From 53df4335eb3c02d07ffe1dc5a714263c49040a80 Mon Sep 17 00:00:00 2001 From: speidy Date: Sat, 15 Mar 2014 16:10:20 +0200 Subject: [PATCH] o added fastpath output, syncronize update pdu o refactor caps a bit --- libxrdp/libxrdp.c | 2 +- libxrdp/xrdp_caps.c | 14 +++++++------- libxrdp/xrdp_rdp.c | 47 +++++++++++++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 971c7142..c00f99d7 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -636,7 +636,7 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx, out_uint16_le(s, bpp); } } - else + else /* slowpath */ { LLOGLN(10, ("libxrdp_send_pointer: slowpath")); xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s); diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index d82023c8..918bf4a0 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -266,8 +266,8 @@ xrdp_caps_process_cache_v3_codec_id(struct xrdp_rdp *self, struct stream *s, /*****************************************************************************/ /* get the number of client cursor cache */ static int APP_CC -xrdp_caps_process_pointercache(struct xrdp_rdp *self, struct stream *s, - int len) +xrdp_caps_process_pointer(struct xrdp_rdp *self, struct stream *s, + int len) { int i; int colorPointerFlag; @@ -275,7 +275,7 @@ xrdp_caps_process_pointercache(struct xrdp_rdp *self, struct stream *s, if (len < 2 + 2 + 2) { - g_writeln("xrdp_caps_process_pointercache: error"); + g_writeln("xrdp_caps_process_pointer: error"); return 1; } no_new_cursor = self->client_info.pointer_flags & 2; @@ -286,7 +286,7 @@ xrdp_caps_process_pointercache(struct xrdp_rdp *self, struct stream *s, self->client_info.pointer_cache_entries = i; if (colorPointerFlag & 1) { - g_writeln("xrdp_caps_process_pointercache: client supports " + g_writeln("xrdp_caps_process_pointer: client supports " "new(color) cursor"); in_uint16_le(s, i); i = MIN(i, 32); @@ -294,12 +294,12 @@ xrdp_caps_process_pointercache(struct xrdp_rdp *self, struct stream *s, } else { - g_writeln("xrdp_caps_process_pointercache: client does not support " + g_writeln("xrdp_caps_process_pointer: client does not support " "new(color) cursor"); } if (no_new_cursor) { - g_writeln("xrdp_caps_process_pointercache: new(color) cursor is " + g_writeln("xrdp_caps_process_pointer: new(color) cursor is " "disabled by config"); self->client_info.pointer_flags = 0; } @@ -567,7 +567,7 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) break; case RDP_CAPSET_POINTER: /* 8 */ DEBUG(("RDP_CAPSET_POINTER")); - xrdp_caps_process_pointercache(self, s, len); + xrdp_caps_process_pointer(self, s, len); break; case RDP_CAPSET_SHARE: /* 9 */ DEBUG(("RDP_CAPSET_SHARE")); diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 8e778520..76834591 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -629,24 +629,47 @@ xrdp_rdp_send_data_update_sync(struct xrdp_rdp *self) init_stream(s, 8192); DEBUG(("in xrdp_rdp_send_data_update_sync")); - if (xrdp_rdp_init_data(self, s) != 0) + if (self->client_info.use_fast_path & 1) /* fastpath output supported */ { - DEBUG(("out xrdp_rdp_send_data_update_sync error")); - free_stream(s); - return 1; + LLOGLN(10, ("xrdp_rdp_send_data_update_sync: fastpath")); + if (xrdp_rdp_init_fastpath(self, s) != 0) + { + return 1; + } + } + else /* slowpath */ + { + if (xrdp_rdp_init_data(self, s) != 0) + { + DEBUG(("out xrdp_rdp_send_data_update_sync error")); + free_stream(s); + return 1; + } + out_uint16_le(s, RDP_UPDATE_SYNCHRONIZE); } - out_uint16_le(s, RDP_UPDATE_SYNCHRONIZE); - out_uint8s(s, 2); + out_uint16_le(s, 0); /* pad */ s_mark_end(s); - if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_UPDATE) != 0) + if (self->client_info.use_fast_path & 1) /* fastpath output supported */ { - DEBUG(("out xrdp_rdp_send_data_update_sync error")); - free_stream(s); - return 1; + if (xrdp_rdp_send_fastpath(self, s, + FASTPATH_UPDATETYPE_SYNCHRONIZE) != 0) + { + return 1; + } + } + else /* slowpath */ + { + if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_UPDATE) != 0) + { + DEBUG(("out xrdp_rdp_send_data_update_sync error")); + free_stream(s); + return 1; + } } + DEBUG(("out xrdp_rdp_send_data_update_sync")); free_stream(s); return 0; @@ -748,8 +771,8 @@ xrdp_rdp_send_synchronise(struct xrdp_rdp *self) return 1; } - out_uint16_le(s, 1); - out_uint16_le(s, 1002); + out_uint16_le(s, 1); /* messageType (2 bytes) */ + out_uint16_le(s, 1002); /* targetUser (2 bytes) */ s_mark_end(s); if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_SYNCHRONISE) != 0)