Index: pjproject/trunk/pjsip/src/test/tsx_uas_test.c
===================================================================
--- pjproject/trunk/pjsip/src/test/tsx_uas_test.c	(revision 4420)
+++ pjproject/trunk/pjsip/src/test/tsx_uas_test.c	(revision 4728)
@@ -1,4 +1,4 @@
 /* $Id$ */
-/* 
+/*
  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -16,5 +16,5 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -31,5 +31,5 @@
  **
  ** This file performs various tests for UAC transactions. Each test will have
- ** a different Via branch param so that message receiver module and 
+ ** a different Via branch param so that message receiver module and
  ** transaction user module can identify which test is being carried out.
  **
@@ -48,5 +48,5 @@
  **
  ** TEST4_BRANCH_ID
- **	Transaction retransmits last response (if any) without notifying 
+ **	Transaction retransmits last response (if any) without notifying
  **	transaction user upon receiving request  retransmissions on TRYING
  **	state
@@ -67,5 +67,5 @@
  ** TEST9_BRANCH_ID
  **	INVITE transaction MUST cease retransmission of final response when
- **	ACK is received. (Note: PJSIP also retransmit 2xx final response 
+ **	ACK is received. (Note: PJSIP also retransmit 2xx final response
  **	until it's terminated by user).
  **     Transaction also MUST terminate in T4 seconds.
@@ -117,5 +117,5 @@
 #define TEST4_REQUEST_COUNT	2
 #define TEST5_PROVISIONAL_CODE	100
-#define TEST5_STATUS_CODE	200	
+#define TEST5_STATUS_CODE	200
 #define TEST5_REQUEST_COUNT	2
 #define TEST5_RESPONSE_COUNT	2
@@ -147,5 +147,5 @@
 
 /* UAC transaction user module. */
