From a4f939702810e8be44ac7c729a32a2fd540d7686 Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Sat, 17 Nov 2007 16:32:18 +0000 Subject: [PATCH] prefer socket.h over other variants (winsock etc.) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89385 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/network.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/include/asterisk/network.h b/include/asterisk/network.h index c2aa30b691..bc7962be70 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 -#include -#elif defined(HAVE_WINSOCK_H) -#include -typedef int socklen_t; - -#else -#include /* 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 /* include early to override inet_ntoa */ #include #include #include #include #include -#include +#include +#elif defined(HAVE_WINSOCK_H) +#include +typedef int socklen_t; +#elif defined(HAVE_WINSOCK2_H) +#include +#include +#else +#error don't know how to handle network functions here. #endif #ifndef HAVE_INET_ATON