diff --git a/CHANGES b/CHANGES index 4122c3d..d0d974d 100644 --- a/CHANGES +++ b/CHANGES @@ -28,8 +28,11 @@ Corrections: Now catching the case of empty SNI host to prevent OpenSSL error. This is related to Red Hat issue 2081414. + Better formatted help output; address keywords in help output are now + printed in uppercase. + Coding: - Introduced groups_t instead of uint32_t, for more flexibility + Introduced groups_t instead of uint32_t, for more flexibility. Rearranged option group bits to only require 32 bits on older systems. diff --git a/socat.c b/socat.c index 1dcd461..9f09305 100644 --- a/socat.c +++ b/socat.c @@ -424,7 +424,7 @@ void socat_usage(FILE *fd) { fputs(copyright_socat, fd); fputc('\n', fd); fputs("Usage:\n", fd); fputs("socat [options] \n", fd); - fputs(" options:\n", fd); + fputs(" options (general command line options):\n", fd); fputs(" -V print version and feature information to stdout, and exit\n", fd); #if WITH_HELP fputs(" -h|-? print a help text describing command line options and addresses\n", fd); diff --git a/test.sh b/test.sh index fec51b1..24dde14 100755 --- a/test.sh +++ b/test.sh @@ -622,7 +622,7 @@ case "$TESTS" in # test if address options array ("optionnames") is sorted alphabetically: $ECHO "testing if address options are sorted...\c" TF="$TD/socat-qq" -$SOCAT -??? |sed '1,/opt:/ d' |awk '{print($1);}' >"$TF" +$SOCAT -hhh |sed '1,/opt:/ d' |awk '{print($1);}' >"$TF" LC_ALL=C sort "$TF" |diff "$TF" - >"$TF-diff" if [ -s "$TF-diff" ]; then $ECHO "\n*** option array is not sorted. Wrong entries:" >&2 @@ -776,7 +776,7 @@ testoptions () { local a A; for a in $@; do A=$(echo "$a" |tr 'a-z' 'A-Z') - if $SOCAT -??? |grep "[^a-z0-9-]$a[^a-z0-9-]" >/dev/null; then + if $SOCAT -hhh |grep "[^a-z0-9-]$a[^a-z0-9-]" >/dev/null; then shift continue fi @@ -933,35 +933,35 @@ runsip6 () { # check if TCP on IPv4 is available on host runstcp4 () { runsip4 >/dev/null || { echo TCP4; return 1; } - $SOCAT -h |grep ' tcp4-' >/dev/null || return 1 + $SOCAT -h |grep -i ' TCP4-' >/dev/null || return 1 return 0; } # check if TCP on IPv6 is available on host runstcp6 () { runsip6 >/dev/null || { echo TCP6; return 1; } - $SOCAT -h |grep ' tcp6-' >/dev/null || return 1 + $SOCAT -h |grep -i ' TCP6-' >/dev/null || return 1 return 0; } # check if UDP on IPv4 is available on host runsudp4 () { runsip4 >/dev/null || { echo UDP4; return 1; } - $SOCAT -h |grep ' udp4-' >/dev/null || return 1 + $SOCAT -h |grep -i ' UDP4-' >/dev/null || return 1 return 0; } # check if UDP on IPv6 is available on host runsudp6 () { runsip6 >/dev/null || { echo UDP6; return 1; } - $SOCAT -h |grep ' udp6-' >/dev/null || return 1 + $SOCAT -h |grep -i ' UDP6-' >/dev/null || return 1 return 0; } # check if SCTP on IPv4 is available on host runssctp4 () { runsip4 >/dev/null || { echo SCTP4; return 1; } - $SOCAT -h |grep ' sctp4-' >/dev/null || return 1 + $SOCAT -h |grep -i ' SCTP4-' >/dev/null || return 1 $SOCAT /dev/null SCTP4-L:0,accept-timeout=0.001 2>/dev/null || return 1; return 0; } @@ -969,7 +969,7 @@ runssctp4 () { # check if SCTP on IPv6 is available on host runssctp6 () { runsip6 >/dev/null || { echo SCTP6; return 1; } - $SOCAT -h |grep ' sctp6-' >/dev/null || return 1 + $SOCAT -h |grep ' SCTP6-' >/dev/null || return 1 $SOCAT /dev/null SCTP6-L:0,accept-timeout=0.001 2>/dev/null || return 1; return 0; } diff --git a/xio-creat.c b/xio-creat.c index c3c2af8..de5faac 100644 --- a/xio-creat.c +++ b/xio-creat.c @@ -17,7 +17,7 @@ static int xioopen_creat(int arg, const char *argv[], struct opt *opts, int rw, /*! within stream model, this is a write-only address - use 2 instead of 3 */ -const struct addrdesc addr_creat = { "create", 3, xioopen_creat, GROUP_FD|GROUP_NAMED|GROUP_FILE, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_creat = { "CREATE", 3, xioopen_creat, GROUP_FD|GROUP_NAMED|GROUP_FILE, 0, 0, 0 HELP(":") }; /* retrieve the mode option and perform the creat() call. diff --git a/xio-creat.h b/xio-creat.h index 2718262..a62cd3b 100644 --- a/xio-creat.h +++ b/xio-creat.h @@ -5,6 +5,6 @@ #ifndef __xio_creat_h_included #define __xio_creat_h_included 1 -extern const struct addrdesc addr_creat; +extern const struct addrdesc xioaddr_creat; #endif /* !defined(__xio_creat_h_included) */ diff --git a/xio-exec.c b/xio-exec.c index dd1acab..56c2929 100644 --- a/xio-exec.c +++ b/xio-exec.c @@ -20,7 +20,7 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts, int dummy1, int dummy2, int dummy3 ); -const struct addrdesc addr_exec = { "exec", 3, xioopen_exec, GROUP_FD|GROUP_FORK|GROUP_EXEC|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_TERMIOS|GROUP_FIFO|GROUP_PTY|GROUP_PARENT, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_exec = { "EXEC", 3, xioopen_exec, GROUP_FD|GROUP_FORK|GROUP_EXEC|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_TERMIOS|GROUP_FIFO|GROUP_PTY|GROUP_PARENT, 0, 0, 0 HELP(":") }; const struct optdesc opt_dash = { "dash", "login", OPT_DASH, GROUP_EXEC, PH_PREEXEC, TYPE_BOOL, OFUNC_SPEC }; diff --git a/xio-exec.h b/xio-exec.h index 221eeb2..15e2331 100644 --- a/xio-exec.h +++ b/xio-exec.h @@ -5,7 +5,7 @@ #ifndef __xio_exec_h_included #define __xio_exec_h_included 1 -extern const struct addrdesc addr_exec; +extern const struct addrdesc xioaddr_exec; extern const struct optdesc opt_dash; diff --git a/xio-fdnum.c b/xio-fdnum.c index 70015d0..1299b43 100644 --- a/xio-fdnum.c +++ b/xio-fdnum.c @@ -15,7 +15,7 @@ static int xioopen_fdnum(int argc, const char *argv[], struct opt *opts, int rw, xiofile_t *xfd, groups_t groups, int dummy1, int dummy2, int dummy3); -const struct addrdesc addr_fd = { "fd", 3, xioopen_fdnum, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_fd = { "FD", 3, xioopen_fdnum, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(":") }; /* use some file descriptor and apply the options. Set the FD_CLOEXEC flag. */ diff --git a/xio-fdnum.h b/xio-fdnum.h index baf89aa..06f1766 100644 --- a/xio-fdnum.h +++ b/xio-fdnum.h @@ -5,7 +5,7 @@ #ifndef __xio_fdnum_h_included #define __xio_fdnum_h_included 1 -extern const struct addrdesc addr_fd; +extern const struct addrdesc xioaddr_fd; extern int xioopen_fd(struct opt *opts, int rw, xiosingle_t *xfd, int numfd, int dummy2, int dummy3); diff --git a/xio-file.c b/xio-file.c index 27b3fab..9227fb4 100644 --- a/xio-file.c +++ b/xio-file.c @@ -66,7 +66,7 @@ const struct optdesc opt_o_trunc = { "o-trunc", "trunc", OPT_O_TRUNC, #if _WITH_FILE /*! inconsistent name FILE vs. OPEN */ -const struct addrdesc addr_open = { "open", 3, xioopen_open, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_open = { "OPEN", 3, xioopen_open, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS, 0, 0, 0 HELP(":") }; /* open for writing: if the filesystem entry already exists, the data is appended diff --git a/xio-file.h b/xio-file.h index c52b668..f592d68 100644 --- a/xio-file.h +++ b/xio-file.h @@ -26,6 +26,6 @@ extern const struct optdesc opt_o_priv; extern const struct optdesc opt_o_trunc; extern const struct optdesc opt_o_noatime; -extern const struct addrdesc addr_open; +extern const struct addrdesc xioaddr_open; #endif /* !defined(__xio_file_h_included) */ diff --git a/xio-gopen.c b/xio-gopen.c index 6321330..0bd62fd 100644 --- a/xio-gopen.c +++ b/xio-gopen.c @@ -17,7 +17,7 @@ static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3); -const struct addrdesc addr_gopen = { "gopen", 3, xioopen_gopen, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS|GROUP_SOCKET|GROUP_SOCK_UNIX, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_gopen = { "GOPEN", 3, xioopen_gopen, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_REG|GROUP_NAMED|GROUP_OPEN|GROUP_FILE|GROUP_TERMIOS|GROUP_SOCKET|GROUP_SOCK_UNIX, 0, 0, 0 HELP(":") }; static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3) { const char *filename = argv[1]; diff --git a/xio-gopen.h b/xio-gopen.h index 6c5e8e7..301be95 100644 --- a/xio-gopen.h +++ b/xio-gopen.h @@ -5,6 +5,6 @@ #ifndef __xio_gopen_h_included #define __xio_gopen_h_included 1 -extern const struct addrdesc addr_gopen; +extern const struct addrdesc xioaddr_gopen; #endif /* !defined(__xio_gopen_h_included) */ diff --git a/xio-interface.c b/xio-interface.c index cae24b3..1c9106f 100644 --- a/xio-interface.c +++ b/xio-interface.c @@ -19,7 +19,7 @@ int xioopen_interface(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, groups_t groups, int pf, int dummy2, int dummy3); -const struct addrdesc xioaddr_interface= { "interface", 3, xioopen_interface, GROUP_FD|GROUP_SOCKET, PF_PACKET, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_interface= { "INTERFACE", 3, xioopen_interface, GROUP_FD|GROUP_SOCKET, PF_PACKET, 0, 0 HELP(":") }; static diff --git a/xio-openssl.c b/xio-openssl.c index 026489f..29413ad 100644 --- a/xio-openssl.c +++ b/xio-openssl.c @@ -62,7 +62,7 @@ static int openssl_delete_cert_info(void); /* description record for ssl connect */ const struct addrdesc xioaddr_openssl = { - "openssl", /* keyword for selecting this address type in xioopen calls + "OPENSSL", /* keyword for selecting this address type in xioopen calls (canonical or main name) */ 3, /* data flow directions this address supports on API layer: 1..read, 2..write, 3..both */ @@ -83,7 +83,7 @@ const struct addrdesc xioaddr_openssl = { #if WITH_LISTEN /* description record for ssl listen */ const struct addrdesc xioaddr_openssl_listen = { - "openssl-listen", /* keyword for selecting this address type in xioopen calls + "OPENSSL-LISTEN", /* keyword for selecting this address type in xioopen calls (canonical or main name) */ 3, /* data flow directions this address supports on API layer: 1..read, 2..write, 3..both */ @@ -102,9 +102,9 @@ const struct addrdesc xioaddr_openssl_listen = { } ; #endif /* WITH_LISTEN */ -const struct addrdesc xioaddr_openssl_dtls_client = { "openssl-dtls-client", 3, xioopen_openssl_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_OPENSSL|GROUP_RETRY, 1, 0, 0 HELP("::") } ; +const struct addrdesc xioaddr_openssl_dtls_client = { "OPENSSL-DTLS-CLIENT", 3, xioopen_openssl_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_OPENSSL|GROUP_RETRY, 1, 0, 0 HELP("::") } ; #if WITH_LISTEN -const struct addrdesc xioaddr_openssl_dtls_server = { "openssl-dtls-server", 3, xioopen_openssl_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_OPENSSL|GROUP_RETRY, 1, 0, 0 HELP(":") } ; +const struct addrdesc xioaddr_openssl_dtls_server = { "OPENSSL-DTLS-SERVER", 3, xioopen_openssl_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_OPENSSL|GROUP_RETRY, 1, 0, 0 HELP(":") } ; #endif /* both client and server */ diff --git a/xio-pipe.c b/xio-pipe.c index b5b9719..4a18f32 100644 --- a/xio-pipe.c +++ b/xio-pipe.c @@ -16,7 +16,7 @@ static int xioopen_fifo(int argc, const char *argv[], struct opt *opts, int xiof static int xioopen_fifo_unnamed(xiofile_t *sock, struct opt *opts); -const struct addrdesc addr_pipe = { "pipe", 3, xioopen_fifo, GROUP_FD|GROUP_NAMED|GROUP_OPEN|GROUP_FIFO, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_pipe = { "PIPE", 3, xioopen_fifo, GROUP_FD|GROUP_NAMED|GROUP_OPEN|GROUP_FIFO, 0, 0, 0 HELP("[:]") }; /* process an unnamed bidirectional "pipe" or "fifo" or "echo" argument with diff --git a/xio-pipe.h b/xio-pipe.h index 7e8fe5e..34d95fa 100644 --- a/xio-pipe.h +++ b/xio-pipe.h @@ -5,7 +5,7 @@ #ifndef __xio_pipe_h_included #define __xio_pipe_h_included 1 -const extern struct addrdesc addr_pipe; +extern const struct addrdesc xioaddr_pipe; extern int xioopen_fifo_unnamed(char *arg, xiofile_t *sock); diff --git a/xio-proxy.c b/xio-proxy.c index d4d664d..47d133f 100644 --- a/xio-proxy.c +++ b/xio-proxy.c @@ -31,7 +31,7 @@ const struct optdesc opt_proxy_resolve = { "proxy-resolve", "resolve", OPT_P const struct optdesc opt_proxy_authorization = { "proxy-authorization", "proxyauth", OPT_PROXY_AUTHORIZATION, GROUP_HTTP, PH_LATE, TYPE_STRING, OFUNC_SPEC }; const struct optdesc opt_proxy_authorization_file = { "proxy-authorization-file", "proxyauthfile", OPT_PROXY_AUTHORIZATION_FILE, GROUP_HTTP, PH_LATE, TYPE_STRING, OFUNC_SPEC }; -const struct addrdesc addr_proxy_connect = { "proxy", 3, xioopen_proxy_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_HTTP|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; +const struct addrdesc xioaddr_proxy_connect = { "PROXY", 3, xioopen_proxy_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_HTTP|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; /*0#define CONNLEN 40*/ /* "CONNECT 123.156.189.123:65432 HTTP/1.0\r\n\0" */ diff --git a/xio-proxy.h b/xio-proxy.h index be68ccb..f74a9bc 100644 --- a/xio-proxy.h +++ b/xio-proxy.h @@ -21,7 +21,7 @@ extern const struct optdesc opt_proxy_resolve; extern const struct optdesc opt_proxy_authorization; extern const struct optdesc opt_proxy_authorization_file; -extern const struct addrdesc addr_proxy_connect; +extern const struct addrdesc xioaddr_proxy_connect; int _xioopen_proxy_prepare(struct proxyvars *proxyvars, struct opt *opts, const char *targetname, const char *targetport); diff --git a/xio-pty.c b/xio-pty.c index cf508aa..8e35e91 100644 --- a/xio-pty.c +++ b/xio-pty.c @@ -20,7 +20,7 @@ static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3); -const struct addrdesc addr_pty = { "pty", 3, xioopen_pty, GROUP_NAMED|GROUP_FD|GROUP_TERMIOS|GROUP_PTY, 0, 0, 0 HELP("") }; +const struct addrdesc xioaddr_pty = { "PTY", 3, xioopen_pty, GROUP_NAMED|GROUP_FD|GROUP_TERMIOS|GROUP_PTY, 0, 0, 0 HELP("") }; const struct optdesc opt_symbolic_link = { "symbolic-link", "link", OPT_SYMBOLIC_LINK, GROUP_PTY, PH_LATE, TYPE_FILENAME, OFUNC_SPEC, 0, 0 }; #if HAVE_POLL diff --git a/xio-pty.h b/xio-pty.h index bdc91e3..ef141a0 100644 --- a/xio-pty.h +++ b/xio-pty.h @@ -5,7 +5,7 @@ #ifndef __xio_pty_h_included #define __xio_pty_h_included 1 -extern const struct addrdesc addr_pty; +extern const struct addrdesc xioaddr_pty; extern const struct optdesc opt_symbolic_link; #if HAVE_POLL diff --git a/xio-rawip.c b/xio-rawip.c index d3340ea..e355476 100644 --- a/xio-rawip.c +++ b/xio-rawip.c @@ -39,23 +39,23 @@ int _xioopen_rawip_sendto(const char *hostname, const char *protname, struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int *pf); -const struct addrdesc addr_rawip_sendto = { "ip-sendto", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6, PF_UNSPEC, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip_datagram= { "ip-datagram", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_RANGE, PF_UNSPEC, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip_recvfrom= { "ip-recvfrom", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, SOCK_RAW, 0 HELP(":") }; -const struct addrdesc addr_rawip_recv = { "ip-recv", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_RANGE, PF_UNSPEC, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip_sendto = { "IP-SENDTO", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6, PF_UNSPEC, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip_datagram= { "IP-DATAGRAM", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_RANGE, PF_UNSPEC, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip_recvfrom= { "IP-RECVFROM", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip_recv = { "IP-RECV", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_RANGE, PF_UNSPEC, SOCK_RAW, 0 HELP(":") }; #if WITH_IP4 -const struct addrdesc addr_rawip4_sendto = { "ip4-sendto", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4, PF_INET, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip4_datagram= { "ip4-datagram", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_RANGE, PF_INET, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip4_recvfrom= { "ip4-recvfrom", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_CHILD|GROUP_RANGE, PF_INET, SOCK_RAW, 0 HELP(":") }; -const struct addrdesc addr_rawip4_recv = { "ip4-recv", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_RANGE, PF_INET, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip4_sendto = { "IP4-SENDTO", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4, PF_INET, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip4_datagram= { "IP4-DATAGRAM", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_RANGE, PF_INET, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip4_recvfrom= { "IP4-RECVFROM", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_CHILD|GROUP_RANGE, PF_INET, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip4_recv = { "IP4-RECV", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_RANGE, PF_INET, SOCK_RAW, 0 HELP(":") }; #endif #if WITH_IP6 -const struct addrdesc addr_rawip6_sendto = { "ip6-sendto", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6, PF_INET6, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip6_datagram= { "ip6-datagram", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_RANGE, PF_INET6, 0, 0 HELP("::") }; -const struct addrdesc addr_rawip6_recvfrom= { "ip6-recvfrom", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_CHILD|GROUP_RANGE, PF_INET6, SOCK_RAW, 0 HELP(":") }; -const struct addrdesc addr_rawip6_recv = { "ip6-recv", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_RANGE, PF_INET6, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip6_sendto = { "IP6-SENDTO", 3, xioopen_rawip_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6, PF_INET6, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip6_datagram= { "IP6-DATAGRAM", 3, xioopen_rawip_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_RANGE, PF_INET6, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_rawip6_recvfrom= { "IP6-RECVFROM", 3, xioopen_rawip_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_CHILD|GROUP_RANGE, PF_INET6, SOCK_RAW, 0 HELP(":") }; +const struct addrdesc xioaddr_rawip6_recv = { "IP6-RECV", 1, xioopen_rawip_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_RANGE, PF_INET6, SOCK_RAW, 0 HELP(":") }; #endif diff --git a/xio-rawip.h b/xio-rawip.h index e6541e6..d88d3c2 100644 --- a/xio-rawip.h +++ b/xio-rawip.h @@ -5,17 +5,17 @@ #ifndef __xio_rawip_h_included #define __xio_rawip_h_included 1 -extern const struct addrdesc addr_rawip_sendto; -extern const struct addrdesc addr_rawip_datagram; -extern const struct addrdesc addr_rawip_recvfrom; -extern const struct addrdesc addr_rawip_recv; -extern const struct addrdesc addr_rawip4_sendto; -extern const struct addrdesc addr_rawip4_datagram; -extern const struct addrdesc addr_rawip4_recvfrom; -extern const struct addrdesc addr_rawip4_recv; -extern const struct addrdesc addr_rawip6_sendto; -extern const struct addrdesc addr_rawip6_datagram; -extern const struct addrdesc addr_rawip6_recvfrom; -extern const struct addrdesc addr_rawip6_recv; +extern const struct addrdesc xioaddr_rawip_sendto; +extern const struct addrdesc xioaddr_rawip_datagram; +extern const struct addrdesc xioaddr_rawip_recvfrom; +extern const struct addrdesc xioaddr_rawip_recv; +extern const struct addrdesc xioaddr_rawip4_sendto; +extern const struct addrdesc xioaddr_rawip4_datagram; +extern const struct addrdesc xioaddr_rawip4_recvfrom; +extern const struct addrdesc xioaddr_rawip4_recv; +extern const struct addrdesc xioaddr_rawip6_sendto; +extern const struct addrdesc xioaddr_rawip6_datagram; +extern const struct addrdesc xioaddr_rawip6_recvfrom; +extern const struct addrdesc xioaddr_rawip6_recv; #endif /* !defined(__xio_rawip_h_included) */ diff --git a/xio-readline.c b/xio-readline.c index a17fe66..233366b 100644 --- a/xio-readline.c +++ b/xio-readline.c @@ -30,7 +30,7 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts, int dummy1, int dummy2, int dummy3); -const struct addrdesc addr_readline = { "readline", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) }; +const struct addrdesc xioaddr_readline = { "READLINE", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) }; const struct optdesc opt_history_file = { "history-file", "history", OPT_HISTORY_FILE, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.history_file) }; const struct optdesc opt_prompt = { "prompt", NULL, OPT_PROMPT, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.prompt) }; diff --git a/xio-readline.h b/xio-readline.h index bd43b48..290189e 100644 --- a/xio-readline.h +++ b/xio-readline.h @@ -5,7 +5,7 @@ #ifndef __xio_readline_h_included #define __xio_readline_h_included 1 -extern const struct addrdesc addr_readline; +extern const struct addrdesc xioaddr_readline; extern const struct optdesc opt_history_file; extern const struct optdesc opt_prompt; diff --git a/xio-sctp.c b/xio-sctp.c index 61aee10..482b836 100644 --- a/xio-sctp.c +++ b/xio-sctp.c @@ -17,23 +17,23 @@ /****** SCTP addresses ******/ #if WITH_IP4 || WITH_IP6 -const struct addrdesc addr_sctp_connect = { "sctp-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP("::") }; +const struct addrdesc xioaddr_sctp_connect = { "SCTP-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_sctp_listen = { "sctp-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":") }; +const struct addrdesc xioaddr_sctp_listen = { "SCTP-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":") }; #endif #endif #if WITH_IP4 -const struct addrdesc addr_sctp4_connect = { "sctp4-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP("::") }; +const struct addrdesc xioaddr_sctp4_connect = { "SCTP4-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_sctp4_listen = { "sctp4-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":") }; +const struct addrdesc xioaddr_sctp4_listen = { "SCTP4-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":") }; #endif #endif /* WITH_IP4 */ #if WITH_IP6 -const struct addrdesc addr_sctp6_connect = { "sctp6-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP("::") }; +const struct addrdesc xioaddr_sctp6_connect = { "SCTP6-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_sctp6_listen = { "sctp6-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP(":") }; +const struct addrdesc xioaddr_sctp6_listen = { "SCTP6-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_SCTP, PF_INET6 HELP(":") }; #endif #endif /* WITH_IP6 */ diff --git a/xio-sctp.h b/xio-sctp.h index c8cc606..dab5d6f 100644 --- a/xio-sctp.h +++ b/xio-sctp.h @@ -5,12 +5,12 @@ #ifndef __xio_sctp_h_included #define __xio_sctp_h_included 1 -extern const struct addrdesc addr_sctp_connect; -extern const struct addrdesc addr_sctp_listen; -extern const struct addrdesc addr_sctp4_connect; -extern const struct addrdesc addr_sctp4_listen; -extern const struct addrdesc addr_sctp6_connect; -extern const struct addrdesc addr_sctp6_listen; +extern const struct addrdesc xioaddr_sctp_connect; +extern const struct addrdesc xioaddr_sctp_listen; +extern const struct addrdesc xioaddr_sctp4_connect; +extern const struct addrdesc xioaddr_sctp4_listen; +extern const struct addrdesc xioaddr_sctp6_connect; +extern const struct addrdesc xioaddr_sctp6_listen; extern const struct optdesc opt_sctp_nodelay; extern const struct optdesc opt_sctp_maxseg; diff --git a/xio-socket.c b/xio-socket.c index c2eaa8a..e5b8391 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -78,14 +78,14 @@ static int xiobind( #if WITH_GENERICSOCKET /* generic socket addresses */ -const struct addrdesc xioaddr_socket_connect = { "socket-connect", 1, xioopen_socket_connect, GROUP_FD|GROUP_SOCKET|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; +const struct addrdesc xioaddr_socket_connect = { "SOCKET-CONNECT", 1, xioopen_socket_connect, GROUP_FD|GROUP_SOCKET|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; #if WITH_LISTEN -const struct addrdesc xioaddr_socket_listen = { "socket-listen", 1, xioopen_socket_listen, GROUP_FD|GROUP_SOCKET|GROUP_LISTEN|GROUP_RANGE|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; +const struct addrdesc xioaddr_socket_listen = { "SOCKET-LISTEN", 1, xioopen_socket_listen, GROUP_FD|GROUP_SOCKET|GROUP_LISTEN|GROUP_RANGE|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; #endif /* WITH_LISTEN */ -const struct addrdesc xioaddr_socket_sendto = { "socket-sendto", 3, xioopen_socket_sendto, GROUP_FD|GROUP_SOCKET, 0, 0, 0 HELP("::::") }; -const struct addrdesc xioaddr_socket_datagram= { "socket-datagram", 3, xioopen_socket_datagram, GROUP_FD|GROUP_SOCKET|GROUP_RANGE, 0, 0, 0 HELP("::::") }; -const struct addrdesc xioaddr_socket_recvfrom= { "socket-recvfrom", 3, xioopen_socket_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_RANGE|GROUP_CHILD, 0, 0, 0 HELP("::::") }; -const struct addrdesc xioaddr_socket_recv = { "socket-recv", 1, xioopen_socket_recv, GROUP_FD|GROUP_SOCKET|GROUP_RANGE, 0, 0, 0 HELP("::::") }; +const struct addrdesc xioaddr_socket_sendto = { "SOCKET-SENDTO", 3, xioopen_socket_sendto, GROUP_FD|GROUP_SOCKET, 0, 0, 0 HELP("::::") }; +const struct addrdesc xioaddr_socket_datagram= { "SOCKET-DATAGRAM", 3, xioopen_socket_datagram, GROUP_FD|GROUP_SOCKET|GROUP_RANGE, 0, 0, 0 HELP("::::") }; +const struct addrdesc xioaddr_socket_recvfrom= { "SOCKET-RECVFROM", 3, xioopen_socket_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_RANGE|GROUP_CHILD, 0, 0, 0 HELP("::::") }; +const struct addrdesc xioaddr_socket_recv = { "SOCKET-RECV", 1, xioopen_socket_recv, GROUP_FD|GROUP_SOCKET|GROUP_RANGE, 0, 0, 0 HELP("::::") }; #endif /* WITH_GENERICSOCKET */ diff --git a/xio-socks.c b/xio-socks.c index 4dde96b..519f80c 100644 --- a/xio-socks.c +++ b/xio-socks.c @@ -35,9 +35,9 @@ static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts const struct optdesc opt_socksport = { "socksport", NULL, OPT_SOCKSPORT, GROUP_IP_SOCKS4, PH_LATE, TYPE_STRING, OFUNC_SPEC }; const struct optdesc opt_socksuser = { "socksuser", NULL, OPT_SOCKSUSER, GROUP_IP_SOCKS4, PH_LATE, TYPE_NAME, OFUNC_SPEC }; -const struct addrdesc addr_socks4_connect = { "socks4", 3, xioopen_socks4_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_IP_SOCKS4|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; +const struct addrdesc xioaddr_socks4_connect = { "SOCKS4", 3, xioopen_socks4_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_IP_SOCKS4|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":::") }; -const struct addrdesc addr_socks4a_connect = { "socks4a", 3, xioopen_socks4_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_IP_SOCKS4|GROUP_CHILD|GROUP_RETRY, 1, 0, 0 HELP(":::") }; +const struct addrdesc xioaddr_socks4a_connect = { "SOCKS4A", 3, xioopen_socks4_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_IP_SOCKS4|GROUP_CHILD|GROUP_RETRY, 1, 0, 0 HELP(":::") }; static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, diff --git a/xio-socks.h b/xio-socks.h index 9b948db..4844b4b 100644 --- a/xio-socks.h +++ b/xio-socks.h @@ -17,8 +17,8 @@ struct socks4 { extern const struct optdesc opt_socksport; extern const struct optdesc opt_socksuser; -extern const struct addrdesc addr_socks4_connect; -extern const struct addrdesc addr_socks4a_connect; +extern const struct addrdesc xioaddr_socks4_connect; +extern const struct addrdesc xioaddr_socks4a_connect; extern int _xioopen_socks4_prepare(const char *targetport, struct opt *opts, char **socksport, struct socks4 *sockhead, size_t *headlen); extern int diff --git a/xio-stdio.c b/xio-stdio.c index 0cae125..6c8d6dc 100644 --- a/xio-stdio.c +++ b/xio-stdio.c @@ -20,17 +20,17 @@ static int xioopen_stdfd(int argc, const char *argv[], struct opt *opts, int xio /* we specify all option groups that we can imagine for a FD, becasue the changed parsing mechanism does not allow us to check the type of FD before applying the options */ -const struct addrdesc addr_stdio = { "stdio", 3, xioopen_stdio, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(NULL) }; -const struct addrdesc addr_stdin = { "stdin", 1, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(NULL) }; -const struct addrdesc addr_stdout = { "stdout", 2, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 1, 0, 0 HELP(NULL) }; -const struct addrdesc addr_stderr = { "stderr", 2, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 2, 0, 0 HELP(NULL) }; +const struct addrdesc xioaddr_stdio = { "STDIO", 3, xioopen_stdio, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(NULL) }; +const struct addrdesc xioaddr_stdin = { "STDIN", 1, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 0, 0, 0 HELP(NULL) }; +const struct addrdesc xioaddr_stdout = { "STDOUT", 2, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 1, 0, 0 HELP(NULL) }; +const struct addrdesc xioaddr_stderr = { "STDERR", 2, xioopen_stdfd, GROUP_FD|GROUP_FIFO|GROUP_CHR|GROUP_BLK|GROUP_FILE|GROUP_SOCKET|GROUP_TERMIOS|GROUP_SOCK_UNIX|GROUP_SOCK_IP|GROUP_IPAPP, 2, 0, 0 HELP(NULL) }; /* process a bidirectional "stdio" or "-" argument with options. generate a dual address. */ int xioopen_stdio_bi(xiofile_t *sock) { struct opt *optspr; - groups_t groups1 = addr_stdio.groups; + groups_t groups1 = xioaddr_stdio.groups; int result; if (xioopen_makedual(sock) < 0) { diff --git a/xio-stdio.h b/xio-stdio.h index 7af87f0..7f7f9fb 100644 --- a/xio-stdio.h +++ b/xio-stdio.h @@ -9,9 +9,9 @@ extern int xioopen_stdio_bi(xiofile_t *sock); -extern const struct addrdesc addr_stdio; -extern const struct addrdesc addr_stdin; -extern const struct addrdesc addr_stdout; -extern const struct addrdesc addr_stderr; +extern const struct addrdesc xioaddr_stdio; +extern const struct addrdesc xioaddr_stdin; +extern const struct addrdesc xioaddr_stdout; +extern const struct addrdesc xioaddr_stderr; #endif /* !defined(__xio_stdio_h_included) */ diff --git a/xio-system.c b/xio-system.c index 93f29bf..7f859d0 100644 --- a/xio-system.c +++ b/xio-system.c @@ -20,7 +20,7 @@ static int xioopen_system(int arg, const char *argv[], struct opt *opts, int dummy1, int dummy2, int dummy3 ); -const struct addrdesc addr_system = { "system", 3, xioopen_system, GROUP_FD|GROUP_FORK|GROUP_EXEC|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_TERMIOS|GROUP_FIFO|GROUP_PTY|GROUP_PARENT, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_system = { "SYSTEM", 3, xioopen_system, GROUP_FD|GROUP_FORK|GROUP_EXEC|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_TERMIOS|GROUP_FIFO|GROUP_PTY|GROUP_PARENT, 1, 0, 0 HELP(":") }; static int xioopen_system(int argc, const char *argv[], struct opt *opts, diff --git a/xio-system.h b/xio-system.h index 9321bb6..7b1e5f3 100644 --- a/xio-system.h +++ b/xio-system.h @@ -5,6 +5,6 @@ #ifndef __xio_system_h_included #define __xio_system_h_included 1 -extern const struct addrdesc addr_system; +extern const struct addrdesc xioaddr_system; #endif /* !defined(__xio_system_h_included) */ diff --git a/xio-tcp.c b/xio-tcp.c index 491cc72..5e2297c 100644 --- a/xio-tcp.c +++ b/xio-tcp.c @@ -17,23 +17,23 @@ /****** TCP addresses ******/ #if WITH_IP4 || WITH_IP6 -const struct addrdesc addr_tcp_connect = { "tcp-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_UNSPEC HELP("::") }; +const struct addrdesc xioaddr_tcp_connect = { "TCP-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_UNSPEC HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_tcp_listen = { "tcp-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_UNSPEC HELP(":") }; +const struct addrdesc xioaddr_tcp_listen = { "TCP-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_UNSPEC HELP(":") }; #endif #endif #if WITH_IP4 -const struct addrdesc addr_tcp4_connect = { "tcp4-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET HELP("::") }; +const struct addrdesc xioaddr_tcp4_connect = { "TCP4-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_tcp4_listen = { "tcp4-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET HELP(":") }; +const struct addrdesc xioaddr_tcp4_listen = { "TCP4-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET HELP(":") }; #endif #endif /* WITH_IP4 */ #if WITH_IP6 -const struct addrdesc addr_tcp6_connect = { "tcp6-connect", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET6 HELP("::") }; +const struct addrdesc xioaddr_tcp6_connect = { "TCP6-CONNECT", 1+XIO_RDWR, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_CHILD|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET6 HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_tcp6_listen = { "tcp6-listen", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET6 HELP(":") }; +const struct addrdesc xioaddr_tcp6_listen = { "TCP6-LISTEN", 1+XIO_RDWR, xioopen_ipapp_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_TCP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, SOCK_STREAM, IPPROTO_TCP, PF_INET6 HELP(":") }; #endif #endif /* WITH_IP6 */ diff --git a/xio-tcp.h b/xio-tcp.h index ff20508..560889a 100644 --- a/xio-tcp.h +++ b/xio-tcp.h @@ -5,12 +5,12 @@ #ifndef __xio_tcp_h_included #define __xio_tcp_h_included 1 -extern const struct addrdesc addr_tcp_connect; -extern const struct addrdesc addr_tcp_listen; -extern const struct addrdesc addr_tcp4_connect; -extern const struct addrdesc addr_tcp4_listen; -extern const struct addrdesc addr_tcp6_connect; -extern const struct addrdesc addr_tcp6_listen; +extern const struct addrdesc xioaddr_tcp_connect; +extern const struct addrdesc xioaddr_tcp_listen; +extern const struct addrdesc xioaddr_tcp4_connect; +extern const struct addrdesc xioaddr_tcp4_listen; +extern const struct addrdesc xioaddr_tcp6_connect; +extern const struct addrdesc xioaddr_tcp6_listen; extern const struct optdesc opt_tcp_nodelay; extern const struct optdesc opt_tcp_maxseg; diff --git a/xio-tun.c b/xio-tun.c index 3851b03..b3d41e2 100644 --- a/xio-tun.c +++ b/xio-tun.c @@ -44,7 +44,7 @@ const struct optdesc opt_iff_automedia = { "iff-automedia", "automedia", O const struct optdesc opt_route = { "route", NULL, OPT_ROUTE, GROUP_INTERFACE, PH_INIT, TYPE_STRING, OFUNC_SPEC }; #endif -const struct addrdesc xioaddr_tun = { "tun", 3, xioopen_tun, GROUP_FD|GROUP_CHR|GROUP_NAMED|GROUP_OPEN|GROUP_TUN, 0, 0, 0 HELP("[:/]") }; +const struct addrdesc xioaddr_tun = { "TUN", 3, xioopen_tun, GROUP_FD|GROUP_CHR|GROUP_NAMED|GROUP_OPEN|GROUP_TUN, 0, 0, 0 HELP("[:/]") }; /* "if-name"=tun3 // "route"=address/netmask // "ip6-route"=address/netmask diff --git a/xio-udp.c b/xio-udp.c index 4496963..becef73 100644 --- a/xio-udp.c +++ b/xio-udp.c @@ -42,35 +42,35 @@ int _xioopen_udp_sendto(const char *hostname, const char *servname, int xioflags, xiofile_t *xxfd, groups_t groups, int pf, int socktype, int ipproto); -const struct addrdesc addr_udp_connect = { "udp-connect", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_UNSPEC HELP("::") }; +const struct addrdesc xioaddr_udp_connect = { "UDP-CONNECT", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_UNSPEC HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_udp_listen = { "udp-listen", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, IPPROTO_UDP, PF_UNSPEC HELP(":") }; +const struct addrdesc xioaddr_udp_listen = { "UDP-LISTEN", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, IPPROTO_UDP, PF_UNSPEC HELP(":") }; #endif /* WITH_LISTEN */ -const struct addrdesc addr_udp_sendto = { "udp-sendto", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; -const struct addrdesc addr_udp_recvfrom = { "udp-recvfrom", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; -const struct addrdesc addr_udp_recv = { "udp-recv", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; -const struct addrdesc addr_udp_datagram = { "udp-datagram", 3, xioopen_udp_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp_sendto = { "UDP-SENDTO", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp_recvfrom = { "UDP-RECVFROM", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp_recv = { "UDP-RECV", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp_datagram = { "UDP-DATAGRAM", 3, xioopen_udp_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; #if WITH_IP4 -const struct addrdesc addr_udp4_connect = { "udp4-connect", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_INET HELP("::") }; +const struct addrdesc xioaddr_udp4_connect = { "UDP4-CONNECT", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_INET HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_udp4_listen = { "udp4-listen", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_INET, IPPROTO_UDP, PF_INET HELP(":") }; +const struct addrdesc xioaddr_udp4_listen = { "UDP4-LISTEN", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_INET, IPPROTO_UDP, PF_INET HELP(":") }; #endif /* WITH_LISTEN */ -const struct addrdesc addr_udp4_sendto = { "udp4-sendto", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; -const struct addrdesc addr_udp4_datagram = { "udp4-datagram",3, xioopen_udp_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; -const struct addrdesc addr_udp4_recvfrom= { "udp4-recvfrom", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; -const struct addrdesc addr_udp4_recv = { "udp4-recv", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp4_sendto = { "UDP4-SENDTO", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp4_datagram = { "UDP4-DATAGRAM",3, xioopen_udp_datagram, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp4_recvfrom = { "UDP4-RECVFROM", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp4_recv = { "UDP4-RECV", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_UDP|GROUP_RANGE, PF_INET, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; #endif /* WITH_IP4 */ #if WITH_IP6 -const struct addrdesc addr_udp6_connect = { "udp6-connect", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_INET6 HELP("::") }; +const struct addrdesc xioaddr_udp6_connect = { "UDP6-CONNECT", 3, xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_INET6 HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_udp6_listen = { "udp6-listen", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_INET6, IPPROTO_UDP, 0 HELP(":") }; +const struct addrdesc xioaddr_udp6_listen = { "UDP6-LISTEN", 3, xioopen_ipdgram_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE, PF_INET6, IPPROTO_UDP, 0 HELP(":") }; #endif /* WITH_LISTEN */ -const struct addrdesc addr_udp6_sendto = { "udp6-sendto", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; -const struct addrdesc addr_udp6_datagram= { "udp6-datagram", 3, xioopen_udp_datagram,GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; -const struct addrdesc addr_udp6_recvfrom= { "udp6-recvfrom", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; -const struct addrdesc addr_udp6_recv = { "udp6-recv", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp6_sendto = { "UDP6-SENDTO", 3, xioopen_udp_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp6_datagram = { "UDP6-DATAGRAM", 3, xioopen_udp_datagram,GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP("::") }; +const struct addrdesc xioaddr_udp6_recvfrom = { "UDP6-RECVFROM", 3, xioopen_udp_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_CHILD|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; +const struct addrdesc xioaddr_udp6_recv = { "UDP6-RECV", 1, xioopen_udp_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE, PF_INET6, SOCK_DGRAM, IPPROTO_UDP HELP(":") }; #endif /* WITH_IP6 */ diff --git a/xio-udp.h b/xio-udp.h index af07730..027b140 100644 --- a/xio-udp.h +++ b/xio-udp.h @@ -5,24 +5,24 @@ #ifndef __xio_udp_h_included #define __xio_udp_h_included 1 -extern const struct addrdesc addr_udp_connect; -extern const struct addrdesc addr_udp_listen; -extern const struct addrdesc addr_udp_sendto; -extern const struct addrdesc addr_udp_datagram; -extern const struct addrdesc addr_udp_recvfrom; -extern const struct addrdesc addr_udp_recv; -extern const struct addrdesc addr_udp4_connect; -extern const struct addrdesc addr_udp4_listen; -extern const struct addrdesc addr_udp4_sendto; -extern const struct addrdesc addr_udp4_datagram; -extern const struct addrdesc addr_udp4_recvfrom; -extern const struct addrdesc addr_udp4_recv; -extern const struct addrdesc addr_udp6_connect; -extern const struct addrdesc addr_udp6_listen; -extern const struct addrdesc addr_udp6_sendto; -extern const struct addrdesc addr_udp6_datagram; -extern const struct addrdesc addr_udp6_recvfrom; -extern const struct addrdesc addr_udp6_recv; +extern const struct addrdesc xioaddr_udp_connect; +extern const struct addrdesc xioaddr_udp_listen; +extern const struct addrdesc xioaddr_udp_sendto; +extern const struct addrdesc xioaddr_udp_datagram; +extern const struct addrdesc xioaddr_udp_recvfrom; +extern const struct addrdesc xioaddr_udp_recv; +extern const struct addrdesc xioaddr_udp4_connect; +extern const struct addrdesc xioaddr_udp4_listen; +extern const struct addrdesc xioaddr_udp4_sendto; +extern const struct addrdesc xioaddr_udp4_datagram; +extern const struct addrdesc xioaddr_udp4_recvfrom; +extern const struct addrdesc xioaddr_udp4_recv; +extern const struct addrdesc xioaddr_udp6_connect; +extern const struct addrdesc xioaddr_udp6_listen; +extern const struct addrdesc xioaddr_udp6_sendto; +extern const struct addrdesc xioaddr_udp6_datagram; +extern const struct addrdesc xioaddr_udp6_recvfrom; +extern const struct addrdesc xioaddr_udp6_recv; extern int _xioopen_ipdgram_listen(struct single *sfd, int xioflags, union sockaddr_union *us, socklen_t uslen, diff --git a/xio-unix.c b/xio-unix.c index 6315a66..12a6c57 100644 --- a/xio-unix.c +++ b/xio-unix.c @@ -38,23 +38,23 @@ int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xiof /* the first free parameter is 0 for "normal" unix domain sockets, or 1 for abstract unix sockets (Linux); the second and third free parameter are unsused */ -const struct addrdesc xioaddr_unix_connect = { "unix-connect", 3, xioopen_unix_connect, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_connect = { "UNIX-CONNECT", 3, xioopen_unix_connect, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; #if WITH_LISTEN -const struct addrdesc xioaddr_unix_listen = { "unix-listen", 3, xioopen_unix_listen, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_listen = { "UNIX-LISTEN", 3, xioopen_unix_listen, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":") }; #endif /* WITH_LISTEN */ -const struct addrdesc xioaddr_unix_sendto = { "unix-sendto", 3, xioopen_unix_sendto, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_unix_recvfrom= { "unix-recvfrom", 3, xioopen_unix_recvfrom, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, 0, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_unix_recv = { "unix-recv", 1, xioopen_unix_recv, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_unix_client = { "unix-client", 3, xioopen_unix_client, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_sendto = { "UNIX-SENDTO", 3, xioopen_unix_sendto, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_recvfrom= { "UNIX-RECVFROM", 3, xioopen_unix_recvfrom, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_recv = { "UNIX-RECV", 1, xioopen_unix_recv, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_unix_client = { "UNIX-CLIENT", 3, xioopen_unix_client, GROUP_FD|GROUP_NAMED|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 0, 0, 0 HELP(":") }; #if WITH_ABSTRACT_UNIXSOCKET -const struct addrdesc xioaddr_abstract_connect = { "abstract-connect", 3, xioopen_unix_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_connect = { "ABSTRACT-CONNECT", 3, xioopen_unix_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; #if WITH_LISTEN -const struct addrdesc xioaddr_abstract_listen = { "abstract-listen", 3, xioopen_unix_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_listen = { "ABSTRACT-LISTEN", 3, xioopen_unix_listen, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, 1, 0, 0 HELP(":") }; #endif /* WITH_LISTEN */ -const struct addrdesc xioaddr_abstract_sendto = { "abstract-sendto", 3, xioopen_unix_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_abstract_recvfrom= { "abstract-recvfrom", 3, xioopen_unix_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, 1, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_abstract_recv = { "abstract-recv", 1, xioopen_unix_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; -const struct addrdesc xioaddr_abstract_client = { "abstract-client", 3, xioopen_unix_client, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_sendto = { "ABSTRACT-SENDTO", 3, xioopen_unix_sendto, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_recvfrom= { "ABSTRACT-RECVFROM", 3, xioopen_unix_recvfrom, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY|GROUP_CHILD, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_recv = { "ABSTRACT-RECV", 1, xioopen_unix_recv, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_abstract_client = { "ABSTRACT-CLIENT", 3, xioopen_unix_client, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_UNIX|GROUP_RETRY, 1, 0, 0 HELP(":") }; #endif /* WITH_ABSTRACT_UNIXSOCKET */ const struct optdesc xioopt_unix_tightsocklen = { "unix-tightsocklen", "tightsocklen", OPT_UNIX_TIGHTSOCKLEN, GROUP_SOCK_UNIX, PH_PREBIND, TYPE_BOOL, OFUNC_OFFSET, XIO_OFFSETOF(para.socket.un.tight), XIO_SIZEOF(para.socket.un.tight) }; diff --git a/xio-vsock.c b/xio-vsock.c index 29025f8..e6e6465 100644 --- a/xio-vsock.c +++ b/xio-vsock.c @@ -22,15 +22,9 @@ static int xioopen_vsock_listen(int argc, const char *argv[], struct opt *opts, static void xiolog_vsock_cid(void); -const struct addrdesc addr_vsock_connect = { "vsock-connect", 1 + XIO_RDWR, - xioopen_vsock_connect, - GROUP_FD|GROUP_SOCKET|GROUP_CHILD|GROUP_RETRY, - 0, 0, 0 HELP("::") }; +const struct addrdesc xioaddr_vsock_connect = { "VSOCK-CONNECT", 1+XIO_RDWR, xioopen_vsock_connect, GROUP_FD|GROUP_SOCKET|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP("::") }; #if WITH_LISTEN -const struct addrdesc addr_vsock_listen = { "vsock-listen", 1 + XIO_RDWR, - xioopen_vsock_listen, - GROUP_FD|GROUP_SOCKET|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, - 0, 0, 0 HELP(":") }; +const struct addrdesc xioaddr_vsock_listen = { "VSOCK-LISTEN", 1+XIO_RDWR, xioopen_vsock_listen, GROUP_FD|GROUP_SOCKET|GROUP_LISTEN|GROUP_CHILD|GROUP_RETRY, 0, 0, 0 HELP(":") }; #endif /* WITH_LISTEN */ diff --git a/xio-vsock.h b/xio-vsock.h index 8d3dc14..b5c36ae 100644 --- a/xio-vsock.h +++ b/xio-vsock.h @@ -8,8 +8,8 @@ #if WITH_VSOCK -extern const struct addrdesc addr_vsock_connect; -extern const struct addrdesc addr_vsock_listen; +extern const struct addrdesc xioaddr_vsock_connect; +extern const struct addrdesc xioaddr_vsock_listen; extern int xiosetsockaddrenv_vsock(int idx, char *namebuff, size_t namelen, char *valuebuff, size_t valuelen, diff --git a/xiohelp.c b/xiohelp.c index 71256de..1c69cd1 100644 --- a/xiohelp.c +++ b/xiohelp.c @@ -73,22 +73,40 @@ static char *optionphasenames[] = { /* print a line about a single option */ static int xiohelp_option(FILE *of, const struct optname *on, const char *name) { - int j; + int chars; + int i, j; groups_t groups; bool occurred; - fprintf(of, " %s\tgroups=", name); - groups = on->desc->group; occurred = false; - for (j = 0; j < 32; ++j) { + chars = fprintf(of, " %s", name); + i = (16 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + fputc('\t', of); + + fputs("groups=", of); + groups = on->desc->group; + occurred = false; + chars = 7; + for (j = 0; j < 8*sizeof(groups_t); ++j) { if (groups & 1) { - if (occurred) { fputc(',', of); } - fprintf(of, "%s", addressgroupnames[j]); + if (occurred) { + fputc(',', of); + ++chars; + } + fputs(addressgroupnames[j], of); + chars += strlen(addressgroupnames[j]); occurred = true; } groups >>= 1; } - fprintf(of, "\tphase=%s", optionphasenames[on->desc->phase]); - fprintf(of, "\ttype=%s", optiontypenames[on->desc->type]); + i = (24 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + + chars = fprintf(of, "phase=%s", optionphasenames[on->desc->phase]); + i = (24 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + + fprintf(of, "type=%s", optiontypenames[on->desc->type]); fputc('\n', of); return 0; } @@ -102,14 +120,9 @@ int xioopenhelp(FILE *of, groups_t groups; bool occurred; - fputs(" bi-address:\n", of); - fputs(" pipe[,]\tgroups=FD,FIFO\n", of); - if (level == 2) { - fputs(" echo is an alias for pipe\n", of); - fputs(" fifo is an alias for pipe\n", of); - } - fputs(" !!\n", of); + fputs(" bi-address: /* is an address that may act both as data sync and source */\n", of); fputs(" \n", of); + fputs(" !!\n", of); fputs(" single-address:\n", of); fputs(" [,]\n", of); fputs(" address-head:\n", of); @@ -117,10 +130,16 @@ int xioopenhelp(FILE *of, i = 0; while (addressnames[i].name) { if (!strcmp(an->name, an->desc->defname)) { + int chars, i; + /* it is a canonical address name */ - fprintf(of, " %s", an->name); + chars = fprintf(of, " %s", an->name); if (an->desc->syntax) { - fputs(an->desc->syntax, of); } + fputs(an->desc->syntax, of); + chars += strlen(an->desc->syntax); + } + i = (40 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } fputs("\tgroups=", of); groups = an->desc->groups; occurred = false; for (j = 0; j < 32; ++j) { @@ -133,7 +152,13 @@ int xioopenhelp(FILE *of, } fputc('\n', of); } else if (level == 2) { - fprintf(of, " %s is an alias name for %s\n", an->name, an->desc->defname); + int chars, i; + + chars = fprintf(of, " %s", an->name); + i = (40 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + + fprintf(of, "\tis an alias name for %s\n", an->desc->defname); } ++an; ++i; } @@ -149,10 +174,16 @@ int xioopenhelp(FILE *of, fputs(" opt:\n", of); on = optionnames; while (on->name != NULL) { - if (on->desc->nickname!= NULL + if (on->desc->nickname != NULL && !strcmp(on->name, on->desc->nickname)) { if (level == 2) { - fprintf(of, " %s is an alias for %s\n", on->name, on->desc->defname); + int chars, i; + + chars = fprintf(of, " %s", on->name); + i = (16 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + + fprintf(of, "\tis an alias for %s\n", on->desc->defname); } else { xiohelp_option(of, on, on->name); } @@ -163,7 +194,13 @@ int xioopenhelp(FILE *of, if (!strcmp(on->name, on->desc->defname)) { xiohelp_option(of, on, on->name); } else { - fprintf(of, " %s is an alias for %s\n", on->name, on->desc->defname); + int chars, i; + + chars = fprintf(of, " %s", on->name); + i = (16 - chars + 7) / 8; + for (; i > 0; --i) { fputc('\t', of); } + + fprintf(of, "\tis an alias for %s\n", on->desc->defname); } } ++on; diff --git a/xioopen.c b/xioopen.c index 2d94fa5..680ad44 100644 --- a/xioopen.c +++ b/xioopen.c @@ -20,300 +20,300 @@ static int xioopen_dual(xiofile_t *xfd, int xioflags); const struct addrname addressnames[] = { #if 1 #if WITH_STDIO - { "-", &addr_stdio }, + { "-", &xioaddr_stdio }, #endif #if defined(WITH_UNIX) && defined(WITH_ABSTRACT_UNIXSOCKET) - { "abstract", &xioaddr_abstract_client }, - { "abstract-client", &xioaddr_abstract_client }, - { "abstract-connect", &xioaddr_abstract_connect }, + { "ABSTRACT", &xioaddr_abstract_client }, + { "ABSTRACT-CLIENT", &xioaddr_abstract_client }, + { "ABSTRACT-CONNECT", &xioaddr_abstract_connect }, #if WITH_LISTEN - { "abstract-listen", &xioaddr_abstract_listen }, + { "ABSTRACT-LISTEN", &xioaddr_abstract_listen }, #endif - { "abstract-recv", &xioaddr_abstract_recv }, - { "abstract-recvfrom", &xioaddr_abstract_recvfrom }, - { "abstract-sendto", &xioaddr_abstract_sendto }, + { "ABSTRACT-RECV", &xioaddr_abstract_recv }, + { "ABSTRACT-RECVFROM", &xioaddr_abstract_recvfrom }, + { "ABSTRACT-SENDTO", &xioaddr_abstract_sendto }, #endif /* defined(WITH_UNIX) && defined(WITH_ABSTRACT_UNIXSOCKET) */ #if WITH_CREAT - { "creat", &addr_creat }, - { "create", &addr_creat }, + { "CREAT", &xioaddr_creat }, + { "CREATE", &xioaddr_creat }, #endif #if WITH_GENERICSOCKET - { "datagram", &xioaddr_socket_datagram }, - { "dgram", &xioaddr_socket_datagram }, + { "DATAGRAM", &xioaddr_socket_datagram }, + { "DGRAM", &xioaddr_socket_datagram }, #endif #if WITH_OPENSSL - { "dtls", &xioaddr_openssl_dtls_client }, - { "dtls-c", &xioaddr_openssl_dtls_client }, - { "dtls-client", &xioaddr_openssl_dtls_client }, - { "dtls-connect", &xioaddr_openssl_dtls_client }, + { "DTLS", &xioaddr_openssl_dtls_client }, + { "DTLS-C", &xioaddr_openssl_dtls_client }, + { "DTLS-CLIENT", &xioaddr_openssl_dtls_client }, + { "DTLS-CONNECT", &xioaddr_openssl_dtls_client }, #if WITH_LISTEN - { "dtls-l", &xioaddr_openssl_dtls_server }, - { "dtls-listen", &xioaddr_openssl_dtls_server }, - { "dtls-server", &xioaddr_openssl_dtls_server }, + { "DTLS-L", &xioaddr_openssl_dtls_server }, + { "DTLS-LISTEN", &xioaddr_openssl_dtls_server }, + { "DTLS-SERVER", &xioaddr_openssl_dtls_server }, #endif #endif #if WITH_PIPE - { "echo", &addr_pipe }, + { "ECHO", &xioaddr_pipe }, #endif #if WITH_EXEC - { "exec", &addr_exec }, + { "EXEC", &xioaddr_exec }, #endif #if WITH_FDNUM - { "fd", &addr_fd }, + { "FD", &xioaddr_fd }, #endif #if WITH_PIPE - { "fifo", &addr_pipe }, + { "FIFO", &xioaddr_pipe }, #endif #if WITH_FILE - { "file", &addr_open }, + { "FILE", &xioaddr_open }, #endif #if WITH_GOPEN - { "gopen", &addr_gopen }, + { "GOPEN", &xioaddr_gopen }, #endif #if WITH_INTERFACE - { "if", &xioaddr_interface }, + { "IF", &xioaddr_interface }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_TCP - { "inet", &addr_tcp_connect }, + { "INET", &xioaddr_tcp_connect }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_TCP && WITH_LISTEN - { "inet-l", &addr_tcp_listen }, - { "inet-listen", &addr_tcp_listen }, + { "INET-L", &xioaddr_tcp_listen }, + { "INET-LISTEN", &xioaddr_tcp_listen }, #endif #if WITH_IP4 && WITH_TCP - { "inet4", &addr_tcp4_connect }, + { "INET4", &xioaddr_tcp4_connect }, #endif #if WITH_IP4 && WITH_TCP && WITH_LISTEN - { "inet4-l", &addr_tcp4_listen }, - { "inet4-listen", &addr_tcp4_listen }, + { "INET4-L", &xioaddr_tcp4_listen }, + { "INET4-LISTEN", &xioaddr_tcp4_listen }, #endif #if WITH_IP6 && WITH_TCP - { "inet6", &addr_tcp6_connect }, + { "INET6", &xioaddr_tcp6_connect }, #endif #if WITH_IP6 && WITH_TCP && WITH_LISTEN - { "inet6-l", &addr_tcp6_listen }, - { "inet6-listen", &addr_tcp6_listen }, + { "INET6-L", &xioaddr_tcp6_listen }, + { "INET6-LISTEN", &xioaddr_tcp6_listen }, #endif #if WITH_INTERFACE - { "interface", &xioaddr_interface }, + { "INTERFACE", &xioaddr_interface }, #endif #if WITH_RAWIP #if (WITH_IP4 || WITH_IP6) - { "ip", &addr_rawip_sendto }, - { "ip-datagram", &addr_rawip_datagram }, - { "ip-dgram", &addr_rawip_datagram }, - { "ip-recv", &addr_rawip_recv }, - { "ip-recvfrom", &addr_rawip_recvfrom }, - { "ip-send", &addr_rawip_sendto }, - { "ip-sendto", &addr_rawip_sendto }, + { "IP", &xioaddr_rawip_sendto }, + { "IP-DATAGRAM", &xioaddr_rawip_datagram }, + { "IP-DGRAM", &xioaddr_rawip_datagram }, + { "IP-RECV", &xioaddr_rawip_recv }, + { "IP-RECVFROM", &xioaddr_rawip_recvfrom }, + { "IP-SEND", &xioaddr_rawip_sendto }, + { "IP-SENDTO", &xioaddr_rawip_sendto }, #endif #if WITH_IP4 - { "ip4", &addr_rawip4_sendto }, - { "ip4-datagram", &addr_rawip4_datagram }, - { "ip4-dgram", &addr_rawip4_datagram }, - { "ip4-recv", &addr_rawip4_recv }, - { "ip4-recvfrom", &addr_rawip4_recvfrom }, - { "ip4-send", &addr_rawip4_sendto }, - { "ip4-sendto", &addr_rawip4_sendto }, + { "IP4", &xioaddr_rawip4_sendto }, + { "IP4-DATAGRAM", &xioaddr_rawip4_datagram }, + { "IP4-DGRAM", &xioaddr_rawip4_datagram }, + { "IP4-RECV", &xioaddr_rawip4_recv }, + { "IP4-RECVFROM", &xioaddr_rawip4_recvfrom }, + { "IP4-SEND", &xioaddr_rawip4_sendto }, + { "IP4-SENDTO", &xioaddr_rawip4_sendto }, #endif #if WITH_IP6 - { "ip6", &addr_rawip6_sendto }, - { "ip6-datagram", &addr_rawip6_datagram }, - { "ip6-dgram", &addr_rawip6_datagram }, - { "ip6-recv", &addr_rawip6_recv }, - { "ip6-recvfrom", &addr_rawip6_recvfrom }, - { "ip6-send", &addr_rawip6_sendto }, - { "ip6-sendto", &addr_rawip6_sendto }, + { "IP6", &xioaddr_rawip6_sendto }, + { "IP6-DATAGRAM", &xioaddr_rawip6_datagram }, + { "IP6-DGRAM", &xioaddr_rawip6_datagram }, + { "IP6-RECV", &xioaddr_rawip6_recv }, + { "IP6-RECVFROM", &xioaddr_rawip6_recvfrom }, + { "IP6-SEND", &xioaddr_rawip6_sendto }, + { "IP6-SENDTO", &xioaddr_rawip6_sendto }, #endif #endif /* WITH_RAWIP */ #if WITH_UNIX - { "local", &xioaddr_unix_connect }, + { "LOCAL", &xioaddr_unix_connect }, #endif #if WITH_FILE - { "open", &addr_open }, + { "OPEN", &xioaddr_open }, #endif #if WITH_OPENSSL - { "openssl", &xioaddr_openssl }, - { "openssl-connect", &xioaddr_openssl }, - { "openssl-dtls-client", &xioaddr_openssl_dtls_client }, - { "openssl-dtls-connect", &xioaddr_openssl_dtls_client }, + { "OPENSSL", &xioaddr_openssl }, + { "OPENSSL-CONNECT", &xioaddr_openssl }, + { "OPENSSL-DTLS-CLIENT", &xioaddr_openssl_dtls_client }, + { "OPENSSL-DTLS-CONNECT", &xioaddr_openssl_dtls_client }, #if WITH_LISTEN - { "openssl-dtls-listen", &xioaddr_openssl_dtls_server }, - { "openssl-dtls-server", &xioaddr_openssl_dtls_server }, - { "openssl-listen", &xioaddr_openssl_listen }, + { "OPENSSL-DTLS-LISTEN", &xioaddr_openssl_dtls_server }, + { "OPENSSL-DTLS-SERVER", &xioaddr_openssl_dtls_server }, + { "OPENSSL-LISTEN", &xioaddr_openssl_listen }, #endif #endif #if WITH_PIPE - { "pipe", &addr_pipe }, + { "PIPE", &xioaddr_pipe }, #endif #if WITH_PROXY - { "proxy", &addr_proxy_connect }, - { "proxy-connect", &addr_proxy_connect }, + { "PROXY", &xioaddr_proxy_connect }, + { "PROXY-CONNECT", &xioaddr_proxy_connect }, #endif #if WITH_PTY - { "pty", &addr_pty }, + { "PTY", &xioaddr_pty }, #endif #if WITH_READLINE - { "readline", &addr_readline }, + { "READLINE", &xioaddr_readline }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_SCTP - { "sctp", &addr_sctp_connect }, - { "sctp-connect", &addr_sctp_connect }, + { "SCTP", &xioaddr_sctp_connect }, + { "SCTP-CONNECT", &xioaddr_sctp_connect }, #if WITH_LISTEN - { "sctp-l", &addr_sctp_listen }, - { "sctp-listen", &addr_sctp_listen }, + { "SCTP-L", &xioaddr_sctp_listen }, + { "SCTP-LISTEN", &xioaddr_sctp_listen }, #endif #if WITH_IP4 - { "sctp4", &addr_sctp4_connect }, - { "sctp4-connect", &addr_sctp4_connect }, + { "SCTP4", &xioaddr_sctp4_connect }, + { "SCTP4-CONNECT", &xioaddr_sctp4_connect }, #if WITH_LISTEN - { "sctp4-l", &addr_sctp4_listen }, - { "sctp4-listen", &addr_sctp4_listen }, + { "SCTP4-L", &xioaddr_sctp4_listen }, + { "SCTP4-LISTEN", &xioaddr_sctp4_listen }, #endif #endif /* WITH_IP4 */ #if WITH_IP6 - { "sctp6", &addr_sctp6_connect }, - { "sctp6-connect", &addr_sctp6_connect }, + { "SCTP6", &xioaddr_sctp6_connect }, + { "SCTP6-CONNECT", &xioaddr_sctp6_connect }, #if WITH_LISTEN - { "sctp6-l", &addr_sctp6_listen }, - { "sctp6-listen", &addr_sctp6_listen }, + { "SCTP6-L", &xioaddr_sctp6_listen }, + { "SCTP6-LISTEN", &xioaddr_sctp6_listen }, #endif #endif /* WITH_IP6 */ #endif /* (WITH_IP4 || WITH_IP6) && WITH_SCTP */ #if WITH_GENERICSOCKET - { "sendto", &xioaddr_socket_sendto }, + { "SENDTO", &xioaddr_socket_sendto }, #endif #if WITH_GENERICSOCKET - { "socket-connect", &xioaddr_socket_connect }, - { "socket-datagram", &xioaddr_socket_datagram }, + { "SOCKET-CONNECT", &xioaddr_socket_connect }, + { "SOCKET-DATAGRAM", &xioaddr_socket_datagram }, #if WITH_LISTEN - { "socket-listen", &xioaddr_socket_listen }, + { "SOCKET-LISTEN", &xioaddr_socket_listen }, #endif /* WITH_LISTEN */ - { "socket-recv", &xioaddr_socket_recv }, - { "socket-recvfrom", &xioaddr_socket_recvfrom }, - { "socket-sendto", &xioaddr_socket_sendto }, + { "SOCKET-RECV", &xioaddr_socket_recv }, + { "SOCKET-RECVFROM", &xioaddr_socket_recvfrom }, + { "SOCKET-SENDTO", &xioaddr_socket_sendto }, #endif #if WITH_SOCKS4 - { "socks", &addr_socks4_connect }, - { "socks4", &addr_socks4_connect }, + { "SOCKS", &xioaddr_socks4_connect }, + { "SOCKS4", &xioaddr_socks4_connect }, #endif #if WITH_SOCKS4A - { "socks4a", &addr_socks4a_connect }, + { "SOCKS4A", &xioaddr_socks4a_connect }, #endif #if WITH_OPENSSL - { "ssl", &xioaddr_openssl }, + { "SSL", &xioaddr_openssl }, #if WITH_LISTEN - { "ssl-l", &xioaddr_openssl_listen }, + { "SSL-L", &xioaddr_openssl_listen }, #endif #endif #if WITH_STDIO - { "stderr", &addr_stderr }, - { "stdin", &addr_stdin }, - { "stdio", &addr_stdio }, - { "stdout", &addr_stdout }, + { "STDERR", &xioaddr_stderr }, + { "STDIN", &xioaddr_stdin }, + { "STDIO", &xioaddr_stdio }, + { "STDOUT", &xioaddr_stdout }, #endif #if WITH_SYSTEM - { "system", &addr_system }, + { "SYSTEM", &xioaddr_system }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_TCP - { "tcp", &addr_tcp_connect }, - { "tcp-connect", &addr_tcp_connect }, + { "TCP", &xioaddr_tcp_connect }, + { "TCP-CONNECT", &xioaddr_tcp_connect }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_TCP && WITH_LISTEN - { "tcp-l", &addr_tcp_listen }, - { "tcp-listen", &addr_tcp_listen }, + { "TCP-L", &xioaddr_tcp_listen }, + { "TCP-LISTEN", &xioaddr_tcp_listen }, #endif #if WITH_IP4 && WITH_TCP - { "tcp4", &addr_tcp4_connect }, - { "tcp4-connect", &addr_tcp4_connect }, + { "TCP4", &xioaddr_tcp4_connect }, + { "TCP4-CONNECT", &xioaddr_tcp4_connect }, #endif #if WITH_IP4 && WITH_TCP && WITH_LISTEN - { "tcp4-l", &addr_tcp4_listen }, - { "tcp4-listen", &addr_tcp4_listen }, + { "TCP4-L", &xioaddr_tcp4_listen }, + { "TCP4-LISTEN", &xioaddr_tcp4_listen }, #endif #if WITH_IP6 && WITH_TCP - { "tcp6", &addr_tcp6_connect }, - { "tcp6-connect", &addr_tcp6_connect }, + { "TCP6", &xioaddr_tcp6_connect }, + { "TCP6-CONNECT", &xioaddr_tcp6_connect }, #endif #if WITH_IP6 && WITH_TCP && WITH_LISTEN - { "tcp6-l", &addr_tcp6_listen }, - { "tcp6-listen", &addr_tcp6_listen }, + { "TCP6-L", &xioaddr_tcp6_listen }, + { "TCP6-LISTEN", &xioaddr_tcp6_listen }, #endif #if WITH_TUN - { "tun", &xioaddr_tun }, + { "TUN", &xioaddr_tun }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_UDP - { "udp", &addr_udp_connect }, + { "UDP", &xioaddr_udp_connect }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_UDP - { "udp-connect", &addr_udp_connect }, - { "udp-datagram", &addr_udp_datagram }, - { "udp-dgram", &addr_udp_datagram }, + { "UDP-CONNECT", &xioaddr_udp_connect }, + { "UDP-DATAGRAM", &xioaddr_udp_datagram }, + { "UDP-DGRAM", &xioaddr_udp_datagram }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_UDP && WITH_LISTEN - { "udp-l", &addr_udp_listen }, - { "udp-listen", &addr_udp_listen }, + { "UDP-L", &xioaddr_udp_listen }, + { "UDP-LISTEN", &xioaddr_udp_listen }, #endif #if (WITH_IP4 || WITH_IP6) && WITH_UDP - { "udp-recv", &addr_udp_recv }, - { "udp-recvfrom", &addr_udp_recvfrom }, - { "udp-send", &addr_udp_sendto }, - { "udp-sendto", &addr_udp_sendto }, + { "UDP-RECV", &xioaddr_udp_recv }, + { "UDP-RECVFROM", &xioaddr_udp_recvfrom }, + { "UDP-SEND", &xioaddr_udp_sendto }, + { "UDP-SENDTO", &xioaddr_udp_sendto }, #endif #if WITH_IP4 && WITH_UDP - { "udp4", &addr_udp4_connect }, - { "udp4-connect", &addr_udp4_connect }, - { "udp4-datagram", &addr_udp4_datagram }, - { "udp4-dgram", &addr_udp4_datagram }, + { "UDP4", &xioaddr_udp4_connect }, + { "UDP4-CONNECT", &xioaddr_udp4_connect }, + { "UDP4-DATAGRAM", &xioaddr_udp4_datagram }, + { "UDP4-DGRAM", &xioaddr_udp4_datagram }, #endif #if WITH_IP4 && WITH_UDP && WITH_LISTEN - { "udp4-l", &addr_udp4_listen }, - { "udp4-listen", &addr_udp4_listen }, + { "UDP4-L", &xioaddr_udp4_listen }, + { "UDP4-LISTEN", &xioaddr_udp4_listen }, #endif #if WITH_IP4 && WITH_UDP - { "udp4-recv", &addr_udp4_recv }, - { "udp4-recvfrom", &addr_udp4_recvfrom }, - { "udp4-send", &addr_udp4_sendto }, - { "udp4-sendto", &addr_udp4_sendto }, + { "UDP4-RECV", &xioaddr_udp4_recv }, + { "UDP4-RECVFROM", &xioaddr_udp4_recvfrom }, + { "UDP4-SEND", &xioaddr_udp4_sendto }, + { "UDP4-SENDTO", &xioaddr_udp4_sendto }, #endif #if WITH_IP6 && WITH_UDP - { "udp6", &addr_udp6_connect }, - { "udp6-connect", &addr_udp6_connect }, - { "udp6-datagram", &addr_udp6_datagram }, - { "udp6-dgram", &addr_udp6_datagram }, + { "UDP6", &xioaddr_udp6_connect }, + { "UDP6-CONNECT", &xioaddr_udp6_connect }, + { "UDP6-DATAGRAM", &xioaddr_udp6_datagram }, + { "UDP6-DGRAM", &xioaddr_udp6_datagram }, #endif #if WITH_IP6 && WITH_UDP && WITH_LISTEN - { "udp6-l", &addr_udp6_listen }, - { "udp6-listen", &addr_udp6_listen }, + { "UDP6-L", &xioaddr_udp6_listen }, + { "UDP6-LISTEN", &xioaddr_udp6_listen }, #endif #if WITH_IP6 && WITH_UDP - { "udp6-recv", &addr_udp6_recv }, - { "udp6-recvfrom", &addr_udp6_recvfrom }, - { "udp6-send", &addr_udp6_sendto }, - { "udp6-sendto", &addr_udp6_sendto }, + { "UDP6-RECV", &xioaddr_udp6_recv }, + { "UDP6-RECVFROM", &xioaddr_udp6_recvfrom }, + { "UDP6-SEND", &xioaddr_udp6_sendto }, + { "UDP6-SENDTO", &xioaddr_udp6_sendto }, #endif #if WITH_UNIX - { "unix", &xioaddr_unix_client }, - { "unix-client", &xioaddr_unix_client }, - { "unix-connect", &xioaddr_unix_connect }, + { "UNIX", &xioaddr_unix_client }, + { "UNIX-CLIENT", &xioaddr_unix_client }, + { "UNIX-CONNECT", &xioaddr_unix_connect }, #endif #if WITH_UNIX && WITH_LISTEN - { "unix-l", &xioaddr_unix_listen }, - { "unix-listen", &xioaddr_unix_listen }, + { "UNIX-L", &xioaddr_unix_listen }, + { "UNIX-LISTEN", &xioaddr_unix_listen }, #endif #if WITH_UNIX - { "unix-recv", &xioaddr_unix_recv }, - { "unix-recvfrom", &xioaddr_unix_recvfrom }, - { "unix-send", &xioaddr_unix_sendto }, - { "unix-sendto", &xioaddr_unix_sendto }, + { "UNIX-RECV", &xioaddr_unix_recv }, + { "UNIX-RECVFROM", &xioaddr_unix_recvfrom }, + { "UNIX-SEND", &xioaddr_unix_sendto }, + { "UNIX-SENDTO", &xioaddr_unix_sendto }, #endif #if WITH_VSOCK - { "vsock", &addr_vsock_connect }, - { "vsock-connect", &addr_vsock_connect }, + { "VSOCK", &xioaddr_vsock_connect }, + { "VSOCK-CONNECT", &xioaddr_vsock_connect }, #endif #if WITH_VSOCK && WITH_LISTEN - { "vsock-l", &addr_vsock_listen }, - { "vsock-listen", &addr_vsock_listen }, + { "VSOCK-L", &xioaddr_vsock_listen }, + { "VSOCK-LISTEN", &xioaddr_vsock_listen }, #endif #else /* !0 */ # if WITH_INTEGRATE @@ -537,7 +537,7 @@ static xiosingle_t *xioparse_single(const char **addr) { #if WITH_FDNUM } else if (isdigit(token[0]&0xff) && token[1] == '\0') { Info1("interpreting address \"%s\" as file descriptor", token); - addrdesc = &addr_fd; + addrdesc = &xioaddr_fd; if ((sfd->argv[sfd->argc++] = strdup("FD")) == NULL) { Error("strdup(\"FD\"): out of memory"); } @@ -549,7 +549,7 @@ static xiosingle_t *xioparse_single(const char **addr) { #if WITH_GOPEN } else if (strchr(token, '/')) { Info1("interpreting address \"%s\" as file name", token); - addrdesc = &addr_gopen; + addrdesc = &xioaddr_gopen; if ((sfd->argv[sfd->argc++] = strdup("GOPEN")) == NULL) { Error("strdup(\"GOPEN\"): out of memory"); }