-static pjsip_module tsx_user = 
+static pjsip_module tsx_user =
 {
     NULL, NULL,				/* prev and next	*/
@@ -165,5 +165,5 @@
 
 /* Module to send request. */
-static pjsip_module msg_sender = 
+static pjsip_module msg_sender =
 {
     NULL, NULL,				/* prev and next	*/
@@ -242,5 +242,5 @@
     pjsip_tx_data *tdata;
 
-    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL, 
+    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,
 					  &tdata);
     if (status != PJ_SUCCESS) {
@@ -272,5 +272,5 @@
     pj_time_val delay;
 
-    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL, 
+    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,
 					  &tdata);
     if (status != PJ_SUCCESS) {
@@ -354,5 +354,5 @@
 {
     if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0 ||
-	pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) 
+	pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0)
     {
 	/*
@@ -375,5 +375,5 @@
 		test_complete = -100;
 	    }
-	    
+
 	    /* Previous state must be completed. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
@@ -406,5 +406,5 @@
 		test_complete = -110;
 	    }
-	    
+
 	    /* Previous state must be completed. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
@@ -466,5 +466,5 @@
 	    /* Check that status code is status_code. */
 	    if (tsx->status_code != TEST4_STATUS_CODE) {
-		PJ_LOG(3,(THIS_FILE, 
+		PJ_LOG(3,(THIS_FILE,
 			  "    error: incorrect status code %d "
 			  "(expecting %d)", tsx->status_code,
@@ -472,5 +472,5 @@
 		test_complete = -120;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) {
@@ -479,5 +479,5 @@
 	    }
 
-	} else if (tsx->state != PJSIP_TSX_STATE_DESTROYED) 
+	} else if (tsx->state != PJSIP_TSX_STATE_DESTROYED)
 	{
 	    PJ_LOG(3,(THIS_FILE, "    error: unexpected state %s (122)",
@@ -503,5 +503,5 @@
 		test_complete = -130;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) {
@@ -538,9 +538,9 @@
 	    if (tsx->status_code != TEST6_STATUS_CODE) {
 		PJ_LOG(3,(THIS_FILE, "    error: incorrect status code %d "
-			  "(expecting %d)", tsx->status_code, 
+			  "(expecting %d)", tsx->status_code,
 			  TEST6_STATUS_CODE));
 		test_complete = -140;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
@@ -551,5 +551,5 @@
 	} else if (tsx->state != PJSIP_TSX_STATE_PROCEEDING &&
 		   tsx->state != PJSIP_TSX_STATE_COMPLETED &&
-		   tsx->state != PJSIP_TSX_STATE_DESTROYED) 
+		   tsx->state != PJSIP_TSX_STATE_DESTROYED)
 	{
 	    PJ_LOG(3,(THIS_FILE, "    error: unexpected state %s (142)",
@@ -562,5 +562,5 @@
     } else
     if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0 ||
-	pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) 
+	pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0)
     {
 	/*
@@ -588,5 +588,5 @@
 		test_complete = -150;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
@@ -606,5 +606,5 @@
 
 		if (tsx->retransmit_count != 10) {
-		    PJ_LOG(3,(THIS_FILE, 
+		    PJ_LOG(3,(THIS_FILE,
 			      "    error: incorrect retransmit count %d "
 			      "(expecting 10)",
@@ -622,5 +622,5 @@
 		test_complete = -152;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) {
@@ -657,5 +657,5 @@
 		test_complete = -160;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_CONFIRMED) {
@@ -671,5 +671,5 @@
 		test_complete = -162;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) {
@@ -686,5 +686,5 @@
 		test_complete = -164;
 	    }
-	    
+
 	    /* Previous state. */
 	    if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
@@ -704,8 +704,8 @@
     if (pj_stricmp2(&tsx->branch, TEST10_BRANCH_ID)==0 ||
 	pj_stricmp2(&tsx->branch, TEST11_BRANCH_ID)==0 ||
-	pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0)  
+	pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0)
     {
 	if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
-	    
+
 	    if (!test_complete)
 		test_complete = 1;
@@ -741,9 +741,9 @@
 
     if (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0 ||
-	pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0) 
+	pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0)
     {
 	/*
-	 * TEST1_BRANCH_ID tests that non-INVITE transaction transmits 2xx 
-	 * final response using correct transport and terminates transaction 
+	 * TEST1_BRANCH_ID tests that non-INVITE transaction transmits 2xx
+	 * final response using correct transport and terminates transaction
 	 * after 32 seconds.
 	 *
@@ -754,6 +754,6 @@
 
 	if (msg->type == PJSIP_REQUEST_MSG) {
-	    /* On received request, create UAS and respond with final 
-	     * response. 
+	    /* On received request, create UAS and respond with final
+	     * response.
 	     */
 	    pjsip_transaction *tsx;
@@ -811,5 +811,5 @@
 
 	    send_response(rdata, tsx, TEST3_PROVISIONAL_CODE);
-	    schedule_send_response(rdata, &tsx->transaction_key, 
+	    schedule_send_response(rdata, &tsx->transaction_key,
 				   TEST3_STATUS_CODE, 2000);
 
@@ -841,5 +841,5 @@
     } else if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0 ||
 	       pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0 ||
-	       pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) 
+	       pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0)
     {
 
@@ -878,5 +878,5 @@
 	} else {
 	    /* Verify the response received. */
-	    
+
 	    PJ_LOG(4,(THIS_FILE, "    received response number %d", recv_count));
 
@@ -893,5 +893,5 @@
 		    test_complete = -133;
 
-		} 
+		}
 		if (recv_count > TEST5_RESPONSE_COUNT) {
 		    PJ_LOG(3,(THIS_FILE, "    error: not expecting response!"));
@@ -929,5 +929,5 @@
 
     } else if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0 ||
-	       pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0) 
+	       pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0)
     {
 
@@ -972,5 +972,5 @@
 
 	    if (recv_count==1) {
-		
+
 		if (rdata->msg_info.msg->line.status.code != code) {
 		    PJ_LOG(3,(THIS_FILE,"    error: invalid status code"));
@@ -988,5 +988,5 @@
 
 		PJ_TIME_VAL_SUB(now, recv_last);
-	    
+
 		msec = now.sec*1000 + now.msec;
 		msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1;
@@ -1017,5 +1017,5 @@
 
 	/*
-	 * TEST9_BRANCH_ID tests that the retransmission of INVITE final 
+	 * TEST9_BRANCH_ID tests that the retransmission of INVITE final
 	 * response should cease when ACK is received. Transaction also MUST
 	 * terminate in T4 seconds.
@@ -1060,5 +1060,5 @@
 
 		PJ_TIME_VAL_SUB(now, recv_last);
-	    
+
 		msec = now.sec*1000 + now.msec;
 		msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1;
@@ -1082,9 +1082,9 @@
 
 		status = pjsip_endpt_create_request_from_hdr(
-			    endpt, &pjsip_ack_method, 
+			    endpt, &pjsip_ack_method,
 			    rdata->msg_info.to->uri,
 			    rdata->msg_info.from,
 			    rdata->msg_info.to,
-			    NULL, 
+			    NULL,
 			    rdata->msg_info.cid,
 			    rdata->msg_info.cseq->cseq,
@@ -1121,5 +1121,5 @@
     } else if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0 ||
 	       pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0 ||
-	       pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0) 
+	       pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0)
     {
 	int test_num, code1, code2;
@@ -1132,4 +1132,6 @@
 	    test_num=12, code1 = 200, code2 = 0;
 
+	PJ_UNUSED_ARG(test_num);
+
 	if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) {
 
@@ -1146,5 +1148,5 @@
 	    pjsip_tsx_recv_msg(tsx, rdata);
 	    save_key(tsx);
-	    
+
 	    schedule_send_response(rdata, &tsx_key, code1, 1000);
 
@@ -1162,9 +1164,9 @@
 }
 
-/* 
- * The generic test framework, used by most of the tests. 
+/*
+ * The generic test framework, used by most of the tests.
  */
-static int perform_test( char *target_uri, char *from_uri, 
-			 char *branch_param, int test_time, 
+static int perform_test( char *target_uri, char *from_uri,
+			 char *branch_param, int test_time,
 			 const pjsip_method *method,
 			 int request_cnt, int request_interval_msec,
@@ -1178,5 +1180,5 @@
     pj_status_t status;
 
-    PJ_LOG(3,(THIS_FILE, 
+    PJ_LOG(3,(THIS_FILE,
 	      "   please standby, this will take at most %d seconds..",
 	      test_time));
@@ -1193,5 +1195,5 @@
     /* Create request. */
     status = pjsip_endpt_create_request( endpt, method, &target,
-					 &from, &target, NULL, NULL, -1, 
+					 &from, &target, NULL, NULL, -1,
 					 NULL, &tdata);
     if (status != PJ_SUCCESS) {
@@ -1369,5 +1371,5 @@
 
     status = perform_test(TARGET_URI, FROM_URI, branch_id, 5,
-			  &pjsip_options_method, 
+			  &pjsip_options_method,
 			  request_cnt, 1000, 1);
     if (status && status != TEST_TIMEOUT_ERROR)
@@ -1423,5 +1425,5 @@
 /*****************************************************************************
  **
- ** TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must 
+ ** TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must
  ** cease when ACK is received
  **
@@ -1464,5 +1466,5 @@
 	char *branch_id;
 	char *title;
-    } tests[] = 
+    } tests[] =
     {
 	{ 0,  10,   TEST10_BRANCH_ID, "test10: failed transport in TRYING state (no delay)" },
@@ -1538,11 +1540,11 @@
     tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)param->type);
 
-    pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s", 
+    pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s",
 		    param->port, param->tp_type);
-    pj_ansi_sprintf(FROM_URI, "sip:alice@127.0.0.1:%d;transport=%s", 
+    pj_ansi_sprintf(FROM_URI, "sip:alice@127.0.0.1:%d;transport=%s",
 		    param->port, param->tp_type);
 
     /* Check if loop transport is configured. */
-    status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_LOOP_DGRAM, 
+    status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_LOOP_DGRAM,
 				      &addr, sizeof(addr), NULL, &loop);
     if (status != PJ_SUCCESS) {
@@ -1562,6 +1564,6 @@
     }
 
-    /* TEST1_BRANCH_ID: Basic 2xx final response. 
-     * TEST2_BRANCH_ID: Basic non-2xx final response. 
+    /* TEST1_BRANCH_ID: Basic 2xx final response.
+     * TEST2_BRANCH_ID: Basic non-2xx final response.
      */
     status = tsx_basic_final_response_test();
@@ -1578,5 +1580,5 @@
      */
     status = tsx_retransmit_last_response_test(TEST4_TITLE,
-					       TEST4_BRANCH_ID, 
+					       TEST4_BRANCH_ID,
 					       TEST4_REQUEST_COUNT,
 					       TEST4_STATUS_CODE);
@@ -1587,5 +1589,5 @@
      */
     status = tsx_retransmit_last_response_test(TEST5_TITLE,
-					       TEST5_BRANCH_ID, 
+					       TEST5_BRANCH_ID,
 					       TEST5_REQUEST_COUNT,
 					       TEST5_STATUS_CODE);
@@ -1600,5 +1602,5 @@
     if ((tp_flag & PJSIP_TRANSPORT_RELIABLE) == 0) {
 	status = tsx_retransmit_last_response_test(TEST6_TITLE,
-						   TEST6_BRANCH_ID, 
+						   TEST6_BRANCH_ID,
 						   TEST6_REQUEST_COUNT,
 						   TEST6_STATUS_CODE);
@@ -1614,5 +1616,5 @@
 	return status;
 
-    /* TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must 
+    /* TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must
      * cease when ACK is received
      * Only applicable for non-reliable transports.
