Merge branch 'gateway' of https://github.com/dvincent-devolutions/FreeRDP into gateway
[platform/upstream/freerdp.git] / include / freerdp / client.h
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
27 extern "C" {
28 #endif
29
30 /**
31  * Client Entry Points
32  */
33
34 typedef void (*pRdpGlobalInit)(void);
35 typedef void (*pRdpGlobalUninit)(void);
36
37 typedef int (*pRdpClientNew)(freerdp* instance, rdpContext* context);
38 typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
39
40 typedef int (*pRdpClientStart)(rdpContext* context);
41 typedef int (*pRdpClientStop)(rdpContext* context);
42
43 struct rdp_client_entry_points_v1
44 {
45         DWORD Size;
46         DWORD Version;
47
48         rdpSettings* settings;
49
50         pRdpGlobalInit GlobalInit;
51         pRdpGlobalUninit GlobalUninit;
52
53         DWORD ContextSize;
54         pRdpClientNew ClientNew;
55         pRdpClientFree ClientFree;
56
57         pRdpClientStart ClientStart;
58         pRdpClientStop ClientStop;
59 };
60
61 #define RDP_CLIENT_INTERFACE_VERSION    1
62 #define RDP_CLIENT_ENTRY_POINT_NAME     "RdpClientEntry"
63
64 typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
65
66 /* Common Client Interface */
67
68 #define DEFINE_RDP_CLIENT_COMMON() \
69         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,
89         int argc, char** argv, BOOL allowUnknown);
90
91 FREERDP_API int freerdp_client_settings_parse_connection_file(rdpSettings* settings, const char* filename);
92 FREERDP_API int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings, const BYTE* buffer, size_t size);
93 FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings, const char* filename, BOOL unicode);
94
95 FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, const char* filename);
96
97 #ifdef __cplusplus
98 }
99 #endif
100
101 #endif /* FREERDP_CLIENT_H */