summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libxrdp/libxrdp.c141
-rw-r--r--libxrdp/xrdp_caps.c80
-rw-r--r--libxrdp/xrdp_orders.c2
-rw-r--r--xrdp/xrdp.ini4
4 files changed, 167 insertions, 60 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index 6a4c17d3..971c7142 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -21,6 +21,12 @@
#include "libxrdp.h"
#include "xrdp_orders_rail.h"
+#define LOG_LEVEL 1
+#define LLOG(_level, _args) \
+ do { if (_level < LOG_LEVEL) { g_write _args ; } } while (0)
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { g_writeln _args ; } } while (0)
+
/******************************************************************************/
struct xrdp_session *EXPORT_CC
libxrdp_init(tbus id, struct trans *trans)
@@ -306,7 +312,20 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
libxrdp_orders_force_send(session);
make_stream(s);
init_stream(s, 8192);
- xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
+ {
+ LLOGLN(10, ("libxrdp_send_palette: fastpath"));
+ if (xrdp_rdp_init_fastpath((struct xrdp_rdp *)session->rdp, s) != 0)
+ {
+ return 1;
+ }
+ }
+ else {
+ LLOGLN(10, ("libxrdp_send_palette: slowpath"));
+ xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
+ }
+
+ /* TS_UPDATE_PALETTE_DATA */
out_uint16_le(s, RDP_UPDATE_PALETTE);
out_uint16_le(s, 0);
out_uint16_le(s, 256); /* # of colors */
@@ -321,7 +340,19 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
}
s_mark_end(s);
- xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s, RDP_DATA_PDU_UPDATE);
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
+ {
+ if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
+ FASTPATH_UPDATETYPE_PALETTE) != 0)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
+ RDP_DATA_PDU_UPDATE);
+ }
free_stream(s);
/* send the orders palette too */
libxrdp_orders_init(session);
@@ -586,20 +617,45 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
}
make_stream(s);
init_stream(s, 8192);
- xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
- if ((session->client_info->pointer_flags & 1) == 0)
+
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
{
- out_uint16_le(s, RDP_POINTER_COLOR);
- out_uint16_le(s, 0); /* pad */
- data_bytes = 3072;
+ LLOGLN(10, ("libxrdp_send_pointer: fastpath"));
+ if (xrdp_rdp_init_fastpath((struct xrdp_rdp *)session->rdp, s) != 0)
+ {
+ return 1;
+ }
+
+ if ((session->client_info->pointer_flags & 1) == 0)
+ {
+ data_bytes = 3072;
+ }
+ else
+ {
+ data_bytes = ((bpp + 7) / 8) * 32 * 32;
+ out_uint16_le(s, bpp);
+ }
}
else
{
- out_uint16_le(s, RDP_POINTER_POINTER);
- out_uint16_le(s, 0); /* pad */
- out_uint16_le(s, bpp);
- data_bytes = ((bpp + 7) / 8) * 32 * 32;
+ LLOGLN(10, ("libxrdp_send_pointer: slowpath"));
+ xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
+ if ((session->client_info->pointer_flags & 1) == 0)
+ {
+ out_uint16_le(s, RDP_POINTER_COLOR);
+ out_uint16_le(s, 0); /* pad */
+ data_bytes = 3072;
+ }
+ else
+ {
+ out_uint16_le(s, RDP_POINTER_POINTER);
+ out_uint16_le(s, 0); /* pad */
+ out_uint16_le(s, bpp);
+ data_bytes = ((bpp + 7) / 8) * 32 * 32;
+ }
}
+
+
out_uint16_le(s, cache_idx); /* cache_idx */
out_uint16_le(s, x);
out_uint16_le(s, y);
@@ -651,9 +707,32 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
}
out_uint8a(s, mask, 128); /* mask */
+ out_uint8(s, 0); /* pad */
s_mark_end(s);
- xrdp_rdp_send_data((struct xrdp_rdp *)(session->rdp), s,
- RDP_DATA_PDU_POINTER);
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
+ {
+ if ((session->client_info->pointer_flags & 1) == 0)
+ {
+ if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
+ FASTPATH_UPDATETYPE_COLOR) != 0)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
+ FASTPATH_UPDATETYPE_POINTER) != 0)
+ {
+ return 1;
+ }
+ }
+ }
+ else
+ {
+ xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
+ RDP_DATA_PDU_POINTER);
+ }
free_stream(s);
return 0;
}
@@ -667,12 +746,40 @@ libxrdp_set_pointer(struct xrdp_session *session, int cache_idx)
DEBUG(("libxrdp_set_pointer sending cursor index"));
make_stream(s);
init_stream(s, 8192);
- xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
- out_uint16_le(s, RDP_POINTER_CACHED);
- out_uint16_le(s, 0); /* pad */
+
+
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
+ {
+ LLOGLN(10, ("libxrdp_send_pointer: fastpath"));
+ if (xrdp_rdp_init_fastpath((struct xrdp_rdp *)session->rdp, s) != 0)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ LLOGLN(10, ("libxrdp_send_pointer: slowpath"));
+ xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
+ out_uint16_le(s, RDP_POINTER_CACHED);
+ out_uint16_le(s, 0); /* pad */
+ }
+
out_uint16_le(s, cache_idx); /* cache_idx */
s_mark_end(s);
- xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s, RDP_DATA_PDU_POINTER);
+
+ if (session->client_info->use_fast_path & 1) /* fastpath output supported */
+ {
+ if (xrdp_rdp_send_fastpath((struct xrdp_rdp *)session->rdp, s,
+ FASTPATH_UPDATETYPE_CACHED) != 0)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
+ RDP_DATA_PDU_POINTER);
+ }
free_stream(s);
return 0;
}
diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c
index d9e39c71..d82023c8 100644
--- a/libxrdp/xrdp_caps.c
+++ b/libxrdp/xrdp_caps.c
@@ -23,6 +23,46 @@
/*****************************************************************************/
static int APP_CC
+xrdp_caps_send_monitorlayout(struct xrdp_rdp *self)
+{
+ struct stream *s;
+ int i;
+
+ make_stream(s);
+ init_stream(s, 8192);
+
+ if (xrdp_rdp_init_data(self, s) != 0)
+ {
+ free_stream(s);
+ return 1;
+ }
+
+ out_uint32_le(s, self->client_info.monitorCount); /* MonitorCount */
+
+ /* TODO: validate for allowed monitors in terminal server (maybe by config?) */
+ for (i = 0; i < self->client_info.monitorCount; i++)
+ {
+ out_uint32_le(s, self->client_info.minfo[i].left);
+ out_uint32_le(s, self->client_info.minfo[i].top);
+ out_uint32_le(s, self->client_info.minfo[i].right);
+ out_uint32_le(s, self->client_info.minfo[i].bottom);
+ out_uint32_le(s, self->client_info.minfo[i].is_primary);
+ }
+
+ s_mark_end(s);
+
+ if (xrdp_rdp_send_data(self, s, 0x37) != 0)
+ {
+ free_stream(s);
+ return 1;
+ }
+
+ free_stream(s);
+ return 0;
+}
+
+/*****************************************************************************/
+static int APP_CC
xrdp_caps_process_general(struct xrdp_rdp *self, struct stream *s,
int len)
{
@@ -867,43 +907,3 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
free_stream(s);
return 0;
}
-
-/*****************************************************************************/
-int APP_CC
-xrdp_caps_send_monitorlayout(struct xrdp_rdp *self)
-{
- struct stream *s;
- int i;
-
- make_stream(s);
- init_stream(s, 8192);
-
- if (xrdp_rdp_init_data(self, s) != 0)
- {
- free_stream(s);
- return 1;
- }
-
- out_uint32_le(s, self->client_info.monitorCount); /* MonitorCount */
-
- /* TODO: validate for allowed monitors in terminal server (maybe by config?) */
- for (i = 0; i < self->client_info.monitorCount; i++)
- {
- out_uint32_le(s, self->client_info.minfo[i].left);
- out_uint32_le(s, self->client_info.minfo[i].top);
- out_uint32_le(s, self->client_info.minfo[i].right);
- out_uint32_le(s, self->client_info.minfo[i].bottom);
- out_uint32_le(s, self->client_info.minfo[i].is_primary);
- }
-
- s_mark_end(s);
-
- if (xrdp_rdp_send_data(self, s, 0x37) != 0)
- {
- free_stream(s);
- return 1;
- }
-
- free_stream(s);
- return 0;
-}
diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c
index 57e16dad..7ba6cf01 100644
--- a/libxrdp/xrdp_orders.c
+++ b/libxrdp/xrdp_orders.c
@@ -185,7 +185,7 @@ xrdp_orders_force_send(struct xrdp_orders *self)
if (self->rdp_layer->client_info.use_fast_path & 1)
{
if (xrdp_rdp_send_fastpath(self->rdp_layer,
- self->out_s, 0) != 0)
+ self->out_s, FASTPATH_UPDATETYPE_ORDERS) != 0)
{
return 1;
}
diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini
index 079ed7b9..22e7d644 100644
--- a/xrdp/xrdp.ini
+++ b/xrdp/xrdp.ini
@@ -45,12 +45,12 @@ grey=dedede
# You can set the PAM error text in a gateway setup (MAX 256 chars)
#pamerrortxt=change your password according to policy at http://url
-new_cursors=no
+new_cursors=yes
#nego_sec_layer=0
allow_multimon=true
# fastpath - can be set to input / output / both / none
-use_fastpath=input
+use_fastpath=both
#
# configure login screen
#