Revise stream ioctl support.
The mu_stream_ioctl function gets two argument that identify the ioctl in question: "family", which identifies a family of ioctls in question, and "opcode", which indicates the requested operation within that family. * include/mailutils/stream.h: Define ioctl families and opcodes. (mu_stream_ioctl): Change signature. * include/mailutils/sys/stream.h (_mu_stream)<ctl>: Change signature. * include/mailutils/log.h (mu_severity_from_string) (mu_severity_to_string): New protos. * libmailutils/stream/stream.c (mu_stream_ioctl): Change signature. * libmailutils/filter/filter_iconv.c: Rewrite ioctl support. * libmailutils/stream/file_stream.c: Likewise. * libmailutils/stream/fltstream.c: Likewise. * libmailutils/stream/iostream.c: Likewise. * libmailutils/stream/logstream.c: Likewise. * libmailutils/stream/mapfile_stream.c: Likewise. * libmailutils/stream/memory_stream.c: Likewise. * libmailutils/stream/nullstream.c: Likewise. * libmailutils/stream/prog_stream.c: Likewise. * libmailutils/stream/rdcache_stream.c: Likewise. * libmailutils/stream/streamref.c: Likewise. * libmailutils/stream/syslogstream.c: Likewise. * libmailutils/stream/tcp.c: Likewise. * libmailutils/stream/xscript-stream.c: Likewise. * libmu_auth/tls.c: Likewise. * comsat/action.c: Change calls to mu_stream_ioctl. * imap4d/auth_gsasl.c: Likewise. * imap4d/io.c: Likewise. * imap4d/util.c: Likewise. * libmailutils/base/getpass.c: Likewise. * libmailutils/cfg/parser.y: Likewise. * libmailutils/mailbox/body.c: Likewise. * libmailutils/mime/mime.c: Likewise. * libmailutils/stdstream/dbgstream.c: Likewise. * libmailutils/stdstream/strerr.c: Likewise. * libmu_sieve/runtime.c: Likewise. * libmu_sieve/sieve.y: Likewise. * libmu_sieve/util.c: Likewise. * libproto/imap/trace.c: Likewise. * libproto/mailer/smtp_data.c: Likewise. * libproto/mailer/smtp_starttls.c: Likewise. * libproto/mailer/smtp_trace.c: Likewise. * libproto/pop/pop3_stls.c: Likewise. * libproto/pop/pop3_stream.c: Likewise. * libproto/pop/pop3_trace.c: Likewise. * maidag/lmtp.c: Likewise. * mail/source.c: Likewise. * mu/logger.c: Likewise. * pop3d/extra.c: Likewise. * pop3d/retr.c: Likewise. * TODO: Update. * doc/texinfo/nullstream.texi: Update.
Showing
46 changed files
with
835 additions
and
563 deletions
... | @@ -14,6 +14,8 @@ Software Foundation, Inc. | ... | @@ -14,6 +14,8 @@ Software Foundation, Inc. |
14 | 14 | ||
15 | See also mu_rfc2822_in_reply_to. | 15 | See also mu_rfc2822_in_reply_to. |
16 | 16 | ||
17 | * Check id _mu_smtp_trace_disable correctly dereferences streams. | ||
18 | |||
17 | * mail: rewrite I/O support using streams. | 19 | * mail: rewrite I/O support using streams. |
18 | 20 | ||
19 | * re-implement imap4 client (in progress) | 21 | * re-implement imap4 client (in progress) | ... | ... |
... | @@ -396,7 +396,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t msg) | ... | @@ -396,7 +396,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t msg) |
396 | if (mu_wordsplit (stmt, &ws, MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT) | 396 | if (mu_wordsplit (stmt, &ws, MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT) |
397 | && ws.ws_wordc) | 397 | && ws.ws_wordc) |
398 | { | 398 | { |
399 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | 399 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
400 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | ||
400 | if (strcmp (ws.ws_wordv[0], "beep") == 0) | 401 | if (strcmp (ws.ws_wordv[0], "beep") == 0) |
401 | { | 402 | { |
402 | /* FIXME: excess arguments are ignored */ | 403 | /* FIXME: excess arguments are ignored */ |
... | @@ -445,7 +446,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t msg) | ... | @@ -445,7 +446,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t msg) |
445 | locus.mu_line += n; | 446 | locus.mu_line += n; |
446 | } | 447 | } |
447 | fclose (fp); | 448 | fclose (fp); |
448 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | 449 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
450 | MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | ||
449 | free (rcname); | 451 | free (rcname); |
450 | } | 452 | } |
451 | 453 | ... | ... |
... | @@ -51,9 +51,22 @@ with @file{/dev/null}, or @file{/dev/zero}. We refer to these devices | ... | @@ -51,9 +51,22 @@ with @file{/dev/null}, or @file{/dev/zero}. We refer to these devices |
51 | only to illustrate the behavior of @dfn{null streams}.}. | 51 | only to illustrate the behavior of @dfn{null streams}.}. |
52 | 52 | ||
53 | This is the default behavior when reading. It can be altered using | 53 | This is the default behavior when reading. It can be altered using |
54 | the following @dfn{ioctls}. | 54 | the @samp{MU_IOCTL_NULLSTREAM} ioctl. |
55 | 55 | ||
56 | @defvr {ioctl} MU_IOCTL_NULLSTREAM_SET_PATTERN | 56 | @defvr {ioctl} MU_IOCTL_NULLSTREAM |
57 | This ioctl controls various parameters of a null stream. Synopsis: | ||
58 | |||
59 | @example | ||
60 | mu_stream_ioctl (@var{stream}, MU_IOCTL_NULLSTREAM, @var{opcode}, @var{arg}); | ||
61 | @end example | ||
62 | |||
63 | @noindent | ||
64 | where @var{opcode} is the operation code specific to null streams and | ||
65 | @var{arg} is the operation argument. Supported operation codes and | ||
66 | their arguments are discussed below in this document. | ||
67 | @end defvr | ||
68 | |||
69 | @defvr {ioctl opcode} MU_IOCTL_NULLSTREAM_SET_PATTERN | ||
57 | Set the @dfn{pattern} for reads. The argument is a pointer to | 70 | Set the @dfn{pattern} for reads. The argument is a pointer to |
58 | @dfn{struct mu_nullstream_pattern}, defined as: | 71 | @dfn{struct mu_nullstream_pattern}, defined as: |
59 | 72 | ||
... | @@ -78,7 +91,10 @@ are returned cyclically at each read. For example, suppose that | ... | @@ -78,7 +91,10 @@ are returned cyclically at each read. For example, suppose that |
78 | 91 | ||
79 | pat.pattern = "01234567"; | 92 | pat.pattern = "01234567"; |
80 | pat.size = 8; | 93 | pat.size = 8; |
81 | mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, &pat); | 94 | mu_stream_ioctl (str, |
95 | MU_IOCTL_NULLSTREAM, | ||
96 | MU_IOCTL_NULLSTREAM_SET_PATTERN, | ||
97 | &pat); | ||
82 | 98 | ||
83 | mu_stream_read (str, buf, sizeof (buf), &n); | 99 | mu_stream_read (str, buf, sizeof (buf), &n); |
84 | @end smallexample | 100 | @end smallexample |
... | @@ -115,7 +131,10 @@ The default behavior corresponds to the following initialization: | ... | @@ -115,7 +131,10 @@ The default behavior corresponds to the following initialization: |
115 | @group | 131 | @group |
116 | pat.pattern = ""; | 132 | pat.pattern = ""; |
117 | pat.size = 1; | 133 | pat.size = 1; |
118 | mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, &pat); | 134 | mu_stream_ioctl (str, |
135 | MU_IOCTL_NULLSTREAM, | ||
136 | MU_IOCTL_NULLSTREAM_SET_PATTERN, | ||
137 | &pat); | ||
119 | @end group | 138 | @end group |
120 | @end smallexample | 139 | @end smallexample |
121 | 140 | ||
... | @@ -124,7 +143,10 @@ argument causes all subsequent reads from that stream to return @samp{EOF}: | ... | @@ -124,7 +143,10 @@ argument causes all subsequent reads from that stream to return @samp{EOF}: |
124 | 143 | ||
125 | @smallexample | 144 | @smallexample |
126 | @group | 145 | @group |
127 | mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, NULL); | 146 | mu_stream_ioctl (str, |
147 | MU_IOCTL_NULLSTREAM, | ||
148 | MU_IOCTL_NULLSTREAM_SET_PATTERN, | ||
149 | NULL); | ||
128 | @dots{} | 150 | @dots{} |
129 | rc = mu_stream_read (str, buf, sizeof (buf), &n); | 151 | rc = mu_stream_read (str, buf, sizeof (buf), &n); |
130 | 152 | ||
... | @@ -134,7 +156,7 @@ argument causes all subsequent reads from that stream to return @samp{EOF}: | ... | @@ -134,7 +156,7 @@ argument causes all subsequent reads from that stream to return @samp{EOF}: |
134 | @end smallexample | 156 | @end smallexample |
135 | @end defvr | 157 | @end defvr |
136 | 158 | ||
137 | @defvr {ioctl} MU_IOCTL_NULLSTREAM_SET_PATCLASS | 159 | @defvr {ioctl opcode} MU_IOCTL_NULLSTREAM_SET_PATCLASS |
138 | Set read pattern in terms of @dfn{C character classes} | 160 | Set read pattern in terms of @dfn{C character classes} |
139 | (@FIXME-pxref{C character classes}). Argument is a pointer | 161 | (@FIXME-pxref{C character classes}). Argument is a pointer |
140 | to an integer containing a bitwise @samp{OR} of the desired | 162 | to an integer containing a bitwise @samp{OR} of the desired |
... | @@ -143,7 +165,10 @@ the following code: | ... | @@ -143,7 +165,10 @@ the following code: |
143 | 165 | ||
144 | @smallexample | 166 | @smallexample |
145 | int class = MU_CTYPE_DIGIT|MU_CTYPE_XLETR; | 167 | int class = MU_CTYPE_DIGIT|MU_CTYPE_XLETR; |
146 | mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATCLASS, &class); | 168 | mu_stream_ioctl (str, |
169 | MU_IOCTL_NULLSTREAM, | ||
170 | MU_IOCTL_NULLSTREAM_SET_PATCLASS, | ||
171 | &class); | ||
147 | @end smallexample | 172 | @end smallexample |
148 | 173 | ||
149 | @noindent | 174 | @noindent |
... | @@ -157,7 +182,7 @@ initializes the read pattern to the following string: | ... | @@ -157,7 +182,7 @@ initializes the read pattern to the following string: |
157 | Two ioctls are provided to control the @dfn{size} of a null stream | 182 | Two ioctls are provided to control the @dfn{size} of a null stream |
158 | available to seek and read operations. | 183 | available to seek and read operations. |
159 | 184 | ||
160 | @defvr {ioctl} MU_IOCTL_NULLSTREAM_SETSIZE | 185 | @defvr {ioctl opcode} MU_IOCTL_NULLSTREAM_SETSIZE |
161 | Limit the addressable size of a null stream. Argument is a pointer | 186 | Limit the addressable size of a null stream. Argument is a pointer |
162 | to @samp{mu_off_t} object specifying the new size. The example below | 187 | to @samp{mu_off_t} object specifying the new size. The example below |
163 | limits the stream size to 32 bytes: | 188 | limits the stream size to 32 bytes: |
... | @@ -165,7 +190,10 @@ limits the stream size to 32 bytes: | ... | @@ -165,7 +190,10 @@ limits the stream size to 32 bytes: |
165 | @smallexample | 190 | @smallexample |
166 | @group | 191 | @group |
167 | mu_off_t limit = 32; | 192 | mu_off_t limit = 32; |
168 | mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SETSIZE, &limit); | 193 | mu_stream_ioctl (str, |
194 | MU_IOCTL_NULLSTREAM, | ||
195 | MU_IOCTL_NULLSTREAM_SETSIZE, | ||
196 | &limit); | ||
169 | @end group | 197 | @end group |
170 | @end smallexample | 198 | @end smallexample |
171 | @end defvr | 199 | @end defvr |
... | @@ -181,7 +209,7 @@ Setting the stream size to @samp{0} causes all subsequent reads from | ... | @@ -181,7 +209,7 @@ Setting the stream size to @samp{0} causes all subsequent reads from |
181 | that stream to return @samp{EOF}. The similar effect has the | 209 | that stream to return @samp{EOF}. The similar effect has the |
182 | @samp{MU_IOCTL_NULLSTREAM_SET_PATTERN} ioctl with the @samp{NULL} argument. | 210 | @samp{MU_IOCTL_NULLSTREAM_SET_PATTERN} ioctl with the @samp{NULL} argument. |
183 | 211 | ||
184 | @defvr {ioctl} MU_IOCTL_NULLSTREAM_CLRSIZE | 212 | @defvr {ioctl opcode} MU_IOCTL_NULLSTREAM_CLRSIZE |
185 | Cancel the size limitation imposed by a previous | 213 | Cancel the size limitation imposed by a previous |
186 | @samp{MU_IOCTL_NULLSTREAM_SETSIZE} ioctl or a call to | 214 | @samp{MU_IOCTL_NULLSTREAM_SETSIZE} ioctl or a call to |
187 | @samp{mu_stream_truncate}. Argument must be @samp{NULL}. | 215 | @samp{mu_stream_truncate}. Argument must be @samp{NULL}. | ... | ... |
... | @@ -111,7 +111,8 @@ auth_gsasl (struct imap4d_auth *ap) | ... | @@ -111,7 +111,8 @@ auth_gsasl (struct imap4d_auth *ap) |
111 | { | 111 | { |
112 | mu_stream_t stream[2], newstream[2]; | 112 | mu_stream_t stream[2], newstream[2]; |
113 | 113 | ||
114 | rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream); | 114 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, |
115 | stream); | ||
115 | if (rc) | 116 | if (rc) |
116 | { | 117 | { |
117 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", | 118 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", |
... | @@ -157,7 +158,8 @@ auth_gsasl (struct imap4d_auth *ap) | ... | @@ -157,7 +158,8 @@ auth_gsasl (struct imap4d_auth *ap) |
157 | mu_stream_unref (stream[0]); | 158 | mu_stream_unref (stream[0]); |
158 | mu_stream_unref (stream[1]); | 159 | mu_stream_unref (stream[1]); |
159 | 160 | ||
160 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, newstream); | 161 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, |
162 | MU_IOCTL_OP_SET, newstream); | ||
161 | if (rc) | 163 | if (rc) |
162 | { | 164 | { |
163 | mu_error (_("%s failed when it should not: %s"), | 165 | mu_error (_("%s failed when it should not: %s"), | ... | ... |
... | @@ -83,7 +83,7 @@ imap4d_init_tls_server () | ... | @@ -83,7 +83,7 @@ imap4d_init_tls_server () |
83 | mu_stream_t tlsstream, stream[2]; | 83 | mu_stream_t tlsstream, stream[2]; |
84 | int rc; | 84 | int rc; |
85 | 85 | ||
86 | rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream); | 86 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, stream); |
87 | if (rc) | 87 | if (rc) |
88 | { | 88 | { |
89 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", | 89 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", |
... | @@ -103,7 +103,7 @@ imap4d_init_tls_server () | ... | @@ -103,7 +103,7 @@ imap4d_init_tls_server () |
103 | mu_stream_unref (stream[1]); | 103 | mu_stream_unref (stream[1]); |
104 | stream[0] = stream[1] = tlsstream; | 104 | stream[0] = stream[1] = tlsstream; |
105 | 105 | ||
106 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, stream); | 106 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, stream); |
107 | if (rc) | 107 | if (rc) |
108 | { | 108 | { |
109 | mu_error (_("%s failed: %s"), "MU_IOCTL_SET_STREAM", | 109 | mu_error (_("%s failed: %s"), "MU_IOCTL_SET_STREAM", | ... | ... |
... | @@ -683,7 +683,8 @@ set_xscript_level (int xlev) | ... | @@ -683,7 +683,8 @@ set_xscript_level (int xlev) |
683 | return MU_XSCRIPT_NORMAL; | 683 | return MU_XSCRIPT_NORMAL; |
684 | } | 684 | } |
685 | 685 | ||
686 | if (mu_stream_ioctl (iostream, MU_IOCTL_LEVEL, &xlev) == 0) | 686 | if (mu_stream_ioctl (iostream, MU_IOCTL_XSCRIPTSTREAM, |
687 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
687 | return xlev; | 688 | return xlev; |
688 | } | 689 | } |
689 | return 0; | 690 | return 0; | ... | ... |
... | @@ -38,6 +38,9 @@ extern "C" { | ... | @@ -38,6 +38,9 @@ extern "C" { |
38 | int mu_log_stream_create (mu_stream_t *, mu_stream_t); | 38 | int mu_log_stream_create (mu_stream_t *, mu_stream_t); |
39 | int mu_syslog_stream_create (mu_stream_t *, int); | 39 | int mu_syslog_stream_create (mu_stream_t *, int); |
40 | 40 | ||
41 | int mu_severity_from_string (const char *str, unsigned *pn); | ||
42 | int mu_severity_to_string (unsigned n, const char **pstr); | ||
43 | |||
41 | extern char *_mu_severity_str[]; | 44 | extern char *_mu_severity_str[]; |
42 | extern int _mu_severity_num; | 45 | extern int _mu_severity_num; |
43 | 46 | ... | ... |
... | @@ -59,74 +59,83 @@ enum mu_buffer_type | ... | @@ -59,74 +59,83 @@ enum mu_buffer_type |
59 | #define MU_STREAM_IWOTH 0x00008000 | 59 | #define MU_STREAM_IWOTH 0x00008000 |
60 | #define MU_STREAM_IMASK 0x0000F000 | 60 | #define MU_STREAM_IMASK 0x0000F000 |
61 | 61 | ||
62 | #define MU_IOCTL_GET_TRANSPORT 1 | 62 | /* Ioctl families */ |
63 | #define MU_IOCTL_GET_STATUS 2 | 63 | #define MU_IOCTL_TRANSPORT 0 |
64 | #define MU_IOCTL_GET_PID 3 | 64 | #define MU_IOCTL_PROGSTREAM 1 /* Program stream */ |
65 | #define MU_IOCTL_SET_SEEK_LIMITS 4 | 65 | #define MU_IOCTL_SEEK_LIMITS 2 /* Seek limits (get/set), |
66 | #define MU_IOCTL_ABRIDGE_SEEK MU_IOCTL_SET_SEEK_LIMITS | 66 | Arg: mu_off_t[2] */ |
67 | #define MU_IOCTL_GET_SEEK_LIMITS 5 | 67 | #define MU_IOCTL_SUBSTREAM 3 /* Substream (get/set) */ |
68 | #define MU_IOCTL_SET_TRANSPORT 6 | 68 | #define MU_IOCTL_TRANSPORT_BUFFER 4 /* get/set */ |
69 | #define MU_IOCTL_GET_STREAM 7 | 69 | #define MU_IOCTL_ECHO 5 /* get/set */ |
70 | #define MU_IOCTL_SET_STREAM 8 | 70 | #define MU_IOCTL_NULLSTREAM 6 /* Null stream (see below) */ |
71 | 71 | #define MU_IOCTL_LOGSTREAM 7 /* Log stream (see below) */ | |
72 | #define MU_IOCTL_LEVEL 9 | 72 | #define MU_IOCTL_XSCRIPTSTREAM 8 /* Transcript stream (see below) */ |
73 | 73 | ||
74 | #define MU_IOCTL_GET_TRANSPORT_BUFFER 10 | 74 | /* Opcodes common for various families */ |
75 | #define MU_IOCTL_SET_TRANSPORT_BUFFER 11 | 75 | #define MU_IOCTL_OP_GET 0 |
76 | 76 | #define MU_IOCTL_OP_SET 1 | |
77 | #define MU_IOCTL_GET_ECHO 12 | ||
78 | #define MU_IOCTL_SET_ECHO 13 | ||
79 | 77 | ||
80 | /* The following ioctls are for nullstreams only: */ | 78 | /* Opcodes for MU_IOCTL_PROGSTREAM */ |
81 | #define MU_IOCTL_NULLSTREAM_SET_PATTERN 14 | 79 | #define MU_IOCTL_PROG_STATUS 0 |
80 | #define MU_IOCTL_PROG_PID 1 | ||
81 | |||
82 | /* Opcodes for MU_IOCTL_NULLSTREAM */ | ||
82 | /* Set read pattern. | 83 | /* Set read pattern. |
83 | Argument: struct mu_nullstream_pattern *pat. | 84 | Argument: struct mu_nullstream_pattern *pat. |
84 | If pat==NULL, any reads from that stream will return EOF. */ | 85 | If pat==NULL, any reads from that stream will return EOF. */ |
85 | #define MU_IOCTL_NULLSTREAM_SET_PATCLASS 15 | 86 | #define MU_IOCTL_NULLSTREAM_SET_PATTERN 0 |
86 | /* Set pattern class for reads: Argument int *pclass (a class mask | 87 | /* Set pattern class for reads: Argument int *pclass (a class mask |
87 | from mailutils/cctype.h */ | 88 | from mailutils/cctype.h */ |
88 | #define MU_IOCTL_NULLSTREAM_SETSIZE 16 | 89 | #define MU_IOCTL_NULLSTREAM_SET_PATCLASS 1 |
89 | /* Limit stream size. Argument: mu_off_t *psize; */ | 90 | /* Limit stream size. Argument: mu_off_t *psize; */ |
90 | #define MU_IOCTL_NULLSTREAM_CLRSIZE 17 | 91 | #define MU_IOCTL_NULLSTREAM_SETSIZE 2 |
91 | /* Lift the size limit. Argument: NULL */ | 92 | /* Lift the size limit. Argument: NULL */ |
92 | 93 | #define MU_IOCTL_NULLSTREAM_CLRSIZE 3 | |
93 | /* The following are for logstreams */ | 94 | |
94 | /* Get or set logging severity. | 95 | /* Get or set logging severity. |
95 | Arg: unsigned * | 96 | Arg: unsigned * |
96 | */ | 97 | */ |
97 | #define MU_IOCTL_LOGSTREAM_GET_SEVERITY 18 | 98 | #define MU_IOCTL_LOGSTREAM_GET_SEVERITY 0 |
98 | #define MU_IOCTL_LOGSTREAM_SET_SEVERITY 19 | 99 | #define MU_IOCTL_LOGSTREAM_SET_SEVERITY 1 |
99 | /* Get or set locus. | 100 | /* Get or set locus. |
100 | Arg: struct mu_locus * | 101 | Arg: struct mu_locus * |
101 | */ | 102 | */ |
102 | #define MU_IOCTL_LOGSTREAM_GET_LOCUS 20 | 103 | #define MU_IOCTL_LOGSTREAM_GET_LOCUS 2 |
103 | #define MU_IOCTL_LOGSTREAM_SET_LOCUS 21 | 104 | #define MU_IOCTL_LOGSTREAM_SET_LOCUS 3 |
104 | /* Get or set log mode. | 105 | /* Get or set log mode. |
105 | Arg: int * | 106 | Arg: int * |
106 | */ | 107 | */ |
107 | #define MU_IOCTL_LOGSTREAM_GET_MODE 22 | 108 | #define MU_IOCTL_LOGSTREAM_GET_MODE 4 |
108 | #define MU_IOCTL_LOGSTREAM_SET_MODE 23 | 109 | #define MU_IOCTL_LOGSTREAM_SET_MODE 5 |
109 | 110 | ||
110 | /* Advance locus line. | 111 | /* Advance locus line. |
111 | Arg: NULL (increment by 1) | 112 | Arg: NULL (increment by 1) |
112 | int * | 113 | int * |
113 | */ | 114 | */ |
114 | #define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 24 | 115 | #define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 6 |
115 | /* Advance locus column. | 116 | /* Advance locus column. |
116 | Arg: NULL (increment by 1) | 117 | Arg: NULL (increment by 1) |
117 | int * | 118 | int * |
118 | */ | 119 | */ |
119 | #define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL 25 | 120 | #define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL 7 |
120 | 121 | ||
121 | /* Suppress output of messages having severity lower than the | 122 | /* Suppress output of messages having severity lower than the |
122 | given threshold. | 123 | given threshold. |
123 | Arg: int * | 124 | Arg: int * |
124 | */ | 125 | */ |
125 | #define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY 26 | 126 | #define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY 8 |
126 | /* Same as above, but: | 127 | /* Same as above, but: |
127 | Arg: const char * | 128 | Arg: const char * |
128 | */ | 129 | */ |
129 | #define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 27 | 130 | #define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 9 |
131 | |||
132 | /* Opcodes for MU_IOCTL_XSCRIPTSTREAM */ | ||
133 | /* Swap transcript levels. | ||
134 | Arg: int *X | ||
135 | |||
136 | New transcript level is set to *X. Previous level is stored in X. | ||
137 | */ | ||
138 | #define MU_IOCTL_XSCRIPTSTREAM_LEVEL 0 | ||
130 | 139 | ||
131 | #define MU_TRANSPORT_INPUT 0 | 140 | #define MU_TRANSPORT_INPUT 0 |
132 | #define MU_TRANSPORT_OUTPUT 1 | 141 | #define MU_TRANSPORT_OUTPUT 1 |
... | @@ -206,7 +215,7 @@ int mu_stream_writeline (mu_stream_t stream, const char *buf, size_t size); | ... | @@ -206,7 +215,7 @@ int mu_stream_writeline (mu_stream_t stream, const char *buf, size_t size); |
206 | int mu_stream_flush (mu_stream_t stream); | 215 | int mu_stream_flush (mu_stream_t stream); |
207 | int mu_stream_close (mu_stream_t stream); | 216 | int mu_stream_close (mu_stream_t stream); |
208 | int mu_stream_size (mu_stream_t stream, mu_off_t *psize); | 217 | int mu_stream_size (mu_stream_t stream, mu_off_t *psize); |
209 | int mu_stream_ioctl (mu_stream_t stream, int code, void *ptr); | 218 | int mu_stream_ioctl (mu_stream_t stream, int family, int opcode, void *ptr); |
210 | int mu_stream_truncate (mu_stream_t stream, mu_off_t); | 219 | int mu_stream_truncate (mu_stream_t stream, mu_off_t); |
211 | int mu_stream_shutdown (mu_stream_t stream, int how); | 220 | int mu_stream_shutdown (mu_stream_t stream, int how); |
212 | 221 | ... | ... |
... | @@ -60,7 +60,7 @@ struct _mu_stream | ... | @@ -60,7 +60,7 @@ struct _mu_stream |
60 | void (*done) (struct _mu_stream *); | 60 | void (*done) (struct _mu_stream *); |
61 | int (*seek) (struct _mu_stream *, mu_off_t, mu_off_t *); | 61 | int (*seek) (struct _mu_stream *, mu_off_t, mu_off_t *); |
62 | int (*size) (struct _mu_stream *, mu_off_t *); | 62 | int (*size) (struct _mu_stream *, mu_off_t *); |
63 | int (*ctl) (struct _mu_stream *, int, void *); | 63 | int (*ctl) (struct _mu_stream *, int, int, void *); |
64 | int (*wait) (struct _mu_stream *, int *, struct timeval *); | 64 | int (*wait) (struct _mu_stream *, int *, struct timeval *); |
65 | int (*truncate) (struct _mu_stream *, mu_off_t); | 65 | int (*truncate) (struct _mu_stream *, mu_off_t); |
66 | int (*shutdown) (struct _mu_stream *, int); | 66 | int (*shutdown) (struct _mu_stream *, int); | ... | ... |
... | @@ -40,13 +40,13 @@ mu_getpass (mu_stream_t in, mu_stream_t out, const char *prompt, | ... | @@ -40,13 +40,13 @@ mu_getpass (mu_stream_t in, mu_stream_t out, const char *prompt, |
40 | if (status) | 40 | if (status) |
41 | return status; | 41 | return status; |
42 | mu_stream_flush (out); | 42 | mu_stream_flush (out); |
43 | status = mu_stream_ioctl (in, MU_IOCTL_SET_ECHO, &echo_state); | 43 | status = mu_stream_ioctl (in, MU_IOCTL_ECHO, MU_IOCTL_OP_SET, &echo_state); |
44 | if (status == 0) | 44 | if (status == 0) |
45 | echo_state = 1; | 45 | echo_state = 1; |
46 | status = mu_stream_getline (in, &buf, &size, NULL); | 46 | status = mu_stream_getline (in, &buf, &size, NULL); |
47 | if (echo_state) | 47 | if (echo_state) |
48 | { | 48 | { |
49 | mu_stream_ioctl (in, MU_IOCTL_SET_ECHO, &echo_state); | 49 | mu_stream_ioctl (in, MU_IOCTL_ECHO, MU_IOCTL_OP_SET, &echo_state); |
50 | mu_stream_write (out, "\n", 1, NULL); | 50 | mu_stream_write (out, "\n", 1, NULL); |
51 | } | 51 | } |
52 | if (status == 0) | 52 | if (status == 0) | ... | ... |
... | @@ -395,12 +395,15 @@ mu_cfg_parse (mu_cfg_tree_t **ptree) | ... | @@ -395,12 +395,15 @@ mu_cfg_parse (mu_cfg_tree_t **ptree) |
395 | int save_mode = 0, mode; | 395 | int save_mode = 0, mode; |
396 | struct mu_locus save_locus = { NULL, }; | 396 | struct mu_locus save_locus = { NULL, }; |
397 | 397 | ||
398 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode); | 398 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_GET_MODE, |
399 | &save_mode); | ||
399 | mode = save_mode | MU_LOGMODE_LOCUS; | 400 | mode = save_mode | MU_LOGMODE_LOCUS; |
400 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | 401 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_MODE, |
401 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus); | 402 | &mode); |
403 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_GET_LOCUS, | ||
404 | &save_locus); | ||
402 | 405 | ||
403 | mu_cfg_set_debug ();//FIXME | 406 | mu_cfg_set_debug (); |
404 | _mu_cfg_errcnt = 0; | 407 | _mu_cfg_errcnt = 0; |
405 | 408 | ||
406 | rc = yyparse (); | 409 | rc = yyparse (); |
... | @@ -419,8 +422,10 @@ mu_cfg_parse (mu_cfg_tree_t **ptree) | ... | @@ -419,8 +422,10 @@ mu_cfg_parse (mu_cfg_tree_t **ptree) |
419 | *ptree = tree; | 422 | *ptree = tree; |
420 | } | 423 | } |
421 | 424 | ||
422 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode); | 425 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_MODE, |
423 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus); | 426 | &save_mode); |
427 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
428 | &save_locus); | ||
424 | free (save_locus.mu_file); | 429 | free (save_locus.mu_file); |
425 | 430 | ||
426 | return rc; | 431 | return rc; |
... | @@ -1246,7 +1251,8 @@ parse_param (struct scan_tree_data *sdata, const mu_cfg_node_t *node) | ... | @@ -1246,7 +1251,8 @@ parse_param (struct scan_tree_data *sdata, const mu_cfg_node_t *node) |
1246 | node->tag); | 1251 | node->tag); |
1247 | abort (); | 1252 | abort (); |
1248 | } | 1253 | } |
1249 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, | 1254 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
1255 | MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
1250 | (void*) &node->locus); | 1256 | (void*) &node->locus); |
1251 | if (param->callback (tgt, node->label)) | 1257 | if (param->callback (tgt, node->label)) |
1252 | return 1; | 1258 | return 1; |
... | @@ -1289,7 +1295,8 @@ _scan_tree_helper (const mu_cfg_node_t *node, void *data) | ... | @@ -1289,7 +1295,8 @@ _scan_tree_helper (const mu_cfg_node_t *node, void *data) |
1289 | sec->target = (char*)sdata->target + sec->offset; | 1295 | sec->target = (char*)sdata->target + sec->offset; |
1290 | if (sec->parser) | 1296 | if (sec->parser) |
1291 | { | 1297 | { |
1292 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, | 1298 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
1299 | MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
1293 | (void*) &node->locus); | 1300 | (void*) &node->locus); |
1294 | if (sec->parser (mu_cfg_section_start, node, | 1301 | if (sec->parser (mu_cfg_section_start, node, |
1295 | sec->label, &sec->target, | 1302 | sec->label, &sec->target, |
... | @@ -1355,10 +1362,13 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections, | ... | @@ -1355,10 +1362,13 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections, |
1355 | dat.call_data = data; | 1362 | dat.call_data = data; |
1356 | dat.target = target; | 1363 | dat.target = target; |
1357 | 1364 | ||
1358 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode); | 1365 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
1366 | MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode); | ||
1359 | mode = save_mode | MU_LOGMODE_LOCUS; | 1367 | mode = save_mode | MU_LOGMODE_LOCUS; |
1360 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | 1368 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
1361 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus); | 1369 | MU_IOCTL_LOGSTREAM_SET_MODE, &mode); |
1370 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | ||
1371 | MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus); | ||
1362 | 1372 | ||
1363 | if (push_section (&dat, sections)) | 1373 | if (push_section (&dat, sections)) |
1364 | return 1; | 1374 | return 1; |
... | @@ -1368,8 +1378,10 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections, | ... | @@ -1368,8 +1378,10 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections, |
1368 | mu_cfg_preorder (tree->nodes, &clos); | 1378 | mu_cfg_preorder (tree->nodes, &clos); |
1369 | pop_section (&dat); | 1379 | pop_section (&dat); |
1370 | 1380 | ||
1371 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode); | 1381 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
1372 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus); | 1382 | MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode); |
1383 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | ||
1384 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &save_locus); | ||
1373 | free (save_locus.mu_file); | 1385 | free (save_locus.mu_file); |
1374 | 1386 | ||
1375 | return dat.error; | 1387 | return dat.error; | ... | ... |
... | @@ -384,26 +384,32 @@ _icvt_strerror (mu_stream_t stream, int rc) | ... | @@ -384,26 +384,32 @@ _icvt_strerror (mu_stream_t stream, int rc) |
384 | } | 384 | } |
385 | 385 | ||
386 | static int | 386 | static int |
387 | _icvt_ioctl (mu_stream_t stream, int code, void *ptr) | 387 | _icvt_ioctl (mu_stream_t stream, int code, int opcode, void *ptr) |
388 | { | 388 | { |
389 | struct icvt_stream *s = (struct icvt_stream *)stream; | 389 | struct icvt_stream *s = (struct icvt_stream *)stream; |
390 | mu_transport_t *ptrans; | 390 | mu_transport_t *ptrans; |
391 | 391 | ||
392 | switch (code) | 392 | switch (code) |
393 | { | 393 | { |
394 | case MU_IOCTL_GET_TRANSPORT: | 394 | case MU_IOCTL_TRANSPORT: |
395 | if (!ptr) | 395 | if (!ptr) |
396 | return EINVAL; | 396 | return EINVAL; |
397 | ptrans = ptr; | 397 | switch (opcode) |
398 | ptrans[0] = (mu_transport_t) s->transport; | 398 | { |
399 | ptrans[1] = NULL; | 399 | case MU_IOCTL_OP_GET: |
400 | ptrans = ptr; | ||
401 | ptrans[0] = (mu_transport_t) s->transport; | ||
402 | ptrans[1] = NULL; | ||
403 | break; | ||
404 | |||
405 | default: | ||
406 | return ENOSYS; | ||
407 | } | ||
400 | break; | 408 | break; |
401 | 409 | ||
402 | case MU_IOCTL_GET_STREAM: | 410 | case MU_IOCTL_SUBSTREAM: |
403 | case MU_IOCTL_SET_STREAM: | 411 | case MU_IOCTL_TRANSPORT_BUFFER: |
404 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 412 | return mu_stream_ioctl (s->transport, code, opcode, ptr); |
405 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | ||
406 | return mu_stream_ioctl (s->transport, code, ptr); | ||
407 | 413 | ||
408 | default: | 414 | default: |
409 | return ENOSYS; | 415 | return ENOSYS; | ... | ... |
... | @@ -42,7 +42,7 @@ static int _body_read (mu_stream_t, char *, size_t, size_t *); | ... | @@ -42,7 +42,7 @@ static int _body_read (mu_stream_t, char *, size_t, size_t *); |
42 | static int _body_truncate (mu_stream_t, mu_off_t); | 42 | static int _body_truncate (mu_stream_t, mu_off_t); |
43 | static int _body_size (mu_stream_t, mu_off_t *); | 43 | static int _body_size (mu_stream_t, mu_off_t *); |
44 | static int _body_write (mu_stream_t, const char *, size_t, size_t *); | 44 | static int _body_write (mu_stream_t, const char *, size_t, size_t *); |
45 | static int _body_ioctl (mu_stream_t, int, void *); | 45 | static int _body_ioctl (mu_stream_t, int, int, void *); |
46 | static int _body_seek (mu_stream_t, mu_off_t, mu_off_t *); | 46 | static int _body_seek (mu_stream_t, mu_off_t, mu_off_t *); |
47 | static const char *_body_error_string (mu_stream_t, int); | 47 | static const char *_body_error_string (mu_stream_t, int); |
48 | 48 | ||
... | @@ -289,11 +289,11 @@ _body_error_string (mu_stream_t stream, int rc) | ... | @@ -289,11 +289,11 @@ _body_error_string (mu_stream_t stream, int rc) |
289 | } | 289 | } |
290 | 290 | ||
291 | static int | 291 | static int |
292 | _body_ioctl (mu_stream_t stream, int code, void *ptr) | 292 | _body_ioctl (mu_stream_t stream, int code, int opcode, void *ptr) |
293 | { | 293 | { |
294 | struct _mu_body_stream *str = (struct _mu_body_stream*) stream; | 294 | struct _mu_body_stream *str = (struct _mu_body_stream*) stream; |
295 | mu_body_t body = str->body; | 295 | mu_body_t body = str->body; |
296 | return mu_stream_ioctl (body->fstream, code, ptr); | 296 | return mu_stream_ioctl (body->fstream, code, opcode, ptr); |
297 | } | 297 | } |
298 | 298 | ||
299 | static int | 299 | static int | ... | ... |
... | @@ -759,7 +759,7 @@ _mime_body_stream_read (mu_stream_t stream, char *buf, size_t buflen, size_t *nb | ... | @@ -759,7 +759,7 @@ _mime_body_stream_read (mu_stream_t stream, char *buf, size_t buflen, size_t *nb |
759 | } | 759 | } |
760 | 760 | ||
761 | static int | 761 | static int |
762 | _mime_body_stream_ioctl (mu_stream_t stream, int code, void *arg) | 762 | _mime_body_stream_ioctl (mu_stream_t stream, int code, int opcode, void *arg) |
763 | { | 763 | { |
764 | struct _mime_body_stream *mstr = (struct _mime_body_stream *)stream; | 764 | struct _mime_body_stream *mstr = (struct _mime_body_stream *)stream; |
765 | mu_mime_t mime = mstr->mime; | 765 | mu_mime_t mime = mstr->mime; |
... | @@ -768,18 +768,28 @@ _mime_body_stream_ioctl (mu_stream_t stream, int code, void *arg) | ... | @@ -768,18 +768,28 @@ _mime_body_stream_ioctl (mu_stream_t stream, int code, void *arg) |
768 | 768 | ||
769 | switch (code) | 769 | switch (code) |
770 | { | 770 | { |
771 | case MU_IOCTL_GET_TRANSPORT: | 771 | case MU_IOCTL_TRANSPORT: |
772 | if (!arg) | 772 | if (!arg) |
773 | return EINVAL; | 773 | return EINVAL; |
774 | 774 | switch (opcode) | |
775 | if (mime->nmtp_parts == 0 || mime->cur_offset == 0) | 775 | { |
776 | return EINVAL; | 776 | case MU_IOCTL_OP_GET: |
777 | rc = mu_message_get_streamref (mime->mtp_parts[mime->cur_part]->msg, | 777 | if (mime->nmtp_parts == 0 || mime->cur_offset == 0) |
778 | &msg_stream); | 778 | return EINVAL; |
779 | if (rc) | 779 | rc = mu_message_get_streamref (mime->mtp_parts[mime->cur_part]->msg, |
780 | break; | 780 | &msg_stream); |
781 | rc = mu_stream_ioctl (msg_stream, code, arg); | 781 | if (rc) |
782 | mu_stream_destroy (&msg_stream); | 782 | break; |
783 | rc = mu_stream_ioctl (msg_stream, code, opcode, arg); | ||
784 | mu_stream_destroy (&msg_stream); | ||
785 | break; | ||
786 | |||
787 | case MU_IOCTL_OP_SET: | ||
788 | return ENOSYS; | ||
789 | |||
790 | default: | ||
791 | return EINVAL; | ||
792 | } | ||
783 | break; | 793 | break; |
784 | 794 | ||
785 | default: | 795 | default: | ... | ... |
... | @@ -29,13 +29,14 @@ mu_dbgstream_create (mu_stream_t *pstr, int severity) | ... | @@ -29,13 +29,14 @@ mu_dbgstream_create (mu_stream_t *pstr, int severity) |
29 | int rc; | 29 | int rc; |
30 | mu_transport_t trans[2]; | 30 | mu_transport_t trans[2]; |
31 | 31 | ||
32 | rc = mu_stream_ioctl (mu_strerr, MU_IOCTL_GET_TRANSPORT, trans); | 32 | rc = mu_stream_ioctl (mu_strerr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans); |
33 | if (rc) | 33 | if (rc) |
34 | return rc; | 34 | return rc; |
35 | rc = mu_log_stream_create (pstr, (mu_stream_t) trans[0]); | 35 | rc = mu_log_stream_create (pstr, (mu_stream_t) trans[0]); |
36 | if (rc) | 36 | if (rc) |
37 | return rc; | 37 | return rc; |
38 | mu_stream_ioctl (*pstr, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity); | 38 | mu_stream_ioctl (*pstr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_SEVERITY, |
39 | &severity); | ||
39 | return 0; | 40 | return 0; |
40 | } | 41 | } |
41 | 42 | ... | ... |
... | @@ -117,10 +117,12 @@ mu_stdstream_strerr_setup (int type) | ... | @@ -117,10 +117,12 @@ mu_stdstream_strerr_setup (int type) |
117 | if (mu_log_print_severity) | 117 | if (mu_log_print_severity) |
118 | { | 118 | { |
119 | int mode = MU_LOGMODE_SEVERITY; | 119 | int mode = MU_LOGMODE_SEVERITY; |
120 | mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | 120 | mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM, |
121 | MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | ||
121 | } | 122 | } |
122 | if (mu_log_severity_threshold > MU_LOG_DEBUG) | 123 | if (mu_log_severity_threshold > MU_LOG_DEBUG) |
123 | mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY, | 124 | mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM, |
125 | MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY, | ||
124 | &mu_log_severity_threshold); | 126 | &mu_log_severity_threshold); |
125 | mu_stream_destroy (&mu_strerr); | 127 | mu_stream_destroy (&mu_strerr); |
126 | mu_strerr = str; | 128 | mu_strerr = str; | ... | ... |
... | @@ -204,109 +204,111 @@ fd_error_string (struct _mu_stream *str, int rc) | ... | @@ -204,109 +204,111 @@ fd_error_string (struct _mu_stream *str, int rc) |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | static int | 206 | static int |
207 | fd_ioctl (struct _mu_stream *str, int code, void *ptr) | 207 | fd_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr) |
208 | { | 208 | { |
209 | struct _mu_file_stream *fstr = (struct _mu_file_stream *) str; | 209 | struct _mu_file_stream *fstr = (struct _mu_file_stream *) str; |
210 | mu_transport_t *ptrans; | 210 | mu_transport_t *ptrans; |
211 | 211 | ||
212 | switch (code) | 212 | switch (code) |
213 | { | 213 | { |
214 | case MU_IOCTL_GET_TRANSPORT: | 214 | case MU_IOCTL_TRANSPORT: |
215 | if (!ptr) | 215 | if (!ptr) |
216 | return EINVAL; | 216 | return EINVAL; |
217 | ptrans = ptr; | 217 | switch (opcode) |
218 | ptrans[0] = (mu_transport_t) fstr->fd; | ||
219 | ptrans[1] = NULL; | ||
220 | break; | ||
221 | |||
222 | case MU_IOCTL_SET_TRANSPORT: | ||
223 | if (!ptr) | ||
224 | return EINVAL; | ||
225 | ptrans = ptr; | ||
226 | fstr->fd = (int) ptrans[0]; | ||
227 | break; | ||
228 | |||
229 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | ||
230 | if (!ptr) | ||
231 | return EINVAL; | ||
232 | else | ||
233 | { | 218 | { |
234 | struct mu_buffer_query *qp = ptr; | 219 | case MU_IOCTL_OP_GET: |
235 | return mu_stream_get_buffer (str, qp); | 220 | ptrans = ptr; |
221 | ptrans[0] = (mu_transport_t) fstr->fd; | ||
222 | ptrans[1] = NULL; | ||
223 | break; | ||
224 | |||
225 | case MU_IOCTL_OP_SET: | ||
226 | ptrans = ptr; | ||
227 | fstr->fd = (int) ptrans[0]; | ||
228 | break; | ||
236 | } | 229 | } |
237 | 230 | break; | |
238 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | 231 | |
232 | case MU_IOCTL_TRANSPORT_BUFFER: | ||
239 | if (!ptr) | 233 | if (!ptr) |
240 | return EINVAL; | 234 | return EINVAL; |
241 | else | 235 | else |
242 | { | 236 | { |
243 | struct mu_buffer_query *qp = ptr; | 237 | struct mu_buffer_query *qp = ptr; |
244 | return mu_stream_set_buffer (str, qp->buftype, qp->bufsize); | 238 | switch (opcode) |
239 | { | ||
240 | case MU_IOCTL_OP_GET: | ||
241 | return mu_stream_get_buffer (str, qp); | ||
242 | case MU_IOCTL_OP_SET: | ||
243 | return mu_stream_set_buffer (str, qp->buftype, qp->bufsize); | ||
244 | } | ||
245 | } | 245 | } |
246 | break; | ||
246 | 247 | ||
247 | case MU_IOCTL_SET_ECHO: | 248 | case MU_IOCTL_ECHO: |
248 | if (!ptr) | 249 | if (!ptr) |
249 | return EINVAL; | 250 | return EINVAL; |
250 | else | 251 | switch (opcode) |
251 | { | 252 | { |
252 | int status; | 253 | case MU_IOCTL_OP_GET: |
253 | struct termios t; | 254 | *(int*)ptr = fstr->flags & _MU_FILE_STREAM_ECHO_OFF; |
254 | int state = *(int*)ptr; | 255 | break; |
256 | case MU_IOCTL_OP_SET: | ||
257 | { | ||
258 | int status; | ||
259 | struct termios t; | ||
260 | int state = *(int*)ptr; | ||
255 | #if HAVE_TCGETATTR | 261 | #if HAVE_TCGETATTR |
256 | if (state == 0) | 262 | if (state == 0) |
257 | { | 263 | { |
258 | if (fstr->flags & _MU_FILE_STREAM_ECHO_OFF) | 264 | if (fstr->flags & _MU_FILE_STREAM_ECHO_OFF) |
259 | return 0; | 265 | return 0; |
260 | status = tcgetattr (fstr->fd, &t); | 266 | status = tcgetattr (fstr->fd, &t); |
261 | if (status == 0) | 267 | if (status == 0) |
262 | { | 268 | { |
263 | fstr->echo_state = malloc (sizeof (t)); | 269 | fstr->echo_state = malloc (sizeof (t)); |
264 | if (!fstr->echo_state) | 270 | if (!fstr->echo_state) |
265 | return ENOMEM; | 271 | return ENOMEM; |
266 | memcpy (fstr->echo_state, &t, sizeof (t)); | 272 | memcpy (fstr->echo_state, &t, sizeof (t)); |
267 | 273 | ||
268 | t.c_lflag &= ~(ECHO | ISIG); | 274 | t.c_lflag &= ~(ECHO | ISIG); |
269 | status = tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, &t); | 275 | status = tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, &t); |
270 | if (status == 0) | 276 | if (status == 0) |
271 | fstr->flags |= _MU_FILE_STREAM_ECHO_OFF; | 277 | fstr->flags |= _MU_FILE_STREAM_ECHO_OFF; |
272 | } | 278 | } |
273 | if (status) | 279 | if (status) |
274 | { | 280 | { |
281 | status = errno; | ||
282 | if (fstr->echo_state) | ||
283 | { | ||
284 | free (fstr->echo_state); | ||
285 | fstr->echo_state = NULL; | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | if (!(fstr->flags & _MU_FILE_STREAM_ECHO_OFF)) | ||
292 | return 0; | ||
293 | if (tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, | ||
294 | fstr->echo_state)) | ||
275 | status = errno; | 295 | status = errno; |
276 | if (fstr->echo_state) | 296 | else |
277 | { | 297 | { |
278 | free (fstr->echo_state); | 298 | status = 0; |
279 | fstr->echo_state = NULL; | 299 | free (fstr->echo_state); |
280 | } | 300 | fstr->echo_state = NULL; |
281 | } | 301 | fstr->flags &= ~_MU_FILE_STREAM_ECHO_OFF; |
282 | } | 302 | } |
283 | else | 303 | } |
284 | { | 304 | return status; |
285 | if (!(fstr->flags & _MU_FILE_STREAM_ECHO_OFF)) | ||
286 | return 0; | ||
287 | if (tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, fstr->echo_state)) | ||
288 | status = errno; | ||
289 | else | ||
290 | { | ||
291 | status = 0; | ||
292 | free (fstr->echo_state); | ||
293 | fstr->echo_state = NULL; | ||
294 | fstr->flags &= ~_MU_FILE_STREAM_ECHO_OFF; | ||
295 | } | ||
296 | } | ||
297 | return status; | ||
298 | #else | 305 | #else |
299 | return ENOSYS; | 306 | return ENOSYS; |
300 | #endif | 307 | #endif |
308 | } | ||
301 | } | 309 | } |
302 | |||
303 | case MU_IOCTL_GET_ECHO: | ||
304 | if (!ptr) | ||
305 | return EINVAL; | ||
306 | else | ||
307 | *(int*)ptr = fstr->flags & _MU_FILE_STREAM_ECHO_OFF; | ||
308 | break; | 310 | break; |
309 | 311 | ||
310 | default: | 312 | default: |
311 | return ENOSYS; | 313 | return ENOSYS; |
312 | } | 314 | } | ... | ... |
... | @@ -358,23 +358,29 @@ filter_seek (struct _mu_stream *stream, mu_off_t off, mu_off_t *ppos) | ... | @@ -358,23 +358,29 @@ filter_seek (struct _mu_stream *stream, mu_off_t off, mu_off_t *ppos) |
358 | } | 358 | } |
359 | 359 | ||
360 | static int | 360 | static int |
361 | filter_ctl (struct _mu_stream *stream, int op, void *ptr) | 361 | filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr) |
362 | { | 362 | { |
363 | struct _mu_filter_stream *fs = (struct _mu_filter_stream *)stream; | 363 | struct _mu_filter_stream *fs = (struct _mu_filter_stream *)stream; |
364 | mu_transport_t *ptrans; | ||
365 | 364 | ||
366 | switch (op) | 365 | switch (code) |
367 | { | 366 | { |
368 | case MU_IOCTL_GET_TRANSPORT: | 367 | case MU_IOCTL_TRANSPORT: |
369 | if (!ptr) | 368 | switch (opcode) |
370 | return EINVAL; | 369 | { |
371 | ptrans = ptr; | 370 | case MU_IOCTL_OP_GET: |
372 | ptrans[0] = (mu_transport_t) fs->transport; | 371 | if (!ptr) |
373 | ptrans[1] = NULL; | 372 | return EINVAL; |
374 | break; | 373 | else |
375 | 374 | { | |
375 | mu_transport_t *ptrans = ptr; | ||
376 | ptrans[0] = (mu_transport_t) fs->transport; | ||
377 | ptrans[1] = NULL; | ||
378 | } | ||
379 | break; | ||
380 | } | ||
381 | /* fall through */ | ||
376 | default: | 382 | default: |
377 | return mu_stream_ioctl (fs->transport, op, ptr); | 383 | return mu_stream_ioctl (fs->transport, code, opcode, ptr); |
378 | } | 384 | } |
379 | return 0; | 385 | return 0; |
380 | } | 386 | } | ... | ... |
... | @@ -126,62 +126,70 @@ _iostream_done (struct _mu_stream *str) | ... | @@ -126,62 +126,70 @@ _iostream_done (struct _mu_stream *str) |
126 | } | 126 | } |
127 | 127 | ||
128 | static int | 128 | static int |
129 | _iostream_ctl (struct _mu_stream *str, int op, void *arg) | 129 | _iostream_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
130 | { | 130 | { |
131 | struct _mu_iostream *sp = (struct _mu_iostream *)str; | 131 | struct _mu_iostream *sp = (struct _mu_iostream *)str; |
132 | mu_transport_t *ptrans; | ||
133 | 132 | ||
134 | switch (op) | 133 | switch (code) |
135 | { | 134 | { |
136 | case MU_IOCTL_GET_TRANSPORT: | 135 | case MU_IOCTL_TRANSPORT: |
137 | if (!arg) | ||
138 | return EINVAL; | ||
139 | ptrans = arg; | ||
140 | ptrans[0] = (mu_transport_t) sp->transport[_MU_STREAM_INPUT]; | ||
141 | ptrans[1] = (mu_transport_t) sp->transport[_MU_STREAM_OUTPUT]; | ||
142 | break; | ||
143 | |||
144 | case MU_IOCTL_SET_TRANSPORT: | ||
145 | if (!arg) | ||
146 | return EINVAL; | ||
147 | ptrans = arg; | ||
148 | sp->transport[_MU_STREAM_INPUT] = (mu_stream_t) ptrans[0]; | ||
149 | sp->transport[_MU_STREAM_OUTPUT] = (mu_stream_t) ptrans[1]; | ||
150 | break; | ||
151 | |||
152 | case MU_IOCTL_GET_STREAM: | ||
153 | if (!arg) | 136 | if (!arg) |
154 | return EINVAL; | 137 | return EINVAL; |
155 | else | 138 | else |
156 | { | 139 | { |
157 | mu_stream_t *pstr = arg; | 140 | mu_transport_t *ptrans = arg; |
158 | 141 | ||
159 | pstr[0] = sp->transport[0]; | 142 | switch (opcode) |
160 | mu_stream_ref (pstr[0]); | 143 | { |
161 | pstr[1] = sp->transport[1]; | 144 | case MU_IOCTL_OP_GET: |
162 | mu_stream_ref (pstr[1]); | 145 | ptrans[0] = (mu_transport_t) sp->transport[_MU_STREAM_INPUT]; |
146 | ptrans[1] = (mu_transport_t) sp->transport[_MU_STREAM_OUTPUT]; | ||
147 | break; | ||
148 | |||
149 | case MU_IOCTL_OP_SET: | ||
150 | ptrans = arg; | ||
151 | sp->transport[_MU_STREAM_INPUT] = (mu_stream_t) ptrans[0]; | ||
152 | sp->transport[_MU_STREAM_OUTPUT] = (mu_stream_t) ptrans[1]; | ||
153 | break; | ||
154 | |||
155 | default: | ||
156 | return EINVAL; | ||
157 | } | ||
163 | } | 158 | } |
164 | break; | 159 | break; |
165 | 160 | ||
166 | case MU_IOCTL_SET_STREAM: | 161 | case MU_IOCTL_SUBSTREAM: |
167 | if (!arg) | 162 | if (!arg) |
168 | return EINVAL; | 163 | return EINVAL; |
169 | else | 164 | else |
170 | { | 165 | { |
171 | mu_stream_t *pstr = arg; | 166 | mu_stream_t *pstr = arg; |
167 | switch (opcode) | ||
168 | { | ||
169 | case MU_IOCTL_OP_GET: | ||
170 | pstr[0] = sp->transport[0]; | ||
171 | mu_stream_ref (pstr[0]); | ||
172 | pstr[1] = sp->transport[1]; | ||
173 | mu_stream_ref (pstr[1]); | ||
174 | break; | ||
175 | |||
176 | case MU_IOCTL_OP_SET: | ||
177 | mu_stream_unref (sp->transport[0]); | ||
178 | sp->transport[0] = pstr[0]; | ||
179 | mu_stream_ref (sp->transport[0]); | ||
180 | |||
181 | mu_stream_unref (sp->transport[1]); | ||
182 | sp->transport[1] = pstr[1]; | ||
183 | mu_stream_ref (sp->transport[1]); | ||
184 | break; | ||
172 | 185 | ||
173 | mu_stream_unref (sp->transport[0]); | 186 | default: |
174 | sp->transport[0] = pstr[0]; | 187 | return EINVAL; |
175 | mu_stream_ref (sp->transport[0]); | 188 | } |
176 | |||
177 | mu_stream_unref (sp->transport[1]); | ||
178 | sp->transport[1] = pstr[1]; | ||
179 | mu_stream_ref (sp->transport[1]); | ||
180 | } | 189 | } |
181 | break; | 190 | break; |
182 | 191 | ||
183 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 192 | case MU_IOCTL_TRANSPORT_BUFFER: |
184 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | ||
185 | if (!arg) | 193 | if (!arg) |
186 | return EINVAL; | 194 | return EINVAL; |
187 | else | 195 | else |
... | @@ -189,7 +197,7 @@ _iostream_ctl (struct _mu_stream *str, int op, void *arg) | ... | @@ -189,7 +197,7 @@ _iostream_ctl (struct _mu_stream *str, int op, void *arg) |
189 | struct mu_buffer_query *qp = arg; | 197 | struct mu_buffer_query *qp = arg; |
190 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || !sp->transport[qp->type]) | 198 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || !sp->transport[qp->type]) |
191 | return EINVAL; | 199 | return EINVAL; |
192 | return mu_stream_ioctl (sp->transport[qp->type], op, arg); | 200 | return mu_stream_ioctl (sp->transport[qp->type], code, opcode, arg); |
193 | } | 201 | } |
194 | 202 | ||
195 | default: | 203 | default: | ... | ... |
... | @@ -213,7 +213,8 @@ _log_write (struct _mu_stream *str, const char *buf, size_t size, | ... | @@ -213,7 +213,8 @@ _log_write (struct _mu_stream *str, const char *buf, size_t size, |
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | mu_stream_ioctl (sp->transport, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity); | 216 | mu_stream_ioctl (sp->transport, MU_IOCTL_LOGSTREAM, |
217 | MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity); | ||
217 | 218 | ||
218 | if (logmode & MU_LOGMODE_LOCUS) | 219 | if (logmode & MU_LOGMODE_LOCUS) |
219 | { | 220 | { |
... | @@ -278,123 +279,139 @@ _log_setbuf_hook (mu_stream_t str, enum mu_buffer_type type, size_t size) | ... | @@ -278,123 +279,139 @@ _log_setbuf_hook (mu_stream_t str, enum mu_buffer_type type, size_t size) |
278 | } | 279 | } |
279 | 280 | ||
280 | static int | 281 | static int |
281 | _log_ctl (struct _mu_stream *str, int op, void *arg) | 282 | _log_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
282 | { | 283 | { |
283 | struct _mu_log_stream *sp = (struct _mu_log_stream *)str; | 284 | struct _mu_log_stream *sp = (struct _mu_log_stream *)str; |
284 | mu_transport_t *ptrans; | ||
285 | 285 | ||
286 | switch (op) | 286 | switch (code) |
287 | { | 287 | { |
288 | case MU_IOCTL_GET_TRANSPORT: | 288 | case MU_IOCTL_TRANSPORT: |
289 | if (!arg) | 289 | if (!arg) |
290 | return EINVAL; | 290 | return EINVAL; |
291 | ptrans = arg; | 291 | else |
292 | ptrans[0] = (mu_transport_t) sp->transport; | 292 | { |
293 | ptrans[1] = NULL; | 293 | mu_transport_t *ptrans = arg; |
294 | break; | 294 | switch (opcode) |
295 | 295 | { | |
296 | case MU_IOCTL_SET_TRANSPORT: | 296 | case MU_IOCTL_OP_GET: |
297 | if (!arg) | 297 | ptrans[0] = (mu_transport_t) sp->transport; |
298 | return EINVAL; | 298 | ptrans[1] = NULL; |
299 | ptrans = arg; | 299 | break; |
300 | if (ptrans[0]) | 300 | |
301 | sp->transport = (mu_stream_t) ptrans[0]; | 301 | case MU_IOCTL_OP_SET: |
302 | ptrans = arg; | ||
303 | if (ptrans[0]) | ||
304 | sp->transport = (mu_stream_t) ptrans[0]; | ||
305 | break; | ||
306 | |||
307 | default: | ||
308 | return EINVAL; | ||
309 | } | ||
310 | } | ||
302 | break; | 311 | break; |
303 | 312 | ||
304 | case MU_IOCTL_LOGSTREAM_GET_SEVERITY: | 313 | case MU_IOCTL_LOGSTREAM: |
305 | if (!arg) | 314 | switch (opcode) |
306 | return EINVAL; | 315 | { |
307 | *(unsigned*)arg = sp->severity; | 316 | case MU_IOCTL_LOGSTREAM_GET_SEVERITY: |
308 | break; | 317 | if (!arg) |
318 | return EINVAL; | ||
319 | *(unsigned*)arg = sp->severity; | ||
320 | break; | ||
309 | 321 | ||
310 | case MU_IOCTL_LOGSTREAM_SET_SEVERITY: | 322 | case MU_IOCTL_LOGSTREAM_SET_SEVERITY: |
311 | if (!arg) | 323 | if (!arg) |
312 | return EINVAL; | 324 | return EINVAL; |
313 | if (*(unsigned*)arg >= _mu_severity_num) | 325 | if (*(unsigned*)arg >= _mu_severity_num) |
314 | return EINVAL; | 326 | return EINVAL; |
315 | sp->severity = *(unsigned*)arg; | 327 | sp->severity = *(unsigned*)arg; |
316 | break; | 328 | break; |
317 | 329 | ||
318 | case MU_IOCTL_LOGSTREAM_GET_MODE: | 330 | case MU_IOCTL_LOGSTREAM_GET_MODE: |
319 | if (!arg) | 331 | if (!arg) |
320 | return EINVAL; | 332 | return EINVAL; |
321 | *(int*)arg = sp->logmode; | 333 | *(int*)arg = sp->logmode; |
322 | break; | 334 | break; |
323 | 335 | ||
324 | case MU_IOCTL_LOGSTREAM_SET_MODE: | 336 | case MU_IOCTL_LOGSTREAM_SET_MODE: |
325 | if (!arg) | 337 | if (!arg) |
326 | return EINVAL; | 338 | return EINVAL; |
327 | sp->logmode = *(int*)arg; | 339 | sp->logmode = *(int*)arg; |
328 | break; | 340 | break; |
329 | 341 | ||
330 | case MU_IOCTL_LOGSTREAM_GET_LOCUS: | 342 | case MU_IOCTL_LOGSTREAM_GET_LOCUS: |
331 | { | 343 | if (!arg) |
332 | struct mu_locus *ploc = arg; | 344 | return EINVAL; |
333 | if (!arg) | 345 | else |
334 | return EINVAL; | 346 | { |
335 | if (sp->locus.mu_file) | 347 | struct mu_locus *ploc = arg; |
336 | { | 348 | if (sp->locus.mu_file) |
337 | ploc->mu_file = strdup (sp->locus.mu_file); | 349 | { |
338 | if (!ploc->mu_file) | 350 | ploc->mu_file = strdup (sp->locus.mu_file); |
339 | return ENOMEM; | 351 | if (!ploc->mu_file) |
340 | } | 352 | return ENOMEM; |
341 | else | 353 | } |
342 | ploc->mu_file = NULL; | 354 | else |
343 | ploc->mu_line = sp->locus.mu_line; | 355 | ploc->mu_file = NULL; |
344 | ploc->mu_col = sp->locus.mu_col; | 356 | ploc->mu_line = sp->locus.mu_line; |
345 | break; | 357 | ploc->mu_col = sp->locus.mu_col; |
346 | } | 358 | } |
359 | break; | ||
347 | 360 | ||
348 | case MU_IOCTL_LOGSTREAM_SET_LOCUS: | 361 | case MU_IOCTL_LOGSTREAM_SET_LOCUS: |
349 | { | ||
350 | struct mu_locus *ploc = arg; | ||
351 | if (!arg) | ||
352 | { | 362 | { |
353 | free (sp->locus.mu_file); | 363 | struct mu_locus *ploc = arg; |
354 | sp->locus.mu_file = NULL; | 364 | if (!arg) |
355 | sp->locus.mu_line = 0; | 365 | { |
356 | sp->locus.mu_col = 0; | 366 | free (sp->locus.mu_file); |
367 | sp->locus.mu_file = NULL; | ||
368 | sp->locus.mu_line = 0; | ||
369 | sp->locus.mu_col = 0; | ||
370 | } | ||
371 | else | ||
372 | { | ||
373 | if (ploc->mu_file) | ||
374 | _locus_set_file (&sp->locus, ploc->mu_file, | ||
375 | strlen (ploc->mu_file)); | ||
376 | if (ploc->mu_line) | ||
377 | _locus_set_line (&sp->locus, ploc->mu_line); | ||
378 | if (ploc->mu_col) | ||
379 | _locus_set_col (&sp->locus, ploc->mu_col); | ||
380 | } | ||
381 | break; | ||
357 | } | 382 | } |
358 | else | ||
359 | { | ||
360 | if (ploc->mu_file) | ||
361 | _locus_set_file (&sp->locus, ploc->mu_file, | ||
362 | strlen (ploc->mu_file)); | ||
363 | if (ploc->mu_line) | ||
364 | _locus_set_line (&sp->locus, ploc->mu_line); | ||
365 | if (ploc->mu_col) | ||
366 | _locus_set_col (&sp->locus, ploc->mu_col); | ||
367 | } | ||
368 | break; | ||
369 | } | ||
370 | 383 | ||
371 | case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE: | 384 | case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE: |
372 | if (!arg) | 385 | if (!arg) |
373 | sp->locus.mu_line++; | 386 | sp->locus.mu_line++; |
374 | else | 387 | else |
375 | sp->locus.mu_line += *(int*)arg; | 388 | sp->locus.mu_line += *(int*)arg; |
376 | break; | 389 | break; |
377 | 390 | ||
378 | case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL: | 391 | case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL: |
379 | if (!arg) | 392 | if (!arg) |
380 | sp->locus.mu_col++; | 393 | sp->locus.mu_col++; |
381 | else | 394 | else |
382 | sp->locus.mu_col += *(int*)arg; | 395 | sp->locus.mu_col += *(int*)arg; |
383 | break; | 396 | break; |
384 | 397 | ||
385 | case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY: | 398 | case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY: |
386 | if (!arg) | 399 | if (!arg) |
387 | sp->threshold = MU_LOG_DEBUG; | 400 | sp->threshold = MU_LOG_DEBUG; |
388 | else if (*(unsigned*)arg >= _mu_severity_num) | 401 | else if (*(unsigned*)arg >= _mu_severity_num) |
389 | return MU_ERR_NOENT; | 402 | return MU_ERR_NOENT; |
390 | sp->threshold = *(unsigned*)arg; | 403 | sp->threshold = *(unsigned*)arg; |
391 | break; | 404 | break; |
392 | 405 | ||
393 | case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME: | 406 | case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME: |
394 | if (!arg) | 407 | if (!arg) |
395 | sp->threshold = MU_LOG_DEBUG; | 408 | sp->threshold = MU_LOG_DEBUG; |
396 | else | 409 | else |
397 | return mu_severity_from_string ((const char *) arg, &sp->threshold); | 410 | return mu_severity_from_string ((const char *) arg, &sp->threshold); |
411 | |||
412 | default: | ||
413 | return EINVAL; | ||
414 | } | ||
398 | break; | 415 | break; |
399 | 416 | ||
400 | default: | 417 | default: | ... | ... |
... | @@ -206,30 +206,50 @@ _mapfile_flush (mu_stream_t stream) | ... | @@ -206,30 +206,50 @@ _mapfile_flush (mu_stream_t stream) |
206 | } | 206 | } |
207 | 207 | ||
208 | static int | 208 | static int |
209 | _mapfile_ioctl (struct _mu_stream *str, int code, void *ptr) | 209 | _mapfile_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr) |
210 | { | 210 | { |
211 | struct _mu_mapfile_stream *mfs = (struct _mu_mapfile_stream *) str; | 211 | struct _mu_mapfile_stream *mfs = (struct _mu_mapfile_stream *) str; |
212 | mu_transport_t ptrans[2]; | ||
213 | 212 | ||
214 | switch (code) | 213 | switch (code) |
215 | { | 214 | { |
216 | case MU_IOCTL_GET_TRANSPORT: | 215 | case MU_IOCTL_TRANSPORT: |
217 | ptrans[0] = (mu_transport_t) mfs->fd; | 216 | if (!ptr) |
218 | ptrans[1] = NULL; | 217 | return EINVAL; |
218 | else | ||
219 | { | ||
220 | mu_transport_t *ptrans = ptr; | ||
221 | switch (opcode) | ||
222 | { | ||
223 | case MU_IOCTL_OP_GET: | ||
224 | ptrans[0] = (mu_transport_t) mfs->fd; | ||
225 | ptrans[1] = NULL; | ||
226 | break; | ||
227 | case MU_IOCTL_OP_SET: | ||
228 | return ENOSYS; | ||
229 | default: | ||
230 | return EINVAL; | ||
231 | } | ||
232 | } | ||
219 | break; | 233 | break; |
220 | 234 | ||
221 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 235 | case MU_IOCTL_TRANSPORT_BUFFER: |
222 | { | 236 | if (!ptr) |
223 | struct mu_buffer_query *qp = ptr; | 237 | return EINVAL; |
224 | return mu_stream_get_buffer (str, qp); | 238 | else |
225 | } | 239 | { |
240 | struct mu_buffer_query *qp = ptr; | ||
241 | switch (opcode) | ||
242 | { | ||
243 | case MU_IOCTL_OP_GET: | ||
244 | return mu_stream_get_buffer (str, qp); | ||
245 | case MU_IOCTL_OP_SET: | ||
246 | return mu_stream_set_buffer (str, qp->buftype, qp->bufsize); | ||
247 | default: | ||
248 | return EINVAL; | ||
249 | } | ||
250 | } | ||
251 | break; | ||
226 | 252 | ||
227 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | ||
228 | { | ||
229 | struct mu_buffer_query *qp = ptr; | ||
230 | return mu_stream_set_buffer (str, qp->buftype, qp->bufsize); | ||
231 | } | ||
232 | |||
233 | default: | 253 | default: |
234 | return ENOSYS; | 254 | return ENOSYS; |
235 | } | 255 | } | ... | ... |
... | @@ -144,32 +144,49 @@ _memory_open (mu_stream_t stream) | ... | @@ -144,32 +144,49 @@ _memory_open (mu_stream_t stream) |
144 | } | 144 | } |
145 | 145 | ||
146 | static int | 146 | static int |
147 | _memory_ioctl (struct _mu_stream *stream, int code, void *ptr) | 147 | _memory_ioctl (struct _mu_stream *stream, int code, int opcode, void *ptr) |
148 | { | 148 | { |
149 | struct _mu_memory_stream *mfs = (struct _mu_memory_stream *) stream; | 149 | struct _mu_memory_stream *mfs = (struct _mu_memory_stream *) stream; |
150 | mu_transport_t *ptrans; | ||
151 | 150 | ||
152 | switch (code) | 151 | switch (code) |
153 | { | 152 | { |
154 | case MU_IOCTL_GET_TRANSPORT: | 153 | case MU_IOCTL_TRANSPORT: |
155 | if (!ptr) | 154 | if (!ptr) |
156 | return EINVAL; | 155 | return EINVAL; |
157 | ptrans = ptr; | 156 | else |
158 | ptrans[0] = (mu_transport_t) mfs->ptr; | 157 | { |
159 | ptrans[1] = NULL; | 158 | mu_transport_t *ptrans = ptr; |
159 | switch (code) | ||
160 | { | ||
161 | case MU_IOCTL_OP_GET: | ||
162 | ptrans[0] = (mu_transport_t) mfs->ptr; | ||
163 | ptrans[1] = NULL; | ||
164 | break; | ||
165 | case MU_IOCTL_OP_SET: | ||
166 | return ENOSYS; | ||
167 | default: | ||
168 | return EINVAL; | ||
169 | } | ||
170 | } | ||
171 | break; | ||
172 | |||
173 | case MU_IOCTL_TRANSPORT_BUFFER: | ||
174 | if (!ptr) | ||
175 | return EINVAL; | ||
176 | else | ||
177 | { | ||
178 | struct mu_buffer_query *qp = ptr; | ||
179 | switch (code) | ||
180 | { | ||
181 | case MU_IOCTL_OP_GET: | ||
182 | return mu_stream_get_buffer (stream, qp); | ||
183 | case MU_IOCTL_OP_SET: | ||
184 | return mu_stream_set_buffer (stream, qp->buftype, qp->bufsize); | ||
185 | default: | ||
186 | return EINVAL; | ||
187 | } | ||
188 | } | ||
160 | break; | 189 | break; |
161 | |||
162 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | ||
163 | { | ||
164 | struct mu_buffer_query *qp = ptr; | ||
165 | return mu_stream_get_buffer (stream, qp); | ||
166 | } | ||
167 | |||
168 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | ||
169 | { | ||
170 | struct mu_buffer_query *qp = ptr; | ||
171 | return mu_stream_set_buffer (stream, qp->buftype, qp->bufsize); | ||
172 | } | ||
173 | 190 | ||
174 | default: | 191 | default: |
175 | return ENOSYS; | 192 | return ENOSYS; | ... | ... |
... | @@ -108,11 +108,14 @@ _nullstream_truncate (struct _mu_stream *str, mu_off_t size) | ... | @@ -108,11 +108,14 @@ _nullstream_truncate (struct _mu_stream *str, mu_off_t size) |
108 | } | 108 | } |
109 | 109 | ||
110 | static int | 110 | static int |
111 | _nullstream_ctl (struct _mu_stream *str, int op, void *arg) | 111 | _nullstream_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
112 | { | 112 | { |
113 | struct _mu_nullstream *np = (struct _mu_nullstream *)str; | 113 | struct _mu_nullstream *np = (struct _mu_nullstream *)str; |
114 | 114 | ||
115 | switch (op) | 115 | if (code != MU_IOCTL_NULLSTREAM) |
116 | /* Only this code is supported */ | ||
117 | return ENOSYS; | ||
118 | switch (opcode) | ||
116 | { | 119 | { |
117 | case MU_IOCTL_NULLSTREAM_SET_PATTERN: | 120 | case MU_IOCTL_NULLSTREAM_SET_PATTERN: |
118 | if (!arg) | 121 | if (!arg) | ... | ... |
... | @@ -352,33 +352,54 @@ _prog_flush (mu_stream_t stream) | ... | @@ -352,33 +352,54 @@ _prog_flush (mu_stream_t stream) |
352 | } | 352 | } |
353 | 353 | ||
354 | static int | 354 | static int |
355 | _prog_ioctl (struct _mu_stream *str, int code, void *ptr) | 355 | _prog_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr) |
356 | { | 356 | { |
357 | struct _mu_prog_stream *fstr = (struct _mu_prog_stream *) str; | 357 | struct _mu_prog_stream *fstr = (struct _mu_prog_stream *) str; |
358 | mu_transport_t t[2]; | ||
359 | mu_transport_t *ptrans; | ||
360 | 358 | ||
361 | switch (code) | 359 | switch (code) |
362 | { | 360 | { |
363 | case MU_IOCTL_GET_TRANSPORT: | 361 | case MU_IOCTL_TRANSPORT: |
364 | if (!ptr) | 362 | if (!ptr) |
365 | return EINVAL; | 363 | return EINVAL; |
366 | mu_stream_ioctl (fstr->in, MU_IOCTL_GET_TRANSPORT, t); | 364 | else |
367 | ptrans[0] = t[0]; | 365 | { |
368 | mu_stream_ioctl (fstr->out, MU_IOCTL_GET_TRANSPORT, t); | 366 | mu_transport_t *ptrans = ptr; |
369 | ptrans[1] = t[1]; | 367 | mu_transport_t t[2]; |
370 | break; | ||
371 | 368 | ||
372 | case MU_IOCTL_GET_STATUS: | 369 | switch (opcode) |
373 | if (!ptr) | 370 | { |
374 | return EINVAL; | 371 | case MU_IOCTL_OP_GET: |
375 | *(int*)ptr = fstr->status; | 372 | mu_stream_ioctl (fstr->in, MU_IOCTL_TRANSPORT, |
373 | MU_IOCTL_OP_GET, t); | ||
374 | ptrans[0] = t[0]; | ||
375 | mu_stream_ioctl (fstr->out, MU_IOCTL_TRANSPORT, | ||
376 | MU_IOCTL_OP_GET, t); | ||
377 | ptrans[1] = t[1]; | ||
378 | break; | ||
379 | case MU_IOCTL_OP_SET: | ||
380 | return ENOSYS; | ||
381 | default: | ||
382 | return EINVAL; | ||
383 | } | ||
384 | } | ||
376 | break; | 385 | break; |
377 | 386 | ||
378 | case MU_IOCTL_GET_PID: | 387 | case MU_IOCTL_PROGSTREAM: |
379 | if (!ptr) | 388 | if (!ptr) |
380 | return EINVAL; | 389 | return EINVAL; |
381 | *(int*)ptr = fstr->pid; | 390 | switch (opcode) |
391 | { | ||
392 | case MU_IOCTL_PROG_STATUS: | ||
393 | *(int*)ptr = fstr->status; | ||
394 | break; | ||
395 | |||
396 | case MU_IOCTL_PROG_PID: | ||
397 | *(pid_t*)ptr = fstr->pid; | ||
398 | break; | ||
399 | |||
400 | default: | ||
401 | return EINVAL; | ||
402 | } | ||
382 | break; | 403 | break; |
383 | 404 | ||
384 | default: | 405 | default: | ... | ... |
... | @@ -116,23 +116,34 @@ rdcache_wait (struct _mu_stream *str, int *pflags, struct timeval *tvp) | ... | @@ -116,23 +116,34 @@ rdcache_wait (struct _mu_stream *str, int *pflags, struct timeval *tvp) |
116 | /* FIXME: Truncate? */ | 116 | /* FIXME: Truncate? */ |
117 | 117 | ||
118 | static int | 118 | static int |
119 | rdcache_ioctl (struct _mu_stream *str, int op, void *arg) | 119 | rdcache_ioctl (struct _mu_stream *str, int code, int opcode, void *arg) |
120 | { | 120 | { |
121 | struct _mu_rdcache_stream *sp = (struct _mu_rdcache_stream *) str; | 121 | struct _mu_rdcache_stream *sp = (struct _mu_rdcache_stream *) str; |
122 | mu_transport_t *ptrans; | ||
123 | 122 | ||
124 | switch (op) | 123 | switch (code) |
125 | { | 124 | { |
126 | case MU_IOCTL_GET_TRANSPORT: | 125 | case MU_IOCTL_TRANSPORT: |
127 | if (!arg) | 126 | if (!arg) |
128 | return EINVAL; | 127 | return EINVAL; |
129 | ptrans = arg; | 128 | else |
130 | ptrans[0] = (mu_transport_t) sp->transport; | 129 | { |
131 | ptrans[1] = NULL; | 130 | mu_transport_t *ptrans = arg; |
132 | break; | ||
133 | 131 | ||
134 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 132 | switch (opcode) |
135 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | 133 | { |
134 | case MU_IOCTL_OP_GET: | ||
135 | ptrans[0] = (mu_transport_t) sp->transport; | ||
136 | ptrans[1] = NULL; | ||
137 | break; | ||
138 | case MU_IOCTL_OP_SET: | ||
139 | return ENOSYS; | ||
140 | default: | ||
141 | return EINVAL; | ||
142 | } | ||
143 | } | ||
144 | break; | ||
145 | |||
146 | case MU_IOCTL_TRANSPORT_BUFFER: | ||
136 | if (!arg) | 147 | if (!arg) |
137 | return EINVAL; | 148 | return EINVAL; |
138 | else | 149 | else |
... | @@ -140,7 +151,7 @@ rdcache_ioctl (struct _mu_stream *str, int op, void *arg) | ... | @@ -140,7 +151,7 @@ rdcache_ioctl (struct _mu_stream *str, int op, void *arg) |
140 | struct mu_buffer_query *qp = arg; | 151 | struct mu_buffer_query *qp = arg; |
141 | if (qp->type != MU_TRANSPORT_INPUT || !sp->transport) | 152 | if (qp->type != MU_TRANSPORT_INPUT || !sp->transport) |
142 | return EINVAL; | 153 | return EINVAL; |
143 | return mu_stream_ioctl (sp->transport, op, arg); | 154 | return mu_stream_ioctl (sp->transport, code, opcode, arg); |
144 | } | 155 | } |
145 | 156 | ||
146 | default: | 157 | default: | ... | ... |
... | @@ -1124,11 +1124,11 @@ mu_stream_size (mu_stream_t stream, mu_off_t *psize) | ... | @@ -1124,11 +1124,11 @@ mu_stream_size (mu_stream_t stream, mu_off_t *psize) |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | int | 1126 | int |
1127 | mu_stream_ioctl (mu_stream_t stream, int code, void *ptr) | 1127 | mu_stream_ioctl (mu_stream_t stream, int family, int opcode, void *ptr) |
1128 | { | 1128 | { |
1129 | if (stream->ctl == NULL) | 1129 | if (stream->ctl == NULL) |
1130 | return ENOSYS; | 1130 | return ENOSYS; |
1131 | return stream->ctl (stream, code, ptr); | 1131 | return stream->ctl (stream, family, opcode, ptr); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | int | 1134 | int |
... | @@ -1150,7 +1150,7 @@ mu_stream_wait (mu_stream_t stream, int *pflags, struct timeval *tvp) | ... | @@ -1150,7 +1150,7 @@ mu_stream_wait (mu_stream_t stream, int *pflags, struct timeval *tvp) |
1150 | _stream_init (stream); | 1150 | _stream_init (stream); |
1151 | } | 1151 | } |
1152 | #endif | 1152 | #endif |
1153 | /* Take to acount if we have any buffering. */ | 1153 | /* Take into account if we have any buffering. */ |
1154 | /* FIXME: How about MU_STREAM_READY_WR? */ | 1154 | /* FIXME: How about MU_STREAM_READY_WR? */ |
1155 | if ((*pflags) & MU_STREAM_READY_RD | 1155 | if ((*pflags) & MU_STREAM_READY_RD |
1156 | && stream->buftype != mu_buffer_none | 1156 | && stream->buftype != mu_buffer_none | ... | ... |
... | @@ -201,30 +201,38 @@ _streamref_size (struct _mu_stream *str, mu_off_t *psize) | ... | @@ -201,30 +201,38 @@ _streamref_size (struct _mu_stream *str, mu_off_t *psize) |
201 | } | 201 | } |
202 | 202 | ||
203 | static int | 203 | static int |
204 | _streamref_ctl (struct _mu_stream *str, int op, void *arg) | 204 | _streamref_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
205 | { | 205 | { |
206 | struct _mu_streamref *sp = (struct _mu_streamref *)str; | 206 | struct _mu_streamref *sp = (struct _mu_streamref *)str; |
207 | mu_off_t *lim; | ||
208 | 207 | ||
209 | switch (op) | 208 | switch (code) |
210 | { | 209 | { |
211 | case MU_IOCTL_ABRIDGE_SEEK: | 210 | case MU_IOCTL_SEEK_LIMITS: |
212 | if (!arg) | 211 | if (!arg) |
213 | return EINVAL; | 212 | return EINVAL; |
214 | lim = arg; | 213 | else |
215 | sp->start = lim[0]; | 214 | { |
216 | sp->end = lim[1]; | 215 | mu_off_t *lim; |
217 | return 0; | ||
218 | 216 | ||
219 | case MU_IOCTL_GET_SEEK_LIMITS: | 217 | switch (opcode) |
220 | if (!arg) | 218 | { |
221 | return EINVAL; | 219 | case MU_IOCTL_OP_GET: |
222 | lim = arg; | 220 | lim[0] = sp->start; |
223 | lim[0] = sp->start; | 221 | lim[1] = sp->end; |
224 | lim[1] = sp->end; | 222 | return 0; |
225 | return 0; | 223 | |
224 | case MU_IOCTL_OP_SET: | ||
225 | sp->start = lim[0]; | ||
226 | sp->end = lim[1]; | ||
227 | return 0; | ||
228 | |||
229 | default: | ||
230 | return EINVAL; | ||
231 | } | ||
232 | } | ||
226 | } | 233 | } |
227 | return streamref_return (sp, mu_stream_ioctl (sp->transport, op, arg)); | 234 | return streamref_return (sp, mu_stream_ioctl (sp->transport, code, |
235 | opcode, arg)); | ||
228 | } | 236 | } |
229 | 237 | ||
230 | static int | 238 | static int | ... | ... |
... | @@ -52,12 +52,15 @@ static int sev2prio[] = { | ... | @@ -52,12 +52,15 @@ static int sev2prio[] = { |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int | 54 | static int |
55 | _syslog_ctl (struct _mu_stream *str, int op, void *arg) | 55 | _syslog_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
56 | { | 56 | { |
57 | struct _mu_syslog_stream *sp = (struct _mu_syslog_stream *)str; | 57 | struct _mu_syslog_stream *sp = (struct _mu_syslog_stream *)str; |
58 | unsigned n; | 58 | unsigned n; |
59 | |||
60 | if (code != MU_IOCTL_LOGSTREAM) | ||
61 | return ENOSYS; | ||
59 | 62 | ||
60 | switch (op) | 63 | switch (opcode) |
61 | { | 64 | { |
62 | case MU_IOCTL_LOGSTREAM_GET_SEVERITY: | 65 | case MU_IOCTL_LOGSTREAM_GET_SEVERITY: |
63 | if (!arg) | 66 | if (!arg) | ... | ... |
... | @@ -193,21 +193,32 @@ _tcp_open (mu_stream_t stream) | ... | @@ -193,21 +193,32 @@ _tcp_open (mu_stream_t stream) |
193 | } | 193 | } |
194 | 194 | ||
195 | static int | 195 | static int |
196 | _tcp_ioctl (mu_stream_t stream, int code, void *ptr) | 196 | _tcp_ioctl (mu_stream_t stream, int code, int opcode, void *ptr) |
197 | { | 197 | { |
198 | struct _tcp_instance *tcp = (struct _tcp_instance *)stream; | 198 | struct _tcp_instance *tcp = (struct _tcp_instance *)stream; |
199 | mu_transport_t *ptrans; | ||
200 | 199 | ||
201 | switch (code) | 200 | switch (code) |
202 | { | 201 | { |
203 | case MU_IOCTL_GET_TRANSPORT: | 202 | case MU_IOCTL_TRANSPORT: |
204 | if (!ptr) | 203 | if (!ptr) |
205 | return EINVAL; | 204 | return EINVAL; |
206 | ptrans = ptr; | 205 | else |
207 | ptrans[0] = (mu_transport_t) tcp->fd; | 206 | { |
208 | ptrans[1] = NULL; | 207 | mu_transport_t *ptrans = ptr; |
208 | switch (opcode) | ||
209 | { | ||
210 | case MU_IOCTL_OP_GET: | ||
211 | ptrans[0] = (mu_transport_t) tcp->fd; | ||
212 | ptrans[1] = NULL; | ||
213 | break; | ||
214 | case MU_IOCTL_OP_SET: | ||
215 | return ENOSYS; | ||
216 | default: | ||
217 | return EINVAL; | ||
218 | } | ||
219 | } | ||
209 | break; | 220 | break; |
210 | 221 | ||
211 | default: | 222 | default: |
212 | return ENOSYS; | 223 | return ENOSYS; |
213 | } | 224 | } | ... | ... |
... | @@ -254,106 +254,119 @@ _xscript_size (struct _mu_stream *str, mu_off_t *psize) | ... | @@ -254,106 +254,119 @@ _xscript_size (struct _mu_stream *str, mu_off_t *psize) |
254 | } | 254 | } |
255 | 255 | ||
256 | static int | 256 | static int |
257 | _xscript_ctl (struct _mu_stream *str, int op, void *arg) | 257 | _xscript_ctl (struct _mu_stream *str, int code, int opcode, void *arg) |
258 | { | 258 | { |
259 | struct _mu_xscript_stream *sp = (struct _mu_xscript_stream *)str; | 259 | struct _mu_xscript_stream *sp = (struct _mu_xscript_stream *)str; |
260 | mu_transport_t *ptrans; | ||
261 | int status = 0; | 260 | int status = 0; |
262 | 261 | ||
263 | switch (op) | 262 | switch (code) |
264 | { | 263 | { |
265 | case MU_IOCTL_GET_TRANSPORT: | 264 | case MU_IOCTL_TRANSPORT: |
266 | if (!arg) | 265 | if (!arg) |
267 | return EINVAL; | 266 | return EINVAL; |
268 | ptrans = arg; | ||
269 | ptrans[0] = (mu_transport_t) sp->transport; | ||
270 | ptrans[1] = (mu_transport_t) sp->logstr; | ||
271 | break; | ||
272 | |||
273 | case MU_IOCTL_SET_TRANSPORT: | ||
274 | if (!arg) | ||
275 | return EINVAL; | ||
276 | ptrans = arg; | ||
277 | if (ptrans[0]) | ||
278 | sp->transport = (mu_stream_t) ptrans[0]; | ||
279 | if (ptrans[1]) | ||
280 | sp->logstr = (mu_stream_t) ptrans[1]; | ||
281 | break; | ||
282 | |||
283 | case MU_IOCTL_GET_STREAM: | ||
284 | if (!arg) | ||
285 | return EINVAL; | ||
286 | if (!sp->transport) | ||
287 | status = ENOSYS; | ||
288 | else | 267 | else |
289 | status = mu_stream_ioctl (sp->transport, op, arg); | ||
290 | if (status == EINVAL || status == ENOSYS) | ||
291 | { | 268 | { |
292 | mu_stream_t *pstr = arg; | 269 | mu_transport_t *ptrans = arg; |
293 | 270 | switch (opcode) | |
294 | pstr[0] = sp->transport; | 271 | { |
295 | mu_stream_ref (pstr[0]); | 272 | case MU_IOCTL_OP_GET: |
296 | pstr[1] = sp->transport; | 273 | ptrans[0] = (mu_transport_t) sp->transport; |
297 | mu_stream_ref (pstr[1]); | 274 | ptrans[1] = (mu_transport_t) sp->logstr; |
298 | status = 0; | 275 | break; |
276 | |||
277 | case MU_IOCTL_OP_SET: | ||
278 | ptrans = arg; | ||
279 | if (ptrans[0]) | ||
280 | sp->transport = (mu_stream_t) ptrans[0]; | ||
281 | if (ptrans[1]) | ||
282 | sp->logstr = (mu_stream_t) ptrans[1]; | ||
283 | break; | ||
284 | |||
285 | default: | ||
286 | return EINVAL; | ||
287 | } | ||
299 | } | 288 | } |
300 | break; | 289 | break; |
301 | 290 | ||
302 | case MU_IOCTL_SET_STREAM: | 291 | case MU_IOCTL_SUBSTREAM: |
303 | if (!arg) | 292 | if (!arg) |
304 | return EINVAL; | 293 | return EINVAL; |
305 | if (!sp->transport) | 294 | switch (opcode) |
306 | status = ENOSYS; | ||
307 | else | ||
308 | status = mu_stream_ioctl (sp->transport, op, arg); | ||
309 | if (status == EINVAL || status == ENOSYS) | ||
310 | { | 295 | { |
311 | mu_stream_t *pstr = arg; | 296 | case MU_IOCTL_OP_GET: |
312 | mu_stream_t tmp; | 297 | if (!sp->transport) |
313 | 298 | status = ENOSYS; | |
314 | if (pstr[0] != pstr[1]) | ||
315 | { | ||
316 | status = mu_iostream_create (&tmp, pstr[0], pstr[1]); | ||
317 | if (status) | ||
318 | return status; | ||
319 | sp->flags |= TRANS_IOSTREAM; | ||
320 | } | ||
321 | else | 299 | else |
300 | status = mu_stream_ioctl (sp->transport, code, opcode, arg); | ||
301 | if (status == EINVAL || status == ENOSYS) | ||
322 | { | 302 | { |
323 | tmp = pstr[0]; | 303 | mu_stream_t *pstr = arg; |
324 | mu_stream_ref (tmp); | 304 | |
325 | mu_stream_ref (tmp); | 305 | pstr[0] = sp->transport; |
306 | mu_stream_ref (pstr[0]); | ||
307 | pstr[1] = sp->transport; | ||
308 | mu_stream_ref (pstr[1]); | ||
326 | status = 0; | 309 | status = 0; |
327 | } | 310 | } |
311 | break; | ||
312 | |||
313 | case MU_IOCTL_OP_SET: | ||
314 | if (!sp->transport) | ||
315 | status = ENOSYS; | ||
316 | else | ||
317 | status = mu_stream_ioctl (sp->transport, code, opcode, arg); | ||
318 | if (status == EINVAL || status == ENOSYS) | ||
319 | { | ||
320 | mu_stream_t *pstr = arg; | ||
321 | mu_stream_t tmp; | ||
322 | |||
323 | if (pstr[0] != pstr[1]) | ||
324 | { | ||
325 | status = mu_iostream_create (&tmp, pstr[0], pstr[1]); | ||
326 | if (status) | ||
327 | return status; | ||
328 | sp->flags |= TRANS_IOSTREAM; | ||
329 | } | ||
330 | else | ||
331 | { | ||
332 | tmp = pstr[0]; | ||
333 | mu_stream_ref (tmp); | ||
334 | mu_stream_ref (tmp); | ||
335 | status = 0; | ||
336 | } | ||
328 | 337 | ||
329 | mu_stream_unref (sp->transport); | 338 | mu_stream_unref (sp->transport); |
330 | sp->transport = tmp; | 339 | sp->transport = tmp; |
340 | } | ||
331 | } | 341 | } |
332 | break; | 342 | break; |
333 | 343 | ||
334 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 344 | case MU_IOCTL_TRANSPORT_BUFFER: |
335 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | 345 | if (!sp->transport) |
336 | { | 346 | return EINVAL; |
337 | if (!sp->transport) | 347 | return mu_stream_ioctl (sp->transport, code, opcode, arg); |
338 | return EINVAL; | ||
339 | return mu_stream_ioctl (sp->transport, op, arg); | ||
340 | } | ||
341 | 348 | ||
342 | case MU_IOCTL_LEVEL: | 349 | case MU_IOCTL_XSCRIPTSTREAM: |
343 | if (!arg) | 350 | if (!arg) |
344 | return EINVAL; | 351 | return EINVAL; |
345 | else | 352 | switch (opcode) |
346 | { | 353 | { |
347 | int oldlev = sp->level; | 354 | case MU_IOCTL_XSCRIPTSTREAM_LEVEL: |
348 | sp->level = *(int*)arg; | 355 | { |
349 | sp->flags &= TRANS_DISABLED; | 356 | int oldlev = sp->level; |
350 | sp->flags |= TRANS_READ | TRANS_WRITE; | 357 | sp->level = *(int*)arg; |
351 | *(int*)arg = oldlev; | 358 | sp->flags &= TRANS_DISABLED; |
359 | sp->flags |= TRANS_READ | TRANS_WRITE; | ||
360 | *(int*)arg = oldlev; | ||
361 | } | ||
362 | break; | ||
363 | default: | ||
364 | return EINVAL; | ||
352 | } | 365 | } |
353 | break; | 366 | break; |
354 | 367 | ||
355 | default: | 368 | default: |
356 | return mu_stream_ioctl (sp->transport, op, arg); | 369 | return mu_stream_ioctl (sp->transport, code, opcode, arg); |
357 | } | 370 | } |
358 | return status; | 371 | return status; |
359 | } | 372 | } | ... | ... |
... | @@ -262,19 +262,32 @@ _tls_wr_wait (struct _mu_stream *stream, int *pflags, struct timeval *tvp) | ... | @@ -262,19 +262,32 @@ _tls_wr_wait (struct _mu_stream *stream, int *pflags, struct timeval *tvp) |
262 | } | 262 | } |
263 | 263 | ||
264 | static int | 264 | static int |
265 | _tls_io_ioctl (struct _mu_stream *stream, int op, void *arg) | 265 | _tls_io_ioctl (struct _mu_stream *stream, int code, int opcode, void *arg) |
266 | { | 266 | { |
267 | struct _mu_tls_io_stream *sp = (struct _mu_tls_io_stream *) stream; | 267 | struct _mu_tls_io_stream *sp = (struct _mu_tls_io_stream *) stream; |
268 | mu_transport_t *ptrans; | ||
269 | 268 | ||
270 | switch (op) | 269 | switch (code) |
271 | { | 270 | { |
272 | case MU_IOCTL_GET_TRANSPORT: | 271 | case MU_IOCTL_TRANSPORT: |
273 | if (!arg) | 272 | if (!arg) |
274 | return EINVAL; | 273 | return EINVAL; |
275 | ptrans = arg; | 274 | else |
276 | ptrans[0] = (mu_transport_t) sp->transport; | 275 | { |
277 | ptrans[1] = NULL; | 276 | mu_transport_t *ptrans = arg; |
277 | switch (opcode) | ||
278 | { | ||
279 | case MU_IOCTL_OP_GET: | ||
280 | ptrans[0] = (mu_transport_t) sp->transport; | ||
281 | ptrans[1] = NULL; | ||
282 | break; | ||
283 | |||
284 | case MU_IOCTL_OP_SET: | ||
285 | return ENOSYS; | ||
286 | |||
287 | default: | ||
288 | return EINVAL; | ||
289 | } | ||
290 | } | ||
278 | break; | 291 | break; |
279 | 292 | ||
280 | default: | 293 | default: |
... | @@ -387,7 +400,7 @@ _tls_server_open (mu_stream_t stream) | ... | @@ -387,7 +400,7 @@ _tls_server_open (mu_stream_t stream) |
387 | gnutls_certificate_set_dh_params (x509_cred, dh_params); | 400 | gnutls_certificate_set_dh_params (x509_cred, dh_params); |
388 | 401 | ||
389 | sp->session = initialize_tls_session (); | 402 | sp->session = initialize_tls_session (); |
390 | mu_stream_ioctl (stream, MU_IOCTL_GET_TRANSPORT, transport); | 403 | mu_stream_ioctl (stream, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, transport); |
391 | gnutls_transport_set_ptr2 (sp->session, | 404 | gnutls_transport_set_ptr2 (sp->session, |
392 | (gnutls_transport_ptr) transport[0], | 405 | (gnutls_transport_ptr) transport[0], |
393 | (gnutls_transport_ptr) transport[1]); | 406 | (gnutls_transport_ptr) transport[1]); |
... | @@ -441,7 +454,7 @@ prepare_client_session (mu_stream_t stream) | ... | @@ -441,7 +454,7 @@ prepare_client_session (mu_stream_t stream) |
441 | 454 | ||
442 | gnutls_credentials_set (sp->session, GNUTLS_CRD_CERTIFICATE, x509_cred); | 455 | gnutls_credentials_set (sp->session, GNUTLS_CRD_CERTIFICATE, x509_cred); |
443 | 456 | ||
444 | mu_stream_ioctl (stream, MU_IOCTL_GET_TRANSPORT, transport); | 457 | mu_stream_ioctl (stream, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, transport); |
445 | gnutls_transport_set_ptr2 (sp->session, | 458 | gnutls_transport_set_ptr2 (sp->session, |
446 | (gnutls_transport_ptr) transport[0], | 459 | (gnutls_transport_ptr) transport[0], |
447 | (gnutls_transport_ptr) transport[1]); | 460 | (gnutls_transport_ptr) transport[1]); |
... | @@ -503,54 +516,69 @@ _tls_write (struct _mu_stream *str, const char *buf, size_t bufsize, | ... | @@ -503,54 +516,69 @@ _tls_write (struct _mu_stream *str, const char *buf, size_t bufsize, |
503 | } | 516 | } |
504 | 517 | ||
505 | static int | 518 | static int |
506 | _tls_ioctl (struct _mu_stream *stream, int op, void *arg) | 519 | _tls_ioctl (struct _mu_stream *stream, int code, int opcode, void *arg) |
507 | { | 520 | { |
508 | struct _mu_tls_stream *sp = (struct _mu_tls_stream *) stream; | 521 | struct _mu_tls_stream *sp = (struct _mu_tls_stream *) stream; |
509 | 522 | ||
510 | switch (op) | 523 | switch (opcode) |
511 | { | 524 | { |
512 | case MU_IOCTL_GET_TRANSPORT: | 525 | case MU_IOCTL_TRANSPORT: |
513 | if (!arg) | 526 | switch (opcode) |
514 | return EINVAL; | ||
515 | else | ||
516 | { | 527 | { |
517 | mu_transport_t *ptrans, trans[2]; | 528 | case MU_IOCTL_OP_GET: |
518 | 529 | if (!arg) | |
519 | ptrans = arg; | 530 | return EINVAL; |
520 | mu_stream_ioctl (sp->transport[0], MU_IOCTL_GET_TRANSPORT, trans); | 531 | else |
521 | ptrans[0] = trans[0]; | 532 | { |
522 | mu_stream_ioctl (sp->transport[1], MU_IOCTL_GET_TRANSPORT, trans); | 533 | mu_transport_t *ptrans, trans[2]; |
523 | ptrans[1] = trans[0]; | 534 | |
535 | ptrans = arg; | ||
536 | mu_stream_ioctl (sp->transport[0], MU_IOCTL_TRANSPORT, | ||
537 | MU_IOCTL_OP_GET, trans); | ||
538 | ptrans[0] = trans[0]; | ||
539 | mu_stream_ioctl (sp->transport[1], MU_IOCTL_TRANSPORT, | ||
540 | MU_IOCTL_OP_GET, trans); | ||
541 | ptrans[1] = trans[0]; | ||
542 | } | ||
543 | break; | ||
544 | |||
545 | case MU_IOCTL_OP_SET: | ||
546 | return ENOSYS; | ||
547 | |||
548 | default: | ||
549 | return EINVAL; | ||
524 | } | 550 | } |
525 | break; | 551 | break; |
526 | 552 | ||
527 | case MU_IOCTL_GET_TRANSPORT_BUFFER: | 553 | case MU_IOCTL_TRANSPORT_BUFFER: |
528 | if (!arg) | 554 | if (!arg) |
529 | return EINVAL; | 555 | return EINVAL; |
530 | else | 556 | else |
531 | { | 557 | { |
532 | struct mu_buffer_query *qp = arg; | 558 | struct mu_buffer_query *qp = arg; |
533 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || | 559 | switch (opcode) |
534 | !sp->transport[qp->type]) | 560 | { |
535 | return EINVAL; | 561 | case MU_IOCTL_OP_GET: |
536 | return mu_stream_get_buffer (sp->transport[qp->type], qp); | 562 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || |
537 | } | 563 | !sp->transport[qp->type]) |
538 | 564 | return EINVAL; | |
539 | case MU_IOCTL_SET_TRANSPORT_BUFFER: | 565 | return mu_stream_get_buffer (sp->transport[qp->type], qp); |
540 | if (!arg) | 566 | |
541 | return EINVAL; | 567 | case MU_IOCTL_OP_SET: |
542 | else | 568 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || |
543 | { | 569 | !sp->transport[qp->type]) |
544 | struct mu_buffer_query *qp = arg; | 570 | return EINVAL; |
545 | if (!MU_TRANSPORT_VALID_TYPE (qp->type) || | 571 | return mu_stream_set_buffer (sp->transport[qp->type], |
546 | !sp->transport[qp->type]) | 572 | qp->buftype, qp->bufsize); |
547 | return EINVAL; | 573 | |
548 | return mu_stream_set_buffer (sp->transport[qp->type], | 574 | default: |
549 | qp->buftype, qp->bufsize); | 575 | return EINVAL; |
576 | } | ||
550 | } | 577 | } |
578 | break; | ||
551 | 579 | ||
552 | default: | 580 | default: |
553 | return EINVAL; | 581 | return ENOSYS; |
554 | } | 582 | } |
555 | return 0; | 583 | return 0; |
556 | } | 584 | } | ... | ... |
... | @@ -42,7 +42,8 @@ void | ... | @@ -42,7 +42,8 @@ void |
42 | _mu_sv_instr_source (mu_sieve_machine_t mach) | 42 | _mu_sv_instr_source (mu_sieve_machine_t mach) |
43 | { | 43 | { |
44 | mach->locus.mu_file = (char*) SIEVE_ARG (mach, 0, string); | 44 | mach->locus.mu_file = (char*) SIEVE_ARG (mach, 0, string); |
45 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS, | 45 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM, |
46 | MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
46 | &mach->locus); | 47 | &mach->locus); |
47 | if (INSTR_DEBUG (mach)) | 48 | if (INSTR_DEBUG (mach)) |
48 | mu_sieve_debug (mach, "%4lu: SOURCE %s", | 49 | mu_sieve_debug (mach, "%4lu: SOURCE %s", |
... | @@ -55,7 +56,8 @@ void | ... | @@ -55,7 +56,8 @@ void |
55 | _mu_sv_instr_line (mu_sieve_machine_t mach) | 56 | _mu_sv_instr_line (mu_sieve_machine_t mach) |
56 | { | 57 | { |
57 | mach->locus.mu_line = SIEVE_ARG (mach, 0, line); | 58 | mach->locus.mu_line = SIEVE_ARG (mach, 0, line); |
58 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS, | 59 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM, |
60 | MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
59 | &mach->locus); | 61 | &mach->locus); |
60 | if (INSTR_DEBUG (mach)) | 62 | if (INSTR_DEBUG (mach)) |
61 | mu_sieve_debug (mach, "%4lu: LINE %u", | 63 | mu_sieve_debug (mach, "%4lu: LINE %u", | ... | ... |
... | @@ -536,7 +536,8 @@ mu_sieve_machine_destroy (mu_sieve_machine_t *pmach) | ... | @@ -536,7 +536,8 @@ mu_sieve_machine_destroy (mu_sieve_machine_t *pmach) |
536 | { | 536 | { |
537 | mu_sieve_machine_t mach = *pmach; | 537 | mu_sieve_machine_t mach = *pmach; |
538 | /* FIXME: Restore stream state (locus & mode) */ | 538 | /* FIXME: Restore stream state (locus & mode) */ |
539 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | 539 | mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM, |
540 | MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | ||
540 | mu_stream_destroy (&mach->errstream); | 541 | mu_stream_destroy (&mach->errstream); |
541 | mu_mailer_destroy (&mach->mailer); | 542 | mu_mailer_destroy (&mach->mailer); |
542 | mu_list_do (mach->destr_list, _run_destructor, NULL); | 543 | mu_list_do (mach->destr_list, _run_destructor, NULL); | ... | ... |
... | @@ -192,7 +192,8 @@ mu_sv_compile_error (struct mu_locus *ploc, const char *fmt, ...) | ... | @@ -192,7 +192,8 @@ mu_sv_compile_error (struct mu_locus *ploc, const char *fmt, ...) |
192 | 192 | ||
193 | va_start (ap, fmt); | 193 | va_start (ap, fmt); |
194 | mu_sieve_error_count++; | 194 | mu_sieve_error_count++; |
195 | mu_stream_ioctl (mu_sieve_machine->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS, | 195 | mu_stream_ioctl (mu_sieve_machine->errstream, |
196 | MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_LOCUS, | ||
196 | ploc); | 197 | ploc); |
197 | mu_stream_printf (mu_sieve_machine->errstream, | 198 | mu_stream_printf (mu_sieve_machine->errstream, |
198 | "\033s<%d>\033O<%d>", | 199 | "\033s<%d>\033O<%d>", | ... | ... |
... | @@ -76,7 +76,7 @@ _mu_imap_trace_disable (mu_imap_t imap) | ... | @@ -76,7 +76,7 @@ _mu_imap_trace_disable (mu_imap_t imap) |
76 | if (!xstr) | 76 | if (!xstr) |
77 | return 0; | 77 | return 0; |
78 | 78 | ||
79 | rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream); | 79 | rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream); |
80 | if (rc) | 80 | if (rc) |
81 | return rc; | 81 | return rc; |
82 | 82 | ||
... | @@ -138,7 +138,8 @@ mu_imap_trace_mask (mu_imap_t imap, int op, int lev) | ... | @@ -138,7 +138,8 @@ mu_imap_trace_mask (mu_imap_t imap, int op, int lev) |
138 | int | 138 | int |
139 | _mu_imap_xscript_level (mu_imap_t imap, int xlev) | 139 | _mu_imap_xscript_level (mu_imap_t imap, int xlev) |
140 | { | 140 | { |
141 | if (mu_stream_ioctl (imap->carrier, MU_IOCTL_LEVEL, &xlev) == 0) | 141 | if (mu_stream_ioctl (imap->carrier, MU_IOCTL_XSCRIPTSTREAM, |
142 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
142 | return xlev; | 143 | return xlev; |
143 | return MU_XSCRIPT_NORMAL; | 144 | return MU_XSCRIPT_NORMAL; |
144 | } | 145 | } | ... | ... |
... | @@ -47,15 +47,15 @@ _mu_smtp_data_begin (mu_smtp_t smtp) | ... | @@ -47,15 +47,15 @@ _mu_smtp_data_begin (mu_smtp_t smtp) |
47 | _mu_smtp_xscript_level (smtp, MU_XSCRIPT_PAYLOAD); | 47 | _mu_smtp_xscript_level (smtp, MU_XSCRIPT_PAYLOAD); |
48 | 48 | ||
49 | smtp->savebuf.type = MU_TRANSPORT_OUTPUT; | 49 | smtp->savebuf.type = MU_TRANSPORT_OUTPUT; |
50 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_GET_TRANSPORT_BUFFER, | 50 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER, |
51 | &smtp->savebuf) == 0) | 51 | MU_IOCTL_OP_GET, &smtp->savebuf) == 0) |
52 | { | 52 | { |
53 | struct mu_buffer_query newbuf; | 53 | struct mu_buffer_query newbuf; |
54 | newbuf.type = MU_TRANSPORT_OUTPUT; | 54 | newbuf.type = MU_TRANSPORT_OUTPUT; |
55 | newbuf.buftype = mu_buffer_full; | 55 | newbuf.buftype = mu_buffer_full; |
56 | newbuf.bufsize = 64*1024; | 56 | newbuf.bufsize = 64*1024; |
57 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER, | 57 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER, |
58 | &newbuf) == 0) | 58 | MU_IOCTL_OP_SET, &newbuf) == 0) |
59 | MU_SMTP_FSET (smtp, _MU_SMTP_SAVEBUF); | 59 | MU_SMTP_FSET (smtp, _MU_SMTP_SAVEBUF); |
60 | } | 60 | } |
61 | return 0; | 61 | return 0; |
... | @@ -68,8 +68,8 @@ _mu_smtp_data_end (mu_smtp_t smtp) | ... | @@ -68,8 +68,8 @@ _mu_smtp_data_end (mu_smtp_t smtp) |
68 | /* code is always _MU_STR_EVENT_CLOSE */ | 68 | /* code is always _MU_STR_EVENT_CLOSE */ |
69 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_SAVEBUF)) | 69 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_SAVEBUF)) |
70 | { | 70 | { |
71 | status = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER, | 71 | status = mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER, |
72 | &smtp->savebuf); | 72 | MU_IOCTL_OP_SET, &smtp->savebuf); |
73 | if (status) | 73 | if (status) |
74 | mu_diag_output (MU_DIAG_NOTICE, | 74 | mu_diag_output (MU_DIAG_NOTICE, |
75 | "failed to restore buffer state on SMTP carrier: %s", | 75 | "failed to restore buffer state on SMTP carrier: %s", | ... | ... |
... | @@ -33,7 +33,8 @@ _mu_smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams) | ... | @@ -33,7 +33,8 @@ _mu_smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams) |
33 | int rc; | 33 | int rc; |
34 | 34 | ||
35 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE)) | 35 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE)) |
36 | rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_GET_STREAM, streams); | 36 | rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, |
37 | streams); | ||
37 | else | 38 | else |
38 | { | 39 | { |
39 | streams[0] = smtp->carrier; | 40 | streams[0] = smtp->carrier; |
... | @@ -51,7 +52,8 @@ _mu_smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams) | ... | @@ -51,7 +52,8 @@ _mu_smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams) |
51 | int rc; | 52 | int rc; |
52 | 53 | ||
53 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE)) | 54 | if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE)) |
54 | rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_STREAM, streams); | 55 | rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, |
56 | streams); | ||
55 | else | 57 | else |
56 | { | 58 | { |
57 | mu_stream_t tmp; | 59 | mu_stream_t tmp; | ... | ... |
... | @@ -75,7 +75,7 @@ _mu_smtp_trace_disable (mu_smtp_t smtp) | ... | @@ -75,7 +75,7 @@ _mu_smtp_trace_disable (mu_smtp_t smtp) |
75 | if (!xstr) | 75 | if (!xstr) |
76 | return 0; | 76 | return 0; |
77 | 77 | ||
78 | rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream); | 78 | rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream); |
79 | if (rc) | 79 | if (rc) |
80 | return rc; | 80 | return rc; |
81 | 81 | ||
... | @@ -137,7 +137,8 @@ mu_smtp_trace_mask (mu_smtp_t smtp, int op, int lev) | ... | @@ -137,7 +137,8 @@ mu_smtp_trace_mask (mu_smtp_t smtp, int op, int lev) |
137 | int | 137 | int |
138 | _mu_smtp_xscript_level (mu_smtp_t smtp, int xlev) | 138 | _mu_smtp_xscript_level (mu_smtp_t smtp, int xlev) |
139 | { | 139 | { |
140 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_LEVEL, &xlev) == 0) | 140 | if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_XSCRIPTSTREAM, |
141 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
141 | return xlev; | 142 | return xlev; |
142 | return MU_XSCRIPT_NORMAL; | 143 | return MU_XSCRIPT_NORMAL; |
143 | } | 144 | } | ... | ... |
... | @@ -35,7 +35,8 @@ pop3_get_streams (mu_pop3_t pop3, mu_stream_t *streams) | ... | @@ -35,7 +35,8 @@ pop3_get_streams (mu_pop3_t pop3, mu_stream_t *streams) |
35 | int rc; | 35 | int rc; |
36 | 36 | ||
37 | if (MU_POP3_FISSET (pop3, MU_POP3_TRACE)) | 37 | if (MU_POP3_FISSET (pop3, MU_POP3_TRACE)) |
38 | rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_GET_STREAM, streams); | 38 | rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SUBSTREAM, |
39 | MU_IOCTL_OP_GET, streams); | ||
39 | else | 40 | else |
40 | { | 41 | { |
41 | streams[0] = pop3->carrier; | 42 | streams[0] = pop3->carrier; |
... | @@ -53,7 +54,8 @@ pop3_set_streams (mu_pop3_t pop3, mu_stream_t *streams) | ... | @@ -53,7 +54,8 @@ pop3_set_streams (mu_pop3_t pop3, mu_stream_t *streams) |
53 | int rc; | 54 | int rc; |
54 | 55 | ||
55 | if (MU_POP3_FISSET (pop3, MU_POP3_TRACE)) | 56 | if (MU_POP3_FISSET (pop3, MU_POP3_TRACE)) |
56 | rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SET_STREAM, streams); | 57 | rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SUBSTREAM, |
58 | MU_IOCTL_OP_SET, streams); | ||
57 | else | 59 | else |
58 | { | 60 | { |
59 | mu_stream_t tmp; | 61 | mu_stream_t tmp; | ... | ... |
... | @@ -49,7 +49,8 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags, | ... | @@ -49,7 +49,8 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags, |
49 | { | 49 | { |
50 | mu_transport_t trans[2]; | 50 | mu_transport_t trans[2]; |
51 | 51 | ||
52 | if (mu_stream_ioctl (str, MU_IOCTL_GET_TRANSPORT, trans) == 0) | 52 | if (mu_stream_ioctl (str, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, |
53 | trans) == 0) | ||
53 | { | 54 | { |
54 | struct mu_pop3_stream *sp = (struct mu_pop3_stream *) trans[0]; | 55 | struct mu_pop3_stream *sp = (struct mu_pop3_stream *) trans[0]; |
55 | _mu_pop3_xscript_level (sp->pop3, MU_XSCRIPT_NORMAL); | 56 | _mu_pop3_xscript_level (sp->pop3, MU_XSCRIPT_NORMAL); |
... | @@ -58,7 +59,7 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags, | ... | @@ -58,7 +59,7 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags, |
58 | if (sp->flags & _POP3F_CHBUF) | 59 | if (sp->flags & _POP3F_CHBUF) |
59 | { | 60 | { |
60 | mu_stream_ioctl (sp->pop3->carrier, | 61 | mu_stream_ioctl (sp->pop3->carrier, |
61 | MU_IOCTL_SET_TRANSPORT_BUFFER, | 62 | MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, |
62 | &sp->oldbuf); | 63 | &sp->oldbuf); |
63 | sp->flags = _POP3F_DONE; | 64 | sp->flags = _POP3F_DONE; |
64 | } | 65 | } |
... | @@ -82,7 +83,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream) | ... | @@ -82,7 +83,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream) |
82 | str->event_mask = _MU_STR_EVMASK(_MU_STR_EVENT_SETFLAG); | 83 | str->event_mask = _MU_STR_EVMASK(_MU_STR_EVENT_SETFLAG); |
83 | 84 | ||
84 | sp->oldbuf.type = MU_TRANSPORT_OUTPUT; | 85 | sp->oldbuf.type = MU_TRANSPORT_OUTPUT; |
85 | if (mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_GET_TRANSPORT_BUFFER, | 86 | if (mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_TRANSPORT_BUFFER, |
87 | MU_IOCTL_OP_GET, | ||
86 | &sp->oldbuf) == 0) | 88 | &sp->oldbuf) == 0) |
87 | { | 89 | { |
88 | struct mu_buffer_query newbuf; | 90 | struct mu_buffer_query newbuf; |
... | @@ -91,7 +93,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream) | ... | @@ -91,7 +93,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream) |
91 | newbuf.type = MU_TRANSPORT_OUTPUT; | 93 | newbuf.type = MU_TRANSPORT_OUTPUT; |
92 | newbuf.buftype = mu_buffer_full; | 94 | newbuf.buftype = mu_buffer_full; |
93 | newbuf.bufsize = 64*1024; | 95 | newbuf.bufsize = 64*1024; |
94 | mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER, | 96 | mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_TRANSPORT_BUFFER, |
97 | MU_IOCTL_OP_SET, | ||
95 | &newbuf); | 98 | &newbuf); |
96 | } | 99 | } |
97 | } | 100 | } | ... | ... |
... | @@ -76,7 +76,7 @@ _mu_pop3_trace_disable (mu_pop3_t pop3) | ... | @@ -76,7 +76,7 @@ _mu_pop3_trace_disable (mu_pop3_t pop3) |
76 | if (!xstr) | 76 | if (!xstr) |
77 | return 0; | 77 | return 0; |
78 | 78 | ||
79 | rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream); | 79 | rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream); |
80 | if (rc) | 80 | if (rc) |
81 | return rc; | 81 | return rc; |
82 | 82 | ||
... | @@ -138,7 +138,8 @@ mu_pop3_trace_mask (mu_pop3_t pop3, int op, int lev) | ... | @@ -138,7 +138,8 @@ mu_pop3_trace_mask (mu_pop3_t pop3, int op, int lev) |
138 | int | 138 | int |
139 | _mu_pop3_xscript_level (mu_pop3_t pop3, int xlev) | 139 | _mu_pop3_xscript_level (mu_pop3_t pop3, int xlev) |
140 | { | 140 | { |
141 | if (mu_stream_ioctl (pop3->carrier, MU_IOCTL_LEVEL, &xlev) == 0) | 141 | if (mu_stream_ioctl (pop3->carrier, MU_IOCTL_XSCRIPTSTREAM, |
142 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
142 | return xlev; | 143 | return xlev; |
143 | return MU_XSCRIPT_NORMAL; | 144 | return MU_XSCRIPT_NORMAL; |
144 | } | 145 | } | ... | ... |
... | @@ -385,25 +385,30 @@ cfun_data (mu_stream_t iostr, char *arg) | ... | @@ -385,25 +385,30 @@ cfun_data (mu_stream_t iostr, char *arg) |
385 | 385 | ||
386 | lmtp_reply (iostr, "354", NULL, "Go ahead"); | 386 | lmtp_reply (iostr, "354", NULL, "Go ahead"); |
387 | 387 | ||
388 | if (mu_stream_ioctl (iostr, MU_IOCTL_GET_TRANSPORT_BUFFER, &oldbuf) == 0) | 388 | if (mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, |
389 | MU_IOCTL_OP_GET, &oldbuf) == 0) | ||
389 | { | 390 | { |
390 | struct mu_buffer_query newbuf; | 391 | struct mu_buffer_query newbuf; |
391 | 392 | ||
392 | newbuf.type = MU_TRANSPORT_OUTPUT; | 393 | newbuf.type = MU_TRANSPORT_OUTPUT; |
393 | newbuf.buftype = mu_buffer_full; | 394 | newbuf.buftype = mu_buffer_full; |
394 | newbuf.bufsize = 64*1024; | 395 | newbuf.bufsize = 64*1024; |
395 | if (mu_stream_ioctl (iostr, MU_IOCTL_SET_TRANSPORT_BUFFER, &newbuf)) | 396 | if (mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, |
397 | &newbuf)) | ||
396 | buf_switch = 1; | 398 | buf_switch = 1; |
397 | } | 399 | } |
398 | 400 | ||
399 | if (mu_stream_ioctl (iostr, MU_IOCTL_LEVEL, &xlev) == 0) | 401 | if (mu_stream_ioctl (iostr, MU_IOCTL_XSCRIPTSTREAM, |
402 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
400 | xlev_switch = 1; | 403 | xlev_switch = 1; |
401 | rc = mu_stream_copy (tempstr, flt, 0, NULL); | 404 | rc = mu_stream_copy (tempstr, flt, 0, NULL); |
402 | mu_stream_destroy (&flt); | 405 | mu_stream_destroy (&flt); |
403 | if (xlev_switch) | 406 | if (xlev_switch) |
404 | mu_stream_ioctl (iostr, MU_IOCTL_LEVEL, &xlev); | 407 | mu_stream_ioctl (iostr, MU_IOCTL_XSCRIPTSTREAM, |
408 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev); | ||
405 | if (buf_switch) | 409 | if (buf_switch) |
406 | mu_stream_ioctl (iostr, MU_IOCTL_SET_TRANSPORT_BUFFER, &oldbuf); | 410 | mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, |
411 | &oldbuf); | ||
407 | if (rc) | 412 | if (rc) |
408 | { | 413 | { |
409 | maidag_error (_("copy error: %s"), mu_strerror (rc)); | 414 | maidag_error (_("copy error: %s"), mu_strerror (rc)); | ... | ... |
... | @@ -27,7 +27,8 @@ source_readline (void *closure, int cont MU_ARG_UNUSED) | ... | @@ -27,7 +27,8 @@ source_readline (void *closure, int cont MU_ARG_UNUSED) |
27 | if (getline (&buf, &s, fp) >= 0) | 27 | if (getline (&buf, &s, fp) >= 0) |
28 | { | 28 | { |
29 | mu_rtrim_class (buf, MU_CTYPE_SPACE); | 29 | mu_rtrim_class (buf, MU_CTYPE_SPACE); |
30 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); | 30 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
31 | MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); | ||
31 | return buf; | 32 | return buf; |
32 | } | 33 | } |
33 | 34 | ||
... | @@ -65,10 +66,12 @@ mail_source (int argc, char **argv) | ... | @@ -65,10 +66,12 @@ mail_source (int argc, char **argv) |
65 | locus.mu_file = argv[1]; | 66 | locus.mu_file = argv[1]; |
66 | locus.mu_line = 0; | 67 | locus.mu_line = 0; |
67 | locus.mu_col = 0; | 68 | locus.mu_col = 0; |
68 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | 69 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
70 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | ||
69 | mail_mainloop (source_readline, fp, 0); | 71 | mail_mainloop (source_readline, fp, 0); |
70 | interactive = save_term; | 72 | interactive = save_term; |
71 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | 73 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
74 | MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); | ||
72 | fclose (fp); | 75 | fclose (fp); |
73 | return 0; | 76 | return 0; |
74 | } | 77 | } | ... | ... |
... | @@ -168,10 +168,13 @@ mutool_logger (int argc, char **argv) | ... | @@ -168,10 +168,13 @@ mutool_logger (int argc, char **argv) |
168 | } | 168 | } |
169 | 169 | ||
170 | mode = MU_LOGMODE_SEVERITY | MU_LOGMODE_LOCUS; | 170 | mode = MU_LOGMODE_SEVERITY | MU_LOGMODE_LOCUS; |
171 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | 171 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM, |
172 | MU_IOCTL_LOGSTREAM_SET_MODE, &mode); | ||
172 | if (locus.mu_file) | 173 | if (locus.mu_file) |
173 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); | 174 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM, |
174 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &log_severity); | 175 | MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus); |
176 | mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM, | ||
177 | MU_IOCTL_LOGSTREAM_SET_SEVERITY, &log_severity); | ||
175 | 178 | ||
176 | if (argc) | 179 | if (argc) |
177 | { | 180 | { | ... | ... |
... | @@ -187,7 +187,7 @@ pop3d_init_tls_server () | ... | @@ -187,7 +187,7 @@ pop3d_init_tls_server () |
187 | mu_stream_t tlsstream, stream[2]; | 187 | mu_stream_t tlsstream, stream[2]; |
188 | int rc; | 188 | int rc; |
189 | 189 | ||
190 | rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream); | 190 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, stream); |
191 | if (rc) | 191 | if (rc) |
192 | { | 192 | { |
193 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", | 193 | mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM", |
... | @@ -202,7 +202,7 @@ pop3d_init_tls_server () | ... | @@ -202,7 +202,7 @@ pop3d_init_tls_server () |
202 | return 1; | 202 | return 1; |
203 | 203 | ||
204 | stream[0] = stream[1] = tlsstream; | 204 | stream[0] = stream[1] = tlsstream; |
205 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, stream); | 205 | rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, stream); |
206 | mu_stream_unref (stream[0]); | 206 | mu_stream_unref (stream[0]); |
207 | mu_stream_unref (stream[1]); | 207 | mu_stream_unref (stream[1]); |
208 | if (rc) | 208 | if (rc) |
... | @@ -340,7 +340,8 @@ set_xscript_level (int xlev) | ... | @@ -340,7 +340,8 @@ set_xscript_level (int xlev) |
340 | return MU_XSCRIPT_NORMAL; | 340 | return MU_XSCRIPT_NORMAL; |
341 | } | 341 | } |
342 | 342 | ||
343 | if (mu_stream_ioctl (iostream, MU_IOCTL_LEVEL, &xlev) == 0) | 343 | if (mu_stream_ioctl (iostream, MU_IOCTL_XSCRIPTSTREAM, |
344 | MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0) | ||
344 | return xlev; | 345 | return xlev; |
345 | } | 346 | } |
346 | return 0; | 347 | return 0; | ... | ... |
... | @@ -27,12 +27,12 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t linestr, size_t maxlines) | ... | @@ -27,12 +27,12 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t linestr, size_t maxlines) |
27 | int xscript_level = set_xscript_level (MU_XSCRIPT_PAYLOAD); | 27 | int xscript_level = set_xscript_level (MU_XSCRIPT_PAYLOAD); |
28 | 28 | ||
29 | oldbuf.type = MU_TRANSPORT_OUTPUT; | 29 | oldbuf.type = MU_TRANSPORT_OUTPUT; |
30 | mu_stream_ioctl (iostream, MU_IOCTL_GET_TRANSPORT_BUFFER, | 30 | mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_GET, |
31 | &oldbuf); | 31 | &oldbuf); |
32 | newbuf.type = MU_TRANSPORT_OUTPUT; | 32 | newbuf.type = MU_TRANSPORT_OUTPUT; |
33 | newbuf.buftype = mu_buffer_full; | 33 | newbuf.buftype = mu_buffer_full; |
34 | newbuf.bufsize = pop3d_output_bufsize; | 34 | newbuf.bufsize = pop3d_output_bufsize; |
35 | mu_stream_ioctl (iostream, MU_IOCTL_SET_TRANSPORT_BUFFER, | 35 | mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, |
36 | &newbuf); | 36 | &newbuf); |
37 | /* FIXME: Return code */ | 37 | /* FIXME: Return code */ |
38 | mu_filter_create (&flt, iostream, "DOT", MU_FILTER_ENCODE, | 38 | mu_filter_create (&flt, iostream, "DOT", MU_FILTER_ENCODE, |
... | @@ -56,7 +56,7 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t linestr, size_t maxlines) | ... | @@ -56,7 +56,7 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t linestr, size_t maxlines) |
56 | mu_stream_close (flt); | 56 | mu_stream_close (flt); |
57 | mu_stream_destroy (&flt); | 57 | mu_stream_destroy (&flt); |
58 | 58 | ||
59 | mu_stream_ioctl (iostream, MU_IOCTL_SET_TRANSPORT_BUFFER, | 59 | mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, |
60 | &oldbuf); | 60 | &oldbuf); |
61 | set_xscript_level (xscript_level); | 61 | set_xscript_level (xscript_level); |
62 | } | 62 | } | ... | ... |
-
Please register or sign in to post a comment