diff options
author | jsorg71 <jsorg71> | 2006-12-30 05:04:13 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2006-12-30 05:04:13 +0000 |
commit | 4b3b83044a29e89d958c3bf0ea2660b978e3c027 (patch) | |
tree | 0bbc878fef02fd1a4192eb45a9c032984f196253 | |
parent | 0dc679e2dc3ddf71735585cf53c4b717ab5b11a9 (diff) | |
download | xrdp-proprietary-4b3b83044a29e89d958c3bf0ea2660b978e3c027.tar.gz xrdp-proprietary-4b3b83044a29e89d958c3bf0ea2660b978e3c027.zip |
more work on channel support
-rw-r--r-- | libxrdp/Makefile | 2 | ||||
-rw-r--r-- | libxrdp/libxrdp.c | 102 | ||||
-rw-r--r-- | libxrdp/libxrdpinc.h | 8 | ||||
-rwxr-xr-x | libxrdp/makefile_win32 | 2 | ||||
-rw-r--r-- | rdp/rdp.h | 10 | ||||
-rw-r--r-- | vnc/vnc.h | 11 | ||||
-rw-r--r-- | xrdp/xrdp.h | 8 | ||||
-rw-r--r-- | xrdp/xrdp_interface.c | 33 | ||||
-rw-r--r-- | xrdp/xrdp_login_wnd.c | 3 | ||||
-rw-r--r-- | xrdp/xrdp_types.h | 11 | ||||
-rw-r--r-- | xup/xup.h | 11 |
11 files changed, 199 insertions, 2 deletions
diff --git a/libxrdp/Makefile b/libxrdp/Makefile index 4ee8b83a..65d3cf71 100644 --- a/libxrdp/Makefile +++ b/libxrdp/Makefile @@ -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 diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 79c93278..d3c600a4 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -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; +} diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index a7e8927d..33160d0e 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -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 diff --git a/libxrdp/makefile_win32 b/libxrdp/makefile_win32 index 4ab297ef..93a44069 100755 --- a/libxrdp/makefile_win32 +++ b/libxrdp/makefile_win32 @@ -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 \ @@ -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; @@ -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; diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 22501954..225a0f85 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -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); diff --git a/xrdp/xrdp_interface.c b/xrdp/xrdp_interface.c index 1bf1a8f4..c4c54c69 100644 --- a/xrdp/xrdp_interface.c +++ b/xrdp/xrdp_interface.c @@ -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); +} diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index 9481d355..f2f3dce6 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -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 */ diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index e296bc53..f65b0c06 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -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* */ @@ -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; |