aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--include/asterisk/acl.h2
-rw-r--r--include/asterisk/autoconfig.h.in3
-rw-r--r--include/asterisk/dnsmgr.h2
-rw-r--r--include/asterisk/manager.h5
-rw-r--r--include/asterisk/netsock.h2
-rw-r--r--include/asterisk/rtp.h2
-rw-r--r--include/asterisk/udptl.h3
-rw-r--r--include/asterisk/utils.h29
-rw-r--r--main/acl.c7
-rw-r--r--main/asterisk.c5
-rw-r--r--main/manager.c5
-rw-r--r--main/netsock.c7
-rw-r--r--main/utils.c6
-rw-r--r--pbx/pbx_dundi.c14
-rw-r--r--res/res_agi.c6
16 files changed, 18 insertions, 82 deletions
diff --git a/configure.ac b/configure.ac
index d2bd34c90..b092d7abe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -305,6 +305,8 @@ AC_SUBST(HAS_POLL)
# fopencookie on linux
AC_CHECK_FUNCS([funopen fopencookie])
+AC_CHECK_FUNCS([inet_aton])
+
# check if we have IP_PKTINFO constant defined
AC_LINK_IFELSE(
AC_LANG_PROGRAM([#include <netinet/in.h>],
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h
index db626c228..79b787d70 100644
--- a/include/asterisk/acl.h
+++ b/include/asterisk/acl.h
@@ -28,7 +28,7 @@
extern "C" {
#endif
-#include <netinet/in.h>
+#include "asterisk/network.h"
#include "asterisk/io.h"
#define AST_SENSE_DENY 0
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index e5b8f0485..5be612e44 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -337,6 +337,9 @@
or greater. */
#undef HAVE_IMAP_TK2006
+/* Define to 1 if you have the `inet_aton' function. */
+#undef HAVE_INET_ATON
+
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
diff --git a/include/asterisk/dnsmgr.h b/include/asterisk/dnsmgr.h
index c9061dc42..33b9556e7 100644
--- a/include/asterisk/dnsmgr.h
+++ b/include/asterisk/dnsmgr.h
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <netinet/in.h>
+#include "asterisk/network.h"
struct ast_dnsmgr_entry;
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index cef48ed48..6566713f1 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -19,10 +19,7 @@
#ifndef _ASTERISK_MANAGER_H
#define _ASTERISK_MANAGER_H
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
+#include "asterisk/network.h"
#include "asterisk/lock.h"
/*!
diff --git a/include/asterisk/netsock.h b/include/asterisk/netsock.h
index f3c932bf1..988d51fcf 100644
--- a/include/asterisk/netsock.h
+++ b/include/asterisk/netsock.h
@@ -28,7 +28,7 @@
extern "C" {
#endif
-#include <netinet/in.h>
+#include "asterisk/network.h"
#include "asterisk/io.h"
#include "asterisk/astobj.h"
diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h
index 8d54cbe88..56ac76e86 100644
--- a/include/asterisk/rtp.h
+++ b/include/asterisk/rtp.h
@@ -26,7 +26,7 @@
#ifndef _ASTERISK_RTP_H
#define _ASTERISK_RTP_H
-#include <netinet/in.h>
+#include "asterisk/network.h"
#include "asterisk/frame.h"
#include "asterisk/io.h"
diff --git a/include/asterisk/udptl.h b/include/asterisk/udptl.h
index 4ee72b825..090cc5b07 100644
--- a/include/asterisk/udptl.h
+++ b/include/asterisk/udptl.h
@@ -18,13 +18,12 @@
#ifndef _ASTERISK_UDPTL_H
#define _ASTERISK_UDPTL_H
+#include "asterisk/network.h"
#include "asterisk/frame.h"
#include "asterisk/io.h"
#include "asterisk/sched.h"
#include "asterisk/channel.h"
-#include <netinet/in.h>
-
enum
{
UDPTL_ERROR_CORRECTION_NONE,
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index c79cc8d0b..6b55a4272 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -23,9 +23,8 @@
#ifndef _ASTERISK_UTILS_H
#define _ASTERISK_UTILS_H
-#include <netinet/in.h>
-#include <arpa/inet.h> /* we want to override inet_ntoa */
-#include <netdb.h>
+#include "asterisk/network.h"
+
#include <limits.h>
#include <time.h> /* we want to override localtime_r */
@@ -310,23 +309,6 @@ static force_inline void ast_slinear_saturated_divide(short *input, short *value
int test_for_thread_safety(void);
-/*!
- * \brief thread-safe replacement for inet_ntoa().
- *
- * \note It is very important to note that even though this is a thread-safe
- * replacement for inet_ntoa(), it is *not* reentrant. In a single
- * thread, the result from a previous call to this function is no longer
- * valid once it is called again. If the result from multiple calls to
- * this function need to be kept or used at once, then the result must be
- * copied to a local buffer before calling this function again.
- */
-const char *ast_inet_ntoa(struct in_addr ia);
-
-#ifdef inet_ntoa
-#undef inet_ntoa
-#endif
-#define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
-
#ifdef localtime_r
#undef localtime_r
#endif
@@ -346,13 +328,6 @@ int ast_wait_for_input(int fd, int ms);
*/
int ast_carefulwrite(int fd, char *s, int len, int timeoutms);
-/*! \brief Compares the source address and port of two sockaddr_in */
-static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
-{
- return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
- || (sin1->sin_port != sin2->sin_port));
-}
-
/*
* Thread management support (should be moved to lock.h or a different header)
*/
diff --git a/main/acl.c b/main/acl.c
index f82a0805c..03a01e739 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -30,13 +30,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <net/if.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
#include <sys/ioctl.h>
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
diff --git a/main/asterisk.c b/main/asterisk.c
index 3db9c0ca5..905fb2f45 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -67,7 +67,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <fcntl.h>
#include <signal.h>
#include <sched.h>
-#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <errno.h>
@@ -87,14 +86,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#endif /* linux */
#include <regex.h>
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
#if defined(SOLARIS)
int daemon(int, int); /* defined in libresolv of all places */
#include <sys/loadavg.h>
#endif
+#include "asterisk/network.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/cli.h"
diff --git a/main/manager.c b/main/manager.c
index 7708d324f..9edc02ad1 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -47,11 +47,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <ctype.h>
#include <sys/time.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
#include <signal.h>
#include <errno.h>
#include <sys/mman.h>
diff --git a/main/netsock.c b/main/netsock.c
index b391fc4ee..6cd5e090f 100644
--- a/main/netsock.c
+++ b/main/netsock.c
@@ -32,13 +32,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <net/if.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
#include <sys/ioctl.h>
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
diff --git a/main/utils.c b/main/utils.c
index 586e1ccc7..ebec01e38 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -30,15 +30,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
#ifdef HAVE_DEV_URANDOM
#include <fcntl.h>
#endif
+#include "asterisk/network.h"
+
#define AST_API_MODULE /* ensure that inlinable API functions will be built in lock.h if required */
#include "asterisk/lock.h"
#include "asterisk/io.h"
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index f2c3be341..bcbce6e4e 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -30,21 +30,9 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
+#include "asterisk/network.h"
#include <errno.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(SOLARIS) || defined(__Darwin__)
-#include <sys/types.h>
-#include <netinet/in_systm.h>
-#endif
-#include <netinet/ip.h>
#include <sys/ioctl.h>
-#include <net/if.h>
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__)
-#include <net/if_dl.h>
-#include <ifaddrs.h>
-#endif
#include <zlib.h>
#include <sys/signal.h>
#include <pthread.h>
diff --git a/res/res_agi.c b/res/res_agi.c
index 36ad040b3..55659f3cf 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -27,11 +27,6 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
#include <math.h>
#include <signal.h>
#include <sys/time.h>
@@ -40,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/wait.h>
#include <sys/stat.h>
+#include "asterisk/network.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"