Changeset 1111 for pjproject/trunk/pjnath/src/pjnath-test/ice_test.c
- Timestamp:
- Mar 28, 2007 3:49:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath-test/ice_test.c
r1108 r1111 38 38 static pj_stun_config stun_cfg; 39 39 40 static void on_ice_complete(pj_ice_st *icest,40 static void on_ice_complete(pj_ice_strans *icest, 41 41 pj_status_t status) 42 42 { … … 49 49 50 50 51 static void on_rx_data(pj_ice_st *icest, unsigned comp_id,51 static void on_rx_data(pj_ice_strans *icest, unsigned comp_id, 52 52 void *pkt, pj_size_t size, 53 53 const pj_sockaddr_t *src_addr, … … 90 90 static int ice_basic_create_destroy_test() 91 91 { 92 pj_ice_st *im;93 pj_ice_st _cb icest_cb;92 pj_ice_strans *im; 93 pj_ice_strans_cb icest_cb; 94 94 pj_status_t status; 95 95 … … 100 100 icest_cb.on_rx_data = &on_rx_data; 101 101 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); 103 103 if (status != PJ_SUCCESS) 104 104 return -10; 105 105 106 pj_ice_st _destroy(im);106 pj_ice_strans_destroy(im); 107 107 108 108 return 0; … … 110 110 111 111 112 static pj_status_t start_ice(pj_ice_st *ist, pj_ice_st*remote)112 static pj_status_t start_ice(pj_ice_strans *ist, pj_ice_strans *remote) 113 113 { 114 114 unsigned count; 115 pj_ice_ cand cand[PJ_ICE_MAX_CAND];115 pj_ice_sess_cand cand[PJ_ICE_MAX_CAND]; 116 116 pj_status_t status; 117 117 118 118 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); 120 120 if (status != PJ_SUCCESS) 121 121 return status; 122 122 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, 124 124 count, cand); 125 125 } … … 134 134 }; 135 135 136 static int init_ice_st(pj_ice_st *ice_st,136 static int init_ice_st(pj_ice_strans *ice_st, 137 137 pj_bool_t add_valid_comp, 138 138 unsigned dummy_cnt, … … 145 145 /* Create components */ 146 146 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); 148 148 if (status != PJ_SUCCESS) 149 149 return -21; … … 155 155 156 156 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, 158 158 65535, &addr, PJ_FALSE); 159 159 if (status != PJ_SUCCESS) … … 164 164 if (add_valid_comp) { 165 165 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, 167 167 &ice_st->comp[i]->local_addr.ipv4, PJ_TRUE); 168 168 if (status != PJ_SUCCESS) … … 179 179 * local address of selected by agent 2. 180 180 */ 181 static int verify_address(pj_ice_st *agent1, pj_ice_st*agent2,181 static int verify_address(pj_ice_strans *agent1, pj_ice_strans *agent2, 182 182 unsigned comp_id) 183 183 { 184 pj_ice_ cand *rcand, *lcand;184 pj_ice_sess_cand *rcand, *lcand; 185 185 int lcand_id; 186 186 … … 194 194 195 195 /* 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); 197 197 if (lcand_id < 0) 198 198 return -62; … … 232 232 struct dummy_cand acand[]) 233 233 { 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; 236 236 struct ice_data *id1, *id2; 237 237 pj_timestamp t_start, t_end; … … 253 253 254 254 /* 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); 256 256 if (status != PJ_SUCCESS) 257 257 return -20; … … 267 267 268 268 /* 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); 270 270 if (status != PJ_SUCCESS) 271 271 return -25; … … 282 282 283 283 /* 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); 285 285 if (status != PJ_SUCCESS) 286 286 return -29; 287 287 288 288 /* 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); 290 290 if (status != PJ_SUCCESS) 291 291 return -29; … … 323 323 /* Send data. It must be successful! */ 324 324 data_from_offerer = pj_str("from offerer"); 325 status = pj_ice_se nd_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); 326 326 if (status != PJ_SUCCESS) 327 327 return -47; 328 328 329 329 data_from_answerer = pj_str("from answerer"); 330 status = pj_ice_se nd_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); 331 331 if (status != PJ_SUCCESS) 332 332 return -48; … … 429 429 430 430 431 pj_ice_st _destroy(im1);432 pj_ice_st _destroy(im2);431 pj_ice_strans_destroy(im1); 432 pj_ice_strans_destroy(im2); 433 433 handle_events(100); 434 434 return 0;
Note: See TracChangeset
for help on using the changeset viewer.