FreeRDP
Loading...
Searching...
No Matches
rdpemt.h
1
18#ifndef FREERDP_LIB_CORE_RDPEMT_H
19#define FREERDP_LIB_CORE_RDPEMT_H
20
21#include <winpr/wtypes.h>
22#include <winpr/winsock.h>
23#include <winpr/wlog.h>
24#include <winpr/stream.h>
25#include <winpr/collections.h>
26
27#include <freerdp/config.h>
28#include <freerdp/api.h>
29
35typedef struct rdp_emt rdpEmt;
36
37typedef enum
38{
39 RDPEMT_EVENT_READY,
40 RDPEMT_EVENT_FAILED,
41 RDPEMT_EVENT_DATA,
42 RDPEMT_EVENT_AUTODETECT_REQUEST
44} RDPEMT_EVENT;
45
48typedef void (*rdpEmtEventFn)(void* custom, rdpEmt* emt, RDPEMT_EVENT event, const BYTE* data,
49 size_t length);
50
53typedef BOOL (*rdpEmtReceiverFn)(void* custom, wStream* s);
54
55#if defined(WITH_RDPEUDP)
56
58WINPR_ATTR_NODISCARD
59FREERDP_LOCAL BOOL rdpemt_is_supported(void);
60
61FREERDP_LOCAL void rdpemt_free(rdpEmt* emt);
62
70WINPR_ATTR_MALLOC(rdpemt_free, 1)
71WINPR_ATTR_NODISCARD
72FREERDP_LOCAL rdpEmt* rdpemt_new(wLog* log, UINT32 requestId, const BYTE* cookie,
73 const char* hostname, const BYTE* publicKey,
74 size_t publicKeyLength, rdpEmtEventFn callback, void* custom);
75
76WINPR_ATTR_NODISCARD
77FREERDP_LOCAL BOOL rdpemt_start(rdpEmt* emt, const struct sockaddr* addr, size_t addrlen);
78
80WINPR_ATTR_NODISCARD
81FREERDP_LOCAL BOOL rdpemt_send_data(rdpEmt* emt, const BYTE* data, size_t length);
82
85WINPR_ATTR_NODISCARD
86FREERDP_LOCAL BOOL rdpemt_send_subheader(rdpEmt* emt, const BYTE* subHeader, size_t length);
87
88WINPR_ATTR_NODISCARD
89FREERDP_LOCAL UINT32 rdpemt_get_request_id(const rdpEmt* emt);
90
96WINPR_ATTR_NODISCARD
97FREERDP_LOCAL BOOL rdpemt_set_receiver(rdpEmt* emt, rdpEmtReceiverFn receiver, void* custom,
98 wQueue* pending);
99
102FREERDP_LOCAL void rdpemt_clear_receiver(rdpEmt* emt);
103
106WINPR_ATTR_NODISCARD
107FREERDP_LOCAL UINT32 rdpemt_take_direct_bytes(rdpEmt* emt);
108
109#else
110
111/* Built without UDP multitransport: requests are declined and no tunnel ever exists. */
112WINPR_ATTR_NODISCARD
113static inline BOOL rdpemt_is_supported(void)
114{
115 return FALSE;
116}
117
118static inline void rdpemt_free(WINPR_ATTR_UNUSED rdpEmt* emt)
119{
120}
121
122WINPR_ATTR_NODISCARD
123static inline rdpEmt*
124rdpemt_new(WINPR_ATTR_UNUSED wLog* log, WINPR_ATTR_UNUSED UINT32 requestId,
125 WINPR_ATTR_UNUSED const BYTE* cookie, WINPR_ATTR_UNUSED const char* hostname,
126 WINPR_ATTR_UNUSED const BYTE* publicKey, WINPR_ATTR_UNUSED size_t publicKeyLength,
127 WINPR_ATTR_UNUSED rdpEmtEventFn callback, WINPR_ATTR_UNUSED void* custom)
128{
129 return nullptr;
130}
131
132WINPR_ATTR_NODISCARD
133static inline BOOL rdpemt_start(WINPR_ATTR_UNUSED rdpEmt* emt,
134 WINPR_ATTR_UNUSED const struct sockaddr* addr,
135 WINPR_ATTR_UNUSED size_t addrlen)
136{
137 return FALSE;
138}
139
140WINPR_ATTR_NODISCARD
141static inline BOOL rdpemt_send_data(WINPR_ATTR_UNUSED rdpEmt* emt,
142 WINPR_ATTR_UNUSED const BYTE* data,
143 WINPR_ATTR_UNUSED size_t length)
144{
145 return FALSE;
146}
147
148WINPR_ATTR_NODISCARD
149static inline BOOL rdpemt_send_subheader(WINPR_ATTR_UNUSED rdpEmt* emt,
150 WINPR_ATTR_UNUSED const BYTE* subHeader,
151 WINPR_ATTR_UNUSED size_t length)
152{
153 return FALSE;
154}
155
156WINPR_ATTR_NODISCARD
157static inline UINT32 rdpemt_get_request_id(WINPR_ATTR_UNUSED const rdpEmt* emt)
158{
159 return 0;
160}
161
162WINPR_ATTR_NODISCARD
163static inline BOOL rdpemt_set_receiver(WINPR_ATTR_UNUSED rdpEmt* emt,
164 WINPR_ATTR_UNUSED rdpEmtReceiverFn receiver,
165 WINPR_ATTR_UNUSED void* custom,
166 WINPR_ATTR_UNUSED wQueue* pending)
167{
168 return FALSE;
169}
170
171static inline void rdpemt_clear_receiver(WINPR_ATTR_UNUSED rdpEmt* emt)
172{
173}
174
175#endif
176
177#endif /* FREERDP_LIB_CORE_RDPEMT_H */