20 #ifndef FREERDP_CLIENT_H
21 #define FREERDP_CLIENT_H
23 #include <winpr/cmdline.h>
25 #include <freerdp/config.h>
26 #include <freerdp/api.h>
27 #include <freerdp/types.h>
28 #include <freerdp/event.h>
29 #include <freerdp/freerdp.h>
31 #if defined(CHANNEL_AINPUT_CLIENT)
32 #include <freerdp/client/ainput.h>
35 #if defined(CHANNEL_RDPEI_CLIENT)
36 #include <freerdp/client/rdpei.h>
39 #if defined(CHANNEL_ENCOMSP_CLIENT)
40 #include <freerdp/client/encomsp.h>
52 typedef BOOL (*pRdpGlobalInit)(void);
53 typedef void (*pRdpGlobalUninit)(void);
55 typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context);
56 typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
58 typedef int (*pRdpClientStart)(rdpContext* context);
59 typedef int (*pRdpClientStop)(rdpContext* context);
66 rdpSettings* settings;
68 pRdpGlobalInit GlobalInit;
69 pRdpGlobalUninit GlobalUninit;
72 pRdpClientNew ClientNew;
73 pRdpClientFree ClientFree;
75 pRdpClientStart ClientStart;
76 pRdpClientStop ClientStop;
79 #define RDP_CLIENT_INTERFACE_VERSION 1
80 #define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry"
82 typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
85 #define FREERDP_MAX_TOUCH_CONTACTS 10
94 ALIGN64 UINT32 pressure;
97 #define FREERDP_MAX_PEN_DEVICES 10
99 typedef struct pen_device
101 ALIGN64 INT32 deviceid;
102 ALIGN64 UINT32 flags;
103 ALIGN64
double max_pressure;
104 ALIGN64 BOOL hovering;
105 ALIGN64 BOOL pressed;
106 ALIGN64 INT32 last_x;
107 ALIGN64 INT32 last_y;
114 #if defined(CHANNEL_AINPUT_CLIENT)
115 ALIGN64 AInputClientContext* ainput;
120 #if defined(CHANNEL_RDPEI_CLIENT)
121 ALIGN64 RdpeiClientContext* rdpei;
128 ALIGN64 BOOL mouse_grabbed;
130 #if defined(CHANNEL_ENCOMSP_CLIENT)
131 ALIGN64 EncomspClientContext* encomsp;
132 ALIGN64 BOOL controlToggle;
143 FREERDP_API
void freerdp_client_context_free(rdpContext* context);
145 WINPR_ATTR_MALLOC(freerdp_client_context_free, 1)
146 FREERDP_API rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
148 FREERDP_API
int freerdp_client_start(rdpContext* context);
149 FREERDP_API
int freerdp_client_stop(rdpContext* context);
151 FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
152 FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
154 FREERDP_API
int freerdp_client_settings_parse_command_line(rdpSettings* settings,
int argc,
155 char** argv, BOOL allowUnknown);
170 FREERDP_API
int freerdp_client_settings_parse_command_line_ex(
171 rdpSettings* settings,
int argc,
char** argv, BOOL allowUnknown,
174 void* handle_userdata);
176 FREERDP_API
int freerdp_client_settings_parse_connection_file(rdpSettings* settings,
177 const
char* filename);
178 FREERDP_API
int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings,
181 FREERDP_API
int freerdp_client_settings_write_connection_file(const rdpSettings* settings,
182 const
char* filename,
185 FREERDP_API
int freerdp_client_settings_parse_assistance_file(rdpSettings* settings,
int argc,
188 FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance,
char** username,
char** password,
189 char** domain, rdp_auth_reason reason);
191 FREERDP_API BOOL client_cli_choose_smartcard(freerdp* instance,
SmartcardCertInfo** cert_list,
192 DWORD count, DWORD* choice, BOOL gateway);
194 FREERDP_API
int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
196 FREERDP_API BOOL client_cli_get_access_token(freerdp* instance, AccessTokenType tokenType,
197 char** token,
size_t count, ...);
198 FREERDP_API BOOL client_common_get_access_token(freerdp* instance, const
char* request,
201 FREERDP_API SSIZE_T client_common_retry_dialog(freerdp* instance, const
char* what,
202 size_t current,
void* userarg);
205 freerdp_client_OnChannelConnectedEventHandler(
void* context,
206 const ChannelConnectedEventArgs* e);
208 freerdp_client_OnChannelDisconnectedEventHandler(
void* context,
209 const ChannelDisconnectedEventArgs* e);
211 #if defined(WITH_FREERDP_DEPRECATED)
212 FREERDP_API WINPR_DEPRECATED_VAR(
"Use client_cli_authenticate_ex",
213 BOOL client_cli_authenticate(freerdp* instance,
214 char** username,
char** password,
217 WINPR_DEPRECATED_VAR(
"Use client_cli_authenticate_ex",
218 BOOL client_cli_gw_authenticate(freerdp* instance,
char** username,
219 char** password,
char** domain));
221 FREERDP_API WINPR_DEPRECATED_VAR(
222 "Use client_cli_verify_certificate_ex",
223 DWORD client_cli_verify_certificate(freerdp* instance,
const char* common_name,
224 const char* subject,
const char* issuer,
225 const char* fingerprint, BOOL host_mismatch));
228 FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance,
const char* host,
229 UINT16 port,
const char* common_name,
230 const char* subject,
const char* issuer,
231 const char* fingerprint, DWORD flags);
233 #if defined(WITH_FREERDP_DEPRECATED)
234 FREERDP_API WINPR_DEPRECATED_VAR(
"Use client_cli_verify_changed_certificate_ex",
235 DWORD client_cli_verify_changed_certificate(
236 freerdp* instance,
const char* common_name,
237 const char* subject,
const char* issuer,
238 const char* fingerprint,
const char* old_subject,
239 const char* old_issuer,
const char* old_fingerprint));
242 FREERDP_API DWORD client_cli_verify_changed_certificate_ex(
243 freerdp* instance,
const char* host, UINT16 port,
const char* common_name,
244 const char* subject,
const char* issuer,
const char* fingerprint,
const char* old_subject,
245 const char* old_issuer,
const char* old_fingerprint, DWORD flags);
247 FREERDP_API BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type,
248 BOOL isDisplayMandatory,
249 BOOL isConsentMandatory,
size_t length,
250 const WCHAR* message);
252 FREERDP_API BOOL client_auto_reconnect(freerdp* instance);
253 FREERDP_API BOOL client_auto_reconnect_ex(freerdp* instance,
254 BOOL (*window_events)(freerdp* instance));
258 FREERDP_TOUCH_DOWN = 0x01,
259 FREERDP_TOUCH_UP = 0x02,
260 FREERDP_TOUCH_MOTION = 0x04,
261 FREERDP_TOUCH_HAS_PRESSURE = 0x100
262 } FreeRDPTouchEventType;
264 FREERDP_API BOOL freerdp_client_handle_touch(rdpClientContext* cctx, UINT32 flags, INT32 finger,
265 UINT32 pressure, INT32 x, INT32 y);
269 FREERDP_PEN_REGISTER = 0x01,
270 FREERDP_PEN_ERASER_PRESSED = 0x02,
271 FREERDP_PEN_PRESS = 0x04,
272 FREERDP_PEN_MOTION = 0x08,
273 FREERDP_PEN_RELEASE = 0x10,
274 FREERDP_PEN_BARREL_PRESSED = 0x20,
275 FREERDP_PEN_HAS_PRESSURE = 0x40,
276 FREERDP_PEN_HAS_ROTATION = 0x80,
277 FREERDP_PEN_HAS_TILTX = 0x100,
278 FREERDP_PEN_HAS_TILTY = 0x200,
279 FREERDP_PEN_IS_INVERTED = 0x400
280 } FreeRDPPenEventType;
282 FREERDP_API BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid,
284 FREERDP_API BOOL freerdp_client_is_pen(rdpClientContext* cctx, INT32 deviceid);
286 FREERDP_API BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx);
288 FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags);
290 FREERDP_API BOOL freerdp_client_send_mouse_event(rdpClientContext* cctx, UINT64 mflags, INT32 x,
300 FREERDP_API BOOL freerdp_client_use_relative_mouse_events(rdpClientContext* cctx);
302 FREERDP_API BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative,
303 UINT16 mflags, INT32 x, INT32 y);
305 FREERDP_API BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx,
306 BOOL relative, UINT16 mflags,
309 FREERDP_API
int freerdp_client_common_stop(rdpContext* context);
311 FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance);
313 #if defined(CHANNEL_ENCOMSP_CLIENT)
314 FREERDP_API BOOL freerdp_client_encomsp_toggle_control(EncomspClientContext* encomsp);
315 FREERDP_API BOOL freerdp_client_encomsp_set_control(EncomspClientContext* encomsp,
ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS]
ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES]