diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-17 16:32:18 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-17 16:32:18 +0000 |
commit | f9cb61c11685150c8482c12b293b2b3fe3aa1187 (patch) | |
tree | 0fd99f57b7b2c9747de9ef4db9b4fb79cf16ff95 | |
parent | 3136f24f36f529901b135c7b9039e898e15f60d5 (diff) |
prefer socket.h over other variants (winsock etc.)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89385 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | include/asterisk/network.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/include/asterisk/network.h b/include/asterisk/network.h index c2aa30b69..bc7962be7 100644 --- a/include/asterisk/network.h +++ b/include/asterisk/network.h @@ -19,6 +19,8 @@ /*! \file * \brief Wrapper for network related headers, * masking differences between various operating systems. + * On passing, we also provide here trivial functions or + * other simple wrappers to network-related functions. */ #ifndef _ASTERISK_NETWORK_H @@ -28,21 +30,29 @@ extern "C" { #endif -#ifdef HAVE_WINSOCK2_H_NOT -#include <winsock2.h> -#include <ws2tcpip.h> -#elif defined(HAVE_WINSOCK_H) -#include <winsock.h> -typedef int socklen_t; - -#else -#include <arpa/inet.h> /* include early to override inet_ntoa */ +/* + * Include relevant network headers. + * Our preferred choice are the standard BSD/linux/unix headers. + * Missing them (e.g. for solaris or various windows environments), + * we resort to whatever we find around, and provide local definitions + * for the missing bits. + */ +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> /* include early to override inet_ntoa */ #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <netinet/tcp.h> #include <netdb.h> -#include <sys/socket.h> +#include <sys/socket.h> +#elif defined(HAVE_WINSOCK_H) +#include <winsock.h> +typedef int socklen_t; +#elif defined(HAVE_WINSOCK2_H) +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#error don't know how to handle network functions here. #endif #ifndef HAVE_INET_ATON |