libfreerdp-chanman: name argument is not necessary when sending events.

This commit is contained in:
Vic Lee 2011-08-11 11:36:10 +08:00
parent d7e502dbe1
commit 4ce70e03d1
7 changed files with 26 additions and 10 deletions

View File

@ -218,7 +218,7 @@ df_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
format_list_event->num_formats = 0;
freerdp_chanman_send_event(chanman, "cliprdr", event);
freerdp_chanman_send_event(chanman, event);
}
static void

View File

@ -344,7 +344,7 @@ void xf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
format_list_event->num_formats = 0;
freerdp_chanman_send_event(chanman, "cliprdr", event);
freerdp_chanman_send_event(chanman, event);
}
void xf_process_rail_event(rdpChanMan* chanman, freerdp* instance)

View File

@ -98,7 +98,7 @@ void tf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
format_list_event->num_formats = 0;
freerdp_chanman_send_event(chanman, "cliprdr", event);
freerdp_chanman_send_event(chanman, event);
}
void tf_process_channel_event(rdpChanMan* chanman, freerdp* instance)

View File

@ -77,7 +77,7 @@ void test_chanman(void)
freerdp_chanman_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11);
event = freerdp_event_new(FRDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
freerdp_chanman_send_event(chan_man, "rdpdbg", event);
freerdp_chanman_send_event(chan_man, event);
while ((event = freerdp_chanman_pop_event(chan_man)) == NULL)
{

View File

@ -147,7 +147,7 @@ void test_cliprdr(void)
format_list_event->formats[0] = CB_FORMAT_TEXT;
format_list_event->formats[1] = CB_FORMAT_HTML;
event_processed = 0;
freerdp_chanman_send_event(chan_man, "cliprdr", event);
freerdp_chanman_send_event(chan_man, event);
/* cliprdr sends format list PDU to server */
while (!event_processed)
@ -203,7 +203,7 @@ void test_cliprdr(void)
strcpy((char*)data_response_event->data, "hello");
data_response_event->size = 6;
event_processed = 0;
freerdp_chanman_send_event(chan_man, "cliprdr", event);
freerdp_chanman_send_event(chan_man, event);
/* cliprdr sends data response PDU to server */
while (!event_processed)
@ -216,7 +216,7 @@ void test_cliprdr(void)
data_request_event = (FRDP_CB_DATA_REQUEST_EVENT*)event;
data_request_event->format = CB_FORMAT_UNICODETEXT;
event_processed = 0;
freerdp_chanman_send_event(chan_man, "cliprdr", event);
freerdp_chanman_send_event(chan_man, event);
/* cliprdr sends data request PDU to server */
while (!event_processed)

View File

@ -40,7 +40,7 @@ FREERDP_API int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* insta
FREERDP_API int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance);
FREERDP_API int freerdp_chanman_data(freerdp* instance, int chan_id, char* data, int data_size,
int flags, int total_size);
FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, const char* name, FRDP_EVENT* event);
FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, FRDP_EVENT* event);
FREERDP_API boolean freerdp_chanman_get_fds(rdpChanMan* chan_man, freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);
FREERDP_API boolean freerdp_chanman_check_fds(rdpChanMan* chan_man, freerdp* instance);

View File

@ -764,17 +764,33 @@ int freerdp_chanman_data(freerdp* instance, int chan_id, char* data, int data_si
return 0;
}
static const char* event_class_to_name_table[] =
{
"rdpdbg", /* FRDP_EVENT_CLASS_DEBUG */
"cliprdr", /* FRDP_EVENT_CLASS_CLIPRDR */
"tsmf", /* FRDP_EVENT_CLASS_TSMF */
"rail", /* FRDP_EVENT_CLASS_RAIL */
NULL
};
/**
* Send a plugin-defined event to the plugin.
* called only from main thread
* @param chan_man the channel manager instance
* @param name the static virtual channel name, such as 'cliprdr'
* @param event an event object created by freerdp_event_new()
*/
FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, const char* name, FRDP_EVENT* event)
FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, FRDP_EVENT* event)
{
struct chan_data* lchan_data;
int index;
const char* name;
name = event_class_to_name_table[event->event_class];
if (name == NULL)
{
DEBUG_CHANMAN("unknown event_class %d", event->event_class);
return 1;
}
lchan_data = freerdp_chanman_find_chan_data_by_name(chan_man, name, &index);
if (lchan_data == NULL)