ExSRTP.Backend behaviour (ExSRTP v0.4.1)
View SourceThe behaviour or SRTP backends.
Summary
Callbacks
Initializes the SRTP backend state based on the given policy.
Protects an RTP packet, returning the protected binary and updated state.
Protects an RTCP compound packet, returning the protected binary and updated state.
Unprotects a protected RTP packet, returning the unprotected packet and updated state.
Unprotects a protected RTCP compound packet, returning the unprotected packets and updated state.
Types
Callbacks
@callback init(ExSRTP.Policy.t()) :: {:ok, state()} | {:error, term()}
Initializes the SRTP backend state based on the given policy.
@callback protect(ExRTP.Packet.t(), state()) :: protect_return()
Protects an RTP packet, returning the protected binary and updated state.
@callback protect_rtcp([ExRTCP.Packet.packet()], state()) :: protect_return()
Protects an RTCP compound packet, returning the protected binary and updated state.
@callback unprotect(binary(), state()) :: {:ok, ExRTP.Packet.t(), state()} | {:error, term()}
Unprotects a protected RTP packet, returning the unprotected packet and updated state.
@callback unprotect_rtcp(binary(), state()) :: {:ok, [ExRTCP.Packet.packet()], state()} | {:error, term()}
Unprotects a protected RTCP compound packet, returning the unprotected packets and updated state.