From 0549380c286e4cf47ac8e3c68010d16a8c615a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 16 Oct 2011 14:57:15 -0400 Subject: [PATCH] libfreerdp-channels: rename from libfreerdp-chanman --- CMakeLists.txt | 2 +- client/DirectFB/CMakeLists.txt | 2 +- client/DirectFB/dfreerdp.c | 40 +-- client/DirectFB/dfreerdp.h | 4 +- client/Windows/wfreerdp.c | 28 +- client/X11/CMakeLists.txt | 2 +- client/X11/xf_cliprdr.c | 16 +- client/X11/xf_cliprdr.h | 2 +- client/X11/xf_rail.c | 32 +- client/X11/xf_rail.h | 2 +- client/X11/xfreerdp.c | 38 +-- client/X11/xfreerdp.h | 4 +- client/test/CMakeLists.txt | 2 +- client/test/freerdp.c | 40 +-- cunit/CMakeLists.txt | 6 +- cunit/{test_chanman.c => test_channels.c} | 36 +-- cunit/{test_chanman.h => test_channels.h} | 0 cunit/test_cliprdr.c | 60 ++-- cunit/test_drdynvc.c | 24 +- cunit/test_freerdp.c | 2 +- cunit/test_gcc.c | 2 +- cunit/test_rail.c | 32 +- include/freerdp/chanman/chanman.h | 54 ---- include/freerdp/channels/channels.h | 54 ++++ include/freerdp/settings.h | 8 +- .../CMakeLists.txt | 14 +- .../libchannels.c | 288 +++++++++--------- .../libchannels.h | 12 +- libfreerdp-core/channel.c | 4 +- libfreerdp-core/connection.c | 8 +- libfreerdp-core/gcc.c | 6 +- 31 files changed, 413 insertions(+), 411 deletions(-) rename cunit/{test_chanman.c => test_channels.c} (60%) rename cunit/{test_chanman.h => test_channels.h} (100%) delete mode 100644 include/freerdp/chanman/chanman.h create mode 100644 include/freerdp/channels/channels.h rename {libfreerdp-chanman => libfreerdp-channels}/CMakeLists.txt (69%) rename libfreerdp-chanman/libchanman.c => libfreerdp-channels/libchannels.c (72%) rename libfreerdp-chanman/libchanman.h => libfreerdp-channels/libchannels.h (75%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e04aa5089..0240a2b8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,7 +157,7 @@ add_subdirectory(libfreerdp-gdi) add_subdirectory(libfreerdp-rail) add_subdirectory(libfreerdp-cache) add_subdirectory(libfreerdp-codec) -add_subdirectory(libfreerdp-chanman) +add_subdirectory(libfreerdp-channels) add_subdirectory(libfreerdp-core) if(NOT WIN32) diff --git a/client/DirectFB/CMakeLists.txt b/client/DirectFB/CMakeLists.txt index e4542025b..a982538e1 100644 --- a/client/DirectFB/CMakeLists.txt +++ b/client/DirectFB/CMakeLists.txt @@ -28,7 +28,7 @@ add_executable(dfreerdp target_link_libraries(dfreerdp freerdp-core) target_link_libraries(dfreerdp freerdp-gdi) target_link_libraries(dfreerdp freerdp-kbd) -target_link_libraries(dfreerdp freerdp-chanman) +target_link_libraries(dfreerdp freerdp-channels) target_link_libraries(dfreerdp freerdp-utils) target_link_libraries(dfreerdp ${DIRECTFB_LIBRARIES}) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index d7007cbe9..96c99bf8f 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -46,7 +46,7 @@ void df_context_size(freerdp* instance, uint32* size) void df_context_new(freerdp* instance, dfContext* context) { - context->chanman = freerdp_chanman_new(); + context->channels = freerdp_channels_new(); } void df_context_free(freerdp* instance, dfContext* context) @@ -148,7 +148,7 @@ boolean df_pre_connect(freerdp* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; - freerdp_chanman_pre_connect(context->chanman, instance); + freerdp_channels_pre_connect(context->channels, instance); return True; } @@ -201,7 +201,7 @@ boolean df_post_connect(freerdp* instance) df_keyboard_init(); - freerdp_chanman_post_connect(context->chanman, instance); + freerdp_channels_post_connect(context->channels, instance); return True; } @@ -209,10 +209,10 @@ boolean df_post_connect(freerdp* instance) static int df_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { - rdpChanMan* chanman = (rdpChanMan*) user_data; + rdpChannels* chanman = (rdpChannels*) user_data; printf("loading plugin %s\n", name); - freerdp_chanman_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(chanman, settings, name, plugin_data); return 1; } @@ -220,11 +220,11 @@ static int df_process_plugin_args(rdpSettings* settings, const char* name, static int df_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) { - return freerdp_chanman_data(instance, channelId, data, size, flags, total_size); + return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } static void -df_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) +df_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) { RDP_EVENT* event; RDP_CB_FORMAT_LIST_EVENT* format_list_event; @@ -234,15 +234,15 @@ df_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) format_list_event = (RDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; - freerdp_chanman_send_event(chanman, event); + freerdp_channels_send_event(chanman, event); } static void -df_process_channel_event(rdpChanMan* chanman, freerdp* instance) +df_process_channel_event(rdpChannels* chanman, freerdp* instance) { RDP_EVENT* event; - event = freerdp_chanman_pop_event(chanman); + event = freerdp_channels_pop_event(chanman); if (event) { @@ -279,7 +279,7 @@ int dfreerdp_run(freerdp* instance) fd_set wfds_set; dfInfo* dfi; dfContext* context; - rdpChanMan* chanman; + rdpChannels* chanman; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -290,7 +290,7 @@ int dfreerdp_run(freerdp* instance) context = (dfContext*) instance->context; dfi = context->dfi; - chanman = context->chanman; + chanman = context->channels; while (1) { @@ -302,7 +302,7 @@ int dfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_chanman_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -353,7 +353,7 @@ int dfreerdp_run(freerdp* instance) printf("Failed to check dfreerdp file descriptor\n"); break; } - if (freerdp_chanman_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(chanman, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; @@ -361,8 +361,8 @@ int dfreerdp_run(freerdp* instance) df_process_channel_event(chanman, instance); } - freerdp_chanman_close(chanman, instance); - freerdp_chanman_free(chanman); + freerdp_channels_close(chanman, instance); + freerdp_channels_free(chanman); df_free(dfi); gdi_free(instance); instance->Disconnect(instance); @@ -396,11 +396,11 @@ int main(int argc, char* argv[]) freerdp* instance; dfContext* context; struct thread_data* data; - rdpChanMan* chanman; + rdpChannels* chanman; setlocale(LC_ALL, ""); - freerdp_chanman_global_init(); + freerdp_channels_global_init(); g_sem = freerdp_sem_new(1); @@ -415,7 +415,7 @@ int main(int argc, char* argv[]) freerdp_context_new(instance); context = (dfContext*) instance->context; - chanman = context->chanman; + chanman = context->channels; DirectFBInit(&argc, &argv); freerdp_parse_args(instance->settings, argc, argv, df_process_plugin_args, chanman, NULL, NULL); @@ -431,7 +431,7 @@ int main(int argc, char* argv[]) freerdp_sem_wait(g_sem); } - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } diff --git a/client/DirectFB/dfreerdp.h b/client/DirectFB/dfreerdp.h index 13c9bb5b8..e2a9228e3 100644 --- a/client/DirectFB/dfreerdp.h +++ b/client/DirectFB/dfreerdp.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include typedef struct df_info dfInfo; @@ -35,7 +35,7 @@ struct df_context rdpContext _p; dfInfo* dfi; - rdpChanMan* chanman; + rdpChannels* channels; rdpSettings* settings; }; typedef struct df_context dfContext; diff --git a/client/Windows/wfreerdp.c b/client/Windows/wfreerdp.c index 3df4c5442..90c1d6aa1 100644 --- a/client/Windows/wfreerdp.c +++ b/client/Windows/wfreerdp.c @@ -252,7 +252,7 @@ boolean wf_pre_connect(freerdp* instance) } settings->kbd_layout = (int) GetKeyboardLayout(0) & 0x0000FFFF; - freerdp_chanman_pre_connect(GET_CHANMAN(instance), instance); + freerdp_channels_pre_connect(GET_CHANMAN(instance), instance); return True; } @@ -368,24 +368,24 @@ boolean wf_post_connect(freerdp* instance) wfi->cache->offscreen->SetSurface = (cbSetSurface) wf_set_surface; } - freerdp_chanman_post_connect(GET_CHANMAN(instance), instance); + freerdp_channels_post_connect(GET_CHANMAN(instance), instance); return True; } int wf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) { - return freerdp_chanman_data(instance, channelId, data, size, flags, total_size); + return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } -void wf_process_channel_event(rdpChanMan* chanman, freerdp* instance) +void wf_process_channel_event(rdpChannels* chanman, freerdp* instance) { wfInfo* wfi; RDP_EVENT* event; wfi = GET_WFI(instance); - event = freerdp_chanman_pop_event(chanman); + event = freerdp_channels_pop_event(chanman); if (event) freerdp_event_free(event); @@ -405,10 +405,10 @@ boolean wf_check_fds(freerdp* instance) int wf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { - rdpChanMan* chanman = (rdpChanMan*) user_data; + rdpChannels* chanman = (rdpChannels*) user_data; printf("loading plugin %s\n", name); - freerdp_chanman_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(chanman, settings, name, plugin_data); return 1; } @@ -430,7 +430,7 @@ int wfreerdp_run(freerdp* instance) void* wfds[32]; int fds_count; HANDLE fds[64]; - rdpChanMan* chanman; + rdpChannels* chanman; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -456,7 +456,7 @@ int wfreerdp_run(freerdp* instance) printf("Failed to get wfreerdp file descriptor\n"); break; } - if (freerdp_chanman_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -496,7 +496,7 @@ int wfreerdp_run(freerdp* instance) printf("Failed to check wfreerdp file descriptor\n"); break; } - if (freerdp_chanman_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(chanman, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; @@ -522,7 +522,7 @@ int wfreerdp_run(freerdp* instance) } /* cleanup */ - freerdp_chanman_free(chanman); + freerdp_channels_free(chanman); freerdp_free(instance); return 0; @@ -588,7 +588,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine thread_data* data; WSADATA wsa_data; WNDCLASSEX wnd_cls; - rdpChanMan* chanman; + rdpChannels* chanman; if (WSAStartup(0x101, &wsa_data) != 0) return 1; @@ -616,14 +616,14 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine RegisterClassEx(&wnd_cls); g_hInstance = hInstance; - freerdp_chanman_global_init(); + freerdp_channels_global_init(); instance = freerdp_new(); instance->PreConnect = wf_pre_connect; instance->PostConnect = wf_post_connect; instance->ReceiveChannelData = wf_receive_channel_data; - chanman = freerdp_chanman_new(); + chanman = freerdp_channels_new(); SET_CHANMAN(instance, chanman); if (!CreateThread(NULL, 0, kbd_thread_func, NULL, 0, NULL)) diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 88386e8a3..2d4795f68 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -87,7 +87,7 @@ target_link_libraries(xfreerdp freerdp-core) target_link_libraries(xfreerdp freerdp-gdi) target_link_libraries(xfreerdp freerdp-kbd) target_link_libraries(xfreerdp freerdp-rail) -target_link_libraries(xfreerdp freerdp-chanman) +target_link_libraries(xfreerdp freerdp-channels) target_link_libraries(xfreerdp freerdp-utils) target_link_libraries(xfreerdp ${X11_LIBRARIES} dl) diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index cb830519f..870450b24 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -37,7 +37,7 @@ struct clipboard_format_mapping typedef struct clipboard_context clipboardContext; struct clipboard_context { - rdpChanMan* chanman; + rdpChannels* chanman; Window root_window; Atom clipboard_atom; Atom property_atom; @@ -69,7 +69,7 @@ struct clipboard_context int incr_data_length; }; -void xf_cliprdr_init(xfInfo* xfi, rdpChanMan* chanman) +void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman) { int n; uint32 id; @@ -317,7 +317,7 @@ static void xf_cliprdr_send_raw_format_list(xfInfo* xfi) event->raw_format_data_size = len; XFree(format_data); - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } static void xf_cliprdr_send_null_format_list(xfInfo* xfi) @@ -330,7 +330,7 @@ static void xf_cliprdr_send_null_format_list(xfInfo* xfi) event->num_formats = 0; - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } static void xf_cliprdr_send_supported_format_list(xfInfo* xfi) @@ -351,7 +351,7 @@ static void xf_cliprdr_send_supported_format_list(xfInfo* xfi) event->formats[i] = cb->format_mappings[i].format_id; } - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } static void xf_cliprdr_send_format_list(xfInfo* xfi) @@ -384,7 +384,7 @@ static void xf_cliprdr_send_data_request(xfInfo* xfi, uint32 format) RDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL); event->format = format; - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } static void xf_cliprdr_send_data_response(xfInfo* xfi, uint8* data, int size) @@ -397,7 +397,7 @@ static void xf_cliprdr_send_data_response(xfInfo* xfi, uint8* data, int size) event->data = data; event->size = size; - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } static void xf_cliprdr_send_null_data_response(xfInfo* xfi) @@ -494,7 +494,7 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi) event->num_formats = num; XFree(data); - freerdp_chanman_send_event(cb->chanman, (RDP_EVENT*) event); + freerdp_channels_send_event(cb->chanman, (RDP_EVENT*) event); } else { diff --git a/client/X11/xf_cliprdr.h b/client/X11/xf_cliprdr.h index 1b6b5ae32..ddd87fee1 100644 --- a/client/X11/xf_cliprdr.h +++ b/client/X11/xf_cliprdr.h @@ -22,7 +22,7 @@ #include "xfreerdp.h" -void xf_cliprdr_init(xfInfo* xfi, rdpChanMan* chanman); +void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman); void xf_cliprdr_uninit(xfInfo* xfi); void xf_process_cliprdr_event(xfInfo* xfi, RDP_EVENT* event); boolean xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent); diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index da87172eb..7a8b810aa 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -195,7 +195,7 @@ static void xf_on_free_rail_client_event(RDP_EVENT* event) } } -static void xf_send_rail_client_event(rdpChanMan* chanman, uint16 event_type, void* param) +static void xf_send_rail_client_event(rdpChannels* chanman, uint16 event_type, void* param) { RDP_EVENT* out_event = NULL; void * payload = NULL; @@ -205,16 +205,16 @@ static void xf_send_rail_client_event(rdpChanMan* chanman, uint16 event_type, vo { out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type, xf_on_free_rail_client_event, payload); - freerdp_chanman_send_event(chanman, out_event); + freerdp_channels_send_event(chanman, out_event); } } void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 top, uint32 right, uint32 bottom) { - rdpChanMan* chanman; + rdpChannels* chanman; RAIL_WINDOW_MOVE_ORDER window_move; - chanman = xfi->context->chanman; + chanman = xfi->context->channels; window_move.windowId = windowId; window_move.left = left; @@ -228,11 +228,11 @@ void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 t void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) { rdpRail* rail; - rdpChanMan* chanman; + rdpChannels* chanman; rdpWindow* rail_window; RAIL_ACTIVATE_ORDER activate; - chanman = xfi->context->chanman; + chanman = xfi->context->channels; rail = ((rdpContext*) xfi->context)->rail; rail_window = window_list_get_by_extra_id(rail->list, (void*) xwindow); @@ -248,10 +248,10 @@ void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command) { - rdpChanMan* chanman; + rdpChannels* chanman; RAIL_SYSCOMMAND_ORDER syscommand; - chanman = xfi->context->chanman; + chanman = xfi->context->channels; syscommand.windowId = windowId; syscommand.command = command; @@ -259,7 +259,7 @@ void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 com xf_send_rail_client_event(chanman, RDP_EVENT_TYPE_RAIL_CLIENT_SYSCOMMAND, &syscommand); } -void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { RAIL_SYSPARAM_ORDER* sysparam; @@ -291,7 +291,7 @@ const char* error_code_names[] = "RAIL_EXEC_E_SESSION_LOCKED" }; -void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { RAIL_EXEC_RESULT_ORDER* exec_result; @@ -304,7 +304,7 @@ void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVE } } -void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data; @@ -318,7 +318,7 @@ void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChanMan* chanman, RDP } } -void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { rdpRail* rail; rdpWindow* rail_window = NULL; @@ -360,7 +360,7 @@ const char* movetype_names[] = "RAIL_WMSZ_KEYSIZE" }; -void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { rdpRail* rail; rdpWindow* rail_window = NULL; @@ -386,7 +386,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChanMan* chanman } -void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { RAIL_GET_APPID_RESP_ORDER* appid_resp = (RAIL_GET_APPID_RESP_ORDER*)event->user_data; @@ -398,7 +398,7 @@ void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVEN freerdp_hexdump(appid_resp->applicationId.string, appid_resp->applicationId.length); } -void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { RAIL_LANGBAR_INFO_ORDER* langbar = (RAIL_LANGBAR_INFO_ORDER*) event->user_data; @@ -407,7 +407,7 @@ void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVE langbar->languageBarStatus); } -void xf_process_rail_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event) +void xf_process_rail_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) { switch (event->event_type) { diff --git a/client/X11/xf_rail.h b/client/X11/xf_rail.h index f998b86ac..d3da658a6 100644 --- a/client/X11/xf_rail.h +++ b/client/X11/xf_rail.h @@ -27,6 +27,6 @@ void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail); void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command); void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled); void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 top, uint32 right, uint32 bottom); -void xf_process_rail_event(xfInfo* xfi, rdpChanMan* chanman, RDP_EVENT* event); +void xf_process_rail_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event); #endif /* __XF_RAIL_H */ diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 17fd21d90..3a0de006c 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -81,7 +81,7 @@ void xf_context_size(freerdp* instance, uint32* size) void xf_context_new(freerdp* instance, xfContext* context) { - context->chanman = freerdp_chanman_new(); + context->channels = freerdp_channels_new(); } void xf_context_free(freerdp* instance, xfContext* context) @@ -559,7 +559,7 @@ boolean xf_pre_connect(freerdp* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; - freerdp_chanman_pre_connect(xfi->context->chanman, instance); + freerdp_channels_pre_connect(xfi->context->channels, instance); xfi->display = XOpenDisplay(NULL); @@ -623,11 +623,11 @@ boolean xf_post_connect(freerdp* instance) xfInfo* xfi; XGCValues gcv; rdpCache* cache; - rdpChanMan* chanman; + rdpChannels* chanman; xfi = ((xfContext*) instance->context)->xfi; cache = instance->context->cache; - chanman = xfi->context->chanman; + chanman = xfi->context->channels; if (xf_get_pixmap_info(xfi) != True) return False; @@ -738,7 +738,7 @@ boolean xf_post_connect(freerdp* instance) rail_register_update_callbacks(instance->context->rail, instance->update); xf_rail_register_callbacks(xfi, instance->context->rail); - freerdp_chanman_post_connect(chanman, instance); + freerdp_channels_post_connect(chanman, instance); xf_tsmf_init(xfi, xv_port); @@ -798,27 +798,27 @@ int xf_process_ui_args(rdpSettings* settings, const char* opt, const char* val, int xf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { - rdpChanMan* chanman = (rdpChanMan*) user_data; + rdpChannels* chanman = (rdpChannels*) user_data; printf("loading plugin %s\n", name); - freerdp_chanman_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(chanman, settings, name, plugin_data); return 1; } int xf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) { - return freerdp_chanman_data(instance, channelId, data, size, flags, total_size); + return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } -void xf_process_channel_event(rdpChanMan* chanman, freerdp* instance) +void xf_process_channel_event(rdpChannels* chanman, freerdp* instance) { xfInfo* xfi; RDP_EVENT* event; xfi = ((xfContext*) instance->context)->xfi; - event = freerdp_chanman_pop_event(chanman); + event = freerdp_channels_pop_event(chanman); if (event) { @@ -902,7 +902,7 @@ int xfreerdp_run(freerdp* instance) void* wfds[32]; fd_set rfds_set; fd_set wfds_set; - rdpChanMan* chanman; + rdpChannels* chanman; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -911,7 +911,7 @@ int xfreerdp_run(freerdp* instance) return 0; xfi = ((xfContext*) instance->context)->xfi; - chanman = ((xfContext*) instance->context)->chanman; + chanman = ((xfContext*) instance->context)->channels; while (1) { @@ -923,7 +923,7 @@ int xfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_chanman_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -974,7 +974,7 @@ int xfreerdp_run(freerdp* instance) printf("Failed to check xfreerdp file descriptor\n"); break; } - if (freerdp_chanman_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(chanman, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; @@ -982,8 +982,8 @@ int xfreerdp_run(freerdp* instance) xf_process_channel_event(chanman, instance); } - freerdp_chanman_close(chanman, instance); - freerdp_chanman_free(chanman); + freerdp_channels_close(chanman, instance); + freerdp_channels_free(chanman); instance->Disconnect(instance); gdi_free(instance); freerdp_free(instance); @@ -1022,7 +1022,7 @@ int main(int argc, char* argv[]) setlocale(LC_ALL, ""); - freerdp_chanman_global_init(); + freerdp_channels_global_init(); g_sem = freerdp_sem_new(1); @@ -1041,7 +1041,7 @@ int main(int argc, char* argv[]) context = (xfContext*) instance->context; if (freerdp_parse_args(instance->settings, argc, argv, - xf_process_plugin_args, context->chanman, xf_process_ui_args, NULL) < 0) + xf_process_plugin_args, context->channels, xf_process_ui_args, NULL) < 0) return 1; data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); @@ -1055,7 +1055,7 @@ int main(int argc, char* argv[]) freerdp_sem_wait(g_sem); } - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 7a2d89440..eb563bde3 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -63,7 +63,7 @@ struct xf_context rdpContext _p; xfInfo* xfi; - rdpChanMan* chanman; + rdpChannels* channels; rdpSettings* settings; }; typedef struct xf_context xfContext; diff --git a/client/test/CMakeLists.txt b/client/test/CMakeLists.txt index 58d0783ff..c6af64717 100644 --- a/client/test/CMakeLists.txt +++ b/client/test/CMakeLists.txt @@ -23,4 +23,4 @@ add_executable(freerdp-test target_link_libraries(freerdp-test freerdp-core) target_link_libraries(freerdp-test freerdp-gdi) target_link_libraries(freerdp-test freerdp-utils) -target_link_libraries(freerdp-test freerdp-chanman dl) +target_link_libraries(freerdp-test freerdp-channels dl) diff --git a/client/test/freerdp.c b/client/test/freerdp.c index 1c3e2ea1c..dad5fb05c 100644 --- a/client/test/freerdp.c +++ b/client/test/freerdp.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include struct tf_info @@ -50,7 +50,7 @@ struct tf_context rdpContext _p; tfInfo* tfi; - rdpChanMan* chanman; + rdpChannels* chanman; }; typedef struct tf_context tfContext; @@ -72,7 +72,7 @@ void tf_context_size(freerdp* instance, uint32* size) void tf_context_new(freerdp* instance, tfContext* context) { - context->chanman = freerdp_chanman_new(); + context->chanman = freerdp_channels_new(); } void tf_context_free(freerdp* instance, tfContext* context) @@ -96,20 +96,20 @@ void tf_end_paint(rdpUpdate* update) int tf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) { - return freerdp_chanman_data(instance, channelId, data, size, flags, total_size); + return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } int tf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { - rdpChanMan* chanman = (rdpChanMan*) user_data; + rdpChannels* chanman = (rdpChannels*) user_data; printf("Load plugin %s\n", name); - freerdp_chanman_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(chanman, settings, name, plugin_data); return 1; } -void tf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) +void tf_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) { RDP_EVENT* event; RDP_CB_FORMAT_LIST_EVENT* format_list_event; @@ -119,14 +119,14 @@ void tf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance) format_list_event = (RDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; - freerdp_chanman_send_event(chanman, event); + freerdp_channels_send_event(chanman, event); } -void tf_process_channel_event(rdpChanMan* chanman, freerdp* instance) +void tf_process_channel_event(rdpChannels* chanman, freerdp* instance) { RDP_EVENT* event; - event = freerdp_chanman_pop_event(chanman); + event = freerdp_channels_pop_event(chanman); if (event) { @@ -179,7 +179,7 @@ boolean tf_pre_connect(freerdp* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = True; settings->order_support[NEG_ELLIPSE_CB_INDEX] = True; - freerdp_chanman_pre_connect(context->chanman, instance); + freerdp_channels_pre_connect(context->chanman, instance); return True; } @@ -197,7 +197,7 @@ boolean tf_post_connect(freerdp* instance) instance->update->BeginPaint = tf_begin_paint; instance->update->EndPaint = tf_end_paint; - freerdp_chanman_post_connect(context->chanman, instance); + freerdp_channels_post_connect(context->chanman, instance); return True; } @@ -214,7 +214,7 @@ int tfreerdp_run(freerdp* instance) fd_set rfds_set; fd_set wfds_set; tfContext* context; - rdpChanMan* chanman; + rdpChannels* chanman; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -234,7 +234,7 @@ int tfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_chanman_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -274,7 +274,7 @@ int tfreerdp_run(freerdp* instance) printf("Failed to check FreeRDP file descriptor\n"); break; } - if (freerdp_chanman_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(chanman, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; @@ -282,8 +282,8 @@ int tfreerdp_run(freerdp* instance) tf_process_channel_event(chanman, instance); } - freerdp_chanman_close(chanman, instance); - freerdp_chanman_free(chanman); + freerdp_channels_close(chanman, instance); + freerdp_channels_free(chanman); freerdp_free(instance); return 0; @@ -314,9 +314,9 @@ int main(int argc, char* argv[]) freerdp* instance; tfContext* context; struct thread_data* data; - rdpChanMan* chanman; + rdpChannels* chanman; - freerdp_chanman_global_init(); + freerdp_channels_global_init(); g_sem = freerdp_sem_new(1); @@ -346,7 +346,7 @@ int main(int argc, char* argv[]) freerdp_sem_wait(g_sem); } - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } diff --git a/cunit/CMakeLists.txt b/cunit/CMakeLists.txt index 65dd48680..7dbb6e98d 100644 --- a/cunit/CMakeLists.txt +++ b/cunit/CMakeLists.txt @@ -52,8 +52,8 @@ add_executable(test_freerdp test_stream.h test_utils.c test_utils.h - test_chanman.c - test_chanman.h + test_channels.c + test_channels.h test_cliprdr.c test_cliprdr.h test_drdynvc.c @@ -71,7 +71,7 @@ target_link_libraries(test_freerdp ${CUNIT_LIBRARIES}) target_link_libraries(test_freerdp freerdp-core) target_link_libraries(test_freerdp freerdp-gdi) target_link_libraries(test_freerdp freerdp-utils) -target_link_libraries(test_freerdp freerdp-chanman) +target_link_libraries(test_freerdp freerdp-channels) target_link_libraries(test_freerdp freerdp-codec) add_test(CUnitTests ${EXECUTABLE_OUTPUT_PATH}/test_freerdp) diff --git a/cunit/test_chanman.c b/cunit/test_channels.c similarity index 60% rename from cunit/test_chanman.c rename to cunit/test_channels.c index 1f478716d..da2cd634e 100644 --- a/cunit/test_chanman.c +++ b/cunit/test_channels.c @@ -22,20 +22,20 @@ #include #include #include -#include +#include #include -#include "test_chanman.h" +#include "test_channels.h" int init_chanman_suite(void) { - freerdp_chanman_global_init(); + freerdp_channels_global_init(); return 0; } int clean_chanman_suite(void) { - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } @@ -56,7 +56,7 @@ static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, in void test_chanman(void) { - rdpChanMan* chan_man; + rdpChannels* chan_man; rdpSettings settings = { 0 }; freerdp instance = { 0 }; RDP_EVENT* event; @@ -65,27 +65,27 @@ void test_chanman(void) instance.settings = &settings; instance.SendChannelData = test_rdp_channel_data; - chan_man = freerdp_chanman_new(); + chan_man = freerdp_channels_new(); - freerdp_chanman_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL); - freerdp_chanman_pre_connect(chan_man, &instance); - freerdp_chanman_post_connect(chan_man, &instance); + freerdp_channels_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL); + freerdp_channels_pre_connect(chan_man, &instance); + freerdp_channels_post_connect(chan_man, &instance); - freerdp_chanman_data(&instance, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8); - freerdp_chanman_data(&instance, 0, "testdata1", 9, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 9); - 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); + freerdp_channels_data(&instance, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8); + freerdp_channels_data(&instance, 0, "testdata1", 9, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 9); + freerdp_channels_data(&instance, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10); + freerdp_channels_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11); event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL); - freerdp_chanman_send_event(chan_man, event); + freerdp_channels_send_event(chan_man, event); - while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) + while ((event = freerdp_channels_pop_event(chan_man)) == NULL) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } printf("responded event_type %d\n", event->event_type); freerdp_event_free(event); - freerdp_chanman_close(chan_man, &instance); - freerdp_chanman_free(chan_man); + freerdp_channels_close(chan_man, &instance); + freerdp_channels_free(chan_man); } diff --git a/cunit/test_chanman.h b/cunit/test_channels.h similarity index 100% rename from cunit/test_chanman.h rename to cunit/test_channels.h diff --git a/cunit/test_cliprdr.c b/cunit/test_cliprdr.c index 8545de5cc..549d337a0 100644 --- a/cunit/test_cliprdr.c +++ b/cunit/test_cliprdr.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,13 +32,13 @@ int init_cliprdr_suite(void) { - freerdp_chanman_global_init(); + freerdp_channels_global_init(); return 0; } int clean_cliprdr_suite(void) { - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } @@ -105,7 +105,7 @@ static void event_process_callback(RDP_EVENT* event) void test_cliprdr(void) { int i; - rdpChanMan* chan_man; + rdpChannels* chan_man; rdpSettings settings = { 0 }; freerdp instance = { 0 }; RDP_EVENT* event; @@ -117,23 +117,23 @@ void test_cliprdr(void) instance.settings = &settings; instance.SendChannelData = test_rdp_channel_data; - chan_man = freerdp_chanman_new(); + chan_man = freerdp_channels_new(); - freerdp_chanman_load_plugin(chan_man, &settings, "../channels/cliprdr/cliprdr.so", NULL); - freerdp_chanman_pre_connect(chan_man, &instance); - freerdp_chanman_post_connect(chan_man, &instance); + freerdp_channels_load_plugin(chan_man, &settings, "../channels/cliprdr/cliprdr.so", NULL); + freerdp_channels_pre_connect(chan_man, &instance); + freerdp_channels_post_connect(chan_man, &instance); /* server sends cliprdr capabilities and monitor ready PDU */ - freerdp_chanman_data(&instance, 0, (char*)test_clip_caps_data, sizeof(test_clip_caps_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_clip_caps_data, sizeof(test_clip_caps_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_clip_caps_data) - 1); - freerdp_chanman_data(&instance, 0, (char*)test_monitor_ready_data, sizeof(test_monitor_ready_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_monitor_ready_data, sizeof(test_monitor_ready_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_monitor_ready_data) - 1); /* cliprdr sends clipboard_sync event to UI */ - while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) + while ((event = freerdp_channels_pop_event(chan_man)) == NULL) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } printf("Got event %d\n", event->event_type); CU_ASSERT(event->event_type == RDP_EVENT_TYPE_CB_SYNC); @@ -147,26 +147,26 @@ 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, event); + freerdp_channels_send_event(chan_man, event); /* cliprdr sends format list PDU to server */ while (!event_processed) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } /* server sends format list response PDU to cliprdr */ - freerdp_chanman_data(&instance, 0, (char*)test_format_list_response_data, sizeof(test_format_list_response_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_format_list_response_data, sizeof(test_format_list_response_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_format_list_response_data) - 1); /* server sends format list PDU to cliprdr */ - freerdp_chanman_data(&instance, 0, (char*)test_format_list_data, sizeof(test_format_list_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_format_list_data, sizeof(test_format_list_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_format_list_data) - 1); /* cliprdr sends format_list event to UI */ - while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) + while ((event = freerdp_channels_pop_event(chan_man)) == NULL) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } printf("Got event %d\n", event->event_type); CU_ASSERT(event->event_type == RDP_EVENT_TYPE_CB_FORMAT_LIST); @@ -179,13 +179,13 @@ void test_cliprdr(void) freerdp_event_free(event); /* server sends data request PDU to cliprdr */ - freerdp_chanman_data(&instance, 0, (char*)test_data_request_data, sizeof(test_data_request_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_data_request_data, sizeof(test_data_request_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_data_request_data) - 1); /* cliprdr sends data request event to UI */ - while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) + while ((event = freerdp_channels_pop_event(chan_man)) == NULL) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } printf("Got event %d\n", event->event_type); CU_ASSERT(event->event_type == RDP_EVENT_TYPE_CB_DATA_REQUEST); @@ -203,12 +203,12 @@ 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, event); + freerdp_channels_send_event(chan_man, event); /* cliprdr sends data response PDU to server */ while (!event_processed) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } /* UI sends data request event to cliprdr */ @@ -216,22 +216,22 @@ void test_cliprdr(void) data_request_event = (RDP_CB_DATA_REQUEST_EVENT*)event; data_request_event->format = CB_FORMAT_UNICODETEXT; event_processed = 0; - freerdp_chanman_send_event(chan_man, event); + freerdp_channels_send_event(chan_man, event); /* cliprdr sends data request PDU to server */ while (!event_processed) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } /* server sends data response PDU to cliprdr */ - freerdp_chanman_data(&instance, 0, (char*)test_data_response_data, sizeof(test_data_response_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_data_response_data, sizeof(test_data_response_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_data_response_data) - 1); /* cliprdr sends data response event to UI */ - while ((event = freerdp_chanman_pop_event(chan_man)) == NULL) + while ((event = freerdp_channels_pop_event(chan_man)) == NULL) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } printf("Got event %d\n", event->event_type); CU_ASSERT(event->event_type == RDP_EVENT_TYPE_CB_DATA_RESPONSE); @@ -243,6 +243,6 @@ void test_cliprdr(void) } freerdp_event_free(event); - freerdp_chanman_close(chan_man, &instance); - freerdp_chanman_free(chan_man); + freerdp_channels_close(chan_man, &instance); + freerdp_channels_free(chan_man); } diff --git a/cunit/test_drdynvc.c b/cunit/test_drdynvc.c index a6d003003..f46a7ac1e 100644 --- a/cunit/test_drdynvc.c +++ b/cunit/test_drdynvc.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -31,13 +31,13 @@ int init_drdynvc_suite(void) { - freerdp_chanman_global_init(); + freerdp_channels_global_init(); return 0; } int clean_drdynvc_suite(void) { - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } @@ -67,7 +67,7 @@ static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, in void test_drdynvc(void) { - rdpChanMan* chan_man; + rdpChannels* chan_man; rdpSettings settings = { 0 }; freerdp instance = { 0 }; @@ -75,23 +75,23 @@ void test_drdynvc(void) instance.settings = &settings; instance.SendChannelData = test_rdp_channel_data; - chan_man = freerdp_chanman_new(); + chan_man = freerdp_channels_new(); - freerdp_chanman_load_plugin(chan_man, &settings, "../channels/drdynvc/drdynvc.so", NULL); - freerdp_chanman_pre_connect(chan_man, &instance); - freerdp_chanman_post_connect(chan_man, &instance); + freerdp_channels_load_plugin(chan_man, &settings, "../channels/drdynvc/drdynvc.so", NULL); + freerdp_channels_pre_connect(chan_man, &instance); + freerdp_channels_post_connect(chan_man, &instance); /* server sends capability request PDU */ - freerdp_chanman_data(&instance, 0, (char*)test_capability_request_data, sizeof(test_capability_request_data) - 1, + freerdp_channels_data(&instance, 0, (char*)test_capability_request_data, sizeof(test_capability_request_data) - 1, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(test_capability_request_data) - 1); /* drdynvc sends capability response PDU to server */ data_received = 0; while (!data_received) { - freerdp_chanman_check_fds(chan_man, &instance); + freerdp_channels_check_fds(chan_man, &instance); } - freerdp_chanman_close(chan_man, &instance); - freerdp_chanman_free(chan_man); + freerdp_channels_close(chan_man, &instance); + freerdp_channels_free(chan_man); } diff --git a/cunit/test_freerdp.c b/cunit/test_freerdp.c index f39313141..33c45392b 100644 --- a/cunit/test_freerdp.c +++ b/cunit/test_freerdp.c @@ -31,7 +31,7 @@ #include "test_utils.h" #include "test_orders.h" #include "test_license.h" -#include "test_chanman.h" +#include "test_channels.h" #include "test_cliprdr.h" #include "test_drdynvc.h" #include "test_librfx.h" diff --git a/cunit/test_gcc.c b/cunit/test_gcc.c index c340dab33..1b86d4b0e 100644 --- a/cunit/test_gcc.c +++ b/cunit/test_gcc.c @@ -198,7 +198,7 @@ void test_gcc_write_client_network_data(void) settings = settings_new(NULL); settings->num_channels = 3; - memset(settings->channels, 0, sizeof(rdpChan) * settings->num_channels); + memset(settings->channels, 0, sizeof(rdpChannel) * settings->num_channels); strcpy(settings->channels[0].name, "rdpdr"); settings->channels[0].options = 0x80800000; diff --git a/cunit/test_rail.c b/cunit/test_rail.c index 6868552a3..c07082b53 100644 --- a/cunit/test_rail.c +++ b/cunit/test_rail.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -47,13 +47,13 @@ int init_rail_suite(void) { - freerdp_chanman_global_init(); + freerdp_channels_global_init(); return 0; } int clean_rail_suite(void) { - freerdp_chanman_global_uninit(); + freerdp_channels_global_uninit(); return 0; } @@ -417,7 +417,7 @@ RAIL_EVENT; typedef struct { - rdpChanMan* chan_man; + rdpChannels* chan_man; freerdp* instance; int th_count; int th_to_finish; @@ -485,7 +485,7 @@ static void test_on_free_rail_client_event(RDP_EVENT* event) } //----------------------------------------------------------------------------- static void send_ui_event2plugin( - rdpChanMan* chan_man, + rdpChannels* chan_man, uint16 event_type, void * data ) @@ -498,7 +498,7 @@ static void send_ui_event2plugin( { out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type, test_on_free_rail_client_event, payload); - freerdp_chanman_send_event(chan_man, out_event); + freerdp_channels_send_event(chan_man, out_event); } } //----------------------------------------------------------------------------- @@ -514,7 +514,7 @@ static void emulate_server_send_channel_data( printf("Emulate server packet (%d packet):\n", counter); freerdp_hexdump(data, size); - freerdp_chanman_data(instance, 0, (char*)data, size, + freerdp_channels_data(instance, 0, (char*)data, size, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, size); usleep(10*1000); } @@ -616,11 +616,11 @@ static void process_events_and_channel_data_from_plugin(thread_param* param) param->th_count++; while (param->th_to_finish == 0) { - freerdp_chanman_check_fds(param->chan_man, param->instance); + freerdp_channels_check_fds(param->chan_man, param->instance); while (1) { - event = freerdp_chanman_pop_event(param->chan_man); + event = freerdp_channels_pop_event(param->chan_man); if (event == NULL) break; static int counter = 0; @@ -658,7 +658,7 @@ void test_rail_plugin(void) thread_param param; pthread_t thread; - rdpChanMan* chan_man; + rdpChannels* chan_man; rdpSettings settings = { 0 }; freerdp s_inst = { 0 }; freerdp* inst = &s_inst; @@ -673,11 +673,11 @@ void test_rail_plugin(void) inst->settings = &settings; inst->SendChannelData = emulate_client_send_channel_data; - chan_man = freerdp_chanman_new(); + chan_man = freerdp_channels_new(); - freerdp_chanman_load_plugin(chan_man, &settings, "../channels/rail/rail.so", NULL); - freerdp_chanman_pre_connect(chan_man, inst); - freerdp_chanman_post_connect(chan_man, inst); + freerdp_channels_load_plugin(chan_man, &settings, "../channels/rail/rail.so", NULL); + freerdp_channels_pre_connect(chan_man, inst); + freerdp_channels_post_connect(chan_man, inst); memset(¶m, 0, sizeof(param)); @@ -882,8 +882,8 @@ void test_rail_plugin(void) ) ); - freerdp_chanman_close(chan_man, inst); - freerdp_chanman_free(chan_man); + freerdp_channels_close(chan_man, inst); + freerdp_channels_free(chan_man); } diff --git a/include/freerdp/chanman/chanman.h b/include/freerdp/chanman/chanman.h deleted file mode 100644 index 8eff0a33a..000000000 --- a/include/freerdp/chanman/chanman.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol client. - * Virtual Channel Manager - * - * Copyright 2009-2011 Jay Sorg - * Copyright 2010-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_CHANMAN_H -#define __FREERDP_CHANMAN_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rdp_chan_man rdpChanMan; - -FREERDP_API int freerdp_chanman_global_init(void); -FREERDP_API int freerdp_chanman_global_uninit(void); -FREERDP_API rdpChanMan* freerdp_chanman_new(void); -FREERDP_API void freerdp_chanman_free(rdpChanMan* chan_man); -FREERDP_API int freerdp_chanman_load_plugin(rdpChanMan* chan_man, rdpSettings* settings, - const char* name, void* data); -FREERDP_API int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance); -FREERDP_API int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance); -FREERDP_API int freerdp_chanman_data(freerdp* instance, int chan_id, void* data, int data_size, - int flags, int total_size); -FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, RDP_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); -FREERDP_API RDP_EVENT* freerdp_chanman_pop_event(rdpChanMan* chan_man); -FREERDP_API void freerdp_chanman_close(rdpChanMan* chan_man, freerdp* instance); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h new file mode 100644 index 000000000..370f39006 --- /dev/null +++ b/include/freerdp/channels/channels.h @@ -0,0 +1,54 @@ +/** + * FreeRDP: A Remote Desktop Protocol client. + * Virtual Channel Manager + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2010-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_CHANMAN_H +#define __FREERDP_CHANMAN_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rdp_channels rdpChannels; + +FREERDP_API int freerdp_channels_global_init(void); +FREERDP_API int freerdp_channels_global_uninit(void); +FREERDP_API rdpChannels* freerdp_channels_new(void); +FREERDP_API void freerdp_channels_free(rdpChannels* channels); +FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, + 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_data(freerdp* instance, int channel_id, void* data, int data_size, + int flags, int total_size); +FREERDP_API int freerdp_channels_send_event(rdpChannels* channels, RDP_EVENT* event); +FREERDP_API boolean freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, + int* read_count, void** write_fds, int* write_count); +FREERDP_API boolean freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance); +FREERDP_API RDP_EVENT* freerdp_channels_pop_event(rdpChannels* channels); +FREERDP_API void freerdp_channels_close(rdpChannels* channels, freerdp* instance); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index d068fa1b1..c18dc7fd0 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -134,15 +134,15 @@ typedef struct uint8 arcRandomBits[16]; } ARC_SC_PRIVATE_PACKET; -struct rdp_chan +struct rdp_channel { char name[8]; /* ui sets */ int options; /* ui sets */ - int chan_id; /* core sets */ + int channel_id; /* core sets */ boolean joined; /* client has joined the channel */ void * handle; /* just for ui */ }; -typedef struct rdp_chan rdpChan; +typedef struct rdp_channel rdpChannel; struct rdp_ext_set { @@ -216,7 +216,7 @@ struct rdp_settings uint32 redirected_session_id; int num_channels; - rdpChan channels[16]; + rdpChannel channels[16]; int num_monitors; struct rdp_monitor monitors[16]; diff --git a/libfreerdp-chanman/CMakeLists.txt b/libfreerdp-channels/CMakeLists.txt similarity index 69% rename from libfreerdp-chanman/CMakeLists.txt rename to libfreerdp-channels/CMakeLists.txt index f4d334c88..ba0108717 100644 --- a/libfreerdp-chanman/CMakeLists.txt +++ b/libfreerdp-channels/CMakeLists.txt @@ -17,14 +17,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(FREERDP_CHANMAN_SRCS - libchanman.c - libchanman.h) +set(FREERDP_CHANNELS_SRCS + libchannels.c + libchannels.h) -add_library(freerdp-chanman ${FREERDP_CHANMAN_SRCS}) +add_library(freerdp-channels ${FREERDP_CHANNELS_SRCS}) -set_target_properties(freerdp-chanman PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -target_link_libraries(freerdp-chanman freerdp-utils) +set_target_properties(freerdp-channels PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") +target_link_libraries(freerdp-channels freerdp-utils) -install(TARGETS freerdp-chanman DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS freerdp-channels DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libfreerdp-chanman/libchanman.c b/libfreerdp-channels/libchannels.c similarity index 72% rename from libfreerdp-chanman/libchanman.c rename to libfreerdp-channels/libchannels.c index 93a294a0b..8607be0ea 100644 --- a/libfreerdp-chanman/libchanman.c +++ b/libfreerdp-channels/libchannels.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ #include #include -#include "libchanman.h" +#include "libchannels.h" #define CHANNEL_MAX_COUNT 30 @@ -58,7 +58,7 @@ struct lib_data void* init_handle; }; -struct chan_data +struct channel_data { char name[CHANNEL_NAME_LEN + 1]; int open_handle; @@ -78,10 +78,10 @@ struct sync_data typedef struct rdp_init_handle rdpInitHandle; struct rdp_init_handle { - rdpChanMan* chan_man; + rdpChannels* chan_man; }; -struct rdp_chan_man +struct rdp_channels { /** * Only the main thread alters these arrays, before any @@ -93,7 +93,7 @@ struct rdp_chan_man */ struct lib_data libs[CHANNEL_MAX_COUNT]; int num_libs; - struct chan_data chans[CHANNEL_MAX_COUNT]; + struct channel_data chans[CHANNEL_MAX_COUNT]; int num_chans; rdpInitHandle init_handles[CHANNEL_MAX_COUNT]; int num_init_handles; @@ -124,17 +124,17 @@ struct rdp_chan_man * The current channel manager reference passes from VirtualChannelEntry to * VirtualChannelInit for the pInitHandle. */ -static rdpChanMan* g_init_chan_man; +static rdpChannels* g_init_chan_man; /* The list of all channel managers. */ -typedef struct rdp_chan_man_list rdpChanManList; -struct rdp_chan_man_list +typedef struct rdp_channels_list rdpChannelsList; +struct rdp_channels_list { - rdpChanMan* chan_man; - rdpChanManList* next; + rdpChannels* channels; + rdpChannelsList* next; }; -static rdpChanManList* g_chan_man_list; +static rdpChannelsList* g_channels_list; /* To generate unique sequence for all open handles */ static int g_open_handle_sequence; @@ -144,16 +144,16 @@ static freerdp_mutex g_mutex_init; static freerdp_mutex g_mutex_list; /* returns the chan_man for the open handle passed in */ -static rdpChanMan* freerdp_chanman_find_by_open_handle(int open_handle, int* pindex) +static rdpChannels* freerdp_channels_find_by_open_handle(int open_handle, int* pindex) { - rdpChanManList* list; - rdpChanMan* chan_man; + rdpChannelsList* list; + rdpChannels* chan_man; int lindex; freerdp_mutex_lock(g_mutex_list); - for (list = g_chan_man_list; list; list = list->next) + for (list = g_channels_list; list; list = list->next) { - chan_man = list->chan_man; + chan_man = list->channels; for (lindex = 0; lindex < chan_man->num_chans; lindex++) { if (chan_man->chans[lindex].open_handle == open_handle) @@ -169,15 +169,15 @@ static rdpChanMan* freerdp_chanman_find_by_open_handle(int open_handle, int* pin } /* returns the chan_man for the rdp instance passed in */ -static rdpChanMan* freerdp_chanman_find_by_rdp_inst(freerdp* instance) +static rdpChannels* freerdp_channels_find_by_instance(freerdp* instance) { - rdpChanManList* list; - rdpChanMan* chan_man; + rdpChannelsList* list; + rdpChannels* chan_man; freerdp_mutex_lock(g_mutex_list); - for (list = g_chan_man_list; list; list = list->next) + for (list = g_channels_list; list; list = list->next) { - chan_man = list->chan_man; + chan_man = list->channels; if (chan_man->instance == instance) { freerdp_mutex_unlock(g_mutex_list); @@ -189,11 +189,11 @@ static rdpChanMan* freerdp_chanman_find_by_rdp_inst(freerdp* instance) } /* returns struct chan_data for the channel name passed in */ -static struct chan_data* freerdp_chanman_find_chan_data_by_name(rdpChanMan* chan_man, +static struct channel_data* freerdp_channels_find_channel_data_by_name(rdpChannels* chan_man, const char* chan_name, int* pindex) { int lindex; - struct chan_data* lchan_data; + struct channel_data* lchan_data; for (lindex = 0; lindex < chan_man->num_chans; lindex++) { @@ -211,23 +211,22 @@ static struct chan_data* freerdp_chanman_find_chan_data_by_name(rdpChanMan* chan } /* returns rdpChan for the channel id passed in */ -static rdpChan* freerdp_chanman_find_rdp_chan_by_id(rdpChanMan* chan_man, - rdpSettings* settings, int chan_id, int* pindex) +static rdpChannel* freerdp_channels_find_channel_by_id(rdpChannels* channels, + rdpSettings* settings, int channel_id, int* pindex) { int lindex; int lcount; - rdpChan* lrdp_chan; + rdpChannel* lrdp_chan; lcount = settings->num_channels; for (lindex = 0; lindex < lcount; lindex++) { lrdp_chan = settings->channels + lindex; - if (lrdp_chan->chan_id == chan_id) + if (lrdp_chan->channel_id == channel_id) { if (pindex != 0) - { *pindex = lindex; - } + return lrdp_chan; } } @@ -235,12 +234,12 @@ static rdpChan* freerdp_chanman_find_rdp_chan_by_id(rdpChanMan* chan_man, } /* returns rdpChan for the channel name passed in */ -static rdpChan* freerdp_chanman_find_rdp_chan_by_name(rdpChanMan* chan_man, +static rdpChannel* freerdp_channels_find_channel_by_name(rdpChannels* chan_man, rdpSettings* settings, const char* chan_name, int* pindex) { int lindex; int lcount; - rdpChan* lrdp_chan; + rdpChannel* lrdp_chan; lcount = settings->num_channels; for (lindex = 0; lindex < lcount; lindex++) @@ -249,9 +248,8 @@ static rdpChan* freerdp_chanman_find_rdp_chan_by_name(rdpChanMan* chan_man, if (strcmp(chan_name, lrdp_chan->name) == 0) { if (pindex != 0) - { *pindex = lindex; - } + return lrdp_chan; } } @@ -267,11 +265,11 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF int channelCount, uint32 versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc) { - rdpChanMan* chan_man; + rdpChannels* chan_man; int index; struct lib_data* llib; - struct chan_data* lchan; - rdpChan* lrdp_chan; + struct channel_data* lchan; + rdpChannel* lrdp_chan; PCHANNEL_DEF lchan_def; chan_man = g_init_chan_man; @@ -279,42 +277,42 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF *ppInitHandle = &chan_man->init_handles[chan_man->num_init_handles]; chan_man->num_init_handles++; - DEBUG_CHANMAN("enter"); + DEBUG_CHANNELS("enter"); if (!chan_man->can_call_init) { - DEBUG_CHANMAN("error not in entry"); + DEBUG_CHANNELS("error not in entry"); return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY; } if (ppInitHandle == 0) { - DEBUG_CHANMAN("error bad pphan"); + DEBUG_CHANNELS("error bad pphan"); return CHANNEL_RC_BAD_INIT_HANDLE; } if (chan_man->num_chans + channelCount >= CHANNEL_MAX_COUNT) { - DEBUG_CHANMAN("error too many channels"); + DEBUG_CHANNELS("error too many channels"); return CHANNEL_RC_TOO_MANY_CHANNELS; } if (pChannel == 0) { - DEBUG_CHANMAN("error bad pchan"); + DEBUG_CHANNELS("error bad pchan"); return CHANNEL_RC_BAD_CHANNEL; } if (chan_man->is_connected) { - DEBUG_CHANMAN("error already connected"); + DEBUG_CHANNELS("error already connected"); return CHANNEL_RC_ALREADY_CONNECTED; } if (versionRequested != VIRTUAL_CHANNEL_VERSION_WIN2000) { - DEBUG_CHANMAN("warning version"); + DEBUG_CHANNELS("warning version"); } for (index = 0; index < channelCount; index++) { lchan_def = pChannel + index; - if (freerdp_chanman_find_chan_data_by_name(chan_man, lchan_def->name, 0) != 0) + if (freerdp_channels_find_channel_data_by_name(chan_man, lchan_def->name, 0) != 0) { - DEBUG_CHANMAN("error channel already used"); + DEBUG_CHANNELS("error channel already used"); return CHANNEL_RC_BAD_CHANNEL; } } @@ -343,7 +341,7 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF } else { - DEBUG_CHANMAN("warning more than 16 channels"); + DEBUG_CHANNELS("warning more than 16 channels"); } chan_man->num_chans++; } @@ -357,36 +355,36 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF static uint32 FREERDP_CC MyVirtualChannelOpen(void* pInitHandle, uint32* pOpenHandle, char* pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc) { - rdpChanMan* chan_man; + rdpChannels* chan_man; int index; - struct chan_data* lchan; + struct channel_data* lchan; - DEBUG_CHANMAN("enter"); + DEBUG_CHANNELS("enter"); chan_man = ((rdpInitHandle*)pInitHandle)->chan_man; if (pOpenHandle == 0) { - DEBUG_CHANMAN("error bad chanhan"); + DEBUG_CHANNELS("error bad chanhan"); return CHANNEL_RC_BAD_CHANNEL_HANDLE; } if (pChannelOpenEventProc == 0) { - DEBUG_CHANMAN("error bad proc"); + DEBUG_CHANNELS("error bad proc"); return CHANNEL_RC_BAD_PROC; } if (!chan_man->is_connected) { - DEBUG_CHANMAN("error not connected"); + DEBUG_CHANNELS("error not connected"); return CHANNEL_RC_NOT_CONNECTED; } - lchan = freerdp_chanman_find_chan_data_by_name(chan_man, pChannelName, &index); + lchan = freerdp_channels_find_channel_data_by_name(chan_man, pChannelName, &index); if (lchan == 0) { - DEBUG_CHANMAN("error chan name"); + DEBUG_CHANNELS("error chan name"); return CHANNEL_RC_UNKNOWN_CHANNEL_NAME; } if (lchan->flags == 2) { - DEBUG_CHANMAN("error chan already open"); + DEBUG_CHANNELS("error chan already open"); return CHANNEL_RC_ALREADY_OPEN; } @@ -402,21 +400,21 @@ static uint32 FREERDP_CC MyVirtualChannelOpen(void* pInitHandle, uint32* pOpenHa */ static uint32 FREERDP_CC MyVirtualChannelClose(uint32 openHandle) { - rdpChanMan* chan_man; - struct chan_data* lchan; + rdpChannels* chan_man; + struct channel_data* lchan; int index; - DEBUG_CHANMAN("enter"); - chan_man = freerdp_chanman_find_by_open_handle(openHandle, &index); + DEBUG_CHANNELS("enter"); + chan_man = freerdp_channels_find_by_open_handle(openHandle, &index); if ((chan_man == NULL) || (index < 0) || (index >= CHANNEL_MAX_COUNT)) { - DEBUG_CHANMAN("error bad chanhan"); + DEBUG_CHANNELS("error bad chanhan"); return CHANNEL_RC_BAD_CHANNEL_HANDLE; } lchan = chan_man->chans + index; if (lchan->flags != 2) { - DEBUG_CHANMAN("error not open"); + DEBUG_CHANNELS("error not open"); return CHANNEL_RC_NOT_OPEN; } lchan->flags = 0; @@ -427,43 +425,43 @@ static uint32 FREERDP_CC MyVirtualChannelClose(uint32 openHandle) static uint32 FREERDP_CC MyVirtualChannelWrite(uint32 openHandle, void* pData, uint32 dataLength, void* pUserData) { - rdpChanMan* chan_man; - struct chan_data* lchan; + rdpChannels* chan_man; + struct channel_data* lchan; struct sync_data* item; int index; - chan_man = freerdp_chanman_find_by_open_handle(openHandle, &index); + chan_man = freerdp_channels_find_by_open_handle(openHandle, &index); if ((chan_man == NULL) || (index < 0) || (index >= CHANNEL_MAX_COUNT)) { - DEBUG_CHANMAN("error bad chanhan"); + DEBUG_CHANNELS("error bad chanhan"); return CHANNEL_RC_BAD_CHANNEL_HANDLE; } if (!chan_man->is_connected) { - DEBUG_CHANMAN("error not connected"); + DEBUG_CHANNELS("error not connected"); return CHANNEL_RC_NOT_CONNECTED; } if (pData == 0) { - DEBUG_CHANMAN("error bad pData"); + DEBUG_CHANNELS("error bad pData"); return CHANNEL_RC_NULL_DATA; } if (dataLength == 0) { - DEBUG_CHANMAN("error bad dataLength"); + DEBUG_CHANNELS("error bad dataLength"); return CHANNEL_RC_ZERO_LENGTH; } lchan = chan_man->chans + index; if (lchan->flags != 2) { - DEBUG_CHANMAN("error not open"); + DEBUG_CHANNELS("error not open"); return CHANNEL_RC_NOT_OPEN; } - freerdp_mutex_lock(chan_man->sync_data_mutex); /* lock chan_man->sync* vars */ + freerdp_mutex_lock(chan_man->sync_data_mutex); /* lock channels->sync* vars */ if (!chan_man->is_connected) { freerdp_mutex_unlock(chan_man->sync_data_mutex); - DEBUG_CHANMAN("error not connected"); + DEBUG_CHANNELS("error not connected"); return CHANNEL_RC_NOT_CONNECTED; } item = xnew(struct sync_data); @@ -482,37 +480,37 @@ static uint32 FREERDP_CC MyVirtualChannelWrite(uint32 openHandle, void* pData, u static uint32 FREERDP_CC MyVirtualChannelEventPush(uint32 openHandle, RDP_EVENT* event) { - rdpChanMan* chan_man; - struct chan_data* lchan; + rdpChannels* chan_man; + struct channel_data* lchan; int index; - chan_man = freerdp_chanman_find_by_open_handle(openHandle, &index); + chan_man = freerdp_channels_find_by_open_handle(openHandle, &index); if ((chan_man == NULL) || (index < 0) || (index >= CHANNEL_MAX_COUNT)) { - DEBUG_CHANMAN("error bad chanhan"); + DEBUG_CHANNELS("error bad chanhan"); return CHANNEL_RC_BAD_CHANNEL_HANDLE; } if (!chan_man->is_connected) { - DEBUG_CHANMAN("error not connected"); + DEBUG_CHANNELS("error not connected"); return CHANNEL_RC_NOT_CONNECTED; } if (event == NULL) { - DEBUG_CHANMAN("error bad event"); + DEBUG_CHANNELS("error bad event"); return CHANNEL_RC_NULL_DATA; } lchan = chan_man->chans + index; if (lchan->flags != 2) { - DEBUG_CHANMAN("error not open"); + DEBUG_CHANNELS("error not open"); return CHANNEL_RC_NOT_OPEN; } - freerdp_sem_wait(chan_man->event_sem); /* lock chan_man->event */ + freerdp_sem_wait(chan_man->event_sem); /* lock channels->event */ if (!chan_man->is_connected) { freerdp_sem_signal(chan_man->event_sem); - DEBUG_CHANMAN("error not connected"); + DEBUG_CHANNELS("error not connected"); return CHANNEL_RC_NOT_CONNECTED; } chan_man->event = event; @@ -526,10 +524,10 @@ static uint32 FREERDP_CC MyVirtualChannelEventPush(uint32 openHandle, RDP_EVENT* * before any other function in the file * called only from main thread */ -int freerdp_chanman_global_init(void) +int freerdp_channels_global_init(void) { g_init_chan_man = NULL; - g_chan_man_list = NULL; + g_channels_list = NULL; g_open_handle_sequence = 1; g_mutex_init = freerdp_mutex_new(); g_mutex_list = freerdp_mutex_new(); @@ -537,10 +535,10 @@ int freerdp_chanman_global_init(void) return 0; } -int freerdp_chanman_global_uninit(void) +int freerdp_channels_global_uninit(void) { - while (g_chan_man_list) - freerdp_chanman_free(g_chan_man_list->chan_man); + while (g_channels_list) + freerdp_channels_free(g_channels_list->channels); freerdp_mutex_free(g_mutex_init); freerdp_mutex_free(g_mutex_list); @@ -548,12 +546,12 @@ int freerdp_chanman_global_uninit(void) return 0; } -rdpChanMan* freerdp_chanman_new(void) +rdpChannels* freerdp_channels_new(void) { - rdpChanMan* chan_man; - rdpChanManList* list; + rdpChannels* chan_man; + rdpChannelsList* list; - chan_man = xnew(rdpChanMan); + chan_man = xnew(rdpChannels); chan_man->sync_data_mutex = freerdp_mutex_new(); chan_man->sync_data_list = list_new(); @@ -562,21 +560,21 @@ rdpChanMan* freerdp_chanman_new(void) chan_man->signal = wait_obj_new(); /* Add it to the global list */ - list = xnew(rdpChanManList); - list->chan_man = chan_man; + list = xnew(rdpChannelsList); + list->channels = chan_man; freerdp_mutex_lock(g_mutex_list); - list->next = g_chan_man_list; - g_chan_man_list = list; + list->next = g_channels_list; + g_channels_list = list; freerdp_mutex_unlock(g_mutex_list); return chan_man; } -void freerdp_chanman_free(rdpChanMan * chan_man) +void freerdp_channels_free(rdpChannels * chan_man) { - rdpChanManList* list; - rdpChanManList* prev; + rdpChannelsList* list; + rdpChannelsList* prev; freerdp_mutex_free(chan_man->sync_data_mutex); list_free(chan_man->sync_data_list); @@ -586,9 +584,9 @@ void freerdp_chanman_free(rdpChanMan * chan_man) /* Remove from global list */ freerdp_mutex_lock(g_mutex_list); - for (prev = NULL, list = g_chan_man_list; list; prev = list, list = list->next) + for (prev = NULL, list = g_channels_list; list; prev = list, list = list->next) { - if (list->chan_man == chan_man) + if (list->channels == chan_man) break; } if (list) @@ -596,7 +594,7 @@ void freerdp_chanman_free(rdpChanMan * chan_man) if (prev) prev->next = list->next; else - g_chan_man_list = list->next; + g_channels_list = list->next; xfree(list); } freerdp_mutex_unlock(g_mutex_list); @@ -608,24 +606,24 @@ void freerdp_chanman_free(rdpChanMan * chan_man) * this is called when processing the command line parameters * called only from main thread */ -int freerdp_chanman_load_plugin(rdpChanMan* chan_man, rdpSettings* settings, +int freerdp_channels_load_plugin(rdpChannels* chan_man, rdpSettings* settings, const char* name, void* data) { struct lib_data* lib; CHANNEL_ENTRY_POINTS_EX ep; int ok; - DEBUG_CHANMAN("%s", name); + DEBUG_CHANNELS("%s", name); if (chan_man->num_libs + 1 >= CHANNEL_MAX_COUNT) { - DEBUG_CHANMAN("too many channels"); + DEBUG_CHANNELS("too many channels"); return 1; } lib = chan_man->libs + chan_man->num_libs; lib->entry = (PVIRTUALCHANNELENTRY)freerdp_load_plugin(name, CHANNEL_EXPORT_FUNC_NAME); if (lib->entry == NULL) { - DEBUG_CHANMAN("failed to find export function"); + DEBUG_CHANNELS("failed to find export function"); return 1; } ep.cbSize = sizeof(ep); @@ -652,7 +650,7 @@ int freerdp_chanman_load_plugin(rdpChanMan* chan_man, rdpSettings* settings, chan_man->can_call_init = 0; if (!ok) { - DEBUG_CHANMAN("export function call failed"); + DEBUG_CHANNELS("export function call failed"); return 1; } return 0; @@ -662,14 +660,14 @@ int freerdp_chanman_load_plugin(rdpChanMan* chan_man, rdpSettings* settings, * go through and inform all the libraries that we are initialized * called only from main thread */ -int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance) +int freerdp_channels_pre_connect(rdpChannels* chan_man, freerdp* instance) { int index; struct lib_data* llib; CHANNEL_DEF lchannel_def; void* dummy; - DEBUG_CHANMAN("enter"); + DEBUG_CHANNELS("enter"); chan_man->instance = instance; /** @@ -677,8 +675,8 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance) * rdpdr channel to make sound work. This is a workaround for Window 7 and * Windows 2008 */ - if (freerdp_chanman_find_chan_data_by_name(chan_man, "rdpsnd", 0) != 0 && - freerdp_chanman_find_chan_data_by_name(chan_man, "rdpdr", 0) == 0) + if (freerdp_channels_find_channel_data_by_name(chan_man, "rdpsnd", 0) != 0 && + freerdp_channels_find_channel_data_by_name(chan_man, "rdpdr", 0) == 0) { lchannel_def.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP; @@ -693,7 +691,7 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance) freerdp_mutex_unlock(g_mutex_init); chan_man->can_call_init = 0; chan_man->settings = 0; - DEBUG_CHANMAN("registered fake rdpdr for rdpsnd."); + DEBUG_CHANNELS("registered fake rdpdr for rdpsnd."); } for (index = 0; index < chan_man->num_libs; index++) @@ -713,7 +711,7 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance) * this will tell the libraries that its ok to call MyVirtualChannelOpen * called only from main thread */ -int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance) +int freerdp_channels_post_connect(rdpChannels* chan_man, freerdp* instance) { int index; struct lib_data* llib; @@ -723,8 +721,8 @@ int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance) chan_man->is_connected = 1; hostname = instance->settings->hostname; hostname_len = strlen(hostname); - DEBUG_CHANMAN("hostname [%s] chan_man->num_libs [%d]", - hostname, chan_man->num_libs); + DEBUG_CHANNELS("hostname [%s] channels->num_libs [%d]", + hostname, channels->num_libs); for (index = 0; index < chan_man->num_libs; index++) { llib = chan_man->libs + index; @@ -741,33 +739,33 @@ int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance) * data comming from the server to the client * called only from main thread */ -int freerdp_chanman_data(freerdp* instance, int chan_id, void* data, int data_size, +int freerdp_channels_data(freerdp* instance, int channel_id, void* data, int data_size, int flags, int total_size) { - rdpChanMan* chan_man; - rdpChan* lrdp_chan; - struct chan_data* lchan_data; + rdpChannels* chan_man; + rdpChannel* lrdp_chan; + struct channel_data* lchan_data; int index; - chan_man = freerdp_chanman_find_by_rdp_inst(instance); + chan_man = freerdp_channels_find_by_instance(instance); if (chan_man == 0) { - DEBUG_CHANMAN("could not find channel manager"); + DEBUG_CHANNELS("could not find channel manager"); return 1; } - lrdp_chan = freerdp_chanman_find_rdp_chan_by_id(chan_man, instance->settings, - chan_id, &index); + lrdp_chan = freerdp_channels_find_channel_by_id(chan_man, instance->settings, + channel_id, &index); if (lrdp_chan == 0) { - DEBUG_CHANMAN("could not find channel id"); + DEBUG_CHANNELS("could not find channel id"); return 1; } - lchan_data = freerdp_chanman_find_chan_data_by_name(chan_man, lrdp_chan->name, + lchan_data = freerdp_channels_find_channel_data_by_name(chan_man, lrdp_chan->name, &index); if (lchan_data == 0) { - DEBUG_CHANMAN("could not find channel name"); + DEBUG_CHANNELS("could not find channel name"); return 1; } if (lchan_data->open_event_proc != 0) @@ -791,26 +789,26 @@ static const char* event_class_to_name_table[] = /** * Send a plugin-defined event to the plugin. * called only from main thread - * @param chan_man the channel manager instance + * @param channels the channel manager instance * @param event an event object created by freerdp_event_new() */ -FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, RDP_EVENT* event) +FREERDP_API int freerdp_channels_send_event(rdpChannels* chan_man, RDP_EVENT* event) { - struct chan_data* lchan_data; + struct channel_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); + DEBUG_CHANNELS("unknown event_class %d", event->event_class); return 1; } - lchan_data = freerdp_chanman_find_chan_data_by_name(chan_man, name, &index); + lchan_data = freerdp_channels_find_channel_data_by_name(chan_man, name, &index); if (lchan_data == NULL) { - DEBUG_CHANMAN("could not find channel name %s", name); + DEBUG_CHANNELS("could not find channel name %s", name); return 1; } if (lchan_data->open_event_proc != NULL) @@ -825,10 +823,10 @@ FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, RDP_EVENT* even /** * called only from main thread */ -static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance) +static void freerdp_channels_process_sync(rdpChannels* chan_man, freerdp* instance) { - struct chan_data* lchan_data; - rdpChan* lrdp_chan; + struct channel_data* lchan_data; + rdpChannel* lrdp_chan; struct sync_data* item; while (chan_man->sync_data_list->head != NULL) @@ -838,11 +836,11 @@ static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance freerdp_mutex_unlock(chan_man->sync_data_mutex); lchan_data = chan_man->chans + item->index; - lrdp_chan = freerdp_chanman_find_rdp_chan_by_name(chan_man, instance->settings, + lrdp_chan = freerdp_channels_find_channel_by_name(chan_man, instance->settings, lchan_data->name, &item->index); if (lrdp_chan != NULL) { - IFCALL(instance->SendChannelData, instance, lrdp_chan->chan_id, item->data, item->data_length); + IFCALL(instance->SendChannelData, instance, lrdp_chan->channel_id, item->data, item->data_length); } if (lchan_data->open_event_proc != 0) { @@ -857,7 +855,7 @@ static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance /** * called only from main thread */ -boolean freerdp_chanman_get_fds(rdpChanMan* chan_man, freerdp* instance, void** read_fds, +boolean freerdp_channels_get_fds(rdpChannels* chan_man, freerdp* instance, void** read_fds, int* read_count, void** write_fds, int* write_count) { wait_obj_get_fds(chan_man->signal, read_fds, read_count); @@ -867,36 +865,40 @@ boolean freerdp_chanman_get_fds(rdpChanMan* chan_man, freerdp* instance, void** /** * called only from main thread */ -boolean freerdp_chanman_check_fds(rdpChanMan * chan_man, freerdp* instance) +boolean freerdp_channels_check_fds(rdpChannels * chan_man, freerdp* instance) { if (wait_obj_is_set(chan_man->signal)) { wait_obj_clear(chan_man->signal); - freerdp_chanman_process_sync(chan_man, instance); + freerdp_channels_process_sync(chan_man, instance); } + return True; } -RDP_EVENT* freerdp_chanman_pop_event(rdpChanMan* chan_man) +RDP_EVENT* freerdp_channels_pop_event(rdpChannels* chan_man) { RDP_EVENT* event; if (chan_man->event == NULL) return NULL; + event = chan_man->event; chan_man->event = NULL; - freerdp_sem_signal(chan_man->event_sem); /* release chan_man->event */ + + freerdp_sem_signal(chan_man->event_sem); /* release channels->event */ + return event; } -void freerdp_chanman_close(rdpChanMan* chan_man, freerdp* instance) +void freerdp_channels_close(rdpChannels* chan_man, freerdp* instance) { int index; struct lib_data* llib; - DEBUG_CHANMAN("closing"); + DEBUG_CHANNELS("closing"); chan_man->is_connected = 0; - freerdp_chanman_check_fds(chan_man, instance); + freerdp_channels_check_fds(chan_man, instance); /* tell all libraries we are shutting down */ for (index = 0; index < chan_man->num_libs; index++) { diff --git a/libfreerdp-chanman/libchanman.h b/libfreerdp-channels/libchannels.h similarity index 75% rename from libfreerdp-chanman/libchanman.h rename to libfreerdp-channels/libchannels.h index eedacb6b9..27058e383 100644 --- a/libfreerdp-chanman/libchanman.h +++ b/libfreerdp-channels/libchannels.h @@ -18,15 +18,15 @@ * limitations under the License. */ -#ifndef __LIBCHANMAN_H -#define __LIBCHANMAN_H +#ifndef __LIBCHANNELS_H +#define __LIBCHANNELS_H #include -#ifdef WITH_DEBUG_CHANMAN -#define DEBUG_CHANMAN(fmt, ...) DEBUG_CLASS(CHANMAN, fmt, ## __VA_ARGS__) +#ifdef WITH_DEBUG_CHANNELS +#define DEBUG_CHANNELS(fmt, ...) DEBUG_CLASS(CHANNELS, fmt, ## __VA_ARGS__) #else -#define DEBUG_CHANMAN(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) +#define DEBUG_CHANNELS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -#endif /* __LIBCHANMAN_H */ +#endif /* __LIBCHANNELS_H */ diff --git a/libfreerdp-core/channel.c b/libfreerdp-core/channel.c index ca11ebeaa..c35b0e39a 100644 --- a/libfreerdp-core/channel.c +++ b/libfreerdp-core/channel.c @@ -34,11 +34,11 @@ boolean freerdp_channel_send(freerdp* instance, uint16 channel_id, uint8* data, uint32 flags; int i, left; int chunk_size; - rdpChan* channel = NULL; + rdpChannel* channel = NULL; for (i = 0; i < instance->settings->num_channels; i++) { - if (instance->settings->channels[i].chan_id == channel_id) + if (instance->settings->channels[i].channel_id == channel_id) { channel = &instance->settings->channels[i]; break; diff --git a/libfreerdp-core/connection.c b/libfreerdp-core/connection.c index 0319f6741..e349d422e 100644 --- a/libfreerdp-core/connection.c +++ b/libfreerdp-core/connection.c @@ -272,7 +272,7 @@ boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) if (rdp->settings->num_channels > 0) { - if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[0].chan_id)) + if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[0].channel_id)) return False; all_joined = False; @@ -285,7 +285,7 @@ boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) if (rdp->settings->channels[i].joined) continue; - if (rdp->settings->channels[i].chan_id != channel_id) + if (rdp->settings->channels[i].channel_id != channel_id) return False; rdp->settings->channels[i].joined = True; @@ -293,7 +293,7 @@ boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) } if (i + 1 < rdp->settings->num_channels) { - if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[i + 1].chan_id)) + if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[i + 1].channel_id)) return False; all_joined = False; @@ -513,7 +513,7 @@ boolean rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s) for (i = 0; i < rdp->settings->num_channels; i++) { - if (rdp->settings->channels[i].chan_id == channel_id) + if (rdp->settings->channels[i].channel_id == channel_id) rdp->settings->channels[i].joined = True; if (!rdp->settings->channels[i].joined) diff --git a/libfreerdp-core/gcc.c b/libfreerdp-core/gcc.c index 8f4cc037f..3f982b7c2 100644 --- a/libfreerdp-core/gcc.c +++ b/libfreerdp-core/gcc.c @@ -859,7 +859,7 @@ boolean gcc_read_client_network_data(STREAM* s, rdpSettings *settings, uint16 bl /* CHANNEL_DEF */ stream_read(s, settings->channels[i].name, 8); /* name (8 bytes) */ stream_read_uint32(s, settings->channels[i].options); /* options (4 bytes) */ - settings->channels[i].chan_id = MCS_GLOBAL_CHANNEL_ID + 1 + i; + settings->channels[i].channel_id = MCS_GLOBAL_CHANNEL_ID + 1 + i; } return True; @@ -913,7 +913,7 @@ boolean gcc_read_server_network_data(STREAM* s, rdpSettings *settings) for (i = 0; i < channelCount; i++) { stream_read_uint16(s, channelId); /* channelId */ - settings->channels[i].chan_id = channelId; + settings->channels[i].channel_id = channelId; } if (channelCount % 2 == 1) @@ -933,7 +933,7 @@ void gcc_write_server_network_data(STREAM* s, rdpSettings *settings) for (i = 0; i < settings->num_channels; i++) { - stream_write_uint16(s, settings->channels[i].chan_id); + stream_write_uint16(s, settings->channels[i].channel_id); } if (settings->num_channels % 2 == 1)