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