1 |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
3 |
Common data types |
4 |
Copyright (C) Matthew Chapman 1999-2005 |
5 |
|
6 |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
10 |
|
11 |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
typedef int BOOL; |
22 |
|
23 |
#ifndef True |
24 |
#define True (1) |
25 |
#define False (0) |
26 |
#endif |
27 |
|
28 |
typedef unsigned char uint8; |
29 |
typedef signed char sint8; |
30 |
typedef unsigned short uint16; |
31 |
typedef signed short sint16; |
32 |
typedef unsigned int uint32; |
33 |
typedef signed int sint32; |
34 |
|
35 |
typedef void *HBITMAP; |
36 |
typedef void *HGLYPH; |
37 |
typedef void *HCOLOURMAP; |
38 |
typedef void *HCURSOR; |
39 |
|
40 |
typedef struct _POINT |
41 |
{ |
42 |
sint16 x, y; |
43 |
} |
44 |
POINT; |
45 |
|
46 |
typedef struct _COLOURENTRY |
47 |
{ |
48 |
uint8 red; |
49 |
uint8 green; |
50 |
uint8 blue; |
51 |
|
52 |
} |
53 |
COLOURENTRY; |
54 |
|
55 |
typedef struct _COLOURMAP |
56 |
{ |
57 |
uint16 ncolours; |
58 |
COLOURENTRY *colours; |
59 |
|
60 |
} |
61 |
COLOURMAP; |
62 |
|
63 |
typedef struct _BOUNDS |
64 |
{ |
65 |
sint16 left; |
66 |
sint16 top; |
67 |
sint16 right; |
68 |
sint16 bottom; |
69 |
|
70 |
} |
71 |
BOUNDS; |
72 |
|
73 |
typedef struct _PEN |
74 |
{ |
75 |
uint8 style; |
76 |
uint8 width; |
77 |
uint32 colour; |
78 |
|
79 |
} |
80 |
PEN; |
81 |
|
82 |
typedef struct _BRUSH |
83 |
{ |
84 |
uint8 xorigin; |
85 |
uint8 yorigin; |
86 |
uint8 style; |
87 |
uint8 pattern[8]; |
88 |
|
89 |
} |
90 |
BRUSH; |
91 |
|
92 |
typedef struct _FONTGLYPH |
93 |
{ |
94 |
sint16 offset; |
95 |
sint16 baseline; |
96 |
uint16 width; |
97 |
uint16 height; |
98 |
HBITMAP pixmap; |
99 |
|
100 |
} |
101 |
FONTGLYPH; |
102 |
|
103 |
typedef struct _DATABLOB |
104 |
{ |
105 |
void *data; |
106 |
int size; |
107 |
|
108 |
} |
109 |
DATABLOB; |
110 |
|
111 |
typedef struct _key_translation |
112 |
{ |
113 |
/* For normal scancode translations */ |
114 |
uint8 scancode; |
115 |
uint16 modifiers; |
116 |
/* For sequences. If keysym is nonzero, the fields above are not used. */ |
117 |
uint32 seq_keysym; /* Really KeySym */ |
118 |
struct _key_translation *next; |
119 |
} |
120 |
key_translation; |
121 |
|
122 |
typedef struct _VCHANNEL |
123 |
{ |
124 |
uint16 mcs_id; |
125 |
char name[8]; |
126 |
uint32 flags; |
127 |
struct stream in; |
128 |
void (*process) (STREAM); |
129 |
} |
130 |
VCHANNEL; |
131 |
|
132 |
/* PSTCACHE */ |
133 |
typedef uint8 HASH_KEY[8]; |
134 |
|
135 |
/* Header for an entry in the persistent bitmap cache file */ |
136 |
typedef struct _PSTCACHE_CELLHEADER |
137 |
{ |
138 |
HASH_KEY key; |
139 |
uint8 width, height; |
140 |
uint16 length; |
141 |
uint32 stamp; |
142 |
} |
143 |
CELLHEADER; |
144 |
|
145 |
#define MAX_CBSIZE 256 |
146 |
|
147 |
/* RDPSND */ |
148 |
typedef struct |
149 |
{ |
150 |
uint16 wFormatTag; |
151 |
uint16 nChannels; |
152 |
uint32 nSamplesPerSec; |
153 |
uint32 nAvgBytesPerSec; |
154 |
uint16 nBlockAlign; |
155 |
uint16 wBitsPerSample; |
156 |
uint16 cbSize; |
157 |
uint8 cb[MAX_CBSIZE]; |
158 |
} WAVEFORMATEX; |
159 |
|
160 |
typedef struct _RDPCOMP |
161 |
{ |
162 |
uint32 roff; |
163 |
uint8 hist[RDP_MPPC_DICT_SIZE]; |
164 |
struct stream ns; |
165 |
} |
166 |
RDPCOMP; |
167 |
|
168 |
/* RDPDR */ |
169 |
typedef uint32 NTSTATUS; |
170 |
typedef uint32 NTHANDLE; |
171 |
|
172 |
typedef struct _DEVICE_FNS |
173 |
{ |
174 |
NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode, |
175 |
uint32 create_disposition, uint32 flags_and_attributes, char *filename, |
176 |
NTHANDLE * handle); |
177 |
NTSTATUS(*close) (NTHANDLE handle); |
178 |
NTSTATUS(*read) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, |
179 |
uint32 * result); |
180 |
NTSTATUS(*write) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, |
181 |
uint32 * result); |
182 |
NTSTATUS(*device_control) (NTHANDLE handle, uint32 request, STREAM in, STREAM out); |
183 |
} |
184 |
DEVICE_FNS; |
185 |
|
186 |
|
187 |
typedef struct rdpdr_device_info |
188 |
{ |
189 |
uint32 device_type; |
190 |
NTHANDLE handle; |
191 |
char name[8]; |
192 |
char *local_path; |
193 |
void *pdevice_data; |
194 |
} |
195 |
RDPDR_DEVICE; |
196 |
|
197 |
typedef struct rdpdr_serial_device_info |
198 |
{ |
199 |
int dtr; |
200 |
int rts; |
201 |
uint32 control, xonoff, onlimit, offlimit; |
202 |
uint32 baud_rate, |
203 |
queue_in_size, |
204 |
queue_out_size, |
205 |
wait_mask, |
206 |
read_interval_timeout, |
207 |
read_total_timeout_multiplier, |
208 |
read_total_timeout_constant, |
209 |
write_total_timeout_multiplier, write_total_timeout_constant, posix_wait_mask; |
210 |
uint8 stop_bits, parity, word_length; |
211 |
uint8 chars[6]; |
212 |
struct termios *ptermios, *pold_termios; |
213 |
int event_txempty, event_cts, event_dsr, event_rlsd, event_pending; |
214 |
} |
215 |
SERIAL_DEVICE; |
216 |
|
217 |
typedef struct rdpdr_parallel_device_info |
218 |
{ |
219 |
char *driver, *printer; |
220 |
uint32 queue_in_size, |
221 |
queue_out_size, |
222 |
wait_mask, |
223 |
read_interval_timeout, |
224 |
read_total_timeout_multiplier, |
225 |
read_total_timeout_constant, |
226 |
write_total_timeout_multiplier, |
227 |
write_total_timeout_constant, posix_wait_mask, bloblen; |
228 |
uint8 *blob; |
229 |
} |
230 |
PARALLEL_DEVICE; |
231 |
|
232 |
typedef struct rdpdr_printer_info |
233 |
{ |
234 |
FILE *printer_fp; |
235 |
char *driver, *printer; |
236 |
uint32 bloblen; |
237 |
uint8 *blob; |
238 |
BOOL default_printer; |
239 |
} |
240 |
PRINTER; |
241 |
|
242 |
typedef struct notify_data |
243 |
{ |
244 |
time_t modify_time; |
245 |
time_t status_time; |
246 |
time_t total_time; |
247 |
unsigned int num_entries; |
248 |
} |
249 |
NOTIFY; |
250 |
|
251 |
#ifndef PATH_MAX |
252 |
#define PATH_MAX 256 |
253 |
#endif |
254 |
|
255 |
typedef struct fileinfo |
256 |
{ |
257 |
uint32 device_id, flags_and_attributes, accessmask; |
258 |
char path[PATH_MAX]; |
259 |
DIR *pdir; |
260 |
struct dirent *pdirent; |
261 |
char pattern[PATH_MAX]; |
262 |
BOOL delete_on_close; |
263 |
NOTIFY notify; |
264 |
uint32 info_class; |
265 |
} |
266 |
FILEINFO; |