- Timestamp:
- May 17, 2009 5:57:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/sipit24/pjsip-apps/src/samples/icedemo.c
r2600 r2705 40 40 unsigned comp_cnt; 41 41 pj_str_t ns; 42 pj_bool_t no_host; 42 int max_host; 43 pj_bool_t regular; 43 44 pj_str_t stun_srv; 44 45 pj_str_t turn_srv; … … 307 308 /* -= Start initializing ICE stream transport config =- */ 308 309 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; 311 313 312 314 /* Configure STUN/srflx candidate resolution */ … … 375 377 { 376 378 pj_ice_strans_cb icecb; 379 pj_ice_sess_options opt; 377 380 pj_status_t status; 378 381 … … 399 402 else 400 403 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); 401 415 } 402 416 … … 961 975 */ 962 976 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)) { 964 978 PJ_LOG(1,(THIS_FILE, "Error: invalid component ID")); 965 979 return; … … 1138 1152 puts(" --nameserver, -n IP Configure nameserver to activate DNS SRV"); 1139 1153 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)"); 1141 1156 puts(" --help, -h Display this screen."); 1142 1157 puts(""); … … 1166 1181 { "comp-cnt", 1, 0, 'c'}, 1167 1182 { "nameserver", 1, 0, 'n'}, 1168 { " no-host", 0, 0, 'H'},1183 { "max-host", 1, 0, 'H'}, 1169 1184 { "help", 0, 0, 'h'}, 1170 1185 { "stun-srv", 1, 0, 's'}, … … 1173 1188 { "turn-username", 1, 0, 'u'}, 1174 1189 { "turn-password", 1, 0, 'p'}, 1175 { "turn-fingerprint", 0, 0, 'F'} 1190 { "turn-fingerprint", 0, 0, 'F'}, 1191 { "regular", 0, 0, 'R'} 1176 1192 }; 1177 1193 int c, opt_id; … … 1179 1195 1180 1196 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) { 1183 1200 switch (c) { 1184 1201 case 'c': … … 1193 1210 break; 1194 1211 case 'H': 1195 icedemo.opt. no_host = PJ_TRUE;1212 icedemo.opt.max_host = atoi(pj_optarg); 1196 1213 break; 1197 1214 case 'h': … … 1216 1233 icedemo.opt.turn_fingerprint = PJ_TRUE; 1217 1234 break; 1235 case 'R': 1236 icedemo.opt.regular = PJ_TRUE; 1237 break; 1218 1238 default: 1219 1239 printf("Argument \"%s\" is not valid. Use -h to see help",
Note: See TracChangeset
for help on using the changeset viewer.