diff options
-rw-r--r-- | xorg/X11R7.6/rdp/rdp.h | 10 | ||||
-rw-r--r-- | xorg/X11R7.6/rdp/rdpup.c | 65 | ||||
-rw-r--r-- | xup/xup.c | 46 |
3 files changed, 119 insertions, 2 deletions
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 5db8d194..9548f76b 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -508,3 +508,13 @@ struct stream { \ (s) = (struct stream*)g_malloc(sizeof(struct stream), 1); \ } + +/******************************************************************************/ +#define free_stream(s) do \ +{ \ + if ((s) != 0) \ + { \ + g_free((s)->data); \ + } \ + g_free((s)); \ +} while (0) diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index b70eb8cd..c0845a2e 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -153,7 +153,7 @@ rdpup_send_msg(struct stream* s) rv = 1; if (s != 0) { - len = s->end - s->data; + len = (int)(s->end - s->data); if (len > s->size) { rdpLog("overrun error len %d count %d\n", len, g_count); @@ -347,6 +347,64 @@ l_bound_by(int val, int low, int high) /******************************************************************************/ static int +rdpup_send_caps(void) +{ + struct stream* ls; + int len; + int rv; + int cap_count; + int cap_bytes; + + make_stream(ls); + init_stream(ls, 8192); + s_push_layer(ls, iso_hdr, 8); + + cap_count = 0; + cap_bytes = 0; + +#if 0 + out_uint16_le(ls, 0); + out_uint16_le(ls, 4); + cap_count++; + cap_bytes += 4; + + out_uint16_le(ls, 1); + out_uint16_le(ls, 4); + cap_count++; + cap_bytes += 4; +#endif + + s_mark_end(ls); + len = (int)(ls->end - ls->data); + s_pop_layer(ls, iso_hdr); + out_uint16_le(ls, 2); /* caps */ + out_uint16_le(ls, cap_count); /* num caps */ + out_uint32_le(ls, cap_bytes); /* caps len after header */ + + rv = rdpup_send(ls->data, len); + if (rv != 0) + { + ErrorF("rdpup_send_caps: rdpup_send failed\n"); + } + free_stream(ls); + return rv; +} + +/******************************************************************************/ +static int +process_version_msg(int param1, int param2, int param3, int param4) +{ + ErrorF("process_version_msg: version %d %d %d %d\n", param1, param2, + param3, param4); + if ((param1 > 0) || (param2 > 0) || (param3 > 0) || (param4 > 0)) + { + rdpup_send_caps(); + } + return 0; +} + +/******************************************************************************/ +static int rdpup_process_msg(struct stream* s) { int msg_type; @@ -431,6 +489,9 @@ param4 %d\n", msg, param1, param2, param3, param4)); case 300: process_screen_size_msg(param1, param2, param3); break; + case 301: + process_version_msg(param1, param2, param3, param4); + break; } } else @@ -466,7 +527,7 @@ rdpup_init(void) make_stream(g_in_s); init_stream(g_in_s, 8192); } - if (g_out_s == 0) + if (g_out_s == 0) { make_stream(g_out_s); init_stream(g_out_s, 8192 * g_Bpp + 100); @@ -223,6 +223,24 @@ lib_mod_connect(struct mod* mod) } if (error == 0) { + /* send version message */ + init_stream(s, 8192); + s_push_layer(s, iso_hdr, 4); + out_uint16_le(s, 103); + out_uint32_le(s, 301); + out_uint32_le(s, 0); + out_uint32_le(s, 0); + out_uint32_le(s, 0); + out_uint32_le(s, 1); + s_mark_end(s); + len = (int)(s->end - s->data); + s_pop_layer(s, iso_hdr); + out_uint32_le(s, len); + lib_send(mod, s->data, len); + } + if (error == 0) + { + /* send screen size message */ init_stream(s, 8192); s_push_layer(s, iso_hdr, 4); out_uint16_le(s, 103); @@ -239,6 +257,7 @@ lib_mod_connect(struct mod* mod) } if (error == 0) { + /* send invalidate message */ init_stream(s, 8192); s_push_layer(s, iso_hdr, 4); out_uint16_le(s, 103); @@ -367,6 +386,7 @@ lib_mod_signal(struct mod* mod) int y1; int x2; int y2; + char* phold; char* bmpdata; char cur_data[32 * (32 * 3)]; char cur_mask[32 * (32 / 8)]; @@ -476,6 +496,32 @@ lib_mod_signal(struct mod* mod) } } } + else if (type == 2) /* caps */ + { + g_writeln("lib_mod_signal: type 2 len %d\n", len); + init_stream(s, len); + rv = lib_recv(mod, s->data, len); + if (rv == 0) + { + for (index = 0; index < num_orders; index++) + { + phold = s->p; + in_uint16_le(s, type); + in_uint16_le(s, len); + switch (type) + { + default: + g_writeln("lib_mod_signal: unknown cap type %d len %d", type, len); + break; + } + s->p = phold + len; + } + } + } + else + { + g_writeln("unknown type %d", type); + } } free_stream(s); LIB_DEBUG(mod, "out lib_mod_signal"); |