2011-07-18 17:28:29 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-18 17:28:29 +04:00
|
|
|
* Dynamic Virtual Channel Interface
|
|
|
|
*
|
|
|
|
* Copyright 2010-2011 Vic Lee
|
2015-05-29 12:23:10 +03:00
|
|
|
* Copyright 2015 Thincast Technologies GmbH
|
|
|
|
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
2011-07-18 17:28:29 +04:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#ifndef FREERDP_DVC_H
|
|
|
|
#define FREERDP_DVC_H
|
2011-07-18 17:28:29 +04:00
|
|
|
|
|
|
|
#include <freerdp/types.h>
|
2012-11-20 07:31:15 +04:00
|
|
|
#include <freerdp/addin.h>
|
2011-07-18 17:28:29 +04:00
|
|
|
|
|
|
|
typedef struct _IWTSVirtualChannelManager IWTSVirtualChannelManager;
|
|
|
|
typedef struct _IWTSListener IWTSListener;
|
|
|
|
typedef struct _IWTSVirtualChannel IWTSVirtualChannel;
|
|
|
|
|
|
|
|
typedef struct _IWTSPlugin IWTSPlugin;
|
|
|
|
typedef struct _IWTSListenerCallback IWTSListenerCallback;
|
|
|
|
typedef struct _IWTSVirtualChannelCallback IWTSVirtualChannelCallback;
|
|
|
|
|
|
|
|
struct _IWTSListener
|
|
|
|
{
|
|
|
|
/* Retrieves the listener-specific configuration. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*GetConfiguration)(IWTSListener *pListener,
|
2014-05-23 15:04:51 +04:00
|
|
|
void **ppPropertyBag);
|
2013-05-14 00:07:42 +04:00
|
|
|
|
2014-05-23 15:04:51 +04:00
|
|
|
void *pInterface;
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _IWTSVirtualChannel
|
|
|
|
{
|
|
|
|
/* Starts a write request on the channel. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Write)(IWTSVirtualChannel *pChannel,
|
2015-05-29 12:23:10 +03:00
|
|
|
ULONG cbSize,
|
2016-04-26 10:35:54 +03:00
|
|
|
const BYTE *pBuffer,
|
2015-05-29 12:23:10 +03:00
|
|
|
void *pReserved);
|
2011-07-18 17:28:29 +04:00
|
|
|
/* Closes the channel. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Close)(IWTSVirtualChannel *pChannel);
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _IWTSVirtualChannelManager
|
|
|
|
{
|
|
|
|
/* Returns an instance of a listener object that listens on a specific
|
|
|
|
endpoint, or creates a static channel. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*CreateListener)(IWTSVirtualChannelManager *pChannelMgr,
|
2015-05-29 12:23:10 +03:00
|
|
|
const char *pszChannelName,
|
|
|
|
ULONG ulFlags,
|
|
|
|
IWTSListenerCallback *pListenerCallback,
|
|
|
|
IWTSListener **ppListener);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* Find the channel or ID to send data to a specific endpoint. */
|
2014-05-23 15:04:51 +04:00
|
|
|
UINT32(*GetChannelId)(IWTSVirtualChannel *channel);
|
|
|
|
IWTSVirtualChannel *(*FindChannelById)(IWTSVirtualChannelManager *pChannelMgr,
|
|
|
|
UINT32 ChannelId);
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _IWTSPlugin
|
|
|
|
{
|
|
|
|
/* Used for the first call that is made from the client to the plug-in. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Initialize)(IWTSPlugin *pPlugin,
|
2014-05-23 15:04:51 +04:00
|
|
|
IWTSVirtualChannelManager *pChannelMgr);
|
2011-07-18 17:28:29 +04:00
|
|
|
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
|
|
|
|
has successfully connected to the Remote Desktop Session Host (RD
|
|
|
|
Session Host) server. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Connected)(IWTSPlugin *pPlugin);
|
2011-07-18 17:28:29 +04:00
|
|
|
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
|
|
|
|
has disconnected from the RD Session Host server. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Disconnected)(IWTSPlugin *pPlugin,
|
2015-05-29 12:23:10 +03:00
|
|
|
DWORD dwDisconnectCode);
|
2011-07-18 17:28:29 +04:00
|
|
|
/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
|
|
|
|
has terminated. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*Terminated)(IWTSPlugin *pPlugin);
|
2013-05-14 00:07:42 +04:00
|
|
|
|
|
|
|
/* Extended */
|
|
|
|
|
2014-05-23 15:04:51 +04:00
|
|
|
void *pInterface;
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _IWTSListenerCallback
|
|
|
|
{
|
|
|
|
/* Accepts or denies a connection request for an incoming connection to
|
|
|
|
the associated listener. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*OnNewChannelConnection)(IWTSListenerCallback *pListenerCallback,
|
2014-05-23 15:04:51 +04:00
|
|
|
IWTSVirtualChannel *pChannel,
|
|
|
|
BYTE *Data,
|
2015-05-29 12:23:10 +03:00
|
|
|
BOOL *pbAccept,
|
2014-05-23 15:04:51 +04:00
|
|
|
IWTSVirtualChannelCallback **ppCallback);
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _IWTSVirtualChannelCallback
|
|
|
|
{
|
|
|
|
/* Notifies the user about data that is being received. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*OnDataReceived) (IWTSVirtualChannelCallback* pChannelCallback, wStream* data);
|
2014-06-03 17:49:00 +04:00
|
|
|
/* Notifies the user that the channel has been opened. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*OnOpen) (IWTSVirtualChannelCallback* pChannelCallback);
|
2011-07-18 17:28:29 +04:00
|
|
|
/* Notifies the user that the channel has been closed. */
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*OnClose) (IWTSVirtualChannelCallback* pChannelCallback);
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The DVC Plugin entry points */
|
|
|
|
typedef struct _IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS;
|
|
|
|
struct _IDRDYNVC_ENTRY_POINTS
|
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT (*RegisterPlugin)(IDRDYNVC_ENTRY_POINTS *pEntryPoints,
|
2014-05-23 15:04:51 +04:00
|
|
|
const char *name, IWTSPlugin *pPlugin);
|
|
|
|
IWTSPlugin *(*GetPlugin)(IDRDYNVC_ENTRY_POINTS *pEntryPoints,
|
|
|
|
const char *name);
|
2014-07-03 22:35:03 +04:00
|
|
|
ADDIN_ARGV* (*GetPluginData)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
|
|
|
|
void* (*GetRdpSettings)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
|
2011-07-18 17:28:29 +04:00
|
|
|
};
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
typedef UINT (*PDVC_PLUGIN_ENTRY)(IDRDYNVC_ENTRY_POINTS *);
|
2014-05-23 15:04:51 +04:00
|
|
|
|
|
|
|
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);
|
2011-07-18 17:28:29 +04:00
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#endif /* FREERDP_DVC_H */
|