channel fixes

ulab-original
jsorg71 15 years ago
parent fa91c84668
commit 33b4e7f417

@ -2086,3 +2086,19 @@ g_time2(void)
return (int)(num_ticks * 10); return (int)(num_ticks * 10);
#endif #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
}

@ -243,5 +243,7 @@ int APP_CC
g_time1(void); g_time1(void);
int APP_CC int APP_CC
g_time2(void); g_time2(void);
int APP_CC
g_time3(void);
#endif #endif

@ -90,6 +90,7 @@ mod_init(void)
mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod = (struct mod*)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod); mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (long)mod; mod->handle = (long)mod;
mod->mod_connect = lib_mod_connect; mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start; mod->mod_start = lib_mod_start;

@ -26,6 +26,8 @@
#include "os_calls.h" #include "os_calls.h"
#include "defines.h" #include "defines.h"
#define CURRENT_MOD_VER 1
struct mod struct mod
{ {
int size; /* size of this struct */ int size; /* size of this struct */
@ -78,7 +80,8 @@ struct mod
int* channel_flags); int* channel_flags);
int (*server_get_channel_id)(struct mod* v, char* name); int (*server_get_channel_id)(struct mod* v, char* name);
int (*server_send_to_channel)(struct mod* v, int channel_id, 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 long server_dumby[100 - 24]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */

@ -307,6 +307,7 @@ mod_init(void)
DEBUG(("in mod_init")); DEBUG(("in mod_init"));
mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod = (struct mod*)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod); mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (long)mod; mod->handle = (long)mod;
mod->mod_connect = lib_mod_connect; mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start; mod->mod_start = lib_mod_start;

@ -251,6 +251,8 @@ struct rdp_orders
struct rdp_bitmap* cache_bitmap[3][600]; struct rdp_bitmap* cache_bitmap[3][600];
}; };
#define CURRENT_MOD_VER 1
struct mod struct mod
{ {
int size; /* size of this struct */ int size; /* size of this struct */
@ -307,7 +309,8 @@ struct mod
int* channel_flags); int* channel_flags);
int (*server_get_channel_id)(struct mod* v, char* name); int (*server_get_channel_id)(struct mod* v, char* name);
int (*server_send_to_channel)(struct mod* v, int channel_id, 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 long server_dumby[100 - 24]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */

@ -125,7 +125,8 @@ lib_send(struct vnc* v, char* data, int len)
/******************************************************************************/ /******************************************************************************/
static int DEFAULT_CC 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 type;
int status; 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 */ out_uint8s(out_s, 4); /* pad */
s_mark_end(out_s); s_mark_end(out_s);
length = (int)(out_s->end - out_s->data); 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); free_stream(out_s);
break; break;
case 3: /* CLIPRDR_FORMAT_ACK */ 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 */ out_uint8s(out_s, 4); /* pad */
s_mark_end(out_s); s_mark_end(out_s);
length = (int)(out_s->end - out_s->data); 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); free_stream(out_s);
break; break;
} }
} }
else
{
g_writeln("lib_process_channel_data: unknown chanid %d v->clip_chanid %d",
chanid, v->clip_chanid);
}
return 0; return 0;
} }
@ -215,7 +222,9 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2,
int cx; int cx;
int cy; int cy;
int size; int size;
int total_size;
int chanid; int chanid;
int flags;
char* data; char* data;
char text[256]; char text[256];
@ -223,16 +232,18 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2,
make_stream(s); make_stream(s);
if (msg == 0x5555) /* channel data */ if (msg == 0x5555) /* channel data */
{ {
chanid = (int)param1; chanid = LOWORD(param1);
flags = HIWORD(param1);
size = (int)param2; size = (int)param2;
data = (char*)param3; data = (char*)param3;
total_size = (int)param4;
if ((size >= 0) && (size <= (32 * 1024)) && (data != 0)) if ((size >= 0) && (size <= (32 * 1024)) && (data != 0))
{ {
init_stream(s, size); init_stream(s, size);
out_uint8a(s, data, size); out_uint8a(s, data, size);
s_mark_end(s); s_mark_end(s);
s->p = s->data; 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 else
{ {
@ -663,7 +674,7 @@ lib_clip_data(struct vnc* v)
out_uint8s(out_s, 4); out_uint8s(out_s, 4);
s_mark_end(out_s); s_mark_end(out_s);
size = (int)(out_s->end - out_s->data); 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(out_s);
} }
free_stream(s); free_stream(s);
@ -741,6 +752,7 @@ lib_mod_signal(struct vnc* v)
} }
else if (type == 3) /* clipboard */ else if (type == 3) /* clipboard */
{ {
g_writeln("got clip data");
error = lib_clip_data(v); error = lib_clip_data(v);
} }
else else
@ -775,7 +787,7 @@ lib_open_clip_channel(struct vnc* v)
v->clip_chanid = v->server_get_channel_id(v, "cliprdr"); v->clip_chanid = v->server_get_channel_id(v, "cliprdr");
if (v->clip_chanid >= 0) 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; return 0;
} }
@ -1163,6 +1175,7 @@ mod_init(void)
v = (struct vnc*)g_malloc(sizeof(struct vnc), 1); v = (struct vnc*)g_malloc(sizeof(struct vnc), 1);
/* set client functions */ /* set client functions */
v->size = sizeof(struct vnc); v->size = sizeof(struct vnc);
v->version = CURRENT_MOD_VER;
v->handle = (long)v; v->handle = (long)v;
v->mod_connect = lib_mod_connect; v->mod_connect = lib_mod_connect;
v->mod_start = lib_mod_start; v->mod_start = lib_mod_start;

