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