Version 1.8.0.0
[socat.git] / xioopts.h
blob4fd22875876511eee478371c4b1b023b3e866294
1 /* source: xioopts.h */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 #ifndef __xioopts_h_included
6 #define __xioopts_h_included 1
8 #define ODESC_END ((void *)0) /* indicates end of actual option array */
9 #define ODESC_DONE ((void *)-1) /* indicates that option has been applied */
10 #define ODESC_ERROR ODESC_DONE /* maybe later */
12 #define XIO_OFFSETOF(x) ((size_t)&((xiosingle_t *)0)->x)
13 #define XIO_SIZEOF(x) (sizeof(((struct single *)0)->x))
15 /* atomic structure for use in the option search table; keep compatible with
16 struct wordent! */
17 struct optname {
18 const char *name;
19 const struct optdesc *desc;
20 } ;
22 /* keep consistent with xiohelp.c:optiontypenames[] ! */
23 enum e_types {
24 TYPE_CONST, /* keyword means a fix value - implies int type */
25 TYPE_BIN, /* raw binary data, length determined by data */
26 TYPE_BOOL, /* value is 0 or 1 (no-value is interpreted as 1) */
27 TYPE_BYTE, /* unsigned char */
29 TYPE_INT, /* int */
30 TYPE_INT_NULL, /* int, or just opt= for no action (instead of default) */
31 TYPE_LONG, /* long */
32 TYPE_STRING, /* char * */
33 TYPE_NAME = TYPE_STRING,
34 TYPE_FILENAME = TYPE_STRING,
35 TYPE_PTRDIFF, /* ptrdiff_t */
37 TYPE_SHORT, /* short */
38 TYPE_SIZE_T, /* size_t */
39 TYPE_SOCKADDR, /* struct sockaddr * */
40 TYPE_UINT, /* unsigned int */
42 TYPE_ULONG, /* unsigned long */
43 TYPE_USHORT, /* unsigned short */
44 TYPE_2BYTE = TYPE_USHORT,
45 TYPE_MODET, /* representation of mode_t */
46 TYPE_GIDT, /* representation of gid_t */
48 TYPE_UIDT, /* representation of uid_t */
49 /*TYPE_FLAG,*/
50 TYPE_INT3, /* int[3] */
51 TYPE_TIMEVAL, /* struct timeval: {long;long;}, seconds and microsec. */
52 TYPE_TIMESPEC, /* struct timespec: {time_t;long;}, seconds and nanosec. */
54 TYPE_DOUBLE, /* double */
55 TYPE_STRING_NULL, /* char *; string or NULL */
56 TYPE_LONGLONG, /* long long */
57 TYPE_OFF32, /* off_t */
59 TYPE_OFF64, /* off64_t */
60 TYPE_INT_INT, /* 2 parameters: first is int, second is int */
61 TYPE_INT_INTP, /* 2 parameters: first is int, second is int* */
62 TYPE_INT_BIN, /* 2 parameters: first is int, second is binary */
64 TYPE_INT_STRING, /* 2 parameters: first is int, second is req string */
65 TYPE_INT_INT_INT, /* 3 params: first and second are int, 3rd is int */
66 TYPE_INT_INT_BIN, /* 3 params: first and second are int, 3rd is binary */
67 TYPE_INT_INT_STRING, /* 3 params: first and second are int, 3rd is string */
68 TYPE_INT_INT_GENERIC, /* 3 params: first and second are int, 3rd is specified by value (dalan syntax) */
70 TYPE_IP4NAME, /* IPv4 hostname or address */
71 TYPE_IP4SOCK, /* IPv4 hostname or address optionally with port */
72 #if HAVE_STRUCT_LINGER
73 TYPE_LINGER, /* struct linger */
74 #endif /* HAVE_STRUCT_LINGER */
75 #if HAVE_STRUCT_IP_MREQ || HAVE_STRUCT_IP_MREQN
76 TYPE_IP_MREQN, /* for struct ip_mreq or struct ip_mreqn */
77 #endif
78 #if HAVE_STRUCT_IP_MREQ_SOURCE
79 TYPE_IP_MREQ_SOURCE, /* for struct ip_mreq_source */
80 #endif
81 #if HAVE_STRUCT_GROUP_SOURCE_REQ
82 TYPE_GROUP_SOURCE_REQ, /* for struct group_source_req */
83 #endif
85 TYPE_GENERIC, /* type is determined from (text) data provided (dalan syntax) */
86 TYPE_OVERFLOW /* marker: beyond last type */
87 } ;
89 enum e_func {
90 OFUNC_NONE, /* no function - should not occur */
91 /* Options to be applied to FD directly */
92 OFUNC_FLAG, /* no function, but bitposition, only with bool; arg1 is mask */
93 OFUNC_FLAG_PATTERN, /* no function, but bitpattern: arg1 is pattern, arg2 is mask */
94 OFUNC_SEEK32, /* lseek(): arg1 is whence (SEEK_SET etc.) */
95 OFUNC_SEEK64, /* lseek64(): arg1 is whence (SEEK_SET etc.) */
96 OFUNC_FCNTL, /* fcntl(, ): arg1 is cmd */
97 OFUNC_IOCTL, /* ioctl(): arg1 of option description is request, arg2
98 is int setrequest */
99 OFUNC_IOCTL_MASK_LONG, /* arg1 is getrequest, arg2 is setrequest:
100 ioctl(arg1, ); |= arg3; ioctl(arg2, ); */
101 OFUNC_IOCTL_GENERIC, /* generic ioctl() (request on cmdline) */
102 OFUNC_SOCKOPT, /* setsockopt() */
103 OFUNC_SOCKOPT_APPEND,/* getsockopt(), append data, setsockopt() */
104 OFUNC_SOCKOPT_GENERIC,/* generic setsockopt() (level, optname on cmdline) */
105 OFUNC_FLOCK, /* flock() */
106 OFUNC_TERMIOS_FLAG, /* a flag in struct termios: major..tcflag, minor..bit
108 OFUNC_TERMIOS_PATTERN, /* a multibit: major..tcflag, minor..pattern,
109 arg3..mask */
110 OFUNC_TERMIOS_VALUE, /* a variable value: major..tcflag, minor..mask, arg3..shift */
111 OFUNC_TERMIOS_CHAR, /* a termios functional character: major..c_cc index */
112 OFUNC_TERMIOS_SPEED, /* termios c_ispeed etc on FreeBSD */
113 OFUNC_TERMIOS_SPEC, /* termios combined modes */
115 OFUNC_EXT, /* with extended file descriptors only */
116 # define OFUNC_XIO OFUNC_EXT
117 OFUNC_SPEC, /* special, i.e. no generalizable function call */
118 OFUNC_OFFSET, /* put a value into xiofile struct; major is offset */
119 OFUNC_OFFSET_MASK, /* set/unset bit pattern in variable */
120 OFUNC_OFFSET_MASKS, /* set pos or neg bit pattern in array[2] */
121 /*OFUNC_APPL,*/ /* special, i.e. application must know which f. */
122 OFUNC_SIGNAL, /* a signal that should be passed to child process */
123 OFUNC_RESOLVER, /* a bit position used on _res.options */
124 OFUNC_IFFLAG, /* interface flag: logical-or a 1bit mask */
125 OFUNC_SET_NAMESPACE, /* set/change Linux namespace */
126 OFUNC_RESET_NAMESPACE, /* set Linux namespace back to default */
127 # define ENABLE_OFUNC
128 # include "xio-streams.h" /* push a POSIX STREAMS module */
129 # undef ENABLE_OFUNC
130 OFUNC_OVERFLOW /* marker: beyond last func */
133 /* for simpler handling of option-to-connection-type relations we define
134 groups. to keep the search for options simple, we allow each option to
135 belong to at most one group only. (we have a dummy GROUP_NONE for those
136 that don't want to belong to any...)
137 The caller of parseopts() specifies per bit pattern a set of groups where it
138 accepts options from.
141 /*- the group bits are:
142 - 000ooooo 00000000 000000uf 0000ssss
143 - ooooo: more detailed description to ssss (e.g., socket family)
144 - ssss: the type of stream, as in stat.h: S_IF...
145 - f: has a named entry in the file system
146 - u: has user and group
148 /* keep consistent with xiohelp.c:addressgroupnames[] ! */
149 /* a dummy group */
150 #define GROUP_NONE 0x00000000
151 #define GROUP_ADDR 0x00000000 /* options that apply to all addresses */
153 #define GROUP_FD 0x00000001 /* everything applyable to a fd */
154 #define GROUP_FIFO 0x00000002
155 #define GROUP_CHR 0x00000004 /* not yet used? */
156 #define GROUP_BLK 0x00000008
157 #define GROUP_REG 0x00000010
158 #define GROUP_FILE GROUP_REG
159 #define GROUP_SOCKET 0x00000020
160 #define GROUP_READLINE 0x00000040
162 #define GROUP_NAMED 0x00000100 /* file system entry */
163 #define GROUP_OPEN 0x00000200 /* flags for open() */
164 #define GROUP_EXEC 0x00000400 /* program or script execution */
165 #define GROUP_FORK 0x00000800 /* communication with forked process */
167 #define GROUP_LISTEN 0x00001000 /* socket in listening mode */
168 #define GROUP_SHELL 0x00002000
169 #define GROUP_CHILD 0x00004000 /* autonom child process */
170 #define GROUP_RETRY 0x00008000 /* when open/connect etc. fails */
171 #define GROUP_TERMIOS 0x00010000
172 #define GROUP_RANGE 0x00020000 /* differs from GROUP_LISTEN */
173 #define GROUP_PTY 0x00040000 /* address pty or exec...,pty */
174 #define GROUP_PARENT 0x00080000 /* for parent of communicating child */
176 #define GROUP_SOCK_UNIX 0x00100000
177 #define GROUP_SOCK_IP4 0x00200000 /* not yet used? */
178 #define GROUP_SOCK_IP6 0x00400000
179 #define GROUP_SOCK_IP (GROUP_SOCK_IP4|GROUP_SOCK_IP6)
180 #define GROUP_INTERFACE 0x00800000
181 #define GROUP_TUN GROUP_INTERFACE
183 #define GROUP_IP_UDP 0x01000000 /* not yet used? */
184 #define GROUP_IP_TCP 0x02000000
185 #define GROUP_IP_SOCKS4 0x04000000
186 #define GROUP_OPENSSL 0x08000000
188 #define GROUP_PROCESS 0x10000000 /* a process related option */
189 #define GROUP_APPL 0x20000000 /* option handled by data loop */
190 #define GROUP_HTTP 0x40000000 /* any HTTP client */
192 /* Keep condition consistent with xio.h:groups_t! */
193 #if WITH_POSIXMQ || WITH_SCTP || WITH_DCCP || WITH_UDPLITE
194 /* The following groups are not expected on systems without uint64_t */
195 #define GROUP_POSIXMQ ((groups_t)0x0100000000ULL)
196 #define GROUP_IP_SCTP ((groups_t)0x0200000000ULL)
197 #define GROUP_IP_DCCP ((groups_t)0x0400000000ULL)
198 #define GROUP_IP_UDPLITE ((groups_t)0x0800000000ULL)
199 #define GROUP_ALL ((groups_t)0x0fffffffffULL) /* OMG... for 32bit systems */
200 #else /* !(WITH_POSIXMQ || WITH_SCTP || WITH_DCCP || WITH_UDPLITE) */
201 #define GROUP_POSIXMQ 0
202 #define GROUP_IP_SCTP 0
203 #define GROUP_IP_DCCP 0
204 #define GROUP_IP_UDPLITE 0
205 #define GROUP_ALL 0xffffffffU
206 #endif /* !(WITH_POSIXMQ || WITH_SCTP || WITH_DCCP || WITH_UDPLITE) */
208 #define GROUP_IPAPP (GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP|GROUP_IP_DCCP|GROUP_IP_UDPLITE) /* true: indicates one of UDP, TCP, SCTP, DCCP, UDPlite */
209 #define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
212 /* no IP multicasts, no error queue yet */
213 /* the only reason for keeping this enum sorted is to help detecting name
214 conflicts. */
215 /* optcode's */
216 enum e_optcode {
217 OPT_ADDRESS_FAMILY = 1,
218 OPT_AI_ADDRCONFIG, /* getaddrinfo() */
219 OPT_AI_PASSIVE, /* getaddrinfo() */
220 OPT_AI_V4MAPPED, /* getaddrinfo() */
221 /* these are not alphabetically, I know... */
222 OPT_B0, /* termios.c_cflag */
223 OPT_B50, /* termios.c_cflag */
224 OPT_B75, /* termios.c_cflag */
225 OPT_B110, /* termios.c_cflag */
226 OPT_B134, /* termios.c_cflag */
227 OPT_B150, /* termios.c_cflag */
228 OPT_B200, /* termios.c_cflag */
229 OPT_B300, /* termios.c_cflag */
230 OPT_B600, /* termios.c_cflag */
231 OPT_B900, /* termios.c_cflag - HP-UX */
232 OPT_B1200, /* termios.c_cflag */
233 OPT_B1800, /* termios.c_cflag */
234 OPT_B2400, /* termios.c_cflag */
235 OPT_B3600, /* termios.c_cflag - HP-UX */
236 OPT_B4800, /* termios.c_cflag */
237 OPT_B7200, /* termios.c_cflag - HP-UX */
238 OPT_B9600, /* termios.c_cflag */
239 OPT_B19200, /* termios.c_cflag */
240 OPT_B38400, /* termios.c_cflag */
241 OPT_B57600, /* termios.c_cflag */
242 OPT_B115200, /* termios.c_cflag */
243 OPT_B230400, /* termios.c_cflag */
244 OPT_B460800, /* termios.c_cflag */
245 OPT_B500000, /* termios.c_cflag */
246 OPT_B576000, /* termios.c_cflag */
247 OPT_B921600, /* termios.c_cflag */
248 OPT_B1000000, /* termios.c_cflag */
249 OPT_B1152000, /* termios.c_cflag */
250 OPT_B1500000, /* termios.c_cflag */
251 OPT_B2000000, /* termios.c_cflag */
252 OPT_B2500000, /* termios.c_cflag */
253 OPT_B3000000, /* termios.c_cflag */
254 OPT_B3500000, /* termios.c_cflag */
255 OPT_B4000000, /* termios.c_cflag */
256 OPT_BACKLOG,
257 OPT_BIND, /* a socket address as character string */
258 OPT_BRKINT, /* termios.c_iflag */
259 #ifdef BSDLY
260 # ifdef BS0
261 OPT_BS0, /* termios.c_oflag */
262 # endif
263 # ifdef BS1
264 OPT_BS1, /* termios.c_oflag */
265 # endif
266 OPT_BSDLY, /* termios.c_oflag */
267 #endif
268 OPT_CHDIR, /* change working directory */
269 OPT_CHILDREN_SHUTUP,
270 OPT_CHROOT, /* chroot() past file system access */
271 OPT_CHROOT_EARLY, /* chroot() before file system access */
272 /*OPT_CIBAUD,*/ /* termios.c_cflag */
273 OPT_CLOCAL, /* termios.c_cflag */
274 OPT_CLOEXEC,
275 OPT_CONNECT_TIMEOUT, /* socket connect */
276 OPT_COOL_WRITE,
277 OPT_CR, /* customized */
278 #ifdef CR0
279 OPT_CR0, /* termios.c_oflag */
280 #endif
281 #ifdef CR1
282 OPT_CR1, /* termios.c_oflag */
283 #endif
284 #ifdef CR2
285 OPT_CR2, /* termios.c_oflag */
286 #endif
287 #ifdef CR3
288 OPT_CR3, /* termios.c_oflag */
289 #endif
290 #ifdef CRDLY
291 OPT_CRDLY, /* termios.c_oflag */
292 #endif
293 OPT_CREAD, /* termios.c_cflag */
294 OPT_CRNL, /* customized */
295 #ifdef CRTSCTS
296 OPT_CRTSCTS, /* termios.c_cflag */
297 #endif
298 OPT_CS5, /* termios.c_cflag */
299 OPT_CS6, /* termios.c_cflag */
300 OPT_CS7, /* termios.c_cflag */
301 OPT_CS8, /* termios.c_cflag */
302 OPT_CSIZE, /* termios.c_cflag */
303 OPT_CSTOPB, /* termios.c_cflag */
304 OPT_DASH, /* exec() */
305 OPT_DCCP_SET_CCID,
306 OPT_ECHO, /* termios.c_lflag */
307 OPT_ECHOCTL, /* termios.c_lflag */
308 OPT_ECHOE, /* termios.c_lflag */
309 OPT_ECHOK, /* termios.c_lflag */
310 OPT_ECHOKE, /* termios.c_lflag */
311 OPT_ECHONL, /* termios.c_lflag */
312 #ifdef ECHOPRT
313 OPT_ECHOPRT, /* termios.c_lflag */
314 #endif
315 OPT_END_CLOSE, /* xfd.stream.howtoend = END_CLOSE */
316 OPT_ESCAPE,
317 OPT_FDIN,
318 OPT_FDOUT,
319 #ifdef FFDLY
320 # ifdef FF0
321 OPT_FF0, /* termios.c_oflag */
322 # endif
323 # ifdef FF1
324 OPT_FF1, /* termios.c_oflag */
325 # endif
326 OPT_FFDLY, /* termios.c_oflag */
327 #endif
328 #ifdef FIOSETOWN
329 OPT_FIOSETOWN, /* asm/sockios.h */
330 #endif
331 OPT_FLOCK_EX, /* flock(fd, LOCK_EX) */
332 OPT_FLOCK_EX_NB, /* flock(fd, LOCK_EX|LOCK_NB) */
333 OPT_FLOCK_SH, /* flock(fd, LOCK_SH) */
334 OPT_FLOCK_SH_NB, /* flock(fd, LOCK_SH|LOCK_NB) */
335 OPT_FLUSHO, /* termios.c_lflag */
336 /*0 OPT_FORCE,*/
337 OPT_FOREVER,
338 OPT_FORK,
339 OPT_FS_APPEND,
340 OPT_FS_COMPR,
341 OPT_FS_DIRSYNC,
342 OPT_FS_IMMUTABLE,
343 OPT_FS_JOURNAL_DATA,
344 OPT_FS_NOATIME,
345 OPT_FS_NODUMP,
346 OPT_FS_NOTAIL,
347 OPT_FS_SECRM,
348 OPT_FS_SYNC,
349 OPT_FS_TOPDIR,
350 OPT_FS_UNRM,
351 OPT_FTRUNCATE32, /* ftruncate() */
352 OPT_FTRUNCATE64, /* ftruncate64() */
353 OPT_F_SETLKW_RD, /* fcntl with struct flock - read-lock, wait */
354 OPT_F_SETLKW_WR, /* fcntl with struct flock - write-lock, wait */
355 OPT_F_SETLK_RD, /* fcntl with struct flock - read-lock */
356 OPT_F_SETLK_WR, /* fcntl with struct flock - write-lock */
357 OPT_F_SETPIPE_SZ, /* pipe == fifo */
358 OPT_GROUP,
359 OPT_GROUP_EARLY,
360 OPT_GROUP_LATE,
361 OPT_HISTORY_FILE, /* readline history file */
362 OPT_HTTP_VERSION,
363 OPT_HUPCL, /* termios.c_cflag */
364 OPT_ICANON, /* termios.c_lflag */
365 OPT_ICRNL, /* termios.c_iflag */
366 OPT_IEXTEN, /* termios.c_lflag */
367 OPT_IFF_ALLMULTI, /* struct ifreq.ifr_flags */
368 OPT_IFF_AUTOMEDIA, /* struct ifreq.ifr_flags */
369 OPT_IFF_BROADCAST, /* struct ifreq.ifr_flags */
370 OPT_IFF_DEBUG, /* struct ifreq.ifr_flags */
371 /*OPT_IFF_DYNAMIC,*/ /* struct ifreq.ifr_flags */
372 OPT_IFF_LOOPBACK, /* struct ifreq.ifr_flags */
373 OPT_IFF_MASTER, /* struct ifreq.ifr_flags */
374 OPT_IFF_MULTICAST, /* struct ifreq.ifr_flags */
375 OPT_IFF_NOARP, /* struct ifreq.ifr_flags */
376 OPT_IFF_NOTRAILERS, /* struct ifreq.ifr_flags */
377 OPT_IFF_NO_PI, /* tun: IFF_NO_PI */
378 OPT_IFF_PORTSEL, /* struct ifreq.ifr_flags */
379 OPT_IFF_POINTOPOINT, /* struct ifreq.ifr_flags */
380 OPT_IFF_PROMISC, /* struct ifreq.ifr_flags */
381 OPT_IFF_RUNNING, /* struct ifreq.ifr_flags */
382 OPT_IFF_SLAVE, /* struct ifreq.ifr_flags */
383 OPT_IFF_UP, /* struct ifreq.ifr_flags */
384 OPT_IGNBRK, /* termios.c_iflag */
385 OPT_IGNCR, /* termios.c_iflag */
386 OPT_IGNORECR, /* HTTP */
387 OPT_IGNOREEOF, /* customized */
388 OPT_IGNPAR, /* termios.c_iflag */
389 OPT_IMAXBEL, /* termios.c_iflag */
390 OPT_INLCR, /* termios.c_iflag */
391 OPT_INPCK, /* termios.c_iflag */
392 OPT_INTERVALL,
393 OPT_IPV6_AUTHHDR,
394 OPT_IPV6_DSTOPTS,
395 OPT_IPV6_FLOWINFO,
396 OPT_IPV6_HOPLIMIT,
397 OPT_IPV6_HOPOPTS,
398 OPT_IPV6_JOIN_GROUP,
399 OPT_IPV6_JOIN_SOURCE_GROUP,
400 OPT_IPV6_PKTINFO,
401 OPT_IPV6_RECVDSTOPTS,
402 OPT_IPV6_RECVERR,
403 OPT_IPV6_RECVHOPLIMIT,
404 OPT_IPV6_RECVHOPOPTS,
405 OPT_IPV6_RECVPATHMTU,
406 OPT_IPV6_RECVPKTINFO,
407 OPT_IPV6_RECVRTHDR,
408 OPT_IPV6_RECVTCLASS,
409 OPT_IPV6_RTHDR,
410 OPT_IPV6_TCLASS,
411 OPT_IPV6_UNICAST_HOPS,
412 OPT_IPV6_V6ONLY,
413 #if 0 /* see Linux: man 7 netlink; probably not what we need yet */
414 OPT_IO_SIOCGIFNAME,
415 #endif
416 OPT_IOCTL_BIN, /* generic ioctl with binary value (pointed to) */
417 OPT_IOCTL_INT, /* generic ioctl with integer value */
418 OPT_IOCTL_INTP, /* generic ioctl with integer value (pointed to) */
419 OPT_IOCTL_STRING, /* generic ioctl with integer value (pointed to) */
420 OPT_IOCTL_VOID, /* generic ioctl without value */
421 OPT_IP_ADD_MEMBERSHIP,
422 OPT_IP_ADD_SOURCE_MEMBERSHIP,
423 #ifdef IP_HDRINCL
424 OPT_IP_HDRINCL,
425 #endif
426 #ifdef IP_FREEBIND
427 OPT_IP_FREEBIND,
428 #endif
429 #ifdef IP_MTU
430 OPT_IP_MTU,
431 #endif
432 #ifdef IP_MTU_DISCOVER
433 OPT_IP_MTU_DISCOVER,
434 #endif
435 OPT_IP_MULTICAST_IF,
436 OPT_IP_MULTICAST_LOOP,
437 OPT_IP_MULTICAST_TTL,
438 OPT_IP_OPTIONS,
439 #ifdef IP_PKTINFO
440 OPT_IP_PKTINFO,
441 #endif
442 #ifdef IP_PKTOPTIONS
443 OPT_IP_PKTOPTIONS,
444 #endif
445 OPT_IP_RECVDSTADDR,
446 #ifdef IP_RECVERR
447 OPT_IP_RECVERR,
448 #endif
449 OPT_IP_RECVIF,
450 #ifdef IP_RECVOPTS
451 OPT_IP_RECVOPTS,
452 #endif
453 #ifdef IP_RECVTOS
454 OPT_IP_RECVTOS,
455 #endif
456 #ifdef IP_RECVTTL
457 OPT_IP_RECVTTL,
458 #endif
459 #ifdef IP_RETOPTS
460 OPT_IP_RETOPTS,
461 #endif
462 #ifdef IP_ROUTER_ALERT
463 OPT_IP_ROUTER_ALERT,
464 #endif
465 OPT_IP_TOS,
466 #ifdef IP_TRANSPARENT
467 OPT_IP_TRANSPARENT,
468 #endif
469 OPT_IP_TTL,
470 OPT_ISIG, /* termios.c_lflag */
471 OPT_ISPEED, /* termios.c_ispeed */
472 OPT_ISTRIP, /* termios.c_iflag */
473 #ifdef IUCLC
474 OPT_IUCLC, /* termios.c_iflag */
475 #endif
476 OPT_IXANY, /* termios.c_iflag */
477 OPT_IXOFF, /* termios.c_iflag */
478 OPT_IXON, /* termios.c_iflag */
479 OPT_ACCEPT_TIMEOUT, /* listening socket */
480 OPT_LOCKFILE,
481 OPT_LOWPORT,
482 OPT_MAX_CHILDREN,
483 #if WITH_POSIXMQ
484 OPT_POSIXMQ_PRIORITY,
485 #endif
486 #ifdef NLDLY
487 # ifdef NL0
488 OPT_NL0, /* termios.c_oflag */
489 # endif
490 # ifdef NL0
491 OPT_NL1, /* termios.c_oflag */
492 # endif
493 OPT_NLDLY, /* termios.c_oflag */
494 #endif
495 OPT_NOECHO, /* readline */
496 OPT_NOFLSH, /* termios.c_lflag */
497 OPT_NOFORK, /* exec, system */
498 OPT_NOPROMPT, /* readline */
499 OPT_NULL_EOF, /* receiving empty packet triggers EOF */
500 #ifdef OCRNL
501 OPT_OCRNL, /* termios.c_oflag */
502 #endif
503 #ifdef OFDEL
504 OPT_OFDEL, /* termios.c_oflag */
505 #endif
506 #ifdef OFILL
507 OPT_OFILL, /* termios.c_oflag */
508 #endif
509 #ifdef OLCUC
510 OPT_OLCUC, /* termios.c_oflag */
511 #endif
512 OPT_ONLCR, /* termios.c_oflag */
513 #ifdef ONLRET
514 OPT_ONLRET, /* termios.c_oflag */
515 #endif
516 #ifdef ONOCR
517 OPT_ONOCR, /* termios.c_oflag */
518 #endif
519 #if HAVE_OPENPTY
520 OPT_OPENPTY,
521 #endif
522 OPT_OPENSSL_CAFILE,
523 OPT_OPENSSL_CAPATH,
524 OPT_OPENSSL_CERTIFICATE,
525 OPT_OPENSSL_CIPHERLIST,
526 OPT_OPENSSL_COMMONNAME,
527 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
528 OPT_OPENSSL_COMPRESS,
529 #endif
530 OPT_OPENSSL_DHPARAM,
531 OPT_OPENSSL_EGD,
532 OPT_OPENSSL_FIPS,
533 OPT_OPENSSL_KEY,
534 #if HAVE_SSL_CTX_set_tlsext_max_fragment_length || defined(SSL_CTX_set_tlsext_max_fragment_length)
535 OPT_OPENSSL_MAXFRAGLEN,
536 #endif
537 #if HAVE_SSL_CTX_set_max_send_fragment || defined(SSL_CTX_set_max_send_fragment)
538 OPT_OPENSSL_MAXSENDFRAG,
539 #endif
540 OPT_OPENSSL_MAX_PROTO_VERSION,
541 OPT_OPENSSL_METHOD,
542 OPT_OPENSSL_MIN_PROTO_VERSION,
543 OPT_OPENSSL_NO_SNI,
544 OPT_OPENSSL_PSEUDO,
545 OPT_OPENSSL_SNIHOST,
546 OPT_OPENSSL_VERIFY,
547 OPT_OPOST, /* termios.c_oflag */
548 OPT_OSPEED, /* termios.c_ospeed */
549 OPT_O_APPEND,
550 #ifdef O_ASYNC
551 OPT_O_ASYNC,
552 #endif
553 OPT_O_BINARY, /* Cygwin */
554 OPT_O_CREATE,
555 #ifdef O_DEFER
556 OPT_O_DEFER,
557 #endif
558 #ifdef O_DELAY
559 OPT_O_DELAY,
560 #endif
561 #ifdef O_DIRECT
562 OPT_O_DIRECT,
563 #endif
564 #ifdef O_DIRECTORY
565 OPT_O_DIRECTORY,
566 #endif
567 #ifdef O_DSYNC
568 OPT_O_DSYNC,
569 #endif
570 OPT_O_EXCL,
571 #ifdef O_LARGEFILE
572 OPT_O_LARGEFILE,
573 #endif
574 #if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
575 OPT_O_NDELAY,
576 #endif
577 OPT_O_NOATIME,
578 OPT_O_NOCTTY,
579 #ifdef O_NOFOLLOW
580 OPT_O_NOFOLLOW,
581 #endif
582 OPT_O_NOINHERIT, /* Cygwin */
583 OPT_O_NONBLOCK,
584 #ifdef O_NSHARE
585 OPT_O_NSHARE,
586 #endif
587 #ifdef O_PRIV
588 OPT_O_PRIV,
589 #endif
590 OPT_O_RDONLY, /* open() */
591 OPT_O_RDWR, /* open() */
592 #ifdef O_RSHARE
593 OPT_O_RSHARE,
594 #endif
595 #ifdef O_RSYNC
596 OPT_O_RSYNC,
597 #endif
598 #ifdef O_SYNC
599 OPT_O_SYNC,
600 #endif
601 OPT_O_TEXT, /* Cygwin */
602 OPT_O_TRUNC, /* open(): O_TRUNC */
603 OPT_O_WRONLY, /* open() */
604 OPT_PARENB, /* termios.c_cflag */
605 OPT_PARMRK, /* termios.c_iflag */
606 OPT_PARODD, /* termios.c_cflag */
607 OPT_PATH,
608 #ifdef PENDIN
609 OPT_PENDIN, /* termios.c_lflag */
610 #endif
611 OPT_PERM,
612 OPT_PERM_EARLY,
613 OPT_PERM_LATE,
614 OPT_PIPES,
615 /*OPT_PORT,*/
616 OPT_PROMPT, /* readline */
617 OPT_PROTOCOL, /* 6=TCP, 17=UDP */
618 OPT_PROTOCOL_FAMILY, /* 1=PF_UNIX, 2=PF_INET, 10=PF_INET6 */
619 OPT_PROXYPORT,
620 OPT_PROXY_AUTHORIZATION,
621 OPT_PROXY_AUTHORIZATION_FILE,
622 OPT_PROXY_RESOLVE,
623 #if HAVE_DEV_PTMX || HAVE_DEV_PTC
624 OPT_PTMX,
625 #endif
626 OPT_PTY,
627 OPT_PTY_INTERVALL,
628 OPT_PTY_WAIT_SLAVE,
629 OPT_RANGE, /* restrict client socket address */
630 OPT_RAW, /* termios */
631 OPT_READBYTES,
632 OPT_RESET_NETNS, /* reset net namespace - not an option, just op! */
633 OPT_RES_AAONLY, /* resolver(3) */
634 OPT_RES_DEBUG, /* resolver(3) */
635 OPT_RES_DEFNAMES, /* resolver(3) */
636 OPT_RES_DNSRCH, /* resolver(3) */
637 OPT_RES_IGNTC, /* resolver(3) */
638 OPT_RES_NSADDR, /* undocumented */
639 OPT_RES_PRIMARY, /* resolver(3) */
640 OPT_RES_RECURSE, /* resolver(3) */
641 OPT_RES_RETRANS, /* undocumented */
642 OPT_RES_RETRY, /* undocumented */
643 OPT_RES_STAYOPEN, /* resolver(3) */
644 OPT_RES_USEVC, /* resolver(3) */
645 OPT_RETRIEVE_VLAN, /* Linux: get VLAN info on raw sockets per auxdata */
646 OPT_RETRY,
647 OPT_SANE, /* termios */
648 OPT_SCTP_MAXSEG,
649 OPT_SCTP_MAXSEG_LATE,
650 OPT_SCTP_NODELAY,
651 OPT_SEEK32_CUR,
652 OPT_SEEK32_END,
653 OPT_SEEK32_SET,
654 OPT_SEEK64_CUR,
655 OPT_SEEK64_END,
656 OPT_SEEK64_SET,
657 OPT_SETGID,
658 OPT_SETGID_EARLY,
659 OPT_SETPGID,
660 OPT_SETSID,
661 OPT_SETSOCKOPT_BIN,
662 OPT_SETSOCKOPT_INT,
663 OPT_SETSOCKOPT_LISTEN,
664 OPT_SETSOCKOPT_STRING,
665 OPT_SETUID,
666 OPT_SETUID_EARLY,
667 OPT_SET_NETNS, /* set net namespace */
668 OPT_SHELL,
669 OPT_SHUT_CLOSE,
670 OPT_SHUT_DOWN,
671 OPT_SHUT_NONE,
672 OPT_SHUT_NULL, /* send 0 bytes on shutdown */
673 OPT_SIGHUP,
674 OPT_SIGINT,
675 OPT_SIGQUIT,
676 #ifdef SIOCSPGRP
677 OPT_SIOCSPGRP,
678 #endif
679 OPT_SITOUT_EIO,
680 #ifdef SO_ACCEPTCONN
681 OPT_SO_ACCEPTCONN,
682 #endif /* SO_ACCEPTCONN */
683 #ifdef SO_ATTACH_FILTER
684 OPT_SO_ATTACH_FILTER,
685 #endif
686 #ifdef SO_AUDIT /* AIX 4.3.3 */
687 OPT_SO_AUDIT,
688 #endif /* SO_AUDIT */
689 #ifdef SO_BINDTODEVICE
690 OPT_SO_BINDTODEVICE,
691 #endif
692 OPT_SO_BROADCAST,
693 #ifdef SO_BSDCOMPAT
694 OPT_SO_BSDCOMPAT,
695 #endif
696 #ifdef SO_CKSUMRECV
697 OPT_SO_CKSUMRECV,
698 #endif /* SO_CKSUMRECV */
699 OPT_SO_DEBUG,
700 #ifdef SO_DETACH_FILTER
701 OPT_SO_DETACH_FILTER,
702 #endif
703 #ifdef SO_DGRAM_ERRIND
704 OPT_SO_DGRAM_ERRIND,
705 #endif
706 #ifdef SO_DONTLINGER
707 OPT_SO_DONTLINGER,
708 #endif
709 OPT_SO_DONTROUTE,
710 OPT_SO_ERROR,
711 OPT_SO_KEEPALIVE,
712 #ifdef SO_KERNACCEPT /* AIX 4.3.3 */
713 OPT_SO_KERNACCEPT,
714 #endif /* SO_KERNACCEPT */
715 OPT_SO_LINGER,
716 #ifdef SO_NO_CHECK
717 OPT_SO_NO_CHECK,
718 #endif
719 #ifdef SO_NOREUSEADDR /* AIX 4.3.3 */
720 OPT_SO_NOREUSEADDR,
721 #endif /* SO_NOREUSEADDR */
722 OPT_SO_OOBINLINE,
723 #ifdef SO_PASSCRED
724 OPT_SO_PASSCRED,
725 #endif
726 #ifdef SO_PEERCRED
727 OPT_SO_PEERCRED,
728 #endif
729 #ifdef SO_PRIORITY
730 OPT_SO_PRIORITY,
731 #endif
732 OPT_SO_PROTOTYPE,
733 OPT_SO_RCVBUF,
734 OPT_SO_RCVBUF_LATE,
735 #ifdef SO_RCVLOWAT
736 OPT_SO_RCVLOWAT,
737 #endif
738 #ifdef SO_RCVTIMEO
739 OPT_SO_RCVTIMEO,
740 #endif
741 OPT_SO_REUSEADDR,
742 #ifdef SO_REUSEPORT
743 OPT_SO_REUSEPORT,
744 #endif /* defined(SO_REUSEPORT) */
745 #ifdef SO_SECURITY_AUTHENTICATION
746 OPT_SO_SECURITY_AUTHENTICATION,
747 #endif
748 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
749 OPT_SO_SECURITY_ENCRYPTION_NETWORK,
750 #endif
751 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
752 OPT_SO_SECURITY_ENCRYPTION_TRANSPORT,
753 #endif
754 OPT_SO_SNDBUF,
755 OPT_SO_SNDBUF_LATE,
756 #ifdef SO_SNDLOWAT
757 OPT_SO_SNDLOWAT,
758 #endif
759 #ifdef SO_SNDTIMEO
760 OPT_SO_SNDTIMEO,
761 #endif
762 OPT_SO_TIMESTAMP, /* Linux */
763 OPT_SO_TYPE,
764 #ifdef SO_USELOOPBACK
765 OPT_SO_USELOOPBACK,
766 #endif /* SO_USELOOPBACK */
767 #ifdef SO_USE_IFBUFS
768 OPT_SO_USE_IFBUFS,
769 #endif /* SO_USE_IFBUFS */
770 #if 1 || defined(WITH_SOCKS4)
771 OPT_SOCKSPORT,
772 OPT_SOCKSUSER,
773 #endif
774 OPT_SOURCEPORT,
775 OPT_STDERR, /* with exec, system */
776 # define ENABLE_OPTCODE
777 # include "xio-streams.h"
778 # undef ENABLE_OPTCODE
779 OPT_SUBSTUSER_EARLY,
780 OPT_SUBSTUSER,
781 #if defined(HAVE_SETGRENT) && defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT)
782 OPT_SUBSTUSER_DELAYED,
783 #endif
784 OPT_SYMBOLIC_LINK, /* with pty */
785 #ifdef TABDLY
786 # ifdef TAB0
787 OPT_TAB0, /* termios.c_oflag */
788 # endif
789 # ifdef TAB1
790 OPT_TAB1, /* termios.c_oflag */
791 # endif
792 # ifdef TAB2
793 OPT_TAB2, /* termios.c_oflag */
794 # endif
795 # ifdef TAB3
796 OPT_TAB3, /* termios.c_oflag */
797 # endif
798 OPT_TABDLY, /* termios.c_oflag */
799 #endif
800 OPT_TCPWRAPPERS, /* libwrap */
801 OPT_TCPWRAP_ETC, /* libwrap */
802 OPT_TCPWRAP_HOSTS_ALLOW_TABLE, /* libwrap */
803 OPT_TCPWRAP_HOSTS_DENY_TABLE, /* libwrap */
804 OPT_TCP_ABORT_THRESHOLD, /* HP-UX */
805 OPT_TCP_CONN_ABORT_THRESHOLD, /* HP-UX */
806 #ifdef TCP_CORK
807 OPT_TCP_CORK,
808 #endif
809 #ifdef TCP_DEFER_ACCEPT
810 OPT_TCP_DEFER_ACCEPT, /* Linux 2.4.0 */
811 #endif
812 #ifdef TCP_INFO
813 OPT_TCP_INFO, /* Linux 2.4.0 */
814 #endif
815 #ifdef TCP_KEEPCNT
816 OPT_TCP_KEEPCNT, /* Linux 2.4.0 */
817 #endif
818 #ifdef TCP_KEEPIDLE
819 OPT_TCP_KEEPIDLE, /* Linux 2.4.0 */
820 #endif
821 OPT_TCP_KEEPINIT, /* OSF1 */
822 #ifdef TCP_KEEPINTVL
823 OPT_TCP_KEEPINTVL, /* Linux 2.4.0 */
824 #endif
825 #ifdef TCP_LINGER2
826 OPT_TCP_LINGER2, /* Linux 2.4.0 */
827 #endif
828 #ifdef TCP_MAXSEG
829 OPT_TCP_MAXSEG,
830 OPT_TCP_MAXSEG_LATE,
831 #endif
832 OPT_TCP_MD5SIG, /* FreeBSD */
833 #ifdef TCP_NODELAY
834 OPT_TCP_NODELAY,
835 #endif
836 OPT_TCP_NOOPT, /* FreeBSD */
837 OPT_TCP_NOPUSH, /* FreeBSD */
838 OPT_TCP_PAWS, /* OSF1 */
839 #ifdef TCP_QUICKACK
840 OPT_TCP_QUICKACK, /* Linux 2.4 */
841 #endif
842 #ifdef TCP_RFC1323
843 OPT_TCP_RFC1323, /* AIX 4.3.3 */
844 #endif
845 OPT_TCP_SACKENA, /* OSF1 */
846 OPT_TCP_SACK_DISABLE, /* OpenBSD */
847 OPT_TCP_SIGNATURE_ENABLE, /* OpenBSD */
848 #ifdef TCP_STDURG
849 OPT_TCP_STDURG, /* AIX 4.3.3; Linux: see man 7 tcp */
850 #endif
851 #ifdef TCP_SYNCNT
852 OPT_TCP_SYNCNT, /* Linux 2.4.0 */
853 #endif
854 OPT_TCP_TSOPTENA, /* OSF1 */
855 #ifdef TCP_WINDOW_CLAMP
856 OPT_TCP_WINDOW_CLAMP, /* Linux 2.4.0 */
857 #endif
858 OPT_TERMIOS_CFMAKERAW, /* termios.cfmakeraw() */
859 OPT_TERMIOS_RAWER,
860 OPT_TIOCSCTTY,
861 OPT_TOSTOP, /* termios.c_lflag */
862 OPT_TUN_DEVICE, /* tun: /dev/net/tun ... */
863 OPT_TUN_NAME, /* tun: tun0 */
864 OPT_TUN_TYPE, /* tun: tun|tap */
865 OPT_UDPLITE_RECV_CSCOV,
866 OPT_UDPLITE_SEND_CSCOV,
867 OPT_UMASK,
868 OPT_UNIX_BIND_TEMPNAME, /* UNIX domain sockets */
869 OPT_UNIX_TIGHTSOCKLEN,
870 OPT_UNLINK,
871 OPT_UNLINK_CLOSE,
872 OPT_UNLINK_EARLY,
873 OPT_UNLINK_LATE,
874 OPT_UN_UMASK,
875 OPT_USER,
876 OPT_USER_EARLY,
877 OPT_USER_LATE,
878 #ifdef VDISCARD
879 OPT_VDISCARD, /* termios.c_cc */
880 #endif
881 OPT_VDSUSP, /* termios.c_cc - HP-UX */
882 OPT_VEOF, /* termios.c_cc */
883 OPT_VEOL, /* termios.c_cc */
884 OPT_VEOL2, /* termios.c_cc */
885 OPT_VERASE, /* termios.c_cc */
886 OPT_VINTR, /* termios.c_cc */
887 OPT_VKILL, /* termios.c_cc */
888 OPT_VLNEXT, /* termios.c_cc */
889 OPT_VMIN, /* termios.c_cc */
890 OPT_VQUIT, /* termios.c_cc */
891 OPT_VREPRINT, /* termios.c_cc */
892 OPT_VSTART, /* termios.c_cc */
893 OPT_VSTOP, /* termios.c_cc */
894 OPT_VSUSP, /* termios.c_cc */
895 OPT_VSWTC, /* termios.c_cc */
896 OPT_VTIME, /* termios.c_cc */
897 #ifdef VTDLY
898 # ifdef VT0
899 OPT_VT0, /* termios.c_oflag */
900 # endif
901 # ifdef VT1
902 OPT_VT1, /* termios.c_oflag */
903 # endif
904 OPT_VTDLY, /* termios.c_oflag */
905 #endif
906 #ifdef VWERASE
907 OPT_VWERASE, /* termios.c_cc */
908 #endif
909 OPT_WAITLOCK,
910 #ifdef XCASE
911 OPT_XCASE, /* termios.c_lflag */
912 #endif
913 #if defined(TABDLY) && defined(XTABS)
914 OPT_XTABS, /* termios.c_oflag */
915 #endif
916 OPT_nocomma /* make aix xlc happy, no trailing comma */
919 /* keep consistent with xiohelp.c:optionphasenames ! */
920 enum e_phase {
921 PH_ALL, /* not for option definitions; use in apply funcs to
922 say "all phases" */
923 PH_OFFSET, /* automatically applied to xio-fd */
924 PH_INIT, /* retrieving info from original state */
925 PH_EARLY, /* before any other processing */
927 PH_PREOPEN, /* before file descriptor is created/opened */
928 PH_OPEN, /* during filesystem entry creation/open */
929 PH_PASTOPEN, /* past filesystem entry creation/open */
931 PH_PRESOCKET, /* before socket call */
932 PH_SOCKET, /* for socket call */
933 PH_PASTSOCKET, /* after socket call */
935 PH_PREBIGEN, /* before socketpair() pipe() openpty() */
936 PH_BIGEN, /* during socketpair() pipe() openpty() */
937 PH_PASTBIGEN, /* past socketpair() pipe() openpty() */
938 PH_FD, /* soon after FD creation or identification */
940 PH_PREBIND, /* before socket bind() */
941 PH_BIND, /* during socket bind() ? */
942 PH_PASTBIND, /* past socket bind() - for client and server sockets! */
944 PH_PRELISTEN, /* before socket listen() */
945 PH_LISTEN, /* during socket listen() ? */
946 PH_PASTLISTEN, /* after socket listen() */
948 PH_PRECONNECT, /* before socket connect() */
949 PH_CONNECT, /* during socket connect() ? */
950 PH_PASTCONNECT, /* after socket connect() */
952 PH_PREACCEPT, /* before socket accept() */
953 PH_ACCEPT, /* during socket accept() ? */
954 PH_PASTACCEPT, /* after socket accept() */
955 PH_CONNECTED, /* for sockets, after connect() or accept() */
957 PH_PREFORK, /* before fork() (with both listen and exec!) */
958 PH_FORK, /* during fork() (with both listen and exec!) */
959 PH_PASTFORK, /* after fork() (with both listen and exec!) */
961 PH_LATE, /* FD is ready, before start of data loop */
962 PH_LATE2, /* FD is ready, dropping privileges */
964 PH_PREEXEC, /* before exec() or system() */
965 PH_EXEC, /* during exec() or system() */
966 PH_PASTEXEC, /* only reached on addresses that do NOT exec() */
967 PH_SPEC /* specific to situation, not fix */
970 /* atomic structure to describe the syntax and more important semantics of an
971 option */
972 struct optdesc {
973 const char *defname; /* default name */
974 const char *nickname; /* usual name */
975 enum e_optcode optcode; /* short form of option name */
976 groups_t group;
977 enum e_phase phase; /* when this option is to be used */
978 enum e_types type; /* the data type as expected on input, and stored */
979 enum e_func func; /* which function can apply this option, e.g. ioctl(),
980 getsockopt(), or just a bit pattern */
981 int major; /* major id for func: level (SOL_...) for setsockopt(),
982 request for ioctl() */
983 int minor; /* minor id for func: SO_..., IP_..., */
984 long arg3;
987 extern bool xioopts_ignoregroups;
988 extern const struct optname optionnames[];
991 extern int retropt_bool(struct opt *opts, int optcode, bool *result);
992 extern int retropt_short(struct opt *opts, int optcode, short *result);
993 extern int retropt_ushort(struct opt *opts, int optcode, unsigned short *result);
994 extern int retropt_int(struct opt *opts, int optcode, int *result);
995 extern int retropt_2integrals(struct opt *opts, int optcode, union integral *value1, union integral *value2);
996 extern int retropt_uint(struct opt *opts, int optcode, unsigned int *result);
997 extern int retropt_long(struct opt *opts, int optcode, long *result);
998 extern int retropt_ulong(struct opt *opts, int optcode, unsigned long *result);
999 extern int retropt_flag(struct opt *opts, int optcode, flags_t *result);
1000 extern int retropt_string(struct opt *opts, int optcode, char **result);
1001 extern int retropt_timespec(struct opt *opts, int optcode, struct timespec *result);
1002 extern int retropt_bind(struct opt *opts, int af, int socktype, int ipproto, struct sockaddr *sa, socklen_t *salen, int feats, const int ai_flags[2]);
1003 extern int applyopt_fd(int fd, struct opt *opt);
1004 extern int applyopt_single(struct single *sfd, struct opt *opt);
1005 extern int applyopts(struct single *sfd, int fd, struct opt *opts, enum e_phase phase);
1006 extern int applyopts2(struct single *sfd, int fd, struct opt *opts, unsigned int from, unsigned int to);
1007 extern int applyopts_optgroup(struct single *sfd, int fd, struct opt *opts, groups_t groups);
1008 extern int applyopts_flags(struct opt *opts, groups_t group, flags_t *result);
1009 extern int applyopts_cloexec(int fd, struct opt *opts);
1010 extern int applyopts_fchown(int fd, struct opt *opts);
1011 extern int applyopts_single(struct single *fd, struct opt *opts, enum e_phase phase);
1012 extern int applyopts_offset(struct single *xfd, struct opt *opts);
1013 extern int applyopts_signal(struct single *xfd, struct opt *opts);
1014 extern int _xio_openlate(struct single *fd, struct opt *opts);
1015 extern int parseopts(const char **a, groups_t groups, struct opt **opts);
1016 extern int parseopts_table(const char **a, groups_t groups,
1017 struct opt **opts,
1018 const struct optname optionnames[], size_t optionnum);
1019 extern const struct opt *searchopt(const struct opt *opts, groups_t groups, enum e_phase from, enum e_phase to,
1020 enum e_func func);
1021 extern struct opt *copyopts(const struct opt *opts, groups_t groups);
1022 extern struct opt *moveopts(struct opt *opts, groups_t groups);
1023 extern int leftopts(const struct opt *opts);
1024 extern int showleft(const struct opt *opts);
1025 extern groups_t groupbits(int fd);
1026 extern groups_t _groupbits(mode_t mode);
1027 extern int dropopts(struct opt *opts, unsigned int phase);
1028 extern int dropopts2(struct opt *opts, unsigned int from, unsigned int to);
1029 extern int dumpopts(struct opt *opts);
1031 #if HAVE_BASIC_UID_T==1
1032 # define retropt_uid(o,c,r) retropt_short(o,c,r)
1033 #elif HAVE_BASIC_UID_T==2
1034 # define retropt_uid(o,c,r) retropt_ushort(o,c,r)
1035 #elif HAVE_BASIC_UID_T==3
1036 # define retropt_uid(o,c,r) retropt_int(o,c,r)
1037 #elif HAVE_BASIC_UID_T==4
1038 # define retropt_uid(o,c,r) retropt_uint(o,c,r)
1039 #elif HAVE_BASIC_UID_T==5
1040 # define retropt_uid(o,c,r) retropt_long(o,c,r)
1041 #elif HAVE_BASIC_UID_T==6
1042 # define retropt_uid(o,c,r) retropt_ulong(o,c,r)
1043 #else
1044 # error "HAVE_BASIC_UID_T is out of range: " HAVE_BASIC_UID_T
1045 #endif
1047 #if HAVE_BASIC_GID_T==1
1048 # define retropt_gid(o,c,r) retropt_short(o,c,r)
1049 #elif HAVE_BASIC_GID_T==2
1050 # define retropt_gid(o,c,r) retropt_ushort(o,c,r)
1051 #elif HAVE_BASIC_GID_T==3
1052 # define retropt_gid(o,c,r) retropt_int(o,c,r)
1053 #elif HAVE_BASIC_GID_T==4
1054 # define retropt_gid(o,c,r) retropt_uint(o,c,r)
1055 #elif HAVE_BASIC_GID_T==5
1056 # define retropt_gid(o,c,r) retropt_long(o,c,r)
1057 #elif HAVE_BASIC_GID_T==6
1058 # define retropt_gid(o,c,r) retropt_ulong(o,c,r)
1059 #else
1060 # error "HAVE_BASIC_GID_T is out of range: " HAVE_BASIC_GID_T
1061 #endif
1063 #if HAVE_BASIC_MODE_T==1
1064 # define retropt_mode(o,c,r) retropt_short(o,c,r)
1065 #elif HAVE_BASIC_MODE_T==2
1066 # define retropt_mode(o,c,r) retropt_ushort(o,c,r)
1067 #elif HAVE_BASIC_MODE_T==3
1068 # define retropt_mode(o,c,r) retropt_int(o,c,r)
1069 #elif HAVE_BASIC_MODE_T==4
1070 # define retropt_mode(o,c,r) retropt_uint(o,c,r)
1071 #elif HAVE_BASIC_MODE_T==5
1072 # define retropt_mode(o,c,r) retropt_long(o,c,r)
1073 #elif HAVE_BASIC_MODE_T==6
1074 # define retropt_mode(o,c,r) retropt_ulong(o,c,r)
1075 #else
1076 # error "HAVE_BASIC_MODE_T is out of range: " HAVE_BASIC_MODE_T
1077 #endif
1079 #endif /* !defined(__xioopts_h_included) */