libfreerdp-core: add support for RDP4 MPPC compression
This commit is contained in:
parent
c2d8486d8a
commit
88bebd1f15
@ -23,6 +23,20 @@
|
||||
|
||||
#include "bulk.h"
|
||||
|
||||
UINT32 bulk_compression_level(rdpBulk* bulk)
|
||||
{
|
||||
rdpSettings* settings = bulk->context->settings;
|
||||
bulk->CompressionLevel = (settings->CompressionLevel >= 1) ? 1 : 0;
|
||||
return bulk->CompressionLevel;
|
||||
}
|
||||
|
||||
UINT32 bulk_compression_max_size(rdpBulk* bulk)
|
||||
{
|
||||
bulk_compression_level(bulk);
|
||||
bulk->CompressionMaxSize = (bulk->CompressionLevel < 1) ? 8192 : 65536;
|
||||
return bulk->CompressionMaxSize;
|
||||
}
|
||||
|
||||
int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags)
|
||||
{
|
||||
int status = -1;
|
||||
@ -67,6 +81,8 @@ int bulk_compress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstDat
|
||||
*ppDstData = bulk->OutputBuffer;
|
||||
*pDstSize = sizeof(bulk->OutputBuffer);
|
||||
|
||||
bulk_compression_level(bulk);
|
||||
mppc_set_compression_level(bulk->mppcSend, bulk->CompressionLevel);
|
||||
status = mppc_compress(bulk->mppcSend, pSrcData, SrcSize, *ppDstData, pDstSize, pFlags);
|
||||
|
||||
return status;
|
||||
|
@ -32,12 +32,16 @@ struct rdp_bulk
|
||||
{
|
||||
rdpContext* context;
|
||||
UINT32 CompressionLevel;
|
||||
UINT32 CompressionMaxSize;
|
||||
MPPC_CONTEXT* mppcSend;
|
||||
MPPC_CONTEXT* mppcRecv;
|
||||
BYTE OutputBuffer[65536];
|
||||
struct rdp_mppc_dec* mppc_dec;
|
||||
};
|
||||
|
||||
UINT32 bulk_compression_level(rdpBulk* bulk);
|
||||
UINT32 bulk_compression_max_size(rdpBulk* bulk);
|
||||
|
||||
int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags);
|
||||
int bulk_compress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags);
|
||||
|
||||
|
@ -842,13 +842,21 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
||||
UINT32 fpHeaderSize = 6;
|
||||
UINT32 fpUpdatePduHeaderSize;
|
||||
UINT32 fpUpdateHeaderSize;
|
||||
UINT32 CompressionMaxSize;
|
||||
FASTPATH_UPDATE_PDU_HEADER fpUpdatePduHeader = { 0 };
|
||||
FASTPATH_UPDATE_HEADER fpUpdateHeader = { 0 };
|
||||
|
||||
fs = fastpath->fs;
|
||||
settings = rdp->settings;
|
||||
|
||||
maxLength = FASTPATH_MAX_PACKET_SIZE - 20;
|
||||
|
||||
if (settings->CompressionEnabled)
|
||||
{
|
||||
CompressionMaxSize = bulk_compression_max_size(rdp->bulk);
|
||||
maxLength = (maxLength < CompressionMaxSize) ? maxLength : CompressionMaxSize;
|
||||
}
|
||||
|
||||
totalLength = Stream_GetPosition(s);
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user