2
Copyright (c) 2009-2010 Jay Sorg
4
Permission is hereby granted, free of charge, to any person obtaining a
5
copy of this software and associated documentation files (the "Software"),
6
to deal in the Software without restriction, including without limitation
7
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
and/or sell copies of the Software, and to permit persons to whom the
9
Software is furnished to do so, subject to the following conditions:
11
The above copyright notice and this permission notice shall be included
12
in all copies or substantial portions of the Software.
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
DEALINGS IN THE SOFTWARE.
2
* FreeRDP: A Remote Desktop Protocol Client
5
* Copyright 2009-2011 Jay Sorg
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
11
* http://www.apache.org/licenses/LICENSE-2.0
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.
23
20
#ifndef __FREERDP_H
24
21
#define __FREERDP_H
26
#include <freerdp/rdpset.h>
27
#include <freerdp/types_ui.h>
28
#include <freerdp/constants_ui.h>
30
#define FREERDP_INTERFACE_VERSION 3
32
#if defined _WIN32 || defined __CYGWIN__
33
#ifdef FREERDP_EXPORTS
35
#define FREERDP_API __attribute__((dllexport))
37
#define FREERDP_API __declspec(dllexport)
41
#define FREERDP_API __attribute__((dllimport))
43
#define FREERDP_API __declspec(dllimport)
48
#define FREERDP_API __attribute__ ((visibility("default")))
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;
30
typedef struct rdp_freerdp freerdp;
31
typedef struct rdp_context rdpContext;
32
typedef struct rdp_freerdp_peer freerdp_peer;
34
#include <freerdp/api.h>
35
#include <freerdp/types.h>
36
#include <freerdp/settings.h>
37
#include <freerdp/extension.h>
39
#include <freerdp/input.h>
40
#include <freerdp/update.h>
59
freerdp_global_init(void);
61
freerdp_global_finish(void);
74
/* calls from ui to library */
75
int (* rdp_connect)(rdpInst * inst);
76
int (* rdp_get_fds)(rdpInst * inst, void ** read_fds, int * read_count,
77
void ** write_fds, int * write_count);
78
int (* rdp_check_fds)(rdpInst * inst);
79
int (* rdp_send_input)(rdpInst * inst, int message_type, int device_flags,
80
int param1, int param2);
81
int (* rdp_sync_input)(rdpInst * inst, int toggle_flags);
82
int (* rdp_channel_data)(rdpInst * inst, int chan_id, char * data, int data_size);
83
void (* rdp_disconnect)(rdpInst * inst);
84
/* calls from library to ui */
85
void (* ui_error)(rdpInst * inst, const char * text);
86
void (* ui_warning)(rdpInst * inst, const char * text);
87
void (* ui_unimpl)(rdpInst * inst, const char * text);
88
void (* ui_begin_update)(rdpInst * inst);
89
void (* ui_end_update)(rdpInst * inst);
90
void (* ui_desktop_save)(rdpInst * inst, int offset, int x, int y,
92
void (* ui_desktop_restore)(rdpInst * inst, int offset, int x, int y,
94
RD_HBITMAP (* ui_create_bitmap)(rdpInst * inst, int width, int height, uint8 * data);
95
void (* ui_paint_bitmap)(rdpInst * inst, int x, int y, int cx, int cy, int width,
96
int height, uint8 * data);
97
void (* ui_destroy_bitmap)(rdpInst * inst, RD_HBITMAP bmp);
98
void (* ui_line)(rdpInst * inst, uint8 opcode, int startx, int starty, int endx,
99
int endy, RD_PEN * pen);
100
void (* ui_rect)(rdpInst * inst, int x, int y, int cx, int cy, int color);
101
void (* ui_polygon)(rdpInst * inst, uint8 opcode, uint8 fillmode, RD_POINT * point,
102
int npoints, RD_BRUSH * brush, int bgcolor, int fgcolor);
103
void (* ui_polyline)(rdpInst * inst, uint8 opcode, RD_POINT * points, int npoints,
105
void (* ui_ellipse)(rdpInst * inst, uint8 opcode, uint8 fillmode, int x, int y,
106
int cx, int cy, RD_BRUSH * brush, int bgcolor, int fgcolor);
107
void (* ui_start_draw_glyphs)(rdpInst * inst, int bgcolor, int fgcolor);
108
void (* ui_draw_glyph)(rdpInst * inst, int x, int y, int cx, int cy,
110
void (* ui_end_draw_glyphs)(rdpInst * inst, int x, int y, int cx, int cy);
111
uint32 (* ui_get_toggle_keys_state)(rdpInst * inst);
112
void (* ui_bell)(rdpInst * inst);
113
void (* ui_destblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy);
114
void (* ui_patblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
115
RD_BRUSH * brush, int bgcolor, int fgcolor);
116
void (* ui_screenblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
118
void (* ui_memblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
119
RD_HBITMAP src, int srcx, int srcy);
120
void (* ui_triblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
121
RD_HBITMAP src, int srcx, int srcy, RD_BRUSH * brush, int bgcolor, int fgcolor);
122
RD_HGLYPH (* ui_create_glyph)(rdpInst * inst, int width, int height, uint8 * data);
123
void (* ui_destroy_glyph)(rdpInst * inst, RD_HGLYPH glyph);
124
int (* ui_select)(rdpInst * inst, int rdp_socket);
125
void (* ui_set_clip)(rdpInst * inst, int x, int y, int cx, int cy);
126
void (* ui_reset_clip)(rdpInst * inst);
127
void (* ui_resize_window)(rdpInst * inst);
128
void (* ui_set_cursor)(rdpInst * inst, RD_HCURSOR cursor);
129
void (* ui_destroy_cursor)(rdpInst * inst, RD_HCURSOR cursor);
130
RD_HCURSOR (* ui_create_cursor)(rdpInst * inst, unsigned int x, unsigned int y,
131
int width, int height, uint8 * andmask, uint8 * xormask, int bpp);
132
void (* ui_set_null_cursor)(rdpInst * inst);
133
void (* ui_set_default_cursor)(rdpInst * inst);
134
RD_HPALETTE (* ui_create_colormap)(rdpInst * inst, RD_PALETTE * colors);
135
void (* ui_move_pointer)(rdpInst * inst, int x, int y);
136
void (* ui_set_colormap)(rdpInst * inst, RD_HPALETTE map);
137
RD_HBITMAP (* ui_create_surface)(rdpInst * inst, int width, int height, RD_HBITMAP old);
138
void (* ui_set_surface)(rdpInst * inst, RD_HBITMAP surface);
139
void (* ui_destroy_surface)(rdpInst * inst, RD_HBITMAP surface);
140
void (* ui_channel_data)(rdpInst * inst, int chan_id, char * data, int data_size,
141
int flags, int total_size);
144
FREERDP_API rdpInst *
145
freerdp_new(rdpSet * settings);
147
freerdp_free(rdpInst * inst);
46
typedef void (*pContextNew)(freerdp* instance, rdpContext* context);
47
typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
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);
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);
59
freerdp* instance; /* 0 */
60
freerdp_peer* peer; /* 1 */
61
uint32 paddingA[16 - 2]; /* 2 */
65
uint32 paddingB[32 - 18]; /* 18 */
69
rdpRail* rail; /* 34 */
70
rdpCache* cache; /* 35 */
71
rdpChannels* channels; /* 36 */
72
rdpGraphics* graphics; /* 37 */
73
uint32 paddingC[64 - 38]; /* 38 */
78
rdpContext* context; /* 0 */
79
uint32 paddingA[16 - 1]; /* 1 */
81
rdpInput* input; /* 16 */
82
rdpUpdate* update; /* 17 */
83
rdpSettings* settings; /* 18 */
84
uint32 paddingB[32 - 19]; /* 19 */
86
size_t context_size; /* 32 */
87
pContextNew ContextNew; /* 33 */
88
pContextFree ContextFree; /* 34 */
89
uint32 paddingC[48 - 35]; /* 35 */
91
pPreConnect PreConnect; /* 48 */
92
pPostConnect PostConnect; /* 49 */
93
pAuthenticate Authenticate; /* 50 */
94
pVerifyCertificate VerifyCertificate; /* 51 */
95
uint32 paddingD[64 - 52]; /* 52 */
97
pSendChannelData SendChannelData; /* 64 */
98
pReceiveChannelData ReceiveChannelData; /* 65 */
99
uint32 paddingE[80 - 66]; /* 66 */
102
FREERDP_API void freerdp_context_new(freerdp* instance);
103
FREERDP_API void freerdp_context_free(freerdp* instance);
105
FREERDP_API boolean freerdp_connect(freerdp* instance);
106
FREERDP_API boolean freerdp_disconnect(freerdp* instance);
108
FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount);
109
FREERDP_API boolean freerdp_check_fds(freerdp* instance);
111
FREERDP_API void freerdp_send_keep_alive(freerdp* instance);
112
FREERDP_API uint32 freerdp_error_info(freerdp* instance);
114
FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision);
116
FREERDP_API freerdp* freerdp_new();
117
FREERDP_API void freerdp_free(freerdp* instance);
149
119
#ifdef __cplusplus