[asterisk-scf-commits] asterisk-scf/release/pjproject.git branch "veesix" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Dec 29 17:27:48 UTC 2010


branch "veesix" has been updated
       via  a505e6e6056509f62a1a91c6834811115035a759 (commit)
      from  23957be23cf833643535a84399a5ca3a558a0b35 (commit)

Summary of changes:
 pjsip/build/Makefile                               |    2 +-
 pjsip/src/test/test.c                              |    1 +
 pjsip/src/test/test.h                              |    1 +
 pjsip/src/test/transport_tcp_test.c                |   11 ++++++++---
 ...ransport_tcp_test.c => transport_tcp_test_v6.c} |    6 +++---
 5 files changed, 14 insertions(+), 7 deletions(-)
 copy pjsip/src/test/{transport_tcp_test.c => transport_tcp_test_v6.c} (97%)


- Log -----------------------------------------------------------------
commit a505e6e6056509f62a1a91c6834811115035a759
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Dec 29 11:33:48 2010 -0600

    Create separate tests for TCP over IPv4 and IPv6.

diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile
index 6466c57..231ec54 100644
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -87,7 +87,7 @@ export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
 export TEST_SRCDIR = ../src/test
 export TEST_OBJS += dlg_core_test.o dns_test.o msg_err_test.o \
 		    msg_logger.o msg_test.o multipart_test.o regc_test.o \
-		    test.o transport_loop_test.o transport_tcp_test.o \
+		    test.o transport_loop_test.o transport_tcp_test.o transport_tcp_test_v6.o \
 		    transport_test.o transport_udp_test.o \
 		    tsx_basic_test.o tsx_bench.o tsx_uac_test.o \
 		    tsx_uas_test.o txdata_test.o uri_test.o \
diff --git a/pjsip/src/test/test.c b/pjsip/src/test/test.c
index 8fa5f66..40bb8f1 100644
--- a/pjsip/src/test/test.c
+++ b/pjsip/src/test/test.c
@@ -323,6 +323,7 @@ int test_main(void)
 
 #if INCLUDE_TCP_TEST
     DO_TEST(transport_tcp_test());
+    DO_TEST(transport_tcp_test_v6());
 #endif
 
 #if INCLUDE_RESOLVE_TEST
diff --git a/pjsip/src/test/test.h b/pjsip/src/test/test.h
index c5e1d5d..c1b02fa 100644
--- a/pjsip/src/test/test.h
+++ b/pjsip/src/test/test.h
@@ -78,6 +78,7 @@ int tsx_bench(void);
 int transport_udp_test(void);
 int transport_loop_test(void);
 int transport_tcp_test(void);
+int transport_tcp_test_v6(void);
 int resolve_test(void);
 int regc_test(void);
 
diff --git a/pjsip/src/test/transport_tcp_test.c b/pjsip/src/test/transport_tcp_test.c
index 2a814bb..1472221 100644
--- a/pjsip/src/test/transport_tcp_test.c
+++ b/pjsip/src/test/transport_tcp_test.c
@@ -35,21 +35,26 @@ int transport_tcp_test(void)
     pjsip_tpfactory *tpfactory;
     pjsip_transport *tcp;
     pj_sockaddr rem_addr;
+    pj_sockaddr_in local_addr;
     pj_status_t status;
     char url[PJSIP_MAX_URL_SIZE];
     int rtt[SEND_RECV_LOOP], min_rtt;
     int i, pkt_lost;
     char rem_addr_str[PJ_INET6_ADDRSTRLEN];
 
+    pj_bzero(&local_addr, sizeof(local_addr));
+    local_addr.sin_family = pj_AF_INET();
+    local_addr.sin_port = 5060;
+
     /* Start TCP listener on arbitrary port. */
-    status = pjsip_tcp_transport_start(endpt, NULL, 1, &tpfactory);
+    status = pjsip_tcp_transport_start(endpt, (pj_sockaddr *)&local_addr, 1, &tpfactory);
     if (status != PJ_SUCCESS) {
 	app_perror("   Error: unable to start TCP transport", status);
 	return -10;
     }
 
     /* Get the listener address */
-    status = pj_sockaddr_init(pj_AF_INET6(), &rem_addr, &tpfactory->addr_name.host,
+    status = pj_sockaddr_init(pj_AF_INET(), &rem_addr, &tpfactory->addr_name.host,
 				 (pj_uint16_t)tpfactory->addr_name.port);
     if (status != PJ_SUCCESS) {
 	app_perror("   Error: possibly invalid TCP address name", status);
@@ -60,7 +65,7 @@ int transport_tcp_test(void)
             pj_sockaddr_print(&rem_addr, rem_addr_str, sizeof(rem_addr_str), 1 | 2));
 
     /* Acquire one TCP transport. */
-    status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_TCP6, 
+    status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_TCP, 
 					   &rem_addr, pj_sockaddr_get_len(&rem_addr),
 					   NULL, &tcp);
     if (status != PJ_SUCCESS || tcp == NULL) {
diff --git a/pjsip/src/test/transport_tcp_test.c b/pjsip/src/test/transport_tcp_test_v6.c
similarity index 97%
copy from pjsip/src/test/transport_tcp_test.c
copy to pjsip/src/test/transport_tcp_test_v6.c
index 2a814bb..232fcc8 100644
--- a/pjsip/src/test/transport_tcp_test.c
+++ b/pjsip/src/test/transport_tcp_test_v6.c
@@ -22,14 +22,14 @@
 #include <pjsip.h>
 #include <pjlib.h>
 
-#define THIS_FILE   "transport_tcp_test.c"
+#define THIS_FILE   "transport_tcp_test_v6.c"
 
 
 /*
  * TCP transport test.
  */
 #if PJ_HAS_TCP
-int transport_tcp_test(void)
+int transport_tcp_test_v6(void)
 {
     enum { SEND_RECV_LOOP = 8 };
     pjsip_tpfactory *tpfactory;
@@ -146,7 +146,7 @@ int transport_tcp_test(void)
     return 0;
 }
 #else	/* PJ_HAS_TCP */
-int transport_tcp_test(void)
+int transport_tcp_test_v6(void)
 {
     return 0;
 }

-----------------------------------------------------------------------


-- 
asterisk-scf/release/pjproject.git



More information about the asterisk-scf-commits mailing list