1 /** 2 * FreeRDP: A Remote Desktop Protocol Server 3 * freerdp wrapper 4 * 5 * Copyright 2011-2013 Jay Sorg 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 /* include other h files */ 21 #include "arch.h" 22 #include "parse.h" 23 #include "os_calls.h" 24 #include "defines.h" 25 #include "xrdp_rail.h" 26 #include "xrdp_client_info.h" 27 #include "xrdp_constants.h" 28 29 /* this is the freerdp main header */ 30 #include <freerdp/freerdp.h> 31 #include <freerdp/rail.h> 32 #include <freerdp/rail/rail.h> 33 #include <freerdp/codec/bitmap.h> 34 //#include <freerdp/utils/memory.h> 35 //#include "/home/jay/git/jsorg71/staging/include/freerdp/freerdp.h" 36 37 struct bitmap_item 38 { 39 int width; 40 int height; 41 char *data; 42 }; 43 44 struct brush_item 45 { 46 int bpp; 47 int width; 48 int height; 49 char *data; 50 char b8x8[8]; 51 }; 52 53 struct pointer_item 54 { 55 int hotx; 56 int hoty; 57 char data[32 * 32 * 4]; 58 char mask[32 * 32 / 8]; 59 int bpp; 60 }; 61 62 #define CURRENT_MOD_VER 4 63 64 struct source_info; 65 66 struct kbd_overrides 67 { 68 int type; 69 int subtype; 70 int fn_keys; 71 int layout; 72 int layout_mask; 73 }; 74 75 struct mod 76 { 77 int size; /* size of this struct */ 78 int version; /* internal version */ 79 /* client functions */ 80 int (*mod_start)(struct mod *v, int w, int h, int bpp); 81 int (*mod_connect)(struct mod *v); 82 int (*mod_event)(struct mod *v, int msg, long param1, long param2, 83 long param3, long param4); 84 int (*mod_signal)(struct mod *v); 85 int (*mod_end)(struct mod *v); 86 int (*mod_set_param)(struct mod *v, const char *name, const char *value); 87 int (*mod_session_change)(struct mod *v, int, int); 88 int (*mod_get_wait_objs)(struct mod *v, tbus *read_objs, int *rcount, 89 tbus *write_objs, int *wcount, int *timeout); 90 int (*mod_check_wait_objs)(struct mod *v); 91 int (*mod_frame_ack)(struct mod *mod, int flags, int frame_id); 92 int (*mod_suppress_output)(struct mod *mod, int suppress, 93 int left, int top, int right, int bottom); 94 int (*mod_server_monitor_resize)(struct mod *mod, 95 int width, int height); 96 int (*mod_server_monitor_full_invalidate)(struct mod *mod, 97 int width, int height); 98 int (*mod_server_version_message)(struct mod *mod); 99 tintptr mod_dumby[100 - 14]; /* align, 100 minus the number of mod 100 functions above */ 101 /* server functions */ 102 int (*server_begin_update)(struct mod *v); 103 int (*server_end_update)(struct mod *v); 104 int (*server_fill_rect)(struct mod *v, int x, int y, int cx, int cy); 105 int (*server_screen_blt)(struct mod *v, int x, int y, int cx, int cy, 106 int srcx, int srcy); 107 int (*server_paint_rect)(struct mod *v, int x, int y, int cx, int cy, 108 char *data, int width, int height, int srcx, int srcy); 109 int (*server_set_pointer)(struct mod *v, int x, int y, char *data, char *mask); 110 int (*server_palette)(struct mod *v, int *palette); 111 int (*server_msg)(struct mod *v, char *msg, int code); 112 int (*server_is_term)(struct mod *v); 113 int (*server_set_clip)(struct mod *v, int x, int y, int cx, int cy); 114 int (*server_reset_clip)(struct mod *v); 115 int (*server_set_fgcolor)(struct mod *v, int fgcolor); 116 int (*server_set_bgcolor)(struct mod *v, int bgcolor); 117 int (*server_set_opcode)(struct mod *v, int opcode); 118 int (*server_set_mixmode)(struct mod *v, int mixmode); 119 int (*server_set_brush)(struct mod *v, int x_origin, int y_origin, 120 int style, char *pattern); 121 int (*server_set_pen)(struct mod *v, int style, 122 int width); 123 int (*server_draw_line)(struct mod *v, int x1, int y1, int x2, int y2); 124 int (*server_add_char)(struct mod *v, int font, int character, 125 int offset, int baseline, 126 int width, int height, char *data); 127 int (*server_draw_text)(struct mod *v, int font, 128 int flags, int mixmode, int clip_left, int clip_top, 129 int clip_right, int clip_bottom, 130 int box_left, int box_top, 131 int box_right, int box_bottom, 132 int x, int y, char *data, int data_len); 133 int (*server_reset)(struct mod *v, int width, int height, int bpp); 134 int (*server_query_channel)(struct mod *v, int index, 135 char *channel_name, 136 int *channel_flags); 137 int (*server_get_channel_id)(struct mod *v, const char *name); 138 int (*server_send_to_channel)(struct mod *v, int channel_id, 139 char *data, int data_len, 140 int total_data_len, int flags); 141 int (*server_bell_trigger)(struct mod *v); 142 int (*server_chansrv_in_use)(struct mod *v); 143 /* off screen bitmaps */ 144 int (*server_create_os_surface)(struct mod *v, int rdpindex, 145 int width, int height); 146 int (*server_switch_os_surface)(struct mod *v, int rdpindex); 147 int (*server_delete_os_surface)(struct mod *v, int rdpindex); 148 int (*server_paint_rect_os)(struct mod *mod, int x, int y, 149 int cx, int cy, 150 int rdpindex, int srcx, int srcy); 151 int (*server_set_hints)(struct mod *mod, int hints, int mask); 152 /* rail */ 153 int (*server_window_new_update)(struct mod *mod, int window_id, 154 struct rail_window_state_order *window_state, 155 int flags); 156 int (*server_window_delete)(struct mod *mod, int window_id); 157 int (*server_window_icon)(struct mod *mod, 158 int window_id, int cache_entry, int cache_id, 159 struct rail_icon_info *icon_info, 160 int flags); 161 int (*server_window_cached_icon)(struct mod *mod, 162 int window_id, int cache_entry, 163 int cache_id, int flags); 164 int (*server_notify_new_update)(struct mod *mod, 165 int window_id, int notify_id, 166 struct rail_notify_state_order *notify_state, 167 int flags); 168 int (*server_notify_delete)(struct mod *mod, int window_id, 169 int notify_id); 170 int (*server_monitored_desktop)(struct mod *mod, 171 struct rail_monitored_desktop_order *mdo, 172 int flags); 173 int (*server_set_pointer_ex)(struct mod *mod, int x, int y, char *data, 174 char *mask, int bpp); 175 int (*server_add_char_alpha)(struct mod *mod, int font, int character, 176 int offset, int baseline, 177 int width, int height, char *data); 178 int (*server_create_os_surface_bpp)(struct mod *v, int rdpindex, 179 int width, int height, int bpp); 180 int (*server_paint_rect_bpp)(struct mod *v, int x, int y, int cx, int cy, 181 char *data, int width, int height, 182 int srcx, int srcy, int bpp); 183 int (*server_composite)(struct mod *v, int srcidx, int srcformat, 184 int srcwidth, int srcrepeat, int *srctransform, 185 int mskflags, int mskidx, int mskformat, 186 int mskwidth, int mskrepeat, int op, 187 int srcx, int srcy, int mskx, int msky, 188 int dstx, int dsty, int width, int height, 189 int dstformat); 190 int (*server_paint_rects)(struct mod *v, 191 int num_drects, short *drects, 192 int num_crects, short *crects, 193 char *data, int width, int height, 194 int flags, int frame_id); 195 int (*server_session_info)(struct mod *v, const char *data, 196 int data_bytes); 197 tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server 198 functions above */ 199 /* common */ 200 tintptr handle; /* pointer to self as long */ 201 tintptr wm; 202 tintptr painter; 203 struct source_info *si; 204 205 /* mod data */ 206 int sck; 207 int width; 208 int height; 209 int bpp; 210 int colormap[256]; 211 char *chan_buf; 212 int chan_buf_valid; 213 int chan_buf_bytes; 214 int vmaj; 215 int vmin; 216 int vrev; 217 char username[INFO_CLIENT_MAX_CB_LEN]; 218 char password[INFO_CLIENT_MAX_CB_LEN]; 219 char domain[INFO_CLIENT_MAX_CB_LEN]; 220 int bool_keyBoardSynced ; /* Numlock can be out of sync, we hold state here to resolve */ 221 int keyBoardLockInfo ; /* Holds initial numlock capslock state */ 222 223 struct xrdp_client_info client_info; 224 225 struct rdp_freerdp *inst; 226 struct bitmap_item bitmap_cache[4][4096]; 227 struct brush_item brush_cache[64]; 228 struct pointer_item pointer_cache[32]; 229 char pamusername[255]; 230 231 int allow_client_experiencesettings; 232 int perf_settings_override_mask; /* Performance bits overridden in ini file */ 233 int perf_settings_values_mask; /* Values of overridden performance bits */ 234 int allow_client_kbd_settings; 235 struct kbd_overrides kbd_overrides; /* neutrinordp.overide_kbd_* values */ 236 }; 237