freerdp: remove deprecated eventing system

This commit is contained in:
Marc-André Moreau 2014-11-12 13:18:18 -05:00
parent 24a752a708
commit 0e7c95c421
16 changed files with 3 additions and 407 deletions

View File

@ -137,21 +137,6 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
return 0;
}
int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event)
{
int status;
status = svc_plugin_send_event((rdpSvcPlugin*) drdynvc, event);
if (status != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "pVirtualChannelEventPush failed %d", status);
return 1;
}
return 0;
}
static int drdynvc_send_capability_response(drdynvcPlugin* drdynvc)
{
int status;
@ -406,11 +391,6 @@ static void drdynvc_process_connect(rdpSvcPlugin* plugin)
drdynvc->state = DRDYNVC_STATE_CAPABILITIES;
}
static void drdynvc_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
freerdp_event_free(event);
}
static void drdynvc_process_terminate(rdpSvcPlugin* plugin)
{
drdynvcPlugin* drdynvc = (drdynvcPlugin*) plugin;
@ -466,7 +446,6 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
_p->plugin.connect_callback = drdynvc_process_connect;
_p->plugin.receive_callback = drdynvc_process_receive;
_p->plugin.event_callback = drdynvc_process_event;
_p->plugin.terminate_callback = drdynvc_process_terminate;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP*) pEntryPoints;

View File

@ -63,6 +63,5 @@ struct drdynvc_plugin
};
int drdynvc_write_data(drdynvcPlugin* plugin, UINT32 ChannelId, BYTE* data, UINT32 data_size);
int drdynvc_push_event(drdynvcPlugin* plugin, wMessage* event);
#endif

View File

@ -76,25 +76,6 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
}
}
static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, wMessage* pEvent)
{
int status;
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
status = drdynvc_push_event(dvcman->drdynvc, pEvent);
if (status == 0)
{
DEBUG_DVC("event_type %d pushed.", GetMessageType(pEvent->id));
}
else
{
WLog_ERR(TAG, "event_type %d push failed.", GetMessageType(pEvent->id));
}
return status;
}
static int dvcman_register_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name, IWTSPlugin* pPlugin)
{
DVCMAN* dvcman = ((DVCMAN_ENTRY_POINTS*) pEntryPoints)->dvcman;
@ -203,7 +184,6 @@ IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
dvcman = (DVCMAN*) calloc(1, sizeof(DVCMAN));
dvcman->iface.CreateListener = dvcman_create_listener;
dvcman->iface.PushEvent = dvcman_push_event;
dvcman->iface.FindChannelById = dvcman_find_channel_by_id;
dvcman->iface.GetChannelId = dvcman_get_channel_id;
dvcman->drdynvc = plugin;

View File

@ -37,12 +37,12 @@ struct _DVCMAN
drdynvcPlugin* drdynvc;
int num_plugins;
const char* plugin_names[MAX_PLUGINS];
IWTSPlugin* plugins[MAX_PLUGINS];
int num_plugins;
IWTSListener* listeners[MAX_PLUGINS];
int num_listeners;
IWTSListener* listeners[MAX_PLUGINS];
wArrayList* channels;
wStreamPool* pool;

View File

@ -38,7 +38,6 @@
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/client/cliprdr.h>

View File

@ -40,7 +40,6 @@ FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings*
const char* name, void* data);
FREERDP_API int freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance);
FREERDP_API int freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance);
FREERDP_API int freerdp_channels_send_event(rdpChannels* channels, wMessage* event);
FREERDP_API BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);
FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance);

View File

