[LT2013]
[reactos.git] / modules / rosapps / applications / net / tsclient / rdesktop / orders.h
1 /*
2 rdesktop: A Remote Desktop Protocol client.
3 RDP order processing
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 along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #ifndef RDESKTOP_ORDERS_H
22 #define RDESKTOP_ORDERS_H
23
24 #define RDP_ORDER_STANDARD 0x01
25 #define RDP_ORDER_SECONDARY 0x02
26 #define RDP_ORDER_BOUNDS 0x04
27 #define RDP_ORDER_CHANGE 0x08
28 #define RDP_ORDER_DELTA 0x10
29 #define RDP_ORDER_LASTBOUNDS 0x20
30 #define RDP_ORDER_SMALL 0x40
31 #define RDP_ORDER_TINY 0x80
32
33 enum RDP_ORDER_TYPE
34 {
35 RDP_ORDER_DESTBLT = 0,
36 RDP_ORDER_PATBLT = 1,
37 RDP_ORDER_SCREENBLT = 2,
38 RDP_ORDER_LINE = 9,
39 RDP_ORDER_RECT = 10,
40 RDP_ORDER_DESKSAVE = 11,
41 RDP_ORDER_MEMBLT = 13,
42 RDP_ORDER_TRIBLT = 14,
43 RDP_ORDER_POLYGON = 20,
44 RDP_ORDER_POLYGON2 = 21,
45 RDP_ORDER_POLYLINE = 22,
46 RDP_ORDER_ELLIPSE = 25,
47 RDP_ORDER_ELLIPSE2 = 26,
48 RDP_ORDER_TEXT2 = 27
49 };
50
51 enum RDP_SECONDARY_ORDER_TYPE
52 {
53 RDP_ORDER_RAW_BMPCACHE = 0,
54 RDP_ORDER_COLCACHE = 1,
55 RDP_ORDER_BMPCACHE = 2,
56 RDP_ORDER_FONTCACHE = 3,
57 RDP_ORDER_RAW_BMPCACHE2 = 4,
58 RDP_ORDER_BMPCACHE2 = 5,
59 RDP_ORDER_BRUSHCACHE = 7
60 };
61
62 typedef struct _DESTBLT_ORDER
63 {
64 sint16 x;
65 sint16 y;
66 sint16 cx;
67 sint16 cy;
68 uint8 opcode;
69
70 }
71 DESTBLT_ORDER;
72
73 typedef struct _PATBLT_ORDER
74 {
75 sint16 x;
76 sint16 y;
77 sint16 cx;
78 sint16 cy;
79 uint8 opcode;
80 uint32 bgcolour;
81 uint32 fgcolour;
82 BRUSH brush;
83
84 }
85 PATBLT_ORDER;
86
87 typedef struct _SCREENBLT_ORDER
88 {
89 sint16 x;
90 sint16 y;
91 sint16 cx;
92 sint16 cy;
93 uint8 opcode;
94 sint16 srcx;
95 sint16 srcy;
96
97 }
98 SCREENBLT_ORDER;
99
100 typedef struct _LINE_ORDER
101 {
102 uint16 mixmode;
103 sint16 startx;
104 sint16 starty;
105 sint16 endx;
106 sint16 endy;
107 uint32 bgcolour;
108 uint8 opcode;
109 PEN pen;
110
111 }
112 LINE_ORDER;
113
114 typedef struct _RECT_ORDER
115 {
116 sint16 x;
117 sint16 y;
118 sint16 cx;
119 sint16 cy;
120 uint32 colour;
121
122 }
123 RECT_ORDER;
124
125 typedef struct _DESKSAVE_ORDER
126 {
127 uint32 offset;
128 sint16 left;
129 sint16 top;
130 sint16 right;
131 sint16 bottom;
132 uint8 action;
133
134 }
135 DESKSAVE_ORDER;
136
137 typedef struct _TRIBLT_ORDER
138 {
139 uint8 colour_table;
140 uint8 cache_id;
141 sint16 x;
142 sint16 y;
143 sint16 cx;
144 sint16 cy;
145 uint8 opcode;
146 sint16 srcx;
147 sint16 srcy;
148 uint32 bgcolour;
149 uint32 fgcolour;
150 BRUSH brush;
151 uint16 cache_idx;
152 uint16 unknown;
153
154 }
155 TRIBLT_ORDER;
156
157 typedef struct _MEMBLT_ORDER
158 {
159 uint8 colour_table;
160 uint8 cache_id;
161 sint16 x;
162 sint16 y;
163 sint16 cx;
164 sint16 cy;
165 uint8 opcode;
166 sint16 srcx;
167 sint16 srcy;
168 uint16 cache_idx;
169
170 }
171 MEMBLT_ORDER;
172
173 #define MAX_DATA 256
174
175 typedef struct _POLYGON_ORDER
176 {
177 sint16 x;
178 sint16 y;
179 uint8 opcode;
180 uint8 fillmode;
181 uint32 fgcolour;
182 uint8 npoints;
183 uint8 datasize;
184 uint8 data[MAX_DATA];
185
186 }
187 POLYGON_ORDER;
188
189 typedef struct _POLYGON2_ORDER
190 {
191 sint16 x;
192 sint16 y;
193 uint8 opcode;
194 uint8 fillmode;
195 uint32 bgcolour;
196 uint32 fgcolour;
197 BRUSH brush;
198 uint8 npoints;
199 uint8 datasize;
200 uint8 data[MAX_DATA];
201
202 }
203 POLYGON2_ORDER;
204
205 typedef struct _POLYLINE_ORDER
206 {
207 sint16 x;
208 sint16 y;
209 uint8 opcode;
210 uint32 fgcolour;
211 uint8 lines;
212 uint8 datasize;
213 uint8 data[MAX_DATA];
214
215 }
216 POLYLINE_ORDER;
217
218 typedef struct _ELLIPSE_ORDER
219 {
220 sint16 left;
221 sint16 top;
222 sint16 right;
223 sint16 bottom;
224 uint8 opcode;
225 uint8 fillmode;
226 uint32 fgcolour;
227
228 }
229 ELLIPSE_ORDER;
230
231 typedef struct _ELLIPSE2_ORDER
232 {
233 sint16 left;
234 sint16 top;
235 sint16 right;
236 sint16 bottom;
237 uint8 opcode;
238 uint8 fillmode;
239 BRUSH brush;
240 uint32 bgcolour;
241 uint32 fgcolour;
242
243 }
244 ELLIPSE2_ORDER;
245
246 #define MAX_TEXT 256
247
248 typedef struct _TEXT2_ORDER
249 {
250 uint8 font;
251 uint8 flags;
252 uint8 opcode;
253 uint8 mixmode;
254 uint32 bgcolour;
255 uint32 fgcolour;
256 sint16 clipleft;
257 sint16 cliptop;
258 sint16 clipright;
259 sint16 clipbottom;
260 sint16 boxleft;
261 sint16 boxtop;
262 sint16 boxright;
263 sint16 boxbottom;
264 BRUSH brush;
265 sint16 x;
266 sint16 y;
267 uint8 length;
268 uint8 text[MAX_TEXT];
269
270 }
271 TEXT2_ORDER;
272
273 typedef struct _RDP_ORDER_STATE
274 {
275 uint8 order_type;
276 BOUNDS bounds;
277
278 DESTBLT_ORDER destblt;
279 PATBLT_ORDER patblt;
280 SCREENBLT_ORDER screenblt;
281 LINE_ORDER line;
282 RECT_ORDER rect;
283 DESKSAVE_ORDER desksave;
284 MEMBLT_ORDER memblt;
285 TRIBLT_ORDER triblt;
286 POLYGON_ORDER polygon;
287 POLYGON2_ORDER polygon2;
288 POLYLINE_ORDER polyline;
289 ELLIPSE_ORDER ellipse;
290 ELLIPSE2_ORDER ellipse2;
291 TEXT2_ORDER text2;
292
293 }
294 RDP_ORDER_STATE;
295
296 typedef struct _RDP_RAW_BMPCACHE_ORDER
297 {
298 uint8 cache_id;
299 uint8 pad1;
300 uint8 width;
301 uint8 height;
302 uint8 bpp;
303 uint16 bufsize;
304 uint16 cache_idx;
305 uint8 *data;
306
307 }
308 RDP_RAW_BMPCACHE_ORDER;
309
310 typedef struct _RDP_BMPCACHE_ORDER
311 {
312 uint8 cache_id;
313 uint8 pad1;
314 uint8 width;
315 uint8 height;
316 uint8 bpp;
317 uint16 bufsize;
318 uint16 cache_idx;
319 uint16 pad2;
320 uint16 size;
321 uint16 row_size;
322 uint16 final_size;
323 uint8 *data;
324
325 }
326 RDP_BMPCACHE_ORDER;
327
328 /* RDP_BMPCACHE2_ORDER */
329 #define ID_MASK 0x0007
330 #define MODE_MASK 0x0038
331 #define SQUARE 0x0080
332 #define PERSIST 0x0100
333 #define FLAG_51_UNKNOWN 0x0800
334
335 #define MODE_SHIFT 3
336
337 #define LONG_FORMAT 0x80
338 #define BUFSIZE_MASK 0x3FFF /* or 0x1FFF? */
339
340 #define MAX_GLYPH 32
341
342 typedef struct _RDP_FONT_GLYPH
343 {
344 uint16 character;
345 uint16 unknown;
346 uint16 baseline;
347 uint16 width;
348 uint16 height;
349 uint8 data[MAX_GLYPH];
350
351 }
352 RDP_FONT_GLYPH;
353
354 #define MAX_GLYPHS 256
355
356 typedef struct _RDP_FONTCACHE_ORDER
357 {
358 uint8 font;
359 uint8 nglyphs;
360 RDP_FONT_GLYPH glyphs[MAX_GLYPHS];
361
362 }
363 RDP_FONTCACHE_ORDER;
364
365 typedef struct _RDP_COLCACHE_ORDER
366 {
367 uint8 cache_id;
368 COLOURMAP map;
369
370 }
371 RDP_COLCACHE_ORDER;
372
373 #endif