5bbe0aefa0d8b1636c4d964432b12e0ba207ff80
[platform/upstream/freerdp.git] / include / freerdp / freerdp.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * FreeRDP Interface
4  *
5  * Copyright 2009-2011 Jay Sorg
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_H
21 #define __FREERDP_H
22
23 typedef struct rdp_rdp rdpRdp;
24 typedef struct rdp_gdi rdpGdi;
25 typedef struct rdp_rail rdpRail;
26 typedef struct rdp_cache rdpCache;
27 typedef struct rdp_channels rdpChannels;
28 typedef struct rdp_graphics rdpGraphics;
29
30 typedef struct rdp_freerdp freerdp;
31 typedef struct rdp_context rdpContext;
32 typedef struct rdp_freerdp_peer freerdp_peer;
33
34 #include <freerdp/api.h>
35 #include <freerdp/types.h>
36 #include <freerdp/settings.h>
37 #include <freerdp/extension.h>
38
39 #include <freerdp/input.h>
40 #include <freerdp/update.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 typedef void (*pContextSize)(freerdp* instance, uint32* size);
47 typedef void (*pContextNew)(freerdp* instance, rdpContext* context);
48 typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
49
50 typedef boolean (*pPreConnect)(freerdp* instance);
51 typedef boolean (*pPostConnect)(freerdp* instance);
52 typedef boolean (*pAuthenticate)(freerdp* instance, char** username, char** password, char** domain);
53 typedef boolean (*pVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint);
54
55 typedef int (*pSendChannelData)(freerdp* instance, int channelId, uint8* data, int size);
56 typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size);
57
58 struct rdp_context
59 {
60         freerdp* instance;
61         freerdp_peer* peer;
62
63         int argc;
64         char** argv;
65
66         rdpRdp* rdp;
67         rdpGdi* gdi;
68         rdpRail* rail;
69         rdpCache* cache;
70         rdpChannels* channels;
71         rdpGraphics* graphics;
72 };
73
74 struct rdp_freerdp
75 {
76         rdpContext* context;
77
78         rdpInput* input;
79         rdpUpdate* update;
80         rdpSettings* settings;
81
82         size_t context_size;
83         pContextNew ContextNew;
84         pContextFree ContextFree;
85
86         pPreConnect PreConnect;
87         pPostConnect PostConnect;
88         pAuthenticate Authenticate;
89         pVerifyCertificate VerifyCertificate;
90
91         pSendChannelData SendChannelData;
92         pReceiveChannelData ReceiveChannelData;
93 };
94
95 FREERDP_API void freerdp_context_new(freerdp* instance);
96 FREERDP_API void freerdp_context_free(freerdp* instance);
97
98 FREERDP_API boolean freerdp_connect(freerdp* instance);
99 FREERDP_API boolean freerdp_disconnect(freerdp* instance);
100
101 FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount);
102 FREERDP_API boolean freerdp_check_fds(freerdp* instance);
103
104 FREERDP_API freerdp* freerdp_new();
105 FREERDP_API void freerdp_free(freerdp* instance);
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif