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 |
#ifdef WITH_SCARD |
22 |
#include <wintypes.h> |
23 |
#else |
24 |
typedef int BOOL; |
25 |
#endif |
26 |
|
27 |
#ifndef True |
28 |
#define True (1) |
29 |
#define False (0) |
30 |
#endif |
31 |
|
32 |
typedef unsigned char uint8; |
33 |
typedef signed char sint8; |
34 |
typedef unsigned short uint16; |
35 |
typedef signed short sint16; |
36 |
typedef unsigned int uint32; |
37 |
typedef signed int sint32; |
38 |
|
39 |
typedef void *HBITMAP; |
40 |
typedef void *HGLYPH; |
41 |
typedef void *HCOLOURMAP; |
42 |
typedef void *HCURSOR; |
43 |
|
44 |
typedef struct _POINT |
45 |
{ |
46 |
sint16 x, y; |
47 |
} |
48 |
POINT; |
49 |
|
50 |
typedef struct _COLOURENTRY |
51 |
{ |
52 |
uint8 red; |
53 |
uint8 green; |
54 |
uint8 blue; |
55 |
|
56 |
} |
57 |
COLOURENTRY; |
58 |
|
59 |
typedef struct _COLOURMAP |
60 |
{ |
61 |
uint16 ncolours; |
62 |
COLOURENTRY *colours; |
63 |
|
64 |
} |
65 |
COLOURMAP; |
66 |
|
67 |
typedef struct _BOUNDS |
68 |
{ |
69 |
sint16 left; |
70 |
sint16 top; |
71 |
sint16 right; |
72 |
sint16 bottom; |
73 |
|
74 |
} |
75 |
BOUNDS; |
76 |
|
77 |
typedef struct _PEN |
78 |
{ |
79 |
uint8 style; |
80 |
uint8 width; |
81 |
uint32 colour; |
82 |
|
83 |
} |
84 |
PEN; |
85 |
|
86 |
typedef struct _BRUSH |
87 |
{ |
88 |
uint8 xorigin; |
89 |
uint8 yorigin; |
90 |
uint8 style; |
91 |
uint8 pattern[8]; |
92 |
|
93 |
} |
94 |
BRUSH; |
95 |
|
96 |
typedef struct _FONTGLYPH |
97 |
{ |
98 |
sint16 offset; |
99 |
sint16 baseline; |
100 |
uint16 width; |
101 |
uint16 height; |
102 |
HBITMAP pixmap; |
103 |
|
104 |
} |
105 |
FONTGLYPH; |
106 |
|
107 |
typedef struct _DATABLOB |
108 |
{ |
109 |
void *data; |
110 |
int size; |
111 |
|
112 |
} |
113 |
DATABLOB; |
114 |
|
115 |
typedef struct _key_translation |
116 |
{ |
117 |
/* For normal scancode translations */ |
118 |
uint8 scancode; |
119 |
uint16 modifiers; |
120 |
/* For sequences. If keysym is nonzero, the fields above are not used. */ |
121 |
uint32 seq_keysym; /* Really KeySym */ |
122 |
struct _key_translation *next; |
123 |
} |
124 |
key_translation; |
125 |
|
126 |
typedef struct _VCHANNEL |
127 |
{ |
128 |
uint16 mcs_id; |
129 |
char name[8]; |
130 |
uint32 flags; |
131 |
struct stream in; |
132 |
void (*process) (STREAM); |
133 |
} |
134 |
VCHANNEL; |
135 |
|
136 |
/* PSTCACHE */ |
137 |
typedef uint8 HASH_KEY[8]; |
138 |
|
139 |
/* Header for an entry in the persistent bitmap cache file */ |
140 |
typedef struct _PSTCACHE_CELLHEADER |
141 |
{ |
142 |
HASH_KEY key; |
143 |
uint8 width, height; |
144 |
uint16 length; |
145 |
uint32 stamp; |
146 |
} |
147 |
CELLHEADER; |
148 |
|
149 |
#define MAX_CBSIZE 256 |
150 |
|
151 |
/* RDPSND */ |
152 |
typedef struct |
153 |
{ |
154 |
uint16 wFormatTag; |
155 |
uint16 nChannels; |
156 |
uint32 nSamplesPerSec; |
157 |
uint32 nAvgBytesPerSec; |
158 |
uint16 nBlockAlign; |
159 |
uint16 wBitsPerSample; |
160 |
uint16 cbSize; |
161 |
uint8 cb[MAX_CBSIZE]; |
162 |
} WAVEFORMATEX; |
163 |
|
164 |
typedef struct _RDPCOMP |
165 |
{ |
166 |
uint32 roff; |
167 |
uint8 hist[RDP_MPPC_DICT_SIZE]; |
168 |
struct stream ns; |
169 |
} |
170 |
RDPCOMP; |
171 |
|
172 |
/* RDPDR */ |
173 |
typedef uint32 NTSTATUS; |
174 |
typedef uint32 NTHANDLE; |
175 |
|
176 |
typedef struct _DEVICE_FNS |
177 |
{ |
178 |
NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode, |
179 |
uint32 create_disposition, uint32 flags_and_attributes, char *filename, |
180 |
NTHANDLE * handle); |
181 |
NTSTATUS(*close) (NTHANDLE handle); |
182 |
NTSTATUS(*read) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, |
183 |
uint32 * result); |
184 |
NTSTATUS(*write) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, |
185 |
uint32 * result); |
186 |
NTSTATUS(*device_control) (NTHANDLE handle, uint32 request, STREAM in, STREAM out); |
187 |
} |
188 |
DEVICE_FNS; |
189 |
|
190 |
|
191 |
typedef struct rdpdr_device_info |
192 |
{ |
193 |
uint32 device_type; |
194 |
NTHANDLE handle; |
195 |
char name[8]; |
196 |
char *local_path; |
197 |
void *pdevice_data; |
198 |
} |
199 |
RDPDR_DEVICE; |
200 |
|
201 |
typedef struct rdpdr_serial_device_info |
202 |
{ |
203 |
int dtr; |
204 |
int rts; |
205 |
uint32 control, xonoff, onlimit, offlimit; |
206 |
uint32 baud_rate, |
207 |
queue_in_size, |
208 |
queue_out_size, |
209 |
wait_mask, |
210 |
read_interval_timeout, |
211 |
read_total_timeout_multiplier, |
212 |
read_total_timeout_constant, |
213 |
write_total_timeout_multiplier, write_total_timeout_constant, posix_wait_mask; |
214 |
uint8 stop_bits, parity, word_length; |
215 |
uint8 chars[6]; |
216 |
struct termios *ptermios, *pold_termios; |
217 |
int event_txempty, event_cts, event_dsr, event_rlsd, event_pending; |
218 |
} |
219 |
SERIAL_DEVICE; |
220 |
|
221 |
typedef struct rdpdr_parallel_device_info |
222 |
{ |
223 |
char *driver, *printer; |
224 |
uint32 queue_in_size, |
225 |
queue_out_size, |
226 |
wait_mask, |
227 |
read_interval_timeout, |
228 |
read_total_timeout_multiplier, |
229 |
read_total_timeout_constant, |
230 |
write_total_timeout_multiplier, |
231 |
write_total_timeout_constant, posix_wait_mask, bloblen; |
232 |
uint8 *blob; |
233 |
} |
234 |
PARALLEL_DEVICE; |
235 |
|
236 |
typedef struct rdpdr_printer_info |
237 |
{ |
238 |
FILE *printer_fp; |
239 |
char *driver, *printer; |
240 |
uint32 bloblen; |
241 |
uint8 *blob; |
242 |
BOOL default_printer; |
243 |
} |
244 |
PRINTER; |
245 |
|
246 |
typedef struct notify_data |
247 |
{ |
248 |
time_t modify_time; |
249 |
time_t status_time; |
250 |
time_t total_time; |
251 |
unsigned int num_entries; |
252 |
} |
253 |
NOTIFY; |
254 |
|
255 |
#ifndef PATH_MAX |
256 |
#define PATH_MAX 256 |
257 |
#endif |
258 |
|
259 |
typedef struct fileinfo |
260 |
{ |
261 |
uint32 device_id, flags_and_attributes, accessmask; |
262 |
char path[PATH_MAX]; |
263 |
DIR *pdir; |
264 |
struct dirent *pdirent; |
265 |
char pattern[PATH_MAX]; |
266 |
BOOL delete_on_close; |
267 |
NOTIFY notify; |
268 |
uint32 info_class; |
269 |
} |
270 |
FILEINFO; |
271 |
|
272 |
typedef BOOL(*str_handle_lines_t) (const char *line, void *data); |