Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.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 (*pContextNew)(freerdp* instance, rdpContext* context);
47 typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
48
49 typedef boolean (*pPreConnect)(freerdp* instance);
50 typedef boolean (*pPostConnect)(freerdp* instance);
51 typedef boolean (*pAuthenticate)(freerdp* instance, char** username, char** password, char** domain);
52 typedef boolean (*pVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint);
53
54 typedef int (*pSendChannelData)(freerdp* instance, int channelId, uint8* data, int size);
55 typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size);
56
57 struct rdp_context
58 {
59         freerdp* instance; /* 0 */
60         freerdp_peer* peer; /* 1 */
61         uint32 paddingA[16 - 2]; /* 2 */
62
63         int argc; /* 16 */
64         char** argv; /* 17 */
65         uint32 paddingB[32 - 18]; /* 18 */
66
67         rdpRdp* rdp; /* 32 */
68         rdpGdi* gdi; /* 33 */
69         rdpRail* rail; /* 34 */
70         rdpCache* cache; /* 35 */
71         rdpChannels* channels; /* 36 */
72         rdpGraphics* graphics; /* 37 */
73         uint32 paddingC[64 - 38]; /* 38 */
74 };
75
76 struct rdp_freerdp
77 {
78         rdpContext* context; /* 0 */
79         uint32 paddingA[16 - 1]; /* 1 */
80
81         rdpInput* input; /* 16 */
82         rdpUpdate* update; /* 17 */
83         rdpSettings* settings; /* 18 */
84         uint32 paddingB[32 - 19]; /* 19 */
85
86         size_t context_size; /* 32 */
87         pContextNew ContextNew; /* 33 */
88         pContextFree ContextFree; /* 34 */
89         uint32 paddingC[48 - 35]; /* 35 */
90
91         pPreConnect PreConnect; /* 48 */
92         pPostConnect PostConnect; /* 49 */
93         pAuthenticate Authenticate; /* 50 */
94         pVerifyCertificate VerifyCertificate; /* 51 */
95         uint32 paddingD[64 - 52]; /* 52 */
96
97         pSendChannelData SendChannelData; /* 64 */
98         pReceiveChannelData ReceiveChannelData; /* 65 */
99         uint32 paddingE[80 - 66]; /* 66 */
100 };
101
102 FREERDP_API void freerdp_context_new(freerdp* instance);
103 FREERDP_API void freerdp_context_free(freerdp* instance);
104
105 FREERDP_API boolean freerdp_connect(freerdp* instance);
106 FREERDP_API boolean freerdp_shall_disconnect(freerdp* instance);
107 FREERDP_API boolean freerdp_disconnect(freerdp* instance);
108
109 FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount);
110 FREERDP_API boolean freerdp_check_fds(freerdp* instance);
111
112 FREERDP_API void freerdp_send_keep_alive(freerdp* instance);
113 FREERDP_API uint32 freerdp_error_info(freerdp* instance);
114
115 FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
116
117 FREERDP_API freerdp* freerdp_new();
118 FREERDP_API void freerdp_free(freerdp* instance);
119
120 #ifdef __cplusplus
121 }
122 #endif
123
124 #endif