[Freeswitch-svn] [commit] r8920 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta libsofia-sip-ua/nth libsofia-sip-ua/nua libsofia-sip-ua/sresolv libsofia-sip-ua/stun libsofia-sip-ua/su libsofia-sip-ua/tport tests utils

Freeswitch SVN mikej at freeswitch.org
Tue Jul 8 00:36:13 EDT 2008


Author: mikej
Date: Tue Jul  8 00:36:13 2008
New Revision: 8920

Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c
   freeswitch/trunk/libs/sofia-sip/tests/test_init.c
   freeswitch/trunk/libs/sofia-sip/tests/test_nat.c
   freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c

Log:
Thu Jun  5 10:23:18 EDT 2008  Pekka Pessi <first.last at nokia.com>
  * Using su_inet_ntop and su_inet_pton



Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Tue Jul  8 00:36:13 2008
@@ -1 +1 @@
-Thu Jun  5 12:20:19 EDT 2008
+Tue Jul  8 00:36:02 EDT 2008

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	Tue Jul  8 00:36:13 2008
@@ -636,16 +636,16 @@
     *m->m_url = *ag->ag_contact->m_url;
 
     if (host_is_ip4_address(m->m_url->url_host)) {
-      inet_pton(su->su_family = AF_INET,
-		m->m_url->url_host,
-		&su->su_sin.sin_addr);
+      su_inet_pton(su->su_family = AF_INET,
+		   m->m_url->url_host,
+		   &su->su_sin.sin_addr);
       ag->ag_su_nta_len = (sizeof su->su_sin);
     }
     else {
       TEST_1(host_is_ip_address(m->m_url->url_host));
-      inet_pton(su->su_family = AF_INET6,
-		m->m_url->url_host,
-		&su->su_sin6.sin6_addr);
+      su_inet_pton(su->su_family = AF_INET6,
+		   m->m_url->url_host,
+		   &su->su_sin6.sin6_addr);
       ag->ag_su_nta_len = (sizeof su->su_sin6);
     }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	Tue Jul  8 00:36:13 2008
@@ -185,7 +185,7 @@
   t->t_addr->su_len = (sizeof t->t_addr->su_sin);
   s = su_socket(t->t_addr->su_family = AF_INET, SOCK_STREAM, 0);
   TEST_1(s != INVALID_SOCKET);
-  TEST_1(inet_pton(AF_INET, "127.0.0.1", &t->t_addr->su_sin.sin_addr) >= 0);
+  TEST_1(su_inet_pton(AF_INET, "127.0.0.1", &t->t_addr->su_sin.sin_addr) >= 0);
   TEST_1(bind(s, &t->t_addr->su_sa, 
 	      t->t_addrlen = (sizeof t->t_addr->su_sin)) != -1);
   TEST_1(getsockname(s, &t->t_addr->su_sa, &t->t_addrlen) != -1);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	Tue Jul  8 00:36:13 2008
@@ -1365,7 +1365,7 @@
 
   assert(s2->dns.reg != 0);
 
-  inet_pton(AF_INET, "127.0.0.1", &localhost);
+  su_inet_pton(AF_INET, "127.0.0.1", &localhost);
 
   va_start(va0, use_naptr);
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	Tue Jul  8 00:36:13 2008
@@ -221,7 +221,7 @@
     if (a->a_record->r_status)
       continue;			      /* There was an error */
 
-    inet_ntop(AF_INET, &a->a_addr, addr, sizeof(addr));
+    su_inet_ntop(AF_INET, &a->a_addr, addr, sizeof(addr));
     printf("%s@%s:%u\n", sr->sr_tport, addr, sr->sr_port);
     sr->sr_exitcode = 0;
   }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	Tue Jul  8 00:36:13 2008
@@ -184,6 +184,11 @@
 #endif
 #endif
 #endif
+
+SOFIAPUBFUN int su_inet_pton(int af, char const *src, void *dst);
+SOFIAPUBFUN const char *su_inet_ntop(int af, void const *src,
+				  char *dst, size_t size);
+
 #else
 
 #define sres_send(s,b,len,flags) send((s),(b),(len),(flags))
@@ -195,6 +200,10 @@
 #define SOCKET_ERROR   (-1)
 #define INVALID_SOCKET ((sres_socket_t)-1)
 #define sres_socket(x,y,z) socket((x),(y),(z))
+
+#define su_inet_pton inet_pton
+#define su_inet_ntop inet_ntop
+
 #endif
 
 #if 1
@@ -264,8 +273,8 @@
       a1len = a2len = a3len = a4len = sizeof (struct sockaddr_in6);
 
     if (af == AF_INET) {
-      TEST_1(inet_pton(af, "127.0.0.1", &sin3->sin_addr) > 0);
-      TEST_1(inet_pton(af, "127.0.0.1", &sin4->sin_addr) > 0);
+      TEST_1(su_inet_pton(af, "127.0.0.1", &sin3->sin_addr) > 0);
+      TEST_1(su_inet_pton(af, "127.0.0.1", &sin4->sin_addr) > 0);
     } else {
     }
 
@@ -734,7 +743,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:210:a4ff:fe8d:6a46");
 
   TEST_P(rr_a6->a6_prename, NULL);
@@ -748,7 +757,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:210:a4ff:fe8d:6a46");
 
   TEST_P(rr_a6->a6_prename, NULL);
@@ -778,7 +787,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 64);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "::a08:20ff:fe7d:e7ac");
 
   TEST_S(rr_a6->a6_prename, "mynet.example.com.");
@@ -795,7 +804,7 @@
   TEST(rr_a6->a6_record->r_class, sres_class_in);
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ff0:12:3012:c006:a08:20ff:fe7d:e7ac");
   TEST_P(rr_a6->a6_prename, NULL);
  
@@ -811,7 +820,7 @@
   TEST(rr_a6->a6_record->r_class, sres_class_in);
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 128);
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
   TEST_S(rr_a6->a6_prename, "a6.example.com.");
  
   sres_free_answers(res, ctx->result), ctx->result = NULL;
@@ -824,7 +833,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 64);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "::a08:20ff:fe7d:e7ac");
 
   TEST_S(rr_a6->a6_prename, "mynet.example.com.");
@@ -853,7 +862,7 @@
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:4630");
 
   sres_free_answers(res, ctx->result), ctx->result = NULL;
@@ -865,7 +874,7 @@
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:4630");
 
   sres_free_answers(res, result), result = NULL;
@@ -1027,7 +1036,7 @@
   const sres_ptr_record_t *rr;
   struct sockaddr_in sin = {0};
   
-  inet_pton(AF_INET, "127.0.0.1", &sin.sin_addr);
+  su_inet_pton(AF_INET, "127.0.0.1", &sin.sin_addr);
   sin.sin_family = AF_INET;
 
   BEGIN();
@@ -1089,8 +1098,8 @@
 
   BEGIN();
 
-  inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
-            &sin6.sin6_addr);
+  su_inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
+	       &sin6.sin6_addr);
 
   sin6.sin6_family = AF_INET6;
 
@@ -1154,9 +1163,9 @@
   sres_query(res, test_answer_multi, ctx,
 	     sres_type_aaaa, "mgw02.example.com");
 
-  inet_pton(AF_INET6, 
-            "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
-            &sin6.sin6_addr);
+  su_inet_pton(AF_INET6,
+	       "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac",
+	       &sin6.sin6_addr);
 
   sin6.sin6_family = AF_INET6;
 
@@ -1361,7 +1370,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "3ff0::");
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "3ff0::");
 
   TEST_P(rr_a6->a6_prename, NULL);
 
@@ -1373,7 +1382,7 @@
   TEST(rr_aaaa->aaaa_record->r_type, sres_type_aaaa);
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:462f");
   sres_free_answers(res, result);
 
@@ -1416,7 +1425,7 @@
   TEST(rr_aaaa->aaaa_record->r_type, sres_type_aaaa);
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:462f");
 
   TEST_P(result[1], NULL);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c	Tue Jul  8 00:36:13 2008
@@ -276,8 +276,8 @@
     }
 
     SU_DEBUG_0(("%s: local address NATed as %s:%u\n", __func__,
-		inet_ntop(sa->su_family, SU_ADDR(sa),
-			  ipaddr, sizeof(ipaddr)),
+		su_inet_ntop(sa->su_family, SU_ADDR(sa),
+			     ipaddr, sizeof(ipaddr)),
 		(unsigned) ntohs(sa->su_port)));
 
   break;
