diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 2662f8be7..bfecc98ed 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -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; diff --git a/channels/drdynvc/client/drdynvc_main.h b/channels/drdynvc/client/drdynvc_main.h index 4eda9d8f5..7056e83dd 100644 --- a/channels/drdynvc/client/drdynvc_main.h +++ b/channels/drdynvc/client/drdynvc_main.h @@ -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 diff --git a/channels/drdynvc/client/dvcman.c b/channels/drdynvc/client/dvcman.c index bef066be7..346adacb7 100644 --- a/channels/drdynvc/client/dvcman.c +++ b/channels/drdynvc/client/dvcman.c @@ -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; diff --git a/channels/drdynvc/client/dvcman.h b/channels/drdynvc/client/dvcman.h index 20f0edeb0..c776ed996 100644 --- a/channels/drdynvc/client/dvcman.h +++ b/channels/drdynvc/client/dvcman.h @@ -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; diff --git a/client/Sample/freerdp.c b/client/Sample/freerdp.c index 9b5e486ae..9238ce4a3 100644 --- a/client/Sample/freerdp.c +++ b/client/Sample/freerdp.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h index 60b481d17..ce512de64 100644 --- a/include/freerdp/channels/channels.h +++ b/include/freerdp/channels/channels.h @@ -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); diff --git a/include/freerdp/dvc.h b/include/freerdp/dvc.h index 673ab50a8..3117e3828 100644 --- a/include/freerdp/dvc.h +++ b/include/freerdp/dvc.h @@ -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, diff --git a/include/freerdp/svc.h b/include/freerdp/svc.h index fb9af4f47..d424770d5 100644 --- a/include/freerdp/svc.h +++ b/include/freerdp/svc.h @@ -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; diff --git a/include/freerdp/utils/event.h b/include/freerdp/utils/event.h deleted file mode 100644 index 2b4440da3..000000000 --- a/include/freerdp/utils/event.h +++ /dev/null @@ -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 -#include - -#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 */ diff --git a/include/freerdp/utils/svc_plugin.h b/include/freerdp/utils/svc_plugin.h index 61bd981e2..6ac5d0516 100644 --- a/include/freerdp/utils/svc_plugin.h +++ b/include/freerdp/utils/svc_plugin.h @@ -35,7 +35,6 @@ #include #include -#include 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 } diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index 53c6e3149..53e36b918 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/libfreerdp/core/client.c b/libfreerdp/core/client.c index 93d5292e6..fd9c7c519 100644 --- a/libfreerdp/core/client.c +++ b/libfreerdp/core/client.c @@ -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; diff --git a/libfreerdp/core/client.h b/libfreerdp/core/client.h index 3005b760b..6ff52c829 100644 --- a/libfreerdp/core/client.h +++ b/libfreerdp/core/client.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/libfreerdp/utils/CMakeLists.txt b/libfreerdp/utils/CMakeLists.txt index 1d268632f..406c2c412 100644 --- a/libfreerdp/utils/CMakeLists.txt +++ b/libfreerdp/utils/CMakeLists.txt @@ -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 diff --git a/libfreerdp/utils/event.c b/libfreerdp/utils/event.c deleted file mode 100644 index c8772c905..000000000 --- a/libfreerdp/utils/event.c +++ /dev/null @@ -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 - -#include -#include -#include -#include - -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); - } -} diff --git a/libfreerdp/utils/svc_plugin.c b/libfreerdp/utils/svc_plugin.c index 50e418529..901837ccd 100644 --- a/libfreerdp/utils/svc_plugin.c +++ b/libfreerdp/utils/svc_plugin.c @@ -23,18 +23,14 @@ #endif #include -#include -#include -#include #include #include #include #include -#include #include -#include +#include #include #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; -}