client channels: mutualize common types between dynamic channels

Most dynamic channels share the same copied and pasted code for the XXX_CHANNEL_CALLBACK
and XXX_LISTENER_CALLBACK types. This patch introduce GENERIC_CHANNEL_CALLBACK and
GENERIC_LISTENER_CALLBACK that fits for most channels and discard custom type definitions.
This commit is contained in:
David Fort 2022-06-14 00:51:00 +02:00 committed by akallabeth
parent c2b394c528
commit e389210673
16 changed files with 184 additions and 306 deletions

View File

@ -30,6 +30,7 @@
#include "ainput_main.h"
#include <freerdp/channels/log.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/ainput.h>
#include <freerdp/channels/ainput.h>
@ -37,32 +38,13 @@
#define TAG CHANNELS_TAG("ainput.client")
typedef struct AINPUT_CHANNEL_CALLBACK_ AINPUT_CHANNEL_CALLBACK;
struct AINPUT_CHANNEL_CALLBACK_
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
};
typedef struct AINPUT_LISTENER_CALLBACK_ AINPUT_LISTENER_CALLBACK;
struct AINPUT_LISTENER_CALLBACK_
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
AINPUT_CHANNEL_CALLBACK* channel_callback;
};
typedef struct AINPUT_PLUGIN_ AINPUT_PLUGIN;
struct AINPUT_PLUGIN_
{
IWTSPlugin iface;
AINPUT_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
IWTSListener* listener;
UINT32 MajorVersion;
UINT32 MinorVersion;
@ -78,7 +60,7 @@ static UINT ainput_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
{
UINT16 type;
AINPUT_PLUGIN* ainput;
AINPUT_CHANNEL_CALLBACK* callback = (AINPUT_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
WINPR_ASSERT(callback);
WINPR_ASSERT(data);
@ -108,7 +90,7 @@ static UINT ainput_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
static UINT ainput_send_input_event(AInputClientContext* context, UINT64 flags, INT32 x, INT32 y)
{
AINPUT_PLUGIN* ainput;
AINPUT_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
BYTE buffer[32] = { 0 };
UINT64 time;
wStream sbuffer = { 0 };
@ -161,7 +143,7 @@ static UINT ainput_send_input_event(AInputClientContext* context, UINT64 flags,
*/
static UINT ainput_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
AINPUT_CHANNEL_CALLBACK* callback = (AINPUT_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
free(callback);
@ -178,14 +160,14 @@ static UINT ainput_on_new_channel_connection(IWTSListenerCallback* pListenerCall
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
AINPUT_CHANNEL_CALLBACK* callback;
AINPUT_LISTENER_CALLBACK* listener_callback = (AINPUT_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
WINPR_ASSERT(listener_callback);
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
callback = (AINPUT_CHANNEL_CALLBACK*)calloc(1, sizeof(AINPUT_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
@ -223,7 +205,7 @@ static UINT ainput_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
return ERROR_INVALID_DATA;
}
ainput->listener_callback =
(AINPUT_LISTENER_CALLBACK*)calloc(1, sizeof(AINPUT_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!ainput->listener_callback)
{

View File

@ -37,6 +37,7 @@
#include <winpr/stream.h>
#include <freerdp/freerdp.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/audin.h>
#include "audin_main.h"
@ -49,14 +50,6 @@
#define MSG_SNDIN_DATA 0x06
#define MSG_SNDIN_FORMATCHANGE 0x07
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
} AUDIN_LISTENER_CALLBACK;
typedef struct
{
IWTSVirtualChannelCallback iface;
@ -78,7 +71,7 @@ typedef struct
{
IWTSPlugin iface;
AUDIN_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
/* Parsed plugin data */
AUDIO_FORMAT* fixed_format;
@ -638,7 +631,7 @@ static UINT audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallb
{
AUDIN_CHANNEL_CALLBACK* callback;
AUDIN_PLUGIN* audin;
AUDIN_LISTENER_CALLBACK* listener_callback = (AUDIN_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
if (!listener_callback || !listener_callback->plugin)
return ERROR_INTERNAL_ERROR;
@ -685,7 +678,7 @@ static UINT audin_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
}
WLog_Print(audin->log, WLOG_TRACE, "...");
audin->listener_callback = (AUDIN_LISTENER_CALLBACK*)calloc(1, sizeof(AUDIN_LISTENER_CALLBACK));
audin->listener_callback = (GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!audin->listener_callback)
{

View File

@ -37,34 +37,17 @@
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include <freerdp/client/channels.h>
#include "disp_main.h"
#include "../disp_common.h"
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} DISP_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
DISP_CHANNEL_CALLBACK* channel_callback;
} DISP_LISTENER_CALLBACK;
typedef struct
{
IWTSPlugin iface;
IWTSListener* listener;
DISP_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
UINT32 MaxNumMonitors;
UINT32 MaxMonitorAreaFactorA;
@ -78,7 +61,7 @@ typedef struct
* @return 0 on success, otherwise a Win32 error code
*/
static UINT
disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback, UINT32 NumMonitors,
disp_send_display_control_monitor_layout_pdu(GENERIC_CHANNEL_CALLBACK* callback, UINT32 NumMonitors,
const DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
{
UINT status;
@ -172,7 +155,7 @@ out:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
static UINT disp_recv_display_control_caps_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
DISP_PLUGIN* disp;
DispClientContext* context;
@ -206,7 +189,7 @@ static UINT disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
static UINT disp_recv_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT32 error;
DISPLAY_CONTROL_HEADER header = { 0 };
@ -247,7 +230,7 @@ static UINT disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
*/
static UINT disp_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
{
DISP_CHANNEL_CALLBACK* callback = (DISP_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
return disp_recv_pdu(callback, data);
}
@ -271,15 +254,15 @@ static UINT disp_on_new_channel_connection(IWTSListenerCallback* pListenerCallba
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
DISP_CHANNEL_CALLBACK* callback;
DISP_LISTENER_CALLBACK* listener_callback = (DISP_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
WINPR_ASSERT(listener_callback);
WINPR_ASSERT(pChannel);
WINPR_ASSERT(pbAccept);
WINPR_ASSERT(ppCallback);
callback = (DISP_CHANNEL_CALLBACK*)calloc(1, sizeof(DISP_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
@ -315,7 +298,7 @@ static UINT disp_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
WLog_ERR(TAG, "[%s] channel initialized twice, aborting", DISP_DVC_CHANNEL_NAME);
return ERROR_INVALID_DATA;
}
disp->listener_callback = (DISP_LISTENER_CALLBACK*)calloc(1, sizeof(DISP_LISTENER_CALLBACK));
disp->listener_callback = (GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!disp->listener_callback)
{
@ -371,7 +354,7 @@ static UINT disp_send_monitor_layout(DispClientContext* context, UINT32 NumMonit
DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
{
DISP_PLUGIN* disp;
DISP_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
WINPR_ASSERT(context);

View File

@ -31,6 +31,7 @@
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/geometry.h>
#include <freerdp/channels/log.h>
@ -38,30 +39,12 @@
#include "geometry_main.h"
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} GEOMETRY_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
GEOMETRY_CHANNEL_CALLBACK* channel_callback;
} GEOMETRY_LISTENER_CALLBACK;
typedef struct
{
IWTSPlugin iface;
IWTSListener* listener;
GEOMETRY_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
GeometryClientContext* context;
BOOL initialized;
@ -175,7 +158,7 @@ static UINT32 geometry_read_RGNDATA(wStream* s, UINT32 len, FREERDP_RGNDATA* rgn
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
static UINT geometry_recv_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT32 length, cbGeometryBuffer;
MAPPED_GEOMETRY* mappedGeometry;
@ -315,7 +298,7 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
*/
static UINT geometry_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
{
GEOMETRY_CHANNEL_CALLBACK* callback = (GEOMETRY_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
return geometry_recv_pdu(callback, data);
}
@ -340,13 +323,13 @@ static UINT geometry_on_new_channel_connection(IWTSListenerCallback* pListenerCa
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
GEOMETRY_CHANNEL_CALLBACK* callback;
GEOMETRY_LISTENER_CALLBACK* listener_callback = (GEOMETRY_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
callback = (GEOMETRY_CHANNEL_CALLBACK*)calloc(1, sizeof(GEOMETRY_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
@ -379,7 +362,7 @@ static UINT geometry_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMa
return ERROR_INVALID_DATA;
}
geometry->listener_callback =
(GEOMETRY_LISTENER_CALLBACK*)calloc(1, sizeof(GEOMETRY_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!geometry->listener_callback)
{

View File

@ -35,6 +35,7 @@
#include <freerdp/addin.h>
#include <freerdp/freerdp.h>
#include <freerdp/client/channels.h>
#include "rdpei_common.h"
@ -63,30 +64,12 @@
#define MAX_CONTACTS 64
#define MAX_PEN_CONTACTS 4
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} RDPEI_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
RDPEI_CHANNEL_CALLBACK* channel_callback;
} RDPEI_LISTENER_CALLBACK;
typedef struct
{
IWTSPlugin iface;
IWTSListener* listener;
RDPEI_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
RdpeiClientContext* context;
@ -232,7 +215,7 @@ static UINT rdpei_add_frame(RdpeiClientContext* context)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s, UINT16 eventId,
static UINT rdpei_send_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s, UINT16 eventId,
UINT32 pduLength)
{
UINT status;
@ -308,7 +291,7 @@ static UINT rdpei_write_pen_frame(wStream* s, const RDPINPUT_PEN_FRAME* frame)
return CHANNEL_RC_OK;
}
static UINT rdpei_send_pen_event_pdu(RDPEI_CHANNEL_CALLBACK* callback, UINT32 frameOffset,
static UINT rdpei_send_pen_event_pdu(GENERIC_CHANNEL_CALLBACK* callback, UINT32 frameOffset,
const RDPINPUT_PEN_FRAME* frames, UINT16 count)
{
UINT status;
@ -354,7 +337,7 @@ static UINT rdpei_send_pen_frame(RdpeiClientContext* context, RDPINPUT_PEN_FRAME
{
const UINT64 currentTime = GetTickCount64();
RDPEI_PLUGIN* rdpei;
RDPEI_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
UINT error;
if (!context)
@ -509,7 +492,7 @@ out:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback)
static UINT rdpei_send_cs_ready_pdu(GENERIC_CHANNEL_CALLBACK* callback)
{
UINT status;
wStream* s;
@ -657,7 +640,7 @@ static UINT rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback,
static UINT rdpei_send_touch_event_pdu(GENERIC_CHANNEL_CALLBACK* callback,
RDPINPUT_TOUCH_FRAME* frame)
{
UINT status;
@ -713,7 +696,7 @@ static UINT rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpei_recv_sc_ready_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT32 features = 0;
UINT32 protocolVersion;
@ -757,7 +740,7 @@ static UINT rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_recv_suspend_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpei_recv_suspend_touch_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT error = CHANNEL_RC_OK;
RdpeiClientContext* rdpei;
@ -783,7 +766,7 @@ static UINT rdpei_recv_suspend_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStre
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_recv_resume_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpei_recv_resume_touch_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RdpeiClientContext* rdpei;
UINT error = CHANNEL_RC_OK;
@ -806,7 +789,7 @@ static UINT rdpei_recv_resume_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStrea
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpei_recv_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 eventId;
UINT32 pduLength;
@ -872,7 +855,7 @@ static UINT rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
*/
static UINT rdpei_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
{
RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
return rdpei_recv_pdu(callback, data);
}
@ -883,7 +866,7 @@ static UINT rdpei_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
*/
static UINT rdpei_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
if (callback)
{
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*)callback->plugin;
@ -906,11 +889,11 @@ static UINT rdpei_on_new_channel_connection(IWTSListenerCallback* pListenerCallb
IWTSVirtualChannel* pChannel, BYTE* Data,
BOOL* pbAccept, IWTSVirtualChannelCallback** ppCallback)
{
RDPEI_CHANNEL_CALLBACK* callback;
RDPEI_LISTENER_CALLBACK* listener_callback = (RDPEI_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
if (!listener_callback)
return ERROR_INTERNAL_ERROR;
callback = (RDPEI_CHANNEL_CALLBACK*)calloc(1, sizeof(RDPEI_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
@ -987,7 +970,7 @@ static UINT rdpei_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManag
WLog_ERR(TAG, "[%s] channel initialized twice, aborting", RDPEI_DVC_CHANNEL_NAME);
return ERROR_INVALID_DATA;
}
rdpei->listener_callback = (RDPEI_LISTENER_CALLBACK*)calloc(1, sizeof(RDPEI_LISTENER_CALLBACK));
rdpei->listener_callback = (GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!rdpei->listener_callback)
{
@ -1053,7 +1036,7 @@ UINT rdpei_send_frame(RdpeiClientContext* context, RDPINPUT_TOUCH_FRAME* frame)
{
UINT64 currentTime = GetTickCount64();
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*)context->handle;
RDPEI_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
UINT error;
callback = rdpei->listener_callback->channel_callback;

View File

@ -107,7 +107,7 @@ static UINT rdpgfx_send_caps_advertise_pdu(RdpgfxClientContext* context,
RDPGFX_HEADER header;
RDPGFX_CAPSET* capsSet;
RDPGFX_PLUGIN* gfx;
RDPGFX_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
wStream* s;
gfx = (RDPGFX_PLUGIN*)context->handle;
@ -183,7 +183,7 @@ static BOOL rdpgfx_is_capability_filtered(RDPGFX_PLUGIN* gfx, UINT32 caps)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_send_supported_caps(RDPGFX_CHANNEL_CALLBACK* callback)
static UINT rdpgfx_send_supported_caps(GENERIC_CHANNEL_CALLBACK* callback)
{
RDPGFX_PLUGIN* gfx;
RdpgfxClientContext* context;
@ -351,7 +351,7 @@ static UINT rdpgfx_send_supported_caps(RDPGFX_CHANNEL_CALLBACK* callback)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_caps_confirm_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_caps_confirm_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_CAPSET capsSet;
RDPGFX_CAPS_CONFIRM_PDU pdu;
@ -387,7 +387,7 @@ static UINT rdpgfx_send_frame_acknowledge_pdu(RdpgfxClientContext* context,
wStream* s;
RDPGFX_HEADER header;
RDPGFX_PLUGIN* gfx;
RDPGFX_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
if (!context || !pdu)
return ERROR_BAD_ARGUMENTS;
@ -438,7 +438,7 @@ static UINT rdpgfx_send_qoe_frame_acknowledge_pdu(RdpgfxClientContext* context,
UINT error;
wStream* s;
RDPGFX_HEADER header;
RDPGFX_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
RDPGFX_PLUGIN* gfx;
header.flags = 0;
header.cmdId = RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE;
@ -486,7 +486,7 @@ fail:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
int pad;
UINT32 index;
@ -572,7 +572,7 @@ static UINT rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wS
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_evict_cache_entry_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_evict_cache_entry_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_EVICT_CACHE_ENTRY_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -736,7 +736,7 @@ static UINT rdpgfx_send_cache_import_offer_pdu(RdpgfxClientContext* context,
UINT error = CHANNEL_RC_OK;
wStream* s;
RDPGFX_HEADER header;
RDPGFX_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)context->handle;
if (!context || !pdu)
@ -937,7 +937,7 @@ fail:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_cache_import_reply_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_cache_import_reply_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 idx;
RDPGFX_CACHE_IMPORT_REPLY_PDU pdu;
@ -989,7 +989,7 @@ static UINT rdpgfx_recv_cache_import_reply_pdu(RDPGFX_CHANNEL_CALLBACK* callback
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_create_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_create_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_CREATE_SURFACE_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1025,7 +1025,7 @@ static UINT rdpgfx_recv_create_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wS
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_delete_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_delete_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_DELETE_SURFACE_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1055,7 +1055,7 @@ static UINT rdpgfx_recv_delete_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wS
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_start_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_start_frame_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_START_FRAME_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1089,7 +1089,7 @@ static UINT rdpgfx_recv_start_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStre
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_end_frame_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_END_FRAME_PDU pdu;
RDPGFX_FRAME_ACKNOWLEDGE_PDU ack;
@ -1186,7 +1186,7 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_wire_to_surface_1_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_wire_to_surface_1_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_SURFACE_COMMAND cmd;
RDPGFX_WIRE_TO_SURFACE_PDU_1 pdu;
@ -1274,7 +1274,7 @@ static UINT rdpgfx_recv_wire_to_surface_1_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_wire_to_surface_2_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_wire_to_surface_2_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_SURFACE_COMMAND cmd;
RDPGFX_WIRE_TO_SURFACE_PDU_2 pdu;
@ -1345,7 +1345,7 @@ static UINT rdpgfx_recv_wire_to_surface_2_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_delete_encoding_context_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_delete_encoding_context_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_DELETE_ENCODING_CONTEXT_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1379,7 +1379,7 @@ static UINT rdpgfx_recv_delete_encoding_context_pdu(RDPGFX_CHANNEL_CALLBACK* cal
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_solid_fill_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_solid_fill_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index;
RECTANGLE_16* fillRect;
@ -1446,7 +1446,7 @@ static UINT rdpgfx_recv_solid_fill_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStrea
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_surface_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_surface_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index;
RDPGFX_POINT16* destPt;
@ -1519,7 +1519,7 @@ static UINT rdpgfx_recv_surface_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_surface_to_cache_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_surface_to_cache_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_SURFACE_TO_CACHE_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1564,7 +1564,7 @@ static UINT rdpgfx_recv_surface_to_cache_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_cache_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_cache_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index;
RDPGFX_POINT16* destPt;
@ -1627,7 +1627,7 @@ static UINT rdpgfx_recv_cache_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_map_surface_to_output_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_map_surface_to_output_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1658,7 +1658,7 @@ static UINT rdpgfx_recv_map_surface_to_output_pdu(RDPGFX_CHANNEL_CALLBACK* callb
return error;
}
static UINT rdpgfx_recv_map_surface_to_scaled_output_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
static UINT rdpgfx_recv_map_surface_to_scaled_output_pdu(GENERIC_CHANNEL_CALLBACK* callback,
wStream* s)
{
RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU pdu;
@ -1698,7 +1698,7 @@ static UINT rdpgfx_recv_map_surface_to_scaled_output_pdu(RDPGFX_CHANNEL_CALLBACK
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_map_surface_to_window_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_map_surface_to_window_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_MAP_SURFACE_TO_WINDOW_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1729,7 +1729,7 @@ static UINT rdpgfx_recv_map_surface_to_window_pdu(RDPGFX_CHANNEL_CALLBACK* callb
return error;
}
static UINT rdpgfx_recv_map_surface_to_scaled_window_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
static UINT rdpgfx_recv_map_surface_to_scaled_window_pdu(GENERIC_CHANNEL_CALLBACK* callback,
wStream* s)
{
RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU pdu;
@ -1770,7 +1770,7 @@ static UINT rdpgfx_recv_map_surface_to_scaled_window_pdu(RDPGFX_CHANNEL_CALLBACK
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
size_t beg, end;
RDPGFX_HEADER header;
@ -1979,7 +1979,7 @@ static UINT rdpgfx_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
int status = 0;
UINT32 DstSize = 0;
BYTE* pDstData = NULL;
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
UINT error = CHANNEL_RC_OK;
status = zgfx_decompress(gfx->zgfx, Stream_Pointer(data),
@ -2021,7 +2021,7 @@ static UINT rdpgfx_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
*/
static UINT rdpgfx_on_open(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
RdpgfxClientContext* context = (RdpgfxClientContext*)gfx->iface.pInterface;
UINT error = CHANNEL_RC_OK;
@ -2051,7 +2051,7 @@ static UINT rdpgfx_on_open(IWTSVirtualChannelCallback* pChannelCallback)
static UINT rdpgfx_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
RdpgfxClientContext* context = (RdpgfxClientContext*)gfx->iface.pInterface;
@ -2089,9 +2089,9 @@ static UINT rdpgfx_on_new_channel_connection(IWTSListenerCallback* pListenerCall
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
RDPGFX_CHANNEL_CALLBACK* callback;
RDPGFX_LISTENER_CALLBACK* listener_callback = (RDPGFX_LISTENER_CALLBACK*)pListenerCallback;
callback = (RDPGFX_CHANNEL_CALLBACK*)calloc(1, sizeof(RDPGFX_CHANNEL_CALLBACK));
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
@ -2124,7 +2124,7 @@ static UINT rdpgfx_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
WLog_ERR(TAG, "[%s] channel initialized twice, aborting", RDPGFX_DVC_CHANNEL_NAME);
return ERROR_INVALID_DATA;
}
gfx->listener_callback = (RDPGFX_LISTENER_CALLBACK*)calloc(1, sizeof(RDPGFX_LISTENER_CALLBACK));
gfx->listener_callback = (GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!gfx->listener_callback)
{

View File

@ -27,36 +27,19 @@
#include <winpr/wlog.h>
#include <winpr/collections.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/rdpgfx.h>
#include <freerdp/channels/log.h>
#include <freerdp/codec/zgfx.h>
#include <freerdp/cache/persistent.h>
#include <freerdp/freerdp.h>
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} RDPGFX_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
RDPGFX_CHANNEL_CALLBACK* channel_callback;
} RDPGFX_LISTENER_CALLBACK;
typedef struct
{
IWTSPlugin iface;
IWTSListener* listener;
RDPGFX_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
rdpSettings* settings;

View File

@ -45,33 +45,17 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/client/channels.h>
#include "rdpsnd_common.h"
#include "rdpsnd_main.h"
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} RDPSND_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
RDPSND_CHANNEL_CALLBACK* channel_callback;
} RDPSND_LISTENER_CALLBACK;
struct rdpsnd_plugin
{
IWTSPlugin iface;
IWTSListener* listener;
RDPSND_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
CHANNEL_DEF channelDef;
CHANNEL_ENTRY_POINTS_FREERDP_EX channelEntryPoints;
@ -1569,7 +1553,7 @@ BOOL VCAPITYPE rdpsnd_VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints,
static UINT rdpsnd_on_open(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPSND_CHANNEL_CALLBACK* callback = (RDPSND_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
rdpsndPlugin* rdpsnd;
WINPR_ASSERT(callback);
@ -1585,7 +1569,7 @@ static UINT rdpsnd_on_open(IWTSVirtualChannelCallback* pChannelCallback)
static UINT rdpsnd_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
{
RDPSND_CHANNEL_CALLBACK* callback = (RDPSND_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
rdpsndPlugin* plugin;
wStream* copy;
size_t len;
@ -1615,7 +1599,7 @@ static UINT rdpsnd_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
static UINT rdpsnd_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPSND_CHANNEL_CALLBACK* callback = (RDPSND_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
rdpsndPlugin* rdpsnd;
WINPR_ASSERT(callback);
@ -1644,12 +1628,12 @@ static UINT rdpsnd_on_new_channel_connection(IWTSListenerCallback* pListenerCall
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
RDPSND_CHANNEL_CALLBACK* callback;
RDPSND_LISTENER_CALLBACK* listener_callback = (RDPSND_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
WINPR_ASSERT(listener_callback);
WINPR_ASSERT(pChannel);
WINPR_ASSERT(ppCallback);
callback = (RDPSND_CHANNEL_CALLBACK*)calloc(1, sizeof(RDPSND_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
@ -1683,7 +1667,7 @@ static UINT rdpsnd_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
return ERROR_INVALID_DATA;
}
rdpsnd->listener_callback =
(RDPSND_LISTENER_CALLBACK*)calloc(1, sizeof(RDPSND_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!rdpsnd->listener_callback)
{

View File

@ -52,6 +52,7 @@
#include <winpr/stream.h>
#include "sshagent_main.h"
#include <freerdp/client/channels.h>
#include <freerdp/channels/log.h>
#define TAG CHANNELS_TAG("sshagent.client")
@ -69,11 +70,7 @@ typedef struct
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
GENERIC_CHANNEL_CALLBACK generic;
rdpContext* rdpcontext;
int agent_fd;
@ -159,7 +156,8 @@ static DWORD WINAPI sshagent_read_thread(LPVOID data)
else
{
/* Something read: forward to virtual channel */
status = callback->channel->Write(callback->channel, bytes_read, buffer, NULL);
IWTSVirtualChannel* channel = callback->generic.channel;
status = channel->Write(channel, bytes_read, buffer, NULL);
if (status != CHANNEL_RC_OK)
{
@ -253,6 +251,7 @@ static UINT sshagent_on_new_channel_connection(IWTSListenerCallback* pListenerCa
IWTSVirtualChannelCallback** ppCallback)
{
SSHAGENT_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* generic;
SSHAGENT_LISTENER_CALLBACK* listener_callback = (SSHAGENT_LISTENER_CALLBACK*)pListenerCallback;
callback = (SSHAGENT_CHANNEL_CALLBACK*)calloc(1, sizeof(SSHAGENT_CHANNEL_CALLBACK));
@ -273,11 +272,12 @@ static UINT sshagent_on_new_channel_connection(IWTSListenerCallback* pListenerCa
}
InitializeCriticalSection(&callback->lock);
callback->iface.OnDataReceived = sshagent_on_data_received;
callback->iface.OnClose = sshagent_on_close;
callback->plugin = listener_callback->plugin;
callback->channel_mgr = listener_callback->channel_mgr;
callback->channel = pChannel;
generic = &callback->generic;
generic->iface.OnDataReceived = sshagent_on_data_received;
generic->iface.OnClose = sshagent_on_close;
generic->plugin = listener_callback->plugin;
generic->channel_mgr = listener_callback->channel_mgr;
generic->channel = pChannel;
callback->rdpcontext = listener_callback->rdpcontext;
callback->thread = CreateThread(NULL, 0, sshagent_read_thread, (void*)callback, 0, NULL);

View File

@ -53,7 +53,7 @@ static void usb_process_get_port_status(IUDEVICE* pdev, wStream* out)
}
}
static UINT urb_write_completion(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, BOOL noAck,
static UINT urb_write_completion(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, BOOL noAck,
wStream* out, UINT32 InterfaceId, UINT32 MessageId,
UINT32 RequestId, UINT32 usbd_status, UINT32 OutputBufferSize)
{
@ -113,7 +113,7 @@ static wStream* urb_create_iocompletion(UINT32 InterfaceField, UINT32 MessageId,
}
static UINT urbdrc_process_register_request_callback(IUDEVICE* pdev,
URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
IUDEVMAN* udevman)
{
UINT32 NumRequestCompletion = 0;
@ -207,7 +207,7 @@ static UINT urbdrc_process_retract_device_request(IUDEVICE* pdev, wStream* s, IU
return ERROR_SUCCESS;
}
static UINT urbdrc_process_io_control(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urbdrc_process_io_control(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 MessageId, IUDEVMAN* udevman)
{
UINT32 InterfaceId;
@ -304,7 +304,7 @@ static UINT urbdrc_process_io_control(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* c
return stream_write_and_free(callback->plugin, callback->channel, out);
}
static UINT urbdrc_process_internal_io_control(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urbdrc_process_internal_io_control(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 MessageId, IUDEVMAN* udevman)
{
wStream* out;
@ -339,7 +339,7 @@ static UINT urbdrc_process_internal_io_control(IUDEVICE* pdev, URBDRC_CHANNEL_CA
return stream_write_and_free(callback->plugin, callback->channel, out);
}
static UINT urbdrc_process_query_device_text(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urbdrc_process_query_device_text(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 MessageId, IUDEVMAN* udevman)
{
UINT32 out_size;
@ -398,7 +398,7 @@ static void func_select_all_interface_for_msconfig(IUDEVICE* pdev,
}
}
static UINT urb_select_configuration(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urb_select_configuration(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 RequestField, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir)
{
@ -515,7 +515,7 @@ static UINT urb_select_configuration(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* ca
return ERROR_SUCCESS;
}
static UINT urb_select_interface(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urb_select_interface(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 RequestField, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir)
{
@ -604,7 +604,7 @@ static UINT urb_select_interface(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callba
return ERROR_SUCCESS;
}
static UINT urb_control_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urb_control_transfer(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 RequestField, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir, int External)
{
@ -692,7 +692,7 @@ static UINT urb_control_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callba
usbd_status, OutputBufferSize);
}
static void urb_bulk_transfer_cb(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* out,
static void urb_bulk_transfer_cb(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* out,
UINT32 InterfaceId, BOOL noAck, UINT32 MessageId, UINT32 RequestId,
UINT32 NumberOfPackets, UINT32 status, UINT32 StartFrame,
UINT32 ErrorCount, UINT32 OutputBufferSize)
@ -704,7 +704,7 @@ static void urb_bulk_transfer_cb(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callba
Stream_Free(out, TRUE);
}
static UINT urb_bulk_or_interrupt_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_bulk_or_interrupt_transfer(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, int transferDir)
{
@ -730,7 +730,7 @@ static UINT urb_bulk_or_interrupt_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBA
urb_bulk_transfer_cb, 10000);
}
static void urb_isoch_transfer_cb(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* out,
static void urb_isoch_transfer_cb(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* out,
UINT32 InterfaceId, BOOL noAck, UINT32 MessageId,
UINT32 RequestId, UINT32 NumberOfPackets, UINT32 status,
UINT32 StartFrame, UINT32 ErrorCount, UINT32 OutputBufferSize)
@ -777,7 +777,7 @@ static void urb_isoch_transfer_cb(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callb
}
}
static UINT urb_isoch_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urb_isoch_transfer(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 RequestField, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir)
{
@ -819,7 +819,7 @@ static UINT urb_isoch_transfer(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback
return (UINT)rc;
}
static UINT urb_control_descriptor_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_descriptor_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, BYTE func_recipient, int transferDir)
{
@ -899,7 +899,7 @@ static UINT urb_control_descriptor_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBA
usbd_status, OutputBufferSize);
}
static UINT urb_control_get_status_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_get_status_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, BYTE func_recipient, int transferDir)
{
@ -958,7 +958,7 @@ static UINT urb_control_get_status_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBA
usbd_status, OutputBufferSize);
}
static UINT urb_control_vendor_or_class_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_vendor_or_class_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, BYTE func_type,
BYTE func_recipient, int transferDir)
@ -1041,7 +1041,7 @@ static UINT urb_control_vendor_or_class_request(IUDEVICE* pdev, URBDRC_CHANNEL_C
usbd_status, OutputBufferSize);
}
static UINT urb_os_feature_descriptor_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_os_feature_descriptor_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, int transferDir)
{
@ -1126,7 +1126,7 @@ static UINT urb_os_feature_descriptor_request(IUDEVICE* pdev, URBDRC_CHANNEL_CAL
usbd_status, OutputBufferSize);
}
static UINT urb_pipe_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urb_pipe_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 RequestField, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir, int action)
{
@ -1205,7 +1205,7 @@ static UINT urb_pipe_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
0);
}
static UINT urb_get_current_frame_number(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_get_current_frame_number(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, int transferDir)
{
@ -1267,7 +1267,7 @@ static UINT urb_get_current_frame_number(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK
}
/* Unused function for current server */
static UINT urb_control_get_configuration_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_get_configuration_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, int transferDir)
{
@ -1323,7 +1323,7 @@ static UINT urb_control_get_configuration_request(IUDEVICE* pdev, URBDRC_CHANNEL
}
/* Unused function for current server */
static UINT urb_control_get_interface_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_get_interface_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, int transferDir)
{
@ -1380,7 +1380,7 @@ static UINT urb_control_get_interface_request(IUDEVICE* pdev, URBDRC_CHANNEL_CAL
usbd_status, OutputBufferSize);
}
static UINT urb_control_feature_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urb_control_feature_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 RequestField, UINT32 MessageId,
IUDEVMAN* udevman, BYTE func_recipient, BYTE command,
int transferDir)
@ -1474,7 +1474,7 @@ static UINT urb_control_feature_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK*
usbd_status, OutputBufferSize);
}
static UINT urbdrc_process_transfer_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* callback,
static UINT urbdrc_process_transfer_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callback,
wStream* s, UINT32 MessageId, IUDEVMAN* udevman,
int transferDir)
{
@ -1767,7 +1767,7 @@ static UINT urbdrc_process_transfer_request(IUDEVICE* pdev, URBDRC_CHANNEL_CALLB
return error;
}
UINT urbdrc_process_udev_data_transfer(URBDRC_CHANNEL_CALLBACK* callback, URBDRC_PLUGIN* urbdrc,
UINT urbdrc_process_udev_data_transfer(GENERIC_CHANNEL_CALLBACK* callback, URBDRC_PLUGIN* urbdrc,
IUDEVMAN* udevman, wStream* data)
{
UINT32 InterfaceId;

View File

@ -30,7 +30,7 @@
#define TRANSFER_CTX(transfer) (HANDLE_CTX((transfer)->dev_handle))
#define ITRANSFER_CTX(transfer) (TRANSFER_CTX(__USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)))
UINT urbdrc_process_udev_data_transfer(URBDRC_CHANNEL_CALLBACK* callback, URBDRC_PLUGIN* urbdrc,
UINT urbdrc_process_udev_data_transfer(GENERIC_CHANNEL_CALLBACK* callback, URBDRC_PLUGIN* urbdrc,
IUDEVMAN* udevman, wStream* data);
#endif /* FREERDP_CHANNEL_URBDRC_CLIENT_DATA_TRANSFER_H */

View File

@ -71,7 +71,7 @@ typedef struct
UINT32 ErrorCount;
IUDEVICE* idev;
UINT32 OutputBufferSize;
URBDRC_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
t_isoch_transfer_cb cb;
wArrayList* queue;
#if !defined(HAVE_STREAM_ID_API)
@ -200,7 +200,7 @@ static ASYNC_TRANSFER_USER_DATA* async_transfer_user_data_new(IUDEVICE* idev, UI
size_t offset, size_t BufferSize,
const BYTE* data, size_t packetSize,
BOOL NoAck, t_isoch_transfer_cb cb,
URBDRC_CHANNEL_CALLBACK* callback)
GENERIC_CHANNEL_CALLBACK* callback)
{
ASYNC_TRANSFER_USER_DATA* user_data;
UDEVICE* pdev = (UDEVICE*)idev;
@ -1199,7 +1199,7 @@ static int libusb_udev_query_device_port_status(IUDEVICE* idev, UINT32* UsbdStat
return success;
}
static int libusb_udev_isoch_transfer(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* callback,
static int libusb_udev_isoch_transfer(IUDEVICE* idev, GENERIC_CHANNEL_CALLBACK* callback,
UINT32 MessageId, UINT32 RequestId, UINT32 EndpointAddress,
UINT32 TransferFlags, UINT32 StartFrame, UINT32 ErrorCount,
BOOL NoAck, const BYTE* packetDescriptorData,
@ -1290,7 +1290,7 @@ static BOOL libusb_udev_control_transfer(IUDEVICE* idev, UINT32 RequestId, UINT3
return TRUE;
}
static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* callback,
static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, GENERIC_CHANNEL_CALLBACK* callback,
UINT32 MessageId, UINT32 RequestId,
UINT32 EndpointAddress, UINT32 TransferFlags,
BOOL NoAck, UINT32 BufferSize, const BYTE* data,

View File

@ -132,7 +132,7 @@ static int func_instance_id_generate(IUDEVICE* pdev, char* strInstanceId, size_t
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urbdrc_process_capability_request(URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urbdrc_process_capability_request(GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 MessageId)
{
UINT32 InterfaceId;
@ -170,7 +170,7 @@ static UINT urbdrc_process_capability_request(URBDRC_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urbdrc_process_channel_create(URBDRC_CHANNEL_CALLBACK* callback, wStream* s,
static UINT urbdrc_process_channel_create(GENERIC_CHANNEL_CALLBACK* callback, wStream* s,
UINT32 MessageId)
{
UINT32 InterfaceId;
@ -239,7 +239,7 @@ static UINT urdbrc_send_virtual_channel_add(IWTSPlugin* plugin, IWTSVirtualChann
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVICE* pdev)
static UINT urdbrc_send_usb_device_add(GENERIC_CHANNEL_CALLBACK* callback, IUDEVICE* pdev)
{
wStream* out;
UINT32 InterfaceId;
@ -375,7 +375,7 @@ static UINT urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVI
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urbdrc_exchange_capabilities(URBDRC_CHANNEL_CALLBACK* callback, wStream* data)
static UINT urbdrc_exchange_capabilities(GENERIC_CHANNEL_CALLBACK* callback, wStream* data)
{
UINT32 MessageId;
UINT32 FunctionId;
@ -437,7 +437,7 @@ static BOOL urbdrc_announce_devices(IUDEVMAN* udevman)
return error == ERROR_SUCCESS;
}
static UINT urbdrc_device_control_channel(URBDRC_CHANNEL_CALLBACK* callback, wStream* s)
static UINT urbdrc_device_control_channel(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*)callback->plugin;
IUDEVMAN* udevman = urbdrc->udevman;
@ -504,7 +504,7 @@ fail:
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback, wStream* data)
static UINT urbdrc_process_channel_notification(GENERIC_CHANNEL_CALLBACK* callback, wStream* data)
{
UINT32 MessageId;
UINT32 FunctionId;
@ -557,7 +557,7 @@ static UINT urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callbac
*/
static UINT urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
{
URBDRC_CHANNEL_CALLBACK* callback = (URBDRC_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
URBDRC_PLUGIN* urbdrc;
IUDEVMAN* udevman;
UINT32 InterfaceId;
@ -610,7 +610,7 @@ static UINT urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
*/
static UINT urbdrc_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
URBDRC_CHANNEL_CALLBACK* callback = (URBDRC_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
if (callback)
{
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*)callback->plugin;
@ -645,13 +645,13 @@ static UINT urbdrc_on_new_channel_connection(IWTSListenerCallback* pListenerCall
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
URBDRC_LISTENER_CALLBACK* listener_callback = (URBDRC_LISTENER_CALLBACK*)pListenerCallback;
URBDRC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
if (!ppCallback)
return ERROR_INVALID_PARAMETER;
callback = (URBDRC_CHANNEL_CALLBACK*)calloc(1, sizeof(URBDRC_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
return ERROR_OUTOFMEMORY;
@ -687,7 +687,7 @@ static UINT urbdrc_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMana
}
udevman = urbdrc->udevman;
urbdrc->listener_callback =
(URBDRC_LISTENER_CALLBACK*)calloc(1, sizeof(URBDRC_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!urbdrc->listener_callback)
return CHANNEL_RC_NO_MEMORY;

View File

@ -23,6 +23,7 @@
#include <winpr/pool.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/channels.h>
#define DEVICE_HARDWARE_ID_SIZE 32
#define DEVICE_COMPATIBILITY_ID_SIZE 36
@ -50,28 +51,12 @@ typedef struct S_IUDEVMAN IUDEVMAN;
_type (*get_##_arg)(IUDEVMAN * udevman); \
void (*set_##_arg)(IUDEVMAN * udevman, _type _arg)
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
} URBDRC_LISTENER_CALLBACK;
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} URBDRC_CHANNEL_CALLBACK;
typedef struct
{
IWTSPlugin iface;
URBDRC_LISTENER_CALLBACK* listener_callback;
GENERIC_LISTENER_CALLBACK* listener_callback;
IUDEVMAN* udevman;
UINT32 vchannel_status;
@ -95,14 +80,14 @@ typedef int (*PFREERDP_URBDRC_DEVICE_ENTRY)(PFREERDP_URBDRC_SERVICE_ENTRY_POINTS
typedef struct
{
URBDRC_CHANNEL_CALLBACK* callback;
GENERIC_CHANNEL_CALLBACK* callback;
URBDRC_PLUGIN* urbdrc;
IUDEVMAN* udevman;
IWTSVirtualChannel* channel;
wStream* s;
} TRANSFER_DATA;
typedef void (*t_isoch_transfer_cb)(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* callback, wStream* out,
typedef void (*t_isoch_transfer_cb)(IUDEVICE* idev, GENERIC_CHANNEL_CALLBACK* callback, wStream* out,
UINT32 InterfaceId, BOOL noAck, UINT32 MessageId,
UINT32 RequestId, UINT32 NumberOfPackets, UINT32 status,
UINT32 StartFrame, UINT32 ErrorCount, UINT32 OutputBufferSize);
@ -110,7 +95,7 @@ typedef void (*t_isoch_transfer_cb)(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* cal
struct S_IUDEVICE
{
/* Transfer */
int (*isoch_transfer)(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* callback, UINT32 MessageId,
int (*isoch_transfer)(IUDEVICE* idev, GENERIC_CHANNEL_CALLBACK* callback, UINT32 MessageId,
UINT32 RequestId, UINT32 EndpointAddress, UINT32 TransferFlags,
UINT32 StartFrame, UINT32 ErrorCount, BOOL NoAck,
const BYTE* packetDescriptorData, UINT32 NumberOfPackets,
@ -122,7 +107,7 @@ struct S_IUDEVICE
BYTE bmRequestType, BYTE Request, UINT16 Value, UINT16 Index, UINT32* UrbdStatus,
UINT32* BufferSize, BYTE* Buffer, UINT32 Timeout);
int (*bulk_or_interrupt_transfer)(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* callback,
int (*bulk_or_interrupt_transfer)(IUDEVICE* idev, GENERIC_CHANNEL_CALLBACK* callback,
UINT32 MessageId, UINT32 RequestId, UINT32 EndpointAddress,
UINT32 TransferFlags, BOOL NoAck, UINT32 BufferSize,
const BYTE* data, t_isoch_transfer_cb cb, UINT32 Timeout);

View File

@ -35,6 +35,7 @@
#include <freerdp/addin.h>
#include <freerdp/primitives.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/geometry.h>
#include <freerdp/client/video.h>
#include <freerdp/channels/log.h>
@ -45,32 +46,14 @@
#include "video_main.h"
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} VIDEO_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
VIDEO_CHANNEL_CALLBACK* channel_callback;
} VIDEO_LISTENER_CALLBACK;
typedef struct
{
IWTSPlugin wtsPlugin;
IWTSListener* controlListener;
IWTSListener* dataListener;
VIDEO_LISTENER_CALLBACK* control_callback;
VIDEO_LISTENER_CALLBACK* data_callback;
GENERIC_LISTENER_CALLBACK* control_callback;
GENERIC_LISTENER_CALLBACK* data_callback;
VideoClientContext* context;
BOOL initialized;
@ -570,7 +553,7 @@ static UINT video_read_tsmm_presentation_req(VideoClientContext* context, wStrea
*/
static UINT video_control_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
VIDEO_CHANNEL_CALLBACK* callback = (VIDEO_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
VIDEO_PLUGIN* video;
VideoClientContext* context;
UINT ret = CHANNEL_RC_OK;
@ -928,7 +911,7 @@ static UINT video_VideoData(VideoClientContext* context, const TSMM_VIDEO_DATA*
static UINT video_data_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
VIDEO_CHANNEL_CALLBACK* callback = (VIDEO_CHANNEL_CALLBACK*)pChannelCallback;
GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
VIDEO_PLUGIN* video;
VideoClientContext* context;
UINT32 cbSize, packetType;
@ -1010,13 +993,13 @@ static UINT video_control_on_new_channel_connection(IWTSListenerCallback* listen
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
VIDEO_CHANNEL_CALLBACK* callback;
VIDEO_LISTENER_CALLBACK* listener_callback = (VIDEO_LISTENER_CALLBACK*)listenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)listenerCallback;
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
callback = (VIDEO_CHANNEL_CALLBACK*)calloc(1, sizeof(VIDEO_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc failed!");
@ -1040,13 +1023,13 @@ static UINT video_data_on_new_channel_connection(IWTSListenerCallback* pListener
BOOL* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
VIDEO_CHANNEL_CALLBACK* callback;
VIDEO_LISTENER_CALLBACK* listener_callback = (VIDEO_LISTENER_CALLBACK*)pListenerCallback;
GENERIC_CHANNEL_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* listener_callback = (GENERIC_LISTENER_CALLBACK*)pListenerCallback;
WINPR_UNUSED(Data);
WINPR_UNUSED(pbAccept);
callback = (VIDEO_CHANNEL_CALLBACK*)calloc(1, sizeof(VIDEO_CHANNEL_CALLBACK));
callback = (GENERIC_CHANNEL_CALLBACK*)calloc(1, sizeof(GENERIC_CHANNEL_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc failed!");
@ -1074,7 +1057,7 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
{
UINT status;
VIDEO_PLUGIN* video = (VIDEO_PLUGIN*)plugin;
VIDEO_LISTENER_CALLBACK* callback;
GENERIC_LISTENER_CALLBACK* callback;
if (video->initialized)
{
@ -1082,7 +1065,7 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
return ERROR_INVALID_DATA;
}
video->control_callback = callback =
(VIDEO_LISTENER_CALLBACK*)calloc(1, sizeof(VIDEO_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc for control callback failed!");
@ -1101,7 +1084,7 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
video->controlListener->pInterface = video->wtsPlugin.pInterface;
video->data_callback = callback =
(VIDEO_LISTENER_CALLBACK*)calloc(1, sizeof(VIDEO_LISTENER_CALLBACK));
(GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc for data callback failed!");

View File

@ -24,6 +24,25 @@
#include <freerdp/addin.h>
#include <freerdp/channels/channels.h>
typedef struct
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
} GENERIC_CHANNEL_CALLBACK;
typedef struct
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
GENERIC_CHANNEL_CALLBACK* channel_callback;
} GENERIC_LISTENER_CALLBACK;
#ifdef __cplusplus
extern "C"
{