pub unsafe extern "C" fn srtp_protect(
ctx: srtp_t,
rtp_hdr: *mut c_void,
len_ptr: *mut c_int,
) -> srtp_err_status_t
Expand description
@brief srtp_protect() is the Secure RTP sender-side packet processing function.
The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP protection to the RTP packet rtp_hdr (which has length *len_ptr) using the SRTP context ctx. If srtp_err_status_ok is returned, then rtp_hdr points to the resulting SRTP packet and *len_ptr is the number of octets in that packet; otherwise, no assumptions should be made about the value of either data elements.
The sequence numbers of the RTP packets presented to this function need not be consecutive, but they @b must be out of order by less than 2^15 = 32,768 packets.
@warning This function assumes that it can write the authentication tag into the location in memory immediately following the RTP packet, and assumes that the RTP packet is aligned on a 32-bit boundary.
@warning This function assumes that it can write SRTP_MAX_TRAILER_LEN into the location in memory immediately following the RTP packet. Callers MUST ensure that this much writable memory is available in the buffer that holds the RTP packet.
@param ctx is the SRTP context to use in processing the packet.
@param rtp_hdr is a pointer to the RTP packet (before the call); after the function returns, it points to the srtp packet.
@param len_ptr is a pointer to the length in octets of the complete RTP packet (header and body) before the function call, and of the complete SRTP packet after the call, if srtp_err_status_ok was returned. Otherwise, the value of the data to which it points is undefined.
@return
- srtp_err_status_ok no problems
- srtp_err_status_replay_fail rtp sequence number was non-increasing
- @e other failure in cryptographic mechanisms