1 |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
3 |
Protocol services - Multipoint Communications Service |
4 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
Copyright (C) Erik Forsberg 2003 |
6 |
|
7 |
This program is free software; you can redistribute it and/or modify |
8 |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2 of the License, or |
10 |
(at your option) any later version. |
11 |
|
12 |
This program is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
16 |
|
17 |
You should have received a copy of the GNU General Public License |
18 |
along with this program; if not, write to the Free Software |
19 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
*/ |
21 |
|
22 |
#include "rdesktop.h" |
23 |
|
24 |
extern uint8 *next_packet; |
25 |
|
26 |
void |
27 |
rdp5_process(STREAM s, BOOL encryption, BOOL shortform) |
28 |
{ |
29 |
uint16 length, count; |
30 |
uint8 type; |
31 |
uint8 *next; |
32 |
|
33 |
if (encryption) |
34 |
{ |
35 |
in_uint8s(s, shortform ? 6 : 7 /* XXX HACK */ ); /* signature */ |
36 |
sec_decrypt(s->p, s->end - s->p); |
37 |
} |
38 |
|
39 |
#if 0 |
40 |
printf("RDP5 data:\n"); |
41 |
hexdump(s->p, s->end - s->p); |
42 |
#endif |
43 |
|
44 |
while (s->p < s->end) |
45 |
{ |
46 |
in_uint8(s, type); |
47 |
in_uint16_le(s, length); |
48 |
next_packet = next = s->p + length; |
49 |
|
50 |
switch (type) |
51 |
{ |
52 |
case 0: /* orders */ |
53 |
in_uint16_le(s, count); |
54 |
process_orders(s, count); |
55 |
break; |
56 |
case 1: /* bitmap update (???) */ |
57 |
in_uint8s(s, 2); /* part length */ |
58 |
process_bitmap_updates(s); |
59 |
break; |
60 |
case 2: /* palette */ |
61 |
in_uint8s(s, 2); /* uint16 = 2 */ |
62 |
process_palette(s); |
63 |
break; |
64 |
case 3: /* probably an palette with offset 3. Weird */ |
65 |
break; |
66 |
case 5: |
67 |
process_null_system_pointer_pdu(s); |
68 |
break; |
69 |
case 9: |
70 |
process_colour_pointer_pdu(s); |
71 |
break; |
72 |
case 10: |
73 |
process_cached_pointer_pdu(s); |
74 |
break; |
75 |
default: |
76 |
unimpl("RDP5 opcode %d\n", type); |
77 |
} |
78 |
|
79 |
s->p = next; |
80 |
} |
81 |
} |
82 |
|
83 |
void |
84 |
rdp5_process_channel(STREAM s, uint16 channel) |
85 |
{ |
86 |
printf("Data on channel %02x:\n", channel); |
87 |
hexdump(s->p, s->end - s->p); |
88 |
} |