@ -25,6 +25,9 @@
#include "parse.h" #include "parse.h"
#include "os_calls.h" #include "os_calls.h"
#include "d3des.h" #include "d3des.h"
#include "defines.h"
#define CURRENT_MOD_VER 1
struct vnc struct vnc
{ {
@ -82,7 +85,8 @@ struct vnc
int* channel_flags); int* channel_flags);
int (*server_get_channel_id)(struct vnc* v, char* name); int (*server_get_channel_id)(struct vnc* v, char* name);
int (*server_send_to_channel)(struct vnc* v, int channel_id, 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 long server_dumby[100 - 24]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */

@ -357,6 +357,11 @@ xrdp_mm_setup_mod1(struct xrdp_mm* self)
if ((self->mod_init != 0) && (self->mod_exit != 0)) if ((self->mod_init != 0) && (self->mod_exit != 0))
{ {
self->mod = self->mod_init(); 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 else
@ -1001,7 +1006,6 @@ xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2,
int id; int id;
char* data; char* data;
g_writeln("in xrdp_mm_process_channel_data %d %d %d %d", param1, param2, param3, param4);
rv = 0; rv = 0;
if ((self->chan_trans != 0) && self->chan_trans_up) if ((self->chan_trans != 0) && self->chan_trans_up)
{ {

@ -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 static int APP_CC
xrdp_wm_process_channel_data(struct xrdp_wm* self, 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; int rv;

@ -448,6 +448,7 @@ mod_init(void)
mod = (struct mod*)g_malloc(sizeof(struct mod), 1); mod = (struct mod*)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod); mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (tbus)mod; mod->handle = (tbus)mod;
mod->mod_connect = lib_mod_connect; mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start; mod->mod_start = lib_mod_start;

@ -26,6 +26,8 @@
#include "os_calls.h" #include "os_calls.h"
#include "defines.h" #include "defines.h"
#define CURRENT_MOD_VER 1
struct mod struct mod
{ {
int size; /* size of this struct */ int size; /* size of this struct */
@ -82,7 +84,8 @@ struct mod
int* channel_flags); int* channel_flags);
int (*server_get_channel_id)(struct mod* v, char* name); int (*server_get_channel_id)(struct mod* v, char* name);
int (*server_send_to_channel)(struct mod* v, int channel_id, 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 tbus server_dumby[100 - 24]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */

Loading…
Cancel
Save