2 * FreeRDP: A Remote Desktop Protocol client.
3 * Dynamic Virtual Channel Interface
5 * Copyright 2010-2011 Vic Lee
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.
21 * DVC Plugin API: See the original MS DVC Client API:
22 * http://msdn.microsoft.com/en-us/library/bb540880%28v=VS.85%29.aspx
24 * The FreeRDP DVC Plugin API is a simulation of the MS DVC Client API in C.
25 * The main difference is that every interface method must take an instance
26 * pointer as the first parameter.
30 * Implemented by DRDYNVC:
31 * o IWTSVirtualChannelManager
33 * o IWTSVirtualChannel
35 * Implemented by DVC plugin:
37 * o IWTSListenerCallback
38 * o IWTSVirtualChannelCallback
40 * A basic DVC plugin implementation:
42 * The plugin entry point, which creates and initializes a new IWTSPlugin
44 * 2. IWTSPlugin.Initialize:
45 * Call IWTSVirtualChannelManager.CreateListener with a newly created
46 * IWTSListenerCallback instance
47 * 3. IWTSListenerCallback.OnNewChannelConnection:
48 * Create IWTSVirtualChannelCallback instance if the new channel is accepted
51 #ifndef __FREERDP_DVC_H
52 #define __FREERDP_DVC_H
54 #include <freerdp/types.h>
56 typedef struct _IWTSVirtualChannelManager IWTSVirtualChannelManager;
57 typedef struct _IWTSListener IWTSListener;
58 typedef struct _IWTSVirtualChannel IWTSVirtualChannel;
60 typedef struct _IWTSPlugin IWTSPlugin;
61 typedef struct _IWTSListenerCallback IWTSListenerCallback;
62 typedef struct _IWTSVirtualChannelCallback IWTSVirtualChannelCallback;
66 /* Retrieves the listener-specific configuration. */
67 int (*GetConfiguration) (IWTSListener* pListener,
68 void** ppPropertyBag);
71 struct _IWTSVirtualChannel
73 /* Starts a write request on the channel. */
74 int (*Write) (IWTSVirtualChannel* pChannel,
78 /* Closes the channel. */
79 int (*Close) (IWTSVirtualChannel* pChannel);
82 struct _IWTSVirtualChannelManager
84 /* Returns an instance of a listener object that listens on a specific
85 endpoint, or creates a static channel. */
86 int (*CreateListener) (IWTSVirtualChannelManager* pChannelMgr,
87 const char* pszChannelName,
89 IWTSListenerCallback* pListenerCallback,
90 IWTSListener** ppListener);
91 /* Push a virtual channel event.
92 This is a FreeRDP extension to standard MS API. */
93 int (*PushEvent) (IWTSVirtualChannelManager* pChannelMgr,
99 /* Used for the first call that is made from the client to the plug-in. */
100 int (*Initialize) (IWTSPlugin* pPlugin,
101 IWTSVirtualChannelManager* pChannelMgr);
102 /* Notifies the plug-in that the Remote Desktop Connection (RDC) client
103 has successfully connected to the Remote Desktop Session Host (RD
104 Session Host) server. */
105 int (*Connected) (IWTSPlugin* pPlugin);
106 /* Notifies the plug-in that the Remote Desktop Connection (RDC) client
107 has disconnected from the RD Session Host server. */
108 int (*Disconnected) (IWTSPlugin* pPlugin,
109 uint32 dwDisconnectCode);
110 /* Notifies the plug-in that the Remote Desktop Connection (RDC) client
112 int (*Terminated) (IWTSPlugin* pPlugin);
115 struct _IWTSListenerCallback
117 /* Accepts or denies a connection request for an incoming connection to
118 the associated listener. */
119 int (*OnNewChannelConnection) (IWTSListenerCallback* pListenerCallback,
120 IWTSVirtualChannel* pChannel,
123 IWTSVirtualChannelCallback** ppCallback);
126 struct _IWTSVirtualChannelCallback
128 /* Notifies the user about data that is being received. */
129 int (*OnDataReceived) (IWTSVirtualChannelCallback* pChannelCallback,
132 /* Notifies the user that the channel has been closed. */
133 int (*OnClose) (IWTSVirtualChannelCallback* pChannelCallback);
136 /* The DVC Plugin entry points */
137 typedef struct _IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS;
138 struct _IDRDYNVC_ENTRY_POINTS
140 int (*RegisterPlugin) (IDRDYNVC_ENTRY_POINTS* pEntryPoints,
141 const char* name, IWTSPlugin* pPlugin);
142 IWTSPlugin* (*GetPlugin) (IDRDYNVC_ENTRY_POINTS* pEntryPoints,
144 RDP_PLUGIN_DATA* (*GetPluginData) (IDRDYNVC_ENTRY_POINTS* pEntryPoints);
147 typedef int (*PDVC_PLUGIN_ENTRY) (IDRDYNVC_ENTRY_POINTS*);