FreeRDP
include/freerdp/client.h
1 
20 #ifndef FREERDP_CLIENT_H
21 #define FREERDP_CLIENT_H
22 
23 #include <winpr/cmdline.h>
24 
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>
30 
31 #if defined(CHANNEL_AINPUT_CLIENT)
32 #include <freerdp/client/ainput.h>
33 #endif
34 
35 #if defined(CHANNEL_RDPEI_CLIENT)
36 #include <freerdp/client/rdpei.h>
37 #endif
38 
39 #if defined(CHANNEL_ENCOMSP_CLIENT)
40 #include <freerdp/client/encomsp.h>
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47 
52  typedef BOOL (*pRdpGlobalInit)(void);
53  typedef void (*pRdpGlobalUninit)(void);
54 
55  typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context);
56  typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
57 
58  typedef int (*pRdpClientStart)(rdpContext* context);
59  typedef int (*pRdpClientStop)(rdpContext* context);
60 
62  {
63  DWORD Size;
64  DWORD Version;
65 
66  rdpSettings* settings;
67 
68  pRdpGlobalInit GlobalInit;
69  pRdpGlobalUninit GlobalUninit;
70 
71  DWORD ContextSize;
72  pRdpClientNew ClientNew;
73  pRdpClientFree ClientFree;
74 
75  pRdpClientStart ClientStart;
76  pRdpClientStop ClientStop;
77  };
78 
79 #define RDP_CLIENT_INTERFACE_VERSION 1
80 #define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry"
81 
82  typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
83 
84  /* Common Client Interface */
85 #define FREERDP_MAX_TOUCH_CONTACTS 10
86 
87  typedef struct
88  {
89  ALIGN64 INT32 id;
90  ALIGN64 UINT32 count;
91  ALIGN64 INT32 x;
92  ALIGN64 INT32 y;
93  ALIGN64 UINT32 flags;
94  ALIGN64 UINT32 pressure;
96 
97 #define FREERDP_MAX_PEN_DEVICES 10
98 
99  typedef struct pen_device
100  {
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;
109 
111  {
112  rdpContext context;
113  ALIGN64 HANDLE thread;
114 #if defined(CHANNEL_AINPUT_CLIENT)
115  ALIGN64 AInputClientContext* ainput;
116 #else
117  UINT64 reserved1;
118 #endif
119 
120 #if defined(CHANNEL_RDPEI_CLIENT)
121  ALIGN64 RdpeiClientContext* rdpei;
122 #else
123  UINT64 reserved2;
124 #endif
125 
126  ALIGN64 INT32 lastX;
127  ALIGN64 INT32 lastY;
128  ALIGN64 BOOL mouse_grabbed;
130 #if defined(CHANNEL_ENCOMSP_CLIENT)
131  ALIGN64 EncomspClientContext* encomsp;
132  ALIGN64 BOOL controlToggle;
133 #else
134  UINT64 reserved3[2];
135 #endif
136  ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS];
137  ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES];
138  UINT64 reserved[128 - 9];
139  };
140 
141  /* Common client functions */
142 
143  FREERDP_API void freerdp_client_context_free(rdpContext* context);
144 
145  WINPR_ATTR_MALLOC(freerdp_client_context_free, 1)
146  FREERDP_API rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
147 
148  FREERDP_API int freerdp_client_start(rdpContext* context);
149  FREERDP_API int freerdp_client_stop(rdpContext* context);
150 
151  FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
152  FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
153 
154  FREERDP_API int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc,
155  char** argv, BOOL allowUnknown);
156 
170  FREERDP_API int freerdp_client_settings_parse_command_line_ex(
171  rdpSettings* settings, int argc, char** argv, BOOL allowUnknown,
172  COMMAND_LINE_ARGUMENT_A* args, size_t count,
173  int (*handle_option)(const COMMAND_LINE_ARGUMENT_A* arg, void* custom),
174  void* handle_userdata);
175 
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,
179  const BYTE* buffer,
180  size_t size);
181  FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings,
182  const char* filename,
183  BOOL unicode);
184 
185  FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc,
186  char* argv[]);
187 
188  FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance, char** username, char** password,
189  char** domain, rdp_auth_reason reason);
190 
191  FREERDP_API BOOL client_cli_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list,
192  DWORD count, DWORD* choice, BOOL gateway);
193 
194  FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
195 
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,
199  char** token);
200 
201  FREERDP_API SSIZE_T client_common_retry_dialog(freerdp* instance, const char* what,
202  size_t current, void* userarg);
203 
204  FREERDP_API void
205  freerdp_client_OnChannelConnectedEventHandler(void* context,
206  const ChannelConnectedEventArgs* e);
207  FREERDP_API void
208  freerdp_client_OnChannelDisconnectedEventHandler(void* context,
209  const ChannelDisconnectedEventArgs* e);
210 
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,
215  char** domain));
216  FREERDP_API
217  WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
218  BOOL client_cli_gw_authenticate(freerdp* instance, char** username,
219  char** password, char** domain));
220 
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));
226 #endif
227 
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);
232 
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));
240 #endif
241 
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);
246 
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);
251 
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));
255 
256  typedef enum
257  {
258  FREERDP_TOUCH_DOWN = 0x01,
259  FREERDP_TOUCH_UP = 0x02,
260  FREERDP_TOUCH_MOTION = 0x04,
261  FREERDP_TOUCH_HAS_PRESSURE = 0x100
262  } FreeRDPTouchEventType;
263 
264  FREERDP_API BOOL freerdp_client_handle_touch(rdpClientContext* cctx, UINT32 flags, INT32 finger,
265  UINT32 pressure, INT32 x, INT32 y);
266 
267  typedef enum
268  {
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;
281 
282  FREERDP_API BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid,
283  ...);
284  FREERDP_API BOOL freerdp_client_is_pen(rdpClientContext* cctx, INT32 deviceid);
285 
286  FREERDP_API BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx);
287 
288  FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags);
289 
290  FREERDP_API BOOL freerdp_client_send_mouse_event(rdpClientContext* cctx, UINT64 mflags, INT32 x,
291  INT32 y);
292 
300  FREERDP_API BOOL freerdp_client_use_relative_mouse_events(rdpClientContext* cctx);
301 
302  FREERDP_API BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative,
303  UINT16 mflags, INT32 x, INT32 y);
304 
305  FREERDP_API BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx,
306  BOOL relative, UINT16 mflags,
307  INT32 x, INT32 y);
308 
309  FREERDP_API int freerdp_client_common_stop(rdpContext* context);
310 
311  FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance);
312 
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,
316  BOOL control);
317 #endif
318 
319 #ifdef __cplusplus
320 }
321 #endif
322 
323 #endif /* FREERDP_CLIENT_H */
ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS]
ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES]