more work on channel support
This commit is contained in:
parent
0dc679e2dc
commit
4b3b83044a
@ -1,7 +1,7 @@
|
||||
# libxrdp makefile
|
||||
LIBXRDPOBJ = libxrdp.o xrdp_tcp.o xrdp_iso.o xrdp_mcs.o \
|
||||
xrdp_sec.o xrdp_rdp.o xrdp_orders.o \
|
||||
xrdp_bitmap_compress.o \
|
||||
xrdp_bitmap_compress.o xrdp_channel.o \
|
||||
os_calls.o ssl_calls.o file.o
|
||||
|
||||
DESTDIR = /usr/local/xrdp
|
||||
|
@ -600,3 +600,105 @@ libxrdp_orders_send_bitmap2(struct xrdp_session* session,
|
||||
width, height, bpp, data,
|
||||
cache_id, cache_idx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
/* this function gets the channel name and its flags, index is zero
|
||||
based. either channel_name or channel_flags can be passed in nil if
|
||||
they are not needed */
|
||||
int EXPORT_CC
|
||||
libxrdp_query_channel(struct xrdp_session* session, int index,
|
||||
char* channel_name, int* channel_flags)
|
||||
{
|
||||
int count;
|
||||
struct xrdp_rdp* rdp;
|
||||
struct xrdp_mcs* mcs;
|
||||
struct mcs_channel_item* channel_item;
|
||||
|
||||
rdp = (struct xrdp_rdp*)session->rdp;
|
||||
mcs = rdp->sec_layer->mcs_layer;
|
||||
count = mcs->channel_list->count;
|
||||
if (index < 0 || index >= count)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
channel_item = (struct mcs_channel_item*)
|
||||
list_get_item(mcs->channel_list, index);
|
||||
if (channel_item == 0)
|
||||
{
|
||||
/* this should not happen */
|
||||
return 1;
|
||||
}
|
||||
if (channel_name != 0)
|
||||
{
|
||||
g_strncpy(channel_name, channel_item->name, 8);
|
||||
}
|
||||
if (channel_flags != 0)
|
||||
{
|
||||
*channel_flags = channel_item->flags;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns a zero based index of the channel, -1 if error or it dosen't
|
||||
exist */
|
||||
int EXPORT_CC
|
||||
libxrdp_get_channel_id(struct xrdp_session* session, char* name)
|
||||
{
|
||||
int index;
|
||||
int count;
|
||||
struct xrdp_rdp* rdp;
|
||||
struct xrdp_mcs* mcs;
|
||||
struct mcs_channel_item* channel_item;
|
||||
|
||||
rdp = (struct xrdp_rdp*)session->rdp;
|
||||
mcs = rdp->sec_layer->mcs_layer;
|
||||
count = mcs->channel_list->count;
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
channel_item = (struct mcs_channel_item*)
|
||||
list_get_item(mcs->channel_list, index);
|
||||
if (channel_item != 0)
|
||||
{
|
||||
if (g_strcasecmp(name, channel_item->name) == 0)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int EXPORT_CC
|
||||
libxrdp_send_to_channel(struct xrdp_session* session, int channel_id,
|
||||
char* data, int data_len)
|
||||
{
|
||||
struct xrdp_rdp* rdp;
|
||||
struct xrdp_sec* sec;
|
||||
struct xrdp_channel* chan;
|
||||
struct stream* s;
|
||||
|
||||
rdp = (struct xrdp_rdp*)session->rdp;
|
||||
sec = rdp->sec_layer;
|
||||
chan = sec->chan_layer;
|
||||
make_stream(s);
|
||||
init_stream(s, data_len + 1024); /* this should be big enough */
|
||||
if (xrdp_channel_init(chan, s) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
/* here we make a copy of the data, xrdp_channel_send is
|
||||
going to alter it if its bigger that 8192 or something */
|
||||
out_uint8a(s, data, data_len);
|
||||
s_mark_end(s);
|
||||
if (xrdp_channel_send(chan, s, channel_id) != 0)
|
||||
{
|
||||
free_stream(s);
|
||||
return 1;
|
||||
}
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
@ -197,5 +197,13 @@ int DEFAULT_CC
|
||||
libxrdp_orders_send_bitmap2(struct xrdp_session* session,
|
||||
int width, int height, int bpp, char* data,
|
||||
int cache_id, int cache_idx);
|
||||
int DEFAULT_CC
|
||||
libxrdp_query_channel(struct xrdp_session* session, int index,
|
||||
char* channel_name, int* channel_flags);
|
||||
int DEFAULT_CC
|
||||
libxrdp_get_channel_id(struct xrdp_session* session, char* name);
|
||||
int DEFAULT_CC
|
||||
libxrdp_send_to_channel(struct xrdp_session* session, int channel_id,
|
||||
char* data, int data_len);
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
XRDPOBJ = libxrdp.obj xrdp_tcp.obj xrdp_iso.obj xrdp_mcs.obj \
|
||||
xrdp_sec.obj xrdp_rdp.obj xrdp_orders.obj \
|
||||
xrdp_bitmap_compress.obj \
|
||||
xrdp_bitmap_compress.obj xrdp_channel.obj \
|
||||
list.obj \
|
||||
file.obj \
|
||||
os_calls.obj \
|
||||
|
10
rdp/rdp.h
10
rdp/rdp.h
@ -262,6 +262,8 @@ struct mod
|
||||
int (*mod_signal)(struct mod* v);
|
||||
int (*mod_end)(struct mod* v);
|
||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
||||
functions above */
|
||||
/* server functions */
|
||||
int (*server_begin_update)(struct mod* v);
|
||||
int (*server_end_update)(struct mod* v);
|
||||
@ -295,6 +297,14 @@ struct mod
|
||||
int box_right, int box_bottom,
|
||||
int x, int y, char* data, int data_len);
|
||||
int (*server_reset)(struct mod* v, int width, int height, int bpp);
|
||||
int (*server_query_channel)(struct mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||
char* data, int data_len);
|
||||
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
||||
functions above */
|
||||
/* common */
|
||||
long handle; /* pointer to self as long */
|
||||
long wm;
|
||||
|
11
vnc/vnc.h
11
vnc/vnc.h
@ -29,6 +29,7 @@
|
||||
struct vnc
|
||||
{
|
||||
int size; /* size of this struct */
|
||||
int version; /* internal version */
|
||||
/* client functions */
|
||||
int (*mod_start)(struct vnc* v, int w, int h, int bpp);
|
||||
int (*mod_connect)(struct vnc* v);
|
||||
@ -37,6 +38,8 @@ struct vnc
|
||||
int (*mod_signal)(struct vnc* v);
|
||||
int (*mod_end)(struct vnc* v);
|
||||
int (*mod_set_param)(struct vnc* v, char* name, char* value);
|
||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
||||
functions above */
|
||||
/* server functions */
|
||||
int (*server_begin_update)(struct vnc* v);
|
||||
int (*server_end_update)(struct vnc* v);
|
||||
@ -70,6 +73,14 @@ struct vnc
|
||||
int box_right, int box_bottom,
|
||||
int x, int y, char* data, int data_len);
|
||||
int (*server_reset)(struct vnc* v, int width, int height, int bpp);
|
||||
int (*server_query_channel)(struct vnc* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct vnc* v, char* name);
|
||||
int (*server_send_to_channel)(struct vnc* v, int channel_id,
|
||||
char* data, int data_len);
|
||||
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
||||
functions above */
|
||||
/* common */
|
||||
long handle; /* pointer to self as long */
|
||||
long wm;
|
||||
|
@ -365,3 +365,11 @@ server_draw_text(struct xrdp_mod* mod, int font,
|
||||
int x, int y, char* data, int data_len);
|
||||
int DEFAULT_CC
|
||||
server_reset(struct xrdp_mod* mod, int width, int height, int bpp);
|
||||
int DEFAULT_CC
|
||||
server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
|
||||
int* channel_flags);
|
||||
int DEFAULT_CC
|
||||
server_get_channel_id(struct xrdp_mod* mod, char* name);
|
||||
int DEFAULT_CC
|
||||
server_send_to_channel(struct xrdp_mod* mod, int channel_id,
|
||||
char* data, int data_len);
|
||||
|
@ -411,3 +411,36 @@ server_reset(struct xrdp_mod* mod, int width, int height, int bpp)
|
||||
xrdp_wm_load_static_pointers(wm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int DEFAULT_CC
|
||||
server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
|
||||
int* channel_flags)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
return libxrdp_query_channel(wm->session, index, channel_name,
|
||||
channel_flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int DEFAULT_CC
|
||||
server_get_channel_id(struct xrdp_mod* mod, char* name)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
return libxrdp_get_channel_id(wm->session, name);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int DEFAULT_CC
|
||||
server_send_to_channel(struct xrdp_mod* mod, int channel_id,
|
||||
char* data, int data_len)
|
||||
{
|
||||
struct xrdp_wm* wm;
|
||||
|
||||
wm = (struct xrdp_wm*)mod->wm;
|
||||
return libxrdp_send_to_channel(wm->session, channel_id, data, data_len);
|
||||
}
|
||||
|
@ -174,6 +174,9 @@ xrdp_wm_setup_mod1(struct xrdp_wm* self,
|
||||
self->mod->server_add_char = server_add_char;
|
||||
self->mod->server_draw_text = server_draw_text;
|
||||
self->mod->server_reset = server_reset;
|
||||
self->mod->server_query_channel = server_query_channel;
|
||||
self->mod->server_get_channel_id = server_get_channel_id;
|
||||
self->mod->server_send_to_channel = server_send_to_channel;
|
||||
}
|
||||
}
|
||||
/* id self->mod is null, there must be a problem */
|
||||
|
@ -24,6 +24,7 @@
|
||||
struct xrdp_mod
|
||||
{
|
||||
int size; /* size of this struct */
|
||||
int version; /* internal version */
|
||||
/* client functions */
|
||||
int (*mod_start)(struct xrdp_mod* v, int w, int h, int bpp);
|
||||
int (*mod_connect)(struct xrdp_mod* v);
|
||||
@ -32,6 +33,8 @@ struct xrdp_mod
|
||||
int (*mod_signal)(struct xrdp_mod* v);
|
||||
int (*mod_end)(struct xrdp_mod* v);
|
||||
int (*mod_set_param)(struct xrdp_mod* v, char* name, char* value);
|
||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
||||
functions above */
|
||||
/* server functions */
|
||||
int (*server_begin_update)(struct xrdp_mod* v);
|
||||
int (*server_end_update)(struct xrdp_mod* v);
|
||||
@ -65,6 +68,14 @@ struct xrdp_mod
|
||||
int box_right, int box_bottom,
|
||||
int x, int y, char* data, int data_len);
|
||||
int (*server_reset)(struct xrdp_mod* v, int width, int height, int bpp);
|
||||
int (*server_query_channel)(struct xrdp_mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct xrdp_mod* v, char* name);
|
||||
int (*server_send_to_channel)(struct xrdp_mod* v, int channel_id,
|
||||
char* data, int data_len);
|
||||
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
||||
functions above */
|
||||
/* common */
|
||||
long handle; /* pointer to self as int */
|
||||
long wm; /* struct xrdp_wm* */
|
||||
|
11
xup/xup.h
11
xup/xup.h
@ -29,6 +29,7 @@
|
||||
struct mod
|
||||
{
|
||||
int size; /* size of this struct */
|
||||
int version; /* internal version */
|
||||
/* client functions */
|
||||
int (*mod_start)(struct mod* v, int w, int h, int bpp);
|
||||
int (*mod_connect)(struct mod* v);
|
||||
@ -37,6 +38,8 @@ struct mod
|
||||
int (*mod_signal)(struct mod* v);
|
||||
int (*mod_end)(struct mod* v);
|
||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
||||
functions above */
|
||||
/* server functions */
|
||||
int (*server_begin_update)(struct mod* v);
|
||||
int (*server_end_update)(struct mod* v);
|
||||
@ -70,6 +73,14 @@ struct mod
|
||||
int box_right, int box_bottom,
|
||||
int x, int y, char* data, int data_len);
|
||||
int (*server_reset)(struct mod* v, int width, int height, int bpp);
|
||||
int (*server_query_channel)(struct mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||
char* data, int data_len);
|
||||
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
||||
functions above */
|
||||
/* common */
|
||||
long handle; /* pointer to self as long */
|
||||
long wm;
|
||||
|
Loading…
Reference in New Issue
Block a user