Ignore:
Timestamp:
Feb 4, 2014 10:13:56 AM (10 years ago)
Author:
bennylp
Message:

Misc (re #1630): Fixing warnings about variable set but not used with recent gcc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/test/tsx_uas_test.c

    r4420 r4728  
    11/* $Id$ */ 
    2 /*  
     2/* 
    33 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 
    44 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 
     
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1919 */ 
    2020 
     
    3131 ** 
    3232 ** This file performs various tests for UAC transactions. Each test will have 
    33  ** a different Via branch param so that message receiver module and  
     33 ** a different Via branch param so that message receiver module and 
    3434 ** transaction user module can identify which test is being carried out. 
    3535 ** 
     
    4848 ** 
    4949 ** TEST4_BRANCH_ID 
    50  **     Transaction retransmits last response (if any) without notifying  
     50 **     Transaction retransmits last response (if any) without notifying 
    5151 **     transaction user upon receiving request  retransmissions on TRYING 
    5252 **     state 
     
    6767 ** TEST9_BRANCH_ID 
    6868 **     INVITE transaction MUST cease retransmission of final response when 
    69  **     ACK is received. (Note: PJSIP also retransmit 2xx final response  
     69 **     ACK is received. (Note: PJSIP also retransmit 2xx final response 
    7070 **     until it's terminated by user). 
    7171 **     Transaction also MUST terminate in T4 seconds. 
     
    117117#define TEST4_REQUEST_COUNT     2 
    118118#define TEST5_PROVISIONAL_CODE  100 
    119 #define TEST5_STATUS_CODE       200      
     119#define TEST5_STATUS_CODE       200 
    120120#define TEST5_REQUEST_COUNT     2 
    121121#define TEST5_RESPONSE_COUNT    2 
     
    147147 
    148148/* UAC transaction user module. */ 
    149 static pjsip_module tsx_user =  
     149static pjsip_module tsx_user = 
    150150{ 
    151151    NULL, NULL,                         /* prev and next        */ 
     
    165165 
    166166/* Module to send request. */ 
    167 static pjsip_module msg_sender =  
     167static pjsip_module msg_sender = 
    168168{ 
    169169    NULL, NULL,                         /* prev and next        */ 
     
    242242    pjsip_tx_data *tdata; 
    243243 
    244     status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,  
     244    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL, 
    245245                                          &tdata); 
    246246    if (status != PJ_SUCCESS) { 
     
    272272    pj_time_val delay; 
    273273 
    274     status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,  
     274    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL, 
    275275                                          &tdata); 
    276276    if (status != PJ_SUCCESS) { 
     
    354354{ 
    355355    if (pj_stricmp2(&tsx->branch, TEST1_BRANCH_ID)==0 || 
    356         pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0)  
     356        pj_stricmp2(&tsx->branch, TEST2_BRANCH_ID)==0) 
    357357    { 
    358358        /* 
     
    375375                test_complete = -100; 
    376376            } 
    377              
     377 
    378378            /* Previous state must be completed. */ 
    379379            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     
    406406                test_complete = -110; 
    407407            } 
    408              
     408 
    409409            /* Previous state must be completed. */ 
    410410            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     
    466466            /* Check that status code is status_code. */ 
    467467            if (tsx->status_code != TEST4_STATUS_CODE) { 
    468                 PJ_LOG(3,(THIS_FILE,  
     468                PJ_LOG(3,(THIS_FILE, 
    469469                          "    error: incorrect status code %d " 
    470470                          "(expecting %d)", tsx->status_code, 
     
    472472                test_complete = -120; 
    473473            } 
    474              
     474 
    475475            /* Previous state. */ 
    476476            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) { 
     
    479479            } 
    480480 
    481         } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED)  
     481        } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED) 
    482482        { 
    483483            PJ_LOG(3,(THIS_FILE, "    error: unexpected state %s (122)", 
     
    503503                test_complete = -130; 
    504504            } 
    505              
     505 
    506506            /* Previous state. */ 
    507507            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) { 
     
    538538            if (tsx->status_code != TEST6_STATUS_CODE) { 
    539539                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code %d " 
    540                           "(expecting %d)", tsx->status_code,  
     540                          "(expecting %d)", tsx->status_code, 
    541541                          TEST6_STATUS_CODE)); 
    542542                test_complete = -140; 
    543543            } 
    544              
     544 
    545545            /* Previous state. */ 
    546546            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     
    551551        } else if (tsx->state != PJSIP_TSX_STATE_PROCEEDING && 
    552552                   tsx->state != PJSIP_TSX_STATE_COMPLETED && 
    553                    tsx->state != PJSIP_TSX_STATE_DESTROYED)  
     553                   tsx->state != PJSIP_TSX_STATE_DESTROYED) 
    554554        { 
    555555            PJ_LOG(3,(THIS_FILE, "    error: unexpected state %s (142)", 
     
    562562    } else 
    563563    if (pj_stricmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || 
    564         pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0)  
     564        pj_stricmp2(&tsx->branch, TEST8_BRANCH_ID)==0) 
    565565    { 
    566566        /* 
     
    588588                test_complete = -150; 
    589589            } 
    590              
     590 
    591591            /* Previous state. */ 
    592592            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     
    606606 
    607607                if (tsx->retransmit_count != 10) { 
    608                     PJ_LOG(3,(THIS_FILE,  
     608                    PJ_LOG(3,(THIS_FILE, 
    609609                              "    error: incorrect retransmit count %d " 
    610610                              "(expecting 10)", 
     
    622622                test_complete = -152; 
    623623            } 
    624              
     624 
    625625            /* Previous state. */ 
    626626            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) { 
     
    657657                test_complete = -160; 
    658658            } 
    659              
     659 
    660660            /* Previous state. */ 
    661661            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_CONFIRMED) { 
     
    671671                test_complete = -162; 
    672672            } 
    673              
     673 
    674674            /* Previous state. */ 
    675675            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) { 
     
    686686                test_complete = -164; 
    687687            } 
    688              
     688 
    689689            /* Previous state. */ 
    690690            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     
    704704    if (pj_stricmp2(&tsx->branch, TEST10_BRANCH_ID)==0 || 
    705705        pj_stricmp2(&tsx->branch, TEST11_BRANCH_ID)==0 || 
    706         pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0)   
     706        pj_stricmp2(&tsx->branch, TEST12_BRANCH_ID)==0) 
    707707    { 
    708708        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
    709              
     709 
    710710            if (!test_complete) 
    711711                test_complete = 1; 
     
    741741 
    742742    if (pj_stricmp2(&branch_param, TEST1_BRANCH_ID) == 0 || 
    743         pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0)  
     743        pj_stricmp2(&branch_param, TEST2_BRANCH_ID) == 0) 
    744744    { 
    745745        /* 
    746          * TEST1_BRANCH_ID tests that non-INVITE transaction transmits 2xx  
    747          * final response using correct transport and terminates transaction  
     746         * TEST1_BRANCH_ID tests that non-INVITE transaction transmits 2xx 
     747         * final response using correct transport and terminates transaction 
    748748         * after 32 seconds. 
    749749         * 
     
    754754 
    755755        if (msg->type == PJSIP_REQUEST_MSG) { 
    756             /* On received request, create UAS and respond with final  
    757              * response.  
     756            /* On received request, create UAS and respond with final 
     757             * response. 
    758758             */ 
    759759            pjsip_transaction *tsx; 
     
    811811 
    812812            send_response(rdata, tsx, TEST3_PROVISIONAL_CODE); 
    813             schedule_send_response(rdata, &tsx->transaction_key,  
     813            schedule_send_response(rdata, &tsx->transaction_key, 
    814814                                   TEST3_STATUS_CODE, 2000); 
    815815 
     
    841841    } else if (pj_stricmp2(&branch_param, TEST4_BRANCH_ID) == 0 || 
    842842               pj_stricmp2(&branch_param, TEST5_BRANCH_ID) == 0 || 
    843                pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0)  
     843               pj_stricmp2(&branch_param, TEST6_BRANCH_ID) == 0) 
    844844    { 
    845845 
     
    878878        } else { 
    879879            /* Verify the response received. */ 
    880              
     880 
    881881            PJ_LOG(4,(THIS_FILE, "    received response number %d", recv_count)); 
    882882 
     
    893893                    test_complete = -133; 
    894894 
    895                 }  
     895                } 
    896896                if (recv_count > TEST5_RESPONSE_COUNT) { 
    897897                    PJ_LOG(3,(THIS_FILE, "    error: not expecting response!")); 
     
    929929 
    930930    } else if (pj_stricmp2(&branch_param, TEST7_BRANCH_ID) == 0 || 
    931                pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0)  
     931               pj_stricmp2(&branch_param, TEST8_BRANCH_ID) == 0) 
    932932    { 
    933933 
     
    972972 
    973973            if (recv_count==1) { 
    974                  
     974 
    975975                if (rdata->msg_info.msg->line.status.code != code) { 
    976976                    PJ_LOG(3,(THIS_FILE,"    error: invalid status code")); 
     
    988988 
    989989                PJ_TIME_VAL_SUB(now, recv_last); 
    990              
     990 
    991991                msec = now.sec*1000 + now.msec; 
    992992                msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1; 
     
    10171017 
    10181018        /* 
    1019          * TEST9_BRANCH_ID tests that the retransmission of INVITE final  
     1019         * TEST9_BRANCH_ID tests that the retransmission of INVITE final 
    10201020         * response should cease when ACK is received. Transaction also MUST 
    10211021         * terminate in T4 seconds. 
     
    10601060 
    10611061                PJ_TIME_VAL_SUB(now, recv_last); 
    1062              
     1062 
    10631063                msec = now.sec*1000 + now.msec; 
    10641064                msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1; 
     
    10821082 
    10831083                status = pjsip_endpt_create_request_from_hdr( 
    1084                             endpt, &pjsip_ack_method,  
     1084                            endpt, &pjsip_ack_method, 
    10851085                            rdata->msg_info.to->uri, 
    10861086                            rdata->msg_info.from, 
    10871087                            rdata->msg_info.to, 
    1088                             NULL,  
     1088                            NULL, 
    10891089                            rdata->msg_info.cid, 
    10901090                            rdata->msg_info.cseq->cseq, 
     
    11211121    } else if (pj_stricmp2(&branch_param, TEST10_BRANCH_ID) == 0 || 
    11221122               pj_stricmp2(&branch_param, TEST11_BRANCH_ID) == 0 || 
    1123                pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0)  
     1123               pj_stricmp2(&branch_param, TEST12_BRANCH_ID) == 0) 
    11241124    { 
    11251125        int test_num, code1, code2; 
     
    11321132            test_num=12, code1 = 200, code2 = 0; 
    11331133 
     1134        PJ_UNUSED_ARG(test_num); 
     1135 
    11341136        if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) { 
    11351137 
     
    11461148            pjsip_tsx_recv_msg(tsx, rdata); 
    11471149            save_key(tsx); 
    1148              
     1150 
    11491151            schedule_send_response(rdata, &tsx_key, code1, 1000); 
    11501152 
     
    11621164} 
    11631165 
    1164 /*  
    1165  * The generic test framework, used by most of the tests.  
     1166/* 
     1167 * The generic test framework, used by most of the tests. 
    11661168 */ 
    1167 static int perform_test( char *target_uri, char *from_uri,  
    1168                          char *branch_param, int test_time,  
     1169static int perform_test( char *target_uri, char *from_uri, 
     1170                         char *branch_param, int test_time, 
    11691171                         const pjsip_method *method, 
    11701172                         int request_cnt, int request_interval_msec, 
     
    11781180    pj_status_t status; 
    11791181 
    1180     PJ_LOG(3,(THIS_FILE,  
     1182    PJ_LOG(3,(THIS_FILE, 
    11811183              "   please standby, this will take at most %d seconds..", 
    11821184              test_time)); 
     
    11931195    /* Create request. */ 
    11941196    status = pjsip_endpt_create_request( endpt, method, &target, 
    1195                                          &from, &target, NULL, NULL, -1,  
     1197                                         &from, &target, NULL, NULL, -1, 
    11961198                                         NULL, &tdata); 
    11971199    if (status != PJ_SUCCESS) { 
     
    13691371 
    13701372    status = perform_test(TARGET_URI, FROM_URI, branch_id, 5, 
    1371                           &pjsip_options_method,  
     1373                          &pjsip_options_method, 
    13721374                          request_cnt, 1000, 1); 
    13731375    if (status && status != TEST_TIMEOUT_ERROR) 
     
    14231425/***************************************************************************** 
    14241426 ** 
    1425  ** TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must  
     1427 ** TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must 
    14261428 ** cease when ACK is received 
    14271429 ** 
     
    14641466        char *branch_id; 
    14651467        char *title; 
    1466     } tests[] =  
     1468    } tests[] = 
    14671469    { 
    14681470        { 0,  10,   TEST10_BRANCH_ID, "test10: failed transport in TRYING state (no delay)" }, 
     
    15381540    tp_flag = pjsip_transport_get_flag_from_type((pjsip_transport_type_e)param->type); 
    15391541 
    1540     pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s",  
     1542    pj_ansi_sprintf(TARGET_URI, "sip:bob@127.0.0.1:%d;transport=%s", 
    15411543                    param->port, param->tp_type); 
    1542     pj_ansi_sprintf(FROM_URI, "sip:alice@127.0.0.1:%d;transport=%s",  
     1544    pj_ansi_sprintf(FROM_URI, "sip:alice@127.0.0.1:%d;transport=%s", 
    15431545                    param->port, param->tp_type); 
    15441546 
    15451547    /* Check if loop transport is configured. */ 
    1546     status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_LOOP_DGRAM,  
     1548    status = pjsip_endpt_acquire_transport(endpt, PJSIP_TRANSPORT_LOOP_DGRAM, 
    15471549                                      &addr, sizeof(addr), NULL, &loop); 
    15481550    if (status != PJ_SUCCESS) { 
     
    15621564    } 
    15631565 
    1564     /* TEST1_BRANCH_ID: Basic 2xx final response.  
    1565      * TEST2_BRANCH_ID: Basic non-2xx final response.  
     1566    /* TEST1_BRANCH_ID: Basic 2xx final response. 
     1567     * TEST2_BRANCH_ID: Basic non-2xx final response. 
    15661568     */ 
    15671569    status = tsx_basic_final_response_test(); 
     
    15781580     */ 
    15791581    status = tsx_retransmit_last_response_test(TEST4_TITLE, 
    1580                                                TEST4_BRANCH_ID,  
     1582                                               TEST4_BRANCH_ID, 
    15811583                                               TEST4_REQUEST_COUNT, 
    15821584                                               TEST4_STATUS_CODE); 
     
    15871589     */ 
    15881590    status = tsx_retransmit_last_response_test(TEST5_TITLE, 
    1589                                                TEST5_BRANCH_ID,  
     1591                                               TEST5_BRANCH_ID, 
    15901592                                               TEST5_REQUEST_COUNT, 
    15911593                                               TEST5_STATUS_CODE); 
     
    16001602    if ((tp_flag & PJSIP_TRANSPORT_RELIABLE) == 0) { 
    16011603        status = tsx_retransmit_last_response_test(TEST6_TITLE, 
    1602                                                    TEST6_BRANCH_ID,  
     1604                                                   TEST6_BRANCH_ID, 
    16031605                                                   TEST6_REQUEST_COUNT, 
    16041606                                                   TEST6_STATUS_CODE); 
     
    16141616        return status; 
    16151617 
    1616     /* TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must  
     1618    /* TEST9_BRANCH_ID: retransmission of non-2xx INVITE final response must 
    16171619     * cease when ACK is received 
    16181620     * Only applicable for non-reliable transports. 
Note: See TracChangeset for help on using the changeset viewer.