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