Changeset 5746
- Timestamp:
- Feb 26, 2018 7:50:18 AM (7 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/build/pjmedia.vcxproj
r5547 r5746 200 200 <PropertyGroup> 201 201 <PlatformToolset>$(BuildToolset)</PlatformToolset> 202 <CharacterSet Condition="'$(API_Family)'!='WinDesktop'"></CharacterSet> 203 </PropertyGroup> 202 <CharacterSet Condition="'$(API_Family)'!='WinDesktop'"> 203 </CharacterSet> 204 </PropertyGroup> 204 205 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 205 206 <ImportGroup Label="ExtensionSettings"> … … 297 298 <PropertyGroup Label="UserMacros" /> 298 299 <PropertyGroup> 299 <_ProjectFileVersion>14.0.22823.1</_ProjectFileVersion> 300 <_ProjectFileVersion>14.0.22823.1</_ProjectFileVersion> 300 301 </PropertyGroup> 301 302 <!-- Compile and link option definition --> … … 513 514 <ClCompile Include="..\src\pjmedia\transport_loop.c" /> 514 515 <ClCompile Include="..\src\pjmedia\transport_srtp.c" /> 516 <ClCompile Include="..\src\pjmedia\transport_srtp_dtls.c"> 517 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|Win32'">true</ExcludedFromBuild> 518 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 519 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|Win32'">true</ExcludedFromBuild> 520 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> 521 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|Win32'">true</ExcludedFromBuild> 522 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|Win32'">true</ExcludedFromBuild> 523 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|ARM'">true</ExcludedFromBuild> 524 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild> 525 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|ARM'">true</ExcludedFromBuild> 526 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild> 527 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|ARM'">true</ExcludedFromBuild> 528 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|ARM'">true</ExcludedFromBuild> 529 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|x64'">true</ExcludedFromBuild> 530 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> 531 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|x64'">true</ExcludedFromBuild> 532 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> 533 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|x64'">true</ExcludedFromBuild> 534 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|x64'">true</ExcludedFromBuild> 535 </ClCompile> 536 <ClCompile Include="..\src\pjmedia\transport_srtp_sdes.c"> 537 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|Win32'">true</ExcludedFromBuild> 538 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 539 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|Win32'">true</ExcludedFromBuild> 540 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> 541 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|Win32'">true</ExcludedFromBuild> 542 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|Win32'">true</ExcludedFromBuild> 543 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|ARM'">true</ExcludedFromBuild> 544 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild> 545 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|ARM'">true</ExcludedFromBuild> 546 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild> 547 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|ARM'">true</ExcludedFromBuild> 548 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|ARM'">true</ExcludedFromBuild> 549 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|x64'">true</ExcludedFromBuild> 550 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> 551 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Dynamic|x64'">true</ExcludedFromBuild> 552 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> 553 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-Static|x64'">true</ExcludedFromBuild> 554 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Dynamic|x64'">true</ExcludedFromBuild> 555 </ClCompile> 515 556 <ClCompile Include="..\src\pjmedia\transport_udp.c" /> 516 557 <ClCompile Include="..\src\pjmedia\types.c" /> -
pjproject/trunk/pjmedia/build/pjmedia.vcxproj.filters
r5432 r5746 216 216 <Filter>Source Files</Filter> 217 217 </ClCompile> 218 <ClCompile Include="..\src\pjmedia\transport_srtp_dtls.c"> 219 <Filter>Source Files</Filter> 220 </ClCompile> 221 <ClCompile Include="..\src\pjmedia\transport_srtp_sdes.c"> 222 <Filter>Source Files</Filter> 223 </ClCompile> 218 224 </ItemGroup> 219 225 <ItemGroup> -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r5725 r5746 120 120 #endif 121 121 122 /* Maximum number of SRTP keying method */ 123 #define MAX_KEYING 2 124 122 125 static const pj_str_t ID_RTP_AVP = { "RTP/AVP", 7 }; 123 126 static const pj_str_t ID_RTP_SAVP = { "RTP/SAVP", 8 }; … … 284 287 * method, any other keying methods will be stopped and destroyed. 285 288 */ 289 unsigned all_keying_cnt; 290 pjmedia_transport *all_keying[MAX_KEYING]; 291 292 /* Current active SRTP keying methods. */ 286 293 unsigned keying_cnt; 287 pjmedia_transport *keying[ 2];294 pjmedia_transport *keying[MAX_KEYING]; 288 295 289 296 /* If not zero, keying nego is ongoing (async-ly, e.g: by DTLS-SRTP). … … 718 725 719 726 /* Initialize SRTP keying method. */ 720 for (i = 0; i < srtp->setting.keying_count ; ++i) {727 for (i = 0; i < srtp->setting.keying_count && i < MAX_KEYING; ++i) { 721 728 switch(srtp->setting.keying[i]) { 722 729 723 730 case PJMEDIA_SRTP_KEYING_SDES: 724 731 #if defined(PJMEDIA_SRTP_HAS_SDES) && (PJMEDIA_SRTP_HAS_SDES != 0) 725 sdes_create(srtp, &srtp-> keying[srtp->keying_cnt++]);732 sdes_create(srtp, &srtp->all_keying[srtp->all_keying_cnt++]); 726 733 #endif 727 734 break; … … 729 736 case PJMEDIA_SRTP_KEYING_DTLS_SRTP: 730 737 #if defined(PJMEDIA_SRTP_HAS_DTLS) && (PJMEDIA_SRTP_HAS_DTLS != 0) 731 dtls_create(srtp, &srtp-> keying[srtp->keying_cnt++]);738 dtls_create(srtp, &srtp->all_keying[srtp->all_keying_cnt++]); 732 739 #endif 733 740 break; … … 1039 1046 sizeof(srtp_info)); 1040 1047 1041 /* Invoke get_info() of all keying methods*/1048 /* Invoke get_info() from any active keying method */ 1042 1049 for (i=0; i < srtp->keying_cnt; i++) 1043 1050 pjmedia_transport_get_info(srtp->keying[i], info); … … 1372 1379 struct transport_srtp *srtp = (struct transport_srtp*) tp; 1373 1380 unsigned member_tp_option; 1374 pj_status_t last_err_st = PJ_EBUG;1381 pj_status_t keying_status = PJ_SUCCESS; 1375 1382 pj_status_t status; 1376 1383 unsigned i; … … 1384 1391 srtp->offerer_side = (sdp_remote == NULL); 1385 1392 1386 if (srtp->offerer_side && srtp->setting.use == PJMEDIA_SRTP_DISABLED) 1393 if (srtp->offerer_side && srtp->setting.use == PJMEDIA_SRTP_DISABLED) { 1387 1394 srtp->bypass_srtp = PJ_TRUE; 1388 else 1395 srtp->keying_cnt = 0; 1396 } else { 1397 srtp->bypass_srtp = PJ_FALSE; 1398 srtp->keying_cnt = srtp->all_keying_cnt; 1399 for (i = 0; i < srtp->all_keying_cnt; ++i) 1400 srtp->keying[i] = srtp->all_keying[i]; 1401 1389 1402 member_tp_option |= PJMEDIA_TPMED_NO_TRANSPORT_CHECKING; 1403 } 1390 1404 1391 1405 status = pjmedia_transport_media_create(srtp->member_tp, sdp_pool, 1392 1406 member_tp_option, sdp_remote, 1393 1407 media_index); 1394 if (status != PJ_SUCCESS || srtp->bypass_srtp)1408 if (status != PJ_SUCCESS) 1395 1409 return status; 1396 1410 … … 1406 1420 srtp->keying_cnt, i); 1407 1421 srtp->keying_cnt--; 1408 last_err_st= st;1422 keying_status = st; 1409 1423 continue; 1410 1424 } else if (srtp->offerer_side) { … … 1420 1434 /* All keying method failed to process remote SDP? */ 1421 1435 if (srtp->keying_cnt == 0) 1422 return last_err_st;1436 return keying_status; 1423 1437 1424 1438 return PJ_SUCCESS; … … 1432 1446 { 1433 1447 struct transport_srtp *srtp = (struct transport_srtp*) tp; 1434 pj_status_t last_err_st = PJ_EBUG;1448 pj_status_t keying_status = PJ_SUCCESS; 1435 1449 pj_status_t status; 1436 1450 unsigned i; … … 1445 1459 status = pjmedia_transport_encode_sdp(srtp->member_tp, sdp_pool, 1446 1460 sdp_local, sdp_remote, media_index); 1447 if (status != PJ_SUCCESS || srtp->bypass_srtp)1461 if (status != PJ_SUCCESS) 1448 1462 return status; 1449 1463 … … 1459 1473 srtp->keying_cnt, i); 1460 1474 srtp->keying_cnt--; 1461 last_err_st= st;1475 keying_status = st; 1462 1476 continue; 1463 1477 } … … 1483 1497 /* All keying method failed to process remote SDP? */ 1484 1498 if (srtp->keying_cnt == 0) 1485 return last_err_st;1499 return keying_status; 1486 1500 1487 1501 return PJ_SUCCESS; … … 1496 1510 { 1497 1511 struct transport_srtp *srtp = (struct transport_srtp*) tp; 1498 pj_status_t last_err_st = PJ_EBUG;1512 pj_status_t keying_status = PJ_SUCCESS; 1499 1513 pj_status_t status; 1500 1514 unsigned i; … … 1505 1519 sdp_local, sdp_remote, 1506 1520 media_index); 1507 if (status != PJ_SUCCESS || srtp->bypass_srtp)1521 if (status != PJ_SUCCESS) 1508 1522 return status; 1509 1523 … … 1518 1532 srtp->keying_cnt, i); 1519 1533 srtp->keying_cnt--; 1520 last_err_st= status;1534 keying_status = status; 1521 1535 continue; 1522 1536 } … … 1542 1556 /* All keying method failed to process remote SDP? */ 1543 1557 if (srtp->keying_cnt == 0) 1544 return last_err_st;1558 return keying_status; 1545 1559 1546 1560 /* If SRTP key is being negotiated, just return now. … … 1624 1638 1625 1639 #endif 1626 1627 -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp_dtls.c
r5635 r5746 375 375 unsigned i; 376 376 int mode, rc; 377 377 378 /* Check if it is already instantiated */ 379 if (ds->ossl_ssl) 380 return PJ_SUCCESS; 381 378 382 /* Create DTLS context */ 379 383 ctx = SSL_CTX_new(DTLS_method()); … … 685 689 pj_status_t status; 686 690 int err; 691 692 /* Init DTLS (if not yet) */ 693 status = ssl_create(ds); 694 if (status != PJ_SUCCESS) 695 return status; 687 696 688 697 /* Check if handshake has been initiated or even completed */ … … 1014 1023 } 1015 1024 1016 /* Init DTLS */1017 if (!ds->ossl_ssl) {1018 status = ssl_create(ds);1019 if (status != PJ_SUCCESS)1020 goto on_return;1021 }1022 1023 1025 /* Set remote cert fingerprint verification status to PJ_EPENDING */ 1024 1026 ds->rem_fprint_status = PJ_EPENDING; … … 1100 1102 ds->nego_started = PJ_FALSE; 1101 1103 ds->got_keys = PJ_FALSE; 1102 1103 status = ssl_create(ds); 1104 if (status != PJ_SUCCESS) 1105 goto on_return; 1106 } 1107 } 1108 1109 /* Set media transport to UDP/TLS/RTP/SAVP */ 1110 m_loc->desc.transport = ID_TP_DTLS_SRTP; 1104 ds->rem_fprint_status = PJ_EPENDING; 1105 } 1106 } 1107 1108 /* Set media transport to UDP/TLS/RTP/SAVP if we are the offerer, 1109 * otherwise just match it to the offer (currently we only accept 1110 * UDP/TLS/RTP/SAVP in remote offer though). 1111 */ 1112 if (ds->srtp->offerer_side) { 1113 m_loc->desc.transport = ID_TP_DTLS_SRTP; 1114 } else { 1115 m_loc->desc.transport = 1116 sdp_remote->media[media_index]->desc.transport; 1117 } 1111 1118 1112 1119 /* Add a=fingerprint attribute, fingerprint of our TLS certificate */ … … 1170 1177 use_ice = ice_info && ice_info->comp_cnt; 1171 1178 if (!use_ice) { 1179 /* Start SSL nego */ 1172 1180 status = ssl_handshake(ds); 1173 1181 if (status != PJ_SUCCESS) … … 1223 1231 ds->nego_started = PJ_FALSE; 1224 1232 ds->got_keys = PJ_FALSE; 1225 1226 status = ssl_create(ds); 1227 if (status != PJ_SUCCESS) 1228 goto on_return; 1233 ds->rem_fprint_status = PJ_EPENDING; 1229 1234 } 1230 1235 } else { … … 1387 1392 1388 1393 /* Find DTLS keying and destroy any other keying. */ 1389 for (j = 0; j < srtp-> keying_cnt; ++j) {1390 if (srtp-> keying[j]->op == &dtls_op)1391 ds = (dtls_srtp*)srtp-> keying[j];1394 for (j = 0; j < srtp->all_keying_cnt; ++j) { 1395 if (srtp->all_keying[j]->op == &dtls_op) 1396 ds = (dtls_srtp*)srtp->all_keying[j]; 1392 1397 else 1393 pjmedia_transport_close(srtp-> keying[j]);1398 pjmedia_transport_close(srtp->all_keying[j]); 1394 1399 } 1395 1400 … … 1401 1406 srtp->keying_cnt = 1; 1402 1407 srtp->keying[0] = &ds->base; 1403 srtp->keying_pending_cnt = 1;1408 srtp->keying_pending_cnt = 0; 1404 1409 1405 1410 /* Apply param to DTLS-SRTP internal states */ … … 1413 1418 ds->pending_start = PJ_TRUE; 1414 1419 srtp->keying_pending_cnt++; 1415 1416 /* Create SSL */1417 status = ssl_create(ds);1418 if (status != PJ_SUCCESS)1419 goto on_return;1420 1420 1421 1421 /* Attach member transport, so we can send/receive DTLS init packets */ -
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp_sdes.c
r5725 r5746 280 280 /* Validations */ 281 281 if (srtp->offerer_side) { 282 if (srtp->setting.use == PJMEDIA_SRTP_DISABLED) 283 srtp->bypass_srtp = PJ_TRUE; 282 /* As offerer: do nothing. */ 284 283 } else { 285 284 pjmedia_sdp_media *m_rem = sdp_remote->media[media_index]; -
pjproject/trunk/pjmedia/src/pjmedia/vid_stream_info.c
r5436 r5746 243 243 si->proto = PJMEDIA_TP_PROTO_RTP_AVP; 244 244 245 } else if (pj_stri cmp(&local_m->desc.transport, &ID_RTP_SAVP) == 0) {245 } else if (pj_stristr(&local_m->desc.transport, &ID_RTP_SAVP)) { 246 246 247 247 si->proto = PJMEDIA_TP_PROTO_RTP_SAVP; -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r5677 r5746 1011 1011 } 1012 1012 1013 /* 1014 * This callback is called when media transport SRTP needs to be created. 1015 */ 1016 static void on_create_media_transport_srtp(pjsua_call_id call_id, 1017 unsigned media_idx, 1018 pjmedia_srtp_setting *srtp_opt) 1019 { 1020 PJ_UNUSED_ARG(call_id); 1021 PJ_UNUSED_ARG(media_idx); 1022 1023 /* Set SRTP keying to use DTLS over SDES */ 1024 if (app_config.srtp_keying == 1) { 1025 srtp_opt->keying_count = 2; 1026 srtp_opt->keying[0] = PJMEDIA_SRTP_KEYING_DTLS_SRTP; 1027 srtp_opt->keying[1] = PJMEDIA_SRTP_KEYING_SDES; 1028 } 1029 } 1030 1031 1013 1032 #ifdef TRANSPORT_ADAPTER_SAMPLE 1014 1033 /* … … 1344 1363 app_config.cfg.cb.on_snd_dev_operation = &on_snd_dev_operation; 1345 1364 app_config.cfg.cb.on_call_media_event = &on_call_media_event; 1365 app_config.cfg.cb.on_create_media_transport_srtp = 1366 &on_create_media_transport_srtp; 1346 1367 #ifdef TRANSPORT_ADAPTER_SAMPLE 1347 1368 app_config.cfg.cb.on_create_media_transport = &on_create_media_transport; -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_common.h
r4489 r5746 85 85 pjsua_transport_config rtp_cfg; 86 86 pjsip_redirect_op redir_op; 87 int srtp_keying; 87 88 88 89 unsigned acc_cnt; -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c
r5701 r5746 192 192 puts (" --turn-user TURN username"); 193 193 puts (" --turn-passwd TURN password"); 194 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 195 puts (" --srtp-keying SRTP keying method for outgoing SDP offer."); 196 puts (" 0=SDES (default), 1=DTLS"); 197 #endif 194 198 195 199 puts (""); … … 356 360 OPT_USE_ICE, OPT_ICE_REGULAR, OPT_USE_SRTP, OPT_SRTP_SECURE, 357 361 OPT_USE_TURN, OPT_ICE_MAX_HOSTS, OPT_ICE_NO_RTCP, OPT_TURN_SRV, 358 OPT_TURN_TCP, OPT_TURN_USER, OPT_TURN_PASSWD, 362 OPT_TURN_TCP, OPT_TURN_USER, OPT_TURN_PASSWD, OPT_SRTP_KEYING, 359 363 OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 360 364 OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC, … … 453 457 { "use-srtp", 1, 0, OPT_USE_SRTP}, 454 458 { "srtp-secure",1, 0, OPT_SRTP_SECURE}, 459 { "srtp-keying",1, 0, OPT_SRTP_KEYING}, 455 460 #endif 456 461 { "add-codec", 1, 0, OPT_ADD_CODEC}, … … 1042 1047 cur_acc->srtp_secure_signaling = app_config.cfg.srtp_secure_signaling; 1043 1048 break; 1049 case OPT_SRTP_KEYING: 1050 app_config.srtp_keying = my_atoi(pj_optarg); 1051 if (!pj_isdigit(*pj_optarg) || app_config.srtp_keying < 0 || 1052 app_config.srtp_keying > 1) 1053 { 1054 PJ_LOG(1,(THIS_FILE, "Invalid value for --srtp-keying option")); 1055 return -1; 1056 } 1057 break; 1044 1058 #endif 1045 1059 … … 1926 1940 pj_strcat2(&cfg, line); 1927 1941 } 1942 if (app_config.srtp_keying >= 0 && app_config.srtp_keying <= 1) 1943 { 1944 pj_ansi_sprintf(line, "--srtp-keying %d\n", 1945 app_config.srtp_keying); 1946 pj_strcat2(&cfg, line); 1947 } 1928 1948 #endif 1929 1949
Note: See TracChangeset
for help on using the changeset viewer.