VirtualBox

source: vbox/trunk/src/VBox/RDP/client/rdp5.c@ 13384

Last change on this file since 13384 was 11982, checked in by vboxsync, 16 years ago

All: license header changes for 2.0 (OSE headers, add Sun GPL/LGPL disclaimer)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
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-2007
5 Copyright (C) Erik Forsberg 2003-2007
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/*
23 * Sun GPL Disclaimer: For the avoidance of doubt, except that if any license choice
24 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
25 * the General Public License version 2 (GPLv2) at this time for any software where
26 * a choice of GPL license versions is made available with the language indicating
27 * that GPLv2 or any later version may be used, or where a choice of which version
28 * of the GPL is applied is otherwise unspecified.
29 */
30
31#include "rdesktop.h"
32
33extern uint8 *g_next_packet;
34
35extern RDPCOMP g_mppc_dict;
36
37void
38rdp5_process(STREAM s)
39{
40 uint16 length, count, x, y;
41 uint8 type, ctype;
42 uint8 *next;
43
44 uint32 roff, rlen;
45 struct stream *ns = &(g_mppc_dict.ns);
46 struct stream *ts;
47
48#if 0
49 printf("RDP5 data:\n");
50 hexdump(s->p, s->end - s->p);
51#endif
52
53 ui_begin_update();
54 while (s->p < s->end)
55 {
56 in_uint8(s, type);
57 if (type & RDP5_COMPRESSED)
58 {
59 in_uint8(s, ctype);
60 in_uint16_le(s, length);
61 type ^= RDP5_COMPRESSED;
62 }
63 else
64 {
65 ctype = 0;
66 in_uint16_le(s, length);
67 }
68 g_next_packet = next = s->p + length;
69
70 if (ctype & RDP_MPPC_COMPRESSED)
71 {
72 if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
73 error("error while decompressing packet\n");
74
75 /* allocate memory and copy the uncompressed data into the temporary stream */
76 ns->data = (uint8 *) xrealloc(ns->data, rlen);
77
78 memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen);
79
80 ns->size = rlen;
81 ns->end = (ns->data + ns->size);
82 ns->p = ns->data;
83 ns->rdp_hdr = ns->p;
84
85 ts = ns;
86 }
87 else
88 ts = s;
89
90 switch (type)
91 {
92 case 0: /* update orders */
93 in_uint16_le(ts, count);
94 process_orders(ts, count);
95 break;
96 case 1: /* update bitmap */
97 in_uint8s(ts, 2); /* part length */
98 process_bitmap_updates(ts);
99 break;
100 case 2: /* update palette */
101 in_uint8s(ts, 2); /* uint16 = 2 */
102 process_palette(ts);
103 break;
104 case 3: /* update synchronize */
105 break;
106 case 5: /* null pointer */
107 ui_set_null_cursor();
108 break;
109 case 6: /* default pointer */
110 break;
111 case 8: /* pointer position */
112 in_uint16_le(ts, x);
113 in_uint16_le(ts, y);
114 if (s_check(ts))
115 ui_move_pointer(x, y);
116 break;
117 case 9: /* color pointer */
118 process_colour_pointer_pdu(ts);
119 break;
120 case 10: /* cached pointer */
121 process_cached_pointer_pdu(ts);
122 break;
123 default:
124 unimpl("RDP5 opcode %d\n", type);
125 }
126
127 s->p = next;
128 }
129 ui_end_update();
130}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette