diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 17 | ||||
| -rw-r--r-- | include/usage.h | 18 |
2 files changed, 21 insertions, 14 deletions
diff --git a/include/libbb.h b/include/libbb.h index 6e10cdc41..3c53e5e68 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -390,6 +390,7 @@ typedef struct len_and_sockaddr { | |||
| 390 | } u; | 390 | } u; |
| 391 | } len_and_sockaddr; | 391 | } len_and_sockaddr; |
| 392 | enum { | 392 | enum { |
| 393 | LSA_LEN_SIZE = offsetof(len_and_sockaddr, u), | ||
| 393 | LSA_SIZEOF_SA = sizeof( | 394 | LSA_SIZEOF_SA = sizeof( |
| 394 | union { | 395 | union { |
| 395 | struct sockaddr sa; | 396 | struct sockaddr sa; |
| @@ -405,7 +406,12 @@ enum { | |||
| 405 | * af == AF_UNSPEC will result in trying to create IPv6 socket, | 406 | * af == AF_UNSPEC will result in trying to create IPv6 socket, |
| 406 | * and if kernel doesn't support it, IPv4. | 407 | * and if kernel doesn't support it, IPv4. |
| 407 | */ | 408 | */ |
| 408 | int xsocket_type(len_and_sockaddr **lsap, USE_FEATURE_IPV6(int af,) int sock_type); | 409 | #if ENABLE_FEATURE_IPV6 |
| 410 | int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type); | ||
| 411 | #else | ||
| 412 | int xsocket_type(len_and_sockaddr **lsap, int sock_type); | ||
| 413 | #define xsocket_type(lsap, af, sock_type) xsocket_type((lsap), (sock_type)) | ||
| 414 | #endif | ||
| 409 | int xsocket_stream(len_and_sockaddr **lsap); | 415 | int xsocket_stream(len_and_sockaddr **lsap); |
| 410 | /* Create server socket bound to bindaddr:port. bindaddr can be NULL, | 416 | /* Create server socket bound to bindaddr:port. bindaddr can be NULL, |
| 411 | * numeric IP ("N.N.N.N") or numeric IPv6 address, | 417 | * numeric IP ("N.N.N.N") or numeric IPv6 address, |
| @@ -430,14 +436,13 @@ len_and_sockaddr* host2sockaddr(const char *host, int port); | |||
| 430 | /* Version which dies on error */ | 436 | /* Version which dies on error */ |
| 431 | len_and_sockaddr* xhost2sockaddr(const char *host, int port); | 437 | len_and_sockaddr* xhost2sockaddr(const char *host, int port); |
| 432 | len_and_sockaddr* xdotted2sockaddr(const char *host, int port); | 438 | len_and_sockaddr* xdotted2sockaddr(const char *host, int port); |
| 433 | #if ENABLE_FEATURE_IPV6 | ||
| 434 | /* Same, useful if you want to force family (e.g. IPv6) */ | 439 | /* Same, useful if you want to force family (e.g. IPv6) */ |
| 440 | #if !ENABLE_FEATURE_IPV6 | ||
| 441 | #define host_and_af2sockaddr(host, port, af) host2sockaddr((host), (port)) | ||
| 442 | #define xhost_and_af2sockaddr(host, port, af) xhost2sockaddr((host), (port)) | ||
| 443 | #else | ||
| 435 | len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af); | 444 | len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af); |
| 436 | len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af); | 445 | len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af); |
| 437 | #else | ||
| 438 | /* [we evaluate af: think about "host_and_af2sockaddr(..., af++)"] */ | ||
| 439 | #define host_and_af2sockaddr(host, port, af) ((void)(af), host2sockaddr((host), (port))) | ||
| 440 | #define xhost_and_af2sockaddr(host, port, af) ((void)(af), xhost2sockaddr((host), (port))) | ||
| 441 | #endif | 446 | #endif |
| 442 | /* Assign sin[6]_port member if the socket is an AF_INET[6] one, | 447 | /* Assign sin[6]_port member if the socket is an AF_INET[6] one, |
| 443 | * otherwise no-op. Useful for ftp. | 448 | * otherwise no-op. Useful for ftp. |
diff --git a/include/usage.h b/include/usage.h index a6d970de6..76beb176f 100644 --- a/include/usage.h +++ b/include/usage.h | |||
| @@ -1597,7 +1597,7 @@ USE_FEATURE_BRCTL_FANCY("\n" \ | |||
| 1597 | " -a De/configure all interfaces automatically\n" \ | 1597 | " -a De/configure all interfaces automatically\n" \ |
| 1598 | " -i FILE Use FILE for interface definitions\n" \ | 1598 | " -i FILE Use FILE for interface definitions\n" \ |
| 1599 | " -n Print out what would happen, but don't do it\n" \ | 1599 | " -n Print out what would happen, but don't do it\n" \ |
| 1600 | " (note that this option doesn't disable mappings)\n" \ | 1600 | " (note: doesn't disable mappings)\n" \ |
| 1601 | " -v Print out what would happen before doing it\n" \ | 1601 | " -v Print out what would happen before doing it\n" \ |
| 1602 | " -m Don't run any mappings\n" \ | 1602 | " -m Don't run any mappings\n" \ |
| 1603 | " -f Force de/configuration" | 1603 | " -f Force de/configuration" |
| @@ -1609,19 +1609,21 @@ USE_FEATURE_BRCTL_FANCY("\n" \ | |||
| 1609 | " -a De/configure all interfaces automatically\n" \ | 1609 | " -a De/configure all interfaces automatically\n" \ |
| 1610 | " -i FILE Use FILE for interface definitions\n" \ | 1610 | " -i FILE Use FILE for interface definitions\n" \ |
| 1611 | " -n Print out what would happen, but don't do it\n" \ | 1611 | " -n Print out what would happen, but don't do it\n" \ |
| 1612 | " (note that this option doesn't disable mappings)\n" \ | 1612 | " (note: doesn't disable mappings)\n" \ |
| 1613 | " -v Print out what would happen before doing it\n" \ | 1613 | " -v Print out what would happen before doing it\n" \ |
| 1614 | " -m Don't run any mappings\n" \ | 1614 | " -m Don't run any mappings\n" \ |
| 1615 | " -f Force de/configuration" | 1615 | " -f Force de/configuration" |
| 1616 | 1616 | ||
| 1617 | #define inetd_trivial_usage \ | 1617 | #define inetd_trivial_usage \ |
| 1618 | "[-f] [-q len] [conf]" | 1618 | "[-fe] [-q N] [-R N] [CONFFILE]" |
| 1619 | #define inetd_full_usage \ | 1619 | #define inetd_full_usage \ |
| 1620 | "Listen for network connections and launch programs" \ | 1620 | "Listen for network connections and launch programs\n" \ |
| 1621 | "\n\nOptions:\n" \ | 1621 | "\nOptions:" \ |
| 1622 | " -f Run in foreground\n" \ | 1622 | "\n -f Run in foreground" \ |
| 1623 | " -q N Set the size of the socket listen queue to N\n" \ | 1623 | "\n -e Log to stderr" \ |
| 1624 | " (default: 128)" | 1624 | "\n -q N Socket listen queue (default: 128)" \ |
| 1625 | "\n -R N Pause services after N connects/min" \ | ||
| 1626 | "\n (default: 0 - disabled)" | ||
| 1625 | 1627 | ||
| 1626 | #define init_trivial_usage \ | 1628 | #define init_trivial_usage \ |
| 1627 | "" | 1629 | "" |
