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 */
31 TYPE_STRING
, /* char * */
32 TYPE_NAME
= TYPE_STRING
,
33 TYPE_FILENAME
= TYPE_STRING
,
34 TYPE_PTRDIFF
, /* ptrdiff_t */
36 TYPE_SHORT
, /* short */
37 TYPE_SIZE_T
, /* size_t */
38 TYPE_SOCKADDR
, /* struct sockaddr * */
39 TYPE_UINT
, /* unsigned int */
41 TYPE_ULONG
, /* unsigned long */
42 TYPE_USHORT
, /* unsigned short */
43 TYPE_2BYTE
= TYPE_USHORT
,
44 TYPE_MODET
, /* representation of mode_t */
45 TYPE_GIDT
, /* representation of gid_t */
47 TYPE_UIDT
, /* representation of uid_t */
49 TYPE_INT3
, /* int[3] */
50 TYPE_TIMEVAL
, /* struct timeval: {long;long;}, seconds and microsec. */
51 TYPE_TIMESPEC
, /* struct timespec: {time_t;long;}, seconds and nanosec. */
53 TYPE_DOUBLE
, /* double */
54 TYPE_STRING_NULL
, /* char *; string or NULL */
55 TYPE_LONGLONG
, /* long long */
56 TYPE_OFF32
, /* off_t */
58 TYPE_OFF64
, /* off64_t */
59 TYPE_INT_INT
, /* 2 parameters: first is int, second is int */
60 TYPE_INT_INTP
, /* 2 parameters: first is int, second is int* */
61 TYPE_INT_BIN
, /* 2 parameters: first is int, second is binary */
63 TYPE_INT_STRING
, /* 2 parameters: first is int, second is req string */
64 TYPE_INT_INT_INT
, /* 3 params: first and second are int, 3rd is int */
65 TYPE_INT_INT_BIN
, /* 3 params: first and second are int, 3rd is binary */
66 TYPE_INT_INT_STRING
, /* 3 params: first and second are int, 3rd is string */
68 TYPE_IP4NAME
, /* IPv4 hostname or address */
69 #if HAVE_STRUCT_LINGER
70 TYPE_LINGER
, /* struct linger */
71 #endif /* HAVE_STRUCT_LINGER */
72 #if HAVE_STRUCT_IP_MREQ || HAVE_STRUCT_IP_MREQN
73 TYPE_IP_MREQN
, /* for struct ip_mreq or struct ip_mreqn */
78 OFUNC_NONE
, /* no function - should not occur */
79 OFUNC_FLAG
, /* no function, but bitposition, only with bool; arg1 is mask */
80 OFUNC_FLAG_PATTERN
, /* no function, but bitpattern: arg1 is pattern, arg2 is mask */
81 OFUNC_SEEK32
, /* lseek(): arg1 is whence (SEEK_SET etc.) */
82 OFUNC_SEEK64
, /* lseek64(): arg1 is whence (SEEK_SET etc.) */
83 OFUNC_FCNTL
, /* fcntl(, ): arg1 is cmd */
84 OFUNC_IOCTL
, /* ioctl(): arg1 of option description is request, arg2
86 OFUNC_IOCTL_MASK_LONG
, /* arg1 is getrequest, arg2 is setrequest:
87 ioctl(arg1, ); |= arg3; ioctl(arg2, ); */
88 OFUNC_IOCTL_GENERIC
, /* generic ioctl() (request on cmdline) */
89 OFUNC_SOCKOPT
, /* setsockopt() */
90 OFUNC_SOCKOPT_APPEND
,/* getsockopt(), append data, setsockopt() */
91 OFUNC_SOCKOPT_GENERIC
,/* generic setsockopt() (level, optname on cmdline) */
92 OFUNC_FLOCK
, /* flock() */
93 OFUNC_TERMIO
, /* termio() ? */
94 OFUNC_SPEC
, /* special, i.e. no generalizable function call */
95 OFUNC_OFFSET
, /* put a value into xiofile struct; major is offset */
96 OFUNC_OFFSET_MASKS
, /* !!! */
97 /*OFUNC_APPL,*/ /* special, i.e. application must know which f. */
98 OFUNC_EXT
, /* with extended file descriptors only */
99 OFUNC_TERMIOS_FLAG
, /* a flag in struct termios: major..tcflag, minor..bit
101 OFUNC_TERMIOS_PATTERN
, /* a multibit: major..tcflag, minor..pattern,
103 OFUNC_TERMIOS_VALUE
, /* a variable value: major..tcflag, minor..mask, arg3..shift */
104 OFUNC_TERMIOS_CHAR
, /* a termios functional character: major..c_cc index */
105 OFUNC_TERMIOS_SPEED
, /* termios c_ispeed etc on FreeBSD */
106 OFUNC_TERMIOS_SPEC
, /* termios combined modes */
107 OFUNC_SIGNAL
, /* a signal that should be passed to child process */
108 OFUNC_RESOLVER
, /* a bit position used on _res.options */
109 OFUNC_IFFLAG
, /* interface flag: locical-or a 1bit mask */
110 # define ENABLE_OFUNC
111 # include "xio-streams.h" /* push a POSIX STREAMS module */
115 /* for simpler handling of option-to-connection-type relations we define
116 groups. to keep the search for options simple, we allow each option to
117 belong to at most one group only. (we have a dummy GROUP_NONE for those
118 that don't want to belong to any...)
119 The caller of parseopts() specifies per bitpatter a set of groups where it
120 accepts options from.
123 /*- the group bits are:
124 - 000ooooo 00000000 000000uf 0000ssss
125 - ooooo: more detailed description to ssss (e.g., socket family)
126 - ssss: the type of stream, as in stat.h: S_IF...
127 - f: has a named entry in the file system
128 - u: has user and group
130 /* keep consistent with xiohelp.c:addressgroupnames[] ! */
132 #define GROUP_NONE 0x00000000
134 #define GROUP_FD 0x00000001 /* everything applyable to a fd */
135 #define GROUP_FIFO 0x00000002
136 #define GROUP_CHR 0x00000004
137 #define GROUP_BLK 0x00000008
138 #define GROUP_REG 0x00000010
139 #define GROUP_FILE GROUP_REG
140 #define GROUP_SOCKET 0x00000020
141 #define GROUP_READLINE 0x00000040
143 #define GROUP_NAMED 0x00000100 /* file system entry */
144 #define GROUP_OPEN 0x00000200 /* flags for open() */
145 #define GROUP_EXEC 0x00000400 /* program or script execution */
146 #define GROUP_FORK 0x00000800 /* communication with forked process */
148 #define GROUP_LISTEN 0x00001000 /* socket in listening mode */
150 #define GROUP_CHILD 0x00004000 /* autonom child process */
151 #define GROUP_RETRY 0x00008000 /* when open/connect etc. fails */
152 #define GROUP_TERMIOS 0x00010000
153 #define GROUP_RANGE 0x00020000 /* differs from GROUP_LISTEN */
154 #define GROUP_PTY 0x00040000 /* address pty or exec...,pty */
155 #define GROUP_PARENT 0x00080000 /* for parent of communicating child */
157 #define GROUP_SOCK_UNIX 0x00100000
158 #define GROUP_SOCK_IP4 0x00200000
159 #define GROUP_SOCK_IP6 0x00400000
160 #define GROUP_SOCK_IP (GROUP_SOCK_IP4|GROUP_SOCK_IP6)
161 #define GROUP_INTERFACE 0x00800000
162 #define GROUP_TUN GROUP_INTERFACE
164 #define GROUP_IP_UDP 0x01000000
165 #define GROUP_IP_TCP 0x02000000
166 #define GROUP_IPAPP (GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP) /* true: indicates one of UDP, TCP, SCTP */
167 #define GROUP_IP_SOCKS4 0x04000000
168 #define GROUP_OPENSSL 0x08000000
170 #define GROUP_PROCESS 0x10000000 /* a process related option */
171 #define GROUP_APPL 0x20000000 /* option handled by data loop */
172 #define GROUP_HTTP 0x40000000 /* any HTTP client */
173 #define GROUP_IP_SCTP 0x80000000
175 #define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
176 #define GROUP_ALL 0xffffffff
179 /* no IP multicasts, no error queue yet */
180 /* the only reason for keeping this enum sorted is to help detecting name
184 OPT_ADDRESS_FAMILY
= 1,
185 /* these are not alphabetically, I know... */
186 OPT_B0
, /* termios.c_cflag */
187 OPT_B50
, /* termios.c_cflag */
188 OPT_B75
, /* termios.c_cflag */
189 OPT_B110
, /* termios.c_cflag */
190 OPT_B134
, /* termios.c_cflag */
191 OPT_B150
, /* termios.c_cflag */
192 OPT_B200
, /* termios.c_cflag */
193 OPT_B300
, /* termios.c_cflag */
194 OPT_B600
, /* termios.c_cflag */
195 OPT_B900
, /* termios.c_cflag - HP-UX */
196 OPT_B1200
, /* termios.c_cflag */
197 OPT_B1800
, /* termios.c_cflag */
198 OPT_B2400
, /* termios.c_cflag */
199 OPT_B3600
, /* termios.c_cflag - HP-UX */
200 OPT_B4800
, /* termios.c_cflag */
201 OPT_B7200
, /* termios.c_cflag - HP-UX */
202 OPT_B9600
, /* termios.c_cflag */
203 OPT_B19200
, /* termios.c_cflag */
204 OPT_B38400
, /* termios.c_cflag */
205 OPT_B57600
, /* termios.c_cflag */
206 OPT_B115200
, /* termios.c_cflag */
207 OPT_B230400
, /* termios.c_cflag */
208 OPT_B460800
, /* termios.c_cflag */
209 OPT_B500000
, /* termios.c_cflag */
210 OPT_B576000
, /* termios.c_cflag */
211 OPT_B921600
, /* termios.c_cflag */
212 OPT_B1000000
, /* termios.c_cflag */
213 OPT_B1152000
, /* termios.c_cflag */
214 OPT_B1500000
, /* termios.c_cflag */
215 OPT_B2000000
, /* termios.c_cflag */
216 OPT_B2500000
, /* termios.c_cflag */
217 OPT_B3000000
, /* termios.c_cflag */
218 OPT_B3500000
, /* termios.c_cflag */
219 OPT_B4000000
, /* termios.c_cflag */
221 OPT_BIND
, /* a socket address as character string */
222 OPT_BRKINT
, /* termios.c_iflag */
225 OPT_BS0
, /* termios.c_oflag */
228 OPT_BS1
, /* termios.c_oflag */
230 OPT_BSDLY
, /* termios.c_oflag */
232 OPT_CHROOT
, /* chroot() past file system access */
233 OPT_CHROOT_EARLY
, /* chroot() before file system access */
234 /*OPT_CIBAUD,*/ /* termios.c_cflag */
235 OPT_CLOCAL
, /* termios.c_cflag */
237 OPT_CONNECT_TIMEOUT
, /* socket connect */
239 OPT_CR
, /* customized */
241 OPT_CR0
, /* termios.c_oflag */
244 OPT_CR1
, /* termios.c_oflag */
247 OPT_CR2
, /* termios.c_oflag */
250 OPT_CR3
, /* termios.c_oflag */
253 OPT_CRDLY
, /* termios.c_oflag */
255 OPT_CREAD
, /* termios.c_cflag */
256 OPT_CRNL
, /* customized */
258 OPT_CRTSCTS
, /* termios.c_cflag */
260 OPT_CS5
, /* termios.c_cflag */
261 OPT_CS6
, /* termios.c_cflag */
262 OPT_CS7
, /* termios.c_cflag */
263 OPT_CS8
, /* termios.c_cflag */
264 OPT_CSIZE
, /* termios.c_cflag */
265 OPT_CSTOPB
, /* termios.c_cflag */
266 OPT_DASH
, /* exec() */
267 OPT_ECHO
, /* termios.c_lflag */
268 OPT_ECHOCTL
, /* termios.c_lflag */
269 OPT_ECHOE
, /* termios.c_lflag */
270 OPT_ECHOK
, /* termios.c_lflag */
271 OPT_ECHOKE
, /* termios.c_lflag */
272 OPT_ECHONL
, /* termios.c_lflag */
274 OPT_ECHOPRT
, /* termios.c_lflag */
276 OPT_END_CLOSE
, /* xfd.stream.howtoend = END_CLOSE */
286 OPT_EXT2_JOURNAL_DATA
,
294 OPT_FF0
, /* termios.c_oflag */
297 OPT_FF1
, /* termios.c_oflag */
299 OPT_FFDLY
, /* termios.c_oflag */
302 OPT_FIOSETOWN
, /* asm/sockios.h */
304 OPT_FLOCK_EX
, /* flock(fd, LOCK_EX) */
305 OPT_FLOCK_EX_NB
, /* flock(fd, LOCK_EX|LOCK_NB) */
306 OPT_FLOCK_SH
, /* flock(fd, LOCK_SH) */
307 OPT_FLOCK_SH_NB
, /* flock(fd, LOCK_SH|LOCK_NB) */
308 OPT_FLUSHO
, /* termios.c_lflag */
312 OPT_FTRUNCATE32
, /* ftruncate() */
313 OPT_FTRUNCATE64
, /* ftruncate64() */
314 OPT_F_SETLKW_RD
, /* fcntl with struct flock - read-lock, wait */
315 OPT_F_SETLKW_WR
, /* fcntl with struct flock - write-lock, wait */
316 OPT_F_SETLK_RD
, /* fcntl with struct flock - read-lock */
317 OPT_F_SETLK_WR
, /* fcntl with struct flock - write-lock */
321 OPT_HISTORY_FILE
, /* readline history file */
322 OPT_HUPCL
, /* termios.c_cflag */
323 OPT_ICANON
, /* termios.c_lflag */
324 OPT_ICRNL
, /* termios.c_iflag */
325 OPT_IEXTEN
, /* termios.c_lflag */
326 OPT_IFF_ALLMULTI
, /* struct ifreq.ifr_flags */
327 OPT_IFF_AUTOMEDIA
, /* struct ifreq.ifr_flags */
328 OPT_IFF_BROADCAST
, /* struct ifreq.ifr_flags */
329 OPT_IFF_DEBUG
, /* struct ifreq.ifr_flags */
330 /*OPT_IFF_DYNAMIC,*/ /* struct ifreq.ifr_flags */
331 OPT_IFF_LOOPBACK
, /* struct ifreq.ifr_flags */
332 OPT_IFF_MASTER
, /* struct ifreq.ifr_flags */
333 OPT_IFF_MULTICAST
, /* struct ifreq.ifr_flags */
334 OPT_IFF_NOARP
, /* struct ifreq.ifr_flags */
335 OPT_IFF_NOTRAILERS
, /* struct ifreq.ifr_flags */
336 OPT_IFF_NO_PI
, /* tun: IFF_NO_PI */
337 OPT_IFF_PORTSEL
, /* struct ifreq.ifr_flags */
338 OPT_IFF_POINTOPOINT
, /* struct ifreq.ifr_flags */
339 OPT_IFF_PROMISC
, /* struct ifreq.ifr_flags */
340 OPT_IFF_RUNNING
, /* struct ifreq.ifr_flags */
341 OPT_IFF_SLAVE
, /* struct ifreq.ifr_flags */
342 OPT_IFF_UP
, /* struct ifreq.ifr_flags */
343 OPT_IGNBRK
, /* termios.c_iflag */
344 OPT_IGNCR
, /* termios.c_iflag */
345 OPT_IGNORECR
, /* HTTP */
346 OPT_IGNOREEOF
, /* customized */
347 OPT_IGNPAR
, /* termios.c_iflag */
348 OPT_IMAXBEL
, /* termios.c_iflag */
349 OPT_INLCR
, /* termios.c_iflag */
350 OPT_INPCK
, /* termios.c_iflag */
359 OPT_IPV6_RECVDSTOPTS
,
361 OPT_IPV6_RECVHOPLIMIT
,
362 OPT_IPV6_RECVHOPOPTS
,
363 OPT_IPV6_RECVPATHMTU
,
364 OPT_IPV6_RECVPKTINFO
,
369 OPT_IPV6_UNICAST_HOPS
,
371 #if 0 /* see Linux: man 7 netlink; probably not what we need yet */
374 OPT_IOCTL_BIN
, /* generic ioctl with binary value (pointed to) */
375 OPT_IOCTL_INT
, /* generic ioctl with integer value */
376 OPT_IOCTL_INTP
, /* generic ioctl with integer value (pointed to) */
377 OPT_IOCTL_STRING
, /* generic ioctl with integer value (pointed to) */
378 OPT_IOCTL_VOID
, /* generic ioctl without value */
379 OPT_IP_ADD_MEMBERSHIP
,
389 #ifdef IP_MTU_DISCOVER
393 OPT_IP_MULTICAST_LOOP
,
394 OPT_IP_MULTICAST_TTL
,
419 #ifdef IP_ROUTER_ALERT
424 OPT_ISIG
, /* termios.c_lflag */
425 OPT_ISPEED
, /* termios.c_ispeed */
426 OPT_ISTRIP
, /* termios.c_iflag */
428 OPT_IUCLC
, /* termios.c_iflag */
430 OPT_IXANY
, /* termios.c_iflag */
431 OPT_IXOFF
, /* termios.c_iflag */
432 OPT_IXON
, /* termios.c_iflag */
438 OPT_NL0
, /* termios.c_oflag */
441 OPT_NL1
, /* termios.c_oflag */
443 OPT_NLDLY
, /* termios.c_oflag */
445 OPT_NOECHO
, /* readline */
446 OPT_NOFLSH
, /* termios.c_lflag */
447 OPT_NOFORK
, /* exec, system */
448 OPT_NOPROMPT
, /* readline */
449 OPT_NULL_EOF
, /* receiving empty packet triggers EOF */
451 OPT_OCRNL
, /* termios.c_oflag */
454 OPT_OFDEL
, /* termios.c_oflag */
457 OPT_OFILL
, /* termios.c_oflag */
460 OPT_OLCUC
, /* termios.c_oflag */
462 OPT_ONLCR
, /* termios.c_oflag */
464 OPT_ONLRET
, /* termios.c_oflag */
467 OPT_ONOCR
, /* termios.c_oflag */
474 OPT_OPENSSL_CERTIFICATE
,
475 OPT_OPENSSL_CIPHERLIST
,
476 OPT_OPENSSL_COMMONNAME
,
477 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
478 OPT_OPENSSL_COMPRESS
,
487 OPT_OPOST
, /* termios.c_oflag */
488 OPT_OSPEED
, /* termios.c_ospeed */
493 OPT_O_BINARY
, /* Cygwin */
514 #if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
522 OPT_O_NOINHERIT
, /* Cygwin */
530 OPT_O_RDONLY
, /* open() */
531 OPT_O_RDWR
, /* open() */
541 OPT_O_TEXT
, /* Cygwin */
542 OPT_O_TRUNC
, /* open(): O_TRUNC */
543 OPT_O_WRONLY
, /* open() */
544 OPT_PARENB
, /* termios.c_cflag */
545 OPT_PARMRK
, /* termios.c_iflag */
546 OPT_PARODD
, /* termios.c_cflag */
549 OPT_PENDIN
, /* termios.c_lflag */
556 OPT_PROMPT
, /* readline */
557 OPT_PROTOCOL
, /* 6=TCP, 17=UDP */
558 OPT_PROTOCOL_FAMILY
, /* 1=PF_UNIX, 2=PF_INET, 10=PF_INET6 */
560 OPT_PROXY_AUTHORIZATION
,
562 #if HAVE_DEV_PTMX || HAVE_DEV_PTC
568 OPT_RANGE
, /* restrict client socket address */
569 OPT_RAW
, /* termios */
571 OPT_RES_AAONLY
, /* resolver(3) */
572 OPT_RES_DEBUG
, /* resolver(3) */
573 OPT_RES_DEFNAMES
, /* resolver(3) */
574 OPT_RES_DNSRCH
, /* resolver(3) */
575 OPT_RES_IGNTC
, /* resolver(3) */
576 OPT_RES_PRIMARY
, /* resolver(3) */
577 OPT_RES_RECURSE
, /* resolver(3) */
578 OPT_RES_STAYOPEN
, /* resolver(3) */
579 OPT_RES_USEVC
, /* resolver(3) */
581 OPT_SANE
, /* termios */
583 OPT_SCTP_MAXSEG_LATE
,
597 OPT_SETSOCKOPT_STRING
,
603 OPT_SHUT_NULL
, /* send 0 bytes on shutdown */
612 #endif /* SO_ACCEPTCONN */
613 #ifdef SO_ATTACH_FILTER
614 OPT_SO_ATTACH_FILTER
,
616 #ifdef SO_AUDIT /* AIX 4.3.3 */
618 #endif /* SO_AUDIT */
619 #ifdef SO_BINDTODEVICE
628 #endif /* SO_CKSUMRECV */
630 #ifdef SO_DETACH_FILTER
631 OPT_SO_DETACH_FILTER
,
633 #ifdef SO_DGRAM_ERRIND
642 #ifdef SO_KERNACCEPT /* AIX 4.3.3 */
644 #endif /* SO_KERNACCEPT */
649 #ifdef SO_NOREUSEADDR /* AIX 4.3.3 */
651 #endif /* SO_NOREUSEADDR */
671 #endif /* defined(SO_REUSEPORT) */
672 #ifdef SO_SECURITY_AUTHENTICATION
673 OPT_SO_SECURITY_AUTHENTICATION
,
675 #ifdef SO_SECURITY_ENCRYPTION_NETWORK
676 OPT_SO_SECURITY_ENCRYPTION_NETWORK
,
678 #ifdef SO_SECURITY_ENCRYPTION_TRANSPORT
679 OPT_SO_SECURITY_ENCRYPTION_TRANSPORT
,
686 OPT_SO_TIMESTAMP
, /* Linux */
688 #ifdef SO_USELOOPBACK
690 #endif /* SO_USELOOPBACK */
693 #endif /* SO_USE_IFBUFS */
694 #if 1 || defined(WITH_SOCKS4)
699 OPT_STDERR
, /* with exec, system */
700 # define ENABLE_OPTCODE
701 # include "xio-streams.h"
702 # undef ENABLE_OPTCODE
705 #if defined(HAVE_SETGRENT) && defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT)
706 OPT_SUBSTUSER_DELAYED
,
708 OPT_SYMBOLIC_LINK
, /* with pty */
711 OPT_TAB0
, /* termios.c_oflag */
714 OPT_TAB1
, /* termios.c_oflag */
717 OPT_TAB2
, /* termios.c_oflag */
720 OPT_TAB3
, /* termios.c_oflag */
722 OPT_TABDLY
, /* termios.c_oflag */
724 OPT_TCPWRAPPERS
, /* libwrap */
725 OPT_TCPWRAP_ETC
, /* libwrap */
726 OPT_TCPWRAP_HOSTS_ALLOW_TABLE
, /* libwrap */
727 OPT_TCPWRAP_HOSTS_DENY_TABLE
, /* libwrap */
728 OPT_TCP_ABORT_THRESHOLD
, /* HP-UX */
729 OPT_TCP_CONN_ABORT_THRESHOLD
, /* HP-UX */
733 #ifdef TCP_DEFER_ACCEPT
734 OPT_TCP_DEFER_ACCEPT
, /* Linux 2.4.0 */
737 OPT_TCP_INFO
, /* Linux 2.4.0 */
740 OPT_TCP_KEEPCNT
, /* Linux 2.4.0 */
743 OPT_TCP_KEEPIDLE
, /* Linux 2.4.0 */
745 OPT_TCP_KEEPINIT
, /* OSF1 */
747 OPT_TCP_KEEPINTVL
, /* Linux 2.4.0 */
750 OPT_TCP_LINGER2
, /* Linux 2.4.0 */
756 OPT_TCP_MD5SIG
, /* FreeBSD */
760 OPT_TCP_NOOPT
, /* FreeBSD */
761 OPT_TCP_NOPUSH
, /* FreeBSD */
762 OPT_TCP_PAWS
, /* OSF1 */
764 OPT_TCP_QUICKACK
, /* Linux 2.4 */
767 OPT_TCP_RFC1323
, /* AIX 4.3.3 */
769 OPT_TCP_SACKENA
, /* OSF1 */
770 OPT_TCP_SACK_DISABLE
, /* OpenBSD */
771 OPT_TCP_SIGNATURE_ENABLE
, /* OpenBSD */
773 OPT_TCP_STDURG
, /* AIX 4.3.3; Linux: see man 7 tcp */
776 OPT_TCP_SYNCNT
, /* Linux 2.4.0 */
778 OPT_TCP_TSOPTENA
, /* OSF1 */
779 #ifdef TCP_WINDOW_CLAMP
780 OPT_TCP_WINDOW_CLAMP
, /* Linux 2.4.0 */
782 OPT_TERMIOS_CFMAKERAW
, /* termios.cfmakeraw() */
785 OPT_TOSTOP
, /* termios.c_lflag */
786 OPT_TUN_DEVICE
, /* tun: /dev/net/tun ... */
787 OPT_TUN_NAME
, /* tun: tun0 */
788 OPT_TUN_TYPE
, /* tun: tun|tap */
790 OPT_UNIX_TIGHTSOCKLEN
, /* UNIX domain sockets */
799 OPT_VDISCARD
, /* termios.c_cc */
801 OPT_VDSUSP
, /* termios.c_cc - HP-UX */
802 OPT_VEOF
, /* termios.c_cc */
803 OPT_VEOL
, /* termios.c_cc */
804 OPT_VEOL2
, /* termios.c_cc */
805 OPT_VERASE
, /* termios.c_cc */
806 OPT_VINTR
, /* termios.c_cc */
807 OPT_VKILL
, /* termios.c_cc */
808 OPT_VLNEXT
, /* termios.c_cc */
809 OPT_VMIN
, /* termios.c_cc */
810 OPT_VQUIT
, /* termios.c_cc */
811 OPT_VREPRINT
, /* termios.c_cc */
812 OPT_VSTART
, /* termios.c_cc */
813 OPT_VSTOP
, /* termios.c_cc */
814 OPT_VSUSP
, /* termios.c_cc */
815 OPT_VSWTC
, /* termios.c_cc */
816 OPT_VTIME
, /* termios.c_cc */
819 OPT_VT0
, /* termios.c_oflag */
822 OPT_VT1
, /* termios.c_oflag */
824 OPT_VTDLY
, /* termios.c_oflag */
827 OPT_VWERASE
, /* termios.c_cc */
831 OPT_XCASE
, /* termios.c_lflag */
833 #if defined(TABDLY) && defined(XTABS)
834 OPT_XTABS
, /* termios.c_oflag */
836 OPT_nocomma
/* make aix xlc happy, no trailing comma */
839 /* keep consistent with xiohelp.c:optionphasenames ! */
841 PH_ALL
, /* not for option definitions; use in apply funcs to
843 PH_INIT
, /* retrieving info from original state */
844 PH_EARLY
, /* before any other processing */
845 PH_PREOPEN
, /* before file descriptor is created/opened */
846 PH_OPEN
, /* during filesystem entry creation/open */
847 PH_PASTOPEN
, /* past filesystem entry creation/open */
848 PH_PRESOCKET
, /* before socket call */
849 PH_SOCKET
, /* for socket call */
850 PH_PASTSOCKET
, /* after socket call */
851 PH_PREBIGEN
, /* before socketpair() pipe() openpty() */
852 PH_BIGEN
, /* during socketpair() pipe() openpty() */
853 PH_PASTBIGEN
, /* past socketpair() pipe() openpty() */
854 PH_FD
, /* soon after FD creation or identification */
855 PH_PREBIND
, /* before socket bind() */
856 PH_BIND
, /* during socket bind() ? */
857 PH_PASTBIND
, /* past socket bind() - for client and server sockets! */
858 PH_PRELISTEN
, /* before socket listen() */
859 PH_LISTEN
, /* during socket listen() ? */
860 PH_PASTLISTEN
, /* after socket listen() */
861 PH_PRECONNECT
, /* before socket connect() */
862 PH_CONNECT
, /* during socket connect() ? */
863 PH_PASTCONNECT
, /* after socket connect() */
864 PH_PREACCEPT
, /* before socket accept() */
865 PH_ACCEPT
, /* during socket accept() ? */
866 PH_PASTACCEPT
, /* after socket accept() */
867 PH_CONNECTED
, /* for sockets, after connect() or accept() */
868 PH_PREFORK
, /* before fork() (with both listen and exec!) */
869 PH_FORK
, /* during fork() (with both listen and exec!) */
870 PH_PASTFORK
, /* after fork() (with both listen and exec!) */
871 PH_LATE
, /* FD is ready, before start of data loop */
872 PH_LATE2
, /* FD is ready, dropping privileges */
873 PH_PREEXEC
, /* before exec() or system() */
874 PH_EXEC
, /* during exec() or system() */
875 PH_SPEC
/* specific to situation, not fix */
878 /* atomic structure to describe the syntax and more important semantics of an
881 const char *defname
; /* default name */
882 const char *nickname
; /* usual name */
883 enum e_optcode optcode
; /* short form of option name */
885 enum e_phase phase
; /* when this option is to be used */
886 enum e_types type
; /* the data type as expected on input, and stored */
887 enum e_func func
; /* which function can apply this option, e.g. ioctl(),
888 getsockopt(), or just a bit pattern */
889 int major
; /* major id for func: level (SOL_...) for setsockopt(),
890 request for ioctl() */
891 int minor
; /* minor id for func: SO_..., IP_..., */
895 extern bool xioopts_ignoregroups
;
896 extern const struct optname optionnames
[];
899 extern int retropt_bool(struct opt
*opts
, int optcode
, bool *result
);
900 extern int retropt_short(struct opt
*opts
, int optcode
, short *result
);
901 extern int retropt_ushort(struct opt
*opts
, int optcode
, unsigned short *result
);
902 extern int retropt_int(struct opt
*opts
, int optcode
, int *result
);
903 extern int retropt_uint(struct opt
*opts
, int optcode
, unsigned int *result
);
904 extern int retropt_long(struct opt
*opts
, int optcode
, long *result
);
905 extern int retropt_ulong(struct opt
*opts
, int optcode
, unsigned long *result
);
906 extern int retropt_flag(struct opt
*opts
, int optcode
, flags_t
*result
);
907 extern int retropt_string(struct opt
*opts
, int optcode
, char **result
);
908 extern int retropt_timespec(struct opt
*opts
, int optcode
, struct timespec
*result
);
909 extern int retropt_bind(struct opt
*opts
,
915 int feats
, /* TCP etc: 1..address allowed,
916 3..address and port allowed */
917 unsigned long res_opts0
, unsigned long res_opts1
);
918 extern int applyopts(int fd
, struct opt
*opts
, enum e_phase phase
);
919 extern int applyopts2(int fd
, struct opt
*opts
, unsigned int from
,
921 extern int applyopts_flags(struct opt
*opts
, int group
, flags_t
*result
);
922 extern int applyopts_cloexec(int fd
, struct opt
*opts
);
923 extern int applyopts_early(const char *path
, struct opt
*opts
);
924 extern int applyopts_fchown(int fd
, struct opt
*opts
);
925 extern int applyopts_single(struct single
*fd
, struct opt
*opts
, enum e_phase phase
);
926 extern int applyopts_offset(struct single
*xfd
, struct opt
*opts
);
927 extern int applyopts_signal(struct single
*xfd
, struct opt
*opts
);
928 extern int _xio_openlate(struct single
*fd
, struct opt
*opts
);
929 extern int parseopts(const char **a
, unsigned int groups
, struct opt
**opts
);
930 extern int parseopts_table(const char **a
, unsigned int groups
,
932 const struct optname optionnames
[], size_t optionnum
);
933 extern struct opt
*copyopts(const struct opt
*opts
, unsigned int groups
);
934 extern struct opt
*moveopts(struct opt
*opts
, unsigned int groups
);
935 extern int leftopts(const struct opt
*opts
);
936 extern int showleft(const struct opt
*opts
);
937 extern int groupbits(int fd
);
938 extern int _groupbits(mode_t mode
);
939 extern int dropopts(struct opt
*opts
, unsigned int phase
);
940 extern int dropopts2(struct opt
*opts
, unsigned int from
, unsigned int to
);
942 #if HAVE_BASIC_UID_T==1
943 # define retropt_uid(o,c,r) retropt_short(o,c,r)
944 #elif HAVE_BASIC_UID_T==2
945 # define retropt_uid(o,c,r) retropt_ushort(o,c,r)
946 #elif HAVE_BASIC_UID_T==3
947 # define retropt_uid(o,c,r) retropt_int(o,c,r)
948 #elif HAVE_BASIC_UID_T==4
949 # define retropt_uid(o,c,r) retropt_uint(o,c,r)
950 #elif HAVE_BASIC_UID_T==5
951 # define retropt_uid(o,c,r) retropt_long(o,c,r)
952 #elif HAVE_BASIC_UID_T==6
953 # define retropt_uid(o,c,r) retropt_ulong(o,c,r)
955 # error "HAVE_BASIC_UID_T is out of range: " HAVE_BASIC_UID_T
958 #if HAVE_BASIC_GID_T==1
959 # define retropt_gid(o,c,r) retropt_short(o,c,r)
960 #elif HAVE_BASIC_GID_T==2
961 # define retropt_gid(o,c,r) retropt_ushort(o,c,r)
962 #elif HAVE_BASIC_GID_T==3
963 # define retropt_gid(o,c,r) retropt_int(o,c,r)
964 #elif HAVE_BASIC_GID_T==4
965 # define retropt_gid(o,c,r) retropt_uint(o,c,r)
966 #elif HAVE_BASIC_GID_T==5
967 # define retropt_gid(o,c,r) retropt_long(o,c,r)
968 #elif HAVE_BASIC_GID_T==6
969 # define retropt_gid(o,c,r) retropt_ulong(o,c,r)
971 # error "HAVE_BASIC_GID_T is out of range: " HAVE_BASIC_GID_T
974 #if HAVE_BASIC_MODE_T==1
975 # define retropt_mode(o,c,r) retropt_short(o,c,r)
976 #elif HAVE_BASIC_MODE_T==2
977 # define retropt_mode(o,c,r) retropt_ushort(o,c,r)
978 #elif HAVE_BASIC_MODE_T==3
979 # define retropt_mode(o,c,r) retropt_int(o,c,r)
980 #elif HAVE_BASIC_MODE_T==4
981 # define retropt_mode(o,c,r) retropt_uint(o,c,r)
982 #elif HAVE_BASIC_MODE_T==5
983 # define retropt_mode(o,c,r) retropt_long(o,c,r)
984 #elif HAVE_BASIC_MODE_T==6
985 # define retropt_mode(o,c,r) retropt_ulong(o,c,r)
987 # error "HAVE_BASIC_MODE_T is out of range: " HAVE_BASIC_MODE_T
990 #endif /* !defined(__xioopts_h_included) */