Blame include/freerdp/dvc.h

Packit 1fb8d4
/**
Packit 1fb8d4
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit 1fb8d4
 * Dynamic Virtual Channel Interface
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2010-2011 Vic Lee
Packit 1fb8d4
 * Copyright 2015 Thincast Technologies GmbH
Packit 1fb8d4
 * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * DVC Plugin API: See the original MS DVC Client API:
Packit 1fb8d4
 * http://msdn.microsoft.com/en-us/library/bb540880%28v=VS.85%29.aspx
Packit 1fb8d4
 *
Packit 1fb8d4
 * The FreeRDP DVC Plugin API is a simulation of the MS DVC Client API in C.
Packit 1fb8d4
 * The main difference is that every interface method must take an instance
Packit 1fb8d4
 * pointer as the first parameter.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Implemented by DRDYNVC:
Packit 1fb8d4
 * o IWTSVirtualChannelManager
Packit 1fb8d4
 * o IWTSListener
Packit 1fb8d4
 * o IWTSVirtualChannel
Packit 1fb8d4
 *
Packit 1fb8d4
 * Implemented by DVC plugin:
Packit 1fb8d4
 * o IWTSPlugin
Packit 1fb8d4
 * o IWTSListenerCallback
Packit 1fb8d4
 * o IWTSVirtualChannelCallback
Packit 1fb8d4
 *
Packit 1fb8d4
 * A basic DVC plugin implementation:
Packit 1fb8d4
 * 1. DVCPluginEntry:
Packit 1fb8d4
 *    The plugin entry point, which creates and initializes a new IWTSPlugin
Packit 1fb8d4
 *    instance
Packit 1fb8d4
 * 2. IWTSPlugin.Initialize:
Packit 1fb8d4
 *    Call IWTSVirtualChannelManager.CreateListener with a newly created
Packit 1fb8d4
 *    IWTSListenerCallback instance
Packit 1fb8d4
 * 3. IWTSListenerCallback.OnNewChannelConnection:
Packit 1fb8d4
 *    Create IWTSVirtualChannelCallback instance if the new channel is accepted
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifndef FREERDP_DVC_H
Packit 1fb8d4
#define FREERDP_DVC_H
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/types.h>
Packit 1fb8d4
#include <freerdp/addin.h>
Packit 1fb8d4
Packit 1fb8d4
typedef struct _IWTSVirtualChannelManager IWTSVirtualChannelManager;
Packit 1fb8d4
typedef struct _IWTSListener IWTSListener;
Packit 1fb8d4
typedef struct _IWTSVirtualChannel IWTSVirtualChannel;
Packit 1fb8d4
Packit 1fb8d4
typedef struct _IWTSPlugin IWTSPlugin;
Packit 1fb8d4
typedef struct _IWTSListenerCallback IWTSListenerCallback;
Packit 1fb8d4
typedef struct _IWTSVirtualChannelCallback IWTSVirtualChannelCallback;
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSListener
Packit 1fb8d4
{
Packit 1fb8d4
	/* Retrieves the listener-specific configuration. */
Packit Service 5a9772
	UINT (*GetConfiguration)(IWTSListener* pListener, void** ppPropertyBag);
