VirtualBox

source: vbox/trunk/src/VBox/RDP/client-1.8.4/rdp5.c@ 94377

Last change on this file since 94377 was 55123, checked in by vboxsync, 10 years ago

rdesktop 1.8.3 modified for VBox

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