1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Interface
*
* Copyright 2010-2011 Vic Lee
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* DVC Plugin API: See the original MS DVC Client API:
* http://msdn.microsoft.com/en-us/library/bb540880%28v=VS.85%29.aspx
*
* The FreeRDP DVC Plugin API is a simulation of the MS DVC Client API in C.
* The main difference is that every interface method must take an instance
* pointer as the first parameter.
*/
/**
* Implemented by DRDYNVC:
* o IWTSVirtualChannelManager
* o IWTSListener
* o IWTSVirtualChannel
*
* Implemented by DVC plugin:
* o IWTSPlugin
* o IWTSListenerCallback
* o IWTSVirtualChannelCallback
*
* A basic DVC plugin implementation:
* 1. DVCPluginEntry:
* The plugin entry point, which creates and initializes a new IWTSPlugin
* instance
* 2. IWTSPlugin.Initialize:
* Call IWTSVirtualChannelManager.CreateListener with a newly created
* IWTSListenerCallback instance
* 3. IWTSListenerCallback.OnNewChannelConnection:
* Create IWTSVirtualChannelCallback instance if the new channel is accepted
*/
#ifndef FREERDP_DVC_H
#define FREERDP_DVC_H
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/settings.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct s_IWTSVirtualChannelManager IWTSVirtualChannelManager;
typedef struct s_IWTSListener IWTSListener;
typedef struct s_IWTSVirtualChannel IWTSVirtualChannel;
typedef struct s_IWTSPlugin IWTSPlugin;
typedef struct s_IWTSListenerCallback IWTSListenerCallback;
typedef struct s_IWTSVirtualChannelCallback IWTSVirtualChannelCallback;
struct s_IWTSListener
{
/* Retrieves the listener-specific configuration. */
UINT (*GetConfiguration)(IWTSListener* pListener, void** ppPropertyBag);
void* pInterface;
};
struct s_IWTSVirtualChannel
{
/* Starts a write request on the channel. */
UINT(*Write)
(IWTSVirtualChannel* pChannel, ULONG cbSize, const BYTE* pBuffer, void* pReserved);
/* Closes the channel. */
UINT (*Close)(IWTSVirtualChannel* pChannel);
};
struct s_IWTSVirtualChannelManager
{
/* Returns an instance of a listener object that listens on a specific
endpoint, or creates a static channel. */
UINT(*CreateListener)
(IWTSVirtualChannelManager* pChannelMgr, const char* pszChannelName, ULONG ulFlags,
IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener);
/* Find the channel or ID to send data to a specific endpoint. */
UINT32 (*GetChannelId)(IWTSVirtualChannel* channel);
IWTSVirtualChannel* (*FindChannelById)(IWTSVirtualChannelManager* pChannelMgr,
UINT32 ChannelId);
const char* (*GetChannelName)(IWTSVirtualChannel* channel);
UINT (*DestroyListener)(IWTSVirtualChannelManager* pChannelMgr, IWTSListener* ppListener);
};
struct s_IWTSPlugin
{
/* Used for the first call that is made from the client to the plug-in. */
UINT (*Initialize)(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has successfully connected to the Remote Desktop Session Host (RD
Session Host) server. */
UINT (*Connected)(IWTSPlugin* pPlugin);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has disconnected from the RD Session Host server. */
UINT (*Disconnected)(IWTSPlugin* pPlugin, DWORD dwDisconnectCode);
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
has terminated. */
UINT (*Terminated)(IWTSPlugin* pPlugin);
UINT (*Attached)(IWTSPlugin* pPlugin);
UINT (*Detached)(IWTSPlugin* pPlugin);
/* Extended */
void* pInterface;
};
struct s_IWTSListenerCallback
{
/* Accepts or denies a connection request for an incoming connection to
the associated listener. */
UINT(*OnNewChannelConnection)
(IWTSListenerCallback* pListenerCallback, IWTSVirtualChannel* pChannel, BYTE* Data,
BOOL* pbAccept, IWTSVirtualChannelCallback** ppCallback);
void* pInterface;
};
struct s_IWTSVirtualChannelCallback
{
UINT(*OnDataReceived)
(IWTSVirtualChannelCallback* pChannelCallback,
wStream* data); /**< Notifies the user about data that is being received. */
UINT(*OnOpen)
(IWTSVirtualChannelCallback*
pChannelCallback); /**< Notifies the user that the channel has been opened. */
UINT(*OnClose)
(IWTSVirtualChannelCallback*
pChannelCallback); /**< Notifies the user that the channel has been closed. */
void* pInterface;
};
/* The DVC Plugin entry points */
typedef struct rdp_context rdpContext; /* forward declaration, necessary to avoid
* circular includes */
typedef struct S_IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS;
struct S_IDRDYNVC_ENTRY_POINTS
{
UINT(*RegisterPlugin)
(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name, IWTSPlugin* pPlugin);
IWTSPlugin* (*GetPlugin)(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name);
const ADDIN_ARGV* (*GetPluginData)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
rdpSettings* (*GetRdpSettings)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
rdpContext* (*GetRdpContext)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
};
typedef UINT (*PDVC_PLUGIN_ENTRY)(IDRDYNVC_ENTRY_POINTS*);
void* get_callback_by_name(const char* name, void** context);
void add_callback_by_name(const char* name, void* fkt, void* context);
void remove_callback_by_name(const char* name, void* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_DVC_H */
|