@ -91,10 +91,6 @@ struct _IWTSVirtualChannelManager
UINT32 ulFlags,
IWTSListenerCallback *pListenerCallback,
IWTSListener **ppListener);
/* Push a virtual channel event.
This is a FreeRDP extension to standard MS API. */
int (*PushEvent)(IWTSVirtualChannelManager *pChannelMgr,
wMessage *pEvent);
/* Find the channel or ID to send data to a specific endpoint. */
UINT32(*GetChannelId)(IWTSVirtualChannel *channel);
IWTSVirtualChannel *(*FindChannelById)(IWTSVirtualChannelManager *pChannelMgr,

View File

@ -29,8 +29,6 @@
#define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry"
typedef UINT (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(DWORD openHandle, wMessage* event);
#define FREERDP_CHANNEL_MAGIC_NUMBER 0x46524450
struct _CHANNEL_ENTRY_POINTS_FREERDP
@ -47,7 +45,6 @@ struct _CHANNEL_ENTRY_POINTS_FREERDP
void* pExtendedData; /* extended initial data */
void* pInterface; /* channel callback interface, use after initialization */
void** ppInterface; /* channel callback interface, use for initialization */
PVIRTUALCHANNELEVENTPUSH pVirtualChannelEventPush;
};
typedef struct _CHANNEL_ENTRY_POINTS_FREERDP CHANNEL_ENTRY_POINTS_FREERDP;
typedef CHANNEL_ENTRY_POINTS_FREERDP* PCHANNEL_ENTRY_POINTS_FREERDP;

View File

@ -1,38 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Events
*
* Copyright 2011 Vic Lee
*
* 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.
*/
#ifndef FREERDP_UTILS_EVENT_H
#define FREERDP_UTILS_EVENT_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#ifdef __cplusplus
extern "C" {
#endif
FREERDP_API wMessage* freerdp_event_new(UINT16 event_class, UINT16 event_type,
MESSAGE_FREE_FN on_event_free_callback, void* user_data);
FREERDP_API void freerdp_event_free(wMessage* event);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_UTILS_EVENT_H */

View File

@ -35,7 +35,6 @@
#include <freerdp/svc.h>
#include <freerdp/log.h>
#include <freerdp/utils/event.h>
typedef struct rdp_svc_plugin rdpSvcPlugin;
@ -46,7 +45,6 @@ struct rdp_svc_plugin
void (*connect_callback)(rdpSvcPlugin* plugin);
void (*receive_callback)(rdpSvcPlugin* plugin, wStream* data_in);
void (*event_callback)(rdpSvcPlugin* plugin, wMessage* event);
void (*terminate_callback)(rdpSvcPlugin* plugin);
HANDLE thread;
@ -66,7 +64,6 @@ FREERDP_API void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEn
FREERDP_API void svc_plugin_terminate(rdpSvcPlugin* plugin);
FREERDP_API int svc_plugin_send(rdpSvcPlugin* plugin, wStream* data_out);
FREERDP_API int svc_plugin_send_event(rdpSvcPlugin* plugin, wMessage* event);
#ifdef __cplusplus
}

View File

@ -36,7 +36,6 @@
#include <freerdp/svc.h>
#include <freerdp/peer.h>
#include <freerdp/addin.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/drdynvc.h>

View File

@ -258,55 +258,6 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
return 0;
}
/**
* Send a plugin-defined event to the plugin.
* called only from main thread
* @param channels the channel manager instance
* @param event an event object created by freerdp_event_new()
*/
FREERDP_API int freerdp_channels_send_event(rdpChannels* channels, wMessage* event)
{
const char* name = NULL;
CHANNEL_OPEN_DATA* pChannelOpenData;
switch (GetMessageClass(event->id))
{
case CliprdrChannel_Class:
name = "cliprdr";
break;
case TsmfChannel_Class:
name = "tsmf";
break;
case RailChannel_Class:
name = "rail";
break;
}
if (!name)
{
freerdp_event_free(event);
return 1;
}
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, name);
if (!pChannelOpenData)
{
freerdp_event_free(event);
return 1;
}
if (pChannelOpenData->pChannelOpenEventProc)
{
pChannelOpenData->pChannelOpenEventProc(pChannelOpenData->OpenHandle, CHANNEL_EVENT_USER,
event, sizeof(wMessage), sizeof(wMessage), 0);
}
return 0;
}
/**
* called only from main thread
*/
@ -675,42 +626,6 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG
return CHANNEL_RC_OK;
}
UINT FreeRDP_VirtualChannelEventPush(DWORD openHandle, wMessage* event)
{
rdpChannels* channels;
CHANNEL_OPEN_DATA* pChannelOpenData;
pChannelOpenData = HashTable_GetItemValue(g_OpenHandles, (void*) (UINT_PTR) openHandle);
if (!pChannelOpenData)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
channels = pChannelOpenData->channels;
if (!channels)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
if (!channels->is_connected)
return CHANNEL_RC_NOT_CONNECTED;
if (!event)
return CHANNEL_RC_NULL_DATA;
if (pChannelOpenData->flags != 2)
return CHANNEL_RC_NOT_OPEN;
/**
* We really intend to use the In queue for events, but we're pushing on both
* to wake up threads waiting on the out queue. Doing this cleanly would require
* breaking freerdp_pop_event() a bit too early in this refactoring.
*/
MessageQueue_Post(channels->MsgPipe->In, (void*) channels, 1, (void*) event, NULL);
MessageQueue_Post(channels->MsgPipe->Out, (void*) channels, 1, (void*) event, NULL);
return CHANNEL_RC_OK;
}
int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, void* entry, void* data)
{
int status;
@ -739,7 +654,6 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, v
EntryPoints.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
EntryPoints.ppInterface = &g_pInterface;
EntryPoints.pExtendedData = data;
EntryPoints.pVirtualChannelEventPush = FreeRDP_VirtualChannelEventPush;
/* enable VirtualChannelInit */
channels->can_call_init = TRUE;

View File

@ -29,7 +29,6 @@
#include <freerdp/svc.h>
#include <freerdp/peer.h>
#include <freerdp/addin.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/drdynvc.h>

View File

@ -19,7 +19,6 @@ set(MODULE_NAME "freerdp-utils")
set(MODULE_PREFIX "FREERDP_UTILS")
set(${MODULE_PREFIX}_SRCS
event.c
passphrase.c
pcap.c
profiler.c

View File

@ -1,189 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Events
*
* Copyright 2011 Vic Lee
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <freerdp/message.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/rail.h>
static wMessage* freerdp_cliprdr_event_new(UINT16 event_type)
{
union
{
wMessage* m;
void *v;
} event;
event.m = NULL;
switch (event_type)
{
case CliprdrChannel_MonitorReady:
event.v = malloc(sizeof(RDP_CB_MONITOR_READY_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_MONITOR_READY_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, MonitorReady);
break;
case CliprdrChannel_FormatList:
event.v = malloc(sizeof(RDP_CB_FORMAT_LIST_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_FORMAT_LIST_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, FormatList);
break;
case CliprdrChannel_DataRequest:
event.v = malloc(sizeof(RDP_CB_DATA_REQUEST_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_DATA_REQUEST_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, DataRequest);
break;
case CliprdrChannel_DataResponse:
event.v = malloc(sizeof(RDP_CB_DATA_RESPONSE_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_DATA_RESPONSE_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, DataResponse);
break;
case CliprdrChannel_ClipCaps:
event.v = malloc(sizeof(RDP_CB_CLIP_CAPS));
ZeroMemory(event.v, sizeof(RDP_CB_CLIP_CAPS));
event.m->id = MakeMessageId(CliprdrChannel, ClipCaps);
break;
case CliprdrChannel_FilecontentsRequest:
event.v = (wMessage*) malloc(sizeof(RDP_CB_FILECONTENTS_REQUEST_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_FILECONTENTS_REQUEST_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, FilecontentsRequest);
break;
case CliprdrChannel_FilecontentsResponse:
event.v = (wMessage*) malloc(sizeof(RDP_CB_FILECONTENTS_RESPONSE_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_FILECONTENTS_RESPONSE_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, FilecontentsResponse);
break;
case CliprdrChannel_LockClipdata:
event.v = (wMessage*) malloc(sizeof(RDP_CB_LOCK_CLIPDATA_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_LOCK_CLIPDATA_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, LockClipdata);
break;
case CliprdrChannel_UnLockClipdata:
event.v = (wMessage*) malloc(sizeof(RDP_CB_UNLOCK_CLIPDATA_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_UNLOCK_CLIPDATA_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, UnLockClipdata);
break;
case CliprdrChannel_TemporaryDirectory:
event.v = (wMessage*) malloc(sizeof(RDP_CB_TEMPDIR_EVENT));
ZeroMemory(event.v, sizeof(RDP_CB_TEMPDIR_EVENT));
event.m->id = MakeMessageId(CliprdrChannel, TemporaryDirectory);
break;
}
return event.m;
}
static wMessage* freerdp_rail_event_new(UINT16 event_type)
{
wMessage* event = NULL;
event = (wMessage*) malloc(sizeof(wMessage));
ZeroMemory(event, sizeof(wMessage));
return event;
}
wMessage* freerdp_event_new(UINT16 event_class, UINT16 event_type,
MESSAGE_FREE_FN on_event_free_callback, void* user_data)
{
wMessage* event = NULL;
switch (event_class)
{
case CliprdrChannel_Class:
event = freerdp_cliprdr_event_new(event_type);
break;
case RailChannel_Class:
event = freerdp_rail_event_new(event_type);
break;
}
if (event)
{
event->wParam = user_data;
event->Free = (void*) on_event_free_callback;
event->id = GetMessageId(event_class, event_type);
}
return event;
}
static void freerdp_cliprdr_event_free(wMessage* event)
{
switch (GetMessageType(event->id))
{
case CliprdrChannel_FormatList:
{
RDP_CB_FORMAT_LIST_EVENT* cb_event = (RDP_CB_FORMAT_LIST_EVENT*) event;
free(cb_event->formats);
free(cb_event->raw_format_data);
}
break;
case CliprdrChannel_DataResponse:
{
RDP_CB_DATA_RESPONSE_EVENT* cb_event = (RDP_CB_DATA_RESPONSE_EVENT*) event;
free(cb_event->data);
}
break;
}
}
static void freerdp_rail_event_free(wMessage* event)
{
}
void freerdp_event_free(wMessage* event)
{
if (event)
{
if (event->Free)
event->Free(event);
switch (GetMessageClass(event->id))
{
case CliprdrChannel_Class:
freerdp_cliprdr_event_free(event);
break;
case RailChannel_Class:
freerdp_rail_event_free(event);
break;
}
free(event);
}
}

View File

@ -23,18 +23,14 @@
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/stream.h>
#include <winpr/collections.h>
#include <freerdp/constants.h>
#include <freerdp/log.h>
#include <freerdp/utils/event.h>
#include <freerdp/constants.h>
#include <freerdp/utils/svc_plugin.h>
#define TAG FREERDP_TAG("utils")
@ -124,11 +120,6 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT3
}
}
static void svc_plugin_process_event(rdpSvcPlugin* plugin, wMessage* event_in)
{
MessageQueue_Post(plugin->MsgPipe->In, NULL, 1, (void*) event_in, NULL);
}
static VOID VCAPITYPE svc_plugin_open_event(DWORD openHandle, UINT event, LPVOID pData, UINT32 dataLength,
UINT32 totalLength, UINT32 dataFlags)
{
@ -154,17 +145,12 @@ static VOID VCAPITYPE svc_plugin_open_event(DWORD openHandle, UINT event, LPVOID
case CHANNEL_EVENT_WRITE_COMPLETE:
Stream_Free((wStream*) pData, TRUE);
break;
case CHANNEL_EVENT_USER:
svc_plugin_process_event(plugin, (wMessage*) pData);
break;
}
}
static void* svc_plugin_thread_func(void* arg)
{
wStream* data;
wMessage* event;
wMessage message;
rdpSvcPlugin* plugin = (rdpSvcPlugin*) arg;
@ -192,11 +178,6 @@ static void* svc_plugin_thread_func(void* arg)
IFCALL(plugin->receive_callback, plugin, data);
Stream_Release(data);
}
else if (message.id == 1)
{
event = (wMessage*) message.wParam;
IFCALL(plugin->event_callback, plugin, event);
}
}
}
@ -340,18 +321,3 @@ int svc_plugin_send(rdpSvcPlugin* plugin, wStream* data_out)
return status;
}
int svc_plugin_send_event(rdpSvcPlugin* plugin, wMessage* event)
{
UINT32 status = 0;
DEBUG_SVC("event class: %d type: %d",
GetMessageClass(event->id), GetMessageType(event->id));
status = plugin->channel_entry_points.pVirtualChannelEventPush(plugin->OpenHandle, event);
if (status != CHANNEL_RC_OK)
WLog_ERR(TAG, "svc_plugin_send_event: VirtualChannelEventPush failed %d", status);
return status;
}