1 /*
2    Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
3    All rights reserved.
4 
5 This file is part of x11vnc.
6 
7 x11vnc is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at
10 your option) any later version.
11 
12 x11vnc is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with x11vnc; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
20 or see <http://www.gnu.org/licenses/>.
21 
22 In addition, as a special exception, Karl J. Runge
23 gives permission to link the code of its release of x11vnc with the
24 OpenSSL project's "OpenSSL" library (or with modified versions of it
25 that use the same license as the "OpenSSL" library), and distribute
26 the linked executables.  You must obey the GNU General Public License
27 in all respects for all of the code used other than "OpenSSL".  If you
28 modify this file, you may extend this exception to your version of the
29 file, but you are not obligated to do so.  If you do not wish to do
30 so, delete this exception statement from your version.
31 */
32 
33 #ifndef _X11VNC_X11VNC_H
34 #define _X11VNC_X11VNC_H
35 
36 /* -- x11vnc.h -- */
37 /*
38  * These ' -- filename.[ch] -- ' comments represent a partial cleanup:
39  * they are an odd way to indicate how this huge file would be split up
40  * someday into multiple files.
41  *
42  * The primary reason we have not broken up this file is for user
43  * convenience: those wanting to use the latest version download a single
44  * file, x11vnc.c, and off they go...
45  */
46 
47 /****************************************************************************/
48 
49 /* Standard includes and libvncserver */
50 
51 #include <unistd.h>
52 #include <signal.h>
53 #include <sys/utsname.h>
54 #ifdef __hpux
55 /* to avoid select() compiler warning */
56 #include <sys/time.h>
57 #endif
58 #include <time.h>
59 #include <errno.h>
60 
61 #include <sys/stat.h>
62 #include <fcntl.h>
63 #include <ctype.h>
64 
65 #include <netdb.h>
66 
67 #include "config.h"
68 
69 #include <rfb/rfb.h>
70 #include <rfb/rfbregion.h>
71 
72 
73 /* we can now build under --without-x: */
74 #if HAVE_X11
75 
76 #define NO_X11 0
77 #include <X11/Xlib.h>
78 #include <X11/Xutil.h>
79 
80 #include <X11/keysym.h>
81 #include <X11/Xatom.h>
82 
83 #else
84 
85 #define NO_X11 1
86 #ifndef SKIP_NO_X11
87 #include "nox11.h"
88 #endif
89 #include <rfb/keysym.h>
90 
91 #endif
92 
93 
94 /****************************************************************************/
95 
96 
97 /*
98  * Build-time customization via CPPFLAGS.
99  *
100  * Summary of options to include in CPPFLAGS for custom builds:
101  *
102  * -DVNCSHARED  to have the vnc display shared by default.
103  * -DFOREVER  to have -forever on by default.
104  * -DNOREPEAT=0  to have -repeat on by default.
105  * -DXINERAMA=0  to have -noxinerama on by default.
106  * -DADDKEYSYMS=0  to have -noadd_keysyms the default.
107  *
108  * -DREMOTE_DEFAULT=0  to disable remote-control on by default (-yesremote).
109  * -DREMOTE_CONTROL=0  to disable remote-control mechanism completely.
110  * -DEXTERNAL_COMMANDS=0  to disable the running of all external commands.
111  * -DTIGHTFILEXFER=0  disable tightfilexfer.
112  *
113  * -DHARDWIRE_PASSWD=...      hardwired passwords, quoting necessary.
114  * -DHARDWIRE_VIEWPASSWD=...
115  * -DNOPW=1                   make -nopw the default (skip warning)
116  * -DUSEPW=1                  make -usepw the default
117  * -DPASSWD_REQUIRED=1        exit unless a password is supplied.
118  * -DPASSWD_UNLESS_NOPW=1     exit unless a password is supplied and no -nopw.
119  *
120  * -DCURSOR_DRAG=1  to have -cursor_drag as the default.
121  * -DWIREFRAME=0  to have -nowireframe as the default.
122  * -DWIREFRAME_COPYRECT=0  to have -nowirecopyrect as the default.
123  * -DWIREFRAME_PARMS=...   set default -wirecopyrect parameters.
124  * -DSCROLL_COPYRECT=0     to have -noscrollcopyrect as the default.
125  * -DSCROLL_COPYRECT_PARMS=...  set default -scrollcopyrect parameters.
126  * -DSCALING_COPYRECT=0
127  * -DXDAMAGE=0    to have -noxdamage as the default.
128  * -DSKIPDUPS=0   to have -noskip_dups as the default or vice versa.
129  *
130  * -DPOINTER_MODE_DEFAULT={0,1,2,3,4}  set default -pointer_mode.
131  * -DBOLDLY_CLOSE_DISPLAY=0  to not close X DISPLAY under -rawfb.
132  * -DSMALL_FOOTPRINT=1  for smaller binary size (no help, no gui, etc)
133  *                      use 2 or 3 for even smaller footprint.
134  * -DNOGUI  do not include the gui tkx11vnc.
135  * -DSKIP_HELP=1   smaller.
136  * -DSKIP_XKB=1    a little smaller.
137  * -DSKIP_8to24=1  a little smaller.
138  * -DPOLL_8TO24_DELAY=N
139  * -DDEBUG_XEVENTS=1  enable printout for X events.
140  *
141  * -DX11VNC_MACOSX_USE_GETMAINDEVICE use deprecated GetMainDevice on macosx
142  *
143  * -DX11VNC_MACOSX_NO_DEPRECATED_LOCALEVENTS={0,1}
144  * -DX11VNC_MACOSX_NO_DEPRECATED_POSTEVENTS={0,1}
145  * -DX11VNC_MACOSX_NO_DEPRECATED_FRAMEBUFFER={0,1}
146  *
147  * or for all:
148  *
149  * -DX11VNC_MACOSX_NO_DEPRECATED=1
150  *
151  * env. var. of the same names as above can be set to imply true.
152  *
153  * Set these in CPPFLAGS before running configure. E.g.:
154  *
155  *   % env CPPFLAGS="-DFOREVER -DREMOTE_CONTROL=0" ./configure
156  *   % make
157  */
158 
159 /*
160  * This can be used to disable the remote control mechanism.
161  */
162 #ifndef REMOTE_CONTROL
163 #define REMOTE_CONTROL 1
164 #endif
165 
166 #ifndef XINERAMA
167 #define XINERAMA 1
168 #endif
169 
170 #ifndef NOPW
171 #define NOPW 0
172 #endif
173 
174 #ifndef USEPW
175 #define USEPW 0
176 #endif
177 
178 #ifndef PASSWD_REQUIRED
179 #define PASSWD_REQUIRED 0
180 #endif
181 
182 #ifndef PASSWD_UNLESS_NOPW
183 #define PASSWD_UNLESS_NOPW 0
184 #endif
185 
186 /* some -D macros for building with old LibVNCServer */
187 #ifndef LIBVNCSERVER_HAS_STATS
188 #define LIBVNCSERVER_HAS_STATS 1
189 #endif
190 
191 #ifndef LIBVNCSERVER_HAS_SHUTDOWNSOCKETS
192 #define LIBVNCSERVER_HAS_SHUTDOWNSOCKETS 1
193 #endif
194 
195 #ifndef LIBVNCSERVER_HAS_TEXTCHAT
196 #define LIBVNCSERVER_HAS_TEXTCHAT 1
197 #endif
198 
199 #ifdef PRE_0_8_LIBVNCSERVER
200 #undef  LIBVNCSERVER_WITH_TIGHTVNC_FILETRANSFER
201 #undef  LIBVNCSERVER_HAS_STATS
202 #undef  LIBVNCSERVER_HAS_SHUTDOWNSOCKETS
203 #undef  LIBVNCSERVER_HAS_TEXTCHAT
204 #define LIBVNCSERVER_HAS_STATS 0
205 #define LIBVNCSERVER_HAS_SHUTDOWNSOCKETS 0
206 #define LIBVNCSERVER_HAS_TEXTCHAT 0
207 #endif
208 
209 /* these are for delaying features: */
210 #define xxNO_NCACHE
211 
212 /*
213  * Beginning of support for small binary footprint build for embedded
214  * systems, PDA's etc.  It currently just cuts out the low-hanging
215  * fruit (large text passages).  Set to 2, 3 to cut out some of the
216  * more esoteric extensions.  More tedious is to modify LDFLAGS in the
217  * Makefile to not link against the extension libraries... but that
218  * should be done too (manually for now).
219  *
220  * If there is interest more of the bloat can be removed...  Currently
221  * these shrink the binary from 1100K to about 600K.
222  */
223 #ifndef SMALL_FOOTPRINT
224 #define SMALL_FOOTPRINT 0
225 #endif
226 
227 #ifndef SKIP_XKB
228 #define SKIP_XKB 0
229 #endif
230 #ifndef SKIP_8TO24
231 #define SKIP_8TO24 0
232 #endif
233 #ifndef SKIP_HELP
234 #define SKIP_HELP 0
235 #endif
236 
237 #if SMALL_FOOTPRINT
238 #undef  NOGUI
239 #define NOGUI
240 #undef  SKIP_HELP
241 #define SKIP_HELP 1
242 #endif
243 
244 #if (SMALL_FOOTPRINT > 1)
245 #undef SKIP_XKB
246 #undef SKIP_8TO24
247 #undef HAVE_LIBXINERAMA
248 #undef HAVE_LIBXFIXES
249 #undef HAVE_LIBXDAMAGE
250 #define SKIP_XKB 1
251 #define SKIP_8TO24 1
252 #define HAVE_LIBXINERAMA 0
253 #define HAVE_LIBXFIXES 0
254 #define HAVE_LIBXDAMAGE 0
255 #endif
256 
257 #if (SMALL_FOOTPRINT > 2)
258 #undef HAVE_UTMPX_H
259 #undef HAVE_PWD_H
260 #undef REMOTE_CONTROL
261 #define HAVE_UTMPX_H 0
262 #define HAVE_PWD_H 0
263 #define REMOTE_CONTROL 0
264 #endif
265 
266 #ifndef X11VNC_MACOSX_NO_DEPRECATED_LOCALEVENTS
267 #if     X11VNC_MACOSX_NO_DEPRECATED
268 #define X11VNC_MACOSX_NO_DEPRECATED_LOCALEVENTS 1
269 #else
270 #define X11VNC_MACOSX_NO_DEPRECATED_LOCALEVENTS 0
271 #endif
272 #endif
273 
274 #ifndef X11VNC_MACOSX_NO_DEPRECATED_POSTEVENTS
275 #if     X11VNC_MACOSX_NO_DEPRECATED
276 #define X11VNC_MACOSX_NO_DEPRECATED_POSTEVENTS 1
277 #else
278 #define X11VNC_MACOSX_NO_DEPRECATED_POSTEVENTS 0
279 #endif
280 #endif
281 
282 #ifndef X11VNC_MACOSX_NO_DEPRECATED_FRAMEBUFFER
283 #if     X11VNC_MACOSX_NO_DEPRECATED
284 #define X11VNC_MACOSX_NO_DEPRECATED_FRAMEBUFFER 1
285 #else
286 #define X11VNC_MACOSX_NO_DEPRECATED_FRAMEBUFFER 0
287 #endif
288 #endif
289 
290 /*
291  * Not recommended unless you know what you are getting into, but if you
292  * define the HARDWIRE_PASSWD or HARDWIRE_VIEWPASSWD variables here or in
293  * CPPFLAGS you can set a default -passwd and -viewpasswd string values,
294  * perhaps this would be better than nothing on an embedded system, etc.
295  * These default values will be overridden by the command line.
296  * We don't even give an example ;-)
297  */
298 
299 /****************************************************************************/
300 
301 /* Extensions and related includes: */
302 
303 #if HAVE_XSHM
304 #  if defined(__hpux) && defined(__ia64)  /* something weird on hp/itanic */
305 #    undef _INCLUDE_HPUX_SOURCE
306 #  endif
307 #include <sys/ipc.h>
308 #include <sys/shm.h>
309 #include <X11/extensions/XShm.h>
310 #endif
311 #if HAVE_SHMAT
312 #include <sys/ipc.h>
313 #include <sys/shm.h>
314 #endif
315 
316 #include <dirent.h>
317 
318 #if HAVE_XTEST
319 #include <X11/extensions/XTest.h>
320 #endif
321 extern int xtest_base_event_type;
322 
323 #if HAVE_LIBXTRAP
324 #define NEED_EVENTS
325 #define NEED_REPLIES
326 #include <X11/extensions/xtraplib.h>
327 #include <X11/extensions/xtraplibp.h>
328 extern XETC *trap_ctx;
329 #endif
330 extern int xtrap_base_event_type;
331 
332 #if HAVE_RECORD
333 #include <X11/Xproto.h>
334 #include <X11/extensions/record.h>
335 #endif
336 
337 #if HAVE_XKEYBOARD
338 #include <X11/XKBlib.h>
339 #endif
340 
341 #if HAVE_LIBXINERAMA
342 #include <X11/extensions/Xinerama.h>
343 #endif
344 
345 #if LIBVNCSERVER_HAVE_SYS_SOCKET_H
346 #include <sys/socket.h>
347 #endif
348 
349 #ifndef _AIX
350 extern int h_errno;
351 #endif
352 
353 #if LIBVNCSERVER_HAVE_NETINET_IN_H
354 #include <netinet/in.h>
355 #include <netinet/tcp.h>
356 #include <arpa/inet.h>
357 #endif
358 
359 #ifndef SOL_IPV6
360 #ifdef  IPPROTO_IPV6
361 #define SOL_IPV6 IPPROTO_IPV6
362 #endif
363 #endif
364 
365 #ifndef IPV6_V6ONLY
366 #ifdef  IPV6_BINDV6ONLY
367 #define IPV6_V6ONLY IPV6_BINDV6ONLY
368 #endif
369 #endif
370 
371 #ifndef X11VNC_IPV6
372 #if defined(AF_INET6)
373 #define X11VNC_IPV6 1
374 #else
375 #define X11VNC_IPV6 0
376 #endif
377 #endif
378 
379 #ifndef X11VNC_LISTEN6
380 #define X11VNC_LISTEN6 1
381 #endif
382 
383 #if !X11VNC_IPV6
384 #undef  X11VNC_LISTEN6
385 #define X11VNC_LISTEN6 0
386 #endif
387 
388 #if HAVE_PWD_H
389 #include <pwd.h>
390 #include <grp.h>
391 #endif
392 #if LIBVNCSERVER_HAVE_SYS_WAIT_H
393 #include <sys/wait.h>
394 #endif
395 #if HAVE_UTMPX_H
396 #include <utmpx.h>
397 #endif
398 
399 #if LIBVNCSERVER_HAVE_MMAP
400 #include <sys/mman.h>
401 #endif
402 
403 /*
404  * overlay/multi-depth screen reading support
405  * undef SOLARIS_OVERLAY or IRIX_OVERLAY if there are problems building.
406  */
407 
408 /* solaris/sun */
409 #if defined (__SVR4) && defined (__sun)
410 # define SOLARIS
411 # ifdef HAVE_SOLARIS_XREADSCREEN
412 #  define SOLARIS_OVERLAY
413 #  define OVERLAY_OS
414 # endif
415 #endif
416 
417 #ifdef SOLARIS_OVERLAY
418 #include <X11/extensions/transovl.h>
419 #endif
420 
421 /* irix/sgi */
422 #if defined(__sgi)
423 # define IRIX
424 # ifdef HAVE_IRIX_XREADDISPLAY
425 #  define IRIX_OVERLAY
426 #  define OVERLAY_OS
427 # endif
428 #endif
429 
430 /*
431  * For reference, the OS header defines:
432  __SVR4 && __sun   is solaris
433  __sgi
434  __hpux
435  __osf__
436  __OpenBSD__
437  __FreeBSD__
438  __NetBSD__
439  __linux__
440  (defined(__MACH__) && defined(__APPLE__))
441  _AIX
442  */
443 #if (defined(__MACH__) && defined(__APPLE__))
444 #define MACOSX
445 #endif
446 
447 
448 #ifdef IRIX_OVERLAY
449 #include <X11/extensions/readdisplay.h>
450 #endif
451 
452 extern int overlay_present;
453 
454 #if HAVE_LIBXRANDR
455 #include <X11/extensions/Xrandr.h>
456 #endif
457 extern int xrandr_base_event_type;
458 
459 #if HAVE_LIBXFIXES
460 #include <X11/extensions/Xfixes.h>
461 #endif
462 extern int xfixes_base_event_type;
463 
464 #if HAVE_LIBXDAMAGE
465 #include <X11/extensions/Xdamage.h>
466 #endif
467 extern int xdamage_base_event_type;
468 
469 #if HAVE_LIBXCOMPOSITE
470 #include <X11/extensions/Xcomposite.h>
471 #endif
472 extern int xcomposite_present;
473 extern int use_xcomposite;
474 
475 #define RAWFB_RET(y)   if (raw_fb && ! dpy) return y;
476 #define RAWFB_RET_VOID if (raw_fb && ! dpy) return;
477 
478 extern char lastmod[];
479 
480 /* X display info */
481 
482 extern Display *dpy;		/* the single display screen we connect to */
483 extern int scr;
484 extern char *xauth_raw_data;
485 extern int xauth_raw_len;
486 extern Window window, rootwin;		/* polled window, root window (usu. same) */
487 extern Visual *default_visual;		/* the default visual (unless -visual) */
488 extern int bpp, depth;
489 extern int indexed_color;
490 extern int dpy_x, dpy_y;		/* size of display */
491 extern int fb_x, fb_y, fb_b;		/* fb size and bpp guesses at display */
492 extern int off_x, off_y;		/* offsets for -sid */
493 extern int wdpy_x, wdpy_y;		/* for actual sizes in case of -clip */
494 extern int cdpy_x, cdpy_y, coff_x, coff_y;	/* the -clip params */
495 extern int button_mask;		/* button state and info */
496 extern int button_mask_prev;
497 extern int num_buttons;
498 
499 extern long xselectinput_rootwin;
500 
501 extern unsigned int display_button_mask;
502 extern unsigned int display_mod_mask;
503 
504 extern int is_wayland_session;  /* set to 1 if we're running under a wayland session */
505 
506 /* image structures */
507 extern XImage *scanline;
508 extern XImage *fullscreen;
509 extern XImage **tile_row;	/* for all possible row runs */
510 extern XImage *snaprect;	/* for XShmGetImage (fs_factor) */
511 extern XImage *snap;		/* the full snap fb */
512 extern XImage *raw_fb_image;	/* the raw fb */
513 
514 #if !HAVE_XSHM
515 /*
516  * for simplicity, define this struct since we'll never use them
517  * under using_shm = 0.
518  */
519 typedef struct {
520 	int shmid; char *shmaddr; Bool readOnly;
521 } XShmSegmentInfo;
522 #endif
523 
524 /* corresponding shm structures */
525 extern XShmSegmentInfo scanline_shm;
526 extern XShmSegmentInfo fullscreen_shm;
527 extern XShmSegmentInfo *tile_row_shm;	/* for all possible row runs */
528 extern XShmSegmentInfo snaprect_shm;
529 
530 /* rfb screen info */
531 extern rfbScreenInfoPtr screen;
532 extern char *rfb_desktop_name;
533 extern char *http_dir;
534 extern char vnc_desktop_name[];
535 extern char *main_fb;			/* our copy of the X11 fb */
536 extern char *rfb_fb;			/* same as main_fb unless transformation */
537 extern char *fake_fb;			/* used under -padgeom */
538 extern char *snap_fb;			/* used under -snapfb */
539 extern char *cmap8to24_fb;		/* used under -8to24 */
540 extern char *rot_fb;			/* used under -rotate */
541 extern char *raw_fb;
542 extern char *raw_fb_addr;
543 extern int raw_fb_offset;
544 extern int raw_fb_shm;
545 extern int raw_fb_mmap;
546 extern int raw_fb_seek;
547 extern int raw_fb_fd;
548 extern int raw_fb_back_to_X;
549 
550 extern int raw_fb_native_bpp;
551 extern int raw_fb_expand_bytes;
552 extern unsigned long  raw_fb_native_red_mask,  raw_fb_native_green_mask,  raw_fb_native_blue_mask;
553 extern unsigned short raw_fb_native_red_max,   raw_fb_native_green_max,   raw_fb_native_blue_max;
554 extern unsigned short raw_fb_native_red_shift, raw_fb_native_green_shift, raw_fb_native_blue_shift;
555 
556 extern int rfb_bytes_per_line;
557 extern int main_bytes_per_line;
558 extern int rot_bytes_per_line;
559 extern unsigned long  main_red_mask,  main_green_mask,  main_blue_mask;
560 extern unsigned short main_red_max,   main_green_max,   main_blue_max;
561 extern unsigned short main_red_shift, main_green_shift, main_blue_shift;
562 
563 extern int raw_fb_bytes_per_line;	/* of actual raw region we poll, not our raw_fb */
564 
565 /* scaling parameters */
566 extern char *scale_str;
567 extern double scale_fac_x;
568 extern double scale_fac_y;
569 extern int scaling;
570 extern int scaling_blend;		/* for no blending option (very course) */
571 extern int scaling_nomult4;		/* do not require width = n * 4 */
572 extern int scaling_pad;		/* pad out scaled sizes to fit denominator */
573 extern int scaling_interpolate;	/* use interpolation scheme when shrinking */
574 extern int scaled_x, scaled_y;		/* dimensions of scaled display */
575 extern int scale_numer, scale_denom;	/* n/m */
576 extern char *rotating_str;
577 extern int rotating;
578 extern int rotating_same;
579 extern int rotating_cursors;
580 
581 /* scale cursor */
582 extern char *scale_cursor_str;
583 extern double scale_cursor_fac_x;
584 extern double scale_cursor_fac_y;
585 extern int scaling_cursor;
586 extern int scaling_cursor_blend;
587 extern int scaling_cursor_interpolate;
588 extern int scale_cursor_numer, scale_cursor_denom;
589 
590 /* size of the basic tile unit that is polled for changes: */
591 extern int tile_x;
592 extern int tile_y;
593 extern int ntiles, ntiles_x, ntiles_y;
594 
595 /* arrays that indicate changed or checked tiles. */
596 extern unsigned char *tile_has_diff, *tile_tried, *tile_copied;
597 extern unsigned char *tile_has_xdamage_diff, *tile_row_has_xdamage_diff;
598 
599 /* times of recent events */
600 extern time_t last_event, last_input, last_client, last_open_xdisplay;
601 extern time_t last_keyboard_input, last_pointer_input;
602 extern time_t last_local_input;	/* macosx */
603 extern time_t last_fb_bytes_sent;
604 extern double last_keyboard_time;
605 extern double last_pointer_time;
606 extern double last_pointer_click_time;
607 extern double last_pointer_motion_time;
608 extern double last_key_to_button_remap_time;
609 extern double last_copyrect;
610 extern double last_copyrect_fix;
611 extern double last_wireframe;
612 extern double servertime_diff;
613 extern double x11vnc_start;
614 extern double x11vnc_current;
615 extern double g_now;
616 
617 extern double last_get_wm_frame_time;
618 extern Window last_get_wm_frame;
619 extern double last_bs_restore;
620 extern double last_su_restore;
621 extern double last_bs_save;
622 extern double last_su_save;
623 
624 extern int hack_val;
625 
626 /* last client to move pointer */
627 extern rfbClientPtr last_pointer_client;
628 extern rfbClientPtr latest_client;
629 extern double last_client_gone;
630 extern double last_new_client;
631 
632 extern int waited_for_client;
633 extern int findcreatedisplay;
634 extern char *terminal_services_daemon;
635 
636 extern int client_count;
637 extern int clients_served;
638 extern int client_normal_count;
639 
640 /* more transient kludge variables: */
641 extern int cursor_x, cursor_y;		/* x and y from the viewer(s) */
642 extern int button_change_x, button_change_y;
643 extern int got_user_input;
644 extern int got_pointer_input;
645 extern int got_local_pointer_input;
646 extern int got_pointer_calls;
647 extern int got_keyboard_input;
648 extern int got_keyboard_calls;
649 extern int urgent_update;
650 extern int last_keyboard_keycode;
651 extern rfbBool last_rfb_down;
652 extern rfbBool last_rfb_key_accepted;
653 extern rfbKeySym last_rfb_keysym;
654 extern double last_rfb_keytime;
655 extern double last_rfb_key_injected;
656 extern double last_rfb_ptr_injected;
657 extern int fb_copy_in_progress;
658 extern int drag_in_progress;
659 extern int shut_down;
660 extern int do_copy_screen;
661 extern time_t damage_time;
662 extern int damage_delay;
663 
664 extern int program_pid;
665 extern char *program_name;
666 extern char *program_cmdline;
667 
668 extern struct utsname UT;
669 
670 typedef struct hint {
671 	/* location x, y, height, and width of a change-rectangle  */
672 	/* (grows as adjacent horizontal tiles are glued together) */
673 	int x, y, w, h;
674 } hint_t;
675 
676 /* struct with client specific data: */
677 #define CILEN 10
678 typedef struct _ClientData {
679 	int uid;
680 	char *hostname;
681 	char *username;
682 	char *unixname;
683 	int client_port;
684 	int server_port;
685 	char *server_ip;
686 	char input[CILEN];
687 	int login_viewonly;
688 	time_t login_time;
689 
690 	pid_t ssl_helper_pid;
691 
692 	int had_cursor_shape_updates;
693 	int had_cursor_pos_updates;
694 
695 	double timer;
696 	double send_cmp_rate;
697 	double send_raw_rate;
698 	double latency;
699 	int cmp_bytes_sent;
700 	int raw_bytes_sent;
701 
702         int ptr_id; /* pointer and keyboard device ids used in multipointer mode */
703         int kbd_id;
704         int ptr_buttonmask;
705         int cursor_x; /* these are used in multipointer mode to draw  */
706         int cursor_y; /* client cursors directly into the framebuffer */
707         int cursor_x_saved;
708         int cursor_y_saved;
709         rfbCursorPtr cursor;
710         char* under_cursor_buffer;
711         int under_cursor_buffer_len;
712         sraRegionPtr cursor_region;
713 
714 } ClientData;
715 
716 extern void nox11_exit(int rc);
717 
718 #include "params.h"
719 #include "enums.h"
720 #include "options.h"
721 #include "util.h"
722 
723 #endif /* _X11VNC_X11VNC_H */
724