mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Rearranged option group bits to only require 32 bits on older systems
This commit is contained in:
parent
2cddaf22b1
commit
c01722ac3e
7 changed files with 24 additions and 7 deletions
2
CHANGES
2
CHANGES
|
@ -12,6 +12,8 @@ Features:
|
||||||
Coding:
|
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.
|
||||||
|
|
||||||
####################### V 1.7.4.5 (not released):
|
####################### V 1.7.4.5 (not released):
|
||||||
|
|
||||||
Corrections:
|
Corrections:
|
||||||
|
|
|
@ -51,7 +51,7 @@ int xioopen_socket_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
int dummy1, int socktype, int dummy3);
|
int dummy1, int socktype, int dummy3);
|
||||||
static
|
static
|
||||||
int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
|
int xioopen_socket_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
int xioflags, xiofile_t *xfd, groups_t groups,
|
int xioflags, xiofile_t *xfd, groups_t groups,
|
||||||
int dummy1, int dummy2, int dummy3);
|
int dummy1, int dummy2, int dummy3);
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -586,7 +586,7 @@ 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_PROTOCOL_FAMILY, OPT_UNIX_TIGHTSOCKLEN, OPT_UNLINK_CLOSE, OPT_BIND,
|
||||||
OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK,
|
OPT_SO_TYPE, OPT_SO_PROTOTYPE, OPT_CLOEXEC, OPT_USER, OPT_GROUP, ?OPT_FORK,
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, groups_t groups,
|
_xioopen_unix_client(xiosingle_t *xfd, int xioflags, groups_t groups,
|
||||||
int abstract, struct opt *opts, const char *name) {
|
int abstract, struct opt *opts, const char *name) {
|
||||||
const struct opt *namedopt;
|
const struct opt *namedopt;
|
||||||
|
|
6
xio.h
6
xio.h
|
@ -89,8 +89,14 @@ enum xiotag {
|
||||||
streams */
|
streams */
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
/* Keep condition consistent with xioopts.h:GROUP_*! */
|
||||||
|
#if WITH_SCTP
|
||||||
|
typedef uint64_t groups_t;
|
||||||
|
#define F_groups_t F_uint64_x
|
||||||
|
#else
|
||||||
typedef uint32_t groups_t;
|
typedef uint32_t groups_t;
|
||||||
#define F_groups_t F_uint32_x
|
#define F_groups_t F_uint32_x
|
||||||
|
#endif
|
||||||
|
|
||||||
/* global XIO options/parameters */
|
/* global XIO options/parameters */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -48,10 +48,10 @@ static const char *addressgroupnames[] = {
|
||||||
"TERMIOS", "RANGE", "PTY", "PARENT",
|
"TERMIOS", "RANGE", "PTY", "PARENT",
|
||||||
"UNIX", "IP4", "IP6", "INTERFACE",
|
"UNIX", "IP4", "IP6", "INTERFACE",
|
||||||
"UDP", "TCP", "SOCKS4", "OPENSSL",
|
"UDP", "TCP", "SOCKS4", "OPENSSL",
|
||||||
"PROCESS", "APPL", "HTTP", "SCTP"
|
"PROCESS", "APPL", "HTTP", "undef",
|
||||||
|
"SCTP"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
/* keep consistent with xioopts.h:enum ephase ! */
|
/* keep consistent with xioopts.h:enum ephase ! */
|
||||||
static char *optionphasenames[] = {
|
static char *optionphasenames[] = {
|
||||||
"ALL", "INIT", "EARLY",
|
"ALL", "INIT", "EARLY",
|
||||||
|
|
|
@ -2780,7 +2780,7 @@ groups_t _groupbits(mode_t mode) {
|
||||||
result = GROUP_SOCKET|GROUP_SOCK_UNIX; break;
|
result = GROUP_SOCKET|GROUP_SOCK_UNIX; break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Debug2("_groupbits(%d) -> %d", mode, result);
|
Debug2("_groupbits("F_mode") -> "F_groups_t, mode, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
xioopts.h
13
xioopts.h
|
@ -176,10 +176,19 @@ enum e_func {
|
||||||
#define GROUP_PROCESS 0x10000000 /* a process related option */
|
#define GROUP_PROCESS 0x10000000 /* a process related option */
|
||||||
#define GROUP_APPL 0x20000000 /* option handled by data loop */
|
#define GROUP_APPL 0x20000000 /* option handled by data loop */
|
||||||
#define GROUP_HTTP 0x40000000 /* any HTTP client */
|
#define GROUP_HTTP 0x40000000 /* any HTTP client */
|
||||||
#define GROUP_IP_SCTP 0x80000000U
|
|
||||||
|
|
||||||
#define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
|
/* Keep condition consistent with xio.h:groups_t! */
|
||||||
|
#if WITH_SCTP
|
||||||
|
/* The following groups are not expected on systems without uint64_t */
|
||||||
|
#define GROUP_IP_SCTP 0x0100000000U
|
||||||
|
#define GROUP_ALL 0x03ffffffffU
|
||||||
|
#else
|
||||||
|
#define GROUP_IP_SCTP 0
|
||||||
#define GROUP_ALL 0xffffffffU
|
#define GROUP_ALL 0xffffffffU
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GROUP_IPAPP (GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP) /* true: indicates one of UDP, TCP, SCTP */
|
||||||
|
#define GROUP_ANY (GROUP_PROCESS|GROUP_APPL)
|
||||||
|
|
||||||
|
|
||||||
/* no IP multicasts, no error queue yet */
|
/* no IP multicasts, no error queue yet */
|
||||||
|
|
Loading…
Reference in a new issue