[asterisk-commits] rizzo: trunk r89380 - in /trunk: ./ include/asterisk/ main/ pbx/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 17 08:11:53 CST 2007


Author: rizzo
Date: Sat Nov 17 08:11:53 2007
New Revision: 89380

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89380
Log:
start using asterisk/network.h for network related headers.
Also remove some unnecessary includes.


Modified:
    trunk/configure.ac
    trunk/include/asterisk/acl.h
    trunk/include/asterisk/autoconfig.h.in
    trunk/include/asterisk/dnsmgr.h
    trunk/include/asterisk/manager.h
    trunk/include/asterisk/netsock.h
    trunk/include/asterisk/rtp.h
    trunk/include/asterisk/udptl.h
    trunk/include/asterisk/utils.h
    trunk/main/acl.c
    trunk/main/asterisk.c
    trunk/main/manager.c
    trunk/main/netsock.c
    trunk/main/utils.c
    trunk/pbx/pbx_dundi.c
    trunk/res/res_agi.c

Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sat Nov 17 08:11:53 2007
@@ -304,6 +304,8 @@
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux
 AC_CHECK_FUNCS([funopen fopencookie])
+
+AC_CHECK_FUNCS([inet_aton])
 
 # check if we have IP_PKTINFO constant defined
 AC_LINK_IFELSE(

Modified: trunk/include/asterisk/acl.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/acl.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/acl.h (original)
+++ trunk/include/asterisk/acl.h Sat Nov 17 08:11:53 2007
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-#include <netinet/in.h>
+#include "asterisk/network.h"
 #include "asterisk/io.h"
 
 #define AST_SENSE_DENY                  0

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Sat Nov 17 08:11:53 2007
@@ -336,6 +336,9 @@
 /* Define if your system has the UW IMAP Toolkit c-client library version 2006
    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

Modified: trunk/include/asterisk/dnsmgr.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/dnsmgr.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/dnsmgr.h (original)
+++ trunk/include/asterisk/dnsmgr.h Sat Nov 17 08:11:53 2007
@@ -27,7 +27,7 @@
 extern "C" {
 #endif
 
-#include <netinet/in.h>
+#include "asterisk/network.h"
 
 struct ast_dnsmgr_entry;
 

Modified: trunk/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Sat Nov 17 08:11:53 2007
@@ -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"
 
 /*!

Modified: trunk/include/asterisk/netsock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/netsock.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/netsock.h (original)
+++ trunk/include/asterisk/netsock.h Sat Nov 17 08:11:53 2007
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-#include <netinet/in.h>
+#include "asterisk/network.h"
 #include "asterisk/io.h"
 #include "asterisk/astobj.h"
 

Modified: trunk/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/rtp.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/rtp.h (original)
+++ trunk/include/asterisk/rtp.h Sat Nov 17 08:11:53 2007
@@ -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"

Modified: trunk/include/asterisk/udptl.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/udptl.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/udptl.h (original)
+++ trunk/include/asterisk/udptl.h Sat Nov 17 08:11:53 2007
@@ -18,12 +18,11 @@
 #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
 {

Modified: trunk/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/utils.h?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Sat Nov 17 08:11:53 2007
@@ -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 @@
 
 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
@@ -345,13 +327,6 @@
 	have a need to wait.  This way, we get better performance.
 */
 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)

Modified: trunk/main/acl.c
URL: http://svn.digium.com/view/asterisk/trunk/main/acl.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/main/acl.c (original)
+++ trunk/main/acl.c Sat Nov 17 08:11:53 2007
@@ -30,13 +30,6 @@
 #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__)

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Sat Nov 17 08:11:53 2007
@@ -67,7 +67,6 @@
 #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 @@
 #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"

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Sat Nov 17 08:11:53 2007
@@ -47,11 +47,6 @@
 
 #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>

Modified: trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/trunk/main/netsock.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/main/netsock.c (original)
+++ trunk/main/netsock.c Sat Nov 17 08:11:53 2007
@@ -32,13 +32,6 @@
 #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__)

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Sat Nov 17 08:11:53 2007
@@ -30,14 +30,12 @@
 #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"

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Sat Nov 17 08:11:53 2007
@@ -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>

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=89380&r1=89379&r2=89380
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Sat Nov 17 08:11:53 2007
@@ -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 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 
+#include "asterisk/network.h"
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"




More information about the asterisk-commits mailing list