From 33b4e7f417f5d270b88b44ae1a3356a29a977062 Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Sat, 15 Aug 2009 02:49:13 +0000 Subject: channel fixes --- common/os_calls.c | 16 ++++++++++++++++ common/os_calls.h | 2 ++ mc/mc.c | 1 + mc/mc.h | 5 ++++- rdp/rdp.c | 1 + rdp/rdp.h | 5 ++++- vnc/vnc.c | 27 ++++++++++++++++++++------- vnc/vnc.h | 6 +++++- xrdp/xrdp_mm.c | 6 +++++- xrdp/xrdp_wm.c | 7 ++++++- xup/xup.c | 1 + xup/xup.h | 5 ++++- 12 files changed, 69 insertions(+), 13 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 5db47447..a5b88594 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -2086,3 +2086,19 @@ g_time2(void) return (int)(num_ticks * 10); #endif } + +/*****************************************************************************/ +/* returns time in milliseconds, uses gettimeofday + does not work in win32 */ +int APP_CC +g_time3(void) +{ +#if defined(_WIN32) + return 0; +#else + struct timeval tp; + + gettimeofday(&tp, 0); + return (tp.tv_sec * 1000) + (tp.tv_usec / 1000); +#endif +} diff --git a/common/os_calls.h b/common/os_calls.h index bc4f26f8..4c727f66 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -243,5 +243,7 @@ int APP_CC g_time1(void); int APP_CC g_time2(void); +int APP_CC +g_time3(void); #endif diff --git a/mc/mc.c b/mc/mc.c index fc0e9e18..106fa3fe 100644 --- a/mc/mc.c +++ b/mc/mc.c @@ -90,6 +90,7 @@ mod_init(void) mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod->size = sizeof(struct mod); + mod->version = CURRENT_MOD_VER; mod->handle = (long)mod; mod->mod_connect = lib_mod_connect; mod->mod_start = lib_mod_start; diff --git a/mc/mc.h b/mc/mc.h index b825eadc..949166f0 100644 --- a/mc/mc.h +++ b/mc/mc.h @@ -26,6 +26,8 @@ #include "os_calls.h" #include "defines.h" +#define CURRENT_MOD_VER 1 + struct mod { int size; /* size of this struct */ @@ -78,7 +80,8 @@ struct mod 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); + char* data, int data_len, + int total_data_len, int flags); long server_dumby[100 - 24]; /* align, 100 minus the number of server functions above */ /* common */ diff --git a/rdp/rdp.c b/rdp/rdp.c index c66e88ad..b03c6740 100644 --- a/rdp/rdp.c +++ b/rdp/rdp.c @@ -307,6 +307,7 @@ mod_init(void) DEBUG(("in mod_init")); mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod->size = sizeof(struct mod); + mod->version = CURRENT_MOD_VER; mod->handle = (long)mod; mod->mod_connect = lib_mod_connect; mod->mod_start = lib_mod_start; diff --git a/rdp/rdp.h b/rdp/rdp.h index 9f78c5cb..37e430cb 100644 --- a/rdp/rdp.h +++ b/rdp/rdp.h @@ -251,6 +251,8 @@ struct rdp_orders struct rdp_bitmap* cache_bitmap[3][600]; }; +#define CURRENT_MOD_VER 1 + struct mod { int size; /* size of this struct */ @@ -307,7 +309,8 @@ struct mod 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); + char* data, int data_len, + int total_data_len, int flags); long server_dumby[100 - 24]; /* align, 100 minus the number of server functions above */ /* common */ diff --git a/vnc/vnc.c b/vnc/vnc.c index 3e67b9fd..fefedd6c 100644 --- a/vnc/vnc.c +++ b/vnc/vnc.c @@ -125,7 +125,8 @@ lib_send(struct vnc* v, char* data, int len) /******************************************************************************/ static int DEFAULT_CC -lib_process_channel_data(struct vnc* v, int chanid, int size, struct stream* s) +lib_process_channel_data(struct vnc* v, int chanid, int flags, int size, + struct stream* s, int total_size) { int type; int status; @@ -152,7 +153,7 @@ lib_process_channel_data(struct vnc* v, int chanid, int size, struct stream* s) out_uint8s(out_s, 4); /* pad */ s_mark_end(out_s); length = (int)(out_s->end - out_s->data); - v->server_send_to_channel(v, v->clip_chanid, out_s->data, length); + v->server_send_to_channel(v, v->clip_chanid, out_s->data, length, length, 3); free_stream(out_s); break; case 3: /* CLIPRDR_FORMAT_ACK */ @@ -194,11 +195,17 @@ lib_process_channel_data(struct vnc* v, int chanid, int size, struct stream* s) out_uint8s(out_s, 4); /* pad */ s_mark_end(out_s); length = (int)(out_s->end - out_s->data); - v->server_send_to_channel(v, v->clip_chanid, out_s->data, length); + v->server_send_to_channel(v, v->clip_chanid, out_s->data, length, + length, 3); free_stream(out_s); break; } } + else + { + g_writeln("lib_process_channel_data: unknown chanid %d v->clip_chanid %d", + chanid, v->clip_chanid); + } return 0; } @@ -215,7 +222,9 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2, int cx; int cy; int size; + int total_size; int chanid; + int flags; char* data; char text[256]; @@ -223,16 +232,18 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2, make_stream(s); if (msg == 0x5555) /* channel data */ { - chanid = (int)param1; + chanid = LOWORD(param1); + flags = HIWORD(param1); size = (int)param2; data = (char*)param3; + total_size = (int)param4; if ((size >= 0) && (size <= (32 * 1024)) && (data != 0)) { init_stream(s, size); out_uint8a(s, data, size); s_mark_end(s); s->p = s->data; - error = lib_process_channel_data(v, chanid, size, s); + error = lib_process_channel_data(v, chanid, flags, size, s, total_size); } else { @@ -663,7 +674,7 @@ lib_clip_data(struct vnc* v) out_uint8s(out_s, 4); s_mark_end(out_s); size = (int)(out_s->end - out_s->data); - error = v->server_send_to_channel(v, v->clip_chanid, out_s->data, size); + error = v->server_send_to_channel(v, v->clip_chanid, out_s->data, size, size, 3); free_stream(out_s); } free_stream(s); @@ -741,6 +752,7 @@ lib_mod_signal(struct vnc* v) } else if (type == 3) /* clipboard */ { + g_writeln("got clip data"); error = lib_clip_data(v); } else @@ -775,7 +787,7 @@ lib_open_clip_channel(struct vnc* v) v->clip_chanid = v->server_get_channel_id(v, "cliprdr"); if (v->clip_chanid >= 0) { - v->server_send_to_channel(v, v->clip_chanid, init_data, 12); + v->server_send_to_channel(v, v->clip_chanid, init_data, 12, 12, 3); } return 0; } @@ -1163,6 +1175,7 @@ mod_init(void) v = (struct vnc*)g_malloc(sizeof(struct vnc), 1); /* set client functions */ v->size = sizeof(struct vnc); + v->version = CURRENT_MOD_VER; v->handle = (long)v; v->mod_connect = lib_mod_connect; v->mod_start = lib_mod_start; diff --git a/vnc/vnc.h b/vnc/vnc.h index fe143fb3..e298930e 100644 --- a/vnc/vnc.h +++ b/vnc/vnc.h @@ -25,6 +25,9 @@ #include "parse.h" #include "os_calls.h" #include "d3des.h" +#include "defines.h" + +#define CURRENT_MOD_VER 1 struct vnc { @@ -82,7 +85,8 @@ struct vnc 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); + char* data, int data_len, + int total_data_len, int flags); long server_dumby[100 - 24]; /* align, 100 minus the number of server functions above */ /* common */ diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 56b868a8..e6c4e4d2 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -357,6 +357,11 @@ xrdp_mm_setup_mod1(struct xrdp_mm* self) if ((self->mod_init != 0) && (self->mod_exit != 0)) { self->mod = self->mod_init(); + if (self->mod != 0) + { + g_writeln("loaded modual '%s' ok, interface size %d, version %d", lib, + self->mod->size, self->mod->version); + } } } else @@ -1001,7 +1006,6 @@ xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, int id; char* data; - g_writeln("in xrdp_mm_process_channel_data %d %d %d %d", param1, param2, param3, param4); rv = 0; if ((self->chan_trans != 0) && self->chan_trans_up) { diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 8a11785c..e532e2ab 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1263,9 +1263,14 @@ xrdp_wm_process_input_mouse(struct xrdp_wm* self, int device_flags, } /******************************************************************************/ +/* param1 = MAKELONG(channel_id, flags) + param2 = size + param3 = pointer to data + param4 = total size */ static int APP_CC xrdp_wm_process_channel_data(struct xrdp_wm* self, - tbus param1, tbus param2, tbus param3, tbus param4) + tbus param1, tbus param2, + tbus param3, tbus param4) { int rv; diff --git a/xup/xup.c b/xup/xup.c index acebc4f8..20174365 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -448,6 +448,7 @@ mod_init(void) mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod->size = sizeof(struct mod); + mod->version = CURRENT_MOD_VER; mod->handle = (tbus)mod; mod->mod_connect = lib_mod_connect; mod->mod_start = lib_mod_start; diff --git a/xup/xup.h b/xup/xup.h index 96e56946..e53a6607 100644 --- a/xup/xup.h +++ b/xup/xup.h @@ -26,6 +26,8 @@ #include "os_calls.h" #include "defines.h" +#define CURRENT_MOD_VER 1 + struct mod { int size; /* size of this struct */ @@ -82,7 +84,8 @@ struct mod 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); + char* data, int data_len, + int total_data_len, int flags); tbus server_dumby[100 - 24]; /* align, 100 minus the number of server functions above */ /* common */ -- cgit v1.2.1