TrustCore SDK NanoSSL API reference  version 7.0
SRTP Callbacks

Customizable SRTP callbacks. More...

Variables

sbyte4(* sslSettings::funcPtrSrtpEncodeCallback )(sbyte4 connectionInstance, peerDescr *pChannelDescr, const sbyte *pData, ubyte4 pDataLength, ubyte **encodedData, ubyte4 *encodedLength)
 Apply SRTP profile to an RTP packet. More...
 
sbyte4(* sslSettings::funcPtrSrtpInitCallback )(sbyte4 connectionInstance, peerDescr *pChannelDescr, const SrtpProfileInfo *pProfile, void *keyMaterials, ubyte *mki)
 Initialize SRTP cryptographic context. More...
 

Detailed Description

Variable Documentation

◆ funcPtrSrtpEncodeCallback

sbyte4(* sslSettings::funcPtrSrtpEncodeCallback) (sbyte4 connectionInstance, peerDescr *pChannelDescr, const sbyte *pData, ubyte4 pDataLength, ubyte **encodedData, ubyte4 *encodedLength)

This callback function is called by the DTLS stack at data send to apply the SRTP profile to an RTP packet. Using this callback is optional; the SRTP stack can take over the data communication using the DTLS-SRTP negotiated security profile.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
4.2
Version
4.2 and later

To enable this callback, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_DTLS_SRTP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_DTLS_CLIENT__
  • __ENABLE_MOCANA_DTLS_SERVER__
Parameters
connectionInstancePointer to the SSL/TLS Client instance.
pChannelDescrPointer peer descriptor.
pDataAt call, the RTP packet. On return, pointer to enlarged SRTP packet.
pDataLengthAt call, number of bytes in RTP packet (pData). On return, pointer to number of bytes in enlarged SRTP packet (pData).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
Be sure that the data pData buffer is large enough to accomodate the added bytes of the SRTP profile.

ssl.h

◆ funcPtrSrtpInitCallback

sbyte4(* sslSettings::funcPtrSrtpInitCallback) (sbyte4 connectionInstance, peerDescr *pChannelDescr, const SrtpProfileInfo *pProfile, void *keyMaterials, ubyte *mki)

This callback function is called at the end of a DTLS handshake to initialize SRTP cryptographic context for given connectionInstance.

Callback registration happens at session creation and initialization by assigning your custom callback function (which can have any name) to this callback pointer.

Since
4.2
Version
4.2 and later

To enable this callback, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_DTLS_SRTP__

Additionally, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_DTLS_CLIENT__
  • __ENABLE_MOCANA_DTLS_SERVER__
Parameters
connectionInstancePointer to the SSL/TLS Client instance.
pChannelDescrPointer peer descriptor.
profileIdProfile Id.
keyMaterialsOpaque value that contains the SRTP key materials. Its components can be retrieved from the key material by using the following macro functions (defined in dtls_srtp.h):
  • clientMasterKey
  • serverMasterKey
  • clientMasterSalt
  • serverMasterSalt
mkiPointer to MKI (master key identifier) value, a variable length value defined with TLS syntax.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

ssl.h