diff --git a/channels/cliprdr/cliprdr_format.c b/channels/cliprdr/cliprdr_format.c index 4562d592f..0ce82004e 100644 --- a/channels/cliprdr/cliprdr_format.c +++ b/channels/cliprdr/cliprdr_format.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "cliprdr_constants.h" #include "cliprdr_main.h" @@ -82,7 +83,8 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* data_in, uint32 int supported; int i; - cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); + cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, + FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); num_formats = dataLen / 36; cb_event->formats = (uint32*)xmalloc(sizeof(uint32) * num_formats); cb_event->num_formats = 0; @@ -137,7 +139,8 @@ void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* data_in { FRDP_CB_DATA_REQUEST_EVENT* cb_event; - cb_event = (FRDP_CB_DATA_REQUEST_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL); + cb_event = (FRDP_CB_DATA_REQUEST_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, + FRDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL); stream_read_uint32(data_in, cb_event->format); svc_plugin_send_event((rdpSvcPlugin*)cliprdr, (FRDP_EVENT*)cb_event); } @@ -164,7 +167,8 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* data_i { FRDP_CB_DATA_RESPONSE_EVENT* cb_event; - cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL); + cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, + FRDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL); cb_event->size = dataLen; cb_event->data = (uint8*)xmalloc(dataLen); memcpy(cb_event->data, stream_get_tail(data_in), dataLen); diff --git a/channels/cliprdr/cliprdr_main.c b/channels/cliprdr/cliprdr_main.c index d9c5e6e7b..b86c8344f 100644 --- a/channels/cliprdr/cliprdr_main.c +++ b/channels/cliprdr/cliprdr_main.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "cliprdr_constants.h" #include "cliprdr_main.h" @@ -92,7 +93,7 @@ static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr) cliprdr_send_clip_caps(cliprdr); - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_SYNC, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_SYNC, NULL, NULL); svc_plugin_send_event((rdpSvcPlugin*)cliprdr, event); } diff --git a/channels/rail/rail_main.c b/channels/rail/rail_main.c index 8a6bdf12e..50f50f772 100644 --- a/channels/rail/rail_main.c +++ b/channels/rail/rail_main.c @@ -91,7 +91,7 @@ static void rail_plugin_send_vchannel_event(void* rail_plugin_object, RAIL_VCHAN memset(payload, 0, sizeof(RAIL_VCHANNEL_EVENT)); memcpy(payload, event, sizeof(RAIL_VCHANNEL_EVENT)); - out_event = freerdp_event_new(FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI, on_free_rail_vchannel_event, payload); + out_event = freerdp_event_new(FRDP_EVENT_CLASS_RAIL, FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI, on_free_rail_vchannel_event, payload); svc_plugin_send_event((rdpSvcPlugin*) plugin, out_event); } diff --git a/channels/rdpdbg/rdpdbg_main.c b/channels/rdpdbg/rdpdbg_main.c index 939aa66b5..65dbb2f0c 100644 --- a/channels/rdpdbg/rdpdbg_main.c +++ b/channels/rdpdbg/rdpdbg_main.c @@ -54,7 +54,7 @@ static void rdpdbg_process_event(rdpSvcPlugin* plugin, FRDP_EVENT* event) DEBUG_WARN("event_type %d", event->event_type); freerdp_event_free(event); - event = freerdp_event_new(FRDP_EVENT_TYPE_DEBUG, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_DEBUG, 0, NULL, NULL); svc_plugin_send_event(plugin, event); } diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index bec65c647..c1be80800 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "df_event.h" @@ -212,7 +213,7 @@ df_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) FRDP_EVENT* event; FRDP_CB_FORMAT_LIST_EVENT* format_list_event; - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index aad529201..6bd361f4a 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "xf_event.h" @@ -337,7 +339,7 @@ void xf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) FRDP_EVENT* event; FRDP_CB_FORMAT_LIST_EVENT* format_list_event; - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; diff --git a/client/test/freerdp.c b/client/test/freerdp.c index 6f8a4b80d..bb463a5e5 100644 --- a/client/test/freerdp.c +++ b/client/test/freerdp.c @@ -30,6 +30,7 @@ #include #include #include +#include #define SET_TFI(_instance, _tfi) (_instance)->param1 = _tfi #define GET_TFI(_instance) ((tfInfo*) ((_instance)->param1)) @@ -92,7 +93,7 @@ void tf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) FRDP_EVENT* event; FRDP_CB_FORMAT_LIST_EVENT* format_list_event; - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; diff --git a/cunit/test_chanman.c b/cunit/test_chanman.c index cdb13e493..7aa0c8f81 100644 --- a/cunit/test_chanman.c +++ b/cunit/test_chanman.c @@ -76,7 +76,7 @@ void test_chanman(void) freerdp_chanman_data(&instance, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10); freerdp_chanman_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11); - event = freerdp_event_new(FRDP_EVENT_TYPE_DEBUG, NULL, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_DEBUG, 0, NULL, NULL); freerdp_chanman_send_event(chan_man, "rdpdbg", event); while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) diff --git a/cunit/test_cliprdr.c b/cunit/test_cliprdr.c index 7b0500ab5..088cbefb5 100644 --- a/cunit/test_cliprdr.c +++ b/cunit/test_cliprdr.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "test_cliprdr.h" @@ -139,7 +140,7 @@ void test_cliprdr(void) freerdp_event_free(event); /* UI sends format_list event to cliprdr */ - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL); format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 2; format_list_event->formats = (uint32*)xmalloc(sizeof(uint32) * 2); @@ -196,7 +197,7 @@ void test_cliprdr(void) freerdp_event_free(event); /* UI sends data response event to cliprdr */ - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL); data_response_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event; data_response_event->data = (uint8*)xmalloc(6); strcpy((char*)data_response_event->data, "hello"); @@ -211,7 +212,7 @@ void test_cliprdr(void) } /* UI sends data request event to cliprdr */ - event = freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_REQUEST, event_process_callback, NULL); + event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_DATA_REQUEST, event_process_callback, NULL); data_request_event = (FRDP_CB_DATA_REQUEST_EVENT*)event; data_request_event->format = CB_FORMAT_UNICODETEXT; event_processed = 0; diff --git a/include/freerdp/constants.h b/include/freerdp/constants.h index 727a673c4..fc2d4d7e3 100644 --- a/include/freerdp/constants.h +++ b/include/freerdp/constants.h @@ -77,38 +77,6 @@ enum RDP_SVC_CHANNEL_EVENT CHANNEL_EVENT_USER = 1000 }; -/** - * FreeRDP Event Types - */ -enum FRDP_EVENT_TYPE -{ - FRDP_EVENT_TYPE_DEBUG = 0, - FRDP_EVENT_TYPE_VIDEO_FRAME = 1, - FRDP_EVENT_TYPE_REDRAW = 2, - FRDP_EVENT_TYPE_CB_SYNC = 3, - FRDP_EVENT_TYPE_CB_FORMAT_LIST = 4, - FRDP_EVENT_TYPE_CB_DATA_REQUEST = 5, - FRDP_EVENT_TYPE_CB_DATA_RESPONSE = 6, - - FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL = 100, - FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI = 101 -}; - -/** - * Clipboard Formats - */ -enum FRDP_CB_FORMAT -{ - CB_FORMAT_RAW = 0, - CB_FORMAT_TEXT = 1, - CB_FORMAT_DIB = 8, - CB_FORMAT_UNICODETEXT = 13, - CB_FORMAT_HTML = 0xD010, - CB_FORMAT_PNG = 0xD011, - CB_FORMAT_JPEG = 0xD012, - CB_FORMAT_GIF = 0xD013 -}; - /** * Virtual Channel Constants */ diff --git a/include/freerdp/plugins/cliprdr.h b/include/freerdp/plugins/cliprdr.h new file mode 100644 index 000000000..34ba9a812 --- /dev/null +++ b/include/freerdp/plugins/cliprdr.h @@ -0,0 +1,77 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Clipboard Virtual Channel Types + * + * 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 __CLIPRDR_PLUGIN +#define __CLIPRDR_PLUGIN + +/** + * Event Types + */ +enum FRDP_EVENT_TYPE_CB +{ + FRDP_EVENT_TYPE_CB_SYNC = 1, + FRDP_EVENT_TYPE_CB_FORMAT_LIST, + FRDP_EVENT_TYPE_CB_DATA_REQUEST, + FRDP_EVENT_TYPE_CB_DATA_RESPONSE +}; + +/** + * Clipboard Formats + */ +enum FRDP_CB_FORMAT +{ + CB_FORMAT_RAW = 0, + CB_FORMAT_TEXT = 1, + CB_FORMAT_DIB = 8, + CB_FORMAT_UNICODETEXT = 13, + CB_FORMAT_HTML = 0xD010, + CB_FORMAT_PNG = 0xD011, + CB_FORMAT_JPEG = 0xD012, + CB_FORMAT_GIF = 0xD013 +}; + +/** + * Clipboard Events + */ +typedef FRDP_EVENT FRDP_CB_SYNC_EVENT; + +struct _FRDP_CB_FORMAT_LIST_EVENT +{ + FRDP_EVENT event; + uint32* formats; + uint16 num_formats; +}; +typedef struct _FRDP_CB_FORMAT_LIST_EVENT FRDP_CB_FORMAT_LIST_EVENT; + +struct _FRDP_CB_DATA_REQUEST_EVENT +{ + FRDP_EVENT event; + uint32 format; +}; +typedef struct _FRDP_CB_DATA_REQUEST_EVENT FRDP_CB_DATA_REQUEST_EVENT; + +struct _FRDP_CB_DATA_RESPONSE_EVENT +{ + FRDP_EVENT event; + uint8* data; + uint32 size; +}; +typedef struct _FRDP_CB_DATA_RESPONSE_EVENT FRDP_CB_DATA_RESPONSE_EVENT; + +#endif /* __CLIPRDR_PLUGIN */ diff --git a/include/freerdp/plugins/tsmf.h b/include/freerdp/plugins/tsmf.h new file mode 100644 index 000000000..9779744e1 --- /dev/null +++ b/include/freerdp/plugins/tsmf.h @@ -0,0 +1,59 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Multimedia Redirection Virtual Channel Types + * + * 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 __TSMF_PLUGIN +#define __TSMF_PLUGIN + +/** + * Event Types + */ +enum FRDP_EVENT_TYPE_TSMF +{ + FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME = 1, + FRDP_EVENT_TYPE_TSMF_REDRAW +}; + +struct _FRDP_VIDEO_FRAME_EVENT +{ + FRDP_EVENT event; + uint8* frame_data; + uint32 frame_size; + uint32 frame_pixfmt; + sint16 frame_width; + sint16 frame_height; + sint16 x; + sint16 y; + sint16 width; + sint16 height; + uint16 num_visible_rects; + FRDP_RECT* visible_rects; +}; +typedef struct _FRDP_VIDEO_FRAME_EVENT FRDP_VIDEO_FRAME_EVENT; + +struct _FRDP_REDRAW_EVENT +{ + FRDP_EVENT event; + sint16 x; + sint16 y; + sint16 width; + sint16 height; +}; +typedef struct _FRDP_REDRAW_EVENT FRDP_REDRAW_EVENT; + +#endif /* __TSMF_PLUGIN */ diff --git a/include/freerdp/rail.h b/include/freerdp/rail.h index d75414004..4c312135f 100644 --- a/include/freerdp/rail.h +++ b/include/freerdp/rail.h @@ -300,6 +300,12 @@ enum RDP_RAIL_PDU_TYPE RDP_RAIL_ORDER_GET_APPID_RESP = 0x000F }; +enum FRDP_EVENT_TYPE_RAIL +{ + FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL = 1, + FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI +}; + /* RAIL Common structures */ // Events from 'rail' vchannel plugin to UI diff --git a/include/freerdp/types.h b/include/freerdp/types.h index 7c949a457..55fe4d487 100644 --- a/include/freerdp/types.h +++ b/include/freerdp/types.h @@ -126,68 +126,26 @@ typedef struct _FRDP_RECT } FRDP_RECT; +/* Plugin events */ typedef struct _FRDP_EVENT FRDP_EVENT; typedef void (*FRDP_EVENT_CALLBACK) (FRDP_EVENT* event); struct _FRDP_EVENT { + uint16 event_class; uint16 event_type; FRDP_EVENT_CALLBACK on_event_free_callback; void* user_data; }; -struct _FRDP_VIDEO_FRAME_EVENT +enum FRDP_EVENT_CLASS { - FRDP_EVENT event; - uint8* frame_data; - uint32 frame_size; - uint32 frame_pixfmt; - sint16 frame_width; - sint16 frame_height; - sint16 x; - sint16 y; - sint16 width; - sint16 height; - uint16 num_visible_rects; - FRDP_RECT* visible_rects; + FRDP_EVENT_CLASS_DEBUG = 0, + FRDP_EVENT_CLASS_CLIPRDR, + FRDP_EVENT_CLASS_TSMF, + FRDP_EVENT_CLASS_RAIL }; -typedef struct _FRDP_VIDEO_FRAME_EVENT FRDP_VIDEO_FRAME_EVENT; - -struct _FRDP_REDRAW_EVENT -{ - FRDP_EVENT event; - sint16 x; - sint16 y; - sint16 width; - sint16 height; -}; -typedef struct _FRDP_REDRAW_EVENT FRDP_REDRAW_EVENT; - -typedef FRDP_EVENT FRDP_CB_SYNC_EVENT; - -struct _FRDP_CB_FORMAT_LIST_EVENT -{ - FRDP_EVENT event; - uint32* formats; - uint16 num_formats; -}; -typedef struct _FRDP_CB_FORMAT_LIST_EVENT FRDP_CB_FORMAT_LIST_EVENT; - -struct _FRDP_CB_DATA_REQUEST_EVENT -{ - FRDP_EVENT event; - uint32 format; -}; -typedef struct _FRDP_CB_DATA_REQUEST_EVENT FRDP_CB_DATA_REQUEST_EVENT; - -struct _FRDP_CB_DATA_RESPONSE_EVENT -{ - FRDP_EVENT event; - uint8* data; - uint32 size; -}; -typedef struct _FRDP_CB_DATA_RESPONSE_EVENT FRDP_CB_DATA_RESPONSE_EVENT; typedef struct rdp_inst rdpInst; diff --git a/include/freerdp/utils/event.h b/include/freerdp/utils/event.h index 6e47f563c..f99acb008 100644 --- a/include/freerdp/utils/event.h +++ b/include/freerdp/utils/event.h @@ -21,9 +21,9 @@ #define __EVENT_UTILS_H #include -#include -FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data); +FRDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type, + FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data); void freerdp_event_free(FRDP_EVENT* event); #endif diff --git a/libfreerdp-utils/event.c b/libfreerdp-utils/event.c index d0cac34e4..76e6f6920 100644 --- a/libfreerdp-utils/event.c +++ b/libfreerdp-utils/event.c @@ -22,22 +22,16 @@ #include #include #include +#include +#include +#include -FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data) +static FRDP_EVENT* freerdp_cliprdr_event_new(uint16 event_type) { FRDP_EVENT* event = NULL; switch (event_type) { - case FRDP_EVENT_TYPE_DEBUG: - event = xnew(FRDP_EVENT); - break; - case FRDP_EVENT_TYPE_VIDEO_FRAME: - event = (FRDP_EVENT*)xnew(FRDP_VIDEO_FRAME_EVENT); - break; - case FRDP_EVENT_TYPE_REDRAW: - event = (FRDP_EVENT*)xnew(FRDP_REDRAW_EVENT); - break; case FRDP_EVENT_TYPE_CB_SYNC: event = (FRDP_EVENT*)xnew(FRDP_CB_SYNC_EVENT); break; @@ -50,13 +44,56 @@ FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_fr case FRDP_EVENT_TYPE_CB_DATA_RESPONSE: event = (FRDP_EVENT*)xnew(FRDP_CB_DATA_RESPONSE_EVENT); break; - case FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL: - case FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI: + } + + return event; +} + +static FRDP_EVENT* freerdp_tsmf_event_new(uint16 event_type) +{ + FRDP_EVENT* event = NULL; + + switch (event_type) + { + case FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME: + event = (FRDP_EVENT*)xnew(FRDP_VIDEO_FRAME_EVENT); + break; + case FRDP_EVENT_TYPE_TSMF_REDRAW: + event = (FRDP_EVENT*)xnew(FRDP_REDRAW_EVENT); + break; + } + + return event; +} + +static FRDP_EVENT* freerdp_rail_event_new(uint16 event_type) +{ + return xnew(FRDP_EVENT); +} + +FRDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type, + FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data) +{ + FRDP_EVENT* event = NULL; + + switch (event_class) + { + case FRDP_EVENT_CLASS_DEBUG: event = xnew(FRDP_EVENT); break; + case FRDP_EVENT_CLASS_CLIPRDR: + event = freerdp_cliprdr_event_new(event_type); + break; + case FRDP_EVENT_CLASS_TSMF: + event = freerdp_tsmf_event_new(event_type); + break; + case FRDP_EVENT_CLASS_RAIL: + event = freerdp_rail_event_new(event_type); + break; } if (event != NULL) { + event->event_class = event_class; event->event_type = event_type; event->on_event_free_callback = on_event_free_callback; event->user_data = user_data; @@ -65,6 +102,43 @@ FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_fr return event; } +static void freerdp_cliprdr_event_free(FRDP_EVENT* event) +{ + switch (event->event_type) + { + case FRDP_EVENT_TYPE_CB_FORMAT_LIST: + { + FRDP_CB_FORMAT_LIST_EVENT* cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; + xfree(cb_event->formats); + } + break; + case FRDP_EVENT_TYPE_CB_DATA_RESPONSE: + { + FRDP_CB_DATA_RESPONSE_EVENT* cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event; + xfree(cb_event->data); + } + break; + } +} + +static void freerdp_tsmf_event_free(FRDP_EVENT* event) +{ + switch (event->event_type) + { + case FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME: + { + FRDP_VIDEO_FRAME_EVENT* vevent = (FRDP_VIDEO_FRAME_EVENT*)event; + xfree(vevent->frame_data); + xfree(vevent->visible_rects); + } + break; + } +} + +static void freerdp_rail_event_free(FRDP_EVENT* event) +{ +} + void freerdp_event_free(FRDP_EVENT* event) { if (event != NULL) @@ -72,29 +146,16 @@ void freerdp_event_free(FRDP_EVENT* event) if (event->on_event_free_callback != NULL) event->on_event_free_callback(event); - switch (event->event_type) + switch (event->event_class) { - case FRDP_EVENT_TYPE_VIDEO_FRAME: - { - FRDP_VIDEO_FRAME_EVENT* vevent = (FRDP_VIDEO_FRAME_EVENT*)event; - - xfree(vevent->frame_data); - xfree(vevent->visible_rects); - } + case FRDP_EVENT_CLASS_CLIPRDR: + freerdp_cliprdr_event_free(event); break; - case FRDP_EVENT_TYPE_CB_FORMAT_LIST: - { - FRDP_CB_FORMAT_LIST_EVENT* cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)event; - - xfree(cb_event->formats); - } + case FRDP_EVENT_CLASS_TSMF: + freerdp_tsmf_event_free(event); break; - case FRDP_EVENT_TYPE_CB_DATA_RESPONSE: - { - FRDP_CB_DATA_RESPONSE_EVENT* cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event; - - xfree(cb_event->data); - } + case FRDP_EVENT_CLASS_RAIL: + freerdp_rail_event_free(event); break; } xfree(event); diff --git a/libfreerdp-utils/rail.c b/libfreerdp-utils/rail.c index 14e90dde4..9281b365d 100644 --- a/libfreerdp-utils/rail.c +++ b/libfreerdp-utils/rail.c @@ -17,6 +17,7 @@ * limitations under the License. */ +#include #include #include