20 #ifndef FREERDP_LIB_CORE_TPDU_H
21 #define FREERDP_LIB_CORE_TPDU_H
23 #include <winpr/stream.h>
24 #include <freerdp/api.h>
30 X224_TPDU_CONNECTION_REQUEST = 0xE0,
31 X224_TPDU_CONNECTION_CONFIRM = 0xD0,
32 X224_TPDU_DISCONNECT_REQUEST = 0x80,
33 X224_TPDU_DATA = 0xF0,
34 X224_TPDU_ERROR = 0x70
37 #define TPDU_DATA_HEADER_LENGTH 3
38 #define TPDU_CONNECTION_REQUEST_HEADER_LENGTH 7
39 #define TPDU_CONNECTION_CONFIRM_HEADER_LENGTH 7
40 #define TPDU_DISCONNECT_REQUEST_HEADER_LENGTH 7
42 #define TPDU_DATA_LENGTH (TPKT_HEADER_LENGTH + TPDU_DATA_HEADER_LENGTH)
43 #define TPDU_CONNECTION_REQUEST_LENGTH (TPKT_HEADER_LENGTH + TPDU_CONNECTION_REQUEST_HEADER_LENGTH)
44 #define TPDU_CONNECTION_CONFIRM_LENGTH (TPKT_HEADER_LENGTH + TPDU_CONNECTION_CONFIRM_HEADER_LENGTH)
45 #define TPDU_DISCONNECT_REQUEST_LENGTH (TPKT_HEADER_LENGTH + TPDU_DISCONNECT_REQUEST_HEADER_LENGTH)
47 const char* tpdu_type_to_string(
int type);
48 FREERDP_LOCAL BOOL tpdu_read_header(
wStream* s, BYTE* code, BYTE* li, UINT16 tpktlength);
49 FREERDP_LOCAL BOOL tpdu_read_connection_request(
wStream* s, BYTE* li, UINT16 tpktlength);
50 FREERDP_LOCAL BOOL tpdu_write_connection_request(
wStream* s, UINT16 length);
51 FREERDP_LOCAL BOOL tpdu_read_connection_confirm(
wStream* s, BYTE* li, UINT16 tpktlength);
52 FREERDP_LOCAL BOOL tpdu_write_connection_confirm(
wStream* s, UINT16 length);
53 FREERDP_LOCAL BOOL tpdu_write_disconnect_request(
wStream* s, UINT16 length);
54 FREERDP_LOCAL BOOL tpdu_read_data(
wStream* s, UINT16* li, UINT16 tpktlength);
55 FREERDP_LOCAL BOOL tpdu_write_data(
wStream* s);