added device redir start files

ulab-original
jsorg71 16 years ago
parent c6b9952fa2
commit e1eb8bfcbc

@ -7,7 +7,8 @@ sbin_PROGRAMS = \
xrdp_chansrv_SOURCES = \
chansrv.c \
sound.c \
clipboard.c
clipboard.c \
devredir.c
xrdp_chansrv_LDADD = \
$(top_srcdir)/common/libcommon.la

@ -24,19 +24,23 @@
#include "chansrv.h"
#include "defines.h"
#include "sound.h"
#include "clipboard.h"
#include "devredir.h"
static tbus g_thread_done_event = 0;
static struct trans* g_lis_trans = 0;
static struct trans* g_con_trans = 0;
static struct chan_item g_chan_items[32];
static int g_num_chan_items = 0;
static int g_clip_index = -1;
static int g_sound_index = -1;
static int g_cliprdr_index = -1;
static int g_rdpsnd_index = -1;
static int g_rdpdr_index = -1;
tbus g_term_event = 0;
int g_display = 0;
int g_clip_chan_id = -1;
int g_sound_chan_id = -1;
int g_cliprdr_chan_id = -1; /* cliprdr */
int g_rdpsnd_chan_id = -1; /* rdpsnd */
int g_rdpdr_chan_id = -1; /* rdpdr */
/*****************************************************************************/
/* returns error */
@ -185,25 +189,34 @@ process_message_channel_setup(struct stream* s)
ci->name, ci->id, ci->flags);
if (g_strcasecmp(ci->name, "cliprdr") == 0)
{
g_clip_index = g_num_chan_items;
g_clip_chan_id = ci->id;
g_cliprdr_index = g_num_chan_items;
g_cliprdr_chan_id = ci->id;
}
else if (g_strcasecmp(ci->name, "rdpsnd") == 0)
{
g_sound_index = g_num_chan_items;
g_sound_chan_id = ci->id;
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;
}
g_num_chan_items++;
}
rv = send_channel_setup_response_message();
if (g_clip_index >= 0)
if (g_cliprdr_index >= 0)
{
clipboard_init();
}
if (g_sound_index >= 0)
if (g_rdpsnd_index >= 0)
{
sound_init();
}
if (g_rdpdr_index >= 0)
{
dev_redir_init();
}
return rv;
}
@ -227,14 +240,18 @@ process_message_channel_data(struct stream* s)
rv = send_channel_data_response_message();
if (rv == 0)
{
if (chan_id == g_clip_chan_id)
if (chan_id == g_cliprdr_chan_id)
{
rv = clipboard_data_in(s, chan_id, chan_flags, length, total_length);
}
else if (chan_id == g_sound_chan_id)
else if (chan_id == g_rdpsnd_chan_id)
{
rv = sound_data_in(s, chan_id, chan_flags, length, total_length);
}
else if (chan_id == g_rdpdr_chan_id)
{
rv = dev_redir_data_in(s, chan_id, chan_flags, length, total_length);
}
}
return rv;
}
@ -365,18 +382,16 @@ my_trans_conn_in(struct trans* trans, struct trans* new_trans)
}
/*****************************************************************************/
THREAD_RV THREAD_CC
channel_thread_loop(void* in_val)
static int APP_CC
setup_listen(void)
{
tbus objs[32];
int num_objs;
int timeout;
int error;
char text[256];
THREAD_RV rv;
int error;
g_writeln("xrdp-chansrv: thread start");
rv = 0;
if (g_lis_trans != 0)
{
trans_delete(g_lis_trans);
}
g_lis_trans = trans_create(1, 8192, 8192);
g_lis_trans->trans_conn_in = my_trans_conn_in;
g_snprintf(text, 255, "%d", 7200 + g_display);
@ -384,7 +399,24 @@ channel_thread_loop(void* in_val)
if (error != 0)
{
g_writeln("xrdp-chansrv: trans_listen failed");
return 1;
}
return 0;
}
/*****************************************************************************/
THREAD_RV THREAD_CC
channel_thread_loop(void* in_val)
{
tbus objs[32];
int num_objs;
int timeout;
int error;
THREAD_RV rv;
g_writeln("xrdp-chansrv: thread start");
rv = 0;
error = setup_listen();
if (error == 0)
{
timeout = 0;
@ -415,19 +447,16 @@ channel_thread_loop(void* in_val)
trans_delete(g_con_trans);
g_con_trans = 0;
/* create new listener */
g_lis_trans = trans_create(1, 8192, 8192);
g_lis_trans->trans_conn_in = my_trans_conn_in;
g_snprintf(text, 255, "%d", 7200 + g_display);
error = trans_listen(g_lis_trans, text);
error = setup_listen();
if (error != 0)
{
g_writeln("xrdp-chansrv: trans_listen failed");
break;
}
}
}
clipboard_check_wait_objs();
sound_check_wait_objs();
dev_redir_check_wait_objs();
timeout = 0;
num_objs = 0;
objs[num_objs] = g_term_event;
@ -436,6 +465,7 @@ channel_thread_loop(void* in_val)
trans_get_wait_objs(g_con_trans, objs, &num_objs, &timeout);
clipboard_get_wait_objs(objs, &num_objs, &timeout);
sound_get_wait_objs(objs, &num_objs, &timeout);
dev_redir_get_wait_objs(objs, &num_objs, &timeout);
}
}
trans_delete(g_lis_trans);

@ -21,6 +21,8 @@
#include "parse.h"
#include "os_calls.h"
extern int g_cliprdr_chan_id; /* in chansrv.c */
/*****************************************************************************/
int APP_CC
clipboard_init(void)

@ -0,0 +1,53 @@
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
xrdp: A Remote Desktop Protocol server.
Copyright (C) Jay Sorg 2009
*/
#include "arch.h"
#include "parse.h"
#include "os_calls.h"
extern int g_rdpdr_chan_id; /* in chansrv.c */
/*****************************************************************************/
int APP_CC
dev_redir_init(void)
{
return 0;
}
/*****************************************************************************/
int APP_CC
dev_redir_data_in(struct stream* s, int chan_id, int chan_flags, int length,
int total_length)
{
return 0;
}
/*****************************************************************************/
int APP_CC
dev_redir_get_wait_objs(tbus* objs, int* count, int* timeout)
{
return 0;
}
/*****************************************************************************/
int APP_CC
dev_redir_check_wait_objs(void)
{
return 0;
}

@ -0,0 +1,18 @@
#if !defined(DEVREDIR_H)
#define DEVREDIR_H
#include "arch.h"
#include "parse.h"
int APP_CC
dev_redir_init(void);
int APP_CC
dev_redir_data_in(struct stream* s, int chan_id, int chan_flags, int length,
int total_length);
int APP_CC
dev_redir_get_wait_objs(tbus* objs, int* count, int* timeout);
int APP_CC
dev_redir_check_wait_objs(void);
#endif

@ -21,6 +21,8 @@
#include "parse.h"
#include "os_calls.h"
extern int g_rdpsnd_chan_id; /* in chansrv.c */
/*****************************************************************************/
int APP_CC
sound_init(void)

Loading…
Cancel
Save