libxrdp: add our own mppc compression instead of using the freerdp mppc
This commit is contained in:
parent
f91b33ed13
commit
b3dcfdaa37
@ -51,7 +51,8 @@ libxrdp_la_SOURCES = \
|
|||||||
xrdp_tcp.c \
|
xrdp_tcp.c \
|
||||||
xrdp_bitmap_compress.c \
|
xrdp_bitmap_compress.c \
|
||||||
xrdp_jpeg_compress.c \
|
xrdp_jpeg_compress.c \
|
||||||
xrdp_orders_rail.c
|
xrdp_orders_rail.c \
|
||||||
|
xrdp_mppc_enc.c
|
||||||
|
|
||||||
libxrdp_la_LDFLAGS = \
|
libxrdp_la_LDFLAGS = \
|
||||||
$(EXTRA_FLAGS)
|
$(EXTRA_FLAGS)
|
||||||
|
@ -116,7 +116,7 @@ struct xrdp_rdp
|
|||||||
int share_id;
|
int share_id;
|
||||||
int mcs_channel;
|
int mcs_channel;
|
||||||
struct xrdp_client_info client_info;
|
struct xrdp_client_info client_info;
|
||||||
void* mppc_enc;
|
struct xrdp_mppc_enc* mppc_enc;
|
||||||
void* rfx_enc;
|
void* rfx_enc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -213,6 +213,31 @@ struct xrdp_orders
|
|||||||
struct xrdp_orders_state orders_state;
|
struct xrdp_orders_state orders_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PROTO_RDP_40 1
|
||||||
|
#define PROTO_RDP_50 2
|
||||||
|
|
||||||
|
struct xrdp_mppc_enc
|
||||||
|
{
|
||||||
|
int protocol_type; /* PROTO_RDP_40, PROTO_RDP_50 etc */
|
||||||
|
char *historyBuffer; /* contains uncompressed data */
|
||||||
|
char *outputBuffer; /* contains compressed data */
|
||||||
|
char *outputBufferPlus;
|
||||||
|
int historyOffset; /* next free slot in historyBuffer */
|
||||||
|
int buf_len; /* length of historyBuffer, protocol dependant */
|
||||||
|
int bytes_in_opb; /* compressed bytes available in outputBuffer */
|
||||||
|
int flags; /* PACKET_COMPRESSED, PACKET_AT_FRONT, PACKET_FLUSHED etc */
|
||||||
|
int flagsHold;
|
||||||
|
int first_pkt; /* this is the first pkt passing through enc */
|
||||||
|
tui16 *hash_table;
|
||||||
|
};
|
||||||
|
|
||||||
|
int APP_CC
|
||||||
|
compress_rdp(struct xrdp_mppc_enc *enc, tui8 *srcData, int len);
|
||||||
|
struct xrdp_mppc_enc * APP_CC
|
||||||
|
mppc_enc_new(int protocol_type);
|
||||||
|
void APP_CC
|
||||||
|
mppc_enc_free(struct xrdp_mppc_enc *enc);
|
||||||
|
|
||||||
/* xrdp_tcp.c */
|
/* xrdp_tcp.c */
|
||||||
struct xrdp_tcp* APP_CC
|
struct xrdp_tcp* APP_CC
|
||||||
xrdp_tcp_create(struct xrdp_iso* owner, struct trans* trans);
|
xrdp_tcp_create(struct xrdp_iso* owner, struct trans* trans);
|
||||||
|
1047
libxrdp/xrdp_mppc_enc.c
Normal file
1047
libxrdp/xrdp_mppc_enc.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,6 @@
|
|||||||
#include "libxrdp.h"
|
#include "libxrdp.h"
|
||||||
|
|
||||||
#if defined(XRDP_FREERDP1)
|
#if defined(XRDP_FREERDP1)
|
||||||
#include <freerdp/codec/mppc_enc.h>
|
|
||||||
#include <freerdp/codec/rfx.h>
|
#include <freerdp/codec/rfx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -229,8 +228,8 @@ xrdp_rdp_create(struct xrdp_session *session, struct trans *trans)
|
|||||||
/* load client ip info */
|
/* load client ip info */
|
||||||
bytes = sizeof(self->client_info.client_ip) - 1;
|
bytes = sizeof(self->client_info.client_ip) - 1;
|
||||||
g_write_ip_address(trans->sck, self->client_info.client_ip, bytes);
|
g_write_ip_address(trans->sck, self->client_info.client_ip, bytes);
|
||||||
#if defined(XRDP_FREERDP1)
|
|
||||||
self->mppc_enc = mppc_enc_new(PROTO_RDP_50);
|
self->mppc_enc = mppc_enc_new(PROTO_RDP_50);
|
||||||
|
#if defined(XRDP_FREERDP1)
|
||||||
self->rfx_enc = rfx_context_new();
|
self->rfx_enc = rfx_context_new();
|
||||||
rfx_context_set_cpu_opt(self->rfx_enc, xrdp_rdp_detect_cpu());
|
rfx_context_set_cpu_opt(self->rfx_enc, xrdp_rdp_detect_cpu());
|
||||||
#endif
|
#endif
|
||||||
@ -249,8 +248,8 @@ xrdp_rdp_delete(struct xrdp_rdp *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xrdp_sec_delete(self->sec_layer);
|
xrdp_sec_delete(self->sec_layer);
|
||||||
|
mppc_enc_free(self->mppc_enc);
|
||||||
#if defined(XRDP_FREERDP1)
|
#if defined(XRDP_FREERDP1)
|
||||||
mppc_enc_free((struct rdp_mppc_enc *)(self->mppc_enc));
|
|
||||||
rfx_context_free((RFX_CONTEXT *)(self->rfx_enc));
|
rfx_context_free((RFX_CONTEXT *)(self->rfx_enc));
|
||||||
#endif
|
#endif
|
||||||
g_free(self);
|
g_free(self);
|
||||||
@ -403,9 +402,7 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
|
|||||||
int sec_offset;
|
int sec_offset;
|
||||||
int rdp_offset;
|
int rdp_offset;
|
||||||
struct stream ls;
|
struct stream ls;
|
||||||
#if defined(XRDP_FREERDP1)
|
struct xrdp_mppc_enc *mppc_enc;
|
||||||
struct rdp_mppc_enc *mppc_enc;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEBUG(("in xrdp_rdp_send_data"));
|
DEBUG(("in xrdp_rdp_send_data"));
|
||||||
s_pop_layer(s, rdp_hdr);
|
s_pop_layer(s, rdp_hdr);
|
||||||
@ -416,12 +413,10 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
|
|||||||
ctype = 0;
|
ctype = 0;
|
||||||
clen = len;
|
clen = len;
|
||||||
tocomplen = pdulen - 18;
|
tocomplen = pdulen - 18;
|
||||||
#if defined(XRDP_FREERDP1)
|
|
||||||
|
|
||||||
if (self->client_info.rdp_compression && self->session->up_and_running)
|
if (self->client_info.rdp_compression && self->session->up_and_running)
|
||||||
{
|
{
|
||||||
mppc_enc = (struct rdp_mppc_enc *)(self->mppc_enc);
|
mppc_enc = self->mppc_enc;
|
||||||
|
|
||||||
if (compress_rdp(mppc_enc, (tui8 *)(s->p + 18), tocomplen))
|
if (compress_rdp(mppc_enc, (tui8 *)(s->p + 18), tocomplen))
|
||||||
{
|
{
|
||||||
DEBUG(("mppc_encode ok flags 0x%x bytes_in_opb %d historyOffset %d "
|
DEBUG(("mppc_encode ok flags 0x%x bytes_in_opb %d historyOffset %d "
|
||||||
@ -458,7 +453,6 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
out_uint16_le(s, pdulen);
|
out_uint16_le(s, pdulen);
|
||||||
out_uint16_le(s, pdutype);
|
out_uint16_le(s, pdutype);
|
||||||
out_uint16_le(s, self->mcs_channel);
|
out_uint16_le(s, self->mcs_channel);
|
||||||
|
Loading…
Reference in New Issue
Block a user