1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * RAIL Virtual Channel Plugin
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  * Copyright 2011 Roman Barabanov <romanbarabanov@gmail.com>
7  * Copyright 2011 Vic Lee
8  * Copyright 2015 Thincast Technologies GmbH
9  * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *     http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 
24 #ifndef FREERDP_CHANNEL_RAIL_COMMON_H
25 #define FREERDP_CHANNEL_RAIL_COMMON_H
26 
27 #include <freerdp/rail.h>
28 
29 #define RAIL_PDU_HEADER_LENGTH 4
30 
31 /* Fixed length of PDUs, excluding variable lengths */
32 #define RAIL_HANDSHAKE_ORDER_LENGTH 4             /* fixed */
33 #define RAIL_HANDSHAKE_EX_ORDER_LENGTH 8          /* fixed */
34 #define RAIL_CLIENT_STATUS_ORDER_LENGTH 4         /* fixed */
35 #define RAIL_EXEC_ORDER_LENGTH 8                  /* variable */
36 #define RAIL_EXEC_RESULT_ORDER_LENGTH 12          /* variable */
37 #define RAIL_SYSPARAM_ORDER_LENGTH 4              /* variable */
38 #define RAIL_MINMAXINFO_ORDER_LENGTH 20           /* fixed */
39 #define RAIL_LOCALMOVESIZE_ORDER_LENGTH 12        /* fixed */
40 #define RAIL_ACTIVATE_ORDER_LENGTH 5              /* fixed */
41 #define RAIL_SYSMENU_ORDER_LENGTH 8               /* fixed */
42 #define RAIL_SYSCOMMAND_ORDER_LENGTH 6            /* fixed */
43 #define RAIL_NOTIFY_EVENT_ORDER_LENGTH 12         /* fixed */
44 #define RAIL_WINDOW_MOVE_ORDER_LENGTH 12          /* fixed */
45 #define RAIL_SNAP_ARRANGE_ORDER_LENGTH 12         /* fixed */
46 #define RAIL_GET_APPID_REQ_ORDER_LENGTH 4         /* fixed */
47 #define RAIL_LANGBAR_INFO_ORDER_LENGTH 4          /* fixed */
48 #define RAIL_LANGUAGEIME_INFO_ORDER_LENGTH 42     /* fixed */
49 #define RAIL_COMPARTMENT_INFO_ORDER_LENGTH 16     /* fixed */
50 #define RAIL_CLOAK_ORDER_LENGTH 5                 /* fixed */
51 #define RAIL_TASKBAR_INFO_ORDER_LENGTH 12         /* fixed */
52 #define RAIL_Z_ORDER_SYNC_ORDER_LENGTH 4          /* fixed */
53 #define RAIL_POWER_DISPLAY_REQUEST_ORDER_LENGTH 4 /* fixed */
54 #define RAIL_GET_APPID_RESP_ORDER_LENGTH 524      /* fixed */
55 #define RAIL_GET_APPID_RESP_EX_ORDER_LENGTH 1048  /* fixed */
56 
57 UINT rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
58 void rail_write_handshake_order(wStream* s, const RAIL_HANDSHAKE_ORDER* handshake);
59 UINT rail_read_handshake_ex_order(wStream* s, RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
60 void rail_write_handshake_ex_order(wStream* s, const RAIL_HANDSHAKE_EX_ORDER* handshakeEx);
61 
62 wStream* rail_pdu_init(size_t length);
63 UINT rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength);
64 void rail_write_pdu_header(wStream* s, UINT16 orderType, UINT16 orderLength);
65 
66 UINT rail_write_unicode_string(wStream* s, const RAIL_UNICODE_STRING* unicode_string);
67 UINT rail_write_unicode_string_value(wStream* s, const RAIL_UNICODE_STRING* unicode_string);
68 
69 UINT rail_read_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam, BOOL extendedSpiSupported);
70 UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
71                                BOOL extendedSpiSupported);
72 BOOL rail_is_extended_spi_supported(UINT32 channelsFlags);
73 const char* rail_get_order_type_string(UINT16 orderType);
74 
75 #endif /* FREERDP_CHANNEL_RAIL_COMMON_H */
76