From 630f735a28eca8c6cd4b64ac7e38abe6634a0698 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 10 Mar 2014 22:54:28 -0700 Subject: [PATCH] libxrdp: send, get, and use multi fragment max caps --- common/xrdp_client_info.h | 2 ++ libxrdp/xrdp_caps.c | 12 ++++++++++++ libxrdp/xrdp_fastpath.c | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h index c17675e4..6536db48 100644 --- a/common/xrdp_client_info.h +++ b/common/xrdp_client_info.h @@ -121,6 +121,8 @@ struct xrdp_client_info int mcs_connection_type; int mcs_early_capability_flags; + int max_fastpath_frag_bytes; + }; #endif diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index b882de56..d9e39c71 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -455,6 +455,10 @@ static int APP_CC xrdp_caps_process_multifragmetupdate(struct xrdp_rdp *self, struct stream *s, int len) { + int MaxRequestSize; + + in_uint32_le(s, MaxRequestSize); + self->client_info.max_fastpath_frag_bytes = MaxRequestSize; return 0; } @@ -821,6 +825,14 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) out_uint16_le(s, 5); out_uint8(s, 0); /* client sets */ + if (self->client_info.use_fast_path & 1) /* fastpath output on */ + { + caps_count++; + out_uint16_le(s, 0x001A); /* 26 CAPSETTYPE_MULTIFRAGMENTUPDATE */ + out_uint16_le(s, 8); + out_uint32_le(s, 3 * 1024 * 1024); /* 3MB */ + } + out_uint8s(s, 4); /* pad */ s_mark_end(s); diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c index 9ba171f0..e9c2b82e 100644 --- a/libxrdp/xrdp_fastpath.c +++ b/libxrdp/xrdp_fastpath.c @@ -101,7 +101,14 @@ xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s) int APP_CC xrdp_fastpath_init(struct xrdp_fastpath *self, struct stream *s) { - init_stream(s, 32 * 1024); + int bytes; + + bytes = self->session->client_info->max_fastpath_frag_bytes; + if (bytes < 32 * 1024) + { + bytes = 32 * 1024; + } + init_stream(s, bytes); return 0; }