void emd_chr_exit(int md_id) { unregister_chrdev_region(MKDEV(EMD_CHR_DEV_MAJOR,0),EMD_CHR_CLIENT_NUM); cdev_del(emd_chr_dev); client_deinit(&drv_client[0]); client_deinit(&drv_client[1]); }
static int client_output_flush(struct ostream *output) { if (o_stream_flush(output) == 0) { /* more to come */ return 0; } /* finished / disconnected */ client_deinit(output); return -1; }
static void client_handle(int fd) { struct ostream *output; output = o_stream_create_fd(fd, (size_t)-1, TRUE); o_stream_send(output, ssl_params->data, ssl_params->used); if (o_stream_get_buffer_used_size(output) == 0) client_deinit(output); else { o_stream_set_flush_callback(output, client_output_flush, output); } }
int main (int argc, char *argv[]) { ChannelCallbacks callbacks; g_type_init (); gui_init (&argc, &argv); client_init (); callbacks.input = input_cb; callbacks.disconnect = disconnect_cb; callbacks.error = error_cb; callbacks.user_data = NULL; chn_set_callbacks (&callbacks); if (g_strcmp0 (getenv ("ntx_channel"), "echo") == 0) chn_echo_init (); else if (g_strcmp0 (getenv ("ntx_channel"), "pty") == 0) chn_pty_init (argc > 1 ? argv[1] : "/bin/sh"); else chn_telnet_init (argc > 1 ? argv[1] : "localhost", argc > 2 ? atoi (argv[2]) : 23); chn_connect (); gtk_main (); chn_disconnect (); chn_finalize (); client_deinit (); return 0; }