2013-05-03 11:37:11 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Server
|
|
|
|
* freerdp wrapper
|
|
|
|
*
|
|
|
|
* Copyright 2011-2013 Jay Sorg
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-01-31 12:16:12 +03:00
|
|
|
#ifndef XRDP_NEUTRINORDP_H
|
|
|
|
#define XRDP_NEUTRINORDP_H
|
|
|
|
|
2013-05-03 11:37:11 +04:00
|
|
|
#include "arch.h"
|
2020-08-05 18:12:16 +03:00
|
|
|
#include "xrdp_constants.h"
|
2024-02-01 03:06:59 +03:00
|
|
|
#include "xrdp_client_info.h"
|
2013-05-03 11:37:11 +04:00
|
|
|
|
2024-02-01 03:06:59 +03:00
|
|
|
/* Incomplete type definitions, referenced below */
|
|
|
|
struct rail_window_state_order;
|
|
|
|
struct rail_notify_state_order;
|
|
|
|
struct rail_monitored_desktop_order;
|
|
|
|
struct rail_icon_info;
|
2013-05-03 11:37:11 +04:00
|
|
|
|
|
|
|
struct bitmap_item
|
|
|
|
{
|
2016-05-13 02:02:05 +03:00
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
char *data;
|
2013-05-03 11:37:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct brush_item
|
|
|
|
{
|
2016-05-13 02:02:05 +03:00
|
|
|
int bpp;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
char *data;
|
|
|
|
char b8x8[8];
|
2013-05-03 11:37:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pointer_item
|
|
|
|
{
|
2016-05-13 02:02:05 +03:00
|
|
|
int hotx;
|
|
|
|
int hoty;
|
|
|
|
char data[32 * 32 * 4];
|
|
|
|
char mask[32 * 32 / 8];
|
|
|
|
int bpp;
|
2013-05-03 11:37:11 +04:00
|
|
|
};
|
|
|
|
|
2019-04-10 09:55:02 +03:00
|
|
|
#define CURRENT_MOD_VER 4
|
2013-05-03 11:37:11 +04:00
|
|
|
|
2020-08-07 13:48:22 +03:00
|
|
|
struct source_info;
|
|
|
|
|
2021-07-19 19:08:45 +03:00
|
|
|
struct kbd_overrides
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
int subtype;
|
|
|
|
int fn_keys;
|
|
|
|
int layout;
|
|
|
|
int layout_mask;
|
|
|
|
};
|
|
|
|
|
2013-05-03 11:37:11 +04:00
|
|
|
struct mod
|
|
|
|
{
|
2016-05-13 02:02:05 +03:00
|
|
|
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);
|
|
|
|
int (*mod_event)(struct mod *v, int msg, long param1, long param2,
|
|
|
|
long param3, long param4);
|
|
|
|
int (*mod_signal)(struct mod *v);
|
|
|
|
int (*mod_end)(struct mod *v);
|
2016-11-20 20:55:32 +03:00
|
|
|
int (*mod_set_param)(struct mod *v, const char *name, const char *value);
|
2016-05-13 02:02:05 +03:00
|
|
|
int (*mod_session_change)(struct mod *v, int, int);
|
|
|
|
int (*mod_get_wait_objs)(struct mod *v, tbus *read_objs, int *rcount,
|
|
|
|
tbus *write_objs, int *wcount, int *timeout);
|
|
|
|
int (*mod_check_wait_objs)(struct mod *v);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*mod_frame_ack)(struct mod *mod, int flags, int frame_id);
|
|
|
|
int (*mod_suppress_output)(struct mod *mod, int suppress,
|
|
|
|
int left, int top, int right, int bottom);
|
2018-10-16 07:42:13 +03:00
|
|
|
int (*mod_server_monitor_resize)(struct mod *mod,
|
2024-02-15 17:48:54 +03:00
|
|
|
int width, int height,
|
|
|
|
int num_monitors,
|
|
|
|
const struct monitor_info *monitors,
|
|
|
|
int *in_progress);
|
2018-10-16 07:42:13 +03:00
|
|
|
int (*mod_server_monitor_full_invalidate)(struct mod *mod,
|
2021-05-08 19:58:11 +03:00
|
|
|
int width, int height);
|
2018-10-16 07:42:13 +03:00
|
|
|
int (*mod_server_version_message)(struct mod *mod);
|
|
|
|
tintptr mod_dumby[100 - 14]; /* align, 100 minus the number of mod
|
|
|
|
functions above */
|
2016-05-13 02:02:05 +03:00
|
|
|
/* server functions */
|
|
|
|
int (*server_begin_update)(struct mod *v);
|
|
|
|
int (*server_end_update)(struct mod *v);
|
|
|
|
int (*server_fill_rect)(struct mod *v, int x, int y, int cx, int cy);
|
|
|
|
int (*server_screen_blt)(struct mod *v, int x, int y, int cx, int cy,
|
|
|
|
int srcx, int srcy);
|
|
|
|
int (*server_paint_rect)(struct mod *v, int x, int y, int cx, int cy,
|
|
|
|
char *data, int width, int height, int srcx, int srcy);
|
|
|
|
int (*server_set_pointer)(struct mod *v, int x, int y, char *data, char *mask);
|
|
|
|
int (*server_palette)(struct mod *v, int *palette);
|
2021-10-21 16:12:24 +03:00
|
|
|
int (*server_msg)(struct mod *v, const char *msg, int code);
|
Rework transport connect logic
There are a number of ways the existing transport connect logic in
trans_connect could be improved for POSIX compatibility, and also
slightly tidied up:-
1) The same socket is re-used for multiple connect attempts following
failure which isn't behaviour defined by POSIX.1-2017 (although it
works on Linux).
2) An asynchronous connect is started, and then after a short
delay connect() is called again on the same socket. POSIX.1-2017
is clear that in this situation EALREADY is returned before the
connection is established, but is silent on the behaviour expected
when the connection is established. Returning success is an option,
but so is returning EISCONN. The current code assumes the connect()
call will succeed.
3) The code contains two virtually identical, quite complex loops for
TCP and UNIX sockets, differing only in the calls to create a socket
and connect it.
4) trans_connect() contains looping and retry logic, but this isn't
seen as sufficient by the chansrv connect code in xrdp/xrdp_mm.c and
the Xorg connect code in xup/xup.c. Both of these implement their own
looping and retry logic on top of the logic in trans_connect(),
resulting in slightly unpredictable behaviour with regard to
timeouts.
5) A socket number can technically be zero, but in a couple of places
this isn't allowed for.
This PR attempts to correct the implementation of trans_connect(),
and also to simplify the areas it is called from.
As part of the PR, the signature of the server_is_term member of the
xrdp module interface is changed to match the signature expected by the
is_term member of a struct trans. This allows for trans_connect()
in xrdp modules to directly access g_is_term() within the main xrdp
executable. At the moment this functionality is only used by the xup
module.
2022-03-31 16:33:06 +03:00
|
|
|
int (*server_is_term)(void);
|
2016-05-13 02:02:05 +03:00
|
|
|
int (*server_set_clip)(struct mod *v, int x, int y, int cx, int cy);
|
|
|
|
int (*server_reset_clip)(struct mod *v);
|
|
|
|
int (*server_set_fgcolor)(struct mod *v, int fgcolor);
|
|
|
|
int (*server_set_bgcolor)(struct mod *v, int bgcolor);
|
|
|
|
int (*server_set_opcode)(struct mod *v, int opcode);
|
|
|
|
int (*server_set_mixmode)(struct mod *v, int mixmode);
|
|
|
|
int (*server_set_brush)(struct mod *v, int x_origin, int y_origin,
|
|
|
|
int style, char *pattern);
|
|
|
|
int (*server_set_pen)(struct mod *v, int style,
|
|
|
|
int width);
|
|
|
|
int (*server_draw_line)(struct mod *v, int x1, int y1, int x2, int y2);
|
|
|
|
int (*server_add_char)(struct mod *v, int font, int character,
|
|
|
|
int offset, int baseline,
|
|
|
|
int width, int height, char *data);
|
|
|
|
int (*server_draw_text)(struct mod *v, int font,
|
|
|
|
int flags, int mixmode, int clip_left, int clip_top,
|
|
|
|
int clip_right, int clip_bottom,
|
|
|
|
int box_left, int box_top,
|
|
|
|
int box_right, int box_bottom,
|
|
|
|
int x, int y, char *data, int data_len);
|
2024-02-15 17:48:54 +03:00
|
|
|
int (*client_monitor_resize)(struct mod *v, int width, int height,
|
|
|
|
int num_monitors,
|
|
|
|
const struct monitor_info *monitors);
|
|
|
|
int (*server_monitor_resize_done)(struct mod *v);
|
2021-10-12 16:37:28 +03:00
|
|
|
int (*server_get_channel_count)(struct mod *v);
|
2016-05-13 02:02:05 +03:00
|
|
|
int (*server_query_channel)(struct mod *v, int index,
|
|
|
|
char *channel_name,
|
|
|
|
int *channel_flags);
|
2016-06-22 02:30:17 +03:00
|
|
|
int (*server_get_channel_id)(struct mod *v, const char *name);
|
2016-05-13 02:02:05 +03:00
|
|
|
int (*server_send_to_channel)(struct mod *v, int channel_id,
|
|
|
|
char *data, int data_len,
|
|
|
|
int total_data_len, int flags);
|
|
|
|
int (*server_bell_trigger)(struct mod *v);
|
2021-05-27 17:31:37 +03:00
|
|
|
int (*server_chansrv_in_use)(struct mod *v);
|
2016-05-13 02:02:05 +03:00
|
|
|
/* off screen bitmaps */
|
|
|
|
int (*server_create_os_surface)(struct mod *v, int rdpindex,
|
|
|
|
int width, int height);
|
|
|
|
int (*server_switch_os_surface)(struct mod *v, int rdpindex);
|
|
|
|
int (*server_delete_os_surface)(struct mod *v, int rdpindex);
|
|
|
|
int (*server_paint_rect_os)(struct mod *mod, int x, int y,
|
|
|
|
int cx, int cy,
|
|
|
|
int rdpindex, int srcx, int srcy);
|
|
|
|
int (*server_set_hints)(struct mod *mod, int hints, int mask);
|
|
|
|
/* rail */
|
|
|
|
int (*server_window_new_update)(struct mod *mod, int window_id,
|
|
|
|
struct rail_window_state_order *window_state,
|
|
|
|
int flags);
|
|
|
|
int (*server_window_delete)(struct mod *mod, int window_id);
|
|
|
|
int (*server_window_icon)(struct mod *mod,
|
|
|
|
int window_id, int cache_entry, int cache_id,
|
|
|
|
struct rail_icon_info *icon_info,
|
|
|
|
int flags);
|
|
|
|
int (*server_window_cached_icon)(struct mod *mod,
|
|
|
|
int window_id, int cache_entry,
|
|
|
|
int cache_id, int flags);
|
|
|
|
int (*server_notify_new_update)(struct mod *mod,
|
|
|
|
int window_id, int notify_id,
|
|
|
|
struct rail_notify_state_order *notify_state,
|
|
|
|
int flags);
|
|
|
|
int (*server_notify_delete)(struct mod *mod, int window_id,
|
|
|
|
int notify_id);
|
|
|
|
int (*server_monitored_desktop)(struct mod *mod,
|
|
|
|
struct rail_monitored_desktop_order *mdo,
|
|
|
|
int flags);
|
|
|
|
int (*server_set_pointer_ex)(struct mod *mod, int x, int y, char *data,
|
|
|
|
char *mask, int bpp);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*server_add_char_alpha)(struct mod *mod, int font, int character,
|
2017-01-15 09:24:59 +03:00
|
|
|
int offset, int baseline,
|
2021-02-22 12:48:55 +03:00
|
|
|
int width, int height, char *data);
|
|
|
|
int (*server_create_os_surface_bpp)(struct mod *v, int rdpindex,
|
2017-01-15 09:24:59 +03:00
|
|
|
int width, int height, int bpp);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*server_paint_rect_bpp)(struct mod *v, int x, int y, int cx, int cy,
|
|
|
|
char *data, int width, int height,
|
2017-01-15 09:24:59 +03:00
|
|
|
int srcx, int srcy, int bpp);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*server_composite)(struct mod *v, int srcidx, int srcformat,
|
|
|
|
int srcwidth, int srcrepeat, int *srctransform,
|
2017-01-15 09:24:59 +03:00
|
|
|
int mskflags, int mskidx, int mskformat,
|
|
|
|
int mskwidth, int mskrepeat, int op,
|
|
|
|
int srcx, int srcy, int mskx, int msky,
|
|
|
|
int dstx, int dsty, int width, int height,
|
|
|
|
int dstformat);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*server_paint_rects)(struct mod *v,
|
2017-01-15 09:24:59 +03:00
|
|
|
int num_drects, short *drects,
|
|
|
|
int num_crects, short *crects,
|
|
|
|
char *data, int width, int height,
|
|
|
|
int flags, int frame_id);
|
2021-02-22 12:48:55 +03:00
|
|
|
int (*server_session_info)(struct mod *v, const char *data,
|
2017-01-15 09:24:59 +03:00
|
|
|
int data_bytes);
|
2024-02-15 17:48:54 +03:00
|
|
|
tintptr server_dumby[100 - 47]; /* align, 100 minus the number of server
|
2017-01-15 09:24:59 +03:00
|
|
|
functions above */
|
2016-05-13 02:02:05 +03:00
|
|
|
/* common */
|
|
|
|
tintptr handle; /* pointer to self as long */
|
|
|
|
tintptr wm;
|
|
|
|
tintptr painter;
|
2020-08-07 13:48:22 +03:00
|
|
|
struct source_info *si;
|
2016-04-16 19:51:42 +03:00
|
|
|
|
2016-05-13 02:02:05 +03:00
|
|
|
/* mod data */
|
|
|
|
int sck;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int bpp;
|
|
|
|
int colormap[256];
|
|
|
|
char *chan_buf;
|
|
|
|
int chan_buf_valid;
|
|
|
|
int chan_buf_bytes;
|
|
|
|
int vmaj;
|
|
|
|
int vmin;
|
|
|
|
int vrev;
|
2020-08-05 18:12:16 +03:00
|
|
|
char username[INFO_CLIENT_MAX_CB_LEN];
|
|
|
|
char password[INFO_CLIENT_MAX_CB_LEN];
|
|
|
|
char domain[INFO_CLIENT_MAX_CB_LEN];
|
2016-05-13 02:02:05 +03:00
|
|
|
int bool_keyBoardSynced ; /* Numlock can be out of sync, we hold state here to resolve */
|
|
|
|
int keyBoardLockInfo ; /* Holds initial numlock capslock state */
|
2013-05-03 11:37:11 +04:00
|
|
|
|
2016-05-13 02:02:05 +03:00
|
|
|
struct xrdp_client_info client_info;
|
2013-05-03 11:37:11 +04:00
|
|
|
|
2016-05-13 02:02:05 +03:00
|
|
|
struct rdp_freerdp *inst;
|
|
|
|
struct bitmap_item bitmap_cache[4][4096];
|
|
|
|
struct brush_item brush_cache[64];
|
|
|
|
struct pointer_item pointer_cache[32];
|
2021-05-03 20:27:41 +03:00
|
|
|
char pamusername[255];
|
2021-06-20 02:58:33 +03:00
|
|
|
|
|
|
|
int allow_client_experiencesettings;
|
|
|
|
int perf_settings_override_mask; /* Performance bits overridden in ini file */
|
|
|
|
int perf_settings_values_mask; /* Values of overridden performance bits */
|
2021-07-19 18:10:53 +03:00
|
|
|
int allow_client_kbd_settings;
|
2021-07-19 19:08:45 +03:00
|
|
|
struct kbd_overrides kbd_overrides; /* neutrinordp.overide_kbd_* values */
|
2013-05-03 11:37:11 +04:00
|
|
|
};
|
2023-01-31 12:16:12 +03:00
|
|
|
|
|
|
|
#endif // XRDP_NEUTRINORDP_H
|