1 /* -*- c-basic-offset: 8 -*-
2 rdesktop: A Remote Desktop Protocol client.
3 Protocol services - RDP5 short form PDU processing
4 Copyright (C) Matthew Chapman 1999-2005
5 Copyright (C) Erik Forsberg 2003
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.
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.
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.
25 rdp5_process(RDPCLIENT
* This
, STREAM s
)
27 uint16 length
, count
, x
, y
;
32 struct stream
*ns
= &(This
->mppc_dict
.ns
);
36 printf("RDP5 data:\n");
37 hexdump(s
->p
, s
->end
- s
->p
);
40 ui_begin_update(This
);
44 if (type
& RDP5_COMPRESSED
)
47 in_uint16_le(s
, length
);
48 type
^= RDP5_COMPRESSED
;
53 in_uint16_le(s
, length
);
55 This
->next_packet
= next
= s
->p
+ length
;
57 if (ctype
& RDP_MPPC_COMPRESSED
)
61 if (mppc_expand(This
, s
->p
, length
, ctype
, &roff
, &rlen
) == -1)
62 error("error while decompressing packet\n");
64 /* allocate memory and copy the uncompressed data into the temporary stream */
65 p
= realloc(ns
->data
, rlen
);
69 This
->disconnect_reason
= 262;
73 ns
->data
= (uint8
*) p
;
75 memcpy((ns
->data
), (unsigned char *) (This
->mppc_dict
.hist
+ roff
), rlen
);
78 ns
->end
= (ns
->data
+ ns
->size
);
89 case 0: /* update orders */
90 in_uint16_le(ts
, count
);
91 process_orders(This
, ts
, count
);
93 case 1: /* update bitmap */
94 in_uint8s(ts
, 2); /* part length */
95 process_bitmap_updates(This
, ts
);
97 case 2: /* update palette */
98 in_uint8s(ts
, 2); /* uint16 = 2 */
99 process_palette(This
, ts
);
101 case 3: /* update synchronize */
103 case 5: /* null pointer */
104 ui_set_null_cursor(This
);
106 case 6: /* default pointer */
108 case 8: /* pointer position */
112 ui_move_pointer(This
, x
, y
);
114 case 9: /* color pointer */
115 process_colour_pointer_pdu(This
, ts
);
117 case 10: /* cached pointer */
118 process_cached_pointer_pdu(This
, ts
);
121 unimpl("RDP5 opcode %d\n", type
);