@@ -428,8 +428,8 @@
     err = bind(s, (struct sockaddr *)&sockaddr, socklen);
     if (err < 0) {
       SU_DEBUG_1(("%s: Error %d binding to %s:%u\n", __func__, err,
-		  inet_ntop(sockaddr.su_family, SU_ADDR(&sockaddr), 
-			    ipaddr, sizeof(ipaddr)),
+		  su_inet_ntop(sockaddr.su_family, SU_ADDR(&sockaddr),
+			       ipaddr, sizeof(ipaddr)),
 		  (unsigned) ntohs(sockaddr.su_port)));
       return -1;
     }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c	Tue Jul  8 00:36:13 2008
@@ -143,7 +143,7 @@
 #endif
 
       port = ntohs(su->su_port);
-      inet_ntop(ai->ai_family, SU_ADDR(su), buffer, sizeof(buffer));
+      su_inet_ntop(ai->ai_family, SU_ADDR(su), buffer, sizeof(buffer));
       printf("%d@[%s]:%u", ai->ai_protocol, buffer, port);
 
       if (ai->ai_flags & AI_CANONNAME)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c	Tue Jul  8 00:36:13 2008
@@ -167,8 +167,8 @@
         fputs(li->li_canonname, stdout);
       }
       else {
-        inet_ntop(li->li_family, SU_ADDR(li->li_addr), 
-		  buffer, sizeof(buffer));
+        su_inet_ntop(li->li_family, SU_ADDR(li->li_addr),
+		     buffer, sizeof(buffer));
         printf("%s maddr=[%s]", li->li_canonname, buffer);
       }
       if (li->li_scope & LI_SCOPE_GLOBAL)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c	Tue Jul  8 00:36:13 2008
@@ -223,7 +223,7 @@
 		/* translator hack */
 		{
 			char *q = getenv("GAI");
-			if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1)
+			if (q && su_inet_pton(AF_INET6, q, &faith_prefix) == 1)
 				translate = YES;
 		}
 		firsttime = 0;
