1 | /*
|
---|
2 | rdesktop: A Remote Desktop Protocol client.
|
---|
3 | Common data types
|
---|
4 | Copyright (C) Matthew Chapman 1999-2008
|
---|
5 | Copyright 2014 Henrik Andersson <hean01@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 | typedef int RD_BOOL;
|
---|
31 |
|
---|
32 | #ifndef True
|
---|
33 | #define True (1)
|
---|
34 | #define False (0)
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | typedef unsigned char uint8;
|
---|
38 | typedef signed char sint8;
|
---|
39 | typedef unsigned short uint16;
|
---|
40 | typedef signed short sint16;
|
---|
41 | typedef unsigned int uint32;
|
---|
42 | typedef signed int sint32;
|
---|
43 |
|
---|
44 | typedef void *RD_HBITMAP;
|
---|
45 | typedef void *RD_HGLYPH;
|
---|
46 | typedef void *RD_HCOLOURMAP;
|
---|
47 | typedef void *RD_HCURSOR;
|
---|
48 |
|
---|
49 |
|
---|
50 | typedef enum _RDP_VERSION
|
---|
51 | {
|
---|
52 | RDP_V4 = 4,
|
---|
53 | RDP_V5 = 5,
|
---|
54 | RDP_V6 = 6
|
---|
55 | } RDP_VERSION;
|
---|
56 |
|
---|
57 |
|
---|
58 | typedef struct _RD_POINT
|
---|
59 | {
|
---|
60 | sint16 x, y;
|
---|
61 | }
|
---|
62 | RD_POINT;
|
---|
63 |
|
---|
64 | typedef struct _COLOURENTRY
|
---|
65 | {
|
---|
66 | uint8 red;
|
---|
67 | uint8 green;
|
---|
68 | uint8 blue;
|
---|
69 |
|
---|
70 | }
|
---|
71 | COLOURENTRY;
|
---|
72 |
|
---|
73 | typedef struct _COLOURMAP
|
---|
74 | {
|
---|
75 | uint16 ncolours;
|
---|
76 | COLOURENTRY *colours;
|
---|
77 |
|
---|
78 | }
|
---|
79 | COLOURMAP;
|
---|
80 |
|
---|
81 | typedef struct _BOUNDS
|
---|
82 | {
|
---|
83 | sint16 left;
|
---|
84 | sint16 top;
|
---|
85 | sint16 right;
|
---|
86 | sint16 bottom;
|
---|
87 |
|
---|
88 | }
|
---|
89 | BOUNDS;
|
---|
90 |
|
---|
91 | typedef struct _PEN
|
---|
92 | {
|
---|
93 | uint8 style;
|
---|
94 | uint8 width;
|
---|
95 | uint32 colour;
|
---|
96 |
|
---|
97 | }
|
---|
98 | PEN;
|
---|
99 |
|
---|
100 | /* this is whats in the brush cache */
|
---|
101 | typedef struct _BRUSHDATA
|
---|
102 | {
|
---|
103 | uint32 colour_code;
|
---|
104 | uint32 data_size;
|
---|
105 | uint8 *data;
|
---|
106 | }
|
---|
107 | BRUSHDATA;
|
---|
108 |
|
---|
109 | typedef struct _BRUSH
|
---|
110 | {
|
---|
111 | uint8 xorigin;
|
---|
112 | uint8 yorigin;
|
---|
113 | uint8 style;
|
---|
114 | uint8 pattern[8];
|
---|
115 | BRUSHDATA *bd;
|
---|
116 | }
|
---|
117 | BRUSH;
|
---|
118 |
|
---|
119 | typedef struct _FONTGLYPH
|
---|
120 | {
|
---|
121 | sint16 offset;
|
---|
122 | sint16 baseline;
|
---|
123 | uint16 width;
|
---|
124 | uint16 height;
|
---|
125 | RD_HBITMAP pixmap;
|
---|
126 |
|
---|
127 | }
|
---|
128 | FONTGLYPH;
|
---|
129 |
|
---|
130 | typedef struct _DATABLOB
|
---|
131 | {
|
---|
132 | void *data;
|
---|
133 | int size;
|
---|
134 |
|
---|
135 | }
|
---|
136 | DATABLOB;
|
---|
137 |
|
---|
138 | typedef struct _key_translation
|
---|
139 | {
|
---|
140 | /* For normal scancode translations */
|
---|
141 | uint8 scancode;
|
---|
142 | uint16 modifiers;
|
---|
143 | /* For sequences. If keysym is nonzero, the fields above are not used. */
|
---|
144 | uint32 seq_keysym; /* Really KeySym */
|
---|
145 | struct _key_translation *next;
|
---|
146 | }
|
---|
147 | key_translation;
|
---|
148 |
|
---|
149 | typedef struct _key_translation_entry
|
---|
150 | {
|
---|
151 | key_translation *tr;
|
---|
152 | /* The full KeySym for this entry, not KEYMAP_MASKed */
|
---|
153 | uint32 keysym;
|
---|
154 | /* This will be non-NULL if there has been a hash collision */
|
---|
155 | struct _key_translation_entry *next;
|
---|
156 | }
|
---|
157 | key_translation_entry;
|
---|
158 |
|
---|
159 | typedef struct _VCHANNEL
|
---|
160 | {
|
---|
161 | uint16 mcs_id;
|
---|
162 | char name[8];
|
---|
163 | uint32 flags;
|
---|
164 | struct stream in;
|
---|
165 | void (*process) (STREAM);
|
---|
166 | }
|
---|
167 | VCHANNEL;
|
---|
168 |
|
---|
169 | /* PSTCACHE */
|
---|
170 | typedef uint8 HASH_KEY[8];
|
---|
171 |
|
---|
172 | /* Header for an entry in the persistent bitmap cache file */
|
---|
173 | typedef struct _PSTCACHE_CELLHEADER
|
---|
174 | {
|
---|
175 | HASH_KEY key;
|
---|
176 | uint8 width, height;
|
---|
177 | uint16 length;
|
---|
178 | uint32 stamp;
|
---|
179 | }
|
---|
180 | CELLHEADER;
|
---|
181 |
|
---|
182 | #define MAX_CBSIZE 256
|
---|
183 |
|
---|
184 | /* RDPSND */
|
---|
185 | typedef struct _RD_WAVEFORMATEX
|
---|
186 | {
|
---|
187 | uint16 wFormatTag;
|
---|
188 | uint16 nChannels;
|
---|
189 | uint32 nSamplesPerSec;
|
---|
190 | uint32 nAvgBytesPerSec;
|
---|
191 | uint16 nBlockAlign;
|
---|
192 | uint16 wBitsPerSample;
|
---|
193 | uint16 cbSize;
|
---|
194 | uint8 cb[MAX_CBSIZE];
|
---|
195 | } RD_WAVEFORMATEX;
|
---|
196 |
|
---|
197 | typedef struct _RDPCOMP
|
---|
198 | {
|
---|
199 | uint32 roff;
|
---|
200 | uint8 hist[RDP_MPPC_DICT_SIZE];
|
---|
201 | struct stream ns;
|
---|
202 | }
|
---|
203 | RDPCOMP;
|
---|
204 |
|
---|
205 | /* RDPDR */
|
---|
206 | typedef uint32 RD_NTSTATUS;
|
---|
207 | typedef uint32 RD_NTHANDLE;
|
---|
208 |
|
---|
209 | typedef struct _DEVICE_FNS
|
---|
210 | {
|
---|
211 | RD_NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode,
|
---|
212 | uint32 create_disposition, uint32 flags_and_attributes,
|
---|
213 | char *filename, RD_NTHANDLE * handle);
|
---|
214 | RD_NTSTATUS(*close) (RD_NTHANDLE handle);
|
---|
215 | RD_NTSTATUS(*read) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
|
---|
216 | uint32 * result);
|
---|
217 | RD_NTSTATUS(*write) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset,
|
---|
218 | uint32 * result);
|
---|
219 | RD_NTSTATUS(*device_control) (RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out);
|
---|
220 | }
|
---|
221 | DEVICE_FNS;
|
---|
222 |
|
---|
223 |
|
---|
224 | typedef struct rdpdr_device_info
|
---|
225 | {
|
---|
226 | uint32 device_type;
|
---|
227 | RD_NTHANDLE handle;
|
---|
228 | char name[8];
|
---|
229 | char *local_path;
|
---|
230 | void *pdevice_data;
|
---|
231 | }
|
---|
232 | RDPDR_DEVICE;
|
---|
233 |
|
---|
234 | typedef struct rdpdr_serial_device_info
|
---|
235 | {
|
---|
236 | int dtr;
|
---|
237 | int rts;
|
---|
238 | uint32 control, xonoff, onlimit, offlimit;
|
---|
239 | uint32 baud_rate,
|
---|
240 | queue_in_size,
|
---|
241 | queue_out_size,
|
---|
242 | wait_mask,
|
---|
243 | read_interval_timeout,
|
---|
244 | read_total_timeout_multiplier,
|
---|
245 | read_total_timeout_constant,
|
---|
246 | write_total_timeout_multiplier, write_total_timeout_constant, posix_wait_mask;
|
---|
247 | uint8 stop_bits, parity, word_length;
|
---|
248 | uint8 chars[6];
|
---|
249 | struct termios *ptermios, *pold_termios;
|
---|
250 | int event_txempty, event_cts, event_dsr, event_rlsd, event_pending;
|
---|
251 | }
|
---|
252 | SERIAL_DEVICE;
|
---|
253 |
|
---|
254 | typedef struct rdpdr_parallel_device_info
|
---|
255 | {
|
---|
256 | char *driver, *printer;
|
---|
257 | uint32 queue_in_size,
|
---|
258 | queue_out_size,
|
---|
259 | wait_mask,
|
---|
260 | read_interval_timeout,
|
---|
261 | read_total_timeout_multiplier,
|
---|
262 | read_total_timeout_constant,
|
---|
263 | write_total_timeout_multiplier,
|
---|
264 | write_total_timeout_constant, posix_wait_mask, bloblen;
|
---|
265 | uint8 *blob;
|
---|
266 | }
|
---|
267 | PARALLEL_DEVICE;
|
---|
268 |
|
---|
269 | typedef struct rdpdr_printer_info
|
---|
270 | {
|
---|
271 | FILE *printer_fp;
|
---|
272 | char *driver, *printer;
|
---|
273 | uint32 bloblen;
|
---|
274 | uint8 *blob;
|
---|
275 | RD_BOOL default_printer;
|
---|
276 | }
|
---|
277 | PRINTER;
|
---|
278 |
|
---|
279 | typedef struct notify_data
|
---|
280 | {
|
---|
281 | time_t modify_time;
|
---|
282 | time_t status_time;
|
---|
283 | time_t total_time;
|
---|
284 | unsigned int num_entries;
|
---|
285 | }
|
---|
286 | NOTIFY;
|
---|
287 |
|
---|
288 | #ifndef PATH_MAX
|
---|
289 | #define PATH_MAX 256
|
---|
290 | #endif
|
---|
291 |
|
---|
292 | typedef struct fileinfo
|
---|
293 | {
|
---|
294 | uint32 device_id, flags_and_attributes, accessmask;
|
---|
295 | char path[PATH_MAX];
|
---|
296 | DIR *pdir;
|
---|
297 | struct dirent *pdirent;
|
---|
298 | char pattern[PATH_MAX];
|
---|
299 | RD_BOOL delete_on_close;
|
---|
300 | NOTIFY notify;
|
---|
301 | uint32 info_class;
|
---|
302 | }
|
---|
303 | FILEINFO;
|
---|
304 |
|
---|
305 | typedef RD_BOOL(*str_handle_lines_t) (const char *line, void *data);
|
---|