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 *g_next_packet; |
25 |
|
26 |
void |
27 |
rdp5_process(STREAM s, BOOL encryption) |
28 |
{ |
29 |
uint16 length, count, x, y; |
30 |
uint8 type; |
31 |
uint8 *next; |
32 |
|
33 |
if (encryption) |
34 |
{ |
35 |
in_uint8s(s, 8); /* 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 |
g_next_packet = next = s->p + length; |
49 |
|
50 |
switch (type) |
51 |
{ |
52 |
/* Thanks to Jeroen Meijer <jdmeijer at yahoo |
53 |
dot com> for finding out the meaning of |
54 |
most of the opcodes here. Especially opcode |
55 |
8! :) */ |
56 |
case 0: /* orders */ |
57 |
in_uint16_le(s, count); |
58 |
process_orders(s, count); |
59 |
break; |
60 |
case 1: /* bitmap update (???) */ |
61 |
in_uint8s(s, 2); /* part length */ |
62 |
process_bitmap_updates(s); |
63 |
break; |
64 |
case 2: /* palette */ |
65 |
in_uint8s(s, 2); /* uint16 = 2 */ |
66 |
process_palette(s); |
67 |
break; |
68 |
case 3: /* probably an palette with offset 3. Weird */ |
69 |
break; |
70 |
case 5: |
71 |
ui_set_null_cursor(); |
72 |
break; |
73 |
case 8: |
74 |
in_uint16_le(s, x); |
75 |
in_uint16_le(s, y); |
76 |
if (s_check(s)) |
77 |
ui_move_pointer(x, y); |
78 |
break; |
79 |
case 9: |
80 |
process_colour_pointer_pdu(s); |
81 |
break; |
82 |
case 10: |
83 |
process_cached_pointer_pdu(s); |
84 |
break; |
85 |
default: |
86 |
unimpl("RDP5 opcode %d\n", type); |
87 |
} |
88 |
|
89 |
s->p = next; |
90 |
} |
91 |
} |