Introduced groups_t instead of uint32_t

This commit is contained in:
Gerhard Rieger 2023-06-14 11:41:44 +02:00
parent 557f299b82
commit 2cddaf22b1
35 changed files with 152 additions and 132 deletions

View file

@ -9,6 +9,9 @@ Features:
The number of warnings has been reduced, e.g.removing a non existing
file does in most cases no longer log a warning.
Coding:
Introduced groups_t instead of uint32_t, for more flexibility
####################### V 1.7.4.5 (not released):
Corrections:

View file

@ -99,17 +99,22 @@ typedef int sig_atomic_t;
#endif
#define F_uint8_t "%hu"
#define F_uint8_x "%02hx"
#define F_int8_t "%hd"
#ifndef F_uint16_t
# if HAVE_BASIC_UINT16_T==0
# define F_uint16_t "%hu"
# define F_uint16_x "%04hx"
# elif HAVE_BASIC_UINT16_T==2
# define F_uint16_t "%hu"
# define F_uint16_x "%04hx"
# elif HAVE_BASIC_UINT16_T==4
# define F_uint16_t "%u"
# define F_uint16_x "%04x"
# elif HAVE_BASIC_UINT16_T==6
# define F_uint16_t "%lu"
# define F_uint16_x "%04lx"
# else
# error "HAVE_BASIC_UINT16_T is out of range:" HAVE_BASIC_UINT16_T
# endif
@ -118,12 +123,16 @@ typedef int sig_atomic_t;
#ifndef F_uint32_t
# if HAVE_BASIC_UINT32_T==0
# define F_uint32_t "%hu"
# define F_uint32_x "%08hx"
# elif HAVE_BASIC_UINT32_T==2
# define F_uint32_t "%hu"
# define F_uint32_x "%08hx"
# elif HAVE_BASIC_UINT32_T==4
# define F_uint32_t "%u"
# define F_uint32_x "%08x"
# elif HAVE_BASIC_UINT32_T==6
# define F_uint32_t "%lu"
# define F_uint32_x "%08lx"
# else
# error "HAVE_BASIC_UINT32_T is out of range:" HAVE_BASIC_UINT32_T
# endif
@ -132,14 +141,19 @@ typedef int sig_atomic_t;
#ifndef F_uint64_t
# if HAVE_BASIC_UINT64_T==0
# define F_uint64_t "%hu"
# define F_uint64_x "%016hx"
# elif HAVE_BASIC_UINT64_T==2
# define F_uint64_t "%hu"
# define F_uint64_x "%016hx"
# elif HAVE_BASIC_UINT64_T==4
# define F_uint64_t "%u"
# define F_uint64_x "%016x"
# elif HAVE_BASIC_UINT64_T==6
# define F_uint64_t "%lu"
# define F_uint64_x "%016lx"
# elif HAVE_BASIC_UINT64_T==8
# define F_uint64_t "%llu"
# define F_uint64_x "%016llx"
# else
# error "HAVE_BASIC_UINT64_T is out of range:" HAVE_BASIC_UINT64_T
# endif

View file

