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>
29#if defined(WITH_RDPEUDP)
30#include "udplistener.h"
38typedef struct rdp_emt rdpEmt;
45 RDPEMT_EVENT_AUTODETECT,
48 RDPEMT_EVENT_SYN_RECEIVED,
49 RDPEMT_EVENT_WRITABLE,
50 RDPEMT_EVENT_RESPONSE_DUE
55#define RDPEMT_SERVER_RESPONSE_TIMEOUT_MS 30000
59typedef void (*rdpEmtEventFn)(
void* custom, rdpEmt* emt, RDPEMT_EVENT event,
const BYTE* data,
64typedef BOOL (*rdpEmtReceiverFn)(
void* custom,
wStream* s);
68typedef BOOL (*rdpEmtHoldFn)(
void* custom);
70#if defined(WITH_RDPEUDP)
74FREERDP_LOCAL BOOL rdpemt_is_supported(
void);
76FREERDP_LOCAL
void rdpemt_free(rdpEmt* emt);
85WINPR_ATTR_MALLOC(rdpemt_free, 1)
87FREERDP_LOCAL rdpEmt* rdpemt_new(wLog* log, UINT32 requestId, const BYTE* cookie,
88 const
char* hostname, const BYTE* publicKey,
89 size_t publicKeyLength, rdpEmtEventFn callback,
void* custom);
92FREERDP_LOCAL BOOL rdpemt_start(rdpEmt* emt, const struct sockaddr* addr,
size_t addrlen);
94#if defined(WITH_RDPEUDP_SERVER)
101WINPR_ATTR_MALLOC(rdpemt_free, 1)
103FREERDP_LOCAL rdpEmt* rdpemt_new_server(wLog* log, UINT32 requestId, const BYTE* cookie,
104 struct rdp_certificate* cert,
105 const struct rdp_private_key* key, BOOL manual,
106 rdpEmtEventFn callback,
void* custom);
115FREERDP_LOCAL BOOL rdpemt_set_tls_settings(rdpEmt* emt, UINT16 minVersion, UINT16 maxVersion,
116 UINT32 secLevel,
const char* ciphers);
121FREERDP_LOCAL
void rdpemt_set_receive_hold(rdpEmt* emt, rdpEmtHoldFn hold);
125FREERDP_LOCAL BOOL rdpemt_has_failed(rdpEmt* emt);
127#if defined(WITH_RDPEUDP_SERVER)
130FREERDP_LOCAL rdpUdpFlow* rdpemt_get_flow(
const rdpEmt* emt);
134FREERDP_LOCAL
void rdpemt_get_send_state(rdpEmt* emt,
rdpUdpSendState* state);
138FREERDP_LOCAL
void rdpemt_set_send_limit(rdpEmt* emt,
size_t limit);
142FREERDP_LOCAL BOOL rdpemt_send_data(rdpEmt* emt,
const BYTE* data,
size_t length);
147FREERDP_LOCAL BOOL rdpemt_send_subheader(rdpEmt* emt,
const BYTE* subHeader,
size_t length);
151FREERDP_LOCAL BOOL rdpemt_flush(rdpEmt* emt);
154FREERDP_LOCAL UINT32 rdpemt_get_request_id(
const rdpEmt* emt);
158FREERDP_LOCAL UINT32 rdpemt_get_serial(
const rdpEmt* emt);
166FREERDP_LOCAL BOOL rdpemt_set_receiver(rdpEmt* emt, rdpEmtReceiverFn receiver,
void* custom,
171FREERDP_LOCAL
void rdpemt_clear_receiver(rdpEmt* emt);
176FREERDP_LOCAL UINT32 rdpemt_take_direct_bytes(rdpEmt* emt);
182static inline BOOL rdpemt_is_supported(
void)
187static inline void rdpemt_free(WINPR_ATTR_UNUSED rdpEmt* emt)
193rdpemt_new(WINPR_ATTR_UNUSED wLog* log, WINPR_ATTR_UNUSED UINT32 requestId,
194 WINPR_ATTR_UNUSED
const BYTE* cookie, WINPR_ATTR_UNUSED
const char* hostname,
195 WINPR_ATTR_UNUSED
const BYTE* publicKey, WINPR_ATTR_UNUSED
size_t publicKeyLength,
196 WINPR_ATTR_UNUSED rdpEmtEventFn callback, WINPR_ATTR_UNUSED
void* custom)
202static inline BOOL rdpemt_start(WINPR_ATTR_UNUSED rdpEmt* emt,
203 WINPR_ATTR_UNUSED
const struct sockaddr* addr,
204 WINPR_ATTR_UNUSED
size_t addrlen)
210static inline BOOL rdpemt_send_data(WINPR_ATTR_UNUSED rdpEmt* emt,
211 WINPR_ATTR_UNUSED
const BYTE* data,
212 WINPR_ATTR_UNUSED
size_t length)
218static inline BOOL rdpemt_send_subheader(WINPR_ATTR_UNUSED rdpEmt* emt,
219 WINPR_ATTR_UNUSED
const BYTE* subHeader,
220 WINPR_ATTR_UNUSED
size_t length)
226static inline UINT32 rdpemt_get_request_id(WINPR_ATTR_UNUSED
const rdpEmt* emt)
232static inline UINT32 rdpemt_get_serial(WINPR_ATTR_UNUSED
const rdpEmt* emt)
238static inline BOOL rdpemt_set_receiver(WINPR_ATTR_UNUSED rdpEmt* emt,
239 WINPR_ATTR_UNUSED rdpEmtReceiverFn receiver,
240 WINPR_ATTR_UNUSED
void* custom,
241 WINPR_ATTR_UNUSED wQueue* pending)
246static inline void rdpemt_clear_receiver(WINPR_ATTR_UNUSED rdpEmt* emt)
251static inline BOOL rdpemt_flush(WINPR_ATTR_UNUSED rdpEmt* emt)
Comprehensive UDP send state information, including additional metrics.