From 8df77dba7165e5c4a15af9c1a14026649d4aefec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 16 Oct 2011 20:10:09 -0400 Subject: [PATCH 1/3] libfreerdp-core: move rdpChannels context to rdpContext --- client/DirectFB/dfreerdp.c | 27 +++++++------- client/DirectFB/dfreerdp.h | 1 - client/X11/xf_rail.c | 56 ++++++++++++++--------------- client/X11/xfreerdp.c | 33 ++++++++--------- client/X11/xfreerdp.h | 3 +- include/freerdp/channels/channels.h | 9 +++-- include/freerdp/freerdp.h | 5 +++ 7 files changed, 70 insertions(+), 64 deletions(-) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index 96c99bf8f..fb6dc35a1 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -46,7 +46,8 @@ void df_context_size(freerdp* instance, uint32* size) void df_context_new(freerdp* instance, dfContext* context) { - context->channels = freerdp_channels_new(); + rdpContext* _context = (rdpContext*) context; + _context->channels = freerdp_channels_new(); } void df_context_free(freerdp* instance, dfContext* context) @@ -148,7 +149,7 @@ boolean df_pre_connect(freerdp* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; - freerdp_channels_pre_connect(context->channels, instance); + freerdp_channels_pre_connect(instance->context->channels, instance); return True; } @@ -201,7 +202,7 @@ boolean df_post_connect(freerdp* instance) df_keyboard_init(); - freerdp_channels_post_connect(context->channels, instance); + freerdp_channels_post_connect(instance->context->channels, instance); return True; } @@ -279,7 +280,7 @@ int dfreerdp_run(freerdp* instance) fd_set wfds_set; dfInfo* dfi; dfContext* context; - rdpChannels* chanman; + rdpChannels* channels; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -290,7 +291,7 @@ int dfreerdp_run(freerdp* instance) context = (dfContext*) instance->context; dfi = context->dfi; - chanman = context->channels; + channels = instance->context->channels; while (1) { @@ -302,7 +303,7 @@ int dfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -353,16 +354,16 @@ int dfreerdp_run(freerdp* instance) printf("Failed to check dfreerdp file descriptor\n"); break; } - if (freerdp_channels_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(channels, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; } - df_process_channel_event(chanman, instance); + df_process_channel_event(channels, instance); } - freerdp_channels_close(chanman, instance); - freerdp_channels_free(chanman); + freerdp_channels_close(channels, instance); + freerdp_channels_free(channels); df_free(dfi); gdi_free(instance); instance->Disconnect(instance); @@ -395,8 +396,8 @@ int main(int argc, char* argv[]) pthread_t thread; freerdp* instance; dfContext* context; + rdpChannels* channels; struct thread_data* data; - rdpChannels* chanman; setlocale(LC_ALL, ""); @@ -415,10 +416,10 @@ int main(int argc, char* argv[]) freerdp_context_new(instance); context = (dfContext*) instance->context; - chanman = context->channels; + channels = instance->context->channels; DirectFBInit(&argc, &argv); - freerdp_parse_args(instance->settings, argc, argv, df_process_plugin_args, chanman, NULL, NULL); + freerdp_parse_args(instance->settings, argc, argv, df_process_plugin_args, channels, NULL, NULL); data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); data->instance = instance; diff --git a/client/DirectFB/dfreerdp.h b/client/DirectFB/dfreerdp.h index e2a9228e3..8cac12339 100644 --- a/client/DirectFB/dfreerdp.h +++ b/client/DirectFB/dfreerdp.h @@ -35,7 +35,6 @@ struct df_context rdpContext _p; dfInfo* dfi; - rdpChannels* channels; rdpSettings* settings; }; typedef struct df_context dfContext; diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index 7a8b810aa..4f2eda8a1 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(rdpChannels* chanman, uint16 event_type, void* param) +static void xf_send_rail_client_event(rdpChannels* channels, uint16 event_type, void* param) { RDP_EVENT* out_event = NULL; void * payload = NULL; @@ -205,16 +205,16 @@ static void xf_send_rail_client_event(rdpChannels* chanman, uint16 event_type, v { out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type, xf_on_free_rail_client_event, payload); - freerdp_channels_send_event(chanman, out_event); + freerdp_channels_send_event(channels, out_event); } } void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 top, uint32 right, uint32 bottom) { - rdpChannels* chanman; + rdpChannels* channels; RAIL_WINDOW_MOVE_ORDER window_move; - chanman = xfi->context->channels; + channels = xfi->_context->channels; window_move.windowId = windowId; window_move.left = left; @@ -222,18 +222,18 @@ void xf_rail_send_windowmove(xfInfo* xfi, uint32 windowId, uint32 left, uint32 t window_move.right = right; window_move.bottom = bottom; - xf_send_rail_client_event(chanman, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &window_move); + xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &window_move); } void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) { rdpRail* rail; - rdpChannels* chanman; + rdpChannels* channels; rdpWindow* rail_window; RAIL_ACTIVATE_ORDER activate; - chanman = xfi->context->channels; - rail = ((rdpContext*) xfi->context)->rail; + rail = xfi->_context->rail; + channels = xfi->_context->channels; rail_window = window_list_get_by_extra_id(rail->list, (void*) xwindow); @@ -243,23 +243,23 @@ void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) activate.windowId = rail_window->windowId; activate.enabled = enabled; - xf_send_rail_client_event(chanman, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, &activate); + xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, &activate); } void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command) { - rdpChannels* chanman; + rdpChannels* channels; RAIL_SYSCOMMAND_ORDER syscommand; - chanman = xfi->context->channels; + channels = xfi->_context->channels; syscommand.windowId = windowId; syscommand.command = command; - xf_send_rail_client_event(chanman, RDP_EVENT_TYPE_RAIL_CLIENT_SYSCOMMAND, &syscommand); + xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_SYSCOMMAND, &syscommand); } -void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event) { RAIL_SYSPARAM_ORDER* sysparam; @@ -277,7 +277,7 @@ void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* chanman, RDP_ sysparam->dragFullWindows = False; - xf_send_rail_client_event(chanman, RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS, sysparam); + xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS, sysparam); } const char* error_code_names[] = @@ -291,7 +291,7 @@ const char* error_code_names[] = "RAIL_EXEC_E_SESSION_LOCKED" }; -void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event) { RAIL_EXEC_RESULT_ORDER* exec_result; @@ -304,7 +304,7 @@ void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* chanman, RDP_EV } } -void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChannels* channels, 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, rdpChannels* chanman, RD } } -void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* channels, 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, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event) { rdpRail* rail; rdpWindow* rail_window = NULL; @@ -386,7 +386,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* chanma } -void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* channels, 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, rdpChannels* chanman, RDP_EVE freerdp_hexdump(appid_resp->applicationId.string, appid_resp->applicationId.length); } -void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event) { RAIL_LANGBAR_INFO_ORDER* langbar = (RAIL_LANGBAR_INFO_ORDER*) event->user_data; @@ -407,36 +407,36 @@ void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* chanman, RDP_EV langbar->languageBarStatus); } -void xf_process_rail_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event) +void xf_process_rail_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event) { switch (event->event_type) { case RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS: - xf_process_rail_get_sysparams_event(xfi, chanman, event); + xf_process_rail_get_sysparams_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_EXEC_RESULTS: - xf_process_rail_exec_result_event(xfi, chanman, event); + xf_process_rail_exec_result_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM: - xf_process_rail_server_sysparam_event(xfi, chanman, event); + xf_process_rail_server_sysparam_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_MINMAXINFO: - xf_process_rail_server_minmaxinfo_event(xfi, chanman, event); + xf_process_rail_server_minmaxinfo_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE: - xf_process_rail_server_localmovesize_event(xfi, chanman, event); + xf_process_rail_server_localmovesize_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_APPID_RESP: - xf_process_rail_appid_resp_event(xfi, chanman, event); + xf_process_rail_appid_resp_event(xfi, channels, event); break; case RDP_EVENT_TYPE_RAIL_CHANNEL_LANGBARINFO: - xf_process_rail_langbarinfo_event(xfi, chanman, event); + xf_process_rail_langbarinfo_event(xfi, channels, event); break; default: diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 3a0de006c..4e360032b 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -81,7 +81,8 @@ void xf_context_size(freerdp* instance, uint32* size) void xf_context_new(freerdp* instance, xfContext* context) { - context->channels = freerdp_channels_new(); + rdpContext* _context = &context->_p; + _context->channels = freerdp_channels_new(); } void xf_context_free(freerdp* instance, xfContext* context) @@ -527,6 +528,8 @@ boolean xf_pre_connect(freerdp* instance) xfi = (xfInfo*) xzalloc(sizeof(xfInfo)); ((xfContext*) instance->context)->xfi = xfi; + + xfi->_context = instance->context; xfi->context = (xfContext*) instance->context; xfi->context->settings = instance->settings; xfi->instance = instance; @@ -559,7 +562,7 @@ boolean xf_pre_connect(freerdp* instance) settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; - freerdp_channels_pre_connect(xfi->context->channels, instance); + freerdp_channels_pre_connect(xfi->_context->channels, instance); xfi->display = XOpenDisplay(NULL); @@ -623,11 +626,11 @@ boolean xf_post_connect(freerdp* instance) xfInfo* xfi; XGCValues gcv; rdpCache* cache; - rdpChannels* chanman; + rdpChannels* channels; xfi = ((xfContext*) instance->context)->xfi; cache = instance->context->cache; - chanman = xfi->context->channels; + channels = xfi->_context->channels; if (xf_get_pixmap_info(xfi) != True) return False; @@ -738,12 +741,12 @@ boolean xf_post_connect(freerdp* instance) rail_register_update_callbacks(instance->context->rail, instance->update); xf_rail_register_callbacks(xfi, instance->context->rail); - freerdp_channels_post_connect(chanman, instance); + freerdp_channels_post_connect(channels, instance); xf_tsmf_init(xfi, xv_port); if (xfi->remote_app != True) - xf_cliprdr_init(xfi, chanman); + xf_cliprdr_init(xfi, channels); return True; } @@ -902,7 +905,7 @@ int xfreerdp_run(freerdp* instance) void* wfds[32]; fd_set rfds_set; fd_set wfds_set; - rdpChannels* chanman; + rdpChannels* channels; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); @@ -911,7 +914,7 @@ int xfreerdp_run(freerdp* instance) return 0; xfi = ((xfContext*) instance->context)->xfi; - chanman = ((xfContext*) instance->context)->channels; + channels = instance->context->channels; while (1) { @@ -923,7 +926,7 @@ int xfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -974,16 +977,16 @@ int xfreerdp_run(freerdp* instance) printf("Failed to check xfreerdp file descriptor\n"); break; } - if (freerdp_channels_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(channels, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; } - xf_process_channel_event(chanman, instance); + xf_process_channel_event(channels, instance); } - freerdp_channels_close(chanman, instance); - freerdp_channels_free(chanman); + freerdp_channels_close(channels, instance); + freerdp_channels_free(channels); instance->Disconnect(instance); gdi_free(instance); freerdp_free(instance); @@ -1015,7 +1018,6 @@ int main(int argc, char* argv[]) { pthread_t thread; freerdp* instance; - xfContext* context; struct thread_data* data; freerdp_handle_signals(); @@ -1038,10 +1040,9 @@ int main(int argc, char* argv[]) freerdp_context_new(instance); instance->settings->sw_gdi = False; - context = (xfContext*) instance->context; if (freerdp_parse_args(instance->settings, argc, argv, - xf_process_plugin_args, context->channels, xf_process_ui_args, NULL) < 0) + xf_process_plugin_args, instance->context->channels, xf_process_ui_args, NULL) < 0) return 1; data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index eb563bde3..56c782f68 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -63,7 +63,7 @@ struct xf_context rdpContext _p; xfInfo* xfi; - rdpChannels* channels; + //rdpChannels* channels; rdpSettings* settings; }; typedef struct xf_context xfContext; @@ -72,6 +72,7 @@ struct xf_info { freerdp* instance; xfContext* context; + rdpContext* _context; GC gc; int bpp; diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h index 370f39006..8bc3a3974 100644 --- a/include/freerdp/channels/channels.h +++ b/include/freerdp/channels/channels.h @@ -18,18 +18,17 @@ * limitations under the License. */ -#ifndef __FREERDP_CHANMAN_H -#define __FREERDP_CHANMAN_H +#ifndef __FREERDP_CHANNELS_H +#define __FREERDP_CHANNELS_H #include #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); @@ -51,4 +50,4 @@ FREERDP_API void freerdp_channels_close(rdpChannels* channels, freerdp* instance } #endif -#endif +#endif /* __FREERDP_CHANNELS_H */ diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 32e43f4f7..5fd28824a 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -24,6 +24,8 @@ typedef struct rdp_rdp rdpRdp; typedef struct rdp_gdi rdpGdi; typedef struct rdp_rail rdpRail; typedef struct rdp_cache rdpCache; +typedef struct rdp_channels rdpChannels; + typedef struct rdp_freerdp freerdp; typedef struct rdp_context rdpContext; @@ -64,6 +66,9 @@ struct rdp_context rdpGdi* gdi; rdpRail* rail; rdpCache* cache; + rdpChannels* channels; + + void* reserved[32 - 6]; }; struct rdp_freerdp From 5d9e8b2e28c8841f3327526ab2f74aa55ddc1b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 16 Oct 2011 21:02:28 -0400 Subject: [PATCH 2/3] libfreerdp-core: cleanup of freerdp interface --- client/DirectFB/dfreerdp.c | 8 ++++---- client/X11/xf_gdi.c | 4 ++-- client/X11/xfreerdp.c | 14 +++++++------- client/test/freerdp.c | 6 +++--- include/freerdp/cache/bitmap.h | 8 ++++---- include/freerdp/cache/brush.h | 4 ++-- include/freerdp/cache/offscreen.h | 13 ++++--------- include/freerdp/freerdp.h | 31 ++++++++++++++----------------- include/freerdp/update.h | 12 +++++++----- libfreerdp-cache/brush.c | 4 ++-- libfreerdp-cache/offscreen.c | 8 ++++---- libfreerdp-channels/libchannels.c | 8 ++++---- libfreerdp-core/freerdp.c | 8 +++----- libfreerdp-gdi/gdi.c | 10 +++++----- 14 files changed, 65 insertions(+), 73 deletions(-) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index fb6dc35a1..3d60b46c5 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -285,7 +285,7 @@ int dfreerdp_run(freerdp* instance) memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); - if (!instance->Connect(instance)) + if (!freerdp_connect(instance)) return 0; context = (dfContext*) instance->context; @@ -298,7 +298,7 @@ int dfreerdp_run(freerdp* instance) rcount = 0; wcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -344,7 +344,7 @@ int dfreerdp_run(freerdp* instance) } } - if (instance->CheckFileDescriptor(instance) != True) + if (freerdp_check_fds(instance) != True) { printf("Failed to check FreeRDP file descriptor\n"); break; @@ -366,7 +366,7 @@ int dfreerdp_run(freerdp* instance) freerdp_channels_free(channels); df_free(dfi); gdi_free(instance); - instance->Disconnect(instance); + freerdp_disconnect(instance); freerdp_free(instance); return 0; diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index 65dd0b0ae..69cc5fc05 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -382,7 +382,7 @@ void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt) if (brush->style & CACHED_BRUSH) { - brush->data = brush_get(cache->brush, brush->index, &brush->bpp); + brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp); brush->style = GDI_BS_PATTERN; } @@ -823,7 +823,7 @@ void xf_gdi_cache_glyph_v2(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_ void xf_gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush) { rdpCache* cache = update->context->cache; - brush_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp); + brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp); } void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command) diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 4e360032b..f7df3d2f4 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -731,9 +731,9 @@ boolean xf_post_connect(freerdp* instance) cache->bitmap->BitmapFree = (cbBitmapFree) xf_bitmap_free; offscreen_cache_register_callbacks(instance->update); - cache->offscreen->OffscreenBitmapSize = (cbOffscreenBitmapSize) xf_bitmap_size; - cache->offscreen->OffscreenBitmapNew = (cbOffscreenBitmapNew) xf_offscreen_bitmap_new; - cache->offscreen->OffscreenBitmapFree = (cbOffscreenBitmapFree) xf_bitmap_free; + cache->offscreen->BitmapSize = (cbBitmapSize) xf_bitmap_size; + cache->offscreen->BitmapNew = (cbBitmapNew) xf_offscreen_bitmap_new; + cache->offscreen->BitmapFree = (cbBitmapFree) xf_bitmap_free; cache->offscreen->SetSurface = (cbSetSurface) xf_set_surface; } @@ -910,7 +910,7 @@ int xfreerdp_run(freerdp* instance) memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); - if (!instance->Connect(instance)) + if (!freerdp_connect(instance)) return 0; xfi = ((xfContext*) instance->context)->xfi; @@ -921,7 +921,7 @@ int xfreerdp_run(freerdp* instance) rcount = 0; wcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -967,7 +967,7 @@ int xfreerdp_run(freerdp* instance) } } - if (instance->CheckFileDescriptor(instance) != True) + if (freerdp_check_fds(instance) != True) { printf("Failed to check FreeRDP file descriptor\n"); break; @@ -987,7 +987,7 @@ int xfreerdp_run(freerdp* instance) freerdp_channels_close(channels, instance); freerdp_channels_free(channels); - instance->Disconnect(instance); + freerdp_disconnect(instance); gdi_free(instance); freerdp_free(instance); xf_free(xfi); diff --git a/client/test/freerdp.c b/client/test/freerdp.c index dad5fb05c..16ad43430 100644 --- a/client/test/freerdp.c +++ b/client/test/freerdp.c @@ -222,14 +222,14 @@ int tfreerdp_run(freerdp* instance) context = (tfContext*) instance->context; chanman = context->chanman; - instance->Connect(instance); + freerdp_connect(instance); while (1) { rcount = 0; wcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -269,7 +269,7 @@ int tfreerdp_run(freerdp* instance) } } - if (instance->CheckFileDescriptor(instance) != True) + if (freerdp_check_fds(instance) != True) { printf("Failed to check FreeRDP file descriptor\n"); break; diff --git a/include/freerdp/cache/bitmap.h b/include/freerdp/cache/bitmap.h index aa8ccd853..fb6e5d1a6 100644 --- a/include/freerdp/cache/bitmap.h +++ b/include/freerdp/cache/bitmap.h @@ -29,6 +29,10 @@ typedef struct _BITMAP_V2_CELL BITMAP_V2_CELL; typedef struct rdp_bitmap_cache rdpBitmapCache; +typedef void (*cbBitmapSize)(rdpUpdate* update, uint32* size); +typedef void (*cbBitmapNew)(rdpUpdate* update, rdpBitmap* bitmap); +typedef void (*cbBitmapFree)(rdpUpdate* update, rdpBitmap* bitmap); + #include struct _BITMAP_V2_CELL @@ -37,10 +41,6 @@ struct _BITMAP_V2_CELL rdpBitmap** entries; }; -typedef void (*cbBitmapSize)(rdpUpdate* update, uint32* size); -typedef void (*cbBitmapNew)(rdpUpdate* update, rdpBitmap* bitmap); -typedef void (*cbBitmapFree)(rdpUpdate* update, rdpBitmap* bitmap); - struct rdp_bitmap_cache { pcMemBlt MemBlt; diff --git a/include/freerdp/cache/brush.h b/include/freerdp/cache/brush.h index aad4afad5..767f3c22d 100644 --- a/include/freerdp/cache/brush.h +++ b/include/freerdp/cache/brush.h @@ -41,8 +41,8 @@ struct rdp_brush }; typedef struct rdp_brush rdpBrushCache; -FREERDP_API void* brush_get(rdpBrushCache* brush, uint8 index, uint8* bpp); -FREERDP_API void brush_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp); +FREERDP_API void* brush_cache_get(rdpBrushCache* brush, uint8 index, uint8* bpp); +FREERDP_API void brush_cache_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp); FREERDP_API rdpBrushCache* brush_cache_new(rdpSettings* settings); FREERDP_API void brush_cache_free(rdpBrushCache* brush); diff --git a/include/freerdp/cache/offscreen.h b/include/freerdp/cache/offscreen.h index 211a8e143..dac478a97 100644 --- a/include/freerdp/cache/offscreen.h +++ b/include/freerdp/cache/offscreen.h @@ -27,20 +27,15 @@ #include typedef struct rdp_offscreen_cache rdpOffscreenCache; +typedef void (*cbSetSurface)(rdpUpdate* update, rdpBitmap* bitmap, boolean primary); #include -typedef void (*cbOffscreenBitmapSize)(rdpUpdate* update, uint32* size); -typedef void (*cbOffscreenBitmapNew)(rdpUpdate* update, rdpBitmap* bitmap); -typedef void (*cbOffscreenBitmapFree)(rdpUpdate* update, rdpBitmap* bitmap); -typedef void (*cbSetSurface)(rdpUpdate* update, rdpBitmap* bitmap, boolean primary); - struct rdp_offscreen_cache { - cbOffscreenBitmapSize OffscreenBitmapSize; - cbOffscreenBitmapNew OffscreenBitmapNew; - cbOffscreenBitmapFree OffscreenBitmapFree; - + cbBitmapSize BitmapSize; + cbBitmapNew BitmapNew; + cbBitmapFree BitmapFree; cbSetSurface SetSurface; uint16 currentSurface; diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 5fd28824a..c002cf52a 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -41,23 +41,17 @@ typedef struct rdp_context rdpContext; extern "C" { #endif -FREERDP_API boolean freerdp_global_init(); -FREERDP_API void freerdp_global_finish(); - -typedef boolean (*pcConnect)(freerdp* instance); -typedef boolean (*pcPreConnect)(freerdp* instance); -typedef boolean (*pcPostConnect)(freerdp* instance); -typedef boolean (*pcAuthenticate)(freerdp* instance, char** username, char** password, char** domain); -typedef boolean (*pcGetFileDescriptor)(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount); -typedef boolean (*pcCheckFileDescriptor)(freerdp* instance); -typedef int (*pcSendChannelData)(freerdp* instance, int channelId, uint8* data, int size); -typedef int (*pcReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size); -typedef void (*pcDisconnect)(freerdp* instance); - typedef void (*pcContextSize)(freerdp* instance, uint32* size); typedef void (*pcContextNew)(freerdp* instance, rdpContext* context); typedef void (*pcContextFree)(freerdp* instance, rdpContext* context); +typedef boolean (*pcPreConnect)(freerdp* instance); +typedef boolean (*pcPostConnect)(freerdp* instance); +typedef boolean (*pcAuthenticate)(freerdp* instance, char** username, char** password, char** domain); + +typedef int (*pcSendChannelData)(freerdp* instance, int channelId, uint8* data, int size); +typedef int (*pcReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size); + struct rdp_context { freerdp* instance; @@ -83,20 +77,23 @@ struct rdp_freerdp pcContextNew ContextNew; pcContextFree ContextFree; - pcConnect Connect; pcPreConnect PreConnect; pcPostConnect PostConnect; pcAuthenticate Authenticate; - pcGetFileDescriptor GetFileDescriptor; - pcCheckFileDescriptor CheckFileDescriptor; + pcSendChannelData SendChannelData; pcReceiveChannelData ReceiveChannelData; - pcDisconnect Disconnect; }; FREERDP_API void freerdp_context_new(freerdp* instance); FREERDP_API void freerdp_context_free(freerdp* instance); +FREERDP_API boolean freerdp_connect(freerdp* instance); +FREERDP_API boolean freerdp_disconnect(freerdp* instance); + +FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount); +FREERDP_API boolean freerdp_check_fds(freerdp* instance); + FREERDP_API freerdp* freerdp_new(); FREERDP_API void freerdp_free(freerdp* instance); diff --git a/include/freerdp/update.h b/include/freerdp/update.h index a56cf65ef..dc4edee8c 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -1047,6 +1047,7 @@ typedef void (*pcDesktopResize)(rdpUpdate* update); typedef void (*pcBitmap)(rdpUpdate* update, BITMAP_UPDATE* bitmap); typedef void (*pcPalette)(rdpUpdate* update, PALETTE_UPDATE* palette); typedef void (*pcPlaySound)(rdpUpdate* update, PLAY_SOUND_UPDATE* play_sound); + typedef void (*pcPointerPosition)(rdpUpdate* update, POINTER_POSITION_UPDATE* pointer_position); typedef void (*pcPointerSystem)(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system); typedef void (*pcPointerColor)(rdpUpdate* update, POINTER_COLOR_UPDATE* pointer_color); @@ -1117,10 +1118,6 @@ struct rdp_update { rdpContext* context; - boolean dump_rfx; - boolean play_rfx; - rdpPcap* pcap_rfx; - pcBeginPaint BeginPaint; pcEndPaint EndPaint; pcSetBounds SetBounds; @@ -1158,7 +1155,6 @@ struct rdp_update pcEllipseSC EllipseSC; pcEllipseCB EllipseCB; - boolean glyph_v2; pcCacheBitmap CacheBitmap; pcCacheBitmapV2 CacheBitmapV2; pcCacheBitmapV3 CacheBitmapV3; @@ -1196,6 +1192,12 @@ struct rdp_update pcBitmapDecompress BitmapDecompress; + boolean glyph_v2; + + boolean dump_rfx; + boolean play_rfx; + rdpPcap* pcap_rfx; + BITMAP_UPDATE bitmap_update; PALETTE_UPDATE palette_update; PLAY_SOUND_UPDATE play_sound; diff --git a/libfreerdp-cache/brush.c b/libfreerdp-cache/brush.c index 0d6b93b39..4ae83f828 100644 --- a/libfreerdp-cache/brush.c +++ b/libfreerdp-cache/brush.c @@ -22,7 +22,7 @@ #include -void* brush_get(rdpBrushCache* brush, uint8 index, uint8* bpp) +void* brush_cache_get(rdpBrushCache* brush, uint8 index, uint8* bpp) { void* entry; @@ -58,7 +58,7 @@ void* brush_get(rdpBrushCache* brush, uint8 index, uint8* bpp) return entry; } -void brush_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp) +void brush_cache_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp) { if (bpp == 1) { diff --git a/libfreerdp-cache/offscreen.c b/libfreerdp-cache/offscreen.c index c8f2542a8..2fdabd562 100644 --- a/libfreerdp-cache/offscreen.c +++ b/libfreerdp-cache/offscreen.c @@ -29,18 +29,18 @@ void update_gdi_create_offscreen_bitmap(rdpUpdate* update, CREATE_OFFSCREEN_BITM uint32 size = sizeof(rdpBitmap); rdpCache* cache = update->context->cache; - IFCALL(cache->offscreen->OffscreenBitmapSize, update, &size); + IFCALL(cache->offscreen->BitmapSize, update, &size); bitmap = (rdpBitmap*) xzalloc(size); bitmap->width = create_offscreen_bitmap->cx; bitmap->height = create_offscreen_bitmap->cy; - IFCALL(cache->offscreen->OffscreenBitmapNew, update, bitmap); + IFCALL(cache->offscreen->BitmapNew, update, bitmap); prevBitmap = offscreen_cache_get(cache->offscreen, create_offscreen_bitmap->id); if (prevBitmap != NULL) { - IFCALL(cache->offscreen->OffscreenBitmapFree, update, prevBitmap); + IFCALL(cache->offscreen->BitmapFree, update, prevBitmap); bitmap_free(prevBitmap); } @@ -142,7 +142,7 @@ void offscreen_cache_free(rdpOffscreenCache* offscreen_cache) if (bitmap != NULL) { - IFCALL(offscreen_cache->OffscreenBitmapFree, offscreen_cache->update, bitmap); + IFCALL(offscreen_cache->BitmapFree, offscreen_cache->update, bitmap); bitmap_free(bitmap); } } diff --git a/libfreerdp-channels/libchannels.c b/libfreerdp-channels/libchannels.c index 8607be0ea..4a78f109c 100644 --- a/libfreerdp-channels/libchannels.c +++ b/libfreerdp-channels/libchannels.c @@ -825,9 +825,9 @@ FREERDP_API int freerdp_channels_send_event(rdpChannels* chan_man, RDP_EVENT* ev */ static void freerdp_channels_process_sync(rdpChannels* chan_man, freerdp* instance) { - struct channel_data* lchan_data; rdpChannel* lrdp_chan; struct sync_data* item; + struct channel_data* lchan_data; while (chan_man->sync_data_list->head != NULL) { @@ -838,10 +838,10 @@ static void freerdp_channels_process_sync(rdpChannels* chan_man, freerdp* instan lchan_data = chan_man->chans + item->index; 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->channel_id, item->data, item->data_length); - } + instance->SendChannelData(instance, lrdp_chan->channel_id, item->data, item->data_length); + if (lchan_data->open_event_proc != 0) { lchan_data->open_event_proc(lchan_data->open_handle, diff --git a/libfreerdp-core/freerdp.c b/libfreerdp-core/freerdp.c index 6c722fdf7..a23da105a 100644 --- a/libfreerdp-core/freerdp.c +++ b/libfreerdp-core/freerdp.c @@ -113,12 +113,14 @@ static int freerdp_send_channel_data(freerdp* instance, int channel_id, uint8* d return rdp_send_channel_data(instance->context->rdp, channel_id, data, size); } -void freerdp_disconnect(freerdp* instance) +boolean freerdp_disconnect(freerdp* instance) { rdpRdp* rdp; rdp = instance->context->rdp; transport_disconnect(rdp->transport); + + return True; } void freerdp_context_new(freerdp* instance) @@ -157,11 +159,7 @@ freerdp* freerdp_new() if (instance != NULL) { - instance->Connect = freerdp_connect; - instance->GetFileDescriptor = freerdp_get_fds; - instance->CheckFileDescriptor = freerdp_check_fds; instance->SendChannelData = freerdp_send_channel_data; - instance->Disconnect = freerdp_disconnect; } return instance; diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c index 3ab2da9bd..cfddd27ed 100644 --- a/libfreerdp-gdi/gdi.c +++ b/libfreerdp-gdi/gdi.c @@ -558,7 +558,7 @@ void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt) if (brush->style & CACHED_BRUSH) { - brush->data = brush_get(cache->brush, brush->index, &brush->bpp); + brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp); brush->style = GDI_BS_PATTERN; } @@ -873,7 +873,7 @@ void gdi_cache_glyph_v2(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2) void gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush) { rdpCache* cache = update->context->cache; - brush_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp); + brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp); } int tilenum = 0; @@ -1191,9 +1191,9 @@ int gdi_init(freerdp* instance, uint32 flags, uint8* buffer) cache->bitmap->BitmapFree = (cbBitmapFree) gdi_bitmap_free; offscreen_cache_register_callbacks(instance->update); - cache->offscreen->OffscreenBitmapSize = (cbOffscreenBitmapSize) gdi_bitmap_size; - cache->offscreen->OffscreenBitmapNew = (cbOffscreenBitmapNew) gdi_offscreen_bitmap_new; - cache->offscreen->OffscreenBitmapFree = (cbOffscreenBitmapFree) gdi_bitmap_free; + cache->offscreen->BitmapSize = (cbBitmapSize) gdi_bitmap_size; + cache->offscreen->BitmapNew = (cbBitmapNew) gdi_offscreen_bitmap_new; + cache->offscreen->BitmapFree = (cbBitmapFree) gdi_bitmap_free; cache->offscreen->SetSurface = (cbSetSurface) gdi_set_surface; gdi->rfx_context = rfx_context_new(); From 0070a5ab93bde40c289d434224184606582e93e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Sun, 16 Oct 2011 21:39:11 -0400 Subject: [PATCH 3/3] xfreerdp: move arguments processing on pre_connect --- client/DirectFB/dfreerdp.c | 14 ++++++------- client/X11/xfreerdp.c | 37 +++++++++++++++++++++++---------- client/test/freerdp.c | 42 +++++++++++++++++++------------------- include/freerdp/freerdp.h | 3 +++ 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index 3d60b46c5..5690f009d 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -210,10 +210,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) { - rdpChannels* chanman = (rdpChannels*) user_data; + rdpChannels* channels = (rdpChannels*) user_data; printf("loading plugin %s\n", name); - freerdp_channels_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(channels, settings, name, plugin_data); return 1; } @@ -225,7 +225,7 @@ df_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, } static void -df_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) +df_process_cb_sync_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; RDP_CB_FORMAT_LIST_EVENT* format_list_event; @@ -235,22 +235,22 @@ df_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) format_list_event = (RDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; - freerdp_channels_send_event(chanman, event); + freerdp_channels_send_event(channels, event); } static void -df_process_channel_event(rdpChannels* chanman, freerdp* instance) +df_process_channel_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; - event = freerdp_channels_pop_event(chanman); + event = freerdp_channels_pop_event(channels); if (event) { switch (event->event_type) { case RDP_EVENT_TYPE_CB_SYNC: - df_process_cb_sync_event(chanman, instance); + df_process_cb_sync_event(channels, instance); break; default: printf("df_process_channel_event: unknown event type %d\n", event->event_type); diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index f7df3d2f4..f7f713a79 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -74,6 +74,9 @@ struct thread_data freerdp* instance; }; +int xf_process_client_args(rdpSettings* settings, const char* opt, const char* val, void* user_data); +int xf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data); + void xf_context_size(freerdp* instance, uint32* size) { *size = sizeof(xfContext); @@ -534,6 +537,13 @@ boolean xf_pre_connect(freerdp* instance) xfi->context->settings = instance->settings; xfi->instance = instance; + if (freerdp_parse_args(instance->settings, instance->context->argc, instance->context->argv, + xf_process_plugin_args, instance->context->channels, xf_process_client_args, xfi) < 0) + { + printf("failed to parse arguments.\n"); + exit(0); + } + settings = instance->settings; bitmap_cache = settings->bitmap_cache; @@ -761,7 +771,7 @@ boolean xf_authenticate(freerdp* instance, char** username, char** password, cha return True; } -int xf_process_ui_args(rdpSettings* settings, const char* opt, const char* val, void* user_data) +int xf_process_client_args(rdpSettings* settings, const char* opt, const char* val, void* user_data) { int argc = 0; @@ -801,10 +811,10 @@ 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) { - rdpChannels* chanman = (rdpChannels*) user_data; + rdpChannels* channels = (rdpChannels*) user_data; printf("loading plugin %s\n", name); - freerdp_channels_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(channels, settings, name, plugin_data); return 1; } @@ -873,14 +883,21 @@ void xf_window_free(xfInfo* xfi) xfi->image = NULL; } - if (context->cache) + if (context != NULL) { - cache_free(context->cache); - context->cache = NULL; + if (context->cache != NULL) + { + cache_free(context->cache); + context->cache = NULL; + } + if (context->rail != NULL) + { + rail_free(context->rail); + context->rail = NULL; + } } xfree(xfi->clrconv); - rail_free(context->rail); xf_tsmf_uninit(xfi); xf_cliprdr_uninit(xfi); @@ -1039,12 +1056,10 @@ int main(int argc, char* argv[]) instance->ContextFree = (pcContextFree) xf_context_free; freerdp_context_new(instance); + instance->context->argc = argc; + instance->context->argv = argv; instance->settings->sw_gdi = False; - if (freerdp_parse_args(instance->settings, argc, argv, - xf_process_plugin_args, instance->context->channels, xf_process_ui_args, NULL) < 0) - return 1; - data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); data->instance = instance; diff --git a/client/test/freerdp.c b/client/test/freerdp.c index 16ad43430..b5a32ffa3 100644 --- a/client/test/freerdp.c +++ b/client/test/freerdp.c @@ -50,7 +50,7 @@ struct tf_context rdpContext _p; tfInfo* tfi; - rdpChannels* chanman; + rdpChannels* channels; }; 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_channels_new(); + context->channels = freerdp_channels_new(); } void tf_context_free(freerdp* instance, tfContext* context) @@ -101,15 +101,15 @@ int tf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int s int tf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { - rdpChannels* chanman = (rdpChannels*) user_data; + rdpChannels* channels = (rdpChannels*) user_data; printf("Load plugin %s\n", name); - freerdp_channels_load_plugin(chanman, settings, name, plugin_data); + freerdp_channels_load_plugin(channels, settings, name, plugin_data); return 1; } -void tf_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) +void tf_process_cb_sync_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; RDP_CB_FORMAT_LIST_EVENT* format_list_event; @@ -119,21 +119,21 @@ void tf_process_cb_sync_event(rdpChannels* chanman, freerdp* instance) format_list_event = (RDP_CB_FORMAT_LIST_EVENT*)event; format_list_event->num_formats = 0; - freerdp_channels_send_event(chanman, event); + freerdp_channels_send_event(channels, event); } -void tf_process_channel_event(rdpChannels* chanman, freerdp* instance) +void tf_process_channel_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; - event = freerdp_channels_pop_event(chanman); + event = freerdp_channels_pop_event(channels); if (event) { switch (event->event_type) { case RDP_EVENT_TYPE_CB_SYNC: - tf_process_cb_sync_event(chanman, instance); + tf_process_cb_sync_event(channels, instance); break; default: printf("tf_process_channel_event: unknown event type %d\n", event->event_type); @@ -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_channels_pre_connect(context->chanman, instance); + freerdp_channels_pre_connect(context->channels, 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_channels_post_connect(context->chanman, instance); + freerdp_channels_post_connect(context->channels, instance); return True; } @@ -214,13 +214,13 @@ int tfreerdp_run(freerdp* instance) fd_set rfds_set; fd_set wfds_set; tfContext* context; - rdpChannels* chanman; + rdpChannels* channels; memset(rfds, 0, sizeof(rfds)); memset(wfds, 0, sizeof(wfds)); context = (tfContext*) instance->context; - chanman = context->chanman; + channels = context->channels; freerdp_connect(instance); @@ -234,7 +234,7 @@ int tfreerdp_run(freerdp* instance) printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_channels_get_fds(chanman, instance, rfds, &rcount, wfds, &wcount) != True) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != True) { printf("Failed to get channel manager file descriptor\n"); break; @@ -274,16 +274,16 @@ int tfreerdp_run(freerdp* instance) printf("Failed to check FreeRDP file descriptor\n"); break; } - if (freerdp_channels_check_fds(chanman, instance) != True) + if (freerdp_channels_check_fds(channels, instance) != True) { printf("Failed to check channel manager file descriptor\n"); break; } - tf_process_channel_event(chanman, instance); + tf_process_channel_event(channels, instance); } - freerdp_channels_close(chanman, instance); - freerdp_channels_free(chanman); + freerdp_channels_close(channels, instance); + freerdp_channels_free(channels); freerdp_free(instance); return 0; @@ -314,7 +314,7 @@ int main(int argc, char* argv[]) freerdp* instance; tfContext* context; struct thread_data* data; - rdpChannels* chanman; + rdpChannels* channels; freerdp_channels_global_init(); @@ -331,9 +331,9 @@ int main(int argc, char* argv[]) freerdp_context_new(instance); context = (tfContext*) instance->context; - chanman = context->chanman; + channels = context->channels; - freerdp_parse_args(instance->settings, argc, argv, tf_process_plugin_args, chanman, NULL, NULL); + freerdp_parse_args(instance->settings, argc, argv, tf_process_plugin_args, channels, NULL, NULL); data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); data->instance = instance; diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index c002cf52a..f0cbf51fb 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -56,6 +56,9 @@ struct rdp_context { freerdp* instance; + int argc; + char** argv; + rdpRdp* rdp; rdpGdi* gdi; rdpRail* rail;