18#ifndef FREERDP_LIB_CORE_RDPEMT_H
19#define FREERDP_LIB_CORE_RDPEMT_H
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>
27#include <freerdp/config.h>
28#include <freerdp/api.h>
35typedef struct rdp_emt rdpEmt;
42 RDPEMT_EVENT_AUTODETECT_REQUEST
48typedef void (*rdpEmtEventFn)(
void* custom, rdpEmt* emt, RDPEMT_EVENT event,
const BYTE* data,
53typedef BOOL (*rdpEmtReceiverFn)(
void* custom,
wStream* s);
55#if defined(WITH_RDPEUDP)
59FREERDP_LOCAL BOOL rdpemt_is_supported(
void);
61FREERDP_LOCAL
void rdpemt_free(rdpEmt* emt);
70WINPR_ATTR_MALLOC(rdpemt_free, 1)
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);
77FREERDP_LOCAL BOOL rdpemt_start(rdpEmt* emt, const struct sockaddr* addr,
size_t addrlen);
81FREERDP_LOCAL BOOL rdpemt_send_data(rdpEmt* emt, const BYTE* data,
size_t length);
86FREERDP_LOCAL BOOL rdpemt_send_subheader(rdpEmt* emt, const BYTE* subHeader,
size_t length);
89FREERDP_LOCAL UINT32 rdpemt_get_request_id(const rdpEmt* emt);
97FREERDP_LOCAL BOOL rdpemt_set_receiver(rdpEmt* emt, rdpEmtReceiverFn receiver,
void* custom,
102FREERDP_LOCAL
void rdpemt_clear_receiver(rdpEmt* emt);
107FREERDP_LOCAL UINT32 rdpemt_take_direct_bytes(rdpEmt* emt);
113static inline BOOL rdpemt_is_supported(
void)
118static inline void rdpemt_free(WINPR_ATTR_UNUSED rdpEmt* emt)
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)
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)
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)
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)
157static inline UINT32 rdpemt_get_request_id(WINPR_ATTR_UNUSED
const rdpEmt* emt)
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)
171static inline void rdpemt_clear_receiver(WINPR_ATTR_UNUSED rdpEmt* emt)