Changeset 2724 for pjproject/trunk/pjnath/src/pjnath/ice_strans.c
- Timestamp:
- May 29, 2009 1:04:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r2599 r2724 51 51 * specify preference among candidates with the same type. Since 52 52 * we don't have the facility to specify that, we'll just set it 53 * all to zero. 54 */ 55 #define SRFLX_PREF 0 56 #define HOST_PREF 0 57 #define RELAY_PREF 0 53 * all to the same value. 54 */ 55 #if PJNATH_ICE_PRIO_STD 56 # define SRFLX_PREF 65535 57 # define HOST_PREF 65535 58 # define RELAY_PREF 65535 59 #else 60 # define SRFLX_PREF 0 61 # define HOST_PREF 0 62 # define RELAY_PREF 0 63 #endif 64 58 65 59 66 /* The candidate type preference when STUN candidate is used */ 60 67 static pj_uint8_t srflx_pref_table[4] = 61 68 { 69 #if PJNATH_ICE_PRIO_STD 70 100, /**< PJ_ICE_HOST_PREF */ 71 126, /**< PJ_ICE_SRFLX_PREF */ 72 110, /**< PJ_ICE_PRFLX_PREF */ 73 0 /**< PJ_ICE_RELAYED_PREF */ 74 #else 62 75 /* Keep it to 2 bits */ 63 76 1, /**< PJ_ICE_HOST_PREF */ … … 65 78 3, /**< PJ_ICE_PRFLX_PREF */ 66 79 0 /**< PJ_ICE_RELAYED_PREF */ 80 #endif 67 81 }; 68 82 … … 198 212 pj_turn_alloc_param_default(&cfg->turn.alloc_param); 199 213 214 pj_ice_sess_options_default(&cfg->opt); 215 200 216 cfg->af = pj_AF_INET(); 201 217 cfg->stun.port = PJ_STUN_PORT; 202 218 cfg->turn.conn_type = PJ_TURN_TP_UDP; 219 220 cfg->stun.max_host_cands = 64; 203 221 } 204 222 … … 246 264 247 265 /* Create STUN transport if configured */ 248 if (ice_st->cfg.stun.server.slen || !ice_st->cfg.stun.no_host_cands) {266 if (ice_st->cfg.stun.server.slen || ice_st->cfg.stun.max_host_cands) { 249 267 pj_stun_sock_cb stun_sock_cb; 250 268 pj_ice_sess_cand *cand; … … 310 328 } 311 329 312 /* Add local addresses to host candidates, unless no_host_cands313 * flag is set.330 /* Add local addresses to host candidates, unless max_host_cands 331 * is set to zero. 314 332 */ 315 if (ice_st->cfg.stun. no_host_cands == PJ_FALSE) {333 if (ice_st->cfg.stun.max_host_cands) { 316 334 pj_stun_sock_info stun_sock_info; 317 335 unsigned i; … … 322 340 return status; 323 341 324 for (i=0; i<stun_sock_info.alias_cnt; ++i) { 342 for (i=0; i<stun_sock_info.alias_cnt && 343 i<ice_st->cfg.stun.max_host_cands; ++i) 344 { 325 345 char addrinfo[PJ_INET6_ADDRSTRLEN+10]; 326 346 const pj_sockaddr *addr = &stun_sock_info.aliases[i]; … … 648 668 649 669 /* 670 * Get the value of various options of the ICE stream transport. 671 */ 672 PJ_DEF(pj_status_t) pj_ice_strans_get_options( pj_ice_strans *ice_st, 673 pj_ice_sess_options *opt) 674 { 675 PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL); 676 pj_memcpy(opt, &ice_st->cfg.opt, sizeof(*opt)); 677 return PJ_SUCCESS; 678 } 679 680 /* 681 * Specify various options for this ICE stream transport. 682 */ 683 PJ_DEF(pj_status_t) pj_ice_strans_set_options(pj_ice_strans *ice_st, 684 const pj_ice_sess_options *opt) 685 { 686 PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL); 687 pj_memcpy(&ice_st->cfg.opt, opt, sizeof(*opt)); 688 if (ice_st->ice) 689 pj_ice_sess_set_options(ice_st->ice, &ice_st->cfg.opt); 690 return PJ_SUCCESS; 691 } 692 693 /* 650 694 * Create ICE! 651 695 */ … … 682 726 /* Associate user data */ 683 727 ice_st->ice->user_data = (void*)ice_st; 728 729 /* Set options */ 730 pj_ice_sess_set_options(ice_st->ice, &ice_st->cfg.opt); 684 731 685 732 /* If default candidate for components are SRFLX one, upload a custom
Note: See TracChangeset
for help on using the changeset viewer.