Add server_chansrv_in_use() to module interface

This commit is contained in:
matt335672 2021-05-27 15:31:37 +01:00
parent 96052ba6e3
commit 949a81443b
7 changed files with 30 additions and 13 deletions

View File

@ -87,7 +87,8 @@ struct mod
char *data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct mod *v);
tintptr server_dumby[100 - 25]; /* align, 100 minus the number of server
int (*server_chansrv_in_use)(struct mod *v);
tintptr server_dumby[100 - 26]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -130,6 +130,7 @@ struct mod
char *data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct mod *v);
int (*server_chansrv_in_use)(struct mod *v);
/* off screen bitmaps */
int (*server_create_os_surface)(struct mod *v, int rdpindex,
int width, int height);
@ -184,7 +185,7 @@ struct mod
int flags, int frame_id);
int (*server_session_info)(struct mod *v, const char *data,
int data_bytes);
tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -125,7 +125,8 @@ struct vnc
char *data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct vnc *v);
tintptr server_dumby[100 - 25]; /* align, 100 minus the number of server
int (*server_chansrv_in_use)(struct vnc *v);
tintptr server_dumby[100 - 26]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -413,6 +413,8 @@ server_end_update(struct xrdp_mod *mod);
int
server_bell_trigger(struct xrdp_mod *mod);
int
server_chansrv_in_use(struct xrdp_mod *mod);
int
server_fill_rect(struct xrdp_mod *mod, int x, int y, int cx, int cy);
int
server_screen_blt(struct xrdp_mod *mod, int x, int y, int cx, int cy,

View File

@ -427,6 +427,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
self->mod->server_begin_update = server_begin_update;
self->mod->server_end_update = server_end_update;
self->mod->server_bell_trigger = server_bell_trigger;
self->mod->server_chansrv_in_use = server_chansrv_in_use;
self->mod->server_fill_rect = server_fill_rect;
self->mod->server_screen_blt = server_screen_blt;
self->mod->server_paint_rect = server_paint_rect;
@ -1628,8 +1629,6 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port)
{
int index;
self->usechansrv = 1;
if (self->wm->client_info->channels_allowed == 0)
{
LOG(LOG_LEVEL_DEBUG, "%s: "
@ -2457,6 +2456,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
if (g_strcasecmp(value, "-1") == 0)
{
self->sesman_controlled = 1;
self->usechansrv = 1;
}
}
@ -3004,6 +3004,17 @@ server_bell_trigger(struct xrdp_mod *mod)
return 0;
}
/*****************************************************************************/
/* Chansrv in use on this configuration? */
int
server_chansrv_in_use(struct xrdp_mod *mod)
{
struct xrdp_wm *wm;
wm = (struct xrdp_wm *)(mod->wm);
return wm->mm->usechansrv;
}
/*****************************************************************************/
int
@ -3610,14 +3621,13 @@ server_send_to_channel(struct xrdp_mod *mod, int channel_id,
if (wm->mm->usechansrv)
{
/*
* Xvnc backend reaches here
* should not return 1 as this case is not an error
*/
return 0;
/* Modules should not be calling this if chansrv is running -
* they can use server_chansrv_in_use() to avoid doing this */
LOG_DEVEL(LOG_LEVEL_ERROR,
"Bad call of server_send_to_channel() detected");
return 1;
}
/* vnc proxy mode reaches here */
return libxrdp_send_to_channel(wm->session, channel_id, data, data_len,
total_data_len, flags);
}

View File

@ -103,6 +103,7 @@ struct xrdp_mod
char *data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct xrdp_mod *v);
int (*server_chansrv_in_use)(struct xrdp_mod *v);
/* off screen bitmaps */
int (*server_create_os_surface)(struct xrdp_mod *v, int rdpindex,
int width, int height);
@ -158,7 +159,7 @@ struct xrdp_mod
int flags, int frame_id);
int (*server_session_info)(struct xrdp_mod *v, const char *data,
int data_bytes);
tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as int */

View File

@ -100,6 +100,7 @@ struct mod
char *data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct mod *v);
int (*server_chansrv_in_use)(struct mod *v);
/* off screen bitmaps */
int (*server_create_os_surface)(struct mod *v, int rdpindex,
int width, int height);
@ -151,7 +152,7 @@ struct mod
char *data, int width, int height,
int flags, int frame_id);
tintptr server_dumby[100 - 43]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */