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>
|
|
|
|
#include <freerdp/freerdp.h>
|
2022-01-19 13:05:41 +03:00
|
|
|
#include <freerdp/event.h>
|
|
|
|
|
|
|
|
#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
|
|
|
|
*/
|
2013-04-09 01:03:21 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
typedef BOOL (*pRdpGlobalInit)(void);
|
|
|
|
typedef void (*pRdpGlobalUninit)(void);
|
2013-04-09 01:03:21 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context);
|
|
|
|
typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
|
2013-04-09 01:03:21 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
typedef int (*pRdpClientStart)(rdpContext* context);
|
|
|
|
typedef int (*pRdpClientStop)(rdpContext* context);
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct rdp_client_entry_points_v1
|
|
|
|
{
|
|
|
|
DWORD Size;
|
|
|
|
DWORD Version;
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
rdpSettings* settings;
|
2013-10-13 02:20:25 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
pRdpGlobalInit GlobalInit;
|
|
|
|
pRdpGlobalUninit GlobalUninit;
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
DWORD ContextSize;
|
|
|
|
pRdpClientNew ClientNew;
|
|
|
|
pRdpClientFree ClientFree;
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
pRdpClientStart ClientStart;
|
|
|
|
pRdpClientStop ClientStop;
|
|
|
|
};
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#define RDP_CLIENT_INTERFACE_VERSION 1
|
|
|
|
#define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry"
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
/* Common Client Interface */
|
2013-06-14 06:11:23 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
struct rdp_client_context
|
|
|
|
{
|
|
|
|
rdpContext context;
|
2022-01-20 13:31:06 +03:00
|
|
|
ALIGN64 HANDLE thread; /**< (offset 0) */
|
2022-01-19 13:05:41 +03:00
|
|
|
#if defined(CHANNEL_AINPUT_CLIENT)
|
2022-01-26 16:21:53 +03:00
|
|
|
ALIGN64 AInputClientContext* ainput; /**< (offset 1) */
|
2022-01-20 13:31:06 +03:00
|
|
|
#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)
|
2022-01-26 16:21:53 +03:00
|
|
|
ALIGN64 RdpeiClientContext* rdpei; /**< (offset 2) */
|
2022-01-20 13:31:06 +03:00
|
|
|
#else
|
2022-06-23 08:57:38 +03:00
|
|
|
UINT64 reserved2;
|
2022-01-19 13:05:41 +03:00
|
|
|
#endif
|
2022-01-20 13:31:06 +03:00
|
|
|
|
2022-01-26 16:21:53 +03:00
|
|
|
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
|
|
|
|
UINT64 reserved[128 - 8]; /**< (offset 8) */
|
2019-11-06 17:24:51 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Common client functions */
|
|
|
|
|
2022-03-23 15:18:35 +03:00
|
|
|
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
|
|
|
|
2022-10-14 19:58:30 +03:00
|
|
|
FREERDP_API BOOL client_cli_choose_smartcard(SmartcardCertInfo** cert_list, DWORD count,
|
|
|
|
DWORD* choice);
|
|
|
|
|
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);
|
|
|
|
|
2021-06-22 15:39:10 +03:00
|
|
|
#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
|
2022-01-26 16:21:53 +03:00
|
|
|
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));
|
2021-06-22 15:39:10 +03:00
|
|
|
#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);
|
|
|
|
|
2021-06-22 15:39:10 +03:00
|
|
|
#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));
|
2021-06-22 15:39:10 +03:00
|
|
|
#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);
|
2020-08-03 13:06:08 +03:00
|
|
|
|
|
|
|
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));
|
2018-09-24 11:30:59 +03:00
|
|
|
|
2022-01-19 14:24:45 +03:00
|
|
|
FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags);
|
|
|
|
|
2022-01-26 16:21:53 +03:00
|
|
|
FREERDP_API BOOL freerdp_client_send_mouse_event(rdpClientContext* cctx, UINT64 mflags, INT32 x,
|
|
|
|
INT32 y);
|
|
|
|
|
2022-01-19 14:24:45 +03:00
|
|
|
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);
|
|
|
|
|
2022-06-22 13:17:44 +03:00
|
|
|
FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance);
|
|
|
|
|
2022-10-13 12:59:40 +03:00
|
|
|
#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);
|
2022-10-13 12:59:40 +03:00
|
|
|
#endif
|
2022-09-12 14:23:06 +03:00
|
|
|
|
2013-04-08 23:37:56 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* FREERDP_CLIENT_H */
|