libfreerdp-chanman: align with new interface

This commit is contained in:
Marc-André Moreau 2011-07-28 01:04:01 -04:00
parent 72fc75b5a6
commit 0f9e9a0d15
8 changed files with 82 additions and 181 deletions

View File

@ -85,7 +85,7 @@ add_subdirectory(include)
add_subdirectory(libfreerdp-utils)
add_subdirectory(libfreerdp-kbd)
add_subdirectory(libfreerdp-gdi)
# add_subdirectory(libfreerdp-chanman)
add_subdirectory(libfreerdp-chanman)
add_subdirectory(libfreerdp-core)
add_subdirectory(channels)

View File

@ -48,12 +48,12 @@ add_executable(test_freerdp
test_utils.h
test_transport.c
test_transport.h
#test_chanman.c
#test_chanman.h
#test_cliprdr.c
#test_cliprdr.h
#test_drdynvc.c
#test_drdynvc.h
test_chanman.c
test_chanman.h
test_cliprdr.c
test_cliprdr.h
test_drdynvc.c
test_drdynvc.h
test_freerdp.c
test_freerdp.h)
@ -62,6 +62,6 @@ 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-chanman)
add_test(CUnitTests ${EXECUTABLE_OUTPUT_PATH}/test_freerdp)

View File

@ -48,7 +48,7 @@ int add_chanman_suite(void)
return 0;
}
static int test_rdp_channel_data(rdpInst* inst, int chan_id, uint8* data, int data_size)
static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size)
{
printf("chan_id %d data_size %d\n", chan_id, data_size);
}
@ -57,34 +57,34 @@ void test_chanman(void)
{
rdpChanMan* chan_man;
rdpSettings settings = { 0 };
rdpInst inst = { 0 };
freerdp instance = { 0 };
FRDP_EVENT* event;
settings.hostname = "testhost";
inst.settings = &settings;
inst.rdp_channel_data = test_rdp_channel_data;
instance.settings = &settings;
instance.ChannelDataInput = test_rdp_channel_data;
chan_man = freerdp_chanman_new();
freerdp_chanman_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL);
freerdp_chanman_pre_connect(chan_man, &inst);
freerdp_chanman_post_connect(chan_man, &inst);
freerdp_chanman_pre_connect(chan_man, &instance);
freerdp_chanman_post_connect(chan_man, &instance);
freerdp_chanman_data(&inst, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8);
freerdp_chanman_data(&inst, 0, "testdata1", 9, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 9);
freerdp_chanman_data(&inst, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10);
freerdp_chanman_data(&inst, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11);
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);
event = freerdp_event_new(FRDP_EVENT_TYPE_DEBUG, NULL, NULL);
freerdp_chanman_send_event(chan_man, "rdpdbg", event);
while ((event = freerdp_chanman_pop_event(chan_man)) == NULL)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
printf("responded event_type %d\n", event->event_type);
freerdp_event_free(event);
freerdp_chanman_close(chan_man, &inst);
freerdp_chanman_close(chan_man, &instance);
freerdp_chanman_free(chan_man);
}

View File

