FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
fastpath.h
1
20#ifndef FREERDP_LIB_CORE_FASTPATH_H
21#define FREERDP_LIB_CORE_FASTPATH_H
22
23/*
24 * Fast-Path has 15 bits available for length information which would lead to a
25 * maximal pdu size of 0x8000. However in practice only 14 bits are used
26 * this isn't documented anywhere but it looks like most implementations will
27 * fail if fast-path packages > 0x3FFF arrive.
28 */
29#define FASTPATH_MAX_PACKET_SIZE 0x3FFF
30
31/*
32 * The following size guarantees that no fast-path PDU fragmentation occurs.
33 * It was calculated by subtracting 128 from FASTPATH_MAX_PACKET_SIZE.
34 * 128 was chosen because it includes all required and optional headers as well as
35 * possible paddings and some extra bytes for safety.
36 */
37#define FASTPATH_FRAGMENT_SAFE_SIZE 0x3F80
38
39typedef struct rdp_fastpath rdpFastPath;
40
41#include "rdp.h"
42
43#include <winpr/stream.h>
44#include <freerdp/api.h>
45
46enum FASTPATH_INPUT_ACTION_TYPE
47{
48 FASTPATH_INPUT_ACTION_FASTPATH = 0x0,
49 FASTPATH_INPUT_ACTION_X224 = 0x3
50};
51
52enum FASTPATH_OUTPUT_ACTION_TYPE
53{
54 FASTPATH_OUTPUT_ACTION_FASTPATH = 0x0,
55 FASTPATH_OUTPUT_ACTION_X224 = 0x3
56};
57
58enum FASTPATH_UPDATETYPE
59{
60 FASTPATH_UPDATETYPE_ORDERS = 0x0,
61 FASTPATH_UPDATETYPE_BITMAP = 0x1,
62 FASTPATH_UPDATETYPE_PALETTE = 0x2,
63 FASTPATH_UPDATETYPE_SYNCHRONIZE = 0x3,
64 FASTPATH_UPDATETYPE_SURFCMDS = 0x4,
65 FASTPATH_UPDATETYPE_PTR_NULL = 0x5,
66 FASTPATH_UPDATETYPE_PTR_DEFAULT = 0x6,
67 FASTPATH_UPDATETYPE_PTR_POSITION = 0x8,
68 FASTPATH_UPDATETYPE_COLOR = 0x9,
69 FASTPATH_UPDATETYPE_CACHED = 0xA,
70 FASTPATH_UPDATETYPE_POINTER = 0xB,
71 FASTPATH_UPDATETYPE_LARGE_POINTER = 0xC
72};
73
74enum FASTPATH_FRAGMENT
75{
76 FASTPATH_FRAGMENT_SINGLE = 0x0,
77 FASTPATH_FRAGMENT_LAST = 0x1,
78 FASTPATH_FRAGMENT_FIRST = 0x2,
79 FASTPATH_FRAGMENT_NEXT = 0x3
80};
81
82enum FASTPATH_OUTPUT_COMPRESSION
83{
84 FASTPATH_OUTPUT_COMPRESSION_USED = 0x2
85};
86
87/* FastPath Input Events */
88enum FASTPATH_INPUT_EVENT_CODE
89{
90 FASTPATH_INPUT_EVENT_SCANCODE = 0x0,
91 FASTPATH_INPUT_EVENT_MOUSE = 0x1,
92 FASTPATH_INPUT_EVENT_MOUSEX = 0x2,
93 FASTPATH_INPUT_EVENT_SYNC = 0x3,
94 FASTPATH_INPUT_EVENT_UNICODE = 0x4,
95 TS_FP_RELPOINTER_EVENT = 0x5,
96 TS_FP_QOETIMESTAMP_EVENT = 0x6
97};
98
99/* FastPath Keyboard Event Flags */
100enum FASTPATH_INPUT_KBDFLAGS
101{
102 FASTPATH_INPUT_KBDFLAGS_RELEASE = 0x01,
103 FASTPATH_INPUT_KBDFLAGS_EXTENDED = 0x02,
104 FASTPATH_INPUT_KBDFLAGS_PREFIX_E1 = 0x04 /* for pause sequence */
105};
106
107typedef struct
108{
109 BYTE length1;
110 BYTE length2;
111 BYTE fipsInformation[4];
112 BYTE dataSignature[8];
113
114 BYTE action;
115 BYTE secFlags;
116 UINT16 length;
118
119typedef struct
120{
121 BYTE compressionFlags;
122 UINT16 size;
123
124 BYTE updateCode;
125 BYTE fragmentation;
126 BYTE compression;
128
129FREERDP_LOCAL BOOL fastpath_read_header_rdp(rdpFastPath* fastpath, wStream* s, UINT16* length);
130FREERDP_LOCAL state_run_t fastpath_recv_updates(rdpFastPath* fastpath, wStream* s);
131FREERDP_LOCAL state_run_t fastpath_recv_inputs(rdpFastPath* fastpath, wStream* s);
132
133FREERDP_LOCAL BOOL fastpath_decrypt(rdpFastPath* fastpath, wStream* s, UINT16* length);
134
135FREERDP_LOCAL wStream* fastpath_input_pdu_init_header(rdpFastPath* fastpath);
136FREERDP_LOCAL wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags,
137 BYTE eventCode);
138FREERDP_LOCAL BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s,
139 size_t iEventCount);
140FREERDP_LOCAL BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s);
141
142WINPR_ATTR_MALLOC(Stream_Release, 1)
143FREERDP_LOCAL wStream* fastpath_update_pdu_init(rdpFastPath* fastpath);
144
145WINPR_ATTR_MALLOC(Stream_Free, 1)
146FREERDP_LOCAL wStream* fastpath_update_pdu_init_new(rdpFastPath* fastpath);
147FREERDP_LOCAL BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s,
148 BOOL skipCompression);
149
150FREERDP_LOCAL BOOL fastpath_send_surfcmd_frame_marker(rdpFastPath* fastpath, UINT16 frameAction,
151 UINT32 frameId);
152FREERDP_LOCAL BYTE fastpath_get_encryption_flags(rdpFastPath* fastpath);
153
154FREERDP_LOCAL rdpFastPath* fastpath_new(rdpRdp* rdp);
155FREERDP_LOCAL void fastpath_free(rdpFastPath* fastpath);
156
157#endif /* FREERDP_LIB_CORE_FASTPATH_H */