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
19 const struct optdesc
*desc
;
22 /* keep consistent with xiohelp.c:optiontypenames[] ! */
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 */
30 TYPE_INT_NULL
, /* int, or just opt= for no action (instead of default) */
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 */
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 */
78 #if HAVE_STRUCT_IP_MREQ_SOURCE
79 TYPE_IP_MREQ_SOURCE
, /* for struct ip_mreq_source */
81 #if HAVE_STRUCT_GROUP_SOURCE_REQ
82 TYPE_GROUP_SOURCE_REQ
, /* for struct group_source_req */
85 TYPE_GENERIC
, /* type is determined from (text) data provided (dalan syntax) */
86 TYPE_OVERFLOW
/* marker: beyond last type */
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
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,
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 */
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[] ! */
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
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 */
257 OPT_BIND
, /* a socket address as character string */
258 OPT_BRKINT
, /* termios.c_iflag */
261 OPT_BS0
, /* termios.c_oflag */
264 OPT_BS1
, /* termios.c_oflag */
266 OPT_BSDLY
, /* termios.c_oflag */
268 OPT_CHDIR
, /* change working directory */
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 */
275 OPT_CONNECT_TIMEOUT
, /* socket connect */
277 OPT_CR
, /* customized */
279 OPT_CR0
, /* termios.c_oflag */
282 OPT_CR1
, /* termios.c_oflag */
285 OPT_CR2
, /* termios.c_oflag */
288 OPT_CR3
, /* termios.c_oflag */
291 OPT_CRDLY
, /* termios.c_oflag */
293 OPT_CREAD
, /* termios.c_cflag */
294 OPT_CRNL
, /* customized */
296 OPT_CRTSCTS
, /* termios.c_cflag */
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() */
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 */
313 OPT_ECHOPRT
, /* termios.c_lflag */
315 OPT_END_CLOSE
, /* xfd.stream.howtoend = END_CLOSE */
321 OPT_FF0
, /* termios.c_oflag */
324 OPT_FF1
, /* termios.c_oflag */
326 OPT_FFDLY
, /* termios.c_oflag */
329 OPT_FIOSETOWN
, /* asm/sockios.h */
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 */
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 */
361 OPT_HISTORY_FILE
, /* readline history file */
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 */
399 OPT_IPV6_JOIN_SOURCE_GROUP
,
401 OPT_IPV6_RECVDSTOPTS
,
403 OPT_IPV6_RECVHOPLIMIT
,
404 OPT_IPV6_RECVHOPOPTS
,
405 OPT_IPV6_RECVPATHMTU
,
406 OPT_IPV6_RECVPKTINFO
,
411 OPT_IPV6_UNICAST_HOPS
,
413 #if 0 /* see Linux: man 7 netlink; probably not what we need yet */
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
,
432 #ifdef IP_MTU_DISCOVER
436 OPT_IP_MULTICAST_LOOP
,
437 OPT_IP_MULTICAST_TTL
,
462 #ifdef IP_ROUTER_ALERT
466 #ifdef IP_TRANSPARENT
470 OPT_ISIG
, /* termios.c_lflag */
471 OPT_ISPEED
, /* termios.c_ispeed */
472 OPT_ISTRIP
, /* termios.c_iflag */
474 OPT_IUCLC
, /* termios.c_iflag */
476 OPT_IXANY
, /* termios.c_iflag */
477 OPT_IXOFF
, /* termios.c_iflag */
478 OPT_IXON
, /* termios.c_iflag */
479 OPT_ACCEPT_TIMEOUT
, /* listening socket */
484 OPT_POSIXMQ_PRIORITY
,
488 OPT_NL0
, /* termios.c_oflag */
491 OPT_NL1
, /* termios.c_oflag */
493 OPT_NLDLY
, /* termios.c_oflag */
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 */
501 OPT_OCRNL
, /* termios.c_oflag */
504 OPT_OFDEL
, /* termios.c_oflag */
507 OPT_OFILL
, /* termios.c_oflag */
510 OPT_OLCUC
, /* termios.c_oflag */
512 OPT_ONLCR
, /* termios.c_oflag */
514 OPT_ONLRET
, /* termios.c_oflag */
517 OPT_ONOCR
, /* termios.c_oflag */
524 OPT_OPENSSL_CERTIFICATE
,
525 OPT_OPENSSL_CIPHERLIST
,
526 OPT_OPENSSL_COMMONNAME
,
527 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
528 OPT_OPENSSL_COMPRESS
,
534 #if HAVE_SSL_CTX_set_tlsext_max_fragment_length || defined(SSL_CTX_set_tlsext_max_fragment_length)
535 OPT_OPENSSL_MAXFRAGLEN
,
537 #if HAVE_SSL_CTX_set_max_send_fragment || defined(SSL_CTX_set_max_send_fragment)
538 OPT_OPENSSL_MAXSENDFRAG
,
540 OPT_OPENSSL_MAX_PROTO_VERSION
,
542 OPT_OPENSSL_MIN_PROTO_VERSION
,
547 OPT_OPOST
, /* termios.c_oflag */
548 OPT_OSPEED
, /* termios.c_ospeed */
553 OPT_O_BINARY
, /* Cygwin */
574 #if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
582 OPT_O_NOINHERIT
, /* Cygwin */
590 OPT_O_RDONLY
, /* open() */
591 OPT_O_RDWR
, /* open() */
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 */
609 OPT_PENDIN
, /* termios.c_lflag */
616 OPT_PROMPT
, /* readline */
617 OPT_PROTOCOL
, /* 6=TCP, 17=UDP */
618 OPT_PROTOCOL_FAMILY
, /* 1=PF_UNIX, 2=PF_INET, 10=PF_INET6 */
620 OPT_PROXY_AUTHORIZATION
,
621 OPT_PROXY_AUTHORIZATION_FILE
,
623 #if HAVE_DEV_PTMX || HAVE_DEV_PTC
629 OPT_RANGE
, /* restrict client socket address */
630 OPT_RAW
, /* termios */
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 */
647 OPT_SANE
, /* termios */
649 OPT_SCTP_MAXSEG_LATE
,
663 OPT_SETSOCKOPT_LISTEN
,
664 OPT_SETSOCKOPT_STRING
,
667 OPT_SET_NETNS
, /* set net namespace */
672 OPT_SHUT_NULL
, /* send 0 bytes on shutdown */
682 #endif /* SO_ACCEPTCONN */
683 #ifdef SO_ATTACH_FILTER
684 OPT_SO_ATTACH_FILTER
,
686 #ifdef SO_AUDIT /* AIX 4.3.3 */
688 #endif /* SO_AUDIT */
689 #ifdef SO_BINDTODEVICE
698 #endif /* SO_CKSUMRECV */
700 #ifdef SO_DETACH_FILTER
701 OPT_SO_DETACH_FILTER
,
703 #ifdef SO_DGRAM_ERRIND
712 #ifdef SO_KERNACCEPT /* AIX 4.3.3 */
714 #endif /* SO_KERNACCEPT */
719 #ifdef SO_NOREUSEADDR /* AIX 4.3.3 */
721 #endif /* SO_NOREUSEADDR */
744 #endif /* defined(SO_REUSEPORT) */
745 #ifdef SO_SECURITY_AUTHENTICATION
746 OPT_SO_SECURITY_AUTHENTICATION
,
748 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
749 OPT_SO_SECURITY_ENCRYPTION_NETWORK
,
751 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
752 OPT_SO_SECURITY_ENCRYPTION_TRANSPORT
,
762 OPT_SO_TIMESTAMP
, /* Linux */
764 #ifdef SO_USELOOPBACK
766 #endif /* SO_USELOOPBACK */
769 #endif /* SO_USE_IFBUFS */
770 #if 1 || defined(WITH_SOCKS4)
775 OPT_STDERR
, /* with exec, system */
776 # define ENABLE_OPTCODE
777 # include "xio-streams.h"
778 # undef ENABLE_OPTCODE
781 #if defined(HAVE_SETGRENT) && defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT)
782 OPT_SUBSTUSER_DELAYED
,
784 OPT_SYMBOLIC_LINK
, /* with pty */
787 OPT_TAB0
, /* termios.c_oflag */
790 OPT_TAB1
, /* termios.c_oflag */
793 OPT_TAB2
, /* termios.c_oflag */
796 OPT_TAB3
, /* termios.c_oflag */
798 OPT_TABDLY
, /* termios.c_oflag */
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 */
809 #ifdef TCP_DEFER_ACCEPT
810 OPT_TCP_DEFER_ACCEPT
, /* Linux 2.4.0 */
813 OPT_TCP_INFO
, /* Linux 2.4.0 */
816 OPT_TCP_KEEPCNT
, /* Linux 2.4.0 */
819 OPT_TCP_KEEPIDLE
, /* Linux 2.4.0 */
821 OPT_TCP_KEEPINIT
, /* OSF1 */
823 OPT_TCP_KEEPINTVL
, /* Linux 2.4.0 */
826 OPT_TCP_LINGER2
, /* Linux 2.4.0 */
832 OPT_TCP_MD5SIG
, /* FreeBSD */
836 OPT_TCP_NOOPT
, /* FreeBSD */
837 OPT_TCP_NOPUSH
, /* FreeBSD */
838 OPT_TCP_PAWS
, /* OSF1 */
840 OPT_TCP_QUICKACK
, /* Linux 2.4 */
843 OPT_TCP_RFC1323
, /* AIX 4.3.3 */
845 OPT_TCP_SACKENA
, /* OSF1 */
846 OPT_TCP_SACK_DISABLE
, /* OpenBSD */
847 OPT_TCP_SIGNATURE_ENABLE
, /* OpenBSD */
849 OPT_TCP_STDURG
, /* AIX 4.3.3; Linux: see man 7 tcp */
852 OPT_TCP_SYNCNT
, /* Linux 2.4.0 */
854 OPT_TCP_TSOPTENA
, /* OSF1 */
855 #ifdef TCP_WINDOW_CLAMP
856 OPT_TCP_WINDOW_CLAMP
, /* Linux 2.4.0 */
858 OPT_TERMIOS_CFMAKERAW
, /* termios.cfmakeraw() */
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
,
868 OPT_UNIX_BIND_TEMPNAME
, /* UNIX domain sockets */
869 OPT_UNIX_TIGHTSOCKLEN
,
879 OPT_VDISCARD
, /* termios.c_cc */
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 */
899 OPT_VT0
, /* termios.c_oflag */
902 OPT_VT1
, /* termios.c_oflag */
904 OPT_VTDLY
, /* termios.c_oflag */
907 OPT_VWERASE
, /* termios.c_cc */
911 OPT_XCASE
, /* termios.c_lflag */
913 #if defined(TABDLY) && defined(XTABS)
914 OPT_XTABS
, /* termios.c_oflag */
916 OPT_nocomma
/* make aix xlc happy, no trailing comma */
919 /* keep consistent with xiohelp.c:optionphasenames ! */
921 PH_ALL
, /* not for option definitions; use in apply funcs to
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
973 const char *defname
; /* default name */
974 const char *nickname
; /* usual name */
975 enum e_optcode optcode
; /* short form of option name */
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_..., */
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
,
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
,
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)
1044 # error "HAVE_BASIC_UID_T is out of range: " HAVE_BASIC_UID_T
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)
1060 # error "HAVE_BASIC_GID_T is out of range: " HAVE_BASIC_GID_T
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)
1076 # error "HAVE_BASIC_MODE_T is out of range: " HAVE_BASIC_MODE_T
1079 #endif /* !defined(__xioopts_h_included) */