client.h (5531B)
1/** 2 * FreeRDP: A Remote Desktop Protocol Implementation 3 * Client Interface 4 * 5 * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef FREERDP_CLIENT_H 21#define FREERDP_CLIENT_H 22 23#include <freerdp/api.h> 24#include <freerdp/freerdp.h> 25 26#ifdef __cplusplus 27extern "C" 28{ 29#endif 30 31 /** 32 * Client Entry Points 33 */ 34 35 typedef BOOL (*pRdpGlobalInit)(void); 36 typedef void (*pRdpGlobalUninit)(void); 37 38 typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context); 39 typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context); 40 41 typedef int (*pRdpClientStart)(rdpContext* context); 42 typedef int (*pRdpClientStop)(rdpContext* context); 43 44 struct rdp_client_entry_points_v1 45 { 46 DWORD Size; 47 DWORD Version; 48 49 rdpSettings* settings; 50 51 pRdpGlobalInit GlobalInit; 52 pRdpGlobalUninit GlobalUninit; 53 54 DWORD ContextSize; 55 pRdpClientNew ClientNew; 56 pRdpClientFree ClientFree; 57 58 pRdpClientStart ClientStart; 59 pRdpClientStop ClientStop; 60 }; 61 62#define RDP_CLIENT_INTERFACE_VERSION 1 63#define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry" 64 65 typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints); 66 67 /* Common Client Interface */ 68 69#define DEFINE_RDP_CLIENT_COMMON() HANDLE thread 70 71 struct rdp_client_context 72 { 73 rdpContext context; 74 DEFINE_RDP_CLIENT_COMMON(); 75 }; 76 77 /* Common client functions */ 78 79 FREERDP_API rdpContext* freerdp_client_context_new(RDP_CLIENT_ENTRY_POINTS* pEntryPoints); 80 FREERDP_API void freerdp_client_context_free(rdpContext* context); 81 82 FREERDP_API int freerdp_client_start(rdpContext* context); 83 FREERDP_API int freerdp_client_stop(rdpContext* context); 84 85 FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context); 86 FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context); 87 88 FREERDP_API int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc, 89 char** argv, BOOL allowUnknown); 90 91 FREERDP_API int freerdp_client_settings_parse_connection_file(rdpSettings* settings, 92 const char* filename); 93 FREERDP_API int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings, 94 const BYTE* buffer, 95 size_t size); 96 FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings, 97 const char* filename, 98 BOOL unicode); 99 100 FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc, 101 char* argv[]); 102 103 FREERDP_API BOOL client_cli_authenticate(freerdp* instance, char** username, char** password, 104 char** domain); 105 FREERDP_API BOOL client_cli_gw_authenticate(freerdp* instance, char** username, char** password, 106 char** domain); 107#if !defined(DEFINE_NO_DEPRECATED) 108 FREERDP_API WINPR_DEPRECATED(DWORD client_cli_verify_certificate( 109 freerdp* instance, const char* common_name, const char* subject, const char* issuer, 110 const char* fingerprint, BOOL host_mismatch)); 111#endif 112 FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host, 113 UINT16 port, const char* common_name, 114 const char* subject, const char* issuer, 115 const char* fingerprint, DWORD flags); 116#if !defined(DEFINE_NO_DEPRECATED) 117 FREERDP_API WINPR_DEPRECATED(DWORD client_cli_verify_changed_certificate( 118 freerdp* instance, const char* common_name, const char* subject, const char* issuer, 119 const char* fingerprint, const char* old_subject, const char* old_issuer, 120 const char* old_fingerprint)); 121#endif 122 FREERDP_API DWORD client_cli_verify_changed_certificate_ex( 123 freerdp* instance, const char* host, UINT16 port, const char* common_name, 124 const char* subject, const char* issuer, const char* fingerprint, const char* old_subject, 125 const char* old_issuer, const char* old_fingerprint, DWORD flags); 126 127 FREERDP_API BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, 128 BOOL isDisplayMandatory, 129 BOOL isConsentMandatory, size_t length, 130 const WCHAR* message); 131 132 FREERDP_API BOOL client_auto_reconnect(freerdp* instance); 133 FREERDP_API BOOL client_auto_reconnect_ex(freerdp* instance, 134 BOOL (*window_events)(freerdp* instance)); 135 136#ifdef __cplusplus 137} 138#endif 139 140#endif /* FREERDP_CLIENT_H */