RDK Documentation (Open Sourced RDK Components)

Description

DTCP manager manages source/sink DTCP-IP sessions and performs encryption/decryption.

DTCP-IP is a specification for copy protection of copyrighted content that is transferred over digital interfaces in home IP networks.

DTCP Manager sub-system performs data encryption and PCP packet decryption with authenticated DTCP-IP sessions.

dtcp_result_t DTCPMgrInitialize (void)
 Initializes the DTCP Manager. More...
 
dtcp_result_t DTCPMgrStartSource (char *ifName, int portNum)
 Starts the DTCP-IP source. More...
 
dtcp_result_t DTCPMgrStopSource (void)
 Stops the DTCP-IP source. More...
 
dtcp_result_t DTCPMgrCreateSourceSession (char *sinkIpAddress, int key_label, int PCPPacketSize, int maxPacketSize, DTCP_SESSION_HANDLE *handle)
 Creates a new DTCP-IP source session. More...
 
dtcp_result_t DTCPMgrCreateSinkSession (char *srcIpAddress, int srcIpPort, BOOLEAN uniqueKey, int maxPacketSize, DTCP_SESSION_HANDLE *handle)
 Creates a new DTCP-IP sink session. More...
 
dtcp_result_t DTCPMgrProcessPacket (DTCP_SESSION_HANDLE session, DTCPIP_Packet *packet)
 Processes a DTCP-IP packet. More...
 
dtcp_result_t DTCPMgrReleasePacket (DTCPIP_Packet *packet)
 Releases a processed DTCP-IP packet. More...
 
dtcp_result_t DTCPMgrDeleteDTCPSession (DTCP_SESSION_HANDLE session)
 Deletes a DTCP-IP session. More...
 
int DTCPMgrGetNumSessions (DTCPDeviceType deviceType)
 Gets the number of active sessions. More...
 
dtcp_result_t DTCPMgrGetSessionInfo (DTCP_SESSION_HANDLE handle, DTCPIP_Session *session)
 Gets session information. More...
 
dtcp_result_t DTCPMgrSetLogLevel (int level)
 Sets log level. More...
 

Function Documentation

◆ DTCPMgrInitialize()

dtcp_result_t DTCPMgrInitialize ( void  )

Initializes the DTCP Manager.

This function initializes the DTCP-IP Manager sub-system. It should be called during platform initialization.

Note
This function can be called multiple times from the multiple contexts. Once it's initialized, it will return DTCP_SUCCESS for all the subsequent calls.
Parameters
None.
Returns
Error code.
Return values
DTCP_SUCCESSDTCP Manager successfully initialized.

Definition at line 31 of file dtcpmgr.cpp.

◆ DTCPMgrStartSource()

dtcp_result_t DTCPMgrStartSource ( char *  ifName,
int  portNum 
)

Starts the DTCP-IP source.

This function start the DTCP-IP source and begins listening for AKE requests on the specified interface and port number.

Note
Calling this function multiple times adds multiple listeners.
Parameters
[in]ifNameInterface name (e.g. "eth0").
[in]portNumTCP/IP port number that the source listens for AKE requests.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully started the DTCP-IP source and/or added a listener.
Example usage
dtcp_result_t result = DTCPMgrStartSource("eth0", 5000);

Definition at line 46 of file dtcpmgr.cpp.

◆ DTCPMgrStopSource()

dtcp_result_t DTCPMgrStopSource ( void  )

Stops the DTCP-IP source.

This function stops the DTCP-IP source and removes all AKE request listeners added with DTCPMgrStartSource().

Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully stopped the DTCP-IP source and removed all listeners.

Definition at line 53 of file dtcpmgr.cpp.

◆ DTCPMgrCreateSourceSession()

dtcp_result_t DTCPMgrCreateSourceSession ( char *  sinkIpAddress,
int  key_label,
int  PCPPacketSize,
int  maxPacketSize,
DTCP_SESSION_HANDLE handle 
)

Creates a new DTCP-IP source session.

This function creates a new authenticated session with a remote DTCP-IP sink.

Parameters
[in]sinkIpAddressIP address of the remote DTCP-IP sink.
[in]key_labelExchange key label, if available from streaming request. If provided, the stream will be encrypted with the session key.
[in]PCPPacketSizeMinimum size of a packet. If the buffer provided in DTCPMgrProcessPacket() is less than PCPPacketSize, then the PCP packet is set to PCPPacketSize and fragmented across multiple DTCPIP_Packets.
This is for reducing PCP space and processing overheads for low latency low bit-rate transfers where each buffer can be very small. PCPPacketSize of 0 would return every buffer as a PCP packet.
i.e. If PCPPacketSize is 64 KB and if the buffer size in DTCPMgrProcessPacket() is 1 KB, the first decrypted buffer would be a PCP packet. And after first packet, decrypted buffer wouldn't have a PCP header until 64 KB.
[in]maxPacketSizeMaximum size of a packet.
If the DataLength provided in DTCPMgrProcessPacket() is more than MaxPacketSize, the DTCP library can reject the process request.
[out]handleThe address of a location to hold the handle for the specified TCP/IP session on return.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully created a DTCP-IP source session.

