Ignore:
Timestamp:
May 17, 2009 5:57:19 PM (15 years ago)
Author:
bennylp
Message:

Ticket #851: initial code to support regular nomination in ICE:

  • Added option to change nomination strategy in ICE strans and session. Default is still aggressive.
  • Added option to control nomination timer
  • Renamed no_host_cand to max_host_cands in ICE config
  • Updated icedemo
  • Also added timer for controlled agent to wait for nomination from controlling agent
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/sipit24/pjnath/src/pjnath/ice_strans.c

    r2599 r2705  
    159159    pj_ice_strans_cb         cb;        /**< Application callback.      */ 
    160160    pj_lock_t               *init_lock; /**< Initialization mutex.      */ 
     161    pj_ice_sess_options      opt;       /**< ICE session options        */ 
    161162 
    162163    pj_ice_sess             *ice;       /**< ICE session.               */ 
     
    201202    cfg->stun.port = PJ_STUN_PORT; 
    202203    cfg->turn.conn_type = PJ_TURN_TP_UDP; 
     204 
     205    cfg->stun.max_host_cands = 64; 
    203206} 
    204207 
     
    246249 
    247250    /* Create STUN transport if configured */ 
    248     if (ice_st->cfg.stun.server.slen || !ice_st->cfg.stun.no_host_cands) { 
     251    if (ice_st->cfg.stun.server.slen || ice_st->cfg.stun.max_host_cands) { 
    249252        pj_stun_sock_cb stun_sock_cb; 
    250253        pj_ice_sess_cand *cand; 
     
    310313        } 
    311314 
    312         /* Add local addresses to host candidates, unless no_host_cands 
    313          * flag is set. 
     315        /* Add local addresses to host candidates, unless max_host_cands 
     316         * is set to zero. 
    314317         */ 
    315         if (ice_st->cfg.stun.no_host_cands == PJ_FALSE) { 
     318        if (ice_st->cfg.stun.max_host_cands) { 
    316319            pj_stun_sock_info stun_sock_info; 
    317320            unsigned i; 
     
    322325                return status; 
    323326 
    324             for (i=0; i<stun_sock_info.alias_cnt; ++i) { 
     327            for (i=0; i<stun_sock_info.alias_cnt &&  
     328                      i<ice_st->cfg.stun.max_host_cands; ++i)  
     329            { 
    325330                char addrinfo[PJ_INET6_ADDRSTRLEN+10]; 
    326331                const pj_sockaddr *addr = &stun_sock_info.aliases[i]; 
     
    444449    ice_st->obj_name = pool->obj_name; 
    445450    ice_st->user_data = user_data; 
     451 
     452    pj_ice_sess_options_default(&ice_st->opt); 
    446453 
    447454    PJ_LOG(4,(ice_st->obj_name,  
     
    648655 
    649656/* 
     657 * Get the value of various options of the ICE stream transport. 
     658 */ 
     659PJ_DEF(pj_status_t) pj_ice_strans_get_options( pj_ice_strans *ice_st, 
     660                                               pj_ice_sess_options *opt) 
     661{ 
     662    PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL); 
     663    pj_memcpy(opt, &ice_st->opt, sizeof(*opt)); 
     664    return PJ_SUCCESS; 
     665} 
     666 
     667/* 
     668 * Specify various options for this ICE stream transport.  
     669 */ 
     670PJ_DEF(pj_status_t) pj_ice_strans_set_options(pj_ice_strans *ice_st, 
     671                                              const pj_ice_sess_options *opt) 
     672{ 
     673    PJ_ASSERT_RETURN(ice_st && opt, PJ_EINVAL); 
     674    pj_memcpy(&ice_st->opt, opt, sizeof(*opt)); 
     675    if (ice_st->ice) 
     676        pj_ice_sess_set_options(ice_st->ice, &ice_st->opt); 
     677    return PJ_SUCCESS; 
     678} 
     679 
     680/* 
    650681 * Create ICE! 
    651682 */ 
     
    682713    /* Associate user data */ 
    683714    ice_st->ice->user_data = (void*)ice_st; 
     715 
     716    /* Set options */ 
     717    pj_ice_sess_set_options(ice_st->ice, &ice_st->opt); 
    684718 
    685719    /* If default candidate for components are SRFLX one, upload a custom 
Note: See TracChangeset for help on using the changeset viewer.