@ -86,7 +86,7 @@ static const uint8 test_data_response_data[] =
"\x6F\x00\x20\x00\x77\x00\x6F\x00\x72\x00\x6c\x00\x64\x00\x00\x00"
};
static int test_rdp_channel_data(rdpInst* inst, int chan_id, uint8* data, int data_size)
static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size)
{
printf("chan_id %d data_size %d\n", chan_id, data_size);
freerdp_hexdump(data, data_size);
@ -102,36 +102,36 @@ static void event_process_callback(FRDP_EVENT* event)
void test_cliprdr(void)
{
int i;
rdpChanMan* chan_man;
rdpSettings settings = { 0 };
rdpInst inst = { 0 };
freerdp instance = { 0 };
FRDP_EVENT* event;
FRDP_CB_FORMAT_LIST_EVENT* format_list_event;
FRDP_CB_DATA_REQUEST_EVENT* data_request_event;
FRDP_CB_DATA_RESPONSE_EVENT* data_response_event;
int i;
settings.hostname = "testhost";
inst.settings = &settings;
inst.rdp_channel_data = test_rdp_channel_data;
instance.settings = &settings;
instance.ChannelDataInput = test_rdp_channel_data;
chan_man = freerdp_chanman_new();
freerdp_chanman_load_plugin(chan_man, &settings, "../channels/cliprdr/cliprdr.so", NULL);
freerdp_chanman_pre_connect(chan_man, &inst);
freerdp_chanman_post_connect(chan_man, &inst);
freerdp_chanman_pre_connect(chan_man, &instance);
freerdp_chanman_post_connect(chan_man, &instance);
/* server sends cliprdr capabilities and monitor ready PDU */
freerdp_chanman_data(&inst, 0, (char*)test_clip_caps_data, sizeof(test_clip_caps_data) - 1,
freerdp_chanman_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(&inst, 0, (char*)test_monitor_ready_data, sizeof(test_monitor_ready_data) - 1,
freerdp_chanman_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)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
printf("Got event %d\n", event->event_type);
CU_ASSERT(event->event_type == FRDP_EVENT_TYPE_CB_SYNC);
@ -150,21 +150,21 @@ void test_cliprdr(void)
/* cliprdr sends format list PDU to server */
while (!event_processed)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
/* server sends format list response PDU to cliprdr */
freerdp_chanman_data(&inst, 0, (char*)test_format_list_response_data, sizeof(test_format_list_response_data) - 1,
freerdp_chanman_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(&inst, 0, (char*)test_format_list_data, sizeof(test_format_list_data) - 1,
freerdp_chanman_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)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
printf("Got event %d\n", event->event_type);
CU_ASSERT(event->event_type == FRDP_EVENT_TYPE_CB_FORMAT_LIST);
@ -177,13 +177,13 @@ void test_cliprdr(void)
freerdp_event_free(event);
/* server sends data request PDU to cliprdr */
freerdp_chanman_data(&inst, 0, (char*)test_data_request_data, sizeof(test_data_request_data) - 1,
freerdp_chanman_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)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
printf("Got event %d\n", event->event_type);
CU_ASSERT(event->event_type == FRDP_EVENT_TYPE_CB_DATA_REQUEST);
@ -206,7 +206,7 @@ void test_cliprdr(void)
/* cliprdr sends data response PDU to server */
while (!event_processed)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
/* UI sends data request event to cliprdr */
@ -219,17 +219,17 @@ void test_cliprdr(void)
/* cliprdr sends data request PDU to server */
while (!event_processed)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
/* server sends data response PDU to cliprdr */
freerdp_chanman_data(&inst, 0, (char*)test_data_response_data, sizeof(test_data_response_data) - 1,
freerdp_chanman_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)
{
freerdp_chanman_check_fds(chan_man, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
printf("Got event %d\n", event->event_type);
CU_ASSERT(event->event_type == FRDP_EVENT_TYPE_CB_DATA_RESPONSE);
@ -241,6 +241,6 @@ void test_cliprdr(void)
}
freerdp_event_free(event);
freerdp_chanman_close(chan_man, &inst);
freerdp_chanman_close(chan_man, &instance);
freerdp_chanman_free(chan_man);
}

View File

@ -57,7 +57,7 @@ static const uint8 test_capability_request_data[] =
static int data_received = 0;
static int test_rdp_channel_data(rdpInst* inst, int chan_id, uint8* data, int data_size)
static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size)
{
printf("chan_id %d data_size %d\n", chan_id, data_size);
freerdp_hexdump(data, data_size);
@ -68,29 +68,29 @@ void test_drdynvc(void)
{
rdpChanMan* chan_man;
rdpSettings settings = { 0 };
rdpInst inst = { 0 };
freerdp instance = { 0 };
settings.hostname = "testhost";
inst.settings = &settings;
inst.rdp_channel_data = test_rdp_channel_data;
instance.settings = &settings;
instance.ChannelDataInput = test_rdp_channel_data;
chan_man = freerdp_chanman_new();
freerdp_chanman_load_plugin(chan_man, &settings, "../channels/drdynvc/drdynvc.so", NULL);
freerdp_chanman_pre_connect(chan_man, &inst);
freerdp_chanman_post_connect(chan_man, &inst);
freerdp_chanman_pre_connect(chan_man, &instance);
freerdp_chanman_post_connect(chan_man, &instance);
/* server sends capability request PDU */
freerdp_chanman_data(&inst, 0, (char*)test_capability_request_data, sizeof(test_capability_request_data) - 1,
freerdp_chanman_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, &inst);
freerdp_chanman_check_fds(chan_man, &instance);
}
freerdp_chanman_close(chan_man, &inst);
freerdp_chanman_close(chan_man, &instance);
freerdp_chanman_free(chan_man);
}

View File

@ -36,16 +36,16 @@ 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, rdpInst* inst);
FREERDP_API int freerdp_chanman_post_connect(rdpChanMan* chan_man, rdpInst* inst);
FREERDP_API int freerdp_chanman_data(rdpInst* inst, int chan_id, char* data, int data_size,
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, char* data, int data_size,
int flags, int total_size);
FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, const char* name, FRDP_EVENT* event);
FREERDP_API int freerdp_chanman_get_fds(rdpChanMan* chan_man, rdpInst* inst, void** read_fds,
FREERDP_API int freerdp_chanman_get_fds(rdpChanMan* chan_man, freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);
FREERDP_API int freerdp_chanman_check_fds(rdpChanMan* chan_man, rdpInst* inst);
FREERDP_API int freerdp_chanman_check_fds(rdpChanMan* chan_man, freerdp* instance);
FREERDP_API FRDP_EVENT* freerdp_chanman_pop_event(rdpChanMan* chan_man);
FREERDP_API void freerdp_chanman_close(rdpChanMan* chan_man, rdpInst* inst);
FREERDP_API void freerdp_chanman_close(rdpChanMan* chan_man, freerdp* instance);
#ifdef __cplusplus
}

View File

@ -32,124 +32,25 @@
extern "C" {
#endif
/* New Interface */
FREERDP_API boolean freerdp_global_init();
FREERDP_API void freerdp_global_finish();
typedef struct
typedef struct rdp_freerdp freerdp;
typedef int (*pcChannelDataInput)(freerdp* freerdp, int channelId, uint8* data, int size);
struct rdp_freerdp
{
void* rdp;
rdpInput* input;
rdpUpdate* update;
rdpSettings* settings;
} freerdp;
pcChannelDataInput ChannelDataInput;
};
FREERDP_API freerdp* freerdp_new();
FREERDP_API void freerdp_free(freerdp* instance);
#if 0
/* Old Interface */
FREERDP_API boolean
freerdp_global_init(void);
FREERDP_API void
freerdp_global_finish(void);
struct rdp_inst
{
int version;
int size;
rdpSettings* settings;
void* rdp;
void* param1;
void* param2;
void* param3;
void* param4;
uint32 disc_reason;
/* calls from ui to library */
int (* rdp_connect)(rdpInst * inst);
int (* rdp_get_fds)(rdpInst * inst, void ** read_fds, int * read_count,
void ** write_fds, int * write_count);
int (* rdp_check_fds)(rdpInst * inst);
int (* rdp_send_input_scancode)(rdpInst * inst, boolean up, boolean extended, uint8 keyCode);
int (* rdp_send_input_unicode)(rdpInst * inst, uint16 character);
int (* rdp_send_input_mouse)(rdpInst * inst, uint16 pointerFlags, uint16 xPos, uint16 yPos);
int (* rdp_sync_input)(rdpInst * inst, int toggle_flags);
int (* rdp_channel_data)(rdpInst * inst, int chan_id, uint8 * data, int data_size);
void (* rdp_suppress_output)(rdpInst * inst, int allow_display_updates);
void (* rdp_disconnect)(rdpInst * inst);
int (* rdp_send_frame_ack)(rdpInst * inst, int frame_id);
/* calls from library to ui */
void (* ui_error)(rdpInst * inst, const char * text);
void (* ui_warning)(rdpInst * inst, const char * text);
void (* ui_unimpl)(rdpInst * inst, const char * text);
void (* ui_begin_update)(rdpInst * inst);
void (* ui_end_update)(rdpInst * inst);
void (* ui_desktop_save)(rdpInst * inst, int offset, int x, int y,
int cx, int cy);
void (* ui_desktop_restore)(rdpInst * inst, int offset, int x, int y,
int cx, int cy);
FRDP_HBITMAP (* ui_create_bitmap)(rdpInst * inst, int width, int height, uint8 * data);
void (* ui_paint_bitmap)(rdpInst * inst, int x, int y, int cx, int cy, int width,
int height, uint8 * data);
void (* ui_destroy_bitmap)(rdpInst * inst, FRDP_HBITMAP bmp);
void (* ui_line)(rdpInst * inst, uint8 opcode, int startx, int starty, int endx,
int endy, FRDP_PEN * pen);
void (* ui_rect)(rdpInst * inst, int x, int y, int cx, int cy, uint32 color);
void (* ui_polygon)(rdpInst * inst, uint8 opcode, uint8 fillmode, FRDP_POINT * point,
int npoints, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
void (* ui_polyline)(rdpInst * inst, uint8 opcode, FRDP_POINT * points, int npoints,
FRDP_PEN * pen);
void (* ui_ellipse)(rdpInst * inst, uint8 opcode, uint8 fillmode, int x, int y,
int cx, int cy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
void (* ui_start_draw_glyphs)(rdpInst * inst, uint32 bgcolor, uint32 fgcolor);
void (* ui_draw_glyph)(rdpInst * inst, int x, int y, int cx, int cy,
FRDP_HGLYPH glyph);
void (* ui_end_draw_glyphs)(rdpInst * inst, int x, int y, int cx, int cy);
uint32 (* ui_get_toggle_keys_state)(rdpInst * inst);
void (* ui_bell)(rdpInst * inst);
void (* ui_destblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy);
void (* ui_patblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
void (* ui_screenblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
int srcx, int srcy);
void (* ui_memblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
FRDP_HBITMAP src, int srcx, int srcy);
void (* ui_triblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
FRDP_HBITMAP src, int srcx, int srcy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
FRDP_HGLYPH (* ui_create_glyph)(rdpInst * inst, int width, int height, uint8 * data);
void (* ui_destroy_glyph)(rdpInst * inst, FRDP_HGLYPH glyph);
int (* ui_select)(rdpInst * inst, int rdp_socket);
void (* ui_set_clip)(rdpInst * inst, int x, int y, int cx, int cy);
void (* ui_reset_clip)(rdpInst * inst);
void (* ui_resize_window)(rdpInst * inst);
void (* ui_set_cursor)(rdpInst * inst, FRDP_HCURSOR cursor);
void (* ui_destroy_cursor)(rdpInst * inst, FRDP_HCURSOR cursor);
FRDP_HCURSOR (* ui_create_cursor)(rdpInst * inst, unsigned int x, unsigned int y,
int width, int height, uint8 * andmask, uint8 * xormask, int bpp);
void (* ui_set_null_cursor)(rdpInst * inst);
void (* ui_set_default_cursor)(rdpInst * inst);
FRDP_HPALETTE (* ui_create_palette)(rdpInst * inst, FRDP_PALETTE * palette);
void (* ui_set_palette)(rdpInst * inst, FRDP_HPALETTE palette);
void (* ui_move_pointer)(rdpInst * inst, int x, int y);
FRDP_HBITMAP (* ui_create_surface)(rdpInst * inst, int width, int height, FRDP_HBITMAP old);
void (* ui_set_surface)(rdpInst * inst, FRDP_HBITMAP surface);
void (* ui_destroy_surface)(rdpInst * inst, FRDP_HBITMAP surface);
void (* ui_channel_data)(rdpInst * inst, int chan_id, char * data, int data_size,
int flags, int total_size);
boolean (* ui_authenticate)(rdpInst * inst);
int (* ui_decode)(rdpInst * inst, uint8 * data, int data_size);
boolean (* ui_check_certificate)(rdpInst * inst, const char * fingerprint,
const char * subject, const char * issuer, boolean verified);
};
FREERDP_API rdpInst *
freerdp_new(rdpSettings * settings);
FREERDP_API void
freerdp_free(rdpInst * inst);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -98,7 +98,7 @@ struct rdp_chan_man
int is_connected;
/* used for locating the chan_man for a given instance */
rdpInst* inst;
freerdp* instance;
/* signal for incoming data or event */
struct wait_obj* signal;
@ -164,7 +164,7 @@ 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(rdpInst* inst)
static rdpChanMan* freerdp_chanman_find_by_rdp_inst(freerdp* instance)
{
rdpChanManList* list;
rdpChanMan* chan_man;
@ -173,7 +173,7 @@ static rdpChanMan* freerdp_chanman_find_by_rdp_inst(rdpInst* inst)
for (list = g_chan_man_list; list; list = list->next)
{
chan_man = list->chan_man;
if (chan_man->inst == inst)
if (chan_man->instance == instance)
{
freerdp_mutex_unlock(g_mutex_list);
return chan_man;
@ -647,7 +647,7 @@ 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, rdpInst* inst)
int freerdp_chanman_pre_connect(rdpChanMan* chan_man, freerdp* instance)
{
int index;
struct lib_data* llib;
@ -655,7 +655,7 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, rdpInst* inst)
void* dummy;
DEBUG_CHANMAN("enter");
chan_man->inst = inst;
chan_man->instance = instance;
/**
* If rdpsnd is registered but not rdpdr, it's necessary to register a fake
@ -669,7 +669,7 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, rdpInst* inst)
CHANNEL_OPTION_ENCRYPT_RDP;
strcpy(lchannel_def.name, "rdpdr");
chan_man->can_call_init = 1;
chan_man->settings = inst->settings;
chan_man->settings = instance->settings;
freerdp_mutex_lock(g_mutex_init);
g_init_chan_man = chan_man;
MyVirtualChannelInit(&dummy, &lchannel_def, 1,
@ -698,7 +698,7 @@ int freerdp_chanman_pre_connect(rdpChanMan* chan_man, rdpInst* inst)
* this will tell the libraries that its ok to call MyVirtualChannelOpen
* called only from main thread
*/
int freerdp_chanman_post_connect(rdpChanMan* chan_man, rdpInst* inst)
int freerdp_chanman_post_connect(rdpChanMan* chan_man, freerdp* instance)
{
int index;
struct lib_data* llib;
@ -706,7 +706,7 @@ int freerdp_chanman_post_connect(rdpChanMan* chan_man, rdpInst* inst)
int hostname_len;
chan_man->is_connected = 1;
hostname = inst->settings->hostname;
hostname = instance->settings->hostname;
hostname_len = strlen(hostname);
DEBUG_CHANMAN("hostname [%s] chan_man->num_libs [%d]",
hostname, chan_man->num_libs);
@ -726,7 +726,7 @@ int freerdp_chanman_post_connect(rdpChanMan* chan_man, rdpInst* inst)
* data comming from the server to the client
* called only from main thread
*/
int freerdp_chanman_data(rdpInst* inst, int chan_id, char* data, int data_size,
int freerdp_chanman_data(freerdp* instance, int chan_id, char* data, int data_size,
int flags, int total_size)
{
rdpChanMan* chan_man;
@ -734,14 +734,14 @@ int freerdp_chanman_data(rdpInst* inst, int chan_id, char* data, int data_size,
struct chan_data* lchan_data;
int index;
chan_man = freerdp_chanman_find_by_rdp_inst(inst);
chan_man = freerdp_chanman_find_by_rdp_inst(instance);
if (chan_man == 0)
{
DEBUG_CHANMAN("could not find channel manager");
return 1;
}
lrdp_chan = freerdp_chanman_find_rdp_chan_by_id(chan_man, inst->settings,
lrdp_chan = freerdp_chanman_find_rdp_chan_by_id(chan_man, instance->settings,
chan_id, &index);
if (lrdp_chan == 0)
{
@ -794,7 +794,7 @@ FREERDP_API int freerdp_chanman_send_event(rdpChanMan* chan_man, const char* nam
/**
* called only from main thread
*/
static void freerdp_chanman_process_sync(rdpChanMan* chan_man, rdpInst* inst)
static void freerdp_chanman_process_sync(rdpChanMan* chan_man, freerdp* instance)
{
void* ldata;
uint32 ldata_len;
@ -816,11 +816,11 @@ static void freerdp_chanman_process_sync(rdpChanMan* chan_man, rdpInst* inst)
chan_man->sync_index = 0;
freerdp_sem_signal(chan_man->sync_data_sem); /* release chan_man->sync* vars */
lchan_data = chan_man->chans + lindex;
lrdp_chan = freerdp_chanman_find_rdp_chan_by_name(chan_man, inst->settings,
lrdp_chan = freerdp_chanman_find_rdp_chan_by_name(chan_man, instance->settings,
lchan_data->name, &lindex);
if (lrdp_chan != 0)
{
inst->rdp_channel_data(inst, lrdp_chan->chan_id, ldata, ldata_len);
instance->ChannelDataInput(instance, lrdp_chan->chan_id, ldata, ldata_len);
}
if (lchan_data->open_event_proc != 0)
{
@ -833,7 +833,7 @@ static void freerdp_chanman_process_sync(rdpChanMan* chan_man, rdpInst* inst)
/**
* called only from main thread
*/
int freerdp_chanman_get_fds(rdpChanMan* chan_man, rdpInst* inst, void** read_fds,
int freerdp_chanman_get_fds(rdpChanMan* 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);
@ -843,12 +843,12 @@ int freerdp_chanman_get_fds(rdpChanMan* chan_man, rdpInst* inst, void** read_fds
/**
* called only from main thread
*/
int freerdp_chanman_check_fds(rdpChanMan * chan_man, rdpInst * inst)
int freerdp_chanman_check_fds(rdpChanMan * chan_man, freerdp* instance)
{
if (wait_obj_is_set(chan_man->signal))
{
wait_obj_clear(chan_man->signal);
freerdp_chanman_process_sync(chan_man, inst);
freerdp_chanman_process_sync(chan_man, instance);
}
return 0;
}
@ -865,14 +865,14 @@ FRDP_EVENT* freerdp_chanman_pop_event(rdpChanMan* chan_man)
return event;
}
void freerdp_chanman_close(rdpChanMan* chan_man, rdpInst* inst)
void freerdp_chanman_close(rdpChanMan* chan_man, freerdp* instance)
{
int index;
struct lib_data* llib;
DEBUG_CHANMAN("closing");
chan_man->is_connected = 0;
freerdp_chanman_check_fds(chan_man, inst);
freerdp_chanman_check_fds(chan_man, instance);
/* tell all libraries we are shutting down */
for (index = 0; index < chan_man->num_libs; index++)
{