dfreerdp: integrate the channel manager.

This commit is contained in:
Vic Lee 2011-08-02 16:04:30 +08:00
parent 05e6d857af
commit b577605dbc
3 changed files with 34 additions and 2 deletions

View File

@ -31,5 +31,6 @@ 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-utils)
target_link_libraries(dfreerdp ${DIRECTFB_LIBRARIES})

View File

@ -96,6 +96,8 @@ boolean df_pre_connect(freerdp* instance)
dfi = (dfInfo*) xzalloc(sizeof(dfInfo));
SET_DFI(instance, dfi);
freerdp_chanman_pre_connect(GET_CHANMAN(instance), instance);
return True;
}
@ -146,9 +148,22 @@ boolean df_post_connect(freerdp* instance)
df_keyboard_init();
freerdp_chanman_post_connect(GET_CHANMAN(instance), instance);
return True;
}
static int df_process_plugin_args(rdpSettings* settings, const char* name,
FRDP_PLUGIN_DATA* plugin_data, void* user_data)
{
rdpChanMan* chanman = (rdpChanMan*) user_data;
printf("Load plugin %s\n", name);
freerdp_chanman_load_plugin(chanman, settings, name, plugin_data);
return 1;
}
int dfreerdp_run(freerdp* instance)
{
int i;
@ -160,6 +175,7 @@ int dfreerdp_run(freerdp* instance)
void* wfds[32];
fd_set rfds_set;
fd_set wfds_set;
rdpChanMan* chanman;
memset(rfds, 0, sizeof(rfds));
memset(wfds, 0, sizeof(wfds));
@ -225,6 +241,9 @@ int dfreerdp_run(freerdp* instance)
}
}
chanman = GET_CHANMAN(instance);
freerdp_chanman_close(chanman, instance);
freerdp_chanman_free(chanman);
freerdp_free(instance);
return 0;
@ -254,6 +273,9 @@ int main(int argc, char* argv[])
pthread_t thread;
freerdp* instance;
struct thread_data* data;
rdpChanMan* chanman;
freerdp_chanman_global_init();
g_sem = freerdp_sem_new(1);
@ -261,8 +283,11 @@ int main(int argc, char* argv[])
instance->PreConnect = df_pre_connect;
instance->PostConnect = df_post_connect;
chanman = freerdp_chanman_new();
SET_CHANMAN(instance, chanman);
DirectFBInit(&argc, &argv);
freerdp_parse_args(instance->settings, argc, argv, NULL, NULL, NULL, NULL);
freerdp_parse_args(instance->settings, argc, argv, df_process_plugin_args, chanman, NULL, NULL);
data = (struct thread_data*) xzalloc(sizeof(struct thread_data));
data->instance = instance;
@ -275,5 +300,7 @@ int main(int argc, char* argv[])
freerdp_sem_wait(g_sem);
}
freerdp_chanman_global_uninit();
return 0;
}

View File

@ -26,9 +26,13 @@
#include <string.h>
#include <directfb.h>
#include <freerdp/freerdp.h>
#include <freerdp/chanman.h>
#define SET_DFI(_instance, _dfi) (_instance)->param1 = _dfi
#define GET_DFI(_instance) ((dfInfo *) ((_instance)->param1))
#define GET_DFI(_instance) ((dfInfo*) ((_instance)->param1))
#define SET_CHANMAN(_instance, _chanman) (_instance)->param2 = _chanman
#define GET_CHANMAN(_instance) ((rdpChanMan*) ((_instance)->param2))
struct df_info
{