Commit 3d643d64 authored by vorton's avatar vorton

Added missing metod to get encrypted size

parent aa442349
......@@ -347,3 +347,33 @@ int dtcpip_snk_close(int session_handle)
return ret_code;
}
unsigned int dtcpip_get_encrypted_sz(unsigned int cleartextSz, unsigned int basePCPPayload)
{
unsigned int nBasePacketPadding = 16 - basePCPPayload % 16;
if (nBasePacketPadding == 16)
{
nBasePacketPadding = 0;
}
unsigned int nBasePacketSz = basePCPPayload + nBasePacketPadding + 14 /* header */;
unsigned int nLeftoverBytes = cleartextSz % basePCPPayload;
unsigned int nNumBasePackets = (cleartextSz - nLeftoverBytes) / basePCPPayload;
unsigned int nLeftoverPadding = 16 - nLeftoverBytes % 16;
if (nLeftoverPadding == 16)
{
nLeftoverPadding = 0;
}
unsigned int nLeftoverPacketSz = nLeftoverBytes + nLeftoverPadding + 14 /* header */;
unsigned int encryptedSz = nNumBasePackets * nBasePacketSz;
if (nLeftoverBytes != 0)
{
encryptedSz += nLeftoverPacketSz;
}
return encryptedSz;
}
......@@ -37,6 +37,8 @@
int dtcpip_cmn_init(const char* storage_path);
void dtcpip_cmn_get_version(char* string, size_t length);
unsigned int dtcpip_get_encrypted_sz(unsigned int cleartextSz, unsigned int basePCPPayload);
int dtcpip_src_init(unsigned short dtcp_port);
int dtcpip_src_open(int* session_handle, int is_audio_only);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment