o libxrdp: fastpath output, added cursor and palette now updates

o xrdp.ini: changed default behavior: always new cursors, always use
fastpath input and output.
ulab-next
speidy 11 years ago
parent 744cdf9da1
commit 8372cce84d

@ -21,6 +21,12 @@
#include "libxrdp.h" #include "libxrdp.h"
#include "xrdp_orders_rail.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 struct xrdp_session *EXPORT_CC
libxrdp_init(tbus id, struct trans *trans) 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); libxrdp_orders_force_send(session);
make_stream(s); make_stream(s);
init_stream(s, 8192); 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, RDP_UPDATE_PALETTE);
out_uint16_le(s, 0); out_uint16_le(s, 0);
out_uint16_le(s, 256); /* # of colors */ out_uint16_le(s, 256); /* # of colors */
@ -321,7 +340,19 @@ libxrdp_send_palette(struct xrdp_session *session, int *palette)
} }
s_mark_end(s); 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); free_stream(s);
/* send the orders palette too */ /* send the orders palette too */
libxrdp_orders_init(session); libxrdp_orders_init(session);
@ -586,20 +617,45 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
} }
make_stream(s); make_stream(s);
init_stream(s, 8192); 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); LLOGLN(10, ("libxrdp_send_pointer: fastpath"));
out_uint16_le(s, 0); /* pad */ if (xrdp_rdp_init_fastpath((struct xrdp_rdp *)session->rdp, s) != 0)
data_bytes = 3072; {
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 else
{ {
out_uint16_le(s, RDP_POINTER_POINTER); LLOGLN(10, ("libxrdp_send_pointer: slowpath"));
out_uint16_le(s, 0); /* pad */ xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
out_uint16_le(s, bpp); if ((session->client_info->pointer_flags & 1) == 0)
data_bytes = ((bpp + 7) / 8) * 32 * 32; {
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, cache_idx); /* cache_idx */
out_uint16_le(s, x); out_uint16_le(s, x);
out_uint16_le(s, y); 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_uint8a(s, mask, 128); /* mask */
out_uint8(s, 0); /* pad */
s_mark_end(s); s_mark_end(s);
xrdp_rdp_send_data((struct xrdp_rdp *)(session->rdp), s, if (session->client_info->use_fast_path & 1) /* fastpath output supported */
RDP_DATA_PDU_POINTER); {
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); free_stream(s);
return 0; return 0;
} }
@ -667,12 +746,40 @@ libxrdp_set_pointer(struct xrdp_session *session, int cache_idx)
DEBUG(("libxrdp_set_pointer sending cursor index")); DEBUG(("libxrdp_set_pointer sending cursor index"));
make_stream(s); make_stream(s);
init_stream(s, 8192); 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 */ out_uint16_le(s, cache_idx); /* cache_idx */
s_mark_end(s); 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); free_stream(s);
return 0; return 0;
} }

@ -21,6 +21,46 @@
#include "libxrdp.h" #include "libxrdp.h"
/*****************************************************************************/
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 static int APP_CC
xrdp_caps_process_general(struct xrdp_rdp *self, struct stream *s, xrdp_caps_process_general(struct xrdp_rdp *self, struct stream *s,
@ -867,43 +907,3 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
free_stream(s); free_stream(s);
return 0; 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;
}

@ -185,7 +185,7 @@ xrdp_orders_force_send(struct xrdp_orders *self)
if (self->rdp_layer->client_info.use_fast_path & 1) if (self->rdp_layer->client_info.use_fast_path & 1)
{ {
if (xrdp_rdp_send_fastpath(self->rdp_layer, if (xrdp_rdp_send_fastpath(self->rdp_layer,
self->out_s, 0) != 0) self->out_s, FASTPATH_UPDATETYPE_ORDERS) != 0)
{ {
return 1; return 1;
} }

@ -45,12 +45,12 @@ grey=dedede
# You can set the PAM error text in a gateway setup (MAX 256 chars) # You can set the PAM error text in a gateway setup (MAX 256 chars)
#pamerrortxt=change your password according to policy at http://url #pamerrortxt=change your password according to policy at http://url
new_cursors=no new_cursors=yes
#nego_sec_layer=0 #nego_sec_layer=0
allow_multimon=true allow_multimon=true
# fastpath - can be set to input / output / both / none # fastpath - can be set to input / output / both / none
use_fastpath=input use_fastpath=both
# #
# configure login screen # configure login screen
# #

Loading…
Cancel
Save