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