Packit 1fb8d4
Packit 1fb8d4
	void* pInterface;
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSVirtualChannel
Packit 1fb8d4
{
Packit 1fb8d4
	/* Starts a write request on the channel. */
Packit Service 5a9772
	UINT (*Write)(IWTSVirtualChannel* pChannel, ULONG cbSize, const BYTE* pBuffer, void* pReserved);
Packit 1fb8d4
	/* Closes the channel. */
Packit Service 5a9772
	UINT (*Close)(IWTSVirtualChannel* pChannel);
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSVirtualChannelManager
Packit 1fb8d4
{
Packit 1fb8d4
	/* Returns an instance of a listener object that listens on a specific
Packit 1fb8d4
	   endpoint, or creates a static channel. */
Packit Service 5a9772
	UINT(*CreateListener)
Packit Service 5a9772
	(IWTSVirtualChannelManager* pChannelMgr, const char* pszChannelName, ULONG ulFlags,
Packit Service 5a9772
	 IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener);
Packit 1fb8d4
	/* Find the channel or ID to send data to a specific endpoint. */
Packit Service 5a9772
	UINT32 (*GetChannelId)(IWTSVirtualChannel* channel);
Packit 1fb8d4
	IWTSVirtualChannel* (*FindChannelById)(IWTSVirtualChannelManager* pChannelMgr,
Packit 1fb8d4
	                                       UINT32 ChannelId);
Packit Service 5a9772
	const char* (*GetChannelName)(IWTSVirtualChannel* channel);
Packit Service 5a9772
	UINT (*DestroyListener)(IWTSVirtualChannelManager* pChannelMgr, IWTSListener* ppListener);
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSPlugin
Packit 1fb8d4
{
Packit 1fb8d4
	/* Used for the first call that is made from the client to the plug-in. */
Packit Service 5a9772
	UINT (*Initialize)(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr);
Packit 1fb8d4
	/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
Packit 1fb8d4
	   has successfully connected to the Remote Desktop Session Host (RD
Packit 1fb8d4
	   Session Host) server. */
Packit Service 5a9772
	UINT (*Connected)(IWTSPlugin* pPlugin);
Packit 1fb8d4
	/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
Packit 1fb8d4
	   has disconnected from the RD Session Host server. */
Packit Service 5a9772
	UINT (*Disconnected)(IWTSPlugin* pPlugin, DWORD dwDisconnectCode);
Packit 1fb8d4
	/* Notifies the plug-in that the Remote Desktop Connection (RDC) client
Packit 1fb8d4
	   has terminated. */
Packit Service 5a9772
	UINT (*Terminated)(IWTSPlugin* pPlugin);
Packit 1fb8d4
Packit Service 5a9772
	UINT (*Attached)(IWTSPlugin* pPlugin);
Packit 1fb8d4
Packit Service 5a9772
	UINT (*Detached)(IWTSPlugin* pPlugin);
Packit 1fb8d4
Packit 1fb8d4
	/* Extended */
Packit 1fb8d4
Packit 1fb8d4
	void* pInterface;
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSListenerCallback
Packit 1fb8d4
{
Packit 1fb8d4
	/* Accepts or denies a connection request for an incoming connection to
Packit 1fb8d4
	   the associated listener. */
Packit Service 5a9772
	UINT(*OnNewChannelConnection)
Packit Service 5a9772
	(IWTSListenerCallback* pListenerCallback, IWTSVirtualChannel* pChannel, BYTE* Data,
Packit Service 5a9772
	 BOOL* pbAccept, IWTSVirtualChannelCallback** ppCallback);
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
struct _IWTSVirtualChannelCallback
Packit 1fb8d4
{
Packit 1fb8d4
	/* Notifies the user about data that is being received. */
Packit Service 5a9772
	UINT (*OnDataReceived)(IWTSVirtualChannelCallback* pChannelCallback, wStream* data);
Packit 1fb8d4
	/* Notifies the user that the channel has been opened. */
Packit Service 5a9772
	UINT (*OnOpen)(IWTSVirtualChannelCallback* pChannelCallback);
Packit 1fb8d4
	/* Notifies the user that the channel has been closed. */
Packit Service 5a9772
	UINT (*OnClose)(IWTSVirtualChannelCallback* pChannelCallback);
Packit 1fb8d4
};
Packit 1fb8d4
Packit 1fb8d4
/* The DVC Plugin entry points */
Packit 1fb8d4
typedef struct _IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS;
Packit 1fb8d4
struct _IDRDYNVC_ENTRY_POINTS
Packit 1fb8d4
{
Packit Service 5a9772
	UINT(*RegisterPlugin)
Packit Service 5a9772
	(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name, IWTSPlugin* pPlugin);
Packit Service 5a9772
	IWTSPlugin* (*GetPlugin)(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name);
Packit 1fb8d4
	ADDIN_ARGV* (*GetPluginData)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
Packit 1fb8d4
	void* (*GetRdpSettings)(IDRDYNVC_ENTRY_POINTS* pEntryPoints);
Packit 1fb8d4
};
Packit 1fb8d4
Packit Service 5a9772
typedef UINT (*PDVC_PLUGIN_ENTRY)(IDRDYNVC_ENTRY_POINTS*);
Packit 1fb8d4
Packit 1fb8d4
void* get_callback_by_name(const char* name, void** context);
Packit 1fb8d4
void add_callback_by_name(const char* name, void* fkt, void* context);
Packit 1fb8d4
void remove_callback_by_name(const char* name, void* context);
Packit 1fb8d4
Packit 1fb8d4
#endif /* FREERDP_DVC_H */