@@ -411,7 +411,7 @@
 	
 	/* hostname as numeric name */
 	for (i = 0; gai_afdl[i].a_af; i++) {
-		if (inet_pton(gai_afdl[i].a_af, hostname, pton)) {
+		if (su_inet_pton(gai_afdl[i].a_af, hostname, pton)) {
 			u_long v4a;
 			u_char pfx;
 
@@ -752,7 +752,7 @@
 	if (host == NULL || hostlen == 0) {
 		/* what should we do? */
 	} else if (flags & NI_NUMERICHOST) {
-		if (inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
+		if (su_inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
 		    == NULL)
 			return ENI_SYSTEM;
 		if (strlen(numaddr) > hostlen)
@@ -784,7 +784,8 @@
 		} else {
 			if (flags & NI_NAMEREQD)
 				return ENI_NOHOSTNAME;
-			if (inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
+			if (su_inet_ntop(gni_afd->a_af, addr,
+					 numaddr, sizeof(numaddr))
 			    == NULL)
 				return ENI_NOHOSTNAME;
 			if (strlen(numaddr) > hostlen)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	Tue Jul  8 00:36:13 2008
@@ -1047,7 +1047,7 @@
 	sa = calloc(1, sizeof(su_sockaddr_t));
 
 	sa->su_family = AF_INET6;
-	if (inet_pton(AF_INET6, addr, &sa->su_sin6.sin6_addr) <= 0)
+	if (su_inet_pton(AF_INET6, addr, &sa->su_sin6.sin6_addr) <= 0)
 	  goto err;
 	
 	s = su_socket(AF_INET6, SOCK_DGRAM, 0);
@@ -1105,7 +1105,7 @@
       li->li_addrlen = sizeof(*su);
       li->li_addr = su = (su_sockaddr_t *)(li + 1);
       su->su_family = li->li_family = AF_INET6;
-      if (inet_pton(AF_INET6, addr, &su->su_sin6.sin6_addr) <= 0)
+      if (su_inet_pton(AF_INET6, addr, &su->su_sin6.sin6_addr) <= 0)
 	goto err;
       if (li->li_flags & LI_IFNAME) 
 	li->li_ifname = ifname;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c	Tue Jul  8 00:36:13 2008
@@ -373,7 +373,7 @@
       char buf[SU_ADDRSIZE];
       
       SU_DEBUG_3(("accept: connection from %s:%u\n",
-		  inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
+		  su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
 		  ntohs(su->su_port)));
 
       if (!su_wait_create(f->f_wait, f->f_socket, SU_WAIT_IN) &&
@@ -628,7 +628,7 @@
   char buf[SU_ADDRSIZE];
   
   SU_DEBUG_3(("forwarder_shutdown: shutdown from %s:%u\n",
-	      inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
+	      su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
 	      ntohs(su->su_port)));
   
   if (su_root_unregister(f->f_pr->pr_root, f->f_wait, forwarder_recv, f) < 0) {
@@ -663,9 +663,9 @@
     su2 = f->f_dest, su1 = f->f_peer->f_dest, d2 = "up", d1 = "down";
 
   SU_DEBUG_3(("forwarder_close: connection from %s:%u to %s:%d\n",
-	      inet_ntop(su1->su_family, SU_ADDR(su1), buf1, sizeof(buf1)),
+	      su_inet_ntop(su1->su_family, SU_ADDR(su1), buf1, sizeof(buf1)),
 	      ntohs(su1->su_port),
-	      inet_ntop(su2->su_family, SU_ADDR(su2), buf2, sizeof(buf2)),
+	      su_inet_ntop(su2->su_family, SU_ADDR(su2), buf2, sizeof(buf2)),
 	      ntohs(su2->su_port)));
 
   forwarder_destroy(f);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c	Tue Jul  8 00:36:13 2008
@@ -116,7 +116,7 @@
 
   if (opt_verbatim)
     printf("udpsocket: using address [%s]:%u\n",
-	   inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port));
 
   return s;
@@ -183,7 +183,7 @@
 
   if (opt_verbatim)
     printf("do_rtt: %d bytes from [%s]:%u: \"%s\", rtt = %lg ms\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, rtt / 1000);
 
   do_ping(p, p->t, NULL);
@@ -237,7 +237,7 @@
 
   if (opt_verbatim)
     printf("do_recv: %d bytes from [%s]:%u: \"%s\" at %s\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, snow(now));
 
   fflush(stdout);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c	Tue Jul  8 00:36:13 2008
@@ -127,7 +127,7 @@
 
   if (opt_verbatim)
     printf("udpsocket: using address [%s]:%u\n",
-	   inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port));
 
   return s;
@@ -202,7 +202,7 @@
 
   if (opt_verbatim)
     printf("do_rtt: %d bytes from [%s]:%u: \"%s\", rtt = %lg ms\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, rtt / 1000);
 
   do_ping(p, p->t, NULL);
@@ -260,7 +260,7 @@
 
   if (opt_verbatim)
     printf("do_recv: %d bytes from [%s]:%u: \"%s\" at %s\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, snow(now));
 
   fflush(stdout);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	Tue Jul  8 00:36:13 2008
@@ -177,7 +177,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
 
   TEST(bind(s, &su.su_sa, sulen), 0);
   TEST(getsockname(s, &su.su_sa, &sulen), 0);
@@ -197,7 +197,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
 
   TEST(bind(l, &su.su_sa, sulen), 0);
   TEST(bind(s, &su.su_sa, sulen), 0);
@@ -304,7 +304,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
   TEST(bind(s, &su.su_sa, sulen), 0);
   TEST(getsockname(s, &su.su_sa, &sulen), 0);
   

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	Tue Jul  8 00:36:13 2008
@@ -239,9 +239,9 @@
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
     TEST_1(getsockname(ep->s, &ep->addr->su_sa, &ep->addrlen) != -1);
     if (SU_HAS_INADDR_ANY(ep->addr)) {
-      inet_pton(su->su_family, 
-	        su->su_family == AF_INET ? "127.0.0.1" : "::1",
-		SU_ADDR(ep->addr));
+      su_inet_pton(su->su_family,
+		   su->su_family == AF_INET ? "127.0.0.1" : "::1",
+		   SU_ADDR(ep->addr));
     }
   }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c	Tue Jul  8 00:36:13 2008
@@ -108,9 +108,9 @@
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
     TEST_1(getsockname(ep->s, &ep->addr->su_sa, &ep->addrlen) != -1);
     if (SU_HAS_INADDR_ANY(ep->addr)) {
-      inet_pton(su->su_family, 
-	        su->su_family == AF_INET ? "127.0.0.1" : "::1",
-		SU_ADDR(ep->addr));
+      su_inet_pton(su->su_family,
+		   su->su_family == AF_INET ? "127.0.0.1" : "::1",
+		   SU_ADDR(ep->addr));
     }
   }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	Tue Jul  8 00:36:13 2008
@@ -3958,7 +3958,7 @@
 #else
   SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n", 
 	      "",
-              inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
+              su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
 	      "",
               htons(su->su_port)));
 #endif

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	Tue Jul  8 00:36:13 2008
@@ -197,7 +197,8 @@
 
     SU_DEBUG_5(("%s: stun_bind() ok: local address NATed as %s:%u\n", 
 		__func__,
-		inet_ntop(su->su_family, SU_ADDR(su), ipname, sizeof(ipname)),
+		su_inet_ntop(su->su_family, SU_ADDR(su),
+			     ipname, sizeof(ipname)),
 		(unsigned) ntohs(su->su_port)));
   }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	Tue Jul  8 00:36:13 2008
@@ -144,7 +144,7 @@
     imr->imr_multiaddr = su->su_sin.sin_addr;
 
     if (host_is_ip4_address(tpn->tpn_canon) &&
-	inet_pton(AF_INET, tpn->tpn_canon, &iface) > 0) {
+	su_inet_pton(AF_INET, tpn->tpn_canon, &iface) > 0) {
       imr->imr_interface = iface;
     }
 
@@ -506,8 +506,8 @@
 		  origin, info));
       if (from->su_family != AF_UNSPEC)
 	SU_DEBUG_3(("\treported by [%s]:%u\n",
-		    inet_ntop(from->su_family, SU_ADDR(from), 
-			      info, sizeof(info)),
+		    su_inet_ntop(from->su_family, SU_ADDR(from),
+				 info, sizeof(info)),
 		    ntohs(from->su_port)));
 
       if (msg->msg_namelen == 0)

Modified: freeswitch/trunk/libs/sofia-sip/tests/test_init.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/tests/test_init.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/tests/test_init.c	Tue Jul  8 00:36:13 2008
@@ -217,7 +217,7 @@
     else if (su->su_family == AF_INET6) {
       a_uri = (void *)
 	su_sprintf(ctx->home, "sip:[%s]:%u",
-		   inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
+		   su_inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
 		   ntohs(su->su_port));
       a_bind = "sip:[::]:*";
     }
@@ -225,7 +225,7 @@
     else if (su->su_family == AF_INET) {
       a_uri = (void *)
 	su_sprintf(ctx->home, "sip:%s:%u",
-		   inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
+		   su_inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
 		   ntohs(su->su_port));
     }
 
@@ -234,15 +234,15 @@
       su->su_len = sulen = (sizeof su->su_sin6), su->su_family = AF_INET6;
       len = strcspn(p_uri->url_host + 1, "]"); assert(len < sizeof b);
       memcpy(b, p_uri->url_host + 1, len); b[len] = '\0';
-      inet_pton(su->su_family, b, SU_ADDR(su));
+      su_inet_pton(su->su_family, b, SU_ADDR(su));
     }
     else {
       su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
-      inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
+      su_inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
     }
 #else
     su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
-    inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
+    su_inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
 #endif
 
     su->su_port = htons(strtoul(url_port(p_uri), NULL, 10));

Modified: freeswitch/trunk/libs/sofia-sip/tests/test_nat.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/tests/test_nat.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/tests/test_nat.c	Tue Jul  8 00:36:13 2008
@@ -531,13 +531,13 @@
     }
 
   getpeername(b->in_socket, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
   snprintf(b->in_name, sizeof b->in_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(addr->su_port));
 
   getsockname(out_socket, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
   snprintf(b->out_name, sizeof b->out_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(addr->su_port));
@@ -617,7 +617,7 @@
   size_t namelen;
   struct binding *b;
 				       
-  inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
+  su_inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
   snprintf(name, sizeof name,
 	   from->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(from->su_port));
@@ -915,7 +915,7 @@
   b->out_register = out_register;
 
   getsockname(out, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), name, sizeof name);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), name, sizeof name);
   snprintf(b->out_name, sizeof b->out_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   name, ntohs(addr->su_port));

Modified: freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/utils/sip-dig.c	Tue Jul  8 00:36:13 2008
@@ -134,13 +134,6 @@
 
 #include "config.h"
 
-#if !defined(HAVE_WIN32)
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-
 #include "sofia-sip/su.h"
 
 #include "sofia-resolv/sres.h"
@@ -803,7 +796,7 @@
     if (answers[i]->sr_record->r_status != 0)
       continue;
 
-    inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
+    su_inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
 
     for (j = 0; tports[j].name; j++) {
       if (strcasecmp(tport, tports[j].name) == 0)



More information about the Freeswitch-svn mailing list