FreeRDP/include/freerdp/client.h

292 lines
11 KiB
C
Raw Normal View History

2013-04-08 23:37:56 +04:00
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Client Interface
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CLIENT_H
#define FREERDP_CLIENT_H
2022-02-22 11:47:27 +03:00
#include <freerdp/config.h>
2013-04-08 23:37:56 +04:00
#include <freerdp/api.h>
2023-03-14 12:39:18 +03:00
#include <freerdp/types.h>
2022-01-19 13:05:41 +03:00
#include <freerdp/event.h>
2023-03-14 12:39:18 +03:00
#include <freerdp/freerdp.h>
2022-01-19 13:05:41 +03:00
#if defined(CHANNEL_AINPUT_CLIENT)
#include <freerdp/client/ainput.h>
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
#include <freerdp/client/rdpei.h>
#endif
2013-04-08 23:37:56 +04:00
2022-09-12 14:23:06 +03:00
#if defined(CHANNEL_ENCOMSP_CLIENT)
#include <freerdp/client/encomsp.h>
#endif
2013-04-08 23:37:56 +04:00
#ifdef __cplusplus
2019-11-06 17:24:51 +03:00
extern "C"
{
2013-04-08 23:37:56 +04:00
#endif
2019-11-06 17:24:51 +03:00
/**
* Client Entry Points
*/
2019-11-06 17:24:51 +03:00
typedef BOOL (*pRdpGlobalInit)(void);
typedef void (*pRdpGlobalUninit)(void);
2019-11-06 17:24:51 +03:00
typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context);
typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
2019-11-06 17:24:51 +03:00
typedef int (*pRdpClientStart)(rdpContext* context);
typedef int (*pRdpClientStop)(rdpContext* context);
2019-11-06 17:24:51 +03:00
struct rdp_client_entry_points_v1
{
DWORD Size;
DWORD Version;
2019-11-06 17:24:51 +03:00
rdpSettings* settings;
2019-11-06 17:24:51 +03:00
pRdpGlobalInit GlobalInit;
pRdpGlobalUninit GlobalUninit;
2019-11-06 17:24:51 +03:00
DWORD ContextSize;
pRdpClientNew ClientNew;
pRdpClientFree ClientFree;
2019-11-06 17:24:51 +03:00
pRdpClientStart ClientStart;
pRdpClientStop ClientStop;
};
2019-11-06 17:24:51 +03:00
#define RDP_CLIENT_INTERFACE_VERSION 1
#define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry"
2019-11-06 17:24:51 +03:00
typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
2019-11-06 17:24:51 +03:00
/* Common Client Interface */
2022-12-30 21:07:46 +03:00
#define FREERDP_MAX_TOUCH_CONTACTS 10
typedef struct
{
ALIGN64 INT32 id;
ALIGN64 UINT32 count;
2022-12-30 13:25:28 +03:00
ALIGN64 INT32 x;
ALIGN64 INT32 y;
2022-12-30 21:07:46 +03:00
ALIGN64 UINT32 flags;
ALIGN64 UINT32 pressure;
} FreeRDP_TouchContact;
2013-06-14 06:11:23 +04:00
#define FREERDP_MAX_PEN_DEVICES 10
typedef struct pen_device
{
ALIGN64 INT32 deviceid;
ALIGN64 UINT32 flags;
ALIGN64 double max_pressure;
ALIGN64 BOOL hovering;
ALIGN64 BOOL pressed;
ALIGN64 INT32 last_x;
ALIGN64 INT32 last_y;
} FreeRDP_PenDevice;
2019-11-06 17:24:51 +03:00
struct rdp_client_context
{
rdpContext context;
ALIGN64 HANDLE thread; /**< (offset 0) */
2022-01-19 13:05:41 +03:00
#if defined(CHANNEL_AINPUT_CLIENT)
ALIGN64 AInputClientContext* ainput; /**< (offset 1) */
#else
2022-06-23 08:57:38 +03:00
UINT64 reserved1;
2022-01-19 13:05:41 +03:00
#endif
#if defined(CHANNEL_RDPEI_CLIENT)
ALIGN64 RdpeiClientContext* rdpei; /**< (offset 2) */
#else
2022-06-23 08:57:38 +03:00
UINT64 reserved2;
2022-01-19 13:05:41 +03:00
#endif
ALIGN64 INT32 lastX; /**< (offset 3) */
ALIGN64 INT32 lastY; /**< (offset 4) */
ALIGN64 BOOL mouse_grabbed; /** < (offset 5) */
2022-09-12 14:23:06 +03:00
#if defined(CHANNEL_ENCOMSP_CLIENT)
ALIGN64 EncomspClientContext* encomsp; /** < (offset 6) */
ALIGN64 BOOL controlToggle; /**< (offset 7) */
#else
UINT64 reserved3[2];
#endif
2022-12-30 21:07:46 +03:00
ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS]; /**< (offset 8) */
ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES]; /**< (offset 9) */
UINT64 reserved[128 - 9]; /**< (offset 9) */
2019-11-06 17:24:51 +03:00
};
/* Common client functions */
FREERDP_API rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
2019-11-06 17:24:51 +03:00
FREERDP_API void freerdp_client_context_free(rdpContext* context);
FREERDP_API int freerdp_client_start(rdpContext* context);
FREERDP_API int freerdp_client_stop(rdpContext* context);
FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
FREERDP_API int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc,
char** argv, BOOL allowUnknown);
FREERDP_API int freerdp_client_settings_parse_connection_file(rdpSettings* settings,
const char* filename);
FREERDP_API int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings,
const BYTE* buffer,
size_t size);
FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings,
const char* filename,
BOOL unicode);
FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc,
char* argv[]);
2021-09-06 16:12:12 +03:00
FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance, char** username, char** password,
char** domain, rdp_auth_reason reason);
2019-11-06 17:24:51 +03:00
FREERDP_API BOOL client_cli_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list,
DWORD count, DWORD* choice, BOOL gateway);
FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
FREERDP_API BOOL client_cli_get_access_token(freerdp* instance, AccessTokenType tokenType,
char** token, size_t count, ...);
FREERDP_API BOOL client_common_get_access_token(freerdp* instance, const char* request,
char** token);
FREERDP_API SSIZE_T client_common_retry_dialog(freerdp* instance, const char* what,
size_t current, void* userarg);
2022-01-19 13:05:41 +03:00
FREERDP_API void
freerdp_client_OnChannelConnectedEventHandler(void* context,
const ChannelConnectedEventArgs* e);
FREERDP_API void
freerdp_client_OnChannelDisconnectedEventHandler(void* context,
const ChannelDisconnectedEventArgs* e);
#if defined(WITH_FREERDP_DEPRECATED)
2021-09-06 16:12:12 +03:00
FREERDP_API WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
BOOL client_cli_authenticate(freerdp* instance,
char** username, char** password,
char** domain));
FREERDP_API
WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex",
BOOL client_cli_gw_authenticate(freerdp* instance, char** username,
char** password, char** domain));
2021-09-06 16:12:12 +03:00
2021-06-16 12:25:01 +03:00
FREERDP_API WINPR_DEPRECATED_VAR(
"Use client_cli_verify_certificate_ex",
DWORD client_cli_verify_certificate(freerdp* instance, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, BOOL host_mismatch));
#endif
2019-11-06 17:24:51 +03:00
FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host,
UINT16 port, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, DWORD flags);
#if defined(WITH_FREERDP_DEPRECATED)
2021-06-16 12:25:01 +03:00
FREERDP_API WINPR_DEPRECATED_VAR("Use client_cli_verify_changed_certificate_ex",
DWORD client_cli_verify_changed_certificate(
freerdp* instance, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, const char* old_subject,
const char* old_issuer, const char* old_fingerprint));
#endif
2019-11-06 17:24:51 +03:00
FREERDP_API DWORD client_cli_verify_changed_certificate_ex(
freerdp* instance, const char* host, UINT16 port, const char* common_name,
const char* subject, const char* issuer, const char* fingerprint, const char* old_subject,
const char* old_issuer, const char* old_fingerprint, DWORD flags);
FREERDP_API BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type,
BOOL isDisplayMandatory,
BOOL isConsentMandatory, size_t length,
const WCHAR* message);
2019-11-06 17:24:51 +03:00
FREERDP_API BOOL client_auto_reconnect(freerdp* instance);
FREERDP_API BOOL client_auto_reconnect_ex(freerdp* instance,
BOOL (*window_events)(freerdp* instance));
2022-12-30 21:07:46 +03:00
typedef enum
{
FREERDP_TOUCH_DOWN = 0x01,
FREERDP_TOUCH_UP = 0x02,
FREERDP_TOUCH_MOTION = 0x04,
FREERDP_TOUCH_HAS_PRESSURE = 0x100
} FreeRDPTouchEventType;
FREERDP_API BOOL freerdp_client_handle_touch(rdpClientContext* cctx, UINT32 flags, INT32 finger,
UINT32 pressure, INT32 x, INT32 y);
typedef enum
{
FREERDP_PEN_REGISTER = 0x01,
FREERDP_PEN_ERASER_PRESSED = 0x02,
FREERDP_PEN_PRESS = 0x04,
FREERDP_PEN_MOTION = 0x08,
FREERDP_PEN_RELEASE = 0x10,
FREERDP_PEN_BARREL_PRESSED = 0x20,
FREERDP_PEN_HAS_PRESSURE = 0x40,
FREERDP_PEN_HAS_ROTATION = 0x80,
FREERDP_PEN_HAS_TILTX = 0x100,
FREERDP_PEN_HAS_TILTY = 0x200,
FREERDP_PEN_IS_INVERTED = 0x400
} FreeRDPPenEventType;
FREERDP_API BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid,
...);
FREERDP_API BOOL freerdp_client_is_pen(rdpClientContext* cctx, INT32 deviceid);
FREERDP_API BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx);
FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags);
FREERDP_API BOOL freerdp_client_send_mouse_event(rdpClientContext* cctx, UINT64 mflags, INT32 x,
INT32 y);
FREERDP_API BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative,
UINT16 mflags, INT32 x, INT32 y);
FREERDP_API BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx,
BOOL relative, UINT16 mflags,
INT32 x, INT32 y);
2022-01-19 14:11:48 +03:00
FREERDP_API int freerdp_client_common_stop(rdpContext* context);
FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance);
#if defined(CHANNEL_ENCOMSP_CLIENT)
2022-09-12 14:23:06 +03:00
FREERDP_API BOOL freerdp_client_encomsp_toggle_control(EncomspClientContext* encomsp);
FREERDP_API BOOL freerdp_client_encomsp_set_control(EncomspClientContext* encomsp,
BOOL control);
#endif
2022-09-12 14:23:06 +03:00
2013-04-08 23:37:56 +04:00
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CLIENT_H */