Changeset 3942 for pjproject/branches/1.x/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Jan 16, 2012 5:05:47 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip-apps/src/pjsua/pjsua_app.c
r3830 r3942 252 252 puts (" --stun-srv=FORMAT Set STUN server host or domain. This option may be"); 253 253 puts (" specified more than once. FORMAT is hostdom[:PORT]"); 254 255 #if defined(PJSIP_HAS_TLS_TRANSPORT) && (PJSIP_HAS_TLS_TRANSPORT != 0) 254 256 puts (""); 255 257 puts ("TLS Options:"); … … 263 265 puts (" --tls-neg-timeout Specify TLS negotiation timeout (default=no)"); 264 266 puts (" --tls-srv-name Specify TLS server name for multihosting server"); 267 puts (" --tls-cipher Specify prefered TLS cipher (optional)."); 268 puts (" May be specified multiple times"); 269 #endif 265 270 266 271 puts (""); … … 530 535 OPT_USE_TLS, OPT_TLS_CA_FILE, OPT_TLS_CERT_FILE, OPT_TLS_PRIV_FILE, 531 536 OPT_TLS_PASSWORD, OPT_TLS_VERIFY_SERVER, OPT_TLS_VERIFY_CLIENT, 532 OPT_TLS_NEG_TIMEOUT, OPT_TLS_SRV_NAME, 537 OPT_TLS_NEG_TIMEOUT, OPT_TLS_SRV_NAME, OPT_TLS_CIPHER, 533 538 OPT_CAPTURE_DEV, OPT_PLAYBACK_DEV, 534 539 OPT_CAPTURE_LAT, OPT_PLAYBACK_LAT, OPT_NO_TONES, OPT_JB_MAX_SIZE, … … 629 634 { "duration", 1, 0, OPT_DURATION}, 630 635 { "thread-cnt", 1, 0, OPT_THREAD_CNT}, 636 #if defined(PJSIP_HAS_TLS_TRANSPORT) && (PJSIP_HAS_TLS_TRANSPORT != 0) 631 637 { "use-tls", 0, 0, OPT_USE_TLS}, 632 638 { "tls-ca-file",1, 0, OPT_TLS_CA_FILE}, … … 638 644 { "tls-neg-timeout", 1, 0, OPT_TLS_NEG_TIMEOUT}, 639 645 { "tls-srv-name", 1, 0, OPT_TLS_SRV_NAME}, 646 { "tls-cipher", 1, 0, OPT_TLS_CIPHER}, 647 #endif 640 648 { "capture-dev", 1, 0, OPT_CAPTURE_DEV}, 641 649 { "playback-dev", 1, 0, OPT_PLAYBACK_DEV}, … … 1304 1312 break; 1305 1313 1314 #if defined(PJSIP_HAS_TLS_TRANSPORT) && (PJSIP_HAS_TLS_TRANSPORT != 0) 1306 1315 case OPT_USE_TLS: 1307 1316 cfg->use_tls = PJ_TRUE; 1308 #if !defined(PJSIP_HAS_TLS_TRANSPORT) || PJSIP_HAS_TLS_TRANSPORT==01309 PJ_LOG(1,(THIS_FILE, "Error: TLS support is not configured"));1310 return -1;1311 #endif1312 1317 break; 1313 1318 1314 1319 case OPT_TLS_CA_FILE: 1315 1320 cfg->udp_cfg.tls_setting.ca_list_file = pj_str(pj_optarg); 1316 #if !defined(PJSIP_HAS_TLS_TRANSPORT) || PJSIP_HAS_TLS_TRANSPORT==01317 PJ_LOG(1,(THIS_FILE, "Error: TLS support is not configured"));1318 return -1;1319 #endif1320 1321 break; 1321 1322 1322 1323 case OPT_TLS_CERT_FILE: 1323 1324 cfg->udp_cfg.tls_setting.cert_file = pj_str(pj_optarg); 1324 #if !defined(PJSIP_HAS_TLS_TRANSPORT) || PJSIP_HAS_TLS_TRANSPORT==01325 PJ_LOG(1,(THIS_FILE, "Error: TLS support is not configured"));1326 return -1;1327 #endif1328 1325 break; 1329 1326 … … 1334 1331 case OPT_TLS_PASSWORD: 1335 1332 cfg->udp_cfg.tls_setting.password = pj_str(pj_optarg); 1336 #if !defined(PJSIP_HAS_TLS_TRANSPORT) || PJSIP_HAS_TLS_TRANSPORT==01337 PJ_LOG(1,(THIS_FILE, "Error: TLS support is not configured"));1338 return -1;1339 #endif1340 1333 break; 1341 1334 … … 1356 1349 cfg->udp_cfg.tls_setting.server_name = pj_str(pj_optarg); 1357 1350 break; 1351 case OPT_TLS_CIPHER: 1352 { 1353 pj_ssl_cipher cipher; 1354 1355 if (pj_ansi_strnicmp(pj_optarg, "0x", 2) == 0) { 1356 pj_str_t cipher_st = pj_str(pj_optarg + 2); 1357 cipher = pj_strtoul2(&cipher_st, NULL, 16); 1358 } else { 1359 cipher = atoi(pj_optarg); 1360 } 1361 1362 if (pj_ssl_cipher_is_supported(cipher)) { 1363 static pj_ssl_cipher tls_ciphers[128]; 1364 1365 tls_ciphers[cfg->udp_cfg.tls_setting.ciphers_num++] = cipher; 1366 cfg->udp_cfg.tls_setting.ciphers = tls_ciphers; 1367 } else { 1368 pj_ssl_cipher ciphers[128]; 1369 unsigned j, ciphers_cnt; 1370 1371 ciphers_cnt = PJ_ARRAY_SIZE(ciphers); 1372 pj_ssl_cipher_get_availables(ciphers, &ciphers_cnt); 1373 1374 PJ_LOG(1,(THIS_FILE, "Cipher \"%s\" is not supported by " 1375 "TLS/SSL backend.", pj_optarg)); 1376 printf("Available TLS/SSL ciphers (%d):\n", ciphers_cnt); 1377 for (j=0; j<ciphers_cnt; ++j) 1378 printf("- 0x%06X: %s\n", ciphers[j], pj_ssl_cipher_name(ciphers[j])); 1379 return -1; 1380 } 1381 } 1382 break; 1383 #endif /* PJSIP_HAS_TLS_TRANSPORT */ 1358 1384 1359 1385 case OPT_CAPTURE_DEV: … … 1774 1800 } 1775 1801 1802 #if defined(PJSIP_HAS_TLS_TRANSPORT) && (PJSIP_HAS_TLS_TRANSPORT != 0) 1776 1803 /* TLS */ 1777 1804 if (config->use_tls) … … 1821 1848 pj_strcat2(&cfg, line); 1822 1849 } 1850 1851 for (i=0; i<config->udp_cfg.tls_setting.ciphers_num; ++i) { 1852 pj_ansi_sprintf(line, "--tls-cipher 0x%06X # %s\n", 1853 config->udp_cfg.tls_setting.ciphers[i], 1854 pj_ssl_cipher_name(config->udp_cfg.tls_setting.ciphers[i])); 1855 pj_strcat2(&cfg, line); 1856 } 1857 #endif 1823 1858 1824 1859 pj_strcat2(&cfg, "\n#\n# Media settings:\n#\n"); … … 3006 3041 const char *verif_msgs[32]; 3007 3042 unsigned verif_msg_cnt; 3043 3044 /* Dump server TLS cipher */ 3045 PJ_LOG(4,(THIS_FILE, "TLS cipher used: 0x%06X/%s", 3046 ssl_sock_info->cipher, 3047 pj_ssl_cipher_name(ssl_sock_info->cipher) )); 3008 3048 3009 3049 /* Dump server TLS certificate */
Note: See TracChangeset
for help on using the changeset viewer.