/* returns error */ static int APP_CC process_message_channel_setup(struct stream *s) { int num_chans; int index; int rv; struct chan_item *ci; g_num_chan_items = 0; g_cliprdr_index = -1; g_rdpsnd_index = -1; g_rdpdr_index = -1; g_rail_index = -1; g_cliprdr_chan_id = -1; g_rdpsnd_chan_id = -1; g_rdpdr_chan_id = -1; g_rail_chan_id = -1; g_drdynvc_chan_id = -1; LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:")); in_uint16_le(s, num_chans); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d", num_chans)); for (index = 0; index < num_chans; index++) { ci = &(g_chan_items[g_num_chan_items]); g_memset(ci->name, 0, sizeof(ci->name)); in_uint8a(s, ci->name, 8); in_uint16_le(s, ci->id); in_uint16_le(s, ci->flags); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags)); g_writeln("process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags); if (g_strcasecmp(ci->name, "cliprdr") == 0) { g_cliprdr_index = g_num_chan_items; g_cliprdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpsnd") == 0) { g_rdpsnd_index = g_num_chan_items; g_rdpsnd_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpdr") == 0) { g_rdpdr_index = g_num_chan_items; g_rdpdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rail") == 0) { g_rail_index = g_num_chan_items; g_rail_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "drdynvc") == 0) { g_drdynvc_index = g_num_chan_items; // LK_TODO use this g_drdynvc_chan_id = ci->id; // LK_TODO use this } else { LOG(10, ("other %s", ci->name)); } g_num_chan_items++; } rv = send_channel_setup_response_message(); if (g_cliprdr_index >= 0) { clipboard_init(); fuse_init(); } if (g_rdpsnd_index >= 0) { sound_init(); } if (g_rdpdr_index >= 0) { dev_redir_init(); } if (g_rail_index >= 0) { rail_init(); } if (g_drdynvc_index >= 0) { g_memset(&g_dvc_channels[0], 0, sizeof(g_dvc_channels)); drdynvc_init(); } return rv; }
/* returns error */ static int APP_CC process_message_channel_setup(struct stream *s) { int num_chans; int index; int rv; struct chan_item *ci; struct chan_out_data *cod; struct chan_out_data *old_cod; g_num_chan_items = 0; g_cliprdr_index = -1; g_rdpsnd_index = -1; g_rdpdr_index = -1; g_rail_index = -1; g_cliprdr_chan_id = -1; g_rdpsnd_chan_id = -1; g_rdpdr_chan_id = -1; g_rail_chan_id = -1; g_drdynvc_chan_id = -1; LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:")); in_uint16_le(s, num_chans); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d", num_chans)); for (index = 0; index < num_chans; index++) { ci = &(g_chan_items[g_num_chan_items]); g_memset(ci->name, 0, sizeof(ci->name)); in_uint8a(s, ci->name, 8); in_uint16_le(s, ci->id); /* there might be leftover data from last session after reconnecting so free it */ if (ci->head != 0) { cod = ci->head; while (1) { free_stream(cod->s); old_cod = cod; cod = cod->next; g_free(old_cod); if (ci->tail == old_cod) { break; } } } ci->head = 0; ci->tail = 0; in_uint16_le(s, ci->flags); LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags)); g_writeln("process_message_channel_setup: chan name '%s' " "id %d flags %8.8x", ci->name, ci->id, ci->flags); if (g_strcasecmp(ci->name, "cliprdr") == 0) { g_cliprdr_index = g_num_chan_items; g_cliprdr_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpsnd") == 0) { g_rdpsnd_index = g_num_chan_items; g_rdpsnd_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "rdpdr") == 0) { g_rdpdr_index = g_num_chan_items; g_rdpdr_chan_id = ci->id; } /* disabled for now */ else if (g_strcasecmp(ci->name, "rail") == 0) { g_rail_index = g_num_chan_items; g_rail_chan_id = ci->id; } else if (g_strcasecmp(ci->name, "drdynvc") == 0) { g_drdynvc_index = g_num_chan_items; // LK_TODO use this g_drdynvc_chan_id = ci->id; // LK_TODO use this } else { LOG(10, ("other %s", ci->name)); } g_num_chan_items++; } rv = send_channel_setup_response_message(); if (g_cliprdr_index >= 0) { clipboard_init(); xfuse_init(); } if (g_rdpsnd_index >= 0) { sound_init(); } if (g_rdpdr_index >= 0) { dev_redir_init(); xfuse_init(); } if (g_rail_index >= 0) { rail_init(); } if (g_drdynvc_index >= 0) { g_memset(&g_dvc_channels[0], 0, sizeof(g_dvc_channels)); drdynvc_init(); } return rv; }