Definition at line 69 of file dtcpmgr.cpp.

◆ DTCPMgrCreateSinkSession()

dtcp_result_t DTCPMgrCreateSinkSession ( char *  srcIpAddress,
int  srcIpPort,
BOOLEAN  uniqueKey,
int  maxPacketSize,
DTCP_SESSION_HANDLE handle 
)

Creates a new DTCP-IP sink session.

This function creates a new authenticated session with a remote DTCP-IP source.

Parameters
[in]srcIpAddressIP address of the remote DTCP-IP source.
[in]srcIpPortTCP/IP port of the remote DTCP-IP source.
[in]uniqueKeyFlag to request unique exchange keys. (Both server and client should have 'session exchange key' support.)
[in]maxPacketSizeMaximum size of packet. If DataLength provided in DTCPMgrProcessPacket() is more than MaxPacketSize, the DTCP library can reject the process request.
[out]handleThe address of a location to hold the handle for the specified TCP/IP session on return.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully created a DTCP-IP sink session.

Definition at line 87 of file dtcpmgr.cpp.

◆ DTCPMgrProcessPacket()

dtcp_result_t DTCPMgrProcessPacket ( DTCP_SESSION_HANDLE  session,
DTCPIP_Packet packet 
)

Processes a DTCP-IP packet.

This function processes a DTCP-IP packet - encrypts or decrypts buffers, depending on the session type:

  • Source - encrypt the provided buffers and create a DTCP-IP packet.
  • Sink - process the DTCP-IP packet and return decrypted buffers.
Note
All processing is done inside the DTCPIP_Packet data structure.
Parameters
[in]sessionSession handle.
[in,out]packetAddress of the location of the of the processed DTCP-IP packet.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully processed the packet.

Definition at line 106 of file dtcpmgr.cpp.

◆ DTCPMgrReleasePacket()

dtcp_result_t DTCPMgrReleasePacket ( DTCPIP_Packet packet)

Releases a processed DTCP-IP packet.

This function releases the DTCP-IP packet. The processed packet may contain DTCP Manager allocated/owned buffers/memory - this call frees up these resources.

Parameters
[in]packetAddress of the location of the DTCP-IP packet.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully released packet.

Definition at line 115 of file dtcpmgr.cpp.

◆ DTCPMgrDeleteDTCPSession()

dtcp_result_t DTCPMgrDeleteDTCPSession ( DTCP_SESSION_HANDLE  session)

Deletes a DTCP-IP session.

This function stops an active DTCP-IP session.

Parameters
[in]sessionSession handle.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully deleted the session.

Definition at line 121 of file dtcpmgr.cpp.

◆ DTCPMgrGetNumSessions()

int DTCPMgrGetNumSessions ( DTCPDeviceType  deviceType)

Gets the number of active sessions.

This function retrieves the total number of active sessions for the specified device type.

Parameters
[in]deviceTypeDTCP-IP device type (source/sink). DTCP_UNKNOWN returns total number of sessions of all types.
Returns
Number of active sessions.
Example usage
int source_session_count = getNumDTCPSessions(DTCP_SOURCE);

Definition at line 130 of file dtcpmgr.cpp.

◆ DTCPMgrGetSessionInfo()

dtcp_result_t DTCPMgrGetSessionInfo ( DTCP_SESSION_HANDLE  handle,
DTCPIP_Session session 
)

Gets session information.

This function retrieves information related to an active session.

Parameters
[in]handleDTCP-IP session handle.
[out]sessionThe address of a location of the DTCP-IP session structure to fill on return.
Returns
Error code.
Return values
DTCP_SUCCESSSuccessfully returned the session info.

Definition at line 137 of file dtcpmgr.cpp.

◆ DTCPMgrSetLogLevel()

dtcp_result_t DTCPMgrSetLogLevel ( int  level)

Sets log level.

This function sets DTCP Manager's logging verbosity level.

Parameters
[in]levelLogging level.
Returns
Error code.
Return values
DTCP_SUCCESSLogging level was set successfully.

Definition at line 146 of file dtcpmgr.cpp.

dtcp_result_t
dtcp_result_t
DTCP Manager return codes.
Definition: dtcpmgr.h:148
DTCP_SOURCE
@ DTCP_SOURCE
Definition: dtcpmgr.h:178
DTCPMgrStartSource
dtcp_result_t DTCPMgrStartSource(char *ifName, int portNum)
Starts the DTCP-IP source.
Definition: dtcpmgr.cpp:46