@ -13,7 +13,7 @@
#include "xio-creat.h"
static int xioopen_creat(int arg, const char *argv[], struct opt *opts, int rw, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
static int xioopen_creat(int arg, const char *argv[], struct opt *opts, int rw, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3);
/*! within stream model, this is a write-only address - use 2 instead of 3 */
@ -37,7 +37,7 @@ static int _xioopen_creat(const char *path, int rw, struct opt *opts) {
}
static int xioopen_creat(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_creat(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];
int rw = (xioflags&XIO_ACCMODE);
bool exists;

View file

@ -16,7 +16,7 @@
static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
int xioflags, /* XIO_RDONLY etc. */
xiofile_t *fd,
unsigned groups,
groups_t groups,
int dummy1, int dummy2, int dummy3
);
@ -27,7 +27,7 @@ const struct optdesc opt_dash = { "dash", "login", OPT_DASH, GROUP_EXEC, PH_PREE
static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
int xioflags, /* XIO_RDONLY, XIO_MAYCHILD etc. */
xiofile_t *fd,
unsigned groups,
groups_t groups,
int dummy1, int dummy2, int dummy3
) {
int status;

View file

@ -12,7 +12,7 @@
#if WITH_FDNUM
static int xioopen_fdnum(int argc, const char *argv[], struct opt *opts, int rw, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3);
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(":<num>") };
@ -20,7 +20,7 @@ const struct addrdesc addr_fd = { "fd", 3, xioopen_fdnum, GROUP_FD|GROUP
/* use some file descriptor and apply the options. Set the FD_CLOEXEC flag. */
static int xioopen_fdnum(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
char *a1;
int rw = (xioflags&XIO_ACCMODE);

View file

@ -11,7 +11,7 @@
#include "xio-file.h"
static int xioopen_open(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
static int xioopen_open(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3);
#if WITH_OPEN
@ -72,7 +72,7 @@ const struct addrdesc addr_open = { "open", 3, xioopen_open, GROUP_FD|GROUP_
if the filesystem entry already exists, the data is appended
if it does not exist, a file is created and the data is appended
*/
static int xioopen_open(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_open(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];
int rw = (xioflags & XIO_ACCMODE);
bool exists;

View file

@ -14,12 +14,12 @@
#if WITH_GOPEN
static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
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(":<filename>") };
static int xioopen_gopen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
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];
flags_t openflags = (xioflags & XIO_ACCMODE);
mode_t st_mode;

View file

@ -16,7 +16,7 @@
static
int xioopen_interface(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups, int pf,
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(":<interface>") };
@ -25,7 +25,7 @@ const struct addrdesc xioaddr_interface= { "interface", 3, xioopen_interface,
static
int _xioopen_interface(const char *ifname,
struct opt *opts, int xioflags, xiofile_t *xxfd,
unsigned groups, int pf) {
groups_t groups, int pf) {
xiosingle_t *xfd = &xxfd->stream;
union sockaddr_union us = {{0}};
socklen_t uslen;
@ -74,7 +74,7 @@ int _xioopen_interface(const char *ifname,
static
int xioopen_interface(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int dummy2, int dummy3) {
xiosingle_t *xfd = &xxfd->stream;
int result;

View file

@ -23,7 +23,7 @@ const struct optdesc opt_lowport = { "lowport", NULL, OPT_LOWPORT, GROUP_IPAPP,
/* we expect the form "host:port" */
int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd,
unsigned groups, int socktype, int ipproto,
groups_t groups, int socktype, int ipproto,
int pf) {
struct single *xfd = &xxfd->stream;
struct opt *opts0 = NULL;
@ -258,7 +258,7 @@ int _xioopen_ipapp_listen_prepare(struct opt *opts, struct opt **opts0,
/* currently only used for TCP4 */
int xioopen_ipapp_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd,
unsigned groups, int socktype,
groups_t groups, int socktype,
int ipproto, int pf) {
struct opt *opts0 = NULL;
union sockaddr_union us_sa, *us = &us_sa;

View file

@ -15,7 +15,7 @@ extern const struct optdesc opt_sourceport;
extern const struct optdesc opt_lowport;
extern int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd,
unsigned groups, int socktype,
groups_t groups, int socktype,
int ipproto, int protname);
extern int
_xioopen_ipapp_prepare(struct opt *opts, struct opt **opts0,
@ -32,7 +32,7 @@ extern int _xioopen_ip4app_connect(const char *hostname, const char *portname,
struct opt *opts);
extern int xioopen_ipapp_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd,
unsigned groups, int socktype,
groups_t groups, int socktype,
int ipproto, int protname);
extern int _xioopen_ipapp_listen_prepare(struct opt *opts, struct opt **opts0,
const char *portname, int *pf, int ipproto,

View file

@ -96,8 +96,8 @@ int applyopts_named(const char *filename, struct opt *opts, unsigned int phase)
After this sub you may proceed with open() or whatever...
*/
int _xioopen_named_early(int argc, const char *argv[], xiofile_t *xfd,
int groups,
bool *exists, struct opt *opts) {
groups_t groups, bool *exists, struct opt *opts)
{
const char *path = argv[1];
#if HAVE_STAT64
struct stat64 statbuf;

View file

@ -19,7 +19,7 @@ extern const struct optdesc opt_umask;
extern int
applyopts_named(const char *filename, struct opt *opts, unsigned int phase);
extern int _xioopen_named_early(int argc, const char *argv[], xiofile_t *xfd,
int groups,
groups_t groups,
bool *exists, struct opt *opts);
extern int _xioopen_open(const char *path, int rw, struct opt *opts);

View file

@ -43,12 +43,12 @@
/* static declaration of ssl's open function */
static int xioopen_openssl_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd, unsigned groups,
int xioflags, xiofile_t *fd, groups_t groups,
int dummy1, int dummy2, int dummy3);
/* static declaration of ssl's open function */
static int xioopen_openssl_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd, unsigned groups,
int xioflags, xiofile_t *fd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static int openssl_SSL_ERROR_SSL(int level, const char *funcname);
static int openssl_handle_peer_certificate(struct single *xfd,
@ -199,7 +199,7 @@ static int
writing (1), or both (2) ? */
xiofile_t *xxfd, /* a xio file descriptor structure,
already allocated */
unsigned groups, /* the matching address groups... */
groups_t groups, /* the matching address groups... */
int protogrp, /* first transparent integer value from
addr_openssl */
int dummy2, /* second transparent integer value from
@ -487,7 +487,7 @@ static int
writing (1), or both (2) ? */
xiofile_t *xxfd, /* a xio file descriptor structure,
already allocated */
unsigned groups, /* the matching address groups... */
groups_t groups, /* the matching address groups... */
int protogrp, /* first transparent integer value from
addr_openssl */
int dummy2, /* second transparent integer value from

View file

@ -12,7 +12,7 @@
#if WITH_PIPE
static int xioopen_fifo(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
static int xioopen_fifo(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3);
static int xioopen_fifo_unnamed(xiofile_t *sock, struct opt *opts);
@ -75,7 +75,7 @@ static int xioopen_fifo_unnamed(xiofile_t *sock, struct opt *opts) {
/* open a named or unnamed pipe/fifo */
static int xioopen_fifo(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_fifo(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3) {
const char *pipename = argv[1];
int rw = (xioflags & XIO_ACCMODE);
#if HAVE_STAT64

View file

@ -47,7 +47,7 @@ const struct optdesc opt_sigquit = { "sigquit", NULL, OPT_SIGQUIT, GROUP_P
*/
int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */
struct single *fd,
unsigned groups,
groups_t groups,
struct opt **copts, /* in: opts; out: opts for child */
int *duptostderr /* out: redirect stderr to output fd */
) {

View file

@ -20,7 +20,7 @@ extern const struct optdesc opt_sigquit;
extern int _xioopen_foxec(int rw, /* O_RDONLY etc. */
struct single *fd,
unsigned groups,
groups_t groups,
struct opt **opts,
int *duptostderr
);

View file

@ -22,7 +22,7 @@
static int xioopen_proxy_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd,
unsigned groups, int dummy1, int dummy2,
groups_t groups, int dummy1, int dummy2,
int dummy3);
const struct optdesc opt_proxyport = { "proxyport", NULL, OPT_PROXYPORT, GROUP_HTTP, PH_LATE, TYPE_STRING, OFUNC_SPEC };
@ -79,7 +79,7 @@ static ssize_t
static int xioopen_proxy_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd,
unsigned groups, int dummy1, int dummy2,
groups_t groups, int dummy1, int dummy2,
int dummy3) {
/* we expect the form: host:host:port */
struct single *xfd = &xxfd->stream;

View file

@ -18,7 +18,7 @@
#define MAXPTYNAMELEN 64
static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
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("") };
@ -28,7 +28,7 @@ const struct optdesc opt_pty_wait_slave = { "pty-wait-slave", "wait-slave", OPT_
const struct optdesc opt_pty_intervall = { "pty-interval", NULL, OPT_PTY_INTERVALL, GROUP_PTY, PH_EARLY, TYPE_TIMESPEC, OFUNC_SPEC, 0, 0 };
#endif /* HAVE_POLL */
static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, groups_t groups, int dummy1, int dummy2, int dummy3) {
/* we expect the form: filename */
int ptyfd = -1, ttyfd = -1;
#if defined(HAVE_DEV_PTMX) || defined(HAVE_DEV_PTC)

View file

@ -19,25 +19,25 @@
static
int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd, unsigned groups, int pf,
int xioflags, xiofile_t *fd, groups_t groups, int pf,
int dummy2, int dummy3);
static
int xioopen_rawip_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd, unsigned groups, int pf,
int xioflags, xiofile_t *fd, groups_t groups, int pf,
int dummy2, int dummy3);
static
int xioopen_rawip_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int dummy3);
static
int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto);
static
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
struct opt *opts, int xioflags,
xiofile_t *xxfd, unsigned groups, int *pf);
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(":<host>:<protocol>") };
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(":<host>:<protocol>") };
@ -64,7 +64,7 @@ const struct addrdesc addr_rawip6_recv = { "ip6-recv", 1, xioopen_rawip
/* socklen_t salen;*/
static
int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int dummy2, int dummy3) {
int result;
@ -91,7 +91,7 @@ int xioopen_rawip_sendto(int argc, const char *argv[], struct opt *opts,
static
int _xioopen_rawip_sendto(const char *hostname, const char *protname,
struct opt *opts, int xioflags, xiofile_t *xxfd,
unsigned groups, int *pf) {
groups_t groups, int *pf) {
char *garbage;
xiosingle_t *xfd = &xxfd->stream;
union sockaddr_union us;
@ -150,7 +150,7 @@ int _xioopen_rawip_sendto(const char *hostname, const char *protname,
/* we expect the form: address:protocol */
static
int xioopen_rawip_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int dummy2, int dummy3) {
xiosingle_t *xfd = &xxfd->stream;
char *rangename;
@ -196,7 +196,7 @@ int xioopen_rawip_datagram(int argc, const char *argv[], struct opt *opts,
static
int xioopen_rawip_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int dummy3) {
const char *protname = argv[1];
char *garbage;
@ -254,7 +254,7 @@ int xioopen_rawip_recvfrom(int argc, const char *argv[], struct opt *opts,
static
int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int dummy3) {
const char *protname = argv[1];
char *garbage;

View file

@ -26,7 +26,7 @@ uses stdin!!
#define READLINE_MAXPROMPT 512
static int xioopen_readline(int argc, const char *argv[], struct opt *opts,
int rw, xiofile_t *xfd, unsigned groups,
int rw, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
@ -38,7 +38,7 @@ const struct optdesc opt_noprompt = { "noprompt", NULL, OPT_NOPROMP
const struct optdesc opt_noecho = { "noecho", NULL, OPT_NOECHO, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_SPEC, 0 };
static int xioopen_readline(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
int rw = (xioflags & XIO_ACCMODE);
char msgbuf[256], *cp = msgbuf;

View file

@ -31,34 +31,34 @@
static
int xioopen_socket_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static
int xioopen_socket_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static
int xioopen_socket_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static
int xioopen_socket_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static
int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int socktype, int dummy3);
static
int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int dumy1, int dummy2, int dummy3);
int xioflags, xiofile_t *xfd, groups_t groups,
int dummy1, int dummy2, int dummy3);
static
int _xioopen_socket_sendto(const char *pfname, const char *type,
const char *proto, const char *address,
struct opt *opts, int xioflags, xiofile_t *xxfd,
unsigned groups);
groups_t groups);
static int
xiolog_ancillary_socket(struct cmsghdr *cmsg, int *num,
@ -210,7 +210,7 @@ const struct optdesc opt_null_eof = { "null-eof", NULL, OPT_NULL_EOF, GROUP_SOCK
static
int xioopen_socket_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
struct single *xfd = &xxfd->stream;
const char *pfname = argv[1];
@ -291,7 +291,7 @@ int xioopen_socket_connect(int argc, const char *argv[], struct opt *opts,
#if WITH_LISTEN
static
int xioopen_socket_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
struct single *xfd = &xxfd->stream;
const char *pfname = argv[1];
@ -361,7 +361,7 @@ int xioopen_socket_listen(int argc, const char *argv[], struct opt *opts,
/* we expect the form: ...:domain:type:protocol:remote-address */
static
int xioopen_socket_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
int result;
@ -384,7 +384,7 @@ static
int _xioopen_socket_sendto(const char *pfname, const char *type,
const char *protname, const char *address,
struct opt *opts, int xioflags, xiofile_t *xxfd,
unsigned groups) {
groups_t groups) {
xiosingle_t *xfd = &xxfd->stream;
char *garbage;
union sockaddr_union us = {{0}};
@ -475,7 +475,7 @@ int _xioopen_socket_sendto(const char *pfname, const char *type,
/* we expect the form: ...:domain:socktype:protocol:local-address */
static
int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy, int summy2, int dummy3) {
struct single *xfd = &xxfd->stream;
const char *pfname = argv[1];
@ -552,7 +552,7 @@ int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts,
/* we expect the form: ...:domain:type:protocol:local-address */
static
int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
struct single *xfd = &xxfd->stream;
const char *pfname = argv[1];
@ -631,7 +631,7 @@ int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
/* we expect the form: ...:domain:type:protocol:remote-address */
static
int xioopen_socket_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int dummy1, int dummy2, int dummy3) {
xiosingle_t *xfd = &xxfd->stream;
const char *pfname = argv[1];
@ -1029,7 +1029,7 @@ int xioopen_connect(struct single *xfd, union sockaddr_union *us, size_t uslen,
int _xioopen_dgram_sendto(/* them is already in xfd->peersa */
union sockaddr_union *us, socklen_t uslen,
struct opt *opts,
int xioflags, xiosingle_t *xfd, unsigned groups,
int xioflags, xiosingle_t *xfd, groups_t groups,
int pf, int socktype, int ipproto, bool alt) {
int level = E_ERROR;
union sockaddr_union la; socklen_t lalen = sizeof(la);

View file

@ -101,7 +101,7 @@ extern
int _xioopen_dgram_sendto(/* them is already in xfd->peersa */
union sockaddr_union *us, socklen_t uslen,
struct opt *opts,
int xioflags, xiosingle_t *xfd, unsigned groups,
int xioflags, xiosingle_t *xfd, groups_t groups,
int pf, int socktype, int ipproto, bool alt);
extern
int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,

View file

@ -29,7 +29,7 @@ enum {
static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd,
unsigned groups, int dummy1, int dummy2,
groups_t groups, int dummy1, int dummy2,
int dummy3);
const struct optdesc opt_socksport = { "socksport", NULL, OPT_SOCKSPORT, GROUP_IP_SOCKS4, PH_LATE, TYPE_STRING, OFUNC_SPEC };
@ -41,7 +41,7 @@ const struct addrdesc addr_socks4a_connect = { "socks4a", 3, xioopen_socks4_conn
static int xioopen_socks4_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd,
unsigned groups, int socks4a, int dummy2,
groups_t groups, int socks4a, int dummy2,
int dummy3) {
/* we expect the form: host:host:port */
struct single *xfd = &xxfd->stream;

View file

@ -13,8 +13,8 @@
#if WITH_STDIO
static int xioopen_stdio(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
static int xioopen_stdfd(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int fd, int dummy2, int dummy3);
static int xioopen_stdio(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3);
static int xioopen_stdfd(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, groups_t groups, int fd, int dummy2, int dummy3);
/* we specify all option groups that we can imagine for a FD, becasue the
@ -30,7 +30,7 @@ const struct addrdesc addr_stderr = { "stderr", 2, xioopen_stdfd, GROUP_FD|GROUP
generate a dual address. */
int xioopen_stdio_bi(xiofile_t *sock) {
struct opt *optspr;
unsigned int groups1 = addr_stdio.groups;
groups_t groups1 = addr_stdio.groups;
int result;
if (xioopen_makedual(sock) < 0) {
@ -135,7 +135,7 @@ int xioopen_stdio_bi(xiofile_t *sock) {
/* wrap around unidirectional xioopensingle and xioopen_fd to automatically determine stdin or stdout fd depending on rw.
Do not set FD_CLOEXEC flag. */
static int xioopen_stdio(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_stdio(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3) {
int rw = (xioflags&XIO_ACCMODE);
if (argc != 1) {
@ -154,7 +154,7 @@ static int xioopen_stdio(int argc, const char *argv[], struct opt *opts, int xio
/* wrap around unidirectional xioopensingle and xioopen_fd to automatically determine stdin or stdout fd depending on rw.
Do not set FD_CLOEXEC flag. */
static int xioopen_stdfd(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int fd, int dummy2, int dummy3) {
static int xioopen_stdfd(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, groups_t groups, int fd, int dummy2, int dummy3) {
int rw = (xioflags&XIO_ACCMODE);
if (argc != 1) {

View file

@ -16,7 +16,7 @@
static int xioopen_system(int arg, const char *argv[], struct opt *opts,
int xioflags, /* XIO_RDONLY etc. */
xiofile_t *fd,
unsigned groups,
groups_t groups,
int dummy1, int dummy2, int dummy3
);
@ -26,7 +26,7 @@ const struct addrdesc addr_system = { "system", 3, xioopen_system, GROUP_FD|GROU
static int xioopen_system(int argc, const char *argv[], struct opt *opts,
int xioflags, /* XIO_RDONLY etc. */
xiofile_t *fd,
unsigned groups,
groups_t groups,
int dummy1, int dummy2, int dummy3
) {
int status;

View file

@ -15,7 +15,7 @@
#include "xio-tun.h"
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, unsigned groups, int dummy1, int dummy2, int dummy3);
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *fd, groups_t groups, int dummy1, int dummy2, int dummy3);
/****** TUN addresses ******/
const struct optdesc opt_tun_device = { "tun-device", NULL, OPT_TUN_DEVICE, GROUP_TUN, PH_OPEN, TYPE_FILENAME, OFUNC_SPEC };
@ -64,7 +64,7 @@ static const struct optname xio_route_options[] = {
} ;
#endif
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, unsigned groups, int dummy1, int dummy2, int dummy3) {
static int xioopen_tun(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xfd, groups_t groups, int dummy1, int dummy2, int dummy3) {
char *tundevice = NULL;
char *tunname = NULL, *tuntype = NULL;
int pf = /*! PF_UNSPEC*/ PF_INET;

View file

@ -21,25 +21,25 @@
static
int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto);
static
int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto);
static
int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto);
static
int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto);
static
int _xioopen_udp_sendto(const char *hostname, const char *servname,
struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
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(":<host>:<port>") };
@ -275,7 +275,7 @@ int _xioopen_ipdgram_listen(struct single *sfd,
/* we expect the form: port */
int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *fd,
unsigned groups, int pf, int ipproto,
groups_t groups, int pf, int ipproto,
int protname) {
const char *portname = argv[1];
union sockaddr_union us;
@ -328,7 +328,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
static
int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int socktype, int ipproto) {
int result;
@ -357,7 +357,7 @@ int xioopen_udp_sendto(int argc, const char *argv[], struct opt *opts,
static
int _xioopen_udp_sendto(const char *hostname, const char *servname,
struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int socktype, int ipproto) {
xiosingle_t *xfd = &xxfd->stream;
union sockaddr_union us;
@ -421,7 +421,7 @@ int _xioopen_udp_sendto(const char *hostname, const char *servname,
static
int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int pf, int socktype, int ipproto) {
xiosingle_t *xfd = &xxfd->stream;
char *rangename;
@ -482,7 +482,7 @@ int xioopen_udp_datagram(int argc, const char *argv[], struct opt *opts,
static
int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto) {
union sockaddr_union us;
socklen_t uslen = sizeof(us);
@ -555,7 +555,7 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
static
int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xfd, unsigned groups,
int xioflags, xiofile_t *xfd, groups_t groups,
int pf, int socktype, int ipproto) {
union sockaddr_union us;
socklen_t uslen = sizeof(us);

View file

@ -30,7 +30,7 @@ extern int _xioopen_ipdgram_listen(struct single *sfd,
extern int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
int rw, xiofile_t *fd,
unsigned groups, int af, int ipproto,
groups_t groups, int af, int ipproto,
int protname);
#endif /* !defined(__xio_udp_h_included) */

View file

@ -24,16 +24,16 @@
# define ABSTRACT 0
#endif
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3);
static int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3);
static
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int abstract, int dummy2, int dummy3);
static
int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3);
int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3);
/* 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
@ -115,7 +115,7 @@ xiosetunix(int pf,
}
#if WITH_LISTEN
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3) {
/* we expect the form: filename */
const char *name;
xiosingle_t *xfd = &xxfd->stream;
@ -200,7 +200,7 @@ static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, i
#endif /* WITH_LISTEN */
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3) {
/* we expect the form: filename */
const char *name;
struct single *xfd = &xxfd->stream;
@ -348,7 +348,7 @@ static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts,
}
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy, int dummy3) {
static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy, int dummy3) {
/* we expect the form: filename */
const char *name;
xiosingle_t *xfd = &xxfd->stream;
@ -411,7 +411,7 @@ static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, i
static
int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int abstract, int dummy2, int dummy3) {
/* we expect the form: filename */
const char *name;
@ -491,7 +491,7 @@ int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
static
int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int abstract, int dummy2, int dummy3) {
/* we expect the form: filename */
const char *name;
@ -565,7 +565,7 @@ int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
/* generic UNIX socket client, tries connect, SEQPACKET, send(to) */
static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, unsigned groups, int abstract, int dummy2, int dummy3) {
static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, int xioflags, xiofile_t *xxfd, groups_t groups, int abstract, int dummy2, int dummy3) {
/* we expect the form: filename */
if (argc != 2) {
Error2("%s: wrong number of parameters (%d instead of 1)", argv[0], argc-1);
@ -586,8 +586,8 @@ static int xioopen_unix_client(int argc, const char *argv[], struct opt *opts, i
OPT_PROTOCOL_FAMILY, OPT_UNIX_TIGHTSOCKLEN, OPT_UNLINK_CLOSE, OPT_BIND,
OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK,
*/
int
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
int
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, groups_t groups,
int abstract, struct opt *opts, const char *name) {
const struct opt *namedopt;
int pf = PF_UNIX;

View file

@ -32,7 +32,7 @@ xiosetsockaddrenv_unix(int idx, char *namebuff, size_t namelen,
struct sockaddr_un *sa, socklen_t salen, int ipproto);
extern int
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups,
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, groups_t groups,
int abstract, struct opt *opts, const char *name);
#endif /* !defined(__xio_unix_h_included) */

View file

@ -14,10 +14,10 @@
#include "xio-vsock.h"
static int xioopen_vsock_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups, int abstract,
int xioflags, xiofile_t *xxfd, groups_t groups, int abstract,
int dummy2, int dummy3);
static int xioopen_vsock_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups, int abstract,
int xioflags, xiofile_t *xxfd, groups_t groups, int abstract,
int dummy2, int dummy3);
static void xiolog_vsock_cid(void);
@ -67,7 +67,7 @@ static int vsock_init(struct opt *opts, struct single *xfd) {
}
static int xioopen_vsock_connect(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups,
int xioflags, xiofile_t *xxfd, groups_t groups,
int abstract, int dummy2, int dummy3) {
/* we expect the form :cid:port */
struct single *xfd = &xxfd->stream;
@ -124,7 +124,7 @@ static int xioopen_vsock_connect(int argc, const char *argv[], struct opt *opts,
#if WITH_LISTEN
static int xioopen_vsock_listen(int argc, const char *argv[], struct opt *opts,
int xioflags, xiofile_t *xxfd, unsigned groups, int abstract,
int xioflags, xiofile_t *xxfd, groups_t groups, int abstract,
int dummy2, int dummy3) {
/* we expect the form :port */
struct single *xfd = &xxfd->stream;

7
xio.h
View file

@ -89,6 +89,9 @@ enum xiotag {
streams */
} ;
typedef uint32_t groups_t;
#define F_groups_t F_uint32_x
/* global XIO options/parameters */
typedef struct {
bool strictopts;
@ -311,9 +314,9 @@ typedef union bipipe {
struct addrdesc {
const char *defname; /* main (canonical) name of address */
int directions; /* 1..read, 2..write, 3..both */
int (*func)(int argc, const char *argv[], struct opt *opts, int rw, xiofile_t *fd, unsigned groups,
int (*func)(int argc, const char *argv[], struct opt *opts, int rw, xiofile_t *fd, groups_t groups,
int arg1, int arg2, int arg3);
unsigned groups;
groups_t groups;
int arg1;
int arg2;
int arg3;

View file

@ -74,7 +74,7 @@ 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;
unsigned int groups;
groups_t groups;
bool occurred;
fprintf(of, " %s\tgroups=", name);
@ -99,7 +99,7 @@ int xioopenhelp(FILE *of,
const struct addrname *an;
const struct optname *on;
int i, j;
unsigned int groups;
groups_t groups;
bool occurred;
fputs(" bi-address:\n", of);

View file

@ -1847,7 +1847,7 @@ const struct optname optionnames[] = {
to the array opts. Uses the option table 'optionnames'.
returns 0 on success, -1 on error, 1 on unknown/wrong option
*/
int parseopts(const char **a, unsigned int groups, struct opt **opts) {
int parseopts(const char **a, groups_t groups, struct opt **opts) {
return parseopts_table(a, groups, opts, optionnames,
sizeof(optionnames)/sizeof(struct optname)-1);
@ -1858,7 +1858,7 @@ int parseopts(const char **a, unsigned int groups, struct opt **opts) {
to the array opts. Uses the specified option table.
returns 0 on success, -1 on error, 1 on unknown/wrong option
*/
int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
int parseopts_table(const char **a, groups_t groups, struct opt **opts,
const struct optname optionnames[], size_t optionnum) {
int i=0;
struct opt *opt;
@ -1949,7 +1949,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
!xioopts_ignoregroups) {
Error1("parseopts_table(): option \"%s\" not supported with this address type",
token /*a0*/);
Info2("parseopts_table() groups=%08x, ent->group=%08x",
Info2("parseopts_table() groups="F_groups_t", ent->group="F_groups_t,
groups, ent->desc->group);
#if 0
continue;
@ -2633,7 +2633,7 @@ int parseopts_table(const char **a, unsigned int groups, struct opt **opts,
/* look for an option with the given properties
return a pointer to the first matching valid option in the list
Returns NULL when no matching option found */
const struct opt *searchopt(const struct opt *opts, unsigned int groups, enum e_phase from, enum e_phase to,
const struct opt *searchopt(const struct opt *opts, groups_t groups, enum e_phase from, enum e_phase to,
enum e_func func) {
int i;
@ -2656,7 +2656,7 @@ const struct opt *searchopt(const struct opt *opts, unsigned int groups, enum e_
/* copy the already parsed options for repeated application, but only those
matching groups ANY and <groups> */
struct opt *copyopts(const struct opt *opts, unsigned int groups) {
struct opt *copyopts(const struct opt *opts, groups_t groups) {
struct opt *new;
int i, j, n;
@ -2689,7 +2689,7 @@ struct opt *copyopts(const struct opt *opts, unsigned int groups) {
/* move options to a new options list
move only those matching <groups> */
struct opt *moveopts(struct opt *opts, unsigned int groups) {
struct opt *moveopts(struct opt *opts, groups_t groups) {
struct opt *new;
int i, j, n;
@ -2756,8 +2756,8 @@ int showleft(const struct opt *opts) {
/* determines the address group from mode_t */
/* does not set GROUP_FD; cannot determine GROUP_TERMIOS ! */
int _groupbits(mode_t mode) {
unsigned int result = 0;
groups_t _groupbits(mode_t mode) {
groups_t result = 0;
switch ((mode&S_IFMT)>>12) {
case (S_IFIFO>>12): /* 1, FIFO */
@ -2785,13 +2785,13 @@ int _groupbits(mode_t mode) {
}
/* does not set GROUP_FD */
int groupbits(int fd) {
groups_t groupbits(int fd) {
#if HAVE_STAT64
struct stat64 buf;
#else
struct stat buf;
#endif /* !HAVE_STAT64 */
int result;
groups_t result;
if (
#if HAVE_STAT64
@ -3801,7 +3801,7 @@ int applyopts2(int fd, struct opt *opts, unsigned int from, unsigned int to) {
/* apply and consume all options of type FLAG and group.
Return 0 if everything went right, or -1 if an error occurred. */
int applyopts_flags(struct opt *opts, int group, flags_t *result) {
int applyopts_flags(struct opt *opts, groups_t group, flags_t *result) {
struct opt *opt = opts;
if (!opts) return 0;

View file

@ -139,7 +139,7 @@ enum e_func {
#define GROUP_FD 0x00000001 /* everything applyable to a fd */
#define GROUP_FIFO 0x00000002
#define GROUP_CHR 0x00000004
#define GROUP_CHR 0x00000004 /* not yet used? */
#define GROUP_BLK 0x00000008
#define GROUP_REG 0x00000010
#define GROUP_FILE GROUP_REG
@ -161,13 +161,13 @@ enum e_func {
#define GROUP_PARENT 0x00080000 /* for parent of communicating child */
#define GROUP_SOCK_UNIX 0x00100000
#define GROUP_SOCK_IP4 0x00200000
#define GROUP_SOCK_IP4 0x00200000 /* not yet used? */
#define GROUP_SOCK_IP6 0x00400000
#define GROUP_SOCK_IP (GROUP_SOCK_IP4|GROUP_SOCK_IP6)
#define GROUP_INTERFACE 0x00800000
#define GROUP_TUN GROUP_INTERFACE
#define GROUP_IP_UDP 0x01000000
#define GROUP_IP_UDP 0x01000000 /* not yet used? */
#define GROUP_IP_TCP 0x02000000
#define GROUP_IPAPP (GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP) /* true: indicates one of UDP, TCP, SCTP */
#define GROUP_IP_SOCKS4 0x04000000
@ -176,10 +176,10 @@ enum e_func {
#define GROUP_PROCESS 0x10000000 /* a process related option */
#define GROUP_APPL 0x20000000 /* option handled by data loop */
#define GROUP_HTTP 0x40000000 /* any HTTP client */
#define GROUP_IP_SCTP 0x80000000
#define GROUP_IP_SCTP 0x80000000U
#define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
#define GROUP_ALL 0xffffffff
#define GROUP_ALL 0xffffffffU
/* no IP multicasts, no error queue yet */
@ -898,7 +898,7 @@ struct optdesc {
const char *defname; /* default name */
const char *nickname; /* usual name */
enum e_optcode optcode; /* short form of option name */
unsigned int group;
groups_t group;
enum e_phase phase; /* when this option is to be used */
enum e_types type; /* the data type as expected on input, and stored */
enum e_func func; /* which function can apply this option, e.g. ioctl(),
@ -935,7 +935,7 @@ extern int retropt_bind(struct opt *opts,
extern int applyopts(int fd, struct opt *opts, enum e_phase phase);
extern int applyopts2(int fd, struct opt *opts, unsigned int from,
unsigned int to);
extern int applyopts_flags(struct opt *opts, int group, flags_t *result);
extern int applyopts_flags(struct opt *opts, groups_t group, flags_t *result);
extern int applyopts_cloexec(int fd, struct opt *opts);
extern int applyopts_early(const char *path, struct opt *opts);
extern int applyopts_fchown(int fd, struct opt *opts);
@ -943,18 +943,18 @@ extern int applyopts_single(struct single *fd, struct opt *opts, enum e_phase ph
extern int applyopts_offset(struct single *xfd, struct opt *opts);
extern int applyopts_signal(struct single *xfd, struct opt *opts);
extern int _xio_openlate(struct single *fd, struct opt *opts);
extern int parseopts(const char **a, unsigned int groups, struct opt **opts);
extern int parseopts_table(const char **a, unsigned int groups,
extern int parseopts(const char **a, groups_t groups, struct opt **opts);
extern int parseopts_table(const char **a, groups_t groups,
struct opt **opts,
const struct optname optionnames[], size_t optionnum);
extern const struct opt *searchopt(const struct opt *opts, unsigned int groups, enum e_phase from, enum e_phase to,
extern const struct opt *searchopt(const struct opt *opts, groups_t groups, enum e_phase from, enum e_phase to,
enum e_func func);
extern struct opt *copyopts(const struct opt *opts, unsigned int groups);
extern struct opt *moveopts(struct opt *opts, unsigned int groups);
extern struct opt *copyopts(const struct opt *opts, groups_t groups);
extern struct opt *moveopts(struct opt *opts, groups_t groups);
extern int leftopts(const struct opt *opts);
extern int showleft(const struct opt *opts);
extern int groupbits(int fd);
extern int _groupbits(mode_t mode);
extern groups_t groupbits(int fd);
extern groups_t _groupbits(mode_t mode);
extern int dropopts(struct opt *opts, unsigned int phase);
extern int dropopts2(struct opt *opts, unsigned int from, unsigned int to);