Ignore:
Timestamp:
Mar 28, 2007 3:49:48 PM (17 years ago)
Author:
bennylp
Message:

Updated projects and Makefiles with the new pjnath library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath-test/ice_test.c

    r1108 r1111  
    3838static pj_stun_config stun_cfg; 
    3939 
    40 static void on_ice_complete(pj_ice_st *icest,  
     40static void on_ice_complete(pj_ice_strans *icest,  
    4141                            pj_status_t status) 
    4242{ 
     
    4949 
    5050 
    51 static void on_rx_data(pj_ice_st *icest, unsigned comp_id,  
     51static void on_rx_data(pj_ice_strans *icest, unsigned comp_id,  
    5252                       void *pkt, pj_size_t size, 
    5353                       const pj_sockaddr_t *src_addr, 
     
    9090static int ice_basic_create_destroy_test() 
    9191{ 
    92     pj_ice_st *im; 
    93     pj_ice_st_cb icest_cb; 
     92    pj_ice_strans *im; 
     93    pj_ice_strans_cb icest_cb; 
    9494    pj_status_t status; 
    9595 
     
    100100    icest_cb.on_rx_data = &on_rx_data; 
    101101 
    102     status = pj_ice_st_create(&stun_cfg, "icetest", 2, NULL, &icest_cb, &im); 
     102    status = pj_ice_strans_create(&stun_cfg, "icetest", 2, NULL, &icest_cb, &im); 
    103103    if (status != PJ_SUCCESS) 
    104104        return -10; 
    105105 
    106     pj_ice_st_destroy(im); 
     106    pj_ice_strans_destroy(im); 
    107107 
    108108    return 0; 
     
    110110 
    111111 
    112 static pj_status_t start_ice(pj_ice_st *ist, pj_ice_st *remote) 
     112static pj_status_t start_ice(pj_ice_strans *ist, pj_ice_strans *remote) 
    113113{ 
    114114    unsigned count; 
    115     pj_ice_cand cand[PJ_ICE_MAX_CAND]; 
     115    pj_ice_sess_cand cand[PJ_ICE_MAX_CAND]; 
    116116    pj_status_t status; 
    117117 
    118118    count = PJ_ARRAY_SIZE(cand); 
    119     status = pj_ice_st_enum_cands(remote, &count, cand); 
     119    status = pj_ice_strans_enum_cands(remote, &count, cand); 
    120120    if (status != PJ_SUCCESS) 
    121121        return status; 
    122122 
    123     return pj_ice_st_start_ice(ist, &remote->ice->rx_ufrag, &remote->ice->rx_pass, 
     123    return pj_ice_strans_start_ice(ist, &remote->ice->rx_ufrag, &remote->ice->rx_pass, 
    124124                               count, cand); 
    125125} 
     
    134134}; 
    135135 
    136 static int init_ice_st(pj_ice_st *ice_st, 
     136static int init_ice_st(pj_ice_strans *ice_st, 
    137137                       pj_bool_t add_valid_comp, 
    138138                       unsigned dummy_cnt, 
     
    145145    /* Create components */ 
    146146    for (i=0; i<ice_st->comp_cnt; ++i) { 
    147         status = pj_ice_st_create_comp(ice_st, i+1, PJ_ICE_ST_OPT_DONT_ADD_CAND, NULL); 
     147        status = pj_ice_strans_create_comp(ice_st, i+1, PJ_ICE_ST_OPT_DONT_ADD_CAND, NULL); 
    148148        if (status != PJ_SUCCESS) 
    149149            return -21; 
     
    155155 
    156156        pj_sockaddr_in_init(&addr, pj_cstr(&a, cand[i].addr), (pj_uint16_t)cand[i].port); 
    157         status = pj_ice_st_add_cand(ice_st, cand[i].comp_id, cand[i].type, 
     157        status = pj_ice_strans_add_cand(ice_st, cand[i].comp_id, cand[i].type, 
    158158                                    65535, &addr, PJ_FALSE); 
    159159        if (status != PJ_SUCCESS) 
     
    164164    if (add_valid_comp) { 
    165165        for (i=0; i<ice_st->comp_cnt; ++i) { 
    166             status = pj_ice_st_add_cand(ice_st, i+1, PJ_ICE_CAND_TYPE_HOST, 65535, 
     166            status = pj_ice_strans_add_cand(ice_st, i+1, PJ_ICE_CAND_TYPE_HOST, 65535, 
    167167                                        &ice_st->comp[i]->local_addr.ipv4, PJ_TRUE); 
    168168            if (status != PJ_SUCCESS) 
     
    179179 * local address of selected by agent 2. 
    180180 */ 
    181 static int verify_address(pj_ice_st *agent1, pj_ice_st *agent2, 
     181static int verify_address(pj_ice_strans *agent1, pj_ice_strans *agent2, 
    182182                          unsigned comp_id) 
    183183{ 
    184     pj_ice_cand *rcand, *lcand; 
     184    pj_ice_sess_cand *rcand, *lcand; 
    185185    int lcand_id; 
    186186 
     
    194194 
    195195    /* Get default local candidate of agent 2 */ 
    196     pj_ice_find_default_cand(agent2->ice, comp_id, &lcand_id); 
     196    pj_ice_sess_find_default_cand(agent2->ice, comp_id, &lcand_id); 
    197197    if (lcand_id < 0) 
    198198        return -62; 
     
    232232                            struct dummy_cand acand[]) 
    233233{ 
    234     pj_ice_st *im1, *im2; 
    235     pj_ice_st_cb icest_cb; 
     234    pj_ice_strans *im1, *im2; 
     235    pj_ice_strans_cb icest_cb; 
    236236    struct ice_data *id1, *id2; 
    237237    pj_timestamp t_start, t_end; 
     
    253253 
    254254    /* Create first ICE */ 
    255     status = pj_ice_st_create(&stun_cfg, "offerer", comp_cnt, NULL, &icest_cb, &im1); 
     255    status = pj_ice_strans_create(&stun_cfg, "offerer", comp_cnt, NULL, &icest_cb, &im1); 
    256256    if (status != PJ_SUCCESS) 
    257257        return -20; 
     
    267267 
    268268    /* Create second ICE */ 
    269     status = pj_ice_st_create(&stun_cfg, "answerer", comp_cnt, NULL, &icest_cb, &im2); 
     269    status = pj_ice_strans_create(&stun_cfg, "answerer", comp_cnt, NULL, &icest_cb, &im2); 
    270270    if (status != PJ_SUCCESS) 
    271271        return -25; 
     
    282282 
    283283    /* Init ICE on im1 */ 
    284     status = pj_ice_st_init_ice(im1, PJ_ICE_ROLE_CONTROLLING, NULL, NULL); 
     284    status = pj_ice_strans_init_ice(im1, PJ_ICE_SESS_ROLE_CONTROLLING, NULL, NULL); 
    285285    if (status != PJ_SUCCESS) 
    286286        return -29; 
    287287 
    288288    /* Init ICE on im2 */ 
    289     status = pj_ice_st_init_ice(im2, PJ_ICE_ROLE_CONTROLLED, NULL, NULL); 
     289    status = pj_ice_strans_init_ice(im2, PJ_ICE_SESS_ROLE_CONTROLLED, NULL, NULL); 
    290290    if (status != PJ_SUCCESS) 
    291291        return -29; 
     
    323323        /* Send data. It must be successful! */ 
    324324        data_from_offerer = pj_str("from offerer"); 
    325         status = pj_ice_send_data(im1->ice, 1, data_from_offerer.ptr, data_from_offerer.slen); 
     325        status = pj_ice_sess_send_data(im1->ice, 1, data_from_offerer.ptr, data_from_offerer.slen); 
    326326        if (status != PJ_SUCCESS) 
    327327            return -47; 
    328328 
    329329        data_from_answerer = pj_str("from answerer"); 
    330         status = pj_ice_send_data(im2->ice, 1, data_from_answerer.ptr, data_from_answerer.slen); 
     330        status = pj_ice_sess_send_data(im2->ice, 1, data_from_answerer.ptr, data_from_answerer.slen); 
    331331        if (status != PJ_SUCCESS) 
    332332            return -48; 
     
    429429 
    430430 
    431     pj_ice_st_destroy(im1); 
    432     pj_ice_st_destroy(im2); 
     431    pj_ice_strans_destroy(im1); 
     432    pj_ice_strans_destroy(im2); 
    433433    handle_events(100); 
    434434    return 0; 
Note: See TracChangeset for help on using the changeset viewer.