1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Protocol services - RDP layer |
Protocol services - RDP layer |
4 |
Copyright (C) Matthew Chapman 1999-2001 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
120 |
out_uint32_le(s, rdp_shareid); |
out_uint32_le(s, rdp_shareid); |
121 |
out_uint8(s, 0); /* pad */ |
out_uint8(s, 0); /* pad */ |
122 |
out_uint8(s, 1); /* streamid */ |
out_uint8(s, 1); /* streamid */ |
123 |
out_uint16(s, (length - 14)); |
out_uint16_le(s, (length - 14)); |
124 |
out_uint8(s, data_pdu_type); |
out_uint8(s, data_pdu_type); |
125 |
out_uint8(s, 0); /* compress_type */ |
out_uint8(s, 0); /* compress_type */ |
126 |
out_uint16(s, 0); /* compress_len */ |
out_uint16(s, 0); /* compress_len */ |
196 |
|
|
197 |
/* Send a synchronisation PDU */ |
/* Send a synchronisation PDU */ |
198 |
static void |
static void |
199 |
rdp_send_synchronise() |
rdp_send_synchronise(void) |
200 |
{ |
{ |
201 |
STREAM s; |
STREAM s; |
202 |
|
|
274 |
out_uint16_le(s, RDP_CAPLEN_BITMAP); |
out_uint16_le(s, RDP_CAPLEN_BITMAP); |
275 |
|
|
276 |
out_uint16_le(s, 8); /* Preferred BPP */ |
out_uint16_le(s, 8); /* Preferred BPP */ |
277 |
out_uint16(s, 1); /* Receive 1 BPP */ |
out_uint16_le(s, 1); /* Receive 1 BPP */ |
278 |
out_uint16(s, 1); /* Receive 4 BPP */ |
out_uint16_le(s, 1); /* Receive 4 BPP */ |
279 |
out_uint16_le(s, 1); /* Receive 8 BPP */ |
out_uint16_le(s, 1); /* Receive 8 BPP */ |
280 |
out_uint16_le(s, 800); /* Desktop width */ |
out_uint16_le(s, 800); /* Desktop width */ |
281 |
out_uint16_le(s, 600); /* Desktop height */ |
out_uint16_le(s, 600); /* Desktop height */ |
298 |
order_caps[0] = 1; /* dest blt */ |
order_caps[0] = 1; /* dest blt */ |
299 |
order_caps[1] = 1; /* pat blt */ |
order_caps[1] = 1; /* pat blt */ |
300 |
order_caps[2] = 1; /* screen blt */ |
order_caps[2] = 1; /* screen blt */ |
301 |
|
order_caps[3] = 1; /* required for memblt? */ |
302 |
order_caps[8] = 1; /* line */ |
order_caps[8] = 1; /* line */ |
303 |
order_caps[9] = 1; /* line */ |
order_caps[9] = 1; /* line */ |
304 |
order_caps[10] = 1; /* rect */ |
order_caps[10] = 1; /* rect */ |
320 |
out_uint8p(s, order_caps, 32); /* Orders supported */ |
out_uint8p(s, order_caps, 32); /* Orders supported */ |
321 |
out_uint16_le(s, 0x6a1); /* Text capability flags */ |
out_uint16_le(s, 0x6a1); /* Text capability flags */ |
322 |
out_uint8s(s, 6); /* Pad */ |
out_uint8s(s, 6); /* Pad */ |
323 |
out_uint32(s, desktop_save == False ? 0 : 0x38400); /* Desktop cache size */ |
out_uint32_le(s, desktop_save == False ? 0 : 0x38400); /* Desktop cache size */ |
324 |
out_uint32(s, 0); /* Unknown */ |
out_uint32(s, 0); /* Unknown */ |
325 |
out_uint32(s, 0x4e4); /* Unknown */ |
out_uint32_le(s, 0x4e4); /* Unknown */ |
326 |
} |
} |
327 |
|
|
328 |
/* Output bitmap cache capability set */ |
/* Output bitmap cache capability set */ |
434 |
|
|
435 |
/* Send a confirm active PDU */ |
/* Send a confirm active PDU */ |
436 |
static void |
static void |
437 |
rdp_send_confirm_active() |
rdp_send_confirm_active(void) |
438 |
{ |
{ |
439 |
STREAM s; |
STREAM s; |
440 |
uint16 caplen = |
uint16 caplen = |
601 |
static void |
static void |
602 |
process_palette(STREAM s) |
process_palette(STREAM s) |
603 |
{ |
{ |
604 |
HCOLOURMAP hmap; |
COLOURENTRY *entry; |
605 |
COLOURMAP map; |
COLOURMAP map; |
606 |
uint8 *colours; |
HCOLOURMAP hmap; |
607 |
|
int i; |
608 |
|
|
609 |
in_uint8s(s, 2); /* pad */ |
in_uint8s(s, 2); /* pad */ |
610 |
in_uint16_le(s, map.ncolours); |
in_uint16_le(s, map.ncolours); |
611 |
in_uint8s(s, 2); /* pad */ |
in_uint8s(s, 2); /* pad */ |
612 |
in_uint8p(s, colours, (map.ncolours * 3)); |
|
613 |
map.colours = (COLOURENTRY *) colours; |
map.colours = xmalloc(3 * map.ncolours); |
614 |
|
|
615 |
|
for (i = 0; i < map.ncolours; i++) |
616 |
|
{ |
617 |
|
entry = &map.colours[i]; |
618 |
|
in_uint8(s, entry->red); |
619 |
|
in_uint8(s, entry->green); |
620 |
|
in_uint8(s, entry->blue); |
621 |
|
} |
622 |
|
|
623 |
hmap = ui_create_colourmap(&map); |
hmap = ui_create_colourmap(&map); |
624 |
ui_set_colourmap(hmap); |
ui_set_colourmap(hmap); |
625 |
|
|
626 |
|
xfree(map.colours); |
627 |
} |
} |
628 |
|
|
629 |
/* Process an update PDU */ |
/* Process an update PDU */ |
692 |
|
|
693 |
/* Process incoming packets */ |
/* Process incoming packets */ |
694 |
void |
void |
695 |
rdp_main_loop() |
rdp_main_loop(void) |
696 |
{ |
{ |
697 |
uint8 type; |
uint8 type; |
698 |
STREAM s; |
STREAM s; |
732 |
|
|
733 |
/* Disconnect from the RDP layer */ |
/* Disconnect from the RDP layer */ |
734 |
void |
void |
735 |
rdp_disconnect() |
rdp_disconnect(void) |
736 |
{ |
{ |
737 |
sec_disconnect(); |
sec_disconnect(); |
738 |
} |
} |