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/pjsip-apps/src/samples/icedemo.c

    r2600 r2705  
    4040        unsigned    comp_cnt; 
    4141        pj_str_t    ns; 
    42         pj_bool_t   no_host; 
     42        int         max_host; 
     43        pj_bool_t   regular; 
    4344        pj_str_t    stun_srv; 
    4445        pj_str_t    turn_srv; 
     
    307308    /* -= Start initializing ICE stream transport config =- */ 
    308309 
    309     /* Disable host candidates? */ 
    310     icedemo.ice_cfg.stun.no_host_cands = icedemo.opt.no_host; 
     310    /* Maximum number of host candidates */ 
     311    if (icedemo.opt.max_host != -1) 
     312        icedemo.ice_cfg.stun.max_host_cands = icedemo.opt.max_host; 
    311313 
    312314    /* Configure STUN/srflx candidate resolution */ 
     
    375377{ 
    376378    pj_ice_strans_cb icecb; 
     379    pj_ice_sess_options opt; 
    377380    pj_status_t status; 
    378381 
     
    399402    else 
    400403        PJ_LOG(3,(THIS_FILE, "ICE instance successfully created")); 
     404 
     405    status = pj_ice_strans_get_options(icedemo.icest, &opt); 
     406    pj_assert(status == PJ_SUCCESS); 
     407 
     408    if (icedemo.opt.regular) 
     409        opt.aggressive = PJ_FALSE; 
     410    else 
     411        opt.aggressive = PJ_TRUE; 
     412 
     413    status = pj_ice_strans_set_options(icedemo.icest, &opt); 
     414    pj_assert(status == PJ_SUCCESS); 
    401415} 
    402416 
     
    961975    */ 
    962976 
    963     if (comp_id > pj_ice_strans_get_running_comp_cnt(icedemo.icest)) { 
     977    if (comp_id<1||comp_id>pj_ice_strans_get_running_comp_cnt(icedemo.icest)) { 
    964978        PJ_LOG(1,(THIS_FILE, "Error: invalid component ID")); 
    965979        return; 
     
    11381152    puts(" --nameserver, -n IP       Configure nameserver to activate DNS SRV"); 
    11391153    puts("                           resolution"); 
    1140     puts(" --no-host, -H             Disable host candidates"); 
     1154    puts(" --max-host, -H N          Set max number of host candidates to N"); 
     1155    puts(" --regular, -R             Use regular nomination (default aggressive)"); 
    11411156    puts(" --help, -h                Display this screen."); 
    11421157    puts(""); 
     
    11661181        { "comp-cnt",           1, 0, 'c'}, 
    11671182        { "nameserver",         1, 0, 'n'}, 
    1168         { "no-host",            0, 0, 'H'}, 
     1183        { "max-host",           1, 0, 'H'}, 
    11691184        { "help",               0, 0, 'h'}, 
    11701185        { "stun-srv",           1, 0, 's'}, 
     
    11731188        { "turn-username",      1, 0, 'u'}, 
    11741189        { "turn-password",      1, 0, 'p'}, 
    1175         { "turn-fingerprint",   0, 0, 'F'} 
     1190        { "turn-fingerprint",   0, 0, 'F'}, 
     1191        { "regular",            0, 0, 'R'} 
    11761192    }; 
    11771193    int c, opt_id; 
     
    11791195 
    11801196    icedemo.opt.comp_cnt = 1; 
    1181  
    1182     while((c=pj_getopt_long(argc,argv, "n:s:t:u:p:HhTF", long_options, &opt_id))!=-1) { 
     1197    icedemo.opt.max_host = -1; 
     1198 
     1199    while((c=pj_getopt_long(argc,argv, "c:n:s:t:u:p:H:hTFR", long_options, &opt_id))!=-1) { 
    11831200        switch (c) { 
    11841201        case 'c': 
     
    11931210            break; 
    11941211        case 'H': 
    1195             icedemo.opt.no_host = PJ_TRUE; 
     1212            icedemo.opt.max_host = atoi(pj_optarg); 
    11961213            break; 
    11971214        case 'h': 
     
    12161233            icedemo.opt.turn_fingerprint = PJ_TRUE; 
    12171234            break; 
     1235        case 'R': 
     1236            icedemo.opt.regular = PJ_TRUE; 
     1237            break; 
    12181238        default: 
    12191239            printf("Argument \"%s\" is not valid. Use -h to see help", 
Note: See TracChangeset for help on using the changeset viewer.