summaryrefslogtreecommitdiffstats
path: root/libxrdp
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2014-03-18 00:07:11 -0700
committerJay Sorg <jay.sorg@gmail.com>2014-03-18 00:07:11 -0700
commit6d7e315b0c0a1e56e135614f1e2e96fa19870975 (patch)
tree536a8fe4fd25d7c6b615c4350d09f0a114cea293 /libxrdp
parent63032b000daeaaeb1eed75abc1c70066c9e02581 (diff)
downloadxrdp-proprietary-6d7e315b0c0a1e56e135614f1e2e96fa19870975.tar.gz
xrdp-proprietary-6d7e315b0c0a1e56e135614f1e2e96fa19870975.zip
work on surface command
Diffstat (limited to 'libxrdp')
-rw-r--r--libxrdp/libxrdp.c69
-rw-r--r--libxrdp/libxrdp.h2
-rw-r--r--libxrdp/libxrdpinc.h7
-rw-r--r--libxrdp/xrdp_rdp.c12
4 files changed, 90 insertions, 0 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index 24443429..0d8e030e 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -1309,3 +1309,72 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
width, height, stride, x, y,
cx, cy, quality, out_data, io_len);
}
+
+/*****************************************************************************/
+int EXPORT_CC
+libxrdp_fastpath_send_surface(struct xrdp_session *session,
+ char* data_pad, int pad_bytes,
+ int data_bytes,
+ int destLeft, int destTop,
+ int destRight, int destBottom, int bpp,
+ int codecID, int width, int height)
+{
+ struct stream ls;
+ struct stream *s;
+ struct xrdp_rdp *rdp;
+ int rv;
+ int sec_bytes;
+ int rdp_bytes;
+ int max_bytes;
+ int cmd_bytes;
+
+ LLOGLN(10, ("libxrdp_fastpath_init:"));
+ if ((session->client_info->use_fast_path & 1) == 0)
+ {
+ return 1;
+ }
+ max_bytes = session->client_info->max_fastpath_frag_bytes;
+ if (max_bytes < 32 * 1024)
+ {
+ max_bytes = 32 * 1024;
+ }
+ rdp = (struct xrdp_rdp *) (session->rdp);
+ rdp_bytes = xrdp_rdp_get_fastpath_bytes(rdp);
+ sec_bytes = xrdp_sec_get_fastpath_bytes(rdp->sec_layer);
+ cmd_bytes = 10 + 12;
+ if (data_bytes + rdp_bytes + sec_bytes + cmd_bytes > max_bytes)
+ {
+ return 1;
+ }
+ if (sec_bytes + rdp_bytes + cmd_bytes > pad_bytes)
+ {
+ return 1;
+ }
+ g_memset(&ls, 0, sizeof(ls));
+ s = &ls;
+ s->data = (data_pad + pad_bytes) - (rdp_bytes + sec_bytes + cmd_bytes);
+ s->sec_hdr = s->data;
+ s->rdp_hdr = s->sec_hdr + sec_bytes;
+ s->end = data_pad + pad_bytes + data_bytes;
+ s->p = s->data + (rdp_bytes + sec_bytes);
+ /* TS_SURFCMD_SET_SURF_BITS */
+ out_uint16_le(s, 0x0001); /* CMDTYPE_SET_SURFACE_BITS */
+ out_uint16_le(s, destLeft);
+ out_uint16_le(s, destTop);
+ out_uint16_le(s, destRight);
+ out_uint16_le(s, destBottom);
+ /* TS_ BITMAP_DATA_EX */
+ out_uint8(s, bpp);
+ out_uint8(s, 0);
+ out_uint8(s, 0);
+ out_uint8(s, codecID);
+ out_uint16_le(s, width);
+ out_uint16_le(s, height);
+ out_uint32_le(s, data_bytes);
+ /* 4 = FASTPATH_UPDATETYPE_SURFCMDS */
+ if (xrdp_rdp_send_fastpath(rdp, s, 4) != 0)
+ {
+ return 1;
+ }
+ return 0;
+}
diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h
index 1ddf345c..b909dd72 100644
--- a/libxrdp/libxrdp.h
+++ b/libxrdp/libxrdp.h
@@ -376,6 +376,8 @@ xrdp_rdp_init(struct xrdp_rdp* self, struct stream* s);
int APP_CC
xrdp_rdp_init_data(struct xrdp_rdp* self, struct stream* s);
int APP_CC
+xrdp_rdp_get_fastpath_bytes(struct xrdp_rdp *self);
+int APP_CC
xrdp_rdp_init_fastpath(struct xrdp_rdp *self, struct stream *s);
int APP_CC
xrdp_rdp_recv(struct xrdp_rdp* self, struct stream* s, int* code);
diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h
index 8e41e7fe..8617f605 100644
--- a/libxrdp/libxrdpinc.h
+++ b/libxrdp/libxrdpinc.h
@@ -235,5 +235,12 @@ libxrdp_codec_jpeg_compress(struct xrdp_session *session,
int stride, int x, int y,
int cx, int cy, int quality,
char *out_data, int *io_len);
+int DEFAULT_CC
+libxrdp_fastpath_send_surface(struct xrdp_session *session,
+ char* data_pad, int pad_bytes,
+ int data_bytes,
+ int destLeft, int dst_Top,
+ int destRight, int destBottom, int bpp,
+ int codecID, int width, int height);
#endif
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 76834591..e6a2f622 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -508,6 +508,18 @@ xrdp_rdp_send_data(struct xrdp_rdp *self, struct stream *s,
}
/*****************************************************************************/
+/* returns the fastpath rdp byte count */
+int APP_CC
+xrdp_rdp_get_fastpath_bytes(struct xrdp_rdp *self)
+{
+ if (self->client_info.rdp_compression)
+ {
+ return 4;
+ }
+ return 3;
+}
+
+/*****************************************************************************/
int APP_CC
xrdp_rdp_init_fastpath(struct xrdp_rdp *self, struct stream *s)
{