static void InitEventProcessConnected(void * pInitHandle, void * pData, uint32 dataLength) { rdpsndPlugin * plugin; uint32 error; pthread_t thread; plugin = (rdpsndPlugin *) chan_plugin_find_by_init_handle(pInitHandle); if (plugin == NULL) { LLOGLN(0, ("InitEventProcessConnected: error no match")); return; } error = plugin->ep.pVirtualChannelOpen(pInitHandle, &(plugin->open_handle), plugin->channel_def.name, OpenEvent); if (error != CHANNEL_RC_OK) { LLOGLN(0, ("InitEventProcessConnected: Open failed")); return; } chan_plugin_register_open_handle((rdpChanPlugin *) plugin, plugin->open_handle); pthread_create(&thread, 0, thread_func, plugin); pthread_detach(thread); }
//------------------------------------------------------------------------------ static void InitEventProcessConnected(void * pInitHandle, void * pData, uint32 dataLength) { railCorePlugin * plugin; uint32 error; pthread_t thread; LLOGLN(10, ("rail_core_plugin:InitEventProcessConnected:")); plugin = (railCorePlugin *) chan_plugin_find_by_init_handle(pInitHandle); if (plugin == NULL) { LLOGLN(0, ("rail_core_plugin:InitEventProcessConnected: error no match")); return; } error = plugin->ep.pVirtualChannelOpen(pInitHandle, &(plugin->open_handle), plugin->channel_def.name, OpenEvent); if (error != CHANNEL_RC_OK) { LLOGLN(0, ("rail_core_plugin:InitEventProcessConnected: Open failed")); return; } chan_plugin_register_open_handle((rdpChanPlugin *) plugin, plugin->open_handle); pthread_create(&thread, 0, received_data_processing_thread_func, plugin); pthread_detach(thread); // Notify RAIL lib about channel connection. rail_on_channel_connected(plugin->session); }
static void InitEventProcessTerminated(void * pInitHandle) { rdpsndPlugin * plugin; int index; struct data_in_item * in_item; struct data_out_item * out_item; plugin = (rdpsndPlugin *) chan_plugin_find_by_init_handle(pInitHandle); if (plugin == NULL) { LLOGLN(0, ("InitEventProcessConnected: error no match")); return; } wait_obj_set(plugin->term_event); index = 0; while ((plugin->thread_status > 0) && (index < 100)) { index++; usleep(250 * 1000); } wait_obj_free(plugin->term_event); wait_obj_free(plugin->data_in_event); pthread_mutex_destroy(plugin->in_mutex); free(plugin->in_mutex); /* free the un-processed in/out queue */ while (plugin->in_list_head != 0) { in_item = plugin->in_list_head; plugin->in_list_head = in_item->next; free(in_item->data); free(in_item); } while (plugin->out_list_head != 0) { out_item = plugin->out_list_head; plugin->out_list_head = out_item->next; free(out_item->data); free(out_item); } if (plugin->device_plugin) { plugin->device_plugin->free(plugin->device_plugin); free(plugin->device_plugin); plugin->device_plugin = NULL; } chan_plugin_uninit((rdpChanPlugin *) plugin); free(plugin); }
//------------------------------------------------------------------------------ static void InitEventProcessTerminated(void * pInitHandle) { railCorePlugin * plugin; int index; struct data_in_item * in_item; LLOGLN(10, ("rail_core_plugin:InitEventProcessTerminated: pInitHandle=0x%p", pInitHandle)); plugin = (railCorePlugin *) chan_plugin_find_by_init_handle(pInitHandle); if (plugin == NULL) { LLOGLN(0, ("rail_core_plugin:InitEventProcessTerminated: error no match")); return; } wait_obj_set(plugin->term_event); index = 0; while ((plugin->thread_status > 0) && (index < 100)) { index++; usleep(250 * 1000); } wait_obj_free(plugin->term_event); wait_obj_free(plugin->data_in_event); pthread_mutex_destroy(plugin->in_mutex); free(plugin->in_mutex); /* free the un-processed in/out queue */ while (plugin->in_list_head != NULL) { in_item = plugin->in_list_head; plugin->in_list_head = in_item->next; free(in_item->data); free(in_item); } if (plugin->data_in != NULL) { free(plugin->data_in); } chan_plugin_uninit((rdpChanPlugin *) plugin); rail_on_channel_terminated(plugin->session); free(plugin); }
//------------------------------------------------------------------------------ static void InitEventInitialized(void * pInitHandle) { railCorePlugin * plugin; LLOGLN(10, ("rail_core_plugin:InitEventInitialized: pInitHandle=0x%p", pInitHandle)); plugin = (railCorePlugin *) chan_plugin_find_by_init_handle(pInitHandle); if (plugin == NULL) { LLOGLN(0, ("rail_core_plugin:InitEventInitialized: error no match")); return; } LLOGLN(10, ("rail_core_plugin:InitEventInitialized: session=0x%p", plugin->session)); }