diff options
author | Mladen Turk <mturk@apache.org> | 2009-02-19 07:15:23 +0000 |
---|---|---|
committer | Mladen Turk <mturk@apache.org> | 2009-02-19 07:15:23 +0000 |
commit | 9b0f998ab3db15f7aa53961564ef6be0b0f7a491 (patch) | |
tree | 235d220224061786c2d415c63a208615091fc81b /include/apr_network_io.h | |
parent | db81ee5bb8faeea6c0d9d7836630d6d58e2b357c (diff) | |
download | apr-9b0f998ab3db15f7aa53961564ef6be0b0f7a491.tar.gz |
Enable unix domain (AF_UNIX) sockets if supported by the OS
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@745763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_network_io.h')
-rw-r--r-- | include/apr_network_io.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/apr_network_io.h b/include/apr_network_io.h index 4e3789d2b..b5eea918f 100644 --- a/include/apr_network_io.h +++ b/include/apr_network_io.h @@ -26,10 +26,14 @@ #include "apr_file_io.h" #include "apr_errno.h" #include "apr_inherit.h" +#include "apr_perms_set.h" #if APR_HAVE_NETINET_IN_H #include <netinet/in.h> #endif +#if APR_HAVE_SYS_UN_H +#include <sys/un.h> +#endif #ifdef __cplusplus extern "C" { @@ -154,6 +158,25 @@ struct in_addr { #define APR_INET6 AF_INET6 #endif +#if APR_HAVE_SOCKADDR_UN +#if defined (AF_UNIX) +#define APR_UNIX AF_UNIX +#elif defined(AF_LOCAL) +#define APR_UNIX AF_LOCAL +#else +#error "Neither AF_UNIX nor AF_LOCAL is defined" +#endif +#else /* !APR_HAVE_SOCKADDR_UN */ +#if defined (AF_UNIX) +#define APR_UNIX AF_UNIX +#elif defined(AF_LOCAL) +#define APR_UNIX AF_LOCAL +#else +/* TODO: Use a smarter way to detect unique APR_UNIX value */ +#define APR_UNIX 1234 +#endif +#endif + /** * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets * @{ @@ -245,6 +268,10 @@ struct apr_sockaddr_t { * dependent on whether APR_HAVE_IPV6 is defined. */ struct sockaddr_storage sas; #endif +#if APR_HAVE_SOCKADDR_UN + /** Unix domain socket sockaddr structure */ + struct sockaddr_un unx; +#endif } sa; }; @@ -352,6 +379,7 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, * @param sa The new apr_sockaddr_t. * @param hostname The hostname or numeric address string to resolve/parse, or * NULL to build an address that corresponds to 0.0.0.0 or :: + * or in case of APR_UNIX family it is absolute socket filename. * @param family The address family to use, or APR_UNSPEC if the system should * decide. * @param port The port number. @@ -377,6 +405,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, apr_int32_t flags, apr_pool_t *p); + /** * Look up the host name from an apr_sockaddr_t. * @param hostname The hostname. @@ -769,6 +798,11 @@ APR_DECLARE_INHERIT_SET(socket); APR_DECLARE_INHERIT_UNSET(socket); /** + * Set socket permissions. + */ +APR_PERMS_SET_IMPLEMENT(global_mutex); + +/** * @defgroup apr_mcast IP Multicast * @{ */ |