summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_fastpath.c
diff options
context:
space:
mode:
authorspeidy <speidy@gmail.com>2014-02-09 01:42:04 +0200
committerspeidy <speidy@gmail.com>2014-02-09 01:42:04 +0200
commitcbf5d50a5c96de83178e910318db540334f289b1 (patch)
tree85fc35d23438713559fa5188bbf2563f4b9a531d /libxrdp/xrdp_fastpath.c
parent9a98299e2b3bb0c3e4f047efa4ad8f8450656dda (diff)
downloadxrdp-proprietary-cbf5d50a5c96de83178e910318db540334f289b1.tar.gz
xrdp-proprietary-cbf5d50a5c96de83178e910318db540334f289b1.zip
libxrdp: work on fastpath input
Diffstat (limited to 'libxrdp/xrdp_fastpath.c')
-rw-r--r--libxrdp/xrdp_fastpath.c62
1 files changed, 52 insertions, 10 deletions
diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c
index 96d84972..c8b4927d 100644
--- a/libxrdp/xrdp_fastpath.c
+++ b/libxrdp/xrdp_fastpath.c
@@ -21,16 +21,15 @@
/*****************************************************************************/
struct xrdp_fastpath *APP_CC
-xrdp_fastpath_create(struct xrdp_session *session)
+xrdp_fastpath_create(struct xrdp_sec *owner, struct trans *trans)
{
struct xrdp_fastpath *self;
+ DEBUG((" in xrdp_fastpath_create"));
self = (struct xrdp_fastpath *)g_malloc(sizeof(struct xrdp_fastpath), 1);
- self->tcp_layer =
- ((struct xrdp_rdp *)session->rdp)->sec_layer->
- mcs_layer->iso_layer->tcp_layer;
- make_stream(self->out_s);
- init_stream(self->out_s, FASTPATH_MAX_PACKET_SIZE);
+ self->sec_layer = owner;
+ self->tcp_layer = owner->mcs_layer->iso_layer->tcp_layer;
+ DEBUG((" out xrdp_fastpath_create"));
return self;
}
@@ -42,8 +41,6 @@ xrdp_fastpath_delete(struct xrdp_fastpath *self)
{
return;
}
-
- free_stream(self->out_s);
g_free(self);
}
@@ -54,7 +51,52 @@ xrdp_fastpath_reset(struct xrdp_fastpath *self)
{
return 0;
}
+/*****************************************************************************/
+int APP_CC
+xrdp_fastpath_recv(struct xrdp_fastpath *self, struct stream *s)
+{
+ int fp_hdr;
+ int len;
+ int byte;
+ DEBUG((" in xrdp_fastpath_recv"));
+
+ /* read the first fastpath byte
+ * (we already received it via iso layer */
+ in_uint8(s, fp_hdr); /* fpInputHeader (1 byte) */
+
+ self->numEvents = (fp_hdr & 0x3C) >> 2;
+ self->secFlags = (fp_hdr & 0xC0) >> 6;
+
+ // receive fastpath packet length
+ if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
+ {
+ return 1;
+ }
+
+ in_uint8(s, byte); /* length 1 */
+
+ if (byte & 0x80)
+ {
+ byte &= ~(0x80);
+ len = (byte << 8);
+ in_uint8(s, byte); /* length 2 */
+ len += byte;
+ }
+ else
+ {
+ len = byte;
+ }
+ // receive the left bytes
+ if (xrdp_tcp_recv(self->tcp_layer, s, len) != 0)
+ {
+ return 1;
+ }
+ DEBUG((" out xrdp_fastpath_recv"));
+
+ return 0;
+}
+/*****************************************************************************/
int APP_CC
xrdp_fastpath_init(struct xrdp_fastpath *self)
{
@@ -76,7 +118,7 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath *self, tui8 updateCode,
int i32;
compression = 0;
- s_send = self->out_s;
+// s_send = self->out_s;
maxLen = FASTPATH_MAX_PACKET_SIZE - 6; /* 6 bytes for header */
payloadLeft = (s->end - s->data);
@@ -112,7 +154,7 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath *self, tui8 updateCode,
((compression & 0x03) << 6);
out_uint8(s_send, i32);
out_uint16_le(s_send, len);
- s_copy(s_send, s, len);
+// s_copy(s_send, s, len);
s_mark_end(s_send);
if (xrdp_tcp_send(self->tcp_layer, s_send) != 0)