Hello,
I'am developing a basic srtp program wich must recieve specific ip_addr/port srtp trafic. I have started with that code:
srtp_t session;
srtp_policy_t policy;
uint8_t key[30];
// initialize libSRTP
srtp_init();
// set policy to describe a policy for an SRTP stream
//crypto_policy_set_rtp_default(&policy.rtp);
crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp);
crypto_policy_set_rtcp_default(&policy.rtcp);
policy.ssrc.type = ssrc_specific;
policy.ssrc.value = IP_PORT_SOURCE; // i don't know how to specify this
policy.key = key;
policy.next = NULL;
// set key to random value
crypto_get_random(key, 30);
// allocate and initialize the SRTP session
srtp_create(&session, policy);
// main loop: get rtp packets, send srtp packets
while (1) {
char rtp_buffer[2048];
unsigned len;
len = get_rtp_packet(rtp_buffer);
srtp_protect(session, rtp_buffer, &len);
send_srtp_packet(rtp_buffer, len);
}
i don't know how to specify the ip address and port number in the policy.sscr.value . I think something like inet_ntoa + htons colud be possible anywhone can help please, i'am stucked with this ...
thanks in advance!
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'am developing a basic srtp program wich must recieve specific ip_addr/port srtp trafic. I have started with that code:
i don't know how to specify the ip address and port number in the policy.sscr.value . I think something like inet_ntoa + htons colud be possible anywhone can help please, i'am stucked with this ...
thanks in advance!
Daniel