20 #ifndef FREERDP_LIB_CORE_GATEWAY_RTS_H
21 #define FREERDP_LIB_CORE_GATEWAY_RTS_H
23 #include <freerdp/config.h>
25 #include <winpr/stream.h>
27 #include <freerdp/api.h>
28 #include <freerdp/types.h>
29 #include <freerdp/log.h>
33 #define RTS_FLAG_NONE 0x0000
34 #define RTS_FLAG_PING 0x0001
35 #define RTS_FLAG_OTHER_CMD 0x0002
36 #define RTS_FLAG_RECYCLE_CHANNEL 0x0004
37 #define RTS_FLAG_IN_CHANNEL 0x0008
38 #define RTS_FLAG_OUT_CHANNEL 0x0010
39 #define RTS_FLAG_EOF 0x0020
40 #define RTS_FLAG_ECHO 0x0040
42 #define RTS_CMD_RECEIVE_WINDOW_SIZE 0x00000000
43 #define RTS_CMD_FLOW_CONTROL_ACK 0x00000001
44 #define RTS_CMD_CONNECTION_TIMEOUT 0x00000002
45 #define RTS_CMD_COOKIE 0x00000003
46 #define RTS_CMD_CHANNEL_LIFETIME 0x00000004
47 #define RTS_CMD_CLIENT_KEEPALIVE 0x00000005
48 #define RTS_CMD_VERSION 0x00000006
49 #define RTS_CMD_EMPTY 0x00000007
50 #define RTS_CMD_PADDING 0x00000008
51 #define RTS_CMD_NEGATIVE_ANCE 0x00000009
52 #define RTS_CMD_ANCE 0x0000000A
53 #define RTS_CMD_CLIENT_ADDRESS 0x0000000B
54 #define RTS_CMD_ASSOCIATION_GROUP_ID 0x0000000C
55 #define RTS_CMD_DESTINATION 0x0000000D
56 #define RTS_CMD_PING_TRAFFIC_SENT_NOTIFY 0x0000000E
57 #define RTS_CMD_LAST_ID 0x0000000F
59 #define RTS_CMD_RECEIVE_WINDOW_SIZE_LENGTH 0x00000004
60 #define RTS_CMD_FLOW_CONTROL_ACK_LENGTH 0x00000018
61 #define RTS_CMD_CONNECTION_TIMEOUT_LENGTH 0x00000004
62 #define RTS_CMD_COOKIE_LENGTH 0x00000010
63 #define RTS_CMD_CHANNEL_LIFETIME_LENGTH 0x00000004
64 #define RTS_CMD_CLIENT_KEEPALIVE_LENGTH 0x00000004
65 #define RTS_CMD_VERSION_LENGTH 0x00000004
66 #define RTS_CMD_EMPTY_LENGTH 0x00000000
67 #define RTS_CMD_PADDING_LENGTH 0x00000000
68 #define RTS_CMD_NEGATIVE_ANCE_LENGTH 0x00000000
69 #define RTS_CMD_ANCE_LENGTH 0x00000000
70 #define RTS_CMD_CLIENT_ADDRESS_LENGTH 0x00000000
71 #define RTS_CMD_ASSOCIATION_GROUP_ID_LENGTH 0x00000010
72 #define RTS_CMD_DESTINATION_LENGTH 0x00000004
73 #define RTS_CMD_PING_TRAFFIC_SENT_NOTIFY_LENGTH 0x00000004
75 #define FDClient 0x00000000
76 #define FDInProxy 0x00000001
77 #define FDServer 0x00000002
78 #define FDOutProxy 0x00000003
80 FREERDP_LOCAL
void rts_generate_cookie(BYTE* cookie);
87 FREERDP_LOCAL
void rts_free_pdu_header(
rpcconn_hdr_t* header, BOOL allocated);
92 FREERDP_LOCAL BOOL rts_command_length(UINT32 CommandType,
wStream* s,
size_t* length, BOOL silent);
94 FREERDP_LOCAL BOOL rts_send_CONN_A1_pdu(rdpRpc* rpc);
95 FREERDP_LOCAL BOOL rts_recv_CONN_A3_pdu(rdpRpc* rpc,
wStream* buffer);
97 FREERDP_LOCAL BOOL rts_send_CONN_B1_pdu(rdpRpc* rpc);
99 FREERDP_LOCAL BOOL rts_recv_CONN_C2_pdu(rdpRpc* rpc,
wStream* buffer);
101 FREERDP_LOCAL BOOL rts_send_OUT_R1_A3_pdu(rdpRpc* rpc);
103 FREERDP_LOCAL BOOL rts_send_flow_control_ack_pdu(rdpRpc* rpc);
105 FREERDP_LOCAL BOOL rts_recv_out_of_sequence_pdu(rdpRpc* rpc,
wStream* buffer,
108 FREERDP_LOCAL BOOL rts_recv_ping_pdu(rdpRpc* rpc,
wStream* s);
110 #define Stream_ConditionalCheckAndLogRequiredLength(tag, s, size, silent) \
111 rts_conditional_check_and_log(tag, s, size, silent, __func__, __FILE__, __LINE__)
113 FREERDP_LOCAL BOOL rts_conditional_check_and_log(
const char* tag,
wStream* s,
size_t size,
114 BOOL silent,
const char* fkt,
const char* file,
117 #define Stream_ConditionalSafeSeek(s, size, silent) \
118 rts_conditional_safe_seek(s, size, silent, __func__, __FILE__, __LINE__)
120 FREERDP_LOCAL BOOL rts_conditional_safe_seek(
wStream* s,
size_t size, BOOL silent,
const char* fkt,
121 const char* file,
size_t line);