xorg: added start of X11rdp / xup caps

ulab-original
Jay Sorg 13 years ago
parent 6333cdd865
commit ff6e8a1232

@ -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)

@ -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);
@ -345,6 +345,64 @@ l_bound_by(int val, int low, int high)
return val;
}
/******************************************************************************/
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)
@ -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");

Loading…
Cancel
Save