MCPcopy Create free account
hub / github.com/cisco/libsrtp / srtcp_test

Function srtcp_test

test/srtp_driver.c:1415–1621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1413}
1414
1415srtp_err_status_t srtcp_test(const srtp_policy_t *policy, int mki_index)
1416{
1417 int i;
1418 srtp_t srtcp_sender;
1419 srtp_t srtcp_rcvr;
1420 srtp_err_status_t status = srtp_err_status_ok;
1421 srtcp_hdr_t *hdr, *hdr2;
1422 uint8_t hdr_enc[64];
1423 uint8_t *pkt_end;
1424 int msg_len_octets, msg_len_enc, msg_len;
1425 int len, len2;
1426 uint32_t tag_length;
1427 uint32_t ssrc;
1428 srtp_policy_t *rcvr_policy;
1429 int use_mki = 0;
1430
1431 if (mki_index >= 0)
1432 use_mki = 1;
1433
1434 err_check(srtp_create(&srtcp_sender, policy));
1435
1436 /* print out policy */
1437 err_check(srtp_session_print_policy(srtcp_sender));
1438
1439 /*
1440 * initialize data buffer, using the ssrc in the policy unless that
1441 * value is a wildcard, in which case we'll just use an arbitrary
1442 * one
1443 */
1444 if (policy->ssrc.type != ssrc_specific) {
1445 ssrc = 0xdecafbad;
1446 } else {
1447 ssrc = policy->ssrc.value;
1448 }
1449 msg_len_octets = 28;
1450 hdr = srtp_create_rtcp_test_packet(msg_len_octets, ssrc, &len);
1451 /* save message len */
1452 msg_len = len;
1453
1454 if (hdr == NULL) {
1455 return srtp_err_status_alloc_fail;
1456 }
1457 hdr2 = srtp_create_rtcp_test_packet(msg_len_octets, ssrc, &len2);
1458 if (hdr2 == NULL) {
1459 free(hdr);
1460 return srtp_err_status_alloc_fail;
1461 }
1462
1463 debug_print(mod_driver, "before protection:\n%s",
1464 srtp_rtcp_packet_to_string(hdr, len));
1465
1466#if PRINT_REFERENCE_PACKET
1467 debug_print(mod_driver, "reference packet before protection:\n%s",
1468 octet_string_hex_string((uint8_t *)hdr, len));
1469#endif
1470 err_check(srtp_test_call_protect_rtcp(srtcp_sender, hdr, &len, mki_index));
1471
1472 debug_print(mod_driver, "after protection:\n%s",

Callers 1

mainFunction · 0.85

Calls 10

err_checkFunction · 0.85
srtp_createFunction · 0.85
octet_string_hex_stringFunction · 0.85
srtp_deallocFunction · 0.85

Tested by

no test coverage detected