Commit 85a310d3f53b71be9a5e0604cba9d899df1ba20f

Authored by 신재종
1 parent 342f4a0116
Exists in master

integrate libvncserver, connection checked

rfb/default8x16.h
@@ -0,0 +1,266 @@ @@ -0,0 +1,266 @@
  1 +#ifndef _DEFAULT_8_X_16_H
  2 +#define _DEFAULT_8_X_16_H
  3 +
  4 +static unsigned char default8x16FontData[4096+1]={
  5 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  6 +0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
  7 +0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00,
  8 +0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,
  9 +0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
  10 +0x00,0x00,0x00,0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  11 +0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  12 +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
  13 +0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,
  14 +0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0x00,0x00,0x00,0x00,
  15 +0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff,
  16 +0x00,0x00,0x1e,0x0e,0x1a,0x32,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00,
  17 +0x00,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,
  18 +0x00,0x00,0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0,0x00,0x00,0x00,0x00,
  19 +0x00,0x00,0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0,0x00,0x00,0x00,
  20 +0x00,0x00,0x00,0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18,0x00,0x00,0x00,0x00,
  21 +0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,
  22 +0x00,0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02,0x00,0x00,0x00,0x00,
  23 +0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,
  24 +0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00,
  25 +0x00,0x00,0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b,0x00,0x00,0x00,0x00,
  26 +0x00,0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,
  27 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xfe,0xfe,0x00,0x00,0x00,0x00,
  28 +0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00,
  29 +0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
  30 +0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,
  31 +0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
  32 +0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
  33 +0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
  34 +0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
  35 +0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe,0x00,0x00,0x00,0x00,0x00,
  36 +0x00,0x00,0x00,0x00,0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
  37 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  38 +0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
  39 +0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  40 +0x00,0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00,0x00,0x00,0x00,
  41 +0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18,0x00,0x00,
  42 +0x00,0x00,0x00,0x00,0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86,0x00,0x00,0x00,0x00,
  43 +0x00,0x00,0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  44 +0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  45 +0x00,0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00,0x00,0x00,
  46 +0x00,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00,0x00,
  47 +0x00,0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
  48 +0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
  49 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,
  50 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  51 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
  52 +0x00,0x00,0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00,0x00,0x00,
  53 +0x00,0x00,0x7c,0xc6,0xc6,0xce,0xde,0xf6,0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  54 +0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00,
  55 +0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00,
  56 +0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
  57 +0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00,
  58 +0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
  59 +0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  60 +0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
  61 +0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  62 +0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00,
  63 +0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
  64 +0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
  65 +0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00,
  66 +0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  67 +0x00,0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00,0x00,0x00,0x00,
  68 +0x00,0x00,0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
  69 +0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00,
  70 +0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  71 +0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc,0x00,0x00,0x00,0x00,
  72 +0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x00,0x00,0x00,0x00,
  73 +0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00,0x00,0x00,0x00,
  74 +0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00,
  75 +0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
  76 +0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a,0x00,0x00,0x00,0x00,
  77 +0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  78 +0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  79 +0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00,
  80 +0x00,0x00,0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
  81 +0x00,0x00,0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00,
  82 +0x00,0x00,0xc3,0xe7,0xff,0xff,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x00,0x00,0x00,0x00,
  83 +0x00,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  84 +0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  85 +0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
  86 +0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e,0x00,0x00,
  87 +0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
  88 +0x00,0x00,0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  89 +0x00,0x00,0xff,0xdb,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  90 +0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  91 +0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00,
  92 +0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x66,0x00,0x00,0x00,0x00,
  93 +0x00,0x00,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x3c,0x66,0xc3,0xc3,0x00,0x00,0x00,0x00,
  94 +0x00,0x00,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  95 +0x00,0x00,0xff,0xc3,0x86,0x0c,0x18,0x30,0x60,0xc1,0xc3,0xff,0x00,0x00,0x00,0x00,
  96 +0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,0x00,0x00,0x00,
  97 +0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02,0x00,0x00,0x00,0x00,
  98 +0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x00,0x00,0x00,
  99 +0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  100 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,
  101 +0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  102 +0x00,0x00,0x00,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  103 +0x00,0x00,0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c,0x00,0x00,0x00,0x00,
  104 +0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  105 +0x00,0x00,0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  106 +0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  107 +0x00,0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
  108 +0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78,0x00,
  109 +0x00,0x00,0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
  110 +0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  111 +0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,
  112 +0x00,0x00,0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6,0x00,0x00,0x00,0x00,
  113 +0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  114 +0x00,0x00,0x00,0x00,0x00,0xe6,0xff,0xdb,0xdb,0xdb,0xdb,0xdb,0x00,0x00,0x00,0x00,
  115 +0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
  116 +0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  117 +0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00,
  118 +0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e,0x00,
  119 +0x00,0x00,0x00,0x00,0x00,0xdc,0x76,0x66,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
  120 +0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,0x00,
  121 +0x00,0x00,0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c,0x00,0x00,0x00,0x00,
  122 +0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  123 +0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00,
  124 +0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x00,0x00,0x00,0x00,
  125 +0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00,0x00,
  126 +0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8,0x00,
  127 +0x00,0x00,0x00,0x00,0x00,0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00,
  128 +0x00,0x00,0x0e,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x00,
  129 +0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
  130 +0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
  131 +0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  132 +0x00,0x00,0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe,0x00,0x00,0x00,0x00,0x00,
  133 +0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c,0x00,0x00,
  134 +0x00,0x00,0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  135 +0x00,0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  136 +0x00,0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  137 +0x00,0x00,0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  138 +0x00,0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  139 +0x00,0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  140 +0x00,0x00,0x00,0x00,0x3c,0x66,0x60,0x60,0x66,0x3c,0x0c,0x06,0x3c,0x00,0x00,0x00,
  141 +0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  142 +0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  143 +0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
  144 +0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  145 +0x00,0x18,0x3c,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  146 +0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  147 +0x00,0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  148 +0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  149 +0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe,0x00,0x00,0x00,0x00,
  150 +0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x1b,0x7e,0xd8,0xdc,0x77,0x00,0x00,0x00,0x00,
  151 +0x00,0x00,0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce,0x00,0x00,0x00,0x00,
  152 +0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  153 +0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  154 +0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  155 +0x00,0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  156 +0x00,0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  157 +0x00,0x00,0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78,0x00,
  158 +0x00,0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  159 +0x00,0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  160 +0x00,0x18,0x18,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,
  161 +0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc,0x00,0x00,0x00,0x00,
  162 +0x00,0x00,0xc3,0x66,0x3c,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
  163 +0x00,0xfc,0x66,0x66,0x7c,0x62,0x66,0x6f,0x66,0x66,0x66,0xf3,0x00,0x00,0x00,0x00,
  164 +0x00,0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70,0x00,0x00,
  165 +0x00,0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  166 +0x00,0x0c,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
  167 +0x00,0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  168 +0x00,0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
  169 +0x00,0x00,0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
  170 +0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  171 +0x00,0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  172 +0x00,0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  173 +0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
  174 +0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,
  175 +0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,
  176 +0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xce,0x9b,0x06,0x0c,0x1f,0x00,0x00,
  177 +0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x96,0x3e,0x06,0x06,0x00,0x00,
  178 +0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3c,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,
  179 +0x00,0x00,0x00,0x00,0x00,0x36,0x6c,0xd8,0x6c,0x36,0x00,0x00,0x00,0x00,0x00,0x00,
  180 +0x00,0x00,0x00,0x00,0x00,0xd8,0x6c,0x36,0x6c,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,
  181 +0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,
  182 +0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
  183 +0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,
  184 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  185 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  186 +0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  187 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  188 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  189 +0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  190 +0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  191 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  192 +0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  193 +0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  194 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  195 +0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  196 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  197 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  198 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  199 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  200 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  201 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  202 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  203 +0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  204 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  205 +0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  206 +0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  207 +0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  208 +0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  209 +0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  210 +0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  211 +0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  212 +0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  213 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  214 +0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  215 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  216 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  217 +0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  218 +0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  219 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  220 +0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
  221 +0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  222 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  223 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  224 +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  225 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
  226 +0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
  227 +0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,
  228 +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  229 +0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76,0x00,0x00,0x00,0x00,
  230 +0x00,0x00,0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc,0x00,0x00,0x00,0x00,
  231 +0x00,0x00,0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,
  232 +0x00,0x00,0x00,0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,
  233 +0x00,0x00,0x00,0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00,
  234 +0x00,0x00,0x00,0x00,0x00,0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00,
  235 +0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0,0x00,0x00,0x00,
  236 +0x00,0x00,0x00,0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
  237 +0x00,0x00,0x00,0x7e,0x18,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00,
  238 +0x00,0x00,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38,0x00,0x00,0x00,0x00,
  239 +0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee,0x00,0x00,0x00,0x00,
  240 +0x00,0x00,0x1e,0x30,0x18,0x0c,0x3e,0x66,0x66,0x66,0x66,0x3c,0x00,0x00,0x00,0x00,
  241 +0x00,0x00,0x00,0x00,0x00,0x7e,0xdb,0xdb,0xdb,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,
  242 +0x00,0x00,0x00,0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0,0x00,0x00,0x00,0x00,
  243 +0x00,0x00,0x1c,0x30,0x60,0x60,0x7c,0x60,0x60,0x60,0x30,0x1c,0x00,0x00,0x00,0x00,
  244 +0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
  245 +0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
  246 +0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
  247 +0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,0x7e,0x00,0x00,0x00,0x00,
  248 +0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x7e,0x00,0x00,0x00,0x00,
  249 +0x00,0x00,0x0e,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
  250 +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00,
  251 +0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
  252 +0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,
  253 +0x00,0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  254 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  255 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  256 +0x00,0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c,0x00,0x00,0x00,0x00,
  257 +0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  258 +0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  259 +0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00,
  260 +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  261 +};
  262 +static int default8x16FontMetaData[256*5+1]={
  263 +0,8,16,0,0,16,8,16,0,0,32,8,16,0,0,48,8,16,0,0,64,8,16,0,0,80,8,16,0,0,96,8,16,0,0,112,8,16,0,0,128,8,16,0,0,144,8,16,0,0,160,8,16,0,0,176,8,16,0,0,192,8,16,0,0,208,8,16,0,0,224,8,16,0,0,240,8,16,0,0,256,8,16,0,0,272,8,16,0,0,288,8,16,0,0,304,8,16,0,0,320,8,16,0,0,336,8,16,0,0,352,8,16,0,0,368,8,16,0,0,384,8,16,0,0,400,8,16,0,0,416,8,16,0,0,432,8,16,0,0,448,8,16,0,0,464,8,16,0,0,480,8,16,0,0,496,8,16,0,0,512,8,16,0,0,528,8,16,0,0,544,8,16,0,0,560,8,16,0,0,576,8,16,0,0,592,8,16,0,0,608,8,16,0,0,624,8,16,0,0,640,8,16,0,0,656,8,16,0,0,672,8,16,0,0,688,8,16,0,0,704,8,16,0,0,720,8,16,0,0,736,8,16,0,0,752,8,16,0,0,768,8,16,0,0,784,8,16,0,0,800,8,16,0,0,816,8,16,0,0,832,8,16,0,0,848,8,16,0,0,864,8,16,0,0,880,8,16,0,0,896,8,16,0,0,912,8,16,0,0,928,8,16,0,0,944,8,16,0,0,960,8,16,0,0,976,8,16,0,0,992,8,16,0,0,1008,8,16,0,0,1024,8,16,0,0,1040,8,16,0,0,1056,8,16,0,0,1072,8,16,0,0,1088,8,16,0,0,1104,8,16,0,0,1120,8,16,0,0,1136,8,16,0,0,1152,8,16,0,0,1168,8,16,0,0,1184,8,16,0,0,1200,8,16,0,0,1216,8,16,0,0,1232,8,16,0,0,1248,8,16,0,0,1264,8,16,0,0,1280,8,16,0,0,1296,8,16,0,0,1312,8,16,0,0,1328,8,16,0,0,1344,8,16,0,0,1360,8,16,0,0,1376,8,16,0,0,1392,8,16,0,0,1408,8,16,0,0,1424,8,16,0,0,1440,8,16,0,0,1456,8,16,0,0,1472,8,16,0,0,1488,8,16,0,0,1504,8,16,0,0,1520,8,16,0,0,1536,8,16,0,0,1552,8,16,0,0,1568,8,16,0,0,1584,8,16,0,0,1600,8,16,0,0,1616,8,16,0,0,1632,8,16,0,0,1648,8,16,0,0,1664,8,16,0,0,1680,8,16,0,0,1696,8,16,0,0,1712,8,16,0,0,1728,8,16,0,0,1744,8,16,0,0,1760,8,16,0,0,1776,8,16,0,0,1792,8,16,0,0,1808,8,16,0,0,1824,8,16,0,0,1840,8,16,0,0,1856,8,16,0,0,1872,8,16,0,0,1888,8,16,0,0,1904,8,16,0,0,1920,8,16,0,0,1936,8,16,0,0,1952,8,16,0,0,1968,8,16,0,0,1984,8,16,0,0,2000,8,16,0,0,2016,8,16,0,0,2032,8,16,0,0,2048,8,16,0,0,2064,8,16,0,0,2080,8,16,0,0,2096,8,16,0,0,2112,8,16,0,0,2128,8,16,0,0,2144,8,16,0,0,2160,8,16,0,0,2176,8,16,0,0,2192,8,16,0,0,2208,8,16,0,0,2224,8,16,0,0,2240,8,16,0,0,2256,8,16,0,0,2272,8,16,0,0,2288,8,16,0,0,2304,8,16,0,0,2320,8,16,0,0,2336,8,16,0,0,2352,8,16,0,0,2368,8,16,0,0,2384,8,16,0,0,2400,8,16,0,0,2416,8,16,0,0,2432,8,16,0,0,2448,8,16,0,0,2464,8,16,0,0,2480,8,16,0,0,2496,8,16,0,0,2512,8,16,0,0,2528,8,16,0,0,2544,8,16,0,0,2560,8,16,0,0,2576,8,16,0,0,2592,8,16,0,0,2608,8,16,0,0,2624,8,16,0,0,2640,8,16,0,0,2656,8,16,0,0,2672,8,16,0,0,2688,8,16,0,0,2704,8,16,0,0,2720,8,16,0,0,2736,8,16,0,0,2752,8,16,0,0,2768,8,16,0,0,2784,8,16,0,0,2800,8,16,0,0,2816,8,16,0,0,2832,8,16,0,0,2848,8,16,0,0,2864,8,16,0,0,2880,8,16,0,0,2896,8,16,0,0,2912,8,16,0,0,2928,8,16,0,0,2944,8,16,0,0,2960,8,16,0,0,2976,8,16,0,0,2992,8,16,0,0,3008,8,16,0,0,3024,8,16,0,0,3040,8,16,0,0,3056,8,16,0,0,3072,8,16,0,0,3088,8,16,0,0,3104,8,16,0,0,3120,8,16,0,0,3136,8,16,0,0,3152,8,16,0,0,3168,8,16,0,0,3184,8,16,0,0,3200,8,16,0,0,3216,8,16,0,0,3232,8,16,0,0,3248,8,16,0,0,3264,8,16,0,0,3280,8,16,0,0,3296,8,16,0,0,3312,8,16,0,0,3328,8,16,0,0,3344,8,16,0,0,3360,8,16,0,0,3376,8,16,0,0,3392,8,16,0,0,3408,8,16,0,0,3424,8,16,0,0,3440,8,16,0,0,3456,8,16,0,0,3472,8,16,0,0,3488,8,16,0,0,3504,8,16,0,0,3520,8,16,0,0,3536,8,16,0,0,3552,8,16,0,0,3568,8,16,0,0,3584,8,16,0,0,3600,8,16,0,0,3616,8,16,0,0,3632,8,16,0,0,3648,8,16,0,0,3664,8,16,0,0,3680,8,16,0,0,3696,8,16,0,0,3712,8,16,0,0,3728,8,16,0,0,3744,8,16,0,0,3760,8,16,0,0,3776,8,16,0,0,3792,8,16,0,0,3808,8,16,0,0,3824,8,16,0,0,3840,8,16,0,0,3856,8,16,0,0,3872,8,16,0,0,3888,8,16,0,0,3904,8,16,0,0,3920,8,16,0,0,3936,8,16,0,0,3952,8,16,0,0,3968,8,16,0,0,3984,8,16,0,0,4000,8,16,0,0,4016,8,16,0,0,4032,8,16,0,0,4048,8,16,0,0,4064,8,16,0,0,4080,8,16,0,0,};
  264 +static rfbFontData default8x16Font = { default8x16FontData, default8x16FontMetaData };
  265 +
  266 +#endif
@@ -0,0 +1,1638 @@ @@ -0,0 +1,1638 @@
  1 +#ifndef XK_0
  2 +
  3 +/* $XConsortium: keysym.h,v 1.15 94/04/17 20:10:55 rws Exp $ */
  4 +
  5 +/***********************************************************
  6 +
  7 +Copyright (c) 1987 X Consortium
  8 +
  9 +Permission is hereby granted, free of charge, to any person obtaining a copy
  10 +of this software and associated documentation files (the "Software"), to deal
  11 +in the Software without restriction, including without limitation the rights
  12 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13 +copies of the Software, and to permit persons to whom the Software is
  14 +furnished to do so, subject to the following conditions:
  15 +
  16 +The above copyright notice and this permission notice shall be included in
  17 +all copies or substantial portions of the Software.
  18 +
  19 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22 +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23 +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25 +
  26 +Except as contained in this notice, the name of the X Consortium shall not be
  27 +used in advertising or otherwise to promote the sale, use or other dealings
  28 +in this Software without prior written authorization from the X Consortium.
  29 +
  30 +
  31 +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  32 +
  33 + All Rights Reserved
  34 +
  35 +Permission to use, copy, modify, and distribute this software and its
  36 +documentation for any purpose and without fee is hereby granted,
  37 +provided that the above copyright notice appear in all copies and that
  38 +both that copyright notice and this permission notice appear in
  39 +supporting documentation, and that the name of Digital not be
  40 +used in advertising or publicity pertaining to distribution of the
  41 +software without specific, written prior permission.
  42 +
  43 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  44 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  45 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  46 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  47 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  48 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  49 +SOFTWARE.
  50 +
  51 +******************************************************************/
  52 +
  53 +/* default keysyms */
  54 +#define XK_MISCELLANY
  55 +#define XK_XKB_KEYS
  56 +#define XK_LATIN1
  57 +#define XK_LATIN2
  58 +#define XK_LATIN3
  59 +#define XK_LATIN4
  60 +#define XK_GREEK
  61 +
  62 +/* $TOG: keysymdef.h /main/25 1997/06/21 10:54:51 kaleb $ */
  63 +
  64 +/***********************************************************
  65 +Copyright (c) 1987, 1994 X Consortium
  66 +
  67 +Permission is hereby granted, free of charge, to any person obtaining
  68 +a copy of this software and associated documentation files (the
  69 +"Software"), to deal in the Software without restriction, including
  70 +without limitation the rights to use, copy, modify, merge, publish,
  71 +distribute, sublicense, and/or sell copies of the Software, and to
  72 +permit persons to whom the Software is furnished to do so, subject to
  73 +the following conditions:
  74 +
  75 +The above copyright notice and this permission notice shall be included
  76 +in all copies or substantial portions of the Software.
  77 +
  78 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  79 +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  80 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  81 +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
  82 +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  83 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  84 +OTHER DEALINGS IN THE SOFTWARE.
  85 +
  86 +Except as contained in this notice, the name of the X Consortium shall
  87 +not be used in advertising or otherwise to promote the sale, use or
  88 +other dealings in this Software without prior written authorization
  89 +from the X Consortium.
  90 +
  91 +
  92 +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
  93 +
  94 + All Rights Reserved
  95 +
  96 +Permission to use, copy, modify, and distribute this software and its
  97 +documentation for any purpose and without fee is hereby granted,
  98 +provided that the above copyright notice appear in all copies and that
  99 +both that copyright notice and this permission notice appear in
  100 +supporting documentation, and that the name of Digital not be
  101 +used in advertising or publicity pertaining to distribution of the
  102 +software without specific, written prior permission.
  103 +
  104 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  105 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  106 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  107 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  108 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  109 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  110 +SOFTWARE.
  111 +
  112 +******************************************************************/
  113 +
  114 +#define XK_VoidSymbol 0xFFFFFF /* void symbol */
  115 +
  116 +#ifdef XK_MISCELLANY
  117 +/*
  118 + * TTY Functions, cleverly chosen to map to ascii, for convenience of
  119 + * programming, but could have been arbitrary (at the cost of lookup
  120 + * tables in client code.
  121 + */
  122 +
  123 +#define XK_BackSpace 0xFF08 /* back space, back char */
  124 +#define XK_Tab 0xFF09
  125 +#define XK_Linefeed 0xFF0A /* Linefeed, LF */
  126 +#define XK_Clear 0xFF0B
  127 +#define XK_Return 0xFF0D /* Return, enter */
  128 +#define XK_Pause 0xFF13 /* Pause, hold */
  129 +#define XK_Scroll_Lock 0xFF14
  130 +#define XK_Sys_Req 0xFF15
  131 +#define XK_Escape 0xFF1B
  132 +#define XK_Delete 0xFFFF /* Delete, rubout */
  133 +
  134 +
  135 +
  136 +/* International & multi-key character composition */
  137 +
  138 +#define XK_Multi_key 0xFF20 /* Multi-key character compose */
  139 +#define XK_SingleCandidate 0xFF3C
  140 +#define XK_MultipleCandidate 0xFF3D
  141 +#define XK_PreviousCandidate 0xFF3E
  142 +
  143 +/* Japanese keyboard support */
  144 +
  145 +#define XK_Kanji 0xFF21 /* Kanji, Kanji convert */
  146 +#define XK_Muhenkan 0xFF22 /* Cancel Conversion */
  147 +#define XK_Henkan_Mode 0xFF23 /* Start/Stop Conversion */
  148 +#define XK_Henkan 0xFF23 /* Alias for Henkan_Mode */
  149 +#define XK_Romaji 0xFF24 /* to Romaji */
  150 +#define XK_Hiragana 0xFF25 /* to Hiragana */
  151 +#define XK_Katakana 0xFF26 /* to Katakana */
  152 +#define XK_Hiragana_Katakana 0xFF27 /* Hiragana/Katakana toggle */
  153 +#define XK_Zenkaku 0xFF28 /* to Zenkaku */
  154 +#define XK_Hankaku 0xFF29 /* to Hankaku */
  155 +#define XK_Zenkaku_Hankaku 0xFF2A /* Zenkaku/Hankaku toggle */
  156 +#define XK_Touroku 0xFF2B /* Add to Dictionary */
  157 +#define XK_Massyo 0xFF2C /* Delete from Dictionary */
  158 +#define XK_Kana_Lock 0xFF2D /* Kana Lock */
  159 +#define XK_Kana_Shift 0xFF2E /* Kana Shift */
  160 +#define XK_Eisu_Shift 0xFF2F /* Alphanumeric Shift */
  161 +#define XK_Eisu_toggle 0xFF30 /* Alphanumeric toggle */
  162 +#define XK_Zen_Koho 0xFF3D /* Multiple/All Candidate(s) */
  163 +#define XK_Mae_Koho 0xFF3E /* Previous Candidate */
  164 +
  165 +/* 0xFF31 through 0xFF3F are under XK_KOREAN */
  166 +
  167 +/* Cursor control & motion */
  168 +
  169 +#define XK_Home 0xFF50
  170 +#define XK_Left 0xFF51 /* Move left, left arrow */
  171 +#define XK_Up 0xFF52 /* Move up, up arrow */
  172 +#define XK_Right 0xFF53 /* Move right, right arrow */
  173 +#define XK_Down 0xFF54 /* Move down, down arrow */
  174 +#define XK_Prior 0xFF55 /* Prior, previous */
  175 +#define XK_Page_Up 0xFF55
  176 +#define XK_Next 0xFF56 /* Next */
  177 +#define XK_Page_Down 0xFF56
  178 +#define XK_End 0xFF57 /* EOL */
  179 +#define XK_Begin 0xFF58 /* BOL */
  180 +
  181 +
  182 +/* Misc Functions */
  183 +
  184 +#define XK_Select 0xFF60 /* Select, mark */
  185 +#define XK_Print 0xFF61
  186 +#define XK_Execute 0xFF62 /* Execute, run, do */
  187 +#define XK_Insert 0xFF63 /* Insert, insert here */
  188 +#define XK_Undo 0xFF65 /* Undo, oops */
  189 +#define XK_Redo 0xFF66 /* redo, again */
  190 +#define XK_Menu 0xFF67
  191 +#define XK_Find 0xFF68 /* Find, search */
  192 +#define XK_Cancel 0xFF69 /* Cancel, stop, abort, exit */
  193 +#define XK_Help 0xFF6A /* Help */
  194 +#define XK_Break 0xFF6B
  195 +#define XK_Mode_switch 0xFF7E /* Character set switch */
  196 +#define XK_script_switch 0xFF7E /* Alias for mode_switch */
  197 +#define XK_Num_Lock 0xFF7F
  198 +
  199 +/* Keypad Functions, keypad numbers cleverly chosen to map to ascii */
  200 +
  201 +#define XK_KP_Space 0xFF80 /* space */
  202 +#define XK_KP_Tab 0xFF89
  203 +#define XK_KP_Enter 0xFF8D /* enter */
  204 +#define XK_KP_F1 0xFF91 /* PF1, KP_A, ... */
  205 +#define XK_KP_F2 0xFF92
  206 +#define XK_KP_F3 0xFF93
  207 +#define XK_KP_F4 0xFF94
  208 +#define XK_KP_Home 0xFF95
  209 +#define XK_KP_Left 0xFF96
  210 +#define XK_KP_Up 0xFF97
  211 +#define XK_KP_Right 0xFF98
  212 +#define XK_KP_Down 0xFF99
  213 +#define XK_KP_Prior 0xFF9A
  214 +#define XK_KP_Page_Up 0xFF9A
  215 +#define XK_KP_Next 0xFF9B
  216 +#define XK_KP_Page_Down 0xFF9B
  217 +#define XK_KP_End 0xFF9C
  218 +#define XK_KP_Begin 0xFF9D
  219 +#define XK_KP_Insert 0xFF9E
  220 +#define XK_KP_Delete 0xFF9F
  221 +#define XK_KP_Equal 0xFFBD /* equals */
  222 +#define XK_KP_Multiply 0xFFAA
  223 +#define XK_KP_Add 0xFFAB
  224 +#define XK_KP_Separator 0xFFAC /* separator, often comma */
  225 +#define XK_KP_Subtract 0xFFAD
  226 +#define XK_KP_Decimal 0xFFAE
  227 +#define XK_KP_Divide 0xFFAF
  228 +
  229 +#define XK_KP_0 0xFFB0
  230 +#define XK_KP_1 0xFFB1
  231 +#define XK_KP_2 0xFFB2
  232 +#define XK_KP_3 0xFFB3
  233 +#define XK_KP_4 0xFFB4
  234 +#define XK_KP_5 0xFFB5
  235 +#define XK_KP_6 0xFFB6
  236 +#define XK_KP_7 0xFFB7
  237 +#define XK_KP_8 0xFFB8
  238 +#define XK_KP_9 0xFFB9
  239 +
  240 +
  241 +
  242 +/*
  243 + * Auxiliary Functions; note the duplicate definitions for left and right
  244 + * function keys; Sun keyboards and a few other manufactures have such
  245 + * function key groups on the left and/or right sides of the keyboard.
  246 + * We've not found a keyboard with more than 35 function keys total.
  247 + */
  248 +
  249 +#define XK_F1 0xFFBE
  250 +#define XK_F2 0xFFBF
  251 +#define XK_F3 0xFFC0
  252 +#define XK_F4 0xFFC1
  253 +#define XK_F5 0xFFC2
  254 +#define XK_F6 0xFFC3
  255 +#define XK_F7 0xFFC4
  256 +#define XK_F8 0xFFC5
  257 +#define XK_F9 0xFFC6
  258 +#define XK_F10 0xFFC7
  259 +#define XK_F11 0xFFC8
  260 +#define XK_L1 0xFFC8
  261 +#define XK_F12 0xFFC9
  262 +#define XK_L2 0xFFC9
  263 +#define XK_F13 0xFFCA
  264 +#define XK_L3 0xFFCA
  265 +#define XK_F14 0xFFCB
  266 +#define XK_L4 0xFFCB
  267 +#define XK_F15 0xFFCC
  268 +#define XK_L5 0xFFCC
  269 +#define XK_F16 0xFFCD
  270 +#define XK_L6 0xFFCD
  271 +#define XK_F17 0xFFCE
  272 +#define XK_L7 0xFFCE
  273 +#define XK_F18 0xFFCF
  274 +#define XK_L8 0xFFCF
  275 +#define XK_F19 0xFFD0
  276 +#define XK_L9 0xFFD0
  277 +#define XK_F20 0xFFD1
  278 +#define XK_L10 0xFFD1
  279 +#define XK_F21 0xFFD2
  280 +#define XK_R1 0xFFD2
  281 +#define XK_F22 0xFFD3
  282 +#define XK_R2 0xFFD3
  283 +#define XK_F23 0xFFD4
  284 +#define XK_R3 0xFFD4
  285 +#define XK_F24 0xFFD5
  286 +#define XK_R4 0xFFD5
  287 +#define XK_F25 0xFFD6
  288 +#define XK_R5 0xFFD6
  289 +#define XK_F26 0xFFD7
  290 +#define XK_R6 0xFFD7
  291 +#define XK_F27 0xFFD8
  292 +#define XK_R7 0xFFD8
  293 +#define XK_F28 0xFFD9
  294 +#define XK_R8 0xFFD9
  295 +#define XK_F29 0xFFDA
  296 +#define XK_R9 0xFFDA
  297 +#define XK_F30 0xFFDB
  298 +#define XK_R10 0xFFDB
  299 +#define XK_F31 0xFFDC
  300 +#define XK_R11 0xFFDC
  301 +#define XK_F32 0xFFDD
  302 +#define XK_R12 0xFFDD
  303 +#define XK_F33 0xFFDE
  304 +#define XK_R13 0xFFDE
  305 +#define XK_F34 0xFFDF
  306 +#define XK_R14 0xFFDF
  307 +#define XK_F35 0xFFE0
  308 +#define XK_R15 0xFFE0
  309 +
  310 +/* Modifiers */
  311 +
  312 +#define XK_Shift_L 0xFFE1 /* Left shift */
  313 +#define XK_Shift_R 0xFFE2 /* Right shift */
  314 +#define XK_Control_L 0xFFE3 /* Left control */
  315 +#define XK_Control_R 0xFFE4 /* Right control */
  316 +#define XK_Caps_Lock 0xFFE5 /* Caps lock */
  317 +#define XK_Shift_Lock 0xFFE6 /* Shift lock */
  318 +
  319 +#define XK_Meta_L 0xFFE7 /* Left meta */
  320 +#define XK_Meta_R 0xFFE8 /* Right meta */
  321 +#define XK_Alt_L 0xFFE9 /* Left alt */
  322 +#define XK_Alt_R 0xFFEA /* Right alt */
  323 +#define XK_Super_L 0xFFEB /* Left super */
  324 +#define XK_Super_R 0xFFEC /* Right super */
  325 +#define XK_Hyper_L 0xFFED /* Left hyper */
  326 +#define XK_Hyper_R 0xFFEE /* Right hyper */
  327 +#endif /* XK_MISCELLANY */
  328 +
  329 +/*
  330 + * ISO 9995 Function and Modifier Keys
  331 + * Byte 3 = 0xFE
  332 + */
  333 +
  334 +#ifdef XK_XKB_KEYS
  335 +#define XK_ISO_Lock 0xFE01
  336 +#define XK_ISO_Level2_Latch 0xFE02
  337 +#define XK_ISO_Level3_Shift 0xFE03
  338 +#define XK_ISO_Level3_Latch 0xFE04
  339 +#define XK_ISO_Level3_Lock 0xFE05
  340 +#define XK_ISO_Group_Shift 0xFF7E /* Alias for mode_switch */
  341 +#define XK_ISO_Group_Latch 0xFE06
  342 +#define XK_ISO_Group_Lock 0xFE07
  343 +#define XK_ISO_Next_Group 0xFE08
  344 +#define XK_ISO_Next_Group_Lock 0xFE09
  345 +#define XK_ISO_Prev_Group 0xFE0A
  346 +#define XK_ISO_Prev_Group_Lock 0xFE0B
  347 +#define XK_ISO_First_Group 0xFE0C
  348 +#define XK_ISO_First_Group_Lock 0xFE0D
  349 +#define XK_ISO_Last_Group 0xFE0E
  350 +#define XK_ISO_Last_Group_Lock 0xFE0F
  351 +
  352 +#define XK_ISO_Left_Tab 0xFE20
  353 +#define XK_ISO_Move_Line_Up 0xFE21
  354 +#define XK_ISO_Move_Line_Down 0xFE22
  355 +#define XK_ISO_Partial_Line_Up 0xFE23
  356 +#define XK_ISO_Partial_Line_Down 0xFE24
  357 +#define XK_ISO_Partial_Space_Left 0xFE25
  358 +#define XK_ISO_Partial_Space_Right 0xFE26
  359 +#define XK_ISO_Set_Margin_Left 0xFE27
  360 +#define XK_ISO_Set_Margin_Right 0xFE28
  361 +#define XK_ISO_Release_Margin_Left 0xFE29
  362 +#define XK_ISO_Release_Margin_Right 0xFE2A
  363 +#define XK_ISO_Release_Both_Margins 0xFE2B
  364 +#define XK_ISO_Fast_Cursor_Left 0xFE2C
  365 +#define XK_ISO_Fast_Cursor_Right 0xFE2D
  366 +#define XK_ISO_Fast_Cursor_Up 0xFE2E
  367 +#define XK_ISO_Fast_Cursor_Down 0xFE2F
  368 +#define XK_ISO_Continuous_Underline 0xFE30
  369 +#define XK_ISO_Discontinuous_Underline 0xFE31
  370 +#define XK_ISO_Emphasize 0xFE32
  371 +#define XK_ISO_Center_Object 0xFE33
  372 +#define XK_ISO_Enter 0xFE34
  373 +
  374 +#define XK_dead_grave 0xFE50
  375 +#define XK_dead_acute 0xFE51
  376 +#define XK_dead_circumflex 0xFE52
  377 +#define XK_dead_tilde 0xFE53
  378 +#define XK_dead_macron 0xFE54
  379 +#define XK_dead_breve 0xFE55
  380 +#define XK_dead_abovedot 0xFE56
  381 +#define XK_dead_diaeresis 0xFE57
  382 +#define XK_dead_abovering 0xFE58
  383 +#define XK_dead_doubleacute 0xFE59
  384 +#define XK_dead_caron 0xFE5A
  385 +#define XK_dead_cedilla 0xFE5B
  386 +#define XK_dead_ogonek 0xFE5C
  387 +#define XK_dead_iota 0xFE5D
  388 +#define XK_dead_voiced_sound 0xFE5E
  389 +#define XK_dead_semivoiced_sound 0xFE5F
  390 +#define XK_dead_belowdot 0xFE60
  391 +
  392 +#define XK_First_Virtual_Screen 0xFED0
  393 +#define XK_Prev_Virtual_Screen 0xFED1
  394 +#define XK_Next_Virtual_Screen 0xFED2
  395 +#define XK_Last_Virtual_Screen 0xFED4
  396 +#define XK_Terminate_Server 0xFED5
  397 +
  398 +#define XK_AccessX_Enable 0xFE70
  399 +#define XK_AccessX_Feedback_Enable 0xFE71
  400 +#define XK_RepeatKeys_Enable 0xFE72
  401 +#define XK_SlowKeys_Enable 0xFE73
  402 +#define XK_BounceKeys_Enable 0xFE74
  403 +#define XK_StickyKeys_Enable 0xFE75
  404 +#define XK_MouseKeys_Enable 0xFE76
  405 +#define XK_MouseKeys_Accel_Enable 0xFE77
  406 +#define XK_Overlay1_Enable 0xFE78
  407 +#define XK_Overlay2_Enable 0xFE79
  408 +#define XK_AudibleBell_Enable 0xFE7A
  409 +
  410 +#define XK_Pointer_Left 0xFEE0
  411 +#define XK_Pointer_Right 0xFEE1
  412 +#define XK_Pointer_Up 0xFEE2
  413 +#define XK_Pointer_Down 0xFEE3
  414 +#define XK_Pointer_UpLeft 0xFEE4
  415 +#define XK_Pointer_UpRight 0xFEE5
  416 +#define XK_Pointer_DownLeft 0xFEE6
  417 +#define XK_Pointer_DownRight 0xFEE7
  418 +#define XK_Pointer_Button_Dflt 0xFEE8
  419 +#define XK_Pointer_Button1 0xFEE9
  420 +#define XK_Pointer_Button2 0xFEEA
  421 +#define XK_Pointer_Button3 0xFEEB
  422 +#define XK_Pointer_Button4 0xFEEC
  423 +#define XK_Pointer_Button5 0xFEED
  424 +#define XK_Pointer_DblClick_Dflt 0xFEEE
  425 +#define XK_Pointer_DblClick1 0xFEEF
  426 +#define XK_Pointer_DblClick2 0xFEF0
  427 +#define XK_Pointer_DblClick3 0xFEF1
  428 +#define XK_Pointer_DblClick4 0xFEF2
  429 +#define XK_Pointer_DblClick5 0xFEF3
  430 +#define XK_Pointer_Drag_Dflt 0xFEF4
  431 +#define XK_Pointer_Drag1 0xFEF5
  432 +#define XK_Pointer_Drag2 0xFEF6
  433 +#define XK_Pointer_Drag3 0xFEF7
  434 +#define XK_Pointer_Drag4 0xFEF8
  435 +#define XK_Pointer_Drag5 0xFEFD
  436 +
  437 +#define XK_Pointer_EnableKeys 0xFEF9
  438 +#define XK_Pointer_Accelerate 0xFEFA
  439 +#define XK_Pointer_DfltBtnNext 0xFEFB
  440 +#define XK_Pointer_DfltBtnPrev 0xFEFC
  441 +
  442 +#endif
  443 +
  444 +/*
  445 + * 3270 Terminal Keys
  446 + * Byte 3 = 0xFD
  447 + */
  448 +
  449 +#ifdef XK_3270
  450 +#define XK_3270_Duplicate 0xFD01
  451 +#define XK_3270_FieldMark 0xFD02
  452 +#define XK_3270_Right2 0xFD03
  453 +#define XK_3270_Left2 0xFD04
  454 +#define XK_3270_BackTab 0xFD05
  455 +#define XK_3270_EraseEOF 0xFD06
  456 +#define XK_3270_EraseInput 0xFD07
  457 +#define XK_3270_Reset 0xFD08
  458 +#define XK_3270_Quit 0xFD09
  459 +#define XK_3270_PA1 0xFD0A
  460 +#define XK_3270_PA2 0xFD0B
  461 +#define XK_3270_PA3 0xFD0C
  462 +#define XK_3270_Test 0xFD0D
  463 +#define XK_3270_Attn 0xFD0E
  464 +#define XK_3270_CursorBlink 0xFD0F
  465 +#define XK_3270_AltCursor 0xFD10
  466 +#define XK_3270_KeyClick 0xFD11
  467 +#define XK_3270_Jump 0xFD12
  468 +#define XK_3270_Ident 0xFD13
  469 +#define XK_3270_Rule 0xFD14
  470 +#define XK_3270_Copy 0xFD15
  471 +#define XK_3270_Play 0xFD16
  472 +#define XK_3270_Setup 0xFD17
  473 +#define XK_3270_Record 0xFD18
  474 +#define XK_3270_ChangeScreen 0xFD19
  475 +#define XK_3270_DeleteWord 0xFD1A
  476 +#define XK_3270_ExSelect 0xFD1B
  477 +#define XK_3270_CursorSelect 0xFD1C
  478 +#define XK_3270_PrintScreen 0xFD1D
  479 +#define XK_3270_Enter 0xFD1E
  480 +#endif
  481 +
  482 +/*
  483 + * Latin 1
  484 + * Byte 3 = 0
  485 + */
  486 +#ifdef XK_LATIN1
  487 +#define XK_space 0x020
  488 +#define XK_exclam 0x021
  489 +#define XK_quotedbl 0x022
  490 +#define XK_numbersign 0x023
  491 +#define XK_dollar 0x024
  492 +#define XK_percent 0x025
  493 +#define XK_ampersand 0x026
  494 +#define XK_apostrophe 0x027
  495 +#define XK_quoteright 0x027 /* deprecated */
  496 +#define XK_parenleft 0x028
  497 +#define XK_parenright 0x029
  498 +#define XK_asterisk 0x02a
  499 +#define XK_plus 0x02b
  500 +#define XK_comma 0x02c
  501 +#define XK_minus 0x02d
  502 +#define XK_period 0x02e
  503 +#define XK_slash 0x02f
  504 +#define XK_0 0x030
  505 +#define XK_1 0x031
  506 +#define XK_2 0x032
  507 +#define XK_3 0x033
  508 +#define XK_4 0x034
  509 +#define XK_5 0x035
  510 +#define XK_6 0x036
  511 +#define XK_7 0x037
  512 +#define XK_8 0x038
  513 +#define XK_9 0x039
  514 +#define XK_colon 0x03a
  515 +#define XK_semicolon 0x03b
  516 +#define XK_less 0x03c
  517 +#define XK_equal 0x03d
  518 +#define XK_greater 0x03e
  519 +#define XK_question 0x03f
  520 +#define XK_at 0x040
  521 +#define XK_A 0x041
  522 +#define XK_B 0x042
  523 +#define XK_C 0x043
  524 +#define XK_D 0x044
  525 +#define XK_E 0x045
  526 +#define XK_F 0x046
  527 +#define XK_G 0x047
  528 +#define XK_H 0x048
  529 +#define XK_I 0x049
  530 +#define XK_J 0x04a
  531 +#define XK_K 0x04b
  532 +#define XK_L 0x04c
  533 +#define XK_M 0x04d
  534 +#define XK_N 0x04e
  535 +#define XK_O 0x04f
  536 +#define XK_P 0x050
  537 +#define XK_Q 0x051
  538 +#define XK_R 0x052
  539 +#define XK_S 0x053
  540 +#define XK_T 0x054
  541 +#define XK_U 0x055
  542 +#define XK_V 0x056
  543 +#define XK_W 0x057
  544 +#define XK_X 0x058
  545 +#define XK_Y 0x059
  546 +#define XK_Z 0x05a
  547 +#define XK_bracketleft 0x05b
  548 +#define XK_backslash 0x05c
  549 +#define XK_bracketright 0x05d
  550 +#define XK_asciicircum 0x05e
  551 +#define XK_underscore 0x05f
  552 +#define XK_grave 0x060
  553 +#define XK_quoteleft 0x060 /* deprecated */
  554 +#define XK_a 0x061
  555 +#define XK_b 0x062
  556 +#define XK_c 0x063
  557 +#define XK_d 0x064
  558 +#define XK_e 0x065
  559 +#define XK_f 0x066
  560 +#define XK_g 0x067
  561 +#define XK_h 0x068
  562 +#define XK_i 0x069
  563 +#define XK_j 0x06a
  564 +#define XK_k 0x06b
  565 +#define XK_l 0x06c
  566 +#define XK_m 0x06d
  567 +#define XK_n 0x06e
  568 +#define XK_o 0x06f
  569 +#define XK_p 0x070
  570 +#define XK_q 0x071
  571 +#define XK_r 0x072
  572 +#define XK_s 0x073
  573 +#define XK_t 0x074
  574 +#define XK_u 0x075
  575 +#define XK_v 0x076
  576 +#define XK_w 0x077
  577 +#define XK_x 0x078
  578 +#define XK_y 0x079
  579 +#define XK_z 0x07a
  580 +#define XK_braceleft 0x07b
  581 +#define XK_bar 0x07c
  582 +#define XK_braceright 0x07d
  583 +#define XK_asciitilde 0x07e
  584 +
  585 +#define XK_nobreakspace 0x0a0
  586 +#define XK_exclamdown 0x0a1
  587 +#define XK_cent 0x0a2
  588 +#define XK_sterling 0x0a3
  589 +#define XK_currency 0x0a4
  590 +#define XK_yen 0x0a5
  591 +#define XK_brokenbar 0x0a6
  592 +#define XK_section 0x0a7
  593 +#define XK_diaeresis 0x0a8
  594 +#define XK_copyright 0x0a9
  595 +#define XK_ordfeminine 0x0aa
  596 +#define XK_guillemotleft 0x0ab /* left angle quotation mark */
  597 +#define XK_notsign 0x0ac
  598 +#define XK_hyphen 0x0ad
  599 +#define XK_registered 0x0ae
  600 +#define XK_macron 0x0af
  601 +#define XK_degree 0x0b0
  602 +#define XK_plusminus 0x0b1
  603 +#define XK_twosuperior 0x0b2
  604 +#define XK_threesuperior 0x0b3
  605 +#define XK_acute 0x0b4
  606 +#define XK_mu 0x0b5
  607 +#define XK_paragraph 0x0b6
  608 +#define XK_periodcentered 0x0b7
  609 +#define XK_cedilla 0x0b8
  610 +#define XK_onesuperior 0x0b9
  611 +#define XK_masculine 0x0ba
  612 +#define XK_guillemotright 0x0bb /* right angle quotation mark */
  613 +#define XK_onequarter 0x0bc
  614 +#define XK_onehalf 0x0bd
  615 +#define XK_threequarters 0x0be
  616 +#define XK_questiondown 0x0bf
  617 +#define XK_Agrave 0x0c0
  618 +#define XK_Aacute 0x0c1
  619 +#define XK_Acircumflex 0x0c2
  620 +#define XK_Atilde 0x0c3
  621 +#define XK_Adiaeresis 0x0c4
  622 +#define XK_Aring 0x0c5
  623 +#define XK_AE 0x0c6
  624 +#define XK_Ccedilla 0x0c7
  625 +#define XK_Egrave 0x0c8
  626 +#define XK_Eacute 0x0c9
  627 +#define XK_Ecircumflex 0x0ca
  628 +#define XK_Ediaeresis 0x0cb
  629 +#define XK_Igrave 0x0cc
  630 +#define XK_Iacute 0x0cd
  631 +#define XK_Icircumflex 0x0ce
  632 +#define XK_Idiaeresis 0x0cf
  633 +#define XK_ETH 0x0d0
  634 +#define XK_Eth 0x0d0 /* deprecated */
  635 +#define XK_Ntilde 0x0d1
  636 +#define XK_Ograve 0x0d2
  637 +#define XK_Oacute 0x0d3
  638 +#define XK_Ocircumflex 0x0d4
  639 +#define XK_Otilde 0x0d5
  640 +#define XK_Odiaeresis 0x0d6
  641 +#define XK_multiply 0x0d7
  642 +#define XK_Ooblique 0x0d8
  643 +#define XK_Ugrave 0x0d9
  644 +#define XK_Uacute 0x0da
  645 +#define XK_Ucircumflex 0x0db
  646 +#define XK_Udiaeresis 0x0dc
  647 +#define XK_Yacute 0x0dd
  648 +#define XK_THORN 0x0de
  649 +#define XK_Thorn 0x0de /* deprecated */
  650 +#define XK_ssharp 0x0df
  651 +#define XK_agrave 0x0e0
  652 +#define XK_aacute 0x0e1
  653 +#define XK_acircumflex 0x0e2
  654 +#define XK_atilde 0x0e3
  655 +#define XK_adiaeresis 0x0e4
  656 +#define XK_aring 0x0e5
  657 +#define XK_ae 0x0e6
  658 +#define XK_ccedilla 0x0e7
  659 +#define XK_egrave 0x0e8
  660 +#define XK_eacute 0x0e9
  661 +#define XK_ecircumflex 0x0ea
  662 +#define XK_ediaeresis 0x0eb
  663 +#define XK_igrave 0x0ec
  664 +#define XK_iacute 0x0ed
  665 +#define XK_icircumflex 0x0ee
  666 +#define XK_idiaeresis 0x0ef
  667 +#define XK_eth 0x0f0
  668 +#define XK_ntilde 0x0f1
  669 +#define XK_ograve 0x0f2
  670 +#define XK_oacute 0x0f3
  671 +#define XK_ocircumflex 0x0f4
  672 +#define XK_otilde 0x0f5
  673 +#define XK_odiaeresis 0x0f6
  674 +#define XK_division 0x0f7
  675 +#define XK_oslash 0x0f8
  676 +#define XK_ugrave 0x0f9
  677 +#define XK_uacute 0x0fa
  678 +#define XK_ucircumflex 0x0fb
  679 +#define XK_udiaeresis 0x0fc
  680 +#define XK_yacute 0x0fd
  681 +#define XK_thorn 0x0fe
  682 +#define XK_ydiaeresis 0x0ff
  683 +#endif /* XK_LATIN1 */
  684 +
  685 +/*
  686 + * Latin 2
  687 + * Byte 3 = 1
  688 + */
  689 +
  690 +#ifdef XK_LATIN2
  691 +#define XK_Aogonek 0x1a1
  692 +#define XK_breve 0x1a2
  693 +#define XK_Lstroke 0x1a3
  694 +#define XK_Lcaron 0x1a5
  695 +#define XK_Sacute 0x1a6
  696 +#define XK_Scaron 0x1a9
  697 +#define XK_Scedilla 0x1aa
  698 +#define XK_Tcaron 0x1ab
  699 +#define XK_Zacute 0x1ac
  700 +#define XK_Zcaron 0x1ae
  701 +#define XK_Zabovedot 0x1af
  702 +#define XK_aogonek 0x1b1
  703 +#define XK_ogonek 0x1b2
  704 +#define XK_lstroke 0x1b3
  705 +#define XK_lcaron 0x1b5
  706 +#define XK_sacute 0x1b6
  707 +#define XK_caron 0x1b7
  708 +#define XK_scaron 0x1b9
  709 +#define XK_scedilla 0x1ba
  710 +#define XK_tcaron 0x1bb
  711 +#define XK_zacute 0x1bc
  712 +#define XK_doubleacute 0x1bd
  713 +#define XK_zcaron 0x1be
  714 +#define XK_zabovedot 0x1bf
  715 +#define XK_Racute 0x1c0
  716 +#define XK_Abreve 0x1c3
  717 +#define XK_Lacute 0x1c5
  718 +#define XK_Cacute 0x1c6
  719 +#define XK_Ccaron 0x1c8
  720 +#define XK_Eogonek 0x1ca
  721 +#define XK_Ecaron 0x1cc
  722 +#define XK_Dcaron 0x1cf
  723 +#define XK_Dstroke 0x1d0
  724 +#define XK_Nacute 0x1d1
  725 +#define XK_Ncaron 0x1d2
  726 +#define XK_Odoubleacute 0x1d5
  727 +#define XK_Rcaron 0x1d8
  728 +#define XK_Uring 0x1d9
  729 +#define XK_Udoubleacute 0x1db
  730 +#define XK_Tcedilla 0x1de
  731 +#define XK_racute 0x1e0
  732 +#define XK_abreve 0x1e3
  733 +#define XK_lacute 0x1e5
  734 +#define XK_cacute 0x1e6
  735 +#define XK_ccaron 0x1e8
  736 +#define XK_eogonek 0x1ea
  737 +#define XK_ecaron 0x1ec
  738 +#define XK_dcaron 0x1ef
  739 +#define XK_dstroke 0x1f0
  740 +#define XK_nacute 0x1f1
  741 +#define XK_ncaron 0x1f2
  742 +#define XK_odoubleacute 0x1f5
  743 +#define XK_udoubleacute 0x1fb
  744 +#define XK_rcaron 0x1f8
  745 +#define XK_uring 0x1f9
  746 +#define XK_tcedilla 0x1fe
  747 +#define XK_abovedot 0x1ff
  748 +#endif /* XK_LATIN2 */
  749 +
  750 +/*
  751 + * Latin 3
  752 + * Byte 3 = 2
  753 + */
  754 +
  755 +#ifdef XK_LATIN3
  756 +#define XK_Hstroke 0x2a1
  757 +#define XK_Hcircumflex 0x2a6
  758 +#define XK_Iabovedot 0x2a9
  759 +#define XK_Gbreve 0x2ab
  760 +#define XK_Jcircumflex 0x2ac
  761 +#define XK_hstroke 0x2b1
  762 +#define XK_hcircumflex 0x2b6
  763 +#define XK_idotless 0x2b9
  764 +#define XK_gbreve 0x2bb
  765 +#define XK_jcircumflex 0x2bc
  766 +#define XK_Cabovedot 0x2c5
  767 +#define XK_Ccircumflex 0x2c6
  768 +#define XK_Gabovedot 0x2d5
  769 +#define XK_Gcircumflex 0x2d8
  770 +#define XK_Ubreve 0x2dd
  771 +#define XK_Scircumflex 0x2de
  772 +#define XK_cabovedot 0x2e5
  773 +#define XK_ccircumflex 0x2e6
  774 +#define XK_gabovedot 0x2f5
  775 +#define XK_gcircumflex 0x2f8
  776 +#define XK_ubreve 0x2fd
  777 +#define XK_scircumflex 0x2fe
  778 +#endif /* XK_LATIN3 */
  779 +
  780 +
  781 +/*
  782 + * Latin 4
  783 + * Byte 3 = 3
  784 + */
  785 +
  786 +#ifdef XK_LATIN4
  787 +#define XK_kra 0x3a2
  788 +#define XK_kappa 0x3a2 /* deprecated */
  789 +#define XK_Rcedilla 0x3a3
  790 +#define XK_Itilde 0x3a5
  791 +#define XK_Lcedilla 0x3a6
  792 +#define XK_Emacron 0x3aa
  793 +#define XK_Gcedilla 0x3ab
  794 +#define XK_Tslash 0x3ac
  795 +#define XK_rcedilla 0x3b3
  796 +#define XK_itilde 0x3b5
  797 +#define XK_lcedilla 0x3b6
  798 +#define XK_emacron 0x3ba
  799 +#define XK_gcedilla 0x3bb
  800 +#define XK_tslash 0x3bc
  801 +#define XK_ENG 0x3bd
  802 +#define XK_eng 0x3bf
  803 +#define XK_Amacron 0x3c0
  804 +#define XK_Iogonek 0x3c7
  805 +#define XK_Eabovedot 0x3cc
  806 +#define XK_Imacron 0x3cf
  807 +#define XK_Ncedilla 0x3d1
  808 +#define XK_Omacron 0x3d2
  809 +#define XK_Kcedilla 0x3d3
  810 +#define XK_Uogonek 0x3d9
  811 +#define XK_Utilde 0x3dd
  812 +#define XK_Umacron 0x3de
  813 +#define XK_amacron 0x3e0
  814 +#define XK_iogonek 0x3e7
  815 +#define XK_eabovedot 0x3ec
  816 +#define XK_imacron 0x3ef
  817 +#define XK_ncedilla 0x3f1
  818 +#define XK_omacron 0x3f2
  819 +#define XK_kcedilla 0x3f3
  820 +#define XK_uogonek 0x3f9
  821 +#define XK_utilde 0x3fd
  822 +#define XK_umacron 0x3fe
  823 +#endif /* XK_LATIN4 */
  824 +
  825 +/*
  826 + * Katakana
  827 + * Byte 3 = 4
  828 + */
  829 +
  830 +#ifdef XK_KATAKANA
  831 +#define XK_overline 0x47e
  832 +#define XK_kana_fullstop 0x4a1
  833 +#define XK_kana_openingbracket 0x4a2
  834 +#define XK_kana_closingbracket 0x4a3
  835 +#define XK_kana_comma 0x4a4
  836 +#define XK_kana_conjunctive 0x4a5
  837 +#define XK_kana_middledot 0x4a5 /* deprecated */
  838 +#define XK_kana_WO 0x4a6
  839 +#define XK_kana_a 0x4a7
  840 +#define XK_kana_i 0x4a8
  841 +#define XK_kana_u 0x4a9
  842 +#define XK_kana_e 0x4aa
  843 +#define XK_kana_o 0x4ab
  844 +#define XK_kana_ya 0x4ac
  845 +#define XK_kana_yu 0x4ad
  846 +#define XK_kana_yo 0x4ae
  847 +#define XK_kana_tsu 0x4af
  848 +#define XK_kana_tu 0x4af /* deprecated */
  849 +#define XK_prolongedsound 0x4b0
  850 +#define XK_kana_A 0x4b1
  851 +#define XK_kana_I 0x4b2
  852 +#define XK_kana_U 0x4b3
  853 +#define XK_kana_E 0x4b4
  854 +#define XK_kana_O 0x4b5
  855 +#define XK_kana_KA 0x4b6
  856 +#define XK_kana_KI 0x4b7
  857 +#define XK_kana_KU 0x4b8
  858 +#define XK_kana_KE 0x4b9
  859 +#define XK_kana_KO 0x4ba
  860 +#define XK_kana_SA 0x4bb
  861 +#define XK_kana_SHI 0x4bc
  862 +#define XK_kana_SU 0x4bd
  863 +#define XK_kana_SE 0x4be
  864 +#define XK_kana_SO 0x4bf
  865 +#define XK_kana_TA 0x4c0
  866 +#define XK_kana_CHI 0x4c1
  867 +#define XK_kana_TI 0x4c1 /* deprecated */
  868 +#define XK_kana_TSU 0x4c2
  869 +#define XK_kana_TU 0x4c2 /* deprecated */
  870 +#define XK_kana_TE 0x4c3
  871 +#define XK_kana_TO 0x4c4
  872 +#define XK_kana_NA 0x4c5
  873 +#define XK_kana_NI 0x4c6
  874 +#define XK_kana_NU 0x4c7
  875 +#define XK_kana_NE 0x4c8
  876 +#define XK_kana_NO 0x4c9
  877 +#define XK_kana_HA 0x4ca
  878 +#define XK_kana_HI 0x4cb
  879 +#define XK_kana_FU 0x4cc
  880 +#define XK_kana_HU 0x4cc /* deprecated */
  881 +#define XK_kana_HE 0x4cd
  882 +#define XK_kana_HO 0x4ce
  883 +#define XK_kana_MA 0x4cf
  884 +#define XK_kana_MI 0x4d0
  885 +#define XK_kana_MU 0x4d1
  886 +#define XK_kana_ME 0x4d2
  887 +#define XK_kana_MO 0x4d3
  888 +#define XK_kana_YA 0x4d4
  889 +#define XK_kana_YU 0x4d5
  890 +#define XK_kana_YO 0x4d6
  891 +#define XK_kana_RA 0x4d7
  892 +#define XK_kana_RI 0x4d8
  893 +#define XK_kana_RU 0x4d9
  894 +#define XK_kana_RE 0x4da
  895 +#define XK_kana_RO 0x4db
  896 +#define XK_kana_WA 0x4dc
  897 +#define XK_kana_N 0x4dd
  898 +#define XK_voicedsound 0x4de
  899 +#define XK_semivoicedsound 0x4df
  900 +#define XK_kana_switch 0xFF7E /* Alias for mode_switch */
  901 +#endif /* XK_KATAKANA */
  902 +
  903 +/*
  904 + * Arabic
  905 + * Byte 3 = 5
  906 + */
  907 +
  908 +#ifdef XK_ARABIC
  909 +#define XK_Arabic_comma 0x5ac
  910 +#define XK_Arabic_semicolon 0x5bb
  911 +#define XK_Arabic_question_mark 0x5bf
  912 +#define XK_Arabic_hamza 0x5c1
  913 +#define XK_Arabic_maddaonalef 0x5c2
  914 +#define XK_Arabic_hamzaonalef 0x5c3
  915 +#define XK_Arabic_hamzaonwaw 0x5c4
  916 +#define XK_Arabic_hamzaunderalef 0x5c5
  917 +#define XK_Arabic_hamzaonyeh 0x5c6
  918 +#define XK_Arabic_alef 0x5c7
  919 +#define XK_Arabic_beh 0x5c8
  920 +#define XK_Arabic_tehmarbuta 0x5c9
  921 +#define XK_Arabic_teh 0x5ca
  922 +#define XK_Arabic_theh 0x5cb
  923 +#define XK_Arabic_jeem 0x5cc
  924 +#define XK_Arabic_hah 0x5cd
  925 +#define XK_Arabic_khah 0x5ce
  926 +#define XK_Arabic_dal 0x5cf
  927 +#define XK_Arabic_thal 0x5d0
  928 +#define XK_Arabic_ra 0x5d1
  929 +#define XK_Arabic_zain 0x5d2
  930 +#define XK_Arabic_seen 0x5d3
  931 +#define XK_Arabic_sheen 0x5d4
  932 +#define XK_Arabic_sad 0x5d5
  933 +#define XK_Arabic_dad 0x5d6
  934 +#define XK_Arabic_tah 0x5d7
  935 +#define XK_Arabic_zah 0x5d8
  936 +#define XK_Arabic_ain 0x5d9
  937 +#define XK_Arabic_ghain 0x5da
  938 +#define XK_Arabic_tatweel 0x5e0
  939 +#define XK_Arabic_feh 0x5e1
  940 +#define XK_Arabic_qaf 0x5e2
  941 +#define XK_Arabic_kaf 0x5e3
  942 +#define XK_Arabic_lam 0x5e4
  943 +#define XK_Arabic_meem 0x5e5
  944 +#define XK_Arabic_noon 0x5e6
  945 +#define XK_Arabic_ha 0x5e7
  946 +#define XK_Arabic_heh 0x5e7 /* deprecated */
  947 +#define XK_Arabic_waw 0x5e8
  948 +#define XK_Arabic_alefmaksura 0x5e9
  949 +#define XK_Arabic_yeh 0x5ea
  950 +#define XK_Arabic_fathatan 0x5eb
  951 +#define XK_Arabic_dammatan 0x5ec
  952 +#define XK_Arabic_kasratan 0x5ed
  953 +#define XK_Arabic_fatha 0x5ee
  954 +#define XK_Arabic_damma 0x5ef
  955 +#define XK_Arabic_kasra 0x5f0
  956 +#define XK_Arabic_shadda 0x5f1
  957 +#define XK_Arabic_sukun 0x5f2
  958 +#define XK_Arabic_switch 0xFF7E /* Alias for mode_switch */
  959 +#endif /* XK_ARABIC */
  960 +
  961 +/*
  962 + * Cyrillic
  963 + * Byte 3 = 6
  964 + */
  965 +#ifdef XK_CYRILLIC
  966 +#define XK_Serbian_dje 0x6a1
  967 +#define XK_Macedonia_gje 0x6a2
  968 +#define XK_Cyrillic_io 0x6a3
  969 +#define XK_Ukrainian_ie 0x6a4
  970 +#define XK_Ukranian_je 0x6a4 /* deprecated */
  971 +#define XK_Macedonia_dse 0x6a5
  972 +#define XK_Ukrainian_i 0x6a6
  973 +#define XK_Ukranian_i 0x6a6 /* deprecated */
  974 +#define XK_Ukrainian_yi 0x6a7
  975 +#define XK_Ukranian_yi 0x6a7 /* deprecated */
  976 +#define XK_Cyrillic_je 0x6a8
  977 +#define XK_Serbian_je 0x6a8 /* deprecated */
  978 +#define XK_Cyrillic_lje 0x6a9
  979 +#define XK_Serbian_lje 0x6a9 /* deprecated */
  980 +#define XK_Cyrillic_nje 0x6aa
  981 +#define XK_Serbian_nje 0x6aa /* deprecated */
  982 +#define XK_Serbian_tshe 0x6ab
  983 +#define XK_Macedonia_kje 0x6ac
  984 +#define XK_Byelorussian_shortu 0x6ae
  985 +#define XK_Cyrillic_dzhe 0x6af
  986 +#define XK_Serbian_dze 0x6af /* deprecated */
  987 +#define XK_numerosign 0x6b0
  988 +#define XK_Serbian_DJE 0x6b1
  989 +#define XK_Macedonia_GJE 0x6b2
  990 +#define XK_Cyrillic_IO 0x6b3
  991 +#define XK_Ukrainian_IE 0x6b4
  992 +#define XK_Ukranian_JE 0x6b4 /* deprecated */
  993 +#define XK_Macedonia_DSE 0x6b5
  994 +#define XK_Ukrainian_I 0x6b6
  995 +#define XK_Ukranian_I 0x6b6 /* deprecated */
  996 +#define XK_Ukrainian_YI 0x6b7
  997 +#define XK_Ukranian_YI 0x6b7 /* deprecated */
  998 +#define XK_Cyrillic_JE 0x6b8
  999 +#define XK_Serbian_JE 0x6b8 /* deprecated */
  1000 +#define XK_Cyrillic_LJE 0x6b9
  1001 +#define XK_Serbian_LJE 0x6b9 /* deprecated */
  1002 +#define XK_Cyrillic_NJE 0x6ba
  1003 +#define XK_Serbian_NJE 0x6ba /* deprecated */
  1004 +#define XK_Serbian_TSHE 0x6bb
  1005 +#define XK_Macedonia_KJE 0x6bc
  1006 +#define XK_Byelorussian_SHORTU 0x6be
  1007 +#define XK_Cyrillic_DZHE 0x6bf
  1008 +#define XK_Serbian_DZE 0x6bf /* deprecated */
  1009 +#define XK_Cyrillic_yu 0x6c0
  1010 +#define XK_Cyrillic_a 0x6c1
  1011 +#define XK_Cyrillic_be 0x6c2
  1012 +#define XK_Cyrillic_tse 0x6c3
  1013 +#define XK_Cyrillic_de 0x6c4
  1014 +#define XK_Cyrillic_ie 0x6c5
  1015 +#define XK_Cyrillic_ef 0x6c6
  1016 +#define XK_Cyrillic_ghe 0x6c7
  1017 +#define XK_Cyrillic_ha 0x6c8
  1018 +#define XK_Cyrillic_i 0x6c9
  1019 +#define XK_Cyrillic_shorti 0x6ca
  1020 +#define XK_Cyrillic_ka 0x6cb
  1021 +#define XK_Cyrillic_el 0x6cc
  1022 +#define XK_Cyrillic_em 0x6cd
  1023 +#define XK_Cyrillic_en 0x6ce
  1024 +#define XK_Cyrillic_o 0x6cf
  1025 +#define XK_Cyrillic_pe 0x6d0
  1026 +#define XK_Cyrillic_ya 0x6d1
  1027 +#define XK_Cyrillic_er 0x6d2
  1028 +#define XK_Cyrillic_es 0x6d3
  1029 +#define XK_Cyrillic_te 0x6d4
  1030 +#define XK_Cyrillic_u 0x6d5
  1031 +#define XK_Cyrillic_zhe 0x6d6
  1032 +#define XK_Cyrillic_ve 0x6d7
  1033 +#define XK_Cyrillic_softsign 0x6d8
  1034 +#define XK_Cyrillic_yeru 0x6d9
  1035 +#define XK_Cyrillic_ze 0x6da
  1036 +#define XK_Cyrillic_sha 0x6db
  1037 +#define XK_Cyrillic_e 0x6dc
  1038 +#define XK_Cyrillic_shcha 0x6dd
  1039 +#define XK_Cyrillic_che 0x6de
  1040 +#define XK_Cyrillic_hardsign 0x6df
  1041 +#define XK_Cyrillic_YU 0x6e0
  1042 +#define XK_Cyrillic_A 0x6e1
  1043 +#define XK_Cyrillic_BE 0x6e2
  1044 +#define XK_Cyrillic_TSE 0x6e3
  1045 +#define XK_Cyrillic_DE 0x6e4
  1046 +#define XK_Cyrillic_IE 0x6e5
  1047 +#define XK_Cyrillic_EF 0x6e6
  1048 +#define XK_Cyrillic_GHE 0x6e7
  1049 +#define XK_Cyrillic_HA 0x6e8
  1050 +#define XK_Cyrillic_I 0x6e9
  1051 +#define XK_Cyrillic_SHORTI 0x6ea
  1052 +#define XK_Cyrillic_KA 0x6eb
  1053 +#define XK_Cyrillic_EL 0x6ec
  1054 +#define XK_Cyrillic_EM 0x6ed
  1055 +#define XK_Cyrillic_EN 0x6ee
  1056 +#define XK_Cyrillic_O 0x6ef
  1057 +#define XK_Cyrillic_PE 0x6f0
  1058 +#define XK_Cyrillic_YA 0x6f1
  1059 +#define XK_Cyrillic_ER 0x6f2
  1060 +#define XK_Cyrillic_ES 0x6f3
  1061 +#define XK_Cyrillic_TE 0x6f4
  1062 +#define XK_Cyrillic_U 0x6f5
  1063 +#define XK_Cyrillic_ZHE 0x6f6
  1064 +#define XK_Cyrillic_VE 0x6f7
  1065 +#define XK_Cyrillic_SOFTSIGN 0x6f8
  1066 +#define XK_Cyrillic_YERU 0x6f9
  1067 +#define XK_Cyrillic_ZE 0x6fa
  1068 +#define XK_Cyrillic_SHA 0x6fb
  1069 +#define XK_Cyrillic_E 0x6fc
  1070 +#define XK_Cyrillic_SHCHA 0x6fd
  1071 +#define XK_Cyrillic_CHE 0x6fe
  1072 +#define XK_Cyrillic_HARDSIGN 0x6ff
  1073 +#endif /* XK_CYRILLIC */
  1074 +
  1075 +/*
  1076 + * Greek
  1077 + * Byte 3 = 7
  1078 + */
  1079 +
  1080 +#ifdef XK_GREEK
  1081 +#define XK_Greek_ALPHAaccent 0x7a1
  1082 +#define XK_Greek_EPSILONaccent 0x7a2
  1083 +#define XK_Greek_ETAaccent 0x7a3
  1084 +#define XK_Greek_IOTAaccent 0x7a4
  1085 +#define XK_Greek_IOTAdieresis 0x7a5
  1086 +#define XK_Greek_OMICRONaccent 0x7a7
  1087 +#define XK_Greek_UPSILONaccent 0x7a8
  1088 +#define XK_Greek_UPSILONdieresis 0x7a9
  1089 +#define XK_Greek_OMEGAaccent 0x7ab
  1090 +#define XK_Greek_accentdieresis 0x7ae
  1091 +#define XK_Greek_horizbar 0x7af
  1092 +#define XK_Greek_alphaaccent 0x7b1
  1093 +#define XK_Greek_epsilonaccent 0x7b2
  1094 +#define XK_Greek_etaaccent 0x7b3
  1095 +#define XK_Greek_iotaaccent 0x7b4
  1096 +#define XK_Greek_iotadieresis 0x7b5
  1097 +#define XK_Greek_iotaaccentdieresis 0x7b6
  1098 +#define XK_Greek_omicronaccent 0x7b7
  1099 +#define XK_Greek_upsilonaccent 0x7b8
  1100 +#define XK_Greek_upsilondieresis 0x7b9
  1101 +#define XK_Greek_upsilonaccentdieresis 0x7ba
  1102 +#define XK_Greek_omegaaccent 0x7bb
  1103 +#define XK_Greek_ALPHA 0x7c1
  1104 +#define XK_Greek_BETA 0x7c2
  1105 +#define XK_Greek_GAMMA 0x7c3
  1106 +#define XK_Greek_DELTA 0x7c4
  1107 +#define XK_Greek_EPSILON 0x7c5
  1108 +#define XK_Greek_ZETA 0x7c6
  1109 +#define XK_Greek_ETA 0x7c7
  1110 +#define XK_Greek_THETA 0x7c8
  1111 +#define XK_Greek_IOTA 0x7c9
  1112 +#define XK_Greek_KAPPA 0x7ca
  1113 +#define XK_Greek_LAMDA 0x7cb
  1114 +#define XK_Greek_LAMBDA 0x7cb
  1115 +#define XK_Greek_MU 0x7cc
  1116 +#define XK_Greek_NU 0x7cd
  1117 +#define XK_Greek_XI 0x7ce
  1118 +#define XK_Greek_OMICRON 0x7cf
  1119 +#define XK_Greek_PI 0x7d0
  1120 +#define XK_Greek_RHO 0x7d1
  1121 +#define XK_Greek_SIGMA 0x7d2
  1122 +#define XK_Greek_TAU 0x7d4
  1123 +#define XK_Greek_UPSILON 0x7d5
  1124 +#define XK_Greek_PHI 0x7d6
  1125 +#define XK_Greek_CHI 0x7d7
  1126 +#define XK_Greek_PSI 0x7d8
  1127 +#define XK_Greek_OMEGA 0x7d9
  1128 +#define XK_Greek_alpha 0x7e1
  1129 +#define XK_Greek_beta 0x7e2
  1130 +#define XK_Greek_gamma 0x7e3
  1131 +#define XK_Greek_delta 0x7e4
  1132 +#define XK_Greek_epsilon 0x7e5
  1133 +#define XK_Greek_zeta 0x7e6
  1134 +#define XK_Greek_eta 0x7e7
  1135 +#define XK_Greek_theta 0x7e8
  1136 +#define XK_Greek_iota 0x7e9
  1137 +#define XK_Greek_kappa 0x7ea
  1138 +#define XK_Greek_lamda 0x7eb
  1139 +#define XK_Greek_lambda 0x7eb
  1140 +#define XK_Greek_mu 0x7ec
  1141 +#define XK_Greek_nu 0x7ed
  1142 +#define XK_Greek_xi 0x7ee
  1143 +#define XK_Greek_omicron 0x7ef
  1144 +#define XK_Greek_pi 0x7f0
  1145 +#define XK_Greek_rho 0x7f1
  1146 +#define XK_Greek_sigma 0x7f2
  1147 +#define XK_Greek_finalsmallsigma 0x7f3
  1148 +#define XK_Greek_tau 0x7f4
  1149 +#define XK_Greek_upsilon 0x7f5
  1150 +#define XK_Greek_phi 0x7f6
  1151 +#define XK_Greek_chi 0x7f7
  1152 +#define XK_Greek_psi 0x7f8
  1153 +#define XK_Greek_omega 0x7f9
  1154 +#define XK_Greek_switch 0xFF7E /* Alias for mode_switch */
  1155 +#endif /* XK_GREEK */
  1156 +
  1157 +/*
  1158 + * Technical
  1159 + * Byte 3 = 8
  1160 + */
  1161 +
  1162 +#ifdef XK_TECHNICAL
  1163 +#define XK_leftradical 0x8a1
  1164 +#define XK_topleftradical 0x8a2
  1165 +#define XK_horizconnector 0x8a3
  1166 +#define XK_topintegral 0x8a4
  1167 +#define XK_botintegral 0x8a5
  1168 +#define XK_vertconnector 0x8a6
  1169 +#define XK_topleftsqbracket 0x8a7
  1170 +#define XK_botleftsqbracket 0x8a8
  1171 +#define XK_toprightsqbracket 0x8a9
  1172 +#define XK_botrightsqbracket 0x8aa
  1173 +#define XK_topleftparens 0x8ab
  1174 +#define XK_botleftparens 0x8ac
  1175 +#define XK_toprightparens 0x8ad
  1176 +#define XK_botrightparens 0x8ae
  1177 +#define XK_leftmiddlecurlybrace 0x8af
  1178 +#define XK_rightmiddlecurlybrace 0x8b0
  1179 +#define XK_topleftsummation 0x8b1
  1180 +#define XK_botleftsummation 0x8b2
  1181 +#define XK_topvertsummationconnector 0x8b3
  1182 +#define XK_botvertsummationconnector 0x8b4
  1183 +#define XK_toprightsummation 0x8b5
  1184 +#define XK_botrightsummation 0x8b6
  1185 +#define XK_rightmiddlesummation 0x8b7
  1186 +#define XK_lessthanequal 0x8bc
  1187 +#define XK_notequal 0x8bd
  1188 +#define XK_greaterthanequal 0x8be
  1189 +#define XK_integral 0x8bf
  1190 +#define XK_therefore 0x8c0
  1191 +#define XK_variation 0x8c1
  1192 +#define XK_infinity 0x8c2
  1193 +#define XK_nabla 0x8c5
  1194 +#define XK_approximate 0x8c8
  1195 +#define XK_similarequal 0x8c9
  1196 +#define XK_ifonlyif 0x8cd
  1197 +#define XK_implies 0x8ce
  1198 +#define XK_identical 0x8cf
  1199 +#define XK_radical 0x8d6
  1200 +#define XK_includedin 0x8da
  1201 +#define XK_includes 0x8db
  1202 +#define XK_intersection 0x8dc
  1203 +#define XK_union 0x8dd
  1204 +#define XK_logicaland 0x8de
  1205 +#define XK_logicalor 0x8df
  1206 +#define XK_partialderivative 0x8ef
  1207 +#define XK_function 0x8f6
  1208 +#define XK_leftarrow 0x8fb
  1209 +#define XK_uparrow 0x8fc
  1210 +#define XK_rightarrow 0x8fd
  1211 +#define XK_downarrow 0x8fe
  1212 +#endif /* XK_TECHNICAL */
  1213 +
  1214 +/*
  1215 + * Special
  1216 + * Byte 3 = 9
  1217 + */
  1218 +
  1219 +#ifdef XK_SPECIAL
  1220 +#define XK_blank 0x9df
  1221 +#define XK_soliddiamond 0x9e0
  1222 +#define XK_checkerboard 0x9e1
  1223 +#define XK_ht 0x9e2
  1224 +#define XK_ff 0x9e3
  1225 +#define XK_cr 0x9e4
  1226 +#define XK_lf 0x9e5
  1227 +#define XK_nl 0x9e8
  1228 +#define XK_vt 0x9e9
  1229 +#define XK_lowrightcorner 0x9ea
  1230 +#define XK_uprightcorner 0x9eb
  1231 +#define XK_upleftcorner 0x9ec
  1232 +#define XK_lowleftcorner 0x9ed
  1233 +#define XK_crossinglines 0x9ee
  1234 +#define XK_horizlinescan1 0x9ef
  1235 +#define XK_horizlinescan3 0x9f0
  1236 +#define XK_horizlinescan5 0x9f1
  1237 +#define XK_horizlinescan7 0x9f2
  1238 +#define XK_horizlinescan9 0x9f3
  1239 +#define XK_leftt 0x9f4
  1240 +#define XK_rightt 0x9f5
  1241 +#define XK_bott 0x9f6
  1242 +#define XK_topt 0x9f7
  1243 +#define XK_vertbar 0x9f8
  1244 +#endif /* XK_SPECIAL */
  1245 +
  1246 +/*
  1247 + * Publishing
  1248 + * Byte 3 = a
  1249 + */
  1250 +
  1251 +#ifdef XK_PUBLISHING
  1252 +#define XK_emspace 0xaa1
  1253 +#define XK_enspace 0xaa2
  1254 +#define XK_em3space 0xaa3
  1255 +#define XK_em4space 0xaa4
  1256 +#define XK_digitspace 0xaa5
  1257 +#define XK_punctspace 0xaa6
  1258 +#define XK_thinspace 0xaa7
  1259 +#define XK_hairspace 0xaa8
  1260 +#define XK_emdash 0xaa9
  1261 +#define XK_endash 0xaaa
  1262 +#define XK_signifblank 0xaac
  1263 +#define XK_ellipsis 0xaae
  1264 +#define XK_doubbaselinedot 0xaaf
  1265 +#define XK_onethird 0xab0
  1266 +#define XK_twothirds 0xab1
  1267 +#define XK_onefifth 0xab2
  1268 +#define XK_twofifths 0xab3
  1269 +#define XK_threefifths 0xab4
  1270 +#define XK_fourfifths 0xab5
  1271 +#define XK_onesixth 0xab6
  1272 +#define XK_fivesixths 0xab7
  1273 +#define XK_careof 0xab8
  1274 +#define XK_figdash 0xabb
  1275 +#define XK_leftanglebracket 0xabc
  1276 +#define XK_decimalpoint 0xabd
  1277 +#define XK_rightanglebracket 0xabe
  1278 +#define XK_marker 0xabf
  1279 +#define XK_oneeighth 0xac3
  1280 +#define XK_threeeighths 0xac4
  1281 +#define XK_fiveeighths 0xac5
  1282 +#define XK_seveneighths 0xac6
  1283 +#define XK_trademark 0xac9
  1284 +#define XK_signaturemark 0xaca
  1285 +#define XK_trademarkincircle 0xacb
  1286 +#define XK_leftopentriangle 0xacc
  1287 +#define XK_rightopentriangle 0xacd
  1288 +#define XK_emopencircle 0xace
  1289 +#define XK_emopenrectangle 0xacf
  1290 +#define XK_leftsinglequotemark 0xad0
  1291 +#define XK_rightsinglequotemark 0xad1
  1292 +#define XK_leftdoublequotemark 0xad2
  1293 +#define XK_rightdoublequotemark 0xad3
  1294 +#define XK_prescription 0xad4
  1295 +#define XK_minutes 0xad6
  1296 +#define XK_seconds 0xad7
  1297 +#define XK_latincross 0xad9
  1298 +#define XK_hexagram 0xada
  1299 +#define XK_filledrectbullet 0xadb
  1300 +#define XK_filledlefttribullet 0xadc
  1301 +#define XK_filledrighttribullet 0xadd
  1302 +#define XK_emfilledcircle 0xade
  1303 +#define XK_emfilledrect 0xadf
  1304 +#define XK_enopencircbullet 0xae0
  1305 +#define XK_enopensquarebullet 0xae1
  1306 +#define XK_openrectbullet 0xae2
  1307 +#define XK_opentribulletup 0xae3
  1308 +#define XK_opentribulletdown 0xae4
  1309 +#define XK_openstar 0xae5
  1310 +#define XK_enfilledcircbullet 0xae6
  1311 +#define XK_enfilledsqbullet 0xae7
  1312 +#define XK_filledtribulletup 0xae8
  1313 +#define XK_filledtribulletdown 0xae9
  1314 +#define XK_leftpointer 0xaea
  1315 +#define XK_rightpointer 0xaeb
  1316 +#define XK_club 0xaec
  1317 +#define XK_diamond 0xaed
  1318 +#define XK_heart 0xaee
  1319 +#define XK_maltesecross 0xaf0
  1320 +#define XK_dagger 0xaf1
  1321 +#define XK_doubledagger 0xaf2
  1322 +#define XK_checkmark 0xaf3
  1323 +#define XK_ballotcross 0xaf4
  1324 +#define XK_musicalsharp 0xaf5
  1325 +#define XK_musicalflat 0xaf6
  1326 +#define XK_malesymbol 0xaf7
  1327 +#define XK_femalesymbol 0xaf8
  1328 +#define XK_telephone 0xaf9
  1329 +#define XK_telephonerecorder 0xafa
  1330 +#define XK_phonographcopyright 0xafb
  1331 +#define XK_caret 0xafc
  1332 +#define XK_singlelowquotemark 0xafd
  1333 +#define XK_doublelowquotemark 0xafe
  1334 +#define XK_cursor 0xaff
  1335 +#endif /* XK_PUBLISHING */
  1336 +
  1337 +/*
  1338 + * APL
  1339 + * Byte 3 = b
  1340 + */
  1341 +
  1342 +#ifdef XK_APL
  1343 +#define XK_leftcaret 0xba3
  1344 +#define XK_rightcaret 0xba6
  1345 +#define XK_downcaret 0xba8
  1346 +#define XK_upcaret 0xba9
  1347 +#define XK_overbar 0xbc0
  1348 +#define XK_downtack 0xbc2
  1349 +#define XK_upshoe 0xbc3
  1350 +#define XK_downstile 0xbc4
  1351 +#define XK_underbar 0xbc6
  1352 +#define XK_jot 0xbca
  1353 +#define XK_quad 0xbcc
  1354 +#define XK_uptack 0xbce
  1355 +#define XK_circle 0xbcf
  1356 +#define XK_upstile 0xbd3
  1357 +#define XK_downshoe 0xbd6
  1358 +#define XK_rightshoe 0xbd8
  1359 +#define XK_leftshoe 0xbda
  1360 +#define XK_lefttack 0xbdc
  1361 +#define XK_righttack 0xbfc
  1362 +#endif /* XK_APL */
  1363 +
  1364 +/*
  1365 + * Hebrew
  1366 + * Byte 3 = c
  1367 + */
  1368 +
  1369 +#ifdef XK_HEBREW
  1370 +#define XK_hebrew_doublelowline 0xcdf
  1371 +#define XK_hebrew_aleph 0xce0
  1372 +#define XK_hebrew_bet 0xce1
  1373 +#define XK_hebrew_beth 0xce1 /* deprecated */
  1374 +#define XK_hebrew_gimel 0xce2
  1375 +#define XK_hebrew_gimmel 0xce2 /* deprecated */
  1376 +#define XK_hebrew_dalet 0xce3
  1377 +#define XK_hebrew_daleth 0xce3 /* deprecated */
  1378 +#define XK_hebrew_he 0xce4
  1379 +#define XK_hebrew_waw 0xce5
  1380 +#define XK_hebrew_zain 0xce6
  1381 +#define XK_hebrew_zayin 0xce6 /* deprecated */
  1382 +#define XK_hebrew_chet 0xce7
  1383 +#define XK_hebrew_het 0xce7 /* deprecated */
  1384 +#define XK_hebrew_tet 0xce8
  1385 +#define XK_hebrew_teth 0xce8 /* deprecated */
  1386 +#define XK_hebrew_yod 0xce9
  1387 +#define XK_hebrew_finalkaph 0xcea
  1388 +#define XK_hebrew_kaph 0xceb
  1389 +#define XK_hebrew_lamed 0xcec
  1390 +#define XK_hebrew_finalmem 0xced
  1391 +#define XK_hebrew_mem 0xcee
  1392 +#define XK_hebrew_finalnun 0xcef
  1393 +#define XK_hebrew_nun 0xcf0
  1394 +#define XK_hebrew_samech 0xcf1
  1395 +#define XK_hebrew_samekh 0xcf1 /* deprecated */
  1396 +#define XK_hebrew_ayin 0xcf2
  1397 +#define XK_hebrew_finalpe 0xcf3
  1398 +#define XK_hebrew_pe 0xcf4
  1399 +#define XK_hebrew_finalzade 0xcf5
  1400 +#define XK_hebrew_finalzadi 0xcf5 /* deprecated */
  1401 +#define XK_hebrew_zade 0xcf6
  1402 +#define XK_hebrew_zadi 0xcf6 /* deprecated */
  1403 +#define XK_hebrew_qoph 0xcf7
  1404 +#define XK_hebrew_kuf 0xcf7 /* deprecated */
  1405 +#define XK_hebrew_resh 0xcf8
  1406 +#define XK_hebrew_shin 0xcf9
  1407 +#define XK_hebrew_taw 0xcfa
  1408 +#define XK_hebrew_taf 0xcfa /* deprecated */
  1409 +#define XK_Hebrew_switch 0xFF7E /* Alias for mode_switch */
  1410 +#endif /* XK_HEBREW */
  1411 +
  1412 +/*
  1413 + * Thai
  1414 + * Byte 3 = d
  1415 + */
  1416 +
  1417 +#ifdef XK_THAI
  1418 +#define XK_Thai_kokai 0xda1
  1419 +#define XK_Thai_khokhai 0xda2
  1420 +#define XK_Thai_khokhuat 0xda3
  1421 +#define XK_Thai_khokhwai 0xda4
  1422 +#define XK_Thai_khokhon 0xda5
  1423 +#define XK_Thai_khorakhang 0xda6
  1424 +#define XK_Thai_ngongu 0xda7
  1425 +#define XK_Thai_chochan 0xda8
  1426 +#define XK_Thai_choching 0xda9
  1427 +#define XK_Thai_chochang 0xdaa
  1428 +#define XK_Thai_soso 0xdab
  1429 +#define XK_Thai_chochoe 0xdac
  1430 +#define XK_Thai_yoying 0xdad
  1431 +#define XK_Thai_dochada 0xdae
  1432 +#define XK_Thai_topatak 0xdaf
  1433 +#define XK_Thai_thothan 0xdb0
  1434 +#define XK_Thai_thonangmontho 0xdb1
  1435 +#define XK_Thai_thophuthao 0xdb2
  1436 +#define XK_Thai_nonen 0xdb3
  1437 +#define XK_Thai_dodek 0xdb4
  1438 +#define XK_Thai_totao 0xdb5
  1439 +#define XK_Thai_thothung 0xdb6
  1440 +#define XK_Thai_thothahan 0xdb7
  1441 +#define XK_Thai_thothong 0xdb8
  1442 +#define XK_Thai_nonu 0xdb9
  1443 +#define XK_Thai_bobaimai 0xdba
  1444 +#define XK_Thai_popla 0xdbb
  1445 +#define XK_Thai_phophung 0xdbc
  1446 +#define XK_Thai_fofa 0xdbd
  1447 +#define XK_Thai_phophan 0xdbe
  1448 +#define XK_Thai_fofan 0xdbf
  1449 +#define XK_Thai_phosamphao 0xdc0
  1450 +#define XK_Thai_moma 0xdc1
  1451 +#define XK_Thai_yoyak 0xdc2
  1452 +#define XK_Thai_rorua 0xdc3
  1453 +#define XK_Thai_ru 0xdc4
  1454 +#define XK_Thai_loling 0xdc5
  1455 +#define XK_Thai_lu 0xdc6
  1456 +#define XK_Thai_wowaen 0xdc7
  1457 +#define XK_Thai_sosala 0xdc8
  1458 +#define XK_Thai_sorusi 0xdc9
  1459 +#define XK_Thai_sosua 0xdca
  1460 +#define XK_Thai_hohip 0xdcb
  1461 +#define XK_Thai_lochula 0xdcc
  1462 +#define XK_Thai_oang 0xdcd
  1463 +#define XK_Thai_honokhuk 0xdce
  1464 +#define XK_Thai_paiyannoi 0xdcf
  1465 +#define XK_Thai_saraa 0xdd0
  1466 +#define XK_Thai_maihanakat 0xdd1
  1467 +#define XK_Thai_saraaa 0xdd2
  1468 +#define XK_Thai_saraam 0xdd3
  1469 +#define XK_Thai_sarai 0xdd4
  1470 +#define XK_Thai_saraii 0xdd5
  1471 +#define XK_Thai_saraue 0xdd6
  1472 +#define XK_Thai_sarauee 0xdd7
  1473 +#define XK_Thai_sarau 0xdd8
  1474 +#define XK_Thai_sarauu 0xdd9
  1475 +#define XK_Thai_phinthu 0xdda
  1476 +#define XK_Thai_maihanakat_maitho 0xdde
  1477 +#define XK_Thai_baht 0xddf
  1478 +#define XK_Thai_sarae 0xde0
  1479 +#define XK_Thai_saraae 0xde1
  1480 +#define XK_Thai_sarao 0xde2
  1481 +#define XK_Thai_saraaimaimuan 0xde3
  1482 +#define XK_Thai_saraaimaimalai 0xde4
  1483 +#define XK_Thai_lakkhangyao 0xde5
  1484 +#define XK_Thai_maiyamok 0xde6
  1485 +#define XK_Thai_maitaikhu 0xde7
  1486 +#define XK_Thai_maiek 0xde8
  1487 +#define XK_Thai_maitho 0xde9
  1488 +#define XK_Thai_maitri 0xdea
  1489 +#define XK_Thai_maichattawa 0xdeb
  1490 +#define XK_Thai_thanthakhat 0xdec
  1491 +#define XK_Thai_nikhahit 0xded
  1492 +#define XK_Thai_leksun 0xdf0
  1493 +#define XK_Thai_leknung 0xdf1
  1494 +#define XK_Thai_leksong 0xdf2
  1495 +#define XK_Thai_leksam 0xdf3
  1496 +#define XK_Thai_leksi 0xdf4
  1497 +#define XK_Thai_lekha 0xdf5
  1498 +#define XK_Thai_lekhok 0xdf6
  1499 +#define XK_Thai_lekchet 0xdf7
  1500 +#define XK_Thai_lekpaet 0xdf8
  1501 +#define XK_Thai_lekkao 0xdf9
  1502 +#endif /* XK_THAI */
  1503 +
  1504 +/*
  1505 + * Korean
  1506 + * Byte 3 = e
  1507 + */
  1508 +
  1509 +#ifdef XK_KOREAN
  1510 +
  1511 +#define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */
  1512 +#define XK_Hangul_Start 0xff32 /* Hangul start */
  1513 +#define XK_Hangul_End 0xff33 /* Hangul end, English start */
  1514 +#define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */
  1515 +#define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */
  1516 +#define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */
  1517 +#define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */
  1518 +#define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */
  1519 +#define XK_Hangul_Banja 0xff39 /* Banja mode */
  1520 +#define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */
  1521 +#define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */
  1522 +#define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */
  1523 +#define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */
  1524 +#define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */
  1525 +#define XK_Hangul_Special 0xff3f /* Special symbols */
  1526 +#define XK_Hangul_switch 0xFF7E /* Alias for mode_switch */
  1527 +
  1528 +/* Hangul Consonant Characters */
  1529 +#define XK_Hangul_Kiyeog 0xea1
  1530 +#define XK_Hangul_SsangKiyeog 0xea2
  1531 +#define XK_Hangul_KiyeogSios 0xea3
  1532 +#define XK_Hangul_Nieun 0xea4
  1533 +#define XK_Hangul_NieunJieuj 0xea5
  1534 +#define XK_Hangul_NieunHieuh 0xea6
  1535 +#define XK_Hangul_Dikeud 0xea7
  1536 +#define XK_Hangul_SsangDikeud 0xea8
  1537 +#define XK_Hangul_Rieul 0xea9
  1538 +#define XK_Hangul_RieulKiyeog 0xeaa
  1539 +#define XK_Hangul_RieulMieum 0xeab
  1540 +#define XK_Hangul_RieulPieub 0xeac
  1541 +#define XK_Hangul_RieulSios 0xead
  1542 +#define XK_Hangul_RieulTieut 0xeae
  1543 +#define XK_Hangul_RieulPhieuf 0xeaf
  1544 +#define XK_Hangul_RieulHieuh 0xeb0
  1545 +#define XK_Hangul_Mieum 0xeb1
  1546 +#define XK_Hangul_Pieub 0xeb2
  1547 +#define XK_Hangul_SsangPieub 0xeb3
  1548 +#define XK_Hangul_PieubSios 0xeb4
  1549 +#define XK_Hangul_Sios 0xeb5
  1550 +#define XK_Hangul_SsangSios 0xeb6
  1551 +#define XK_Hangul_Ieung 0xeb7
  1552 +#define XK_Hangul_Jieuj 0xeb8
  1553 +#define XK_Hangul_SsangJieuj 0xeb9
  1554 +#define XK_Hangul_Cieuc 0xeba
  1555 +#define XK_Hangul_Khieuq 0xebb
  1556 +#define XK_Hangul_Tieut 0xebc
  1557 +#define XK_Hangul_Phieuf 0xebd
  1558 +#define XK_Hangul_Hieuh 0xebe
  1559 +
  1560 +/* Hangul Vowel Characters */
  1561 +#define XK_Hangul_A 0xebf
  1562 +#define XK_Hangul_AE 0xec0
  1563 +#define XK_Hangul_YA 0xec1
  1564 +#define XK_Hangul_YAE 0xec2
  1565 +#define XK_Hangul_EO 0xec3
  1566 +#define XK_Hangul_E 0xec4
  1567 +#define XK_Hangul_YEO 0xec5
  1568 +#define XK_Hangul_YE 0xec6
  1569 +#define XK_Hangul_O 0xec7
  1570 +#define XK_Hangul_WA 0xec8
  1571 +#define XK_Hangul_WAE 0xec9
  1572 +#define XK_Hangul_OE 0xeca
  1573 +#define XK_Hangul_YO 0xecb
  1574 +#define XK_Hangul_U 0xecc
  1575 +#define XK_Hangul_WEO 0xecd
  1576 +#define XK_Hangul_WE 0xece
  1577 +#define XK_Hangul_WI 0xecf
  1578 +#define XK_Hangul_YU 0xed0
  1579 +#define XK_Hangul_EU 0xed1
  1580 +#define XK_Hangul_YI 0xed2
  1581 +#define XK_Hangul_I 0xed3
  1582 +
  1583 +/* Hangul syllable-final (JongSeong) Characters */
  1584 +#define XK_Hangul_J_Kiyeog 0xed4
  1585 +#define XK_Hangul_J_SsangKiyeog 0xed5
  1586 +#define XK_Hangul_J_KiyeogSios 0xed6
  1587 +#define XK_Hangul_J_Nieun 0xed7
  1588 +#define XK_Hangul_J_NieunJieuj 0xed8
  1589 +#define XK_Hangul_J_NieunHieuh 0xed9
  1590 +#define XK_Hangul_J_Dikeud 0xeda
  1591 +#define XK_Hangul_J_Rieul 0xedb
  1592 +#define XK_Hangul_J_RieulKiyeog 0xedc
  1593 +#define XK_Hangul_J_RieulMieum 0xedd
  1594 +#define XK_Hangul_J_RieulPieub 0xede
  1595 +#define XK_Hangul_J_RieulSios 0xedf
  1596 +#define XK_Hangul_J_RieulTieut 0xee0
  1597 +#define XK_Hangul_J_RieulPhieuf 0xee1
  1598 +#define XK_Hangul_J_RieulHieuh 0xee2
  1599 +#define XK_Hangul_J_Mieum 0xee3
  1600 +#define XK_Hangul_J_Pieub 0xee4
  1601 +#define XK_Hangul_J_PieubSios 0xee5
  1602 +#define XK_Hangul_J_Sios 0xee6
  1603 +#define XK_Hangul_J_SsangSios 0xee7
  1604 +#define XK_Hangul_J_Ieung 0xee8
  1605 +#define XK_Hangul_J_Jieuj 0xee9
  1606 +#define XK_Hangul_J_Cieuc 0xeea
  1607 +#define XK_Hangul_J_Khieuq 0xeeb
  1608 +#define XK_Hangul_J_Tieut 0xeec
  1609 +#define XK_Hangul_J_Phieuf 0xeed
  1610 +#define XK_Hangul_J_Hieuh 0xeee
  1611 +
  1612 +/* Ancient Hangul Consonant Characters */
  1613 +#define XK_Hangul_RieulYeorinHieuh 0xeef
  1614 +#define XK_Hangul_SunkyeongeumMieum 0xef0
  1615 +#define XK_Hangul_SunkyeongeumPieub 0xef1
  1616 +#define XK_Hangul_PanSios 0xef2
  1617 +#define XK_Hangul_KkogjiDalrinIeung 0xef3
  1618 +#define XK_Hangul_SunkyeongeumPhieuf 0xef4
  1619 +#define XK_Hangul_YeorinHieuh 0xef5
  1620 +
  1621 +/* Ancient Hangul Vowel Characters */
  1622 +#define XK_Hangul_AraeA 0xef6
  1623 +#define XK_Hangul_AraeAE 0xef7
  1624 +
  1625 +/* Ancient Hangul syllable-final (JongSeong) Characters */
  1626 +#define XK_Hangul_J_PanSios 0xef8
  1627 +#define XK_Hangul_J_KkogjiDalrinIeung 0xef9
  1628 +#define XK_Hangul_J_YeorinHieuh 0xefa
  1629 +
  1630 +/* Korean currency symbol */
  1631 +#define XK_Korean_Won 0xeff
  1632 +
  1633 +#endif /* XK_KOREAN */
  1634 +
  1635 +/* Euro currency symbol */
  1636 +#define XK_EuroSign 0x20ac
  1637 +
  1638 +#endif
@@ -0,0 +1,1297 @@ @@ -0,0 +1,1297 @@
  1 +#ifndef RFB_H
  2 +#define RFB_H
  3 +/**
  4 + * @defgroup libvncserver_api LibVNCServer API Reference
  5 + * @{
  6 + */
  7 +
  8 +/**
  9 + * @file rfb.h
  10 + */
  11 +
  12 +/*
  13 + * Copyright (C) 2005 Rohit Kumar <rokumar@novell.com>,
  14 + * Johannes E. Schindelin <johannes.schindelin@gmx.de>
  15 + * Copyright (C) 2002 RealVNC Ltd.
  16 + * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
  17 + * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
  18 + * All Rights Reserved.
  19 + *
  20 + * This is free software; you can redistribute it and/or modify
  21 + * it under the terms of the GNU General Public License as published by
  22 + * the Free Software Foundation; either version 2 of the License, or
  23 + * (at your option) any later version.
  24 + *
  25 + * This software is distributed in the hope that it will be useful,
  26 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28 + * GNU General Public License for more details.
  29 + *
  30 + * You should have received a copy of the GNU General Public License
  31 + * along with this software; if not, write to the Free Software
  32 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  33 + * USA.
  34 + */
  35 +
  36 +#if(defined __cplusplus)
  37 +extern "C"
  38 +{
  39 +#endif
  40 +
  41 +#include <stdio.h>
  42 +#include <stdlib.h>
  43 +#include <string.h>
  44 +#include <rfb/rfbproto.h>
  45 +
  46 +#if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
  47 +#include <arpa/inet.h>
  48 +#include <sys/select.h>
  49 +#endif
  50 +
  51 +#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
  52 +#include <sys/types.h>
  53 +#endif
  54 +
  55 +#ifdef WIN32
  56 +typedef UINT32 in_addr_t;
  57 +#include <winsock2.h>
  58 +#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
  59 +#undef socklen_t
  60 +#include <ws2tcpip.h>
  61 +#endif
  62 +#ifdef _MSC_VER
  63 +#pragma warning(disable:4996)
  64 +#endif
  65 +#endif
  66 +
  67 +#include <rfb/threading.h>
  68 +
  69 +/* if you use pthreads, but don't define LIBVNCSERVER_HAVE_LIBPTHREAD, the structs
  70 + get all mixed up. So this gives a linker error reminding you to compile
  71 + the library and your application (at least the parts including rfb.h)
  72 + with the same support for pthreads. */
  73 +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
  74 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  75 +#define rfbInitServer rfbInitServerWithPthreadsAndZRLE
  76 +#else
  77 +#define rfbInitServer rfbInitServerWithPthreadsButWithoutZRLE
  78 +#endif
  79 +#else
  80 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  81 +#define rfbInitServer rfbInitServerWithoutPthreadsButWithZRLE
  82 +#else
  83 +#define rfbInitServer rfbInitServerWithoutPthreadsAndZRLE
  84 +#endif
  85 +#endif
  86 +
  87 +struct _rfbClientRec;
  88 +struct _rfbScreenInfo;
  89 +struct rfbCursor;
  90 +
  91 +enum rfbNewClientAction {
  92 + RFB_CLIENT_ACCEPT,
  93 + RFB_CLIENT_ON_HOLD,
  94 + RFB_CLIENT_REFUSE
  95 +};
  96 +
  97 +enum rfbSocketState {
  98 + RFB_SOCKET_INIT,
  99 + RFB_SOCKET_READY,
  100 + RFB_SOCKET_SHUTDOWN
  101 +};
  102 +
  103 +typedef void (*rfbKbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl);
  104 +typedef void (*rfbKbdReleaseAllKeysProcPtr) (struct _rfbClientRec* cl);
  105 +typedef void (*rfbPtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl);
  106 +typedef void (*rfbSetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
  107 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  108 +typedef void (*rfbSetXCutTextUTF8ProcPtr) (char* str,int len, struct _rfbClientRec* cl);
  109 +#endif
  110 +typedef struct rfbCursor* (*rfbGetCursorProcPtr) (struct _rfbClientRec* pScreen);
  111 +typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
  112 +typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
  113 +typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
  114 +typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
  115 +typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result);
  116 +/** support the capability to view the caps/num/scroll states of the X server */
  117 +typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
  118 +typedef rfbBool (*rfbXvpHookPtr)(struct _rfbClientRec* cl, uint8_t, uint8_t);
  119 +typedef int (*rfbSetDesktopSizeHookPtr)(int width, int height, int numScreens, struct rfbExtDesktopScreen* extDesktopScreens, struct _rfbClientRec* cl);
  120 +typedef int (*rfbNumberOfExtDesktopScreensPtr)(struct _rfbClientRec* cl);
  121 +typedef rfbBool (*rfbGetExtDesktopScreenPtr)(int seqnumber, struct rfbExtDesktopScreen *extDesktopScreen, struct _rfbClientRec* cl);
  122 +/**
  123 + * If x==1 and y==1 then set the whole display
  124 + * else find the window underneath x and y and set the framebuffer to the dimensions
  125 + * of that window
  126 + */
  127 +typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y);
  128 +/**
  129 + * Status determines if the X11 server permits input from the local user
  130 + * status==0 or 1
  131 + */
  132 +typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status);
  133 +/**
  134 + * Permit the server to allow or deny filetransfers. This is defaulted to deny
  135 + * It is called when a client initiates a connection to determine if it is permitted.
  136 + */
  137 +typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl);
  138 +/** Handle the textchat messages */
  139 +typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string);
  140 +
  141 +typedef struct {
  142 + uint32_t count;
  143 + rfbBool is16; /**< is the data format short? */
  144 + union {
  145 + uint8_t* bytes;
  146 + uint16_t* shorts;
  147 + } data; /**< there have to be count*3 entries */
  148 +} rfbColourMap;
  149 +
  150 +/**
  151 + * Security handling (RFB protocol version 3.7)
  152 + */
  153 +
  154 +typedef struct _rfbSecurity {
  155 + uint8_t type;
  156 + void (*handler)(struct _rfbClientRec* cl);
  157 + struct _rfbSecurity* next;
  158 +} rfbSecurityHandler;
  159 +
  160 +/**
  161 + * Protocol extension handling.
  162 + */
  163 +
  164 +typedef struct _rfbProtocolExtension {
  165 + /** returns FALSE if extension should be deactivated for client.
  166 + if newClient == NULL, it is always deactivated. */
  167 + rfbBool (*newClient)(struct _rfbClientRec* client, void** data);
  168 + /** returns FALSE if extension should be deactivated for client.
  169 + if init == NULL, it stays activated. */
  170 + rfbBool (*init)(struct _rfbClientRec* client, void* data);
  171 + /** if pseudoEncodings is not NULL, it contains a 0 terminated
  172 + list of the pseudo encodings handled by this extension. */
  173 + int *pseudoEncodings;
  174 + /** returns TRUE if that pseudo encoding is handled by the extension.
  175 + encodingNumber==0 means "reset encodings". */
  176 + rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
  177 + void** data, int encodingNumber);
  178 + /** returns TRUE if message was handled */
  179 + rfbBool (*handleMessage)(struct _rfbClientRec* client,
  180 + void* data,
  181 + const rfbClientToServerMsg* message);
  182 + void (*close)(struct _rfbClientRec* client, void* data);
  183 + void (*usage)(void);
  184 + /** processArguments returns the number of handled arguments */
  185 + int (*processArgument)(int argc, char *argv[]);
  186 + struct _rfbProtocolExtension* next;
  187 +} rfbProtocolExtension;
  188 +
  189 +typedef struct _rfbExtensionData {
  190 + rfbProtocolExtension* extension;
  191 + void* data;
  192 + struct _rfbExtensionData* next;
  193 +} rfbExtensionData;
  194 +
  195 +/**
  196 + * Per-screen (framebuffer) structure. There can be as many as you wish,
  197 + * each serving different clients. However, you have to call
  198 + * rfbProcessEvents for each of these.
  199 + */
  200 +
  201 +typedef struct _rfbScreenInfo
  202 +{
  203 + /** this structure has children that are scaled versions of this screen */
  204 + struct _rfbScreenInfo *scaledScreenNext;
  205 + int scaledScreenRefCount;
  206 +
  207 + int width;
  208 + int paddedWidthInBytes;
  209 + int height;
  210 + int depth;
  211 + int bitsPerPixel;
  212 + int sizeInBytes;
  213 +
  214 + rfbPixel blackPixel;
  215 + rfbPixel whitePixel;
  216 +
  217 + /**
  218 + * some screen specific data can be put into a struct where screenData
  219 + * points to. You need this if you have more than one screen at the
  220 + * same time while using the same functions.
  221 + */
  222 + void* screenData;
  223 +
  224 + /* additions by libvncserver */
  225 +
  226 + rfbPixelFormat serverFormat;
  227 + rfbColourMap colourMap; /**< set this if rfbServerFormat.trueColour==FALSE */
  228 + const char* desktopName;
  229 + char thisHost[255];
  230 +
  231 + rfbBool autoPort;
  232 + int port;
  233 + rfbSocket listenSock;
  234 + int maxSock;
  235 + int maxFd;
  236 +#ifdef WIN32
  237 + struct fd_set allFds;
  238 +#else
  239 + fd_set allFds;
  240 +#endif
  241 +
  242 + enum rfbSocketState socketState;
  243 + rfbSocket inetdSock;
  244 + rfbBool inetdInitDone;
  245 +
  246 + int udpPort;
  247 + rfbSocket udpSock;
  248 + struct _rfbClientRec* udpClient;
  249 + rfbBool udpSockConnected;
  250 + struct sockaddr_in udpRemoteAddr;
  251 +
  252 + int maxClientWait;
  253 +
  254 + /* http stuff */
  255 + rfbBool httpInitDone;
  256 + rfbBool httpEnableProxyConnect;
  257 + int httpPort;
  258 + char* httpDir;
  259 + rfbSocket httpListenSock;
  260 + rfbSocket httpSock;
  261 +
  262 + rfbPasswordCheckProcPtr passwordCheck;
  263 + void* authPasswdData;
  264 + /** If rfbAuthPasswdData is given a list, this is the first
  265 + view only password. */
  266 + int authPasswdFirstViewOnly;
  267 +
  268 + /** send only this many rectangles in one update */
  269 + int maxRectsPerUpdate;
  270 + /** this is the amount of milliseconds to wait at least before sending
  271 + * an update. */
  272 + int deferUpdateTime;
  273 +#ifdef TODELETE
  274 + char* screen;
  275 +#endif
  276 + rfbBool alwaysShared;
  277 + rfbBool neverShared;
  278 + rfbBool dontDisconnect;
  279 + struct _rfbClientRec* clientHead;
  280 + struct _rfbClientRec* pointerClient; /**< "Mutex" for pointer events */
  281 +
  282 +
  283 + /* cursor */
  284 + int cursorX, cursorY,underCursorBufferLen;
  285 + char* underCursorBuffer;
  286 + rfbBool dontConvertRichCursorToXCursor;
  287 + struct rfbCursor* cursor;
  288 +
  289 + /**
  290 + * the frameBuffer has to be supplied by the serving process.
  291 + * The buffer will not be freed by
  292 + */
  293 + char* frameBuffer;
  294 + rfbKbdAddEventProcPtr kbdAddEvent;
  295 + rfbKbdReleaseAllKeysProcPtr kbdReleaseAllKeys;
  296 + rfbPtrAddEventProcPtr ptrAddEvent;
  297 + rfbSetXCutTextProcPtr setXCutText;
  298 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  299 + rfbSetXCutTextUTF8ProcPtr setXCutTextUTF8;
  300 +#endif
  301 + rfbGetCursorProcPtr getCursorPtr;
  302 + rfbSetTranslateFunctionProcPtr setTranslateFunction;
  303 + rfbSetSingleWindowProcPtr setSingleWindow;
  304 + rfbSetServerInputProcPtr setServerInput;
  305 + rfbFileTransferPermitted getFileTransferPermission;
  306 + rfbSetTextChat setTextChat;
  307 +
  308 + /** newClientHook is called just after a new client is created */
  309 + rfbNewClientHookPtr newClientHook;
  310 + /** displayHook is called just before a frame buffer update */
  311 + rfbDisplayHookPtr displayHook;
  312 +
  313 + /** These hooks are called to pass keyboard state back to the client */
  314 + rfbGetKeyboardLedStateHookPtr getKeyboardLedStateHook;
  315 +
  316 +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  317 + MUTEX(cursorMutex);
  318 + rfbBool backgroundLoop;
  319 +#endif
  320 +
  321 + /** if TRUE, an ignoring signal handler is installed for SIGPIPE */
  322 + rfbBool ignoreSIGPIPE;
  323 +
  324 + /** if not zero, only a slice of this height is processed every time
  325 + * an update should be sent. This should make working on a slow
  326 + * link more interactive. */
  327 + int progressiveSliceHeight;
  328 +
  329 + in_addr_t listenInterface;
  330 + int deferPtrUpdateTime;
  331 +
  332 + /** handle as many input events as possible (default off) */
  333 + rfbBool handleEventsEagerly;
  334 +
  335 + /** rfbEncodingServerIdentity */
  336 + char *versionString;
  337 +
  338 + /** What does the server tell the new clients which version it supports */
  339 + int protocolMajorVersion;
  340 + int protocolMinorVersion;
  341 +
  342 + /** command line authorization of file transfers */
  343 + rfbBool permitFileTransfer;
  344 +
  345 + /** displayFinishedHook is called just after a frame buffer update */
  346 + rfbDisplayFinishedHookPtr displayFinishedHook;
  347 + /** xvpHook is called to handle an xvp client message */
  348 + rfbXvpHookPtr xvpHook;
  349 + char *sslkeyfile;
  350 + char *sslcertfile;
  351 + int ipv6port; /**< The port to listen on when using IPv6. */
  352 + char* listen6Interface;
  353 + /* We have an additional IPv6 listen socket since there are systems that
  354 + don't support dual binding sockets under *any* circumstances, for
  355 + instance OpenBSD */
  356 + rfbSocket listen6Sock;
  357 + int http6Port;
  358 + rfbSocket httpListen6Sock;
  359 + /** hook to let client set resolution */
  360 + rfbSetDesktopSizeHookPtr setDesktopSizeHook;
  361 + /** Optional hooks to query ExtendedDesktopSize screen information.
  362 + * If not set it is assumed only one screen is present spanning entire fb */
  363 + rfbNumberOfExtDesktopScreensPtr numberOfExtDesktopScreensHook;
  364 + rfbGetExtDesktopScreenPtr getExtDesktopScreenHook;
  365 + /** This value between 0 and 1.0 defines which fraction of the maximum number
  366 + of file descriptors LibVNCServer uses before denying new client connections.
  367 + It is set to 0.5 per default. */
  368 + float fdQuota;
  369 +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
  370 + pthread_t listener_thread;
  371 + int pipe_notify_listener_thread[2];
  372 +#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  373 + uintptr_t listener_thread;
  374 +#endif
  375 +} rfbScreenInfo, *rfbScreenInfoPtr;
  376 +
  377 +
  378 +/**
  379 + * rfbTranslateFnType is the type of translation functions.
  380 + */
  381 +
  382 +typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in,
  383 + rfbPixelFormat *out,
  384 + char *iptr, char *optr,
  385 + int bytesBetweenInputLines,
  386 + int width, int height);
  387 +
  388 +
  389 +/* region stuff */
  390 +
  391 +struct sraRegion;
  392 +typedef struct sraRegion* sraRegionPtr;
  393 +
  394 +/*
  395 + * Per-client structure.
  396 + */
  397 +
  398 +typedef void (*ClientGoneHookPtr)(struct _rfbClientRec* cl);
  399 +typedef void (*ClientFramebufferUpdateRequestHookPtr)(struct _rfbClientRec* cl, rfbFramebufferUpdateRequestMsg* furMsg);
  400 +
  401 +typedef struct _rfbFileTransferData {
  402 + int fd;
  403 + int compressionEnabled;
  404 + int fileSize;
  405 + int numPackets;
  406 + int receiving;
  407 + int sending;
  408 +} rfbFileTransferData;
  409 +
  410 +
  411 +typedef struct _rfbStatList {
  412 + uint32_t type;
  413 + uint32_t sentCount;
  414 + uint32_t bytesSent;
  415 + uint32_t bytesSentIfRaw;
  416 + uint32_t rcvdCount;
  417 + uint32_t bytesRcvd;
  418 + uint32_t bytesRcvdIfRaw;
  419 + struct _rfbStatList *Next;
  420 +} rfbStatList;
  421 +
  422 +typedef struct _rfbSslCtx rfbSslCtx;
  423 +typedef struct _wsCtx wsCtx;
  424 +
  425 +typedef struct _rfbClientRec {
  426 +
  427 + /** back pointer to the screen */
  428 + rfbScreenInfoPtr screen;
  429 +
  430 + /** points to a scaled version of the screen buffer in cl->scaledScreenList */
  431 + rfbScreenInfoPtr scaledScreen;
  432 + /** how did the client tell us it wanted the screen changed? Ultra style or palm style? */
  433 + rfbBool PalmVNC;
  434 +
  435 +
  436 + /** private data. You should put any application client specific data
  437 + * into a struct and let clientData point to it. Don't forget to
  438 + * free the struct via clientGoneHook!
  439 + *
  440 + * This is useful if the IO functions have to behave client specific.
  441 + */
  442 + void* clientData;
  443 + ClientGoneHookPtr clientGoneHook;
  444 +
  445 + rfbSocket sock;
  446 + char *host;
  447 +
  448 + /* RFB protocol minor version number */
  449 + int protocolMajorVersion;
  450 + int protocolMinorVersion;
  451 +
  452 +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
  453 + pthread_t client_thread;
  454 +#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  455 + uintptr_t client_thread;
  456 +#endif
  457 +
  458 + /* Note that the RFB_INITIALISATION_SHARED state is provided to support
  459 + clients that under some circumstances do not send a ClientInit message.
  460 + In particular the Mac OS X built-in VNC client (with protocolMinorVersion
  461 + == 889) is one of those. However, it only requires this support under
  462 + special circumstances that can only be determined during the initial
  463 + authentication. If the right conditions are met this state will be
  464 + set (see the auth.c file) when rfbProcessClientInitMessage is called.
  465 +
  466 + If the state is RFB_INITIALISATION_SHARED we should not expect to receive
  467 + any ClientInit message, but instead should proceed to the next stage
  468 + of initialisation as though an implicit ClientInit message was received
  469 + with a shared-flag of true. (There is currently no corresponding
  470 + RFB_INITIALISATION_NOTSHARED state to represent an implicit ClientInit
  471 + message with a shared-flag of false because no known existing client
  472 + requires such support at this time.)
  473 +
  474 + Note that software using LibVNCServer to provide a VNC server will only
  475 + ever have a chance to see the state field set to
  476 + RFB_INITIALISATION_SHARED if the software is multi-threaded and manages
  477 + to examine the state field during the extremely brief window after the
  478 + 'None' authentication type selection has been received from the built-in
  479 + OS X VNC client and before the rfbProcessClientInitMessage function is
  480 + called -- control cannot return to the caller during this brief window
  481 + while the state field is set to RFB_INITIALISATION_SHARED. */
  482 +
  483 + /** Possible client states: */
  484 + enum {
  485 + RFB_PROTOCOL_VERSION, /**< establishing protocol version */
  486 + RFB_SECURITY_TYPE, /**< negotiating security (RFB v.3.7) */
  487 + RFB_AUTHENTICATION, /**< authenticating */
  488 + RFB_INITIALISATION, /**< sending initialisation messages */
  489 + RFB_NORMAL, /**< normal protocol messages */
  490 +
  491 + /* Ephemeral internal-use states that will never be seen by software
  492 + * using LibVNCServer to provide services: */
  493 +
  494 + RFB_INITIALISATION_SHARED /**< sending initialisation messages with implicit shared-flag already true */
  495 + } state;
  496 +
  497 + rfbBool reverseConnection;
  498 + rfbBool onHold;
  499 + rfbBool readyForSetColourMapEntries;
  500 + rfbBool useCopyRect;
  501 + int preferredEncoding;
  502 + int correMaxWidth, correMaxHeight;
  503 +
  504 + rfbBool viewOnly;
  505 +
  506 + /* The following member is only used during VNC authentication */
  507 + uint8_t authChallenge[CHALLENGESIZE];
  508 +
  509 + /* The following members represent the update needed to get the client's
  510 + framebuffer from its present state to the current state of our
  511 + framebuffer.
  512 +
  513 + If the client does not accept CopyRect encoding then the update is
  514 + simply represented as the region of the screen which has been modified
  515 + (modifiedRegion).
  516 +
  517 + If the client does accept CopyRect encoding, then the update consists of
  518 + two parts. First we have a single copy from one region of the screen to
  519 + another (the destination of the copy is copyRegion), and second we have
  520 + the region of the screen which has been modified in some other way
  521 + (modifiedRegion).
  522 +
  523 + Although the copy is of a single region, this region may have many
  524 + rectangles. When sending an update, the copyRegion is always sent
  525 + before the modifiedRegion. This is because the modifiedRegion may
  526 + overlap parts of the screen which are in the source of the copy.
  527 +
  528 + In fact during normal processing, the modifiedRegion may even overlap
  529 + the destination copyRegion. Just before an update is sent we remove
  530 + from the copyRegion anything in the modifiedRegion. */
  531 +
  532 + sraRegionPtr copyRegion; /**< the destination region of the copy */
  533 + int copyDX, copyDY; /**< the translation by which the copy happens */
  534 +
  535 + sraRegionPtr modifiedRegion;
  536 +
  537 + /** As part of the FramebufferUpdateRequest, a client can express interest
  538 + in a subrectangle of the whole framebuffer. This is stored in the
  539 + requestedRegion member. In the normal case this is the whole
  540 + framebuffer if the client is ready, empty if it's not. */
  541 +
  542 + sraRegionPtr requestedRegion;
  543 +
  544 + /** The following member represents the state of the "deferred update" timer
  545 + - when the framebuffer is modified and the client is ready, in most
  546 + cases it is more efficient to defer sending the update by a few
  547 + milliseconds so that several changes to the framebuffer can be combined
  548 + into a single update. */
  549 +
  550 + struct timeval startDeferring;
  551 + struct timeval startPtrDeferring;
  552 + int lastPtrX;
  553 + int lastPtrY;
  554 + int lastPtrButtons;
  555 +
  556 + /** translateFn points to the translation function which is used to copy
  557 + and translate a rectangle from the framebuffer to an output buffer. */
  558 +
  559 + rfbTranslateFnType translateFn;
  560 + char *translateLookupTable;
  561 + rfbPixelFormat format;
  562 +
  563 + /**
  564 + * UPDATE_BUF_SIZE must be big enough to send at least one whole line of the
  565 + * framebuffer. So for a max screen width of say 2K with 32-bit pixels this
  566 + * means 8K minimum.
  567 + */
  568 +
  569 +#define UPDATE_BUF_SIZE 30000
  570 +
  571 + char updateBuf[UPDATE_BUF_SIZE];
  572 + int ublen;
  573 +
  574 + /* statistics */
  575 + struct _rfbStatList *statEncList;
  576 + struct _rfbStatList *statMsgList;
  577 + int rawBytesEquivalent;
  578 + int bytesSent;
  579 +
  580 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  581 + /* zlib encoding -- necessary compression state info per client */
  582 +
  583 + struct z_stream_s compStream;
  584 + rfbBool compStreamInited;
  585 + uint32_t zlibCompressLevel;
  586 +#endif
  587 +#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
  588 + /** the quality level is also used by ZYWRLE and TightPng */
  589 + int tightQualityLevel;
  590 +
  591 +#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  592 + /* tight encoding -- preserve zlib streams' state for each client */
  593 + z_stream zsStruct[4];
  594 + rfbBool zsActive[4];
  595 + int zsLevel[4];
  596 + int tightCompressLevel;
  597 +#endif
  598 +#endif
  599 +
  600 + /* Ultra Encoding support */
  601 + rfbBool compStreamInitedLZO;
  602 + char *lzoWrkMem;
  603 +
  604 + rfbFileTransferData fileTransfer;
  605 +
  606 + int lastKeyboardLedState; /**< keep track of last value so we can send *change* events */
  607 + rfbBool enableSupportedMessages; /**< client supports SupportedMessages encoding */
  608 + rfbBool enableSupportedEncodings; /**< client supports SupportedEncodings encoding */
  609 + rfbBool enableServerIdentity; /**< client supports ServerIdentity encoding */
  610 + rfbBool enableKeyboardLedState; /**< client supports KeyboardState encoding */
  611 + rfbBool enableLastRectEncoding; /**< client supports LastRect encoding */
  612 + rfbBool enableCursorShapeUpdates; /**< client supports cursor shape updates */
  613 + rfbBool enableCursorPosUpdates; /**< client supports cursor position updates */
  614 + rfbBool useRichCursorEncoding; /**< rfbEncodingRichCursor is preferred */
  615 + rfbBool cursorWasChanged; /**< cursor shape update should be sent */
  616 + rfbBool cursorWasMoved; /**< cursor position update should be sent */
  617 + int cursorX,cursorY; /**< the coordinates of the cursor,
  618 + if enableCursorShapeUpdates = FALSE */
  619 +
  620 + rfbBool useNewFBSize; /**< client supports NewFBSize encoding */
  621 + rfbBool newFBSizePending; /**< framebuffer size was changed */
  622 +
  623 + struct _rfbClientRec *prev;
  624 + struct _rfbClientRec *next;
  625 +
  626 +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  627 + /** whenever a client is referenced, the refCount has to be incremented
  628 + and afterwards decremented, so that the client is not cleaned up
  629 + while being referenced.
  630 + Use the functions rfbIncrClientRef(cl) and rfbDecrClientRef(cl);
  631 + */
  632 + int refCount;
  633 + MUTEX(refCountMutex);
  634 + COND(deleteCond);
  635 +
  636 + MUTEX(outputMutex);
  637 + MUTEX(updateMutex);
  638 + COND(updateCond);
  639 +#endif
  640 +
  641 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  642 + void* zrleData;
  643 + int zywrleLevel;
  644 + int zywrleBuf[rfbZRLETileWidth * rfbZRLETileHeight];
  645 +#endif
  646 +
  647 + /** if progressive updating is on, this variable holds the current
  648 + * y coordinate of the progressive slice. */
  649 + int progressiveSliceY;
  650 +
  651 + rfbExtensionData* extensions;
  652 +
  653 + /** for threaded zrle */
  654 + char *zrleBeforeBuf;
  655 + void *paletteHelper;
  656 +
  657 + /** for thread safety for rfbSendFBUpdate() */
  658 +#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  659 +#define LIBVNCSERVER_SEND_MUTEX
  660 + MUTEX(sendMutex);
  661 +#endif
  662 +
  663 + /* buffers to hold pixel data before and after encoding.
  664 + per-client for thread safety */
  665 + char *beforeEncBuf;
  666 + int beforeEncBufSize;
  667 + char *afterEncBuf;
  668 + int afterEncBufSize;
  669 + int afterEncBufLen;
  670 +#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
  671 + uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */
  672 +#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  673 + /* TurboVNC Encoding support (extends TightVNC) */
  674 + int turboSubsampLevel;
  675 + int turboQualityLevel; /* 1-100 scale */
  676 +#endif
  677 +#endif
  678 + rfbSslCtx *sslctx;
  679 + wsCtx *wsctx;
  680 + char *wspath; /* Requests path component */
  681 +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
  682 + int pipe_notify_client_thread[2];
  683 +#endif
  684 +
  685 + /**
  686 + * clientFramebufferUpdateRequestHook is called when a client requests a frame
  687 + * buffer update.
  688 + */
  689 + ClientFramebufferUpdateRequestHookPtr clientFramebufferUpdateRequestHook;
  690 +
  691 + rfbBool useExtDesktopSize;
  692 + int requestedDesktopSizeChange;
  693 + int lastDesktopSizeChangeError;
  694 +
  695 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  696 + rfbBool enableExtendedClipboard;
  697 + uint32_t extClipboardUserCap;
  698 + uint32_t extClipboardMaxUnsolicitedSize;
  699 + char *extClipboardData;
  700 + int extClipboardDataSize;
  701 +#endif
  702 +} rfbClientRec, *rfbClientPtr;
  703 +
  704 +/**
  705 + * This macro is used to test whether there is a framebuffer update needing to
  706 + * be sent to the client.
  707 + */
  708 +
  709 +#define FB_UPDATE_PENDING(cl) \
  710 + (((cl)->enableCursorShapeUpdates && (cl)->cursorWasChanged) || \
  711 + (((cl)->enableCursorShapeUpdates == FALSE && \
  712 + ((cl)->cursorX != (cl)->screen->cursorX || \
  713 + (cl)->cursorY != (cl)->screen->cursorY))) || \
  714 + ((cl)->useNewFBSize && (cl)->newFBSizePending) || \
  715 + ((cl)->enableCursorPosUpdates && (cl)->cursorWasMoved) || \
  716 + !sraRgnEmpty((cl)->copyRegion) || !sraRgnEmpty((cl)->modifiedRegion))
  717 +
  718 +/*
  719 + * Macros for endian swapping.
  720 + */
  721 +
  722 +#define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff))
  723 +
  724 +#define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \
  725 + (((l) & 0x00ff00)))
  726 +
  727 +#define Swap32(l) ((((l) >> 24) & 0x000000ff)| \
  728 + (((l) & 0x00ff0000) >> 8) | \
  729 + (((l) & 0x0000ff00) << 8) | \
  730 + (((l) & 0x000000ff) << 24))
  731 +
  732 +
  733 +extern char rfbEndianTest;
  734 +
  735 +#define Swap16IfLE(s) (rfbEndianTest ? Swap16(s) : (s))
  736 +#define Swap24IfLE(l) (rfbEndianTest ? Swap24(l) : (l))
  737 +#define Swap32IfLE(l) (rfbEndianTest ? Swap32(l) : (l))
  738 +
  739 +/* UltraVNC uses some windows structures unmodified, so the viewer expects LittleEndian Data */
  740 +#define Swap16IfBE(s) (rfbEndianTest ? (s) : Swap16(s))
  741 +#define Swap24IfBE(l) (rfbEndianTest ? (l) : Swap24(l))
  742 +#define Swap32IfBE(l) (rfbEndianTest ? (l) : Swap32(l))
  743 +
  744 +/* sockets.c */
  745 +
  746 +extern int rfbMaxClientWait;
  747 +
  748 +extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
  749 +extern void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen);
  750 +extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
  751 +extern void rfbCloseClient(rfbClientPtr cl);
  752 +extern int rfbReadExact(rfbClientPtr cl, char *buf, int len);
  753 +extern int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
  754 +extern int rfbPeekExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
  755 +extern int rfbWriteExact(rfbClientPtr cl, const char *buf, int len);
  756 +extern int rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
  757 +extern rfbSocket rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
  758 +extern rfbSocket rfbConnectToTcpAddr(char* host, int port);
  759 +extern rfbSocket rfbListenOnTCPPort(int port, in_addr_t iface);
  760 +extern rfbSocket rfbListenOnTCP6Port(int port, const char* iface);
  761 +extern rfbSocket rfbListenOnUDPPort(int port, in_addr_t iface);
  762 +extern int rfbStringToAddr(char* string,in_addr_t* addr);
  763 +extern rfbBool rfbSetNonBlocking(rfbSocket sock);
  764 +
  765 +#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
  766 +/* websockets.c */
  767 +
  768 +extern rfbBool webSocketsCheck(rfbClientPtr cl);
  769 +extern rfbBool webSocketCheckDisconnect(rfbClientPtr cl);
  770 +extern int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst);
  771 +extern int webSocketsDecode(rfbClientPtr cl, char *dst, int len);
  772 +extern rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl);
  773 +#endif
  774 +
  775 +/* rfbserver.c */
  776 +
  777 +/* Routines to iterate over the client list in a thread-safe way.
  778 + Only a single iterator can be in use at a time process-wide. */
  779 +typedef struct rfbClientIterator *rfbClientIteratorPtr;
  780 +
  781 +extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
  782 +extern rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen);
  783 +extern rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator);
  784 +extern void rfbReleaseClientIterator(rfbClientIteratorPtr iterator);
  785 +extern void rfbIncrClientRef(rfbClientPtr cl);
  786 +extern void rfbDecrClientRef(rfbClientPtr cl);
  787 +
  788 +extern void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
  789 +extern rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
  790 +extern rfbClientPtr rfbNewUDPClient(rfbScreenInfoPtr rfbScreen);
  791 +extern rfbClientPtr rfbReverseConnection(rfbScreenInfoPtr rfbScreen,char *host, int port);
  792 +extern void rfbClientConnectionGone(rfbClientPtr cl);
  793 +extern void rfbProcessClientMessage(rfbClientPtr cl);
  794 +extern void rfbClientConnFailed(rfbClientPtr cl, const char *reason);
  795 +extern void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
  796 +extern void rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen);
  797 +extern rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion);
  798 +extern rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h);
  799 +extern rfbBool rfbSendUpdateBuf(rfbClientPtr cl);
  800 +extern void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len);
  801 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  802 +extern void rfbSendServerCutTextUTF8(rfbScreenInfoPtr rfbScreen,char *str, int len, char *fallbackLatin1Str, int latin1Len);
  803 +#endif
  804 +extern rfbBool rfbSendCopyRegion(rfbClientPtr cl,sraRegionPtr reg,int dx,int dy);
  805 +extern rfbBool rfbSendLastRectMarker(rfbClientPtr cl);
  806 +extern rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h);
  807 +extern rfbBool rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h);
  808 +extern rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours);
  809 +extern void rfbSendBell(rfbScreenInfoPtr rfbScreen);
  810 +
  811 +extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
  812 +extern rfbBool rfbSendFileTransferChunk(rfbClientPtr cl);
  813 +extern rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer);
  814 +extern rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, const char *buffer);
  815 +extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
  816 +extern rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length);
  817 +
  818 +void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len);
  819 +
  820 +/* translate.c */
  821 +
  822 +extern rfbBool rfbEconomicTranslate;
  823 +
  824 +extern void rfbTranslateNone(char *table, rfbPixelFormat *in,
  825 + rfbPixelFormat *out,
  826 + char *iptr, char *optr,
  827 + int bytesBetweenInputLines,
  828 + int width, int height);
  829 +extern rfbBool rfbSetTranslateFunction(rfbClientPtr cl);
  830 +extern rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours);
  831 +extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours);
  832 +
  833 +/* httpd.c */
  834 +
  835 +extern void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen);
  836 +extern void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen);
  837 +extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
  838 +
  839 +
  840 +
  841 +/* auth.c */
  842 +
  843 +extern void rfbAuthNewClient(rfbClientPtr cl);
  844 +extern void rfbProcessClientSecurityType(rfbClientPtr cl);
  845 +extern void rfbAuthProcessClientMessage(rfbClientPtr cl);
  846 +extern void rfbRegisterSecurityHandler(rfbSecurityHandler* handler);
  847 +extern void rfbUnregisterSecurityHandler(rfbSecurityHandler* handler);
  848 +
  849 +/* rre.c */
  850 +
  851 +extern rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h);
  852 +
  853 +
  854 +/* corre.c */
  855 +
  856 +extern rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h);
  857 +
  858 +
  859 +/* hextile.c */
  860 +
  861 +extern rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
  862 + int h);
  863 +
  864 +/* ultra.c */
  865 +
  866 +/* Set maximum ultra rectangle size in pixels. Always allow at least
  867 + * two scan lines.
  868 + */
  869 +#define ULTRA_MAX_RECT_SIZE (128*256)
  870 +#define ULTRA_MAX_SIZE(min) ((( min * 2 ) > ULTRA_MAX_RECT_SIZE ) ? \
  871 + ( min * 2 ) : ULTRA_MAX_RECT_SIZE )
  872 +
  873 +extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h);
  874 +
  875 +
  876 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  877 +/* zlib.c */
  878 +
  879 +/** Minimum zlib rectangle size in bytes. Anything smaller will
  880 + * not compress well due to overhead.
  881 + */
  882 +#define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17)
  883 +
  884 +/* Set maximum zlib rectangle size in pixels. Always allow at least
  885 + * two scan lines.
  886 + */
  887 +#define ZLIB_MAX_RECT_SIZE (128*256)
  888 +#define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \
  889 + ( min * 2 ) : ZLIB_MAX_RECT_SIZE )
  890 +
  891 +extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
  892 + int h);
  893 +
  894 +#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  895 +/* tight.c */
  896 +
  897 +#define TIGHT_DEFAULT_COMPRESSION 6
  898 +#define TURBO_DEFAULT_SUBSAMP 0
  899 +
  900 +extern rfbBool rfbTightDisableGradient;
  901 +
  902 +extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
  903 +
  904 +extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
  905 +extern rfbBool rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, int h);
  906 +extern rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, int compressedLen);
  907 +
  908 +#if defined(LIBVNCSERVER_HAVE_LIBPNG)
  909 +extern rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x,int y,int w,int h);
  910 +#endif
  911 +
  912 +#endif
  913 +#endif
  914 +
  915 +
  916 +/* cursor.c */
  917 +
  918 +typedef struct rfbCursor {
  919 + /** set this to true if LibVNCServer has to free this cursor */
  920 + rfbBool cleanup, cleanupSource, cleanupMask, cleanupRichSource;
  921 + unsigned char *source; /**< points to bits */
  922 + unsigned char *mask; /**< points to bits */
  923 + unsigned short width, height, xhot, yhot; /**< metrics */
  924 + unsigned short foreRed, foreGreen, foreBlue; /**< device-independent colour */
  925 + unsigned short backRed, backGreen, backBlue; /**< device-independent colour */
  926 + unsigned char *richSource; /**< source bytes for a rich cursor */
  927 + unsigned char *alphaSource; /**< source for alpha blending info */
  928 + rfbBool alphaPreMultiplied; /**< if richSource already has alpha applied */
  929 +} rfbCursor, *rfbCursorPtr;
  930 +extern unsigned char rfbReverseByte[0x100];
  931 +
  932 +extern rfbBool rfbSendCursorShape(rfbClientPtr cl/*, rfbScreenInfoPtr pScreen*/);
  933 +extern rfbBool rfbSendCursorPos(rfbClientPtr cl);
  934 +extern void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap);
  935 +extern rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString);
  936 +extern char* rfbMakeMaskForXCursor(int width,int height,char* cursorString);
  937 +extern char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource);
  938 +extern void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
  939 +extern void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
  940 +extern void rfbFreeCursor(rfbCursorPtr cursor);
  941 +extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c);
  942 +
  943 +/** cursor handling for the pointer */
  944 +extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
  945 +
  946 +/* zrle.c */
  947 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  948 +extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h);
  949 +#endif
  950 +
  951 +/* stats.c */
  952 +
  953 +extern void rfbResetStats(rfbClientPtr cl);
  954 +extern void rfbPrintStats(rfbClientPtr cl);
  955 +
  956 +/* font.c */
  957 +
  958 +typedef struct rfbFontData {
  959 + unsigned char* data;
  960 + /**
  961 + metaData is a 256*5 array:
  962 + for each character
  963 + (offset,width,height,x,y)
  964 + */
  965 + int* metaData;
  966 +} rfbFontData,* rfbFontDataPtr;
  967 +
  968 +int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,rfbPixel colour);
  969 +void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,rfbPixel colour);
  970 +/** if colour==backColour, background is transparent */
  971 +int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
  972 +void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
  973 +int rfbWidthOfString(rfbFontDataPtr font,const char* string);
  974 +int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
  975 +void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
  976 +/** this returns the smallest box enclosing any character of font. */
  977 +void rfbWholeFontBBox(rfbFontDataPtr font,int *x1, int *y1, int *x2, int *y2);
  978 +
  979 +/** dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16 */
  980 +rfbFontDataPtr rfbLoadConsoleFont(char *filename);
  981 +/** free a dynamically loaded font */
  982 +void rfbFreeFont(rfbFontDataPtr font);
  983 +
  984 +/* draw.c */
  985 +
  986 +void rfbFillRect(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
  987 +void rfbDrawPixel(rfbScreenInfoPtr s,int x,int y,rfbPixel col);
  988 +void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
  989 +
  990 +/* selbox.c */
  991 +
  992 +/** this opens a modal select box. list is an array of strings, the end marked
  993 + with a NULL.
  994 + It returns the index in the list or -1 if cancelled or something else
  995 + wasn't kosher. */
  996 +typedef void (*SelectionChangedHookPtr)(int _index);
  997 +extern int rfbSelectBox(rfbScreenInfoPtr rfbScreen,
  998 + rfbFontDataPtr font, char** list,
  999 + int x1, int y1, int x2, int y2,
  1000 + rfbPixel foreColour, rfbPixel backColour,
  1001 + int border,SelectionChangedHookPtr selChangedHook);
  1002 +
  1003 +/* cargs.c */
  1004 +
  1005 +extern void rfbUsage(void);
  1006 +extern void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]);
  1007 +extern rfbBool rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]);
  1008 +extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]);
  1009 +
  1010 +/* main.c */
  1011 +
  1012 +extern void rfbLogEnable(int enabled);
  1013 +typedef void (*rfbLogProc)(const char *format, ...);
  1014 +extern rfbLogProc rfbLog, rfbErr;
  1015 +extern void rfbLogPerror(const char *str);
  1016 +
  1017 +void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
  1018 +void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
  1019 +
  1020 +void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
  1021 +void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
  1022 +
  1023 +void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2);
  1024 +void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
  1025 +void rfbDoNothingWithClient(rfbClientPtr cl);
  1026 +enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl);
  1027 +void rfbRegisterProtocolExtension(rfbProtocolExtension* extension);
  1028 +void rfbUnregisterProtocolExtension(rfbProtocolExtension* extension);
  1029 +struct _rfbProtocolExtension* rfbGetExtensionIterator(void);
  1030 +void rfbReleaseExtensionIterator(void);
  1031 +rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension* extension,
  1032 + void* data);
  1033 +rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension);
  1034 +void* rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension* extension);
  1035 +
  1036 +/** to check against plain passwords */
  1037 +rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
  1038 +
  1039 +/* functions to make a vnc server */
  1040 +extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
  1041 + int width,int height,int bitsPerSample,int samplesPerPixel,
  1042 + int bytesPerPixel);
  1043 +extern void rfbInitServer(rfbScreenInfoPtr rfbScreen);
  1044 +extern void rfbShutdownServer(rfbScreenInfoPtr rfbScreen,rfbBool disconnectClients);
  1045 +extern void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen,char *framebuffer,
  1046 + int width,int height, int bitsPerSample,int samplesPerPixel,
  1047 + int bytesPerPixel);
  1048 +
  1049 +extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);
  1050 +extern void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt, ...);
  1051 +
  1052 +/* functions to accept/refuse a client that has been put on hold
  1053 + by a NewClientHookPtr function. Must not be called in other
  1054 + situations. */
  1055 +extern void rfbStartOnHoldClient(rfbClientPtr cl);
  1056 +extern void rfbRefuseOnHoldClient(rfbClientPtr cl);
  1057 +
  1058 +/* call one of these two functions to service the vnc clients.
  1059 + usec are the microseconds the select on the fds waits.
  1060 + if you are using the event loop, set this to some value > 0, so the
  1061 + server doesn't get a high load just by listening.
  1062 + rfbProcessEvents() returns TRUE if an update was pending. */
  1063 +
  1064 +extern void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground);
  1065 +extern rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec);
  1066 +extern rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo);
  1067 +
  1068 +/**
  1069 + * Register the TightVNC-1.3.x file transfer extension.
  1070 + * NB That TightVNC-2.x uses a different, incompatible file transfer protocol.
  1071 + */
  1072 +void rfbRegisterTightVNCFileTransferExtension(void);
  1073 +/**
  1074 + * Unregister the TightVNC-1.3.x file transfer extension.
  1075 + * NB That TightVNC-2.x uses a different, incompatible file transfer protocol.
  1076 + */
  1077 +void rfbUnregisterTightVNCFileTransferExtension(void);
  1078 +
  1079 +/* Statistics */
  1080 +extern char *messageNameServer2Client(uint32_t type, char *buf, int len);
  1081 +extern char *messageNameClient2Server(uint32_t type, char *buf, int len);
  1082 +extern char *encodingName(uint32_t enc, char *buf, int len);
  1083 +
  1084 +extern rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type);
  1085 +extern rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type);
  1086 +
  1087 +/* Each call to rfbStatRecord* adds one to the rect count for that type */
  1088 +extern void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
  1089 +extern void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount); /* Specifically for tight encoding */
  1090 +extern void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
  1091 +extern void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
  1092 +extern void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
  1093 +extern void rfbResetStats(rfbClientPtr cl);
  1094 +extern void rfbPrintStats(rfbClientPtr cl);
  1095 +
  1096 +extern int rfbStatGetSentBytes(rfbClientPtr cl);
  1097 +extern int rfbStatGetSentBytesIfRaw(rfbClientPtr cl);
  1098 +extern int rfbStatGetRcvdBytes(rfbClientPtr cl);
  1099 +extern int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl);
  1100 +extern int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type);
  1101 +extern int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type);
  1102 +extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type);
  1103 +extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type);
  1104 +
  1105 +/** Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported*/
  1106 +extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_);
  1107 +
  1108 +/** send a TextChat message to a client */
  1109 +extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer);
  1110 +
  1111 +
  1112 +/*
  1113 + * Additions for Qt event loop integration
  1114 + * Original idea taken from vino.
  1115 + */
  1116 +rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen);
  1117 +rfbBool rfbUpdateClient(rfbClientPtr cl);
  1118 +
  1119 +
  1120 +#if(defined __cplusplus)
  1121 +}
  1122 +#endif
  1123 +
  1124 +/**
  1125 + * @}
  1126 + */
  1127 +
  1128 +
  1129 +/**
  1130 + @page libvncserver_doc LibVNCServer Documentation
  1131 + @section create_server Creating a server instance
  1132 + To make a server, you just have to initialise a server structure using the
  1133 + function rfbGetScreen(), like
  1134 + @code
  1135 + rfbScreenInfoPtr screen =
  1136 + rfbGetScreen(argc,argv,screenwidth,screenheight,8,3,bpp);
  1137 + @endcode
  1138 + where byte per pixel should be 1, 2 or 4. If performance doesn't matter,
  1139 + you may try bpp=3 (internally one cannot use native data types in this
  1140 + case; if you want to use this, look at pnmshow24.c).
  1141 +
  1142 + You then can set hooks and io functions (see @ref making_it_interactive) or other
  1143 + options (see @ref server_options).
  1144 +
  1145 + And you allocate the frame buffer like this:
  1146 + @code
  1147 + screen->frameBuffer = (char*)malloc(screenwidth*screenheight*bpp);
  1148 + @endcode
  1149 + After that, you initialize the server, like
  1150 + @code
  1151 + rfbInitServer(screen);
  1152 + @endcode
  1153 + You can use a blocking event loop, a background (pthread based) event loop,
  1154 + or implement your own using the rfbProcessEvents() function.
  1155 +
  1156 + @subsection server_options Optional Server Features
  1157 +
  1158 + These options have to be set between rfbGetScreen() and rfbInitServer().
  1159 +
  1160 + If you already have a socket to talk to, just set rfbScreenInfo::inetdSock
  1161 + (originally this is for inetd handling, but why not use it for your purpose?).
  1162 +
  1163 + To also start an HTTP server (running on port 5800+display_number), you have
  1164 + to set rfbScreenInfo::httpDir to a directory containing vncviewer.jar and
  1165 + index.vnc (like the included "webclients" directory).
  1166 +
  1167 + @section making_it_interactive Making it interactive
  1168 +
  1169 + Whenever you draw something, you have to call
  1170 + @code
  1171 + rfbMarkRectAsModified(screen,x1,y1,x2,y2).
  1172 + @endcode
  1173 + This tells LibVNCServer to send updates to all connected clients.
  1174 +
  1175 + There exist the following IO functions as members of rfbScreen:
  1176 + rfbScreenInfo::kbdAddEvent(), rfbScreenInfo::kbdReleaseAllKeys(), rfbScreenInfo::ptrAddEvent(),
  1177 + rfbScreenInfo::setXCutText() and rfbScreenInfo::setXCutTextUTF8()
  1178 +
  1179 + rfbScreenInfo::kbdAddEvent()
  1180 + is called when a key is pressed.
  1181 + rfbScreenInfo::kbdReleaseAllKeys()
  1182 + is not called at all (maybe in the future).
  1183 + rfbScreenInfo::ptrAddEvent()
  1184 + is called when the mouse moves or a button is pressed.
  1185 + WARNING: if you want to have proper cursor handling, call
  1186 + rfbDefaultPtrAddEvent()
  1187 + in your own function. This sets the coordinates of the cursor.
  1188 + rfbScreenInfo::setXCutText()
  1189 + is called when the selection changes.
  1190 + rfbScreenInfo::setXCutTextUTF8()
  1191 + is called when the selection changes and the ExtendedClipboard extension is enabled.
  1192 +
  1193 + There are only two hooks:
  1194 + rfbScreenInfo::newClientHook()
  1195 + is called when a new client has connected.
  1196 + rfbScreenInfo::displayHook()
  1197 + is called just before a frame buffer update is sent.
  1198 +
  1199 + You can also override the following methods:
  1200 + rfbScreenInfo::getCursorPtr()
  1201 + This could be used to make an animated cursor (if you really want ...)
  1202 + rfbScreenInfo::setTranslateFunction()
  1203 + If you insist on colour maps or something more obscure, you have to
  1204 + implement this. Default is a trueColour mapping.
  1205 +
  1206 + @section cursor_handling Cursor handling
  1207 +
  1208 + The screen holds a pointer
  1209 + rfbScreenInfo::cursor
  1210 + to the current cursor. Whenever you set it, remember that any dynamically
  1211 + created cursor (like return value from rfbMakeXCursor()) is not free'd!
  1212 +
  1213 + The rfbCursor structure consists mainly of a mask and a source. The rfbCursor::mask
  1214 + describes, which pixels are drawn for the cursor (a cursor needn't be
  1215 + rectangular). The rfbCursor::source describes, which colour those pixels should have.
  1216 +
  1217 + The standard is an XCursor: a cursor with a foreground and a background
  1218 + colour (stored in backRed,backGreen,backBlue and the same for foreground
  1219 + in a range from 0-0xffff). Therefore, the arrays "mask" and "source"
  1220 + contain pixels as single bits stored in bytes in MSB order. The rows are
  1221 + padded, such that each row begins with a new byte (i.e. a 10x4
  1222 + cursor's mask has 2x4 bytes, because 2 bytes are needed to hold 10 bits).
  1223 +
  1224 + It is however very easy to make a cursor like this:
  1225 + @code
  1226 + char* cur=" "
  1227 + " xx "
  1228 + " x "
  1229 + " ";
  1230 + char* mask="xxxx"
  1231 + "xxxx"
  1232 + "xxxx"
  1233 + "xxx ";
  1234 + rfbCursorPtr c=rfbMakeXCursor(4,4,cur,mask);
  1235 + @endcode
  1236 + You can even set rfbCursor::mask to NULL in this call and LibVNCServer will calculate
  1237 + a mask for you (dynamically, so you have to free it yourself).
  1238 +
  1239 + There is also an array named rfbCursor::richSource for colourful cursors. They have
  1240 + the same format as the frameBuffer (i.e. if the server is 32 bit,
  1241 + a 10x4 cursor has 4x10x4 bytes).
  1242 +
  1243 + @section screen_client_difference What is the difference between rfbScreenInfoPtr and rfbClientPtr?
  1244 +
  1245 + The rfbScreenInfoPtr is a pointer to a rfbScreenInfo structure, which
  1246 + holds information about the server, like pixel format, io functions,
  1247 + frame buffer etc. The rfbClientPtr is a pointer to an rfbClientRec structure, which holds
  1248 + information about a client, like pixel format, socket of the
  1249 + connection, etc. A server can have several clients, but needn't have any. So, if you
  1250 + have a server and three clients are connected, you have one instance
  1251 + of a rfbScreenInfo and three instances of rfbClientRec's.
  1252 +
  1253 + The rfbClientRec structure holds a member rfbClientRec::screen which points to the server.
  1254 + So, to access the server from the client structure, you use client->screen.
  1255 +
  1256 + To access all clients from a server be sure to use the provided iterator
  1257 + rfbGetClientIterator()
  1258 + with
  1259 + rfbClientIteratorNext()
  1260 + and
  1261 + rfbReleaseClientIterator()
  1262 + to prevent thread clashes.
  1263 +
  1264 + @section example_code Example Code
  1265 +
  1266 + There are two documented examples included:
  1267 + - example.c, a shared scribble sheet
  1268 + - pnmshow.c, a program to show PNMs (pictures) over the net.
  1269 +
  1270 + The examples are not too well documented, but easy straight forward and a
  1271 + good starting point.
  1272 +
  1273 + Try example.c: it outputs on which port it listens (default: 5900), so it is
  1274 + display 0. To view, call @code vncviewer :0 @endcode
  1275 + You should see a sheet with a gradient and "Hello World!" written on it. Try
  1276 + to paint something. Note that every time you click, there is some bigger blot,
  1277 + whereas when you drag the mouse while clicked you draw a line. The size of the
  1278 + blot depends on the mouse button you click. Open a second vncviewer with
  1279 + the same parameters and watch it as you paint in the other window. This also
  1280 + works over internet. You just have to know either the name or the IP of your
  1281 + machine. Then it is @code vncviewer machine.where.example.runs.com:0 @endcode
  1282 + or similar for the remote client. Now you are ready to type something. Be sure
  1283 + that your mouse sits still, because every time the mouse moves, the cursor is
  1284 + reset to the position of the pointer! If you are done with that demo, press
  1285 + the down or up arrows. If your viewer supports it, then the dimensions of the
  1286 + sheet change. Just press Escape in the viewer. Note that the server still
  1287 + runs, even if you closed both windows. When you reconnect now, everything you
  1288 + painted and wrote is still there. You can press "Page Up" for a blank page.
  1289 +
  1290 + The demo pnmshow.c is much simpler: you either provide a filename as argument
  1291 + or pipe a file through stdin. Note that the file has to be a raw pnm/ppm file,
  1292 + i.e. a truecolour graphics. Only the Escape key is implemented. This may be
  1293 + the best starting point if you want to learn how to use LibVNCServer. You
  1294 + are confronted with the fact that the bytes per pixel can only be 8, 16 or 32.
  1295 +*/
  1296 +
  1297 +#endif
rfb/rfbclient.h
@@ -0,0 +1,833 @@ @@ -0,0 +1,833 @@
  1 +#ifndef RFBCLIENT_H
  2 +#define RFBCLIENT_H
  3 +
  4 +/**
  5 + * @defgroup libvncclient_api LibVNCClient API Reference
  6 + * @{
  7 + */
  8 +
  9 +/*
  10 + * Copyright (C) 2017 D. R. Commander. All Rights Reserved.
  11 + * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
  12 + * Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
  13 + * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
  14 + *
  15 + * This is free software; you can redistribute it and/or modify
  16 + * it under the terms of the GNU General Public License as published by
  17 + * the Free Software Foundation; either version 2 of the License, or
  18 + * (at your option) any later version.
  19 + *
  20 + * This software is distributed in the hope that it will be useful,
  21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23 + * GNU General Public License for more details.
  24 + *
  25 + * You should have received a copy of the GNU General Public License
  26 + * along with this software; if not, write to the Free Software
  27 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  28 + * USA.
  29 + */
  30 +
  31 +/**
  32 + * @file rfbclient.h
  33 + */
  34 +
  35 +#ifdef WIN32
  36 +#define WIN32_LEAN_AND_MEAN /* Prevent loading any Winsock 1.x headers from windows.h */
  37 +#ifdef _MSC_VER
  38 +#pragma warning(disable:4996)
  39 +#endif
  40 +#endif
  41 +
  42 +#if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
  43 +#include <arpa/inet.h>
  44 +#include <sys/select.h>
  45 +#endif
  46 +
  47 +#include <stdio.h>
  48 +#include <stdlib.h>
  49 +#include <string.h>
  50 +#if LIBVNCSERVER_HAVE_SYS_TIME_H
  51 +#include <sys/time.h>
  52 +#endif
  53 +#if LIBVNCSERVER_HAVE_UNISTD_H
  54 +#include <unistd.h>
  55 +#endif
  56 +#include <rfb/rfbproto.h>
  57 +#include <rfb/keysym.h>
  58 +#include <rfb/threading.h>
  59 +
  60 +#ifdef LIBVNCSERVER_HAVE_SASL
  61 +#include <sasl/sasl.h>
  62 +#endif /* LIBVNCSERVER_HAVE_SASL */
  63 +
  64 +#define rfbClientSwap16IfLE(s) \
  65 + (*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
  66 +
  67 +#define rfbClientSwap32IfLE(l) \
  68 + (*(char *)&client->endianTest ? ((((l) >> 24) & 0x000000ff) | \
  69 + (((l) & 0x00ff0000) >> 8) | \
  70 + (((l) & 0x0000ff00) << 8) | \
  71 + (((l) & 0x000000ff) << 24)) : (l))
  72 +
  73 +#define rfbClientSwap64IfLE(l) \
  74 + (*(char *)&client->endianTest ? ((((l) >> 56 ) & 0x00000000000000ffULL) | \
  75 + (((l) & 0x00ff000000000000ULL) >> 40) | \
  76 + (((l) & 0x0000ff0000000000ULL) >> 24) | \
  77 + (((l) & 0x000000ff00000000ULL) >> 8) | \
  78 + (((l) & 0x00000000ff000000ULL) << 8) | \
  79 + (((l) & 0x0000000000ff0000ULL) << 24) | \
  80 + (((l) & 0x000000000000ff00ULL) << 40) | \
  81 + (((l) & 0x00000000000000ffULL) << 56)) : (l))
  82 +
  83 +#define FLASH_PORT_OFFSET 5400
  84 +#define LISTEN_PORT_OFFSET 5500
  85 +#define TUNNEL_PORT_OFFSET 5500
  86 +#define SERVER_PORT_OFFSET 5900
  87 +
  88 +#define DEFAULT_CONNECT_TIMEOUT 60
  89 +#define DEFAULT_READ_TIMEOUT 0
  90 +
  91 +#define DEFAULT_SSH_CMD "/usr/bin/ssh"
  92 +#define DEFAULT_TUNNEL_CMD \
  93 + (DEFAULT_SSH_CMD " -f -L %L:localhost:%R %H sleep 20")
  94 +#define DEFAULT_VIA_CMD \
  95 + (DEFAULT_SSH_CMD " -f -L %L:%H:%R %G sleep 20")
  96 +
  97 +#if(defined __cplusplus)
  98 +extern "C"
  99 +{
  100 +#endif
  101 +
  102 +/** vncrec */
  103 +
  104 +typedef struct {
  105 + FILE* file;
  106 + struct timeval tv;
  107 + rfbBool readTimestamp;
  108 + rfbBool doNotSleep;
  109 +} rfbVNCRec;
  110 +
  111 +/** client data */
  112 +
  113 +typedef struct rfbClientData {
  114 + void* tag;
  115 + void* data;
  116 + struct rfbClientData* next;
  117 +} rfbClientData;
  118 +
  119 +/** app data (belongs into rfbClient?) */
  120 +
  121 +typedef struct {
  122 + rfbBool shareDesktop;
  123 + rfbBool viewOnly;
  124 +
  125 + const char* encodingsString;
  126 +
  127 + rfbBool useBGR233;
  128 + int nColours;
  129 + rfbBool forceOwnCmap;
  130 + rfbBool forceTrueColour;
  131 + int requestedDepth;
  132 +
  133 + int compressLevel;
  134 + int qualityLevel;
  135 + rfbBool enableJPEG;
  136 + rfbBool useRemoteCursor;
  137 + rfbBool palmVNC; /**< use palmvnc specific SetScale (vs ultravnc) */
  138 + int scaleSetting; /**< 0 means no scale set, else 1/scaleSetting */
  139 +} AppData;
  140 +
  141 +/** For GetCredentialProc callback function to return */
  142 +typedef union _rfbCredential
  143 +{
  144 + /** X509 (VeNCrypt) */
  145 + struct
  146 + {
  147 + char *x509CACertFile;
  148 + char *x509CACrlFile;
  149 + char *x509ClientCertFile;
  150 + char *x509ClientKeyFile;
  151 + uint8_t x509CrlVerifyMode; /* Only required for OpenSSL - see meanings below */
  152 + } x509Credential;
  153 + /** Plain (VeNCrypt), MSLogon (UltraVNC) */
  154 + struct
  155 + {
  156 + char *username;
  157 + char *password;
  158 + } userCredential;
  159 +} rfbCredential;
  160 +
  161 +#define rfbCredentialTypeX509 1
  162 +#define rfbCredentialTypeUser 2
  163 +
  164 +/* When using OpenSSL, CRLs can be included in both the x509CACrlFile and appended
  165 + to the x509CACertFile as is common with OpenSSL. When rfbX509CrlVerifyAll is
  166 + specified the CRL list must include CRLs for all certificates in the chain */
  167 +#define rfbX509CrlVerifyNone 0 /* No CRL checking is performed */
  168 +#define rfbX509CrlVerifyClient 1 /* Only the leaf server certificate is checked */
  169 +#define rfbX509CrlVerifyAll 2 /* All certificates in the server chain are checked */
  170 +
  171 +struct _rfbClient;
  172 +
  173 +/**
  174 + * Handles a text chat message. If your application should accept text messages
  175 + * from the server, define a function with this prototype and set
  176 + * client->HandleTextChat to a pointer to that function subsequent to your
  177 + * rfbGetClient() call.
  178 + * @param client The client which called the text chat handler
  179 + * @param value text length if text != NULL, or one of rfbTextChatOpen,
  180 + * rfbTextChatClose, rfbTextChatFinished if text == NULL
  181 + * @param text The text message from the server
  182 + */
  183 +typedef void (*HandleTextChatProc)(struct _rfbClient* client, int value, char *text);
  184 +/**
  185 + * Handles XVP server messages. If your application sends XVP messages to the
  186 + * server, you'll want to handle the server's XVP_FAIL and XVP_INIT responses.
  187 + * Define a function with this prototype and set client->HandleXvpMsg to a
  188 + * pointer to that function subsequent to your rfbGetClient() call.
  189 + * @param client The client which called the XVP message handler
  190 + * @param version The highest XVP extension version that the server supports
  191 + * @param opcode The opcode. 0 is XVP_FAIL, 1 is XVP_INIT
  192 + */
  193 +typedef void (*HandleXvpMsgProc)(struct _rfbClient* client, uint8_t version, uint8_t opcode);
  194 +typedef void (*HandleKeyboardLedStateProc)(struct _rfbClient* client, int value, int pad);
  195 +typedef rfbBool (*HandleCursorPosProc)(struct _rfbClient* client, int x, int y);
  196 +typedef void (*SoftCursorLockAreaProc)(struct _rfbClient* client, int x, int y, int w, int h);
  197 +typedef void (*SoftCursorUnlockScreenProc)(struct _rfbClient* client);
  198 +/**
  199 + Callback indicating that a rectangular area of the client's framebuffer was updated.
  200 + As a server will usually send several rects per rfbFramebufferUpdate message, this
  201 + callback is usually called multiple times per rfbFramebufferUpdate message.
  202 + @param client The client whose framebuffer was (partially) updated
  203 + @param x The x-coordinate of the upper left corner of the updated rectangle
  204 + @param y The y-coordinate of the upper left corner of the updated rectangle
  205 + @param w The width of the updated rectangle
  206 + @param h The heigth of the updated rectangle
  207 + */
  208 +typedef void (*GotFrameBufferUpdateProc)(struct _rfbClient* client, int x, int y, int w, int h);
  209 +/**
  210 + Callback indicating that a client has completely processed an rfbFramebufferUpdate
  211 + message sent by a server.
  212 + This is called exactly once per each handled rfbFramebufferUpdate message.
  213 + @param client The client which finished processing an rfbFramebufferUpdate
  214 + */
  215 +typedef void (*FinishedFrameBufferUpdateProc)(struct _rfbClient* client);
  216 +typedef char* (*GetPasswordProc)(struct _rfbClient* client);
  217 +typedef rfbCredential* (*GetCredentialProc)(struct _rfbClient* client, int credentialType);
  218 +typedef rfbBool (*MallocFrameBufferProc)(struct _rfbClient* client);
  219 +typedef void (*GotXCutTextProc)(struct _rfbClient* client, const char *text, int textlen);
  220 +typedef void (*BellProc)(struct _rfbClient* client);
  221 +/**
  222 + Called when a cursor shape update was received from the server. The decoded cursor shape
  223 + will be in client->rcSource. It's up to the application to do something with this, e.g. draw
  224 + into a viewer's window. If you want the server to draw the cursor into the framebuffer, be
  225 + careful not to announce remote cursor support, i.e. not include rfbEncodingXCursor or
  226 + rfbEncodingRichCursor in SetFormatAndEncodings().
  227 +*/
  228 +typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel);
  229 +typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y);
  230 +typedef void (*GotFillRectProc)(struct _rfbClient* client, int x, int y, int w, int h, uint32_t colour);
  231 +typedef void (*GotBitmapProc)(struct _rfbClient* client, const uint8_t* buffer, int x, int y, int w, int h);
  232 +typedef rfbBool (*GotJpegProc)(struct _rfbClient* client, const uint8_t* buffer, int length, int x, int y, int w, int h);
  233 +typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client); /** @deprecated */
  234 +typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client); /** @deprecated */
  235 +
  236 +#ifdef LIBVNCSERVER_HAVE_SASL
  237 +typedef char* (*GetUserProc)(struct _rfbClient* client);
  238 +typedef char* (*GetSASLMechanismProc)(struct _rfbClient* client, char* mechlist);
  239 +#endif /* LIBVNCSERVER_HAVE_SASL */
  240 +
  241 +typedef struct _rfbClient {
  242 + uint8_t* frameBuffer;
  243 + int width, height;
  244 +
  245 + int endianTest;
  246 +
  247 + AppData appData;
  248 +
  249 + const char* programName;
  250 + char* serverHost;
  251 + int serverPort; /**< if -1, then use file recorded by vncrec */
  252 + rfbBool listenSpecified;
  253 + int listenPort, flashPort;
  254 +
  255 + struct {
  256 + int x, y, w, h;
  257 + } updateRect;
  258 +
  259 + /** Note that the CoRRE encoding uses this buffer and assumes it is big enough
  260 + to hold 255 * 255 * 32 bits -> 260100 bytes. 640*480 = 307200 bytes.
  261 + Hextile also assumes it is big enough to hold 16 * 16 * 32 bits.
  262 + Tight encoding assumes BUFFER_SIZE is at least 16384 bytes. */
  263 +
  264 +#define RFB_BUFFER_SIZE (640*480)
  265 + char buffer[RFB_BUFFER_SIZE];
  266 +
  267 + /* rfbproto.c */
  268 +
  269 + rfbSocket sock;
  270 + rfbBool canUseCoRRE;
  271 + rfbBool canUseHextile;
  272 + char *desktopName;
  273 + rfbPixelFormat format;
  274 + rfbServerInitMsg si;
  275 +
  276 + /* sockets.c */
  277 +#define RFB_BUF_SIZE 8192
  278 + char buf[RFB_BUF_SIZE];
  279 + char *bufoutptr;
  280 + unsigned int buffered;
  281 +
  282 + /* The zlib encoding requires expansion/decompression/deflation of the
  283 + compressed data in the "buffer" above into another, result buffer.
  284 + However, the size of the result buffer can be determined precisely
  285 + based on the bitsPerPixel, height and width of the rectangle. We
  286 + allocate this buffer one time to be the full size of the buffer. */
  287 +
  288 + /* Ultra Encoding uses this buffer too */
  289 +
  290 + int ultra_buffer_size;
  291 + char *ultra_buffer;
  292 +
  293 + int raw_buffer_size;
  294 + char *raw_buffer;
  295 +
  296 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  297 + z_stream decompStream;
  298 + rfbBool decompStreamInited;
  299 +#endif
  300 +
  301 +
  302 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  303 + /*
  304 + * Variables for the ``tight'' encoding implementation.
  305 + */
  306 +
  307 + /** Separate buffer for compressed data. */
  308 +#define ZLIB_BUFFER_SIZE 30000
  309 + char zlib_buffer[ZLIB_BUFFER_SIZE];
  310 +
  311 + /* Four independent compression streams for zlib library. */
  312 + z_stream zlibStream[4];
  313 + rfbBool zlibStreamActive[4];
  314 +
  315 + /* Filter stuff. Should be initialized by filter initialization code. */
  316 + rfbBool cutZeros;
  317 + int rectWidth, rectColors;
  318 + char tightPalette[256*4];
  319 + uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
  320 +
  321 +#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  322 + /** JPEG decoder state (obsolete-- do not use). */
  323 + rfbBool jpegError;
  324 +
  325 + struct jpeg_source_mgr* jpegSrcManager;
  326 + void* jpegBufferPtr;
  327 + size_t jpegBufferLen;
  328 +
  329 +#endif
  330 +#endif
  331 +
  332 +
  333 + /* cursor.c */
  334 + /** Holds cursor shape data when received from server. */
  335 + uint8_t *rcSource, *rcMask;
  336 +
  337 + /** private data pointer */
  338 + rfbClientData* clientData;
  339 +
  340 + rfbVNCRec* vncRec;
  341 +
  342 + /* Keyboard State support (is 'Caps Lock' set on the remote display???) */
  343 + int KeyboardLedStateEnabled;
  344 + int CurrentKeyboardLedState;
  345 +
  346 + int canHandleNewFBSize;
  347 +
  348 + /* hooks */
  349 + HandleTextChatProc HandleTextChat;
  350 + HandleKeyboardLedStateProc HandleKeyboardLedState;
  351 + HandleCursorPosProc HandleCursorPos;
  352 + SoftCursorLockAreaProc SoftCursorLockArea;
  353 + SoftCursorUnlockScreenProc SoftCursorUnlockScreen;
  354 + GotFrameBufferUpdateProc GotFrameBufferUpdate;
  355 + /** the pointer returned by GetPassword will be freed after use! */
  356 + GetPasswordProc GetPassword;
  357 + MallocFrameBufferProc MallocFrameBuffer;
  358 + GotXCutTextProc GotXCutText;
  359 + BellProc Bell;
  360 +
  361 + GotCursorShapeProc GotCursorShape;
  362 + GotCopyRectProc GotCopyRect;
  363 +
  364 + /** Which messages are supported by the server
  365 + * This is a *guess* for most servers.
  366 + * (If we can even detect the type of server)
  367 + *
  368 + * If the server supports the "rfbEncodingSupportedMessages"
  369 + * then this will be updated when the encoding is received to
  370 + * accurately reflect the servers capabilities.
  371 + */
  372 + rfbSupportedMessages supportedMessages;
  373 +
  374 + /** negotiated protocol version */
  375 + int major, minor;
  376 +
  377 + /** The selected security types */
  378 + uint32_t authScheme, subAuthScheme;
  379 +
  380 + /** The TLS session for Anonymous TLS and VeNCrypt */
  381 + void* tlsSession;
  382 +
  383 + /** To support security types that requires user input (except VNC password
  384 + * authentication), for example VeNCrypt and MSLogon, this callback function
  385 + * must be set before the authentication. Otherwise, it implicates that the
  386 + * caller application does not support it and related security types should
  387 + * be bypassed.
  388 + */
  389 + GetCredentialProc GetCredential;
  390 +
  391 + /** The 0-terminated security types supported by the client.
  392 + * Set by function SetClientAuthSchemes() */
  393 + uint32_t *clientAuthSchemes;
  394 +
  395 + /** When the server is a repeater, this specifies the final destination */
  396 + char *destHost;
  397 + int destPort;
  398 +
  399 + /** the QoS IP DSCP for this client */
  400 + int QoS_DSCP;
  401 +
  402 + /** hook to handle xvp server messages */
  403 + HandleXvpMsgProc HandleXvpMsg;
  404 +
  405 + /* listen.c */
  406 + rfbSocket listenSock;
  407 +
  408 + FinishedFrameBufferUpdateProc FinishedFrameBufferUpdate;
  409 +
  410 + char *listenAddress;
  411 + /* IPv6 listen socket, address and port*/
  412 + rfbSocket listen6Sock;
  413 + char* listen6Address;
  414 + int listen6Port;
  415 +
  416 + /* Output Window ID. When set, client application enables libvncclient to perform direct rendering in its window */
  417 + unsigned long outputWindow;
  418 +
  419 + /**
  420 + * These lock/unlock hooks are not used anymore. LibVNCClient will now use
  421 + * platform-specific synchronization library to protect concurrent TLS R/W.
  422 + *
  423 + * @deprecated
  424 + */
  425 + LockWriteToTLSProc LockWriteToTLS;
  426 + UnlockWriteToTLSProc UnlockWriteToTLS;
  427 +
  428 + /** Hooks for custom rendering
  429 + *
  430 + * VNC rendering boils down to 3 activities:
  431 + * - GotCopyRect: copy an area of the framebuffer
  432 + * - GotFillRect: fill an area of the framebuffer with a solid color
  433 + * - GotBitmap: copy the bitmap in the buffer into the framebuffer
  434 + * The client application should either set all three of these or none!
  435 + */
  436 + GotFillRectProc GotFillRect;
  437 + GotBitmapProc GotBitmap;
  438 + /** Hook for custom JPEG decoding and rendering */
  439 + GotJpegProc GotJpeg;
  440 +
  441 +#ifdef LIBVNCSERVER_HAVE_SASL
  442 + sasl_conn_t *saslconn;
  443 + const char *saslDecoded;
  444 + unsigned int saslDecodedLength;
  445 + unsigned int saslDecodedOffset;
  446 + sasl_secret_t *saslSecret;
  447 +
  448 + /* Callback to allow the client to choose a preferred mechanism. The string returned will
  449 + be freed once no longer required. */
  450 + GetSASLMechanismProc GetSASLMechanism;
  451 + GetUserProc GetUser;
  452 +
  453 +#endif /* LIBVNCSERVER_HAVE_SASL */
  454 +
  455 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  456 +#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  457 + /** JPEG decoder state. */
  458 + void *tjhnd;
  459 +
  460 +#endif
  461 +#endif
  462 + /* timeout in seconds for select() after connect() */
  463 + unsigned int connectTimeout;
  464 +
  465 + /* timeout in seconds when reading from half-open connections in
  466 + * ReadFromRFBServer() - keep at 0 to disable timeout detection and handling */
  467 + unsigned int readTimeout;
  468 +
  469 + /**
  470 + * Mutex to protect concurrent TLS read/write.
  471 + * For internal use only.
  472 + */
  473 + MUTEX(tlsRwMutex);
  474 +} rfbClient;
  475 +
  476 +/* cursor.c */
  477 +/**
  478 + * Handles XCursor and RichCursor shape updates from the server.
  479 + * We emulate cursor operating on the frame buffer (that is
  480 + * why we call it "software cursor"). This decodes the received cursor
  481 + * shape and hands it over to GotCursorShapeProc, if set.
  482 + */
  483 +extern rfbBool HandleCursorShape(rfbClient* client,int xhot, int yhot, int width, int height, uint32_t enc);
  484 +
  485 +/* listen.c */
  486 +
  487 +extern void listenForIncomingConnections(rfbClient* viewer);
  488 +extern int listenForIncomingConnectionsNoFork(rfbClient* viewer, int usec_timeout);
  489 +
  490 +/* rfbproto.c */
  491 +
  492 +extern rfbBool rfbEnableClientLogging;
  493 +typedef void (*rfbClientLogProc)(const char *format, ...);
  494 +extern rfbClientLogProc rfbClientLog,rfbClientErr;
  495 +extern rfbBool ConnectToRFBServer(rfbClient* client,const char *hostname, int port);
  496 +extern rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int repeaterPort, const char *destHost, int destPort);
  497 +extern void SetClientAuthSchemes(rfbClient* client,const uint32_t *authSchemes, int size);
  498 +extern rfbBool InitialiseRFBConnection(rfbClient* client);
  499 +/**
  500 + * Sends format and encoding parameters to the server. Your application can
  501 + * modify the 'client' data structure directly. However some changes to this
  502 + * structure must be communicated back to the server. For instance, if you
  503 + * change the encoding to hextile, the server needs to know that it should send
  504 + * framebuffer updates in hextile format. Likewise if you change the pixel
  505 + * format of the framebuffer, the server must be notified about this as well.
  506 + * Call this function to propagate your changes of the local 'client' structure
  507 + * over to the server.
  508 + * @li Encoding type
  509 + * @li RFB protocol extensions announced via pseudo-encodings
  510 + * @li Framebuffer pixel format (like RGB vs ARGB)
  511 + * @li Remote cursor support
  512 + * @param client The client in which the format or encodings have been changed
  513 + * @return true if the format or encodings were sent to the server successfully,
  514 + * false otherwise
  515 + */
  516 +extern rfbBool SetFormatAndEncodings(rfbClient* client);
  517 +extern rfbBool SendIncrementalFramebufferUpdateRequest(rfbClient* client);
  518 +/**
  519 + * Sends a framebuffer update request to the server. A VNC client may request an
  520 + * update from the server at any time. You can also specify which portions of
  521 + * the screen you want updated. This can be handy if a pointer is at certain
  522 + * location and the user pressed a mouse button, for instance. Then you can
  523 + * immediately request an update of the region around the pointer from the
  524 + * server.
  525 + * @note The coordinate system is a left-handed Cartesian coordinate system with
  526 + * the Z axis (unused) pointing out of the screen. Alternately you can think of
  527 + * it as a right-handed Cartesian coordinate system with the Z axis pointing
  528 + * into the screen. The origin is at the upper left corner of the framebuffer.
  529 + * @param client The client through which to send the request
  530 + * @param x The horizontal position of the update request rectangle
  531 + * @param y The vertical position of the update request rectangle
  532 + * @param w The width of the update request rectangle
  533 + * @param h The height of the update request rectangle
  534 + * @param incremental false: server sends rectangle even if nothing changed.
  535 + * true: server only sends changed parts of rectangle.
  536 + * @return true if the update request was sent successfully, false otherwise
  537 + */
  538 +extern rfbBool SendFramebufferUpdateRequest(rfbClient* client,
  539 + int x, int y, int w, int h,
  540 + rfbBool incremental);
  541 +extern rfbBool SendScaleSetting(rfbClient* client,int scaleSetting);
  542 +/**
  543 + * Sends a pointer event to the server. A pointer event includes a cursor
  544 + * location and a button mask. The button mask indicates which buttons on the
  545 + * pointing device are pressed. Each button is represented by a bit in the
  546 + * button mask. A 1 indicates the button is pressed while a 0 indicates that it
  547 + * is not pressed. You may use these pre-defined button masks by ORing them
  548 + * together: rfbButton1Mask, rfbButton2Mask, rfbButton3Mask, rfbButton4Mask
  549 + * rfbButton5Mask
  550 + * @note The cursor location is relative to the client's framebuffer, not the
  551 + * client's screen itself.
  552 + * @note The coordinate system is a left-handed Cartesian coordinate system with
  553 + * the Z axis (unused) pointing out of the screen. Alternately you can think of
  554 + * it as a right-handed Cartesian coordinate system with the Z axis pointing
  555 + * into the screen. The origin is at the upper left corner of the screen.
  556 + * @param client The client through which to send the pointer event
  557 + * @param x the horizontal location of the cursor
  558 + * @param y the vertical location of the cursor
  559 + * @param buttonMask the button mask indicating which buttons are pressed
  560 + * @return true if the pointer event was sent successfully, false otherwise
  561 + */
  562 +extern rfbBool SendPointerEvent(rfbClient* client,int x, int y, int buttonMask);
  563 +/**
  564 + * Sends a key event to the server. If your application is not merely a VNC
  565 + * viewer (i.e. it controls the server), you'll want to send the keys that the
  566 + * user presses to the server. Use this function to do that.
  567 + * @param client The client through which to send the key event
  568 + * @param key An rfbKeySym defined in rfb/keysym.h
  569 + * @param down true if this was a key down event, false otherwise
  570 + * @return true if the key event was send successfully, false otherwise
  571 + */
  572 +extern rfbBool SendKeyEvent(rfbClient* client,uint32_t key, rfbBool down);
  573 +/**
  574 + * The same as SendKeyEvent, except a key code will be sent along with the
  575 + * symbol if the server supports extended key events.
  576 + * @param client The client through which to send the key event
  577 + * @param keysym An rfbKeySym defined in rfb/keysym.h
  578 + * @param keycode An XT key code
  579 + * @param down true if this was a key down event, false otherwise
  580 + * @return true if the extended key event is supported and was sent
  581 + * successfully, false otherwise
  582 + */
  583 +extern rfbBool SendExtendedKeyEvent(rfbClient* client, uint32_t keysym, uint32_t keycode, rfbBool down);
  584 +/**
  585 + * Places a string on the server's clipboard. Use this function if you want to
  586 + * be able to copy and paste between the server and your application. For
  587 + * instance, when your application is notified that the user copied some text
  588 + * onto the clipboard, you would call this function to synchronize the server's
  589 + * clipboard with your local clipboard.
  590 + * @param client The client structure through which to send the client cut text
  591 + * message
  592 + * @param str The string to send (doesn't need to be NULL terminated)
  593 + * @param len The length of the string
  594 + * @return true if the client cut message was sent successfully, false otherwise
  595 + */
  596 +extern rfbBool SendClientCutText(rfbClient* client,char *str, int len);
  597 +/**
  598 + * Handles messages from the RFB server. You must call this function
  599 + * intermittently so LibVNCClient can parse messages from the server. For
  600 + * example, if your app has a draw loop, you could place a call to this
  601 + * function within that draw loop.
  602 + * @note You must call WaitForMessage() before you call this function.
  603 + * @param client The client which will handle the RFB server messages
  604 + * @return true if the client was able to handle the RFB server messages, false
  605 + * otherwise
  606 + */
  607 +extern rfbBool HandleRFBServerMessage(rfbClient* client);
  608 +
  609 +/**
  610 + * Sends a text chat message to the server.
  611 + * @param client The client through which to send the message
  612 + * @param text The text to send
  613 + * @return true if the text was sent successfully, false otherwise
  614 + */
  615 +extern rfbBool TextChatSend(rfbClient* client, char *text);
  616 +/**
  617 + * Opens a text chat window on the server.
  618 + * @param client The client through which to send the message
  619 + * @return true if the window was opened successfully, false otherwise
  620 + */
  621 +extern rfbBool TextChatOpen(rfbClient* client);
  622 +/**
  623 + * Closes the text chat window on the server.
  624 + * @param client The client through which to send the message
  625 + * @return true if the window was closed successfully, false otherwise
  626 + */
  627 +extern rfbBool TextChatClose(rfbClient* client);
  628 +extern rfbBool TextChatFinish(rfbClient* client);
  629 +extern rfbBool PermitServerInput(rfbClient* client, int enabled);
  630 +extern rfbBool SendXvpMsg(rfbClient* client, uint8_t version, uint8_t code);
  631 +
  632 +extern void PrintPixelFormat(rfbPixelFormat *format);
  633 +
  634 +extern rfbBool SupportsClient2Server(rfbClient* client, int messageType);
  635 +extern rfbBool SupportsServer2Client(rfbClient* client, int messageType);
  636 +
  637 +/* client data */
  638 +
  639 +/**
  640 + * Associates a client data tag with the given pointer. LibVNCClient has
  641 + * several events to which you can associate your own handlers. These handlers
  642 + * have the client structure as one of their parameters. Sometimes, you may want
  643 + * to make data from elsewhere in your application available to these handlers
  644 + * without using a global variable. To do this, you call
  645 + * rfbClientSetClientData() and associate the data with a tag. Then, your
  646 + * handler can call rfbClientGetClientData() and get the a pointer to the data
  647 + * associated with that tag.
  648 + * @param client The client in which to set the client data
  649 + * @param tag A unique tag which identifies the data
  650 + * @param data A pointer to the data to associate with the tag
  651 + */
  652 +void rfbClientSetClientData(rfbClient* client, void* tag, void* data);
  653 +/**
  654 + * Returns a pointer to the client data associated with the given tag. See the
  655 + * the documentation for rfbClientSetClientData() for a discussion of how you
  656 + * can use client data.
  657 + * @param client The client from which to get the client data
  658 + * @param tag The tag which identifies the client data
  659 + * @return a pointer to the client data
  660 + */
  661 +void* rfbClientGetClientData(rfbClient* client, void* tag);
  662 +
  663 +/* protocol extensions */
  664 +
  665 +typedef struct _rfbClientProtocolExtension {
  666 + int* encodings;
  667 + /** returns TRUE if the encoding was handled */
  668 + rfbBool (*handleEncoding)(rfbClient* cl,
  669 + rfbFramebufferUpdateRectHeader* rect);
  670 + /** returns TRUE if it handled the message */
  671 + rfbBool (*handleMessage)(rfbClient* cl,
  672 + rfbServerToClientMsg* message);
  673 + struct _rfbClientProtocolExtension* next;
  674 + uint32_t const* securityTypes;
  675 + /** returns TRUE if it handled the authentication */
  676 + rfbBool (*handleAuthentication)(rfbClient* cl, uint32_t authScheme);
  677 +} rfbClientProtocolExtension;
  678 +
  679 +void rfbClientRegisterExtension(rfbClientProtocolExtension* e);
  680 +
  681 +/* sockets.c */
  682 +
  683 +extern rfbBool errorMessageOnReadFailure;
  684 +
  685 +extern rfbBool ReadFromRFBServer(rfbClient* client, char *out, unsigned int n);
  686 +extern rfbBool WriteToRFBServer(rfbClient* client, const char *buf, unsigned int n);
  687 +extern int FindFreeTcpPort(void);
  688 +extern rfbSocket ListenAtTcpPort(int port);
  689 +extern rfbSocket ListenAtTcpPortAndAddress(int port, const char *address);
  690 +/**
  691 + Tries to connect to an IPv4 host.
  692 + @param host Binary IPv4 address
  693 + @param port Port
  694 + @return A blocking socket or RFB_INVALID_SOCKET if the connection failed
  695 +*/
  696 +extern rfbSocket ConnectClientToTcpAddr(unsigned int host, int port);
  697 +/**
  698 + Tries to connect to an IPv4 or IPv6 host.
  699 + @param hostname A hostname or IP address
  700 + @param port Port
  701 + @return A blocking socket or RFB_INVALID_SOCKET if the connection failed
  702 +*/
  703 +extern rfbSocket ConnectClientToTcpAddr6(const char *hostname, int port);
  704 +/**
  705 + Tries to connect to a Unix socket.
  706 + @param sockFile Path of the socket file
  707 + @return A blocking socket or RFB_INVALID_SOCKET if the connection failed
  708 +*/
  709 +extern rfbSocket ConnectClientToUnixSock(const char *sockFile);
  710 +/**
  711 + Tries to connect to an IPv4 host using the given timeout value.
  712 + @param host Binary IPv4 address
  713 + @param port Port
  714 + @param timeout The time in seconds to wait for a connection
  715 + @return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
  716 +*/
  717 +extern rfbSocket ConnectClientToTcpAddrWithTimeout(unsigned int host, int port, unsigned int timeout);
  718 +/**
  719 + Tries to connect to an IPv4 or IPv6 host using the given timeout value.
  720 + @param hostname A hostname or IP address
  721 + @param port Port
  722 + @param timeout The time in seconds to wait for a connection
  723 + @return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
  724 +*/
  725 +extern rfbSocket ConnectClientToTcpAddr6WithTimeout(const char *hostname, int port, unsigned int timeout);
  726 +/**
  727 + Tries to connect to a Unix socket using the given timeout value.
  728 + @param sockFile Path of the socket file
  729 + @param timeout The time in seconds to wait for a connection
  730 + @return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
  731 +*/
  732 +extern rfbSocket ConnectClientToUnixSockWithTimeout(const char *sockFile, unsigned int timeout);
  733 +extern rfbSocket AcceptTcpConnection(rfbSocket listenSock);
  734 +extern rfbBool SetNonBlocking(rfbSocket sock);
  735 +extern rfbBool SetBlocking(rfbSocket sock);
  736 +extern rfbBool SetDSCP(rfbSocket sock, int dscp);
  737 +
  738 +extern rfbBool StringToIPAddr(const char *str, unsigned int *addr);
  739 +extern rfbBool SameMachine(rfbSocket sock);
  740 +/**
  741 + * Waits for an RFB message to arrive from the server. Before handling a message
  742 + * with HandleRFBServerMessage(), you must wait for your client to receive one.
  743 + * This function blocks until a message is received. You may specify a timeout
  744 + * in microseconds. Once this number of microseconds have elapsed, the function
  745 + * will return.
  746 + * @param client The client to cause to wait until a message is received
  747 + * @param usecs The timeout in microseconds
  748 + * @return the return value of the underlying select() call
  749 + */
  750 +extern int WaitForMessage(rfbClient* client,unsigned int usecs);
  751 +
  752 +/* vncviewer.c */
  753 +/**
  754 + * Allocates and returns a pointer to an rfbClient structure. This will probably
  755 + * be the first LibVNCClient function your client code calls. Most libVNCClient
  756 + * functions operate on an rfbClient structure, and this function allocates
  757 + * memory for that structure. When you're done with the rfbClient structure
  758 + * pointer this function returns, you should free the memory rfbGetClient()
  759 + * allocated by calling rfbClientCleanup().
  760 + *
  761 + * A pixel is one dot on the screen. The number of bytes in a pixel will depend
  762 + * on the number of samples in that pixel and the number of bits in each sample.
  763 + * A sample represents one of the primary colors in a color model. The RGB
  764 + * color model uses red, green, and blue samples respectively. Suppose you
  765 + * wanted to use 16-bit RGB color: You would have three samples per pixel (one
  766 + * for each primary color), five bits per sample (the quotient of 16 RGB bits
  767 + * divided by three samples), and two bytes per pixel (the smallest multiple of
  768 + * eight bits in which the 16-bit pixel will fit). If you wanted 32-bit RGB
  769 + * color, you would have three samples per pixel again, eight bits per sample
  770 + * (since that's how 32-bit color is defined), and four bytes per pixel (the
  771 + * smallest multiple of eight bits in which the 32-bit pixel will fit.
  772 + * @param bitsPerSample The number of bits in a sample
  773 + * @param samplesPerPixel The number of samples in a pixel
  774 + * @param bytesPerPixel The number of bytes in a pixel
  775 + * @return a pointer to the allocated rfbClient structure
  776 + */
  777 +rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,int bytesPerPixel);
  778 +/**
  779 + * Initializes the client. The format is {PROGRAM_NAME, [OPTIONS]..., HOST}. This
  780 + * function does not initialize the program name if the rfbClient's program
  781 + * name is set already. The options are as follows:
  782 + * <table>
  783 + * <tr><th>Option</th><th>Description</th></tr>
  784 + * <tr><td>-listen</td><td>Listen for incoming connections.</td></tr>
  785 + * <tr><td>-listennofork</td><td>Listen for incoming connections without forking.
  786 + * </td></tr>
  787 + * <tr><td>-play</td><td>Set this client to replay a previously recorded session.</td></tr>
  788 + * <tr><td>-encodings</td><td>Set the encodings to use. The next item in the
  789 + * argv array is the encodings string, consisting of comma separated encodings like 'tight,ultra,raw'.</td></tr>
  790 + * <tr><td>-compress</td><td>Set the compression level. The next item in the
  791 + * argv array is the compression level as an integer. Ranges from 0 (lowest) to 9 (highest).
  792 + * </td></tr>
  793 + * <tr><td>-scale</td><td>Set the scaling level. The next item in the
  794 + * argv array is the scaling level as an integer. The screen will be scaled down by this factor.</td></tr>
  795 + * <tr><td>-qosdscp</td><td>Set the Quality of Service Differentiated Services
  796 + * Code Point (QoS DSCP). The next item in the argv array is the code point as
  797 + * an integer.</td></tr>
  798 + * <tr><td>-repeaterdest</td><td>Set a VNC repeater address. The next item in the argv array is
  799 + * the repeater's address as a string.</td></tr>
  800 + * </table>
  801 + *
  802 + * The host may include a port number (delimited by a ':').
  803 + * @param client The client to initialize
  804 + * @param argc The number of arguments to the initializer
  805 + * @param argv The arguments to the initializer as an array of NULL terminated
  806 + * strings
  807 + * @return true if the client was initialized successfully, false otherwise.
  808 + */
  809 +rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv);
  810 +/**
  811 + * Cleans up the client structure and releases the memory allocated for it. You
  812 + * should call this when you're done with the rfbClient structure that you
  813 + * allocated with rfbGetClient().
  814 + * @note rfbClientCleanup() does not touch client->frameBuffer.
  815 + * @param client The client to clean up
  816 + */
  817 +void rfbClientCleanup(rfbClient* client);
  818 +
  819 +#if(defined __cplusplus)
  820 +}
  821 +#endif
  822 +
  823 +/**
  824 + * @}
  825 + */
  826 +
  827 +/**
  828 + @page libvncclient_doc LibVNCClient Documentation
  829 + @section example_code Example Code
  830 + See SDLvncviewer.c for a rather complete client example.
  831 +*/
  832 +
  833 +#endif
rfb/rfbconfig.h
@@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
  1 +#ifndef _RFB_RFBCONFIG_H
  2 +#define _RFB_RFBCONFIG_H 1
  3 +
  4 +/* rfb/rfbconfig.h. Generated automatically by cmake. */
  5 +
  6 +/* Enable 24 bit per pixel in native framebuffer */
  7 +#define LIBVNCSERVER_ALLOW24BPP 1
  8 +
  9 +/* work around when write() returns ENOENT but does not mean it */
  10 +#define LIBVNCSERVER_ENOENT_WORKAROUND 1
  11 +
  12 +/* Define to 1 if you have the <dirent.h> header file. */
  13 +#define LIBVNCSERVER_HAVE_DIRENT_H 1
  14 +
  15 +/* Define to 1 if you have the <endian.h> header file. */
  16 +#define LIBVNCSERVER_HAVE_ENDIAN_H 1
  17 +
  18 +/* Define to 1 if you have the <fcntl.h> header file. */
  19 +#define LIBVNCSERVER_HAVE_FCNTL_H 1
  20 +
  21 +/* Define to 1 if you have the `gettimeofday' function. */
  22 +#define LIBVNCSERVER_HAVE_GETTIMEOFDAY 1
  23 +
  24 +/* Define to 1 if you have the `ftime' function. */
  25 +#define LIBVNCSERVER_HAVE_FTIME 1
  26 +
  27 +/* Define to 1 if you have the `gethostbyname' function. */
  28 +#define LIBVNCSERVER_HAVE_GETHOSTBYNAME 1
  29 +
  30 +/* Define to 1 if you have the `gethostname' function. */
  31 +#define LIBVNCSERVER_HAVE_GETHOSTNAME 1
  32 +
  33 +/* Define to 1 if you have the `inet_ntoa' function. */
  34 +#define LIBVNCSERVER_HAVE_INET_NTOA 1
  35 +
  36 +/* Define to 1 if you have the `memmove' function. */
  37 +#define LIBVNCSERVER_HAVE_MEMMOVE 1
  38 +
  39 +/* Define to 1 if you have the `memset' function. */
  40 +#define LIBVNCSERVER_HAVE_MEMSET 1
  41 +
  42 +/* Define to 1 if you have the `mkfifo' function. */
  43 +#define LIBVNCSERVER_HAVE_MKFIFO 1
  44 +
  45 +/* Define to 1 if you have the `select' function. */
  46 +#define LIBVNCSERVER_HAVE_SELECT 1
  47 +
  48 +/* Define to 1 if you have the `socket' function. */
  49 +#define LIBVNCSERVER_HAVE_SOCKET 1
  50 +
  51 +/* Define to 1 if you have the `strchr' function. */
  52 +#define LIBVNCSERVER_HAVE_STRCHR 1
  53 +
  54 +/* Define to 1 if you have the `strcspn' function. */
  55 +#define LIBVNCSERVER_HAVE_STRCSPN 1
  56 +
  57 +/* Define to 1 if you have the `strdup' function. */
  58 +#define LIBVNCSERVER_HAVE_STRDUP 1
  59 +
  60 +/* Define to 1 if you have the `strerror' function. */
  61 +#define LIBVNCSERVER_HAVE_STRERROR 1
  62 +
  63 +/* Define to 1 if you have the `strstr' function. */
  64 +#define LIBVNCSERVER_HAVE_STRSTR 1
  65 +
  66 +/* Define to 1 if you have the `jpeg' library (-ljpeg). */
  67 +#define LIBVNCSERVER_HAVE_LIBJPEG 1
  68 +
  69 +/* Define if you have the `png' library (-lpng). */
  70 +#define LIBVNCSERVER_HAVE_LIBPNG 1
  71 +
  72 +/* Define to 1 if you have the `pthread' library (-lpthread). */
  73 +#define LIBVNCSERVER_HAVE_LIBPTHREAD 1
  74 +
  75 +/* Define to 1 if you have win32 threads. */
  76 +#define LIBVNCSERVER_HAVE_WIN32THREADS 1
  77 +
  78 +/* Define to 1 if you have the `z' library (-lz). */
  79 +#define LIBVNCSERVER_HAVE_LIBZ 1
  80 +
  81 +/* Define to 1 if you have the `lzo2' library (-llzo2). */
  82 +#define LIBVNCSERVER_HAVE_LZO 1
  83 +
  84 +/* Define to 1 if you have the <netinet/in.h> header file. */
  85 +#define LIBVNCSERVER_HAVE_NETINET_IN_H 1
  86 +
  87 +/* Define to 1 if you have the <sys/endian.h> header file. */
  88 +#define LIBVNCSERVER_HAVE_SYS_ENDIAN_H 1
  89 +
  90 +/* Define to 1 if you have the <sys/socket.h> header file. */
  91 +#define LIBVNCSERVER_HAVE_SYS_SOCKET_H 1
  92 +
  93 +/* Define to 1 if you have the <sys/stat.h> header file. */
  94 +#define LIBVNCSERVER_HAVE_SYS_STAT_H 1
  95 +
  96 +/* Define to 1 if you have the <sys/time.h> header file. */
  97 +#define LIBVNCSERVER_HAVE_SYS_TIME_H 1
  98 +
  99 +/* Define to 1 if you have the <sys/types.h> header file. */
  100 +#define LIBVNCSERVER_HAVE_SYS_TYPES_H 1
  101 +
  102 +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
  103 +#define LIBVNCSERVER_HAVE_SYS_WAIT_H 1
  104 +
  105 +/* Define to 1 if you have <sys/uio.h> */
  106 +#define LIBVNCSERVER_HAVE_SYS_UIO_H 1
  107 +
  108 +/* Define to 1 if you have <sys/resource.h> */
  109 +#define LIBVNCSERVER_HAVE_SYS_RESOURCE_H 1
  110 +
  111 +/* Define to 1 if you have the <unistd.h> header file. */
  112 +#define LIBVNCSERVER_HAVE_UNISTD_H 1
  113 +
  114 +/* Define to 1 if you have the `vfork' function. */
  115 +#define LIBVNCSERVER_HAVE_VFORK 1
  116 +
  117 +/* Define to 1 if you have the <vfork.h> header file. */
  118 +#define LIBVNCSERVER_HAVE_VFORK_H 1
  119 +
  120 +/* Define to 1 if you have the `vprintf' function. */
  121 +#define LIBVNCSERVER_HAVE_VPRINTF 1
  122 +
  123 +/* Define to 1 if `fork' works. */
  124 +#define LIBVNCSERVER_HAVE_WORKING_FORK 1
  125 +
  126 +/* Define to 1 if `vfork' works. */
  127 +#define LIBVNCSERVER_HAVE_WORKING_VFORK 1
  128 +
  129 +/* Define to 1 if `mmap' exists. */
  130 +#define LIBVNCSERVER_HAVE_MMAP 1
  131 +
  132 +/* Define to 1 if `fork' exists. */
  133 +#define LIBVNCSERVER_HAVE_FORK 1
  134 +
  135 +/* Define to 1 if you have the <ws2tcpip.h> header file. */
  136 +#define LIBVNCSERVER_HAVE_WS2TCPIP_H 1
  137 +
  138 +/* Enable IPv6 support */
  139 +#define LIBVNCSERVER_IPv6 1
  140 +
  141 +/* Need a typedef for in_addr_t */
  142 +#define LIBVNCSERVER_NEED_INADDR_T 1
  143 +
  144 +/* Define to the full name and version of this package. */
  145 +#define LIBVNCSERVER_PACKAGE_STRING "@FULL_PACKAGE_NAME@ @LibVNCServer_VERSION@"
  146 +
  147 +/* Define to the version of this package. */
  148 +#define LIBVNCSERVER_PACKAGE_VERSION "@LibVNCServer_VERSION@"
  149 +#define LIBVNCSERVER_VERSION "@LibVNCServer_VERSION@"
  150 +#define LIBVNCSERVER_VERSION_MAJOR "@LibVNCServer_VERSION_MAJOR@"
  151 +#define LIBVNCSERVER_VERSION_MINOR "@LibVNCServer_VERSION_MINOR@"
  152 +#define LIBVNCSERVER_VERSION_PATCHLEVEL "@LibVNCServer_VERSION_PATCH@"
  153 +
  154 +/* Define to 1 if libgcrypt is present */
  155 +#define LIBVNCSERVER_HAVE_LIBGCRYPT 1
  156 +
  157 +/* Define to 1 if GnuTLS is present */
  158 +#define LIBVNCSERVER_HAVE_GNUTLS 1
  159 +
  160 +/* Define to 1 if OpenSSL is present */
  161 +#define LIBVNCSERVER_HAVE_LIBSSL 1
  162 +
  163 +/* Define to 1 if Cyrus SASL is present */
  164 +#define LIBVNCSERVER_HAVE_SASL 1
  165 +
  166 +/* Define to 1 to build with websockets */
  167 +#define LIBVNCSERVER_WITH_WEBSOCKETS 1
  168 +
  169 +/* Define to 1 if your processor stores words with the most significant byte
  170 + first (like Motorola and SPARC, unlike Intel and VAX). */
  171 +#define LIBVNCSERVER_WORDS_BIGENDIAN 1
  172 +
  173 +/* Define to empty if `const' does not conform to ANSI C. */
  174 +/* #define const @CMAKE_CONST@ */
  175 +
  176 +/* Define to `__inline__' or `__inline' if that's what the C compiler
  177 + calls it, or to nothing if 'inline' is not supported under any name. */
  178 +/* #ifndef __cplusplus */
  179 +/* #define inline @CMAKE_INLINE@ */
  180 +/* #endif */
  181 +
  182 +/* Define to `int' if <sys/types.h> does not define. */
  183 +#define HAVE_LIBVNCSERVER_PID_T 1
  184 +#ifndef HAVE_LIBVNCSERVER_PID_T
  185 +typedef int pid_t;
  186 +#endif
  187 +
  188 +/* The type for size_t */
  189 +#define HAVE_LIBVNCSERVER_SIZE_T 1
  190 +#ifndef HAVE_LIBVNCSERVER_SIZE_T
  191 +typedef int size_t;
  192 +#endif
  193 +
  194 +/* The type for socklen */
  195 +#define HAVE_LIBVNCSERVER_SOCKLEN_T 1
  196 +#ifndef HAVE_LIBVNCSERVER_SOCKLEN_T
  197 +typedef int socklen_t;
  198 +#endif
  199 +
  200 +/* once: _RFB_RFBCONFIG_H */
  201 +#endif
rfb/rfbconfig.h.cmakein
@@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
  1 +#ifndef _RFB_RFBCONFIG_H
  2 +#cmakedefine _RFB_RFBCONFIG_H 1
  3 +
  4 +/* rfb/rfbconfig.h. Generated automatically by cmake. */
  5 +
  6 +/* Enable 24 bit per pixel in native framebuffer */
  7 +#cmakedefine LIBVNCSERVER_ALLOW24BPP 1
  8 +
  9 +/* work around when write() returns ENOENT but does not mean it */
  10 +#cmakedefine LIBVNCSERVER_ENOENT_WORKAROUND 1
  11 +
  12 +/* Define to 1 if you have the <dirent.h> header file. */
  13 +#cmakedefine LIBVNCSERVER_HAVE_DIRENT_H 1
  14 +
  15 +/* Define to 1 if you have the <endian.h> header file. */
  16 +#cmakedefine LIBVNCSERVER_HAVE_ENDIAN_H 1
  17 +
  18 +/* Define to 1 if you have the <fcntl.h> header file. */
  19 +#cmakedefine LIBVNCSERVER_HAVE_FCNTL_H 1
  20 +
  21 +/* Define to 1 if you have the `gettimeofday' function. */
  22 +#cmakedefine LIBVNCSERVER_HAVE_GETTIMEOFDAY 1
  23 +
  24 +/* Define to 1 if you have the `ftime' function. */
  25 +#cmakedefine LIBVNCSERVER_HAVE_FTIME 1
  26 +
  27 +/* Define to 1 if you have the `gethostbyname' function. */
  28 +#cmakedefine LIBVNCSERVER_HAVE_GETHOSTBYNAME 1
  29 +
  30 +/* Define to 1 if you have the `gethostname' function. */
  31 +#cmakedefine LIBVNCSERVER_HAVE_GETHOSTNAME 1
  32 +
  33 +/* Define to 1 if you have the `inet_ntoa' function. */
  34 +#cmakedefine LIBVNCSERVER_HAVE_INET_NTOA 1
  35 +
  36 +/* Define to 1 if you have the `memmove' function. */
  37 +#cmakedefine LIBVNCSERVER_HAVE_MEMMOVE 1
  38 +
  39 +/* Define to 1 if you have the `memset' function. */
  40 +#cmakedefine LIBVNCSERVER_HAVE_MEMSET 1
  41 +
  42 +/* Define to 1 if you have the `mkfifo' function. */
  43 +#cmakedefine LIBVNCSERVER_HAVE_MKFIFO 1
  44 +
  45 +/* Define to 1 if you have the `select' function. */
  46 +#cmakedefine LIBVNCSERVER_HAVE_SELECT 1
  47 +
  48 +/* Define to 1 if you have the `socket' function. */
  49 +#cmakedefine LIBVNCSERVER_HAVE_SOCKET 1
  50 +
  51 +/* Define to 1 if you have the `strchr' function. */
  52 +#cmakedefine LIBVNCSERVER_HAVE_STRCHR 1
  53 +
  54 +/* Define to 1 if you have the `strcspn' function. */
  55 +#cmakedefine LIBVNCSERVER_HAVE_STRCSPN 1
  56 +
  57 +/* Define to 1 if you have the `strdup' function. */
  58 +#cmakedefine LIBVNCSERVER_HAVE_STRDUP 1
  59 +
  60 +/* Define to 1 if you have the `strerror' function. */
  61 +#cmakedefine LIBVNCSERVER_HAVE_STRERROR 1
  62 +
  63 +/* Define to 1 if you have the `strstr' function. */
  64 +#cmakedefine LIBVNCSERVER_HAVE_STRSTR 1
  65 +
  66 +/* Define to 1 if you have the `jpeg' library (-ljpeg). */
  67 +#cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1
  68 +
  69 +/* Define if you have the `png' library (-lpng). */
  70 +#cmakedefine LIBVNCSERVER_HAVE_LIBPNG 1
  71 +
  72 +/* Define to 1 if you have the `pthread' library (-lpthread). */
  73 +#cmakedefine LIBVNCSERVER_HAVE_LIBPTHREAD 1
  74 +
  75 +/* Define to 1 if you have win32 threads. */
  76 +#cmakedefine LIBVNCSERVER_HAVE_WIN32THREADS 1
  77 +
  78 +/* Define to 1 if you have the `z' library (-lz). */
  79 +#cmakedefine LIBVNCSERVER_HAVE_LIBZ 1
  80 +
  81 +/* Define to 1 if you have the `lzo2' library (-llzo2). */
  82 +#cmakedefine LIBVNCSERVER_HAVE_LZO 1
  83 +
  84 +/* Define to 1 if you have the <netinet/in.h> header file. */
  85 +#cmakedefine LIBVNCSERVER_HAVE_NETINET_IN_H 1
  86 +
  87 +/* Define to 1 if you have the <sys/endian.h> header file. */
  88 +#cmakedefine LIBVNCSERVER_HAVE_SYS_ENDIAN_H 1
  89 +
  90 +/* Define to 1 if you have the <sys/socket.h> header file. */
  91 +#cmakedefine LIBVNCSERVER_HAVE_SYS_SOCKET_H 1
  92 +
  93 +/* Define to 1 if you have the <sys/stat.h> header file. */
  94 +#cmakedefine LIBVNCSERVER_HAVE_SYS_STAT_H 1
  95 +
  96 +/* Define to 1 if you have the <sys/time.h> header file. */
  97 +#cmakedefine LIBVNCSERVER_HAVE_SYS_TIME_H 1
  98 +
  99 +/* Define to 1 if you have the <sys/types.h> header file. */
  100 +#cmakedefine LIBVNCSERVER_HAVE_SYS_TYPES_H 1
  101 +
  102 +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
  103 +#cmakedefine LIBVNCSERVER_HAVE_SYS_WAIT_H 1
  104 +
  105 +/* Define to 1 if you have <sys/uio.h> */
  106 +#cmakedefine LIBVNCSERVER_HAVE_SYS_UIO_H 1
  107 +
  108 +/* Define to 1 if you have <sys/resource.h> */
  109 +#cmakedefine LIBVNCSERVER_HAVE_SYS_RESOURCE_H 1
  110 +
  111 +/* Define to 1 if you have the <unistd.h> header file. */
  112 +#cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1
  113 +
  114 +/* Define to 1 if you have the `vfork' function. */
  115 +#cmakedefine LIBVNCSERVER_HAVE_VFORK 1
  116 +
  117 +/* Define to 1 if you have the <vfork.h> header file. */
  118 +#cmakedefine LIBVNCSERVER_HAVE_VFORK_H 1
  119 +
  120 +/* Define to 1 if you have the `vprintf' function. */
  121 +#cmakedefine LIBVNCSERVER_HAVE_VPRINTF 1
  122 +
  123 +/* Define to 1 if `fork' works. */
  124 +#cmakedefine LIBVNCSERVER_HAVE_WORKING_FORK 1
  125 +
  126 +/* Define to 1 if `vfork' works. */
  127 +#cmakedefine LIBVNCSERVER_HAVE_WORKING_VFORK 1
  128 +
  129 +/* Define to 1 if `mmap' exists. */
  130 +#cmakedefine LIBVNCSERVER_HAVE_MMAP 1
  131 +
  132 +/* Define to 1 if `fork' exists. */
  133 +#cmakedefine LIBVNCSERVER_HAVE_FORK 1
  134 +
  135 +/* Define to 1 if you have the <ws2tcpip.h> header file. */
  136 +#cmakedefine LIBVNCSERVER_HAVE_WS2TCPIP_H 1
  137 +
  138 +/* Enable IPv6 support */
  139 +#cmakedefine LIBVNCSERVER_IPv6 1
  140 +
  141 +/* Need a typedef for in_addr_t */
  142 +#cmakedefine LIBVNCSERVER_NEED_INADDR_T 1
  143 +
  144 +/* Define to the full name and version of this package. */
  145 +#define LIBVNCSERVER_PACKAGE_STRING "@FULL_PACKAGE_NAME@ @LibVNCServer_VERSION@"
  146 +
  147 +/* Define to the version of this package. */
  148 +#define LIBVNCSERVER_PACKAGE_VERSION "@LibVNCServer_VERSION@"
  149 +#define LIBVNCSERVER_VERSION "@LibVNCServer_VERSION@"
  150 +#define LIBVNCSERVER_VERSION_MAJOR "@LibVNCServer_VERSION_MAJOR@"
  151 +#define LIBVNCSERVER_VERSION_MINOR "@LibVNCServer_VERSION_MINOR@"
  152 +#define LIBVNCSERVER_VERSION_PATCHLEVEL "@LibVNCServer_VERSION_PATCH@"
  153 +
  154 +/* Define to 1 if libgcrypt is present */
  155 +#cmakedefine LIBVNCSERVER_HAVE_LIBGCRYPT 1
  156 +
  157 +/* Define to 1 if GnuTLS is present */
  158 +#cmakedefine LIBVNCSERVER_HAVE_GNUTLS 1
  159 +
  160 +/* Define to 1 if OpenSSL is present */
  161 +#cmakedefine LIBVNCSERVER_HAVE_LIBSSL 1
  162 +
  163 +/* Define to 1 if Cyrus SASL is present */
  164 +#cmakedefine LIBVNCSERVER_HAVE_SASL 1
  165 +
  166 +/* Define to 1 to build with websockets */
  167 +#cmakedefine LIBVNCSERVER_WITH_WEBSOCKETS 1
  168 +
  169 +/* Define to 1 if your processor stores words with the most significant byte
  170 + first (like Motorola and SPARC, unlike Intel and VAX). */
  171 +#cmakedefine LIBVNCSERVER_WORDS_BIGENDIAN 1
  172 +
  173 +/* Define to empty if `const' does not conform to ANSI C. */
  174 +/* #cmakedefine const @CMAKE_CONST@ */
  175 +
  176 +/* Define to `__inline__' or `__inline' if that's what the C compiler
  177 + calls it, or to nothing if 'inline' is not supported under any name. */
  178 +/* #ifndef __cplusplus */
  179 +/* #cmakedefine inline @CMAKE_INLINE@ */
  180 +/* #endif */
  181 +
  182 +/* Define to `int' if <sys/types.h> does not define. */
  183 +#cmakedefine HAVE_LIBVNCSERVER_PID_T 1
  184 +#ifndef HAVE_LIBVNCSERVER_PID_T
  185 +typedef int pid_t;
  186 +#endif
  187 +
  188 +/* The type for size_t */
  189 +#cmakedefine HAVE_LIBVNCSERVER_SIZE_T 1
  190 +#ifndef HAVE_LIBVNCSERVER_SIZE_T
  191 +typedef int size_t;
  192 +#endif
  193 +
  194 +/* The type for socklen */
  195 +#cmakedefine HAVE_LIBVNCSERVER_SOCKLEN_T 1
  196 +#ifndef HAVE_LIBVNCSERVER_SOCKLEN_T
  197 +typedef int socklen_t;
  198 +#endif
  199 +
  200 +/* once: _RFB_RFBCONFIG_H */
  201 +#endif
rfb/rfbproto.h
@@ -0,0 +1,1556 @@ @@ -0,0 +1,1556 @@
  1 +#ifndef RFBPROTO_H
  2 +#define RFBPROTO_H
  3 +
  4 +/**
  5 + @mainpage
  6 + @li @ref libvncserver_api
  7 + @li @ref libvncserver_doc
  8 +
  9 +
  10 + @li @ref libvncclient_api
  11 + @li @ref libvncclient_doc
  12 +
  13 +*/
  14 +
  15 +/*
  16 + * Copyright (C) 2009-2010 D. R. Commander. All Rights Reserved.
  17 + * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
  18 + * Copyright (C) 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
  19 + * Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved.
  20 + * Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
  21 + * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
  22 + *
  23 + * This is free software; you can redistribute it and/or modify
  24 + * it under the terms of the GNU General Public License as published by
  25 + * the Free Software Foundation; either version 2 of the License, or
  26 + * (at your option) any later version.
  27 + *
  28 + * This software is distributed in the hope that it will be useful,
  29 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  30 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31 + * GNU General Public License for more details.
  32 + *
  33 + * You should have received a copy of the GNU General Public License
  34 + * along with this software; if not, write to the Free Software
  35 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  36 + * USA.
  37 + */
  38 +
  39 +/*
  40 + * rfbproto.h - header file for the RFB protocol version 3.3
  41 + *
  42 + * Uses types CARD<n> for an n-bit unsigned integer, INT<n> for an n-bit signed
  43 + * integer (for n = 8, 16 and 32).
  44 + *
  45 + * All multiple byte integers are in big endian (network) order (most
  46 + * significant byte first). Unless noted otherwise there is no special
  47 + * alignment of protocol structures.
  48 + *
  49 + *
  50 + * Once the initial handshaking is done, all messages start with a type byte,
  51 + * (usually) followed by message-specific data. The order of definitions in
  52 + * this file is as follows:
  53 + *
  54 + * (1) Structures used in several types of message.
  55 + * (2) Structures used in the initial handshaking.
  56 + * (3) Message types.
  57 + * (4) Encoding types.
  58 + * (5) For each message type, the form of the data following the type byte.
  59 + * Sometimes this is defined by a single structure but the more complex
  60 + * messages have to be explained by comments.
  61 + */
  62 +
  63 +#include <stdint.h>
  64 +
  65 +#if defined(WIN32)
  66 +typedef int8_t rfbBool;
  67 +#include <sys/timeb.h>
  68 +#include <winsock2.h>
  69 +#endif
  70 +#include <rfb/rfbconfig.h>
  71 +
  72 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  73 +#include <zlib.h>
  74 +#ifdef __CHECKER__
  75 +#undef Z_NULL
  76 +#define Z_NULL NULL
  77 +#endif
  78 +#endif
  79 +
  80 +#if LIBVNCSERVER_HAVE_ENDIAN_H
  81 +# include <endian.h>
  82 +# if __BYTE_ORDER == __BIG_ENDIAN
  83 +# define LIBVNCSERVER_WORDS_BIGENDIAN 1
  84 +# endif
  85 +#endif
  86 +
  87 +/* MS compilers don't have strncasecmp */
  88 +#ifdef _MSC_VER
  89 +#define strncasecmp _strnicmp
  90 +#endif
  91 +
  92 +#define rfbMax(a,b) (((a)>(b))?(a):(b))
  93 +#ifdef WIN32
  94 +#define rfbSocket SOCKET
  95 +#define RFB_INVALID_SOCKET INVALID_SOCKET
  96 +#define rfbCloseSocket closesocket
  97 +#else
  98 +#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
  99 +#include <sys/time.h>
  100 +#endif
  101 +#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H
  102 +#include <netinet/in.h>
  103 +#endif
  104 +#define rfbSocket int
  105 +#define SOCKET int /* LibVNCServer versions older than 0.9.13 defined this for non-Windows, so keep it here */
  106 +#define RFB_INVALID_SOCKET (-1)
  107 +#define rfbCloseSocket close
  108 +typedef int8_t rfbBool;
  109 +#undef FALSE
  110 +#define FALSE 0
  111 +#undef TRUE
  112 +#define TRUE -1
  113 +#endif
  114 +
  115 +typedef uint32_t rfbKeySym;
  116 +typedef uint32_t rfbPixel;
  117 +
  118 +#ifdef LIBVNCSERVER_NEED_INADDR_T
  119 +typedef uint32_t in_addr_t;
  120 +#endif
  121 +
  122 +#ifndef INADDR_NONE
  123 +#define INADDR_NONE ((in_addr_t) 0xffffffff)
  124 +#endif
  125 +
  126 +#define MAX_ENCODINGS 64
  127 +
  128 +/*****************************************************************************
  129 + *
  130 + * Structures used in several messages
  131 + *
  132 + *****************************************************************************/
  133 +
  134 +/*-----------------------------------------------------------------------------
  135 + * Structure used to specify a rectangle. This structure is a multiple of 4
  136 + * bytes so that it can be interspersed with 32-bit pixel data without
  137 + * affecting alignment.
  138 + */
  139 +
  140 +typedef struct {
  141 + uint16_t x;
  142 + uint16_t y;
  143 + uint16_t w;
  144 + uint16_t h;
  145 +} rfbRectangle;
  146 +
  147 +#define sz_rfbRectangle 8
  148 +
  149 +
  150 +/*-----------------------------------------------------------------------------
  151 + * Structure used to specify pixel format.
  152 + */
  153 +
  154 +typedef struct {
  155 +
  156 + uint8_t bitsPerPixel; /* 8,16,32 only */
  157 +
  158 + uint8_t depth; /* 8 to 32 */
  159 +
  160 + uint8_t bigEndian; /* True if multi-byte pixels are interpreted
  161 + as big endian, or if single-bit-per-pixel
  162 + has most significant bit of the byte
  163 + corresponding to first (leftmost) pixel. Of
  164 + course this is meaningless for 8 bits/pix */
  165 +
  166 + uint8_t trueColour; /* If false then we need a "colour map" to
  167 + convert pixels to RGB. If true, xxxMax and
  168 + xxxShift specify bits used for red, green
  169 + and blue */
  170 +
  171 + /* the following fields are only meaningful if trueColour is true */
  172 +
  173 + uint16_t redMax; /* maximum red value (= 2^n - 1 where n is the
  174 + number of bits used for red). Note this
  175 + value is always in big endian order. */
  176 +
  177 + uint16_t greenMax; /* similar for green */
  178 +
  179 + uint16_t blueMax; /* and blue */
  180 +
  181 + uint8_t redShift; /* number of shifts needed to get the red
  182 + value in a pixel to the least significant
  183 + bit. To find the red value from a given
  184 + pixel, do the following:
  185 + 1) Swap pixel value according to bigEndian
  186 + (e.g. if bigEndian is false and host byte
  187 + order is big endian, then swap).
  188 + 2) Shift right by redShift.
  189 + 3) AND with redMax (in host byte order).
  190 + 4) You now have the red value between 0 and
  191 + redMax. */
  192 +
  193 + uint8_t greenShift; /* similar for green */
  194 +
  195 + uint8_t blueShift; /* and blue */
  196 +
  197 + uint8_t pad1;
  198 + uint16_t pad2;
  199 +
  200 +} rfbPixelFormat;
  201 +
  202 +#define sz_rfbPixelFormat 16
  203 +
  204 +/* UltraVNC: Color settings values */
  205 +#define rfbPFFullColors 0
  206 +#define rfbPF256Colors 1
  207 +#define rfbPF64Colors 2
  208 +#define rfbPF8Colors 3
  209 +#define rfbPF8GreyColors 4
  210 +#define rfbPF4GreyColors 5
  211 +#define rfbPF2GreyColors 6
  212 +
  213 +
  214 +/*****************************************************************************
  215 + *
  216 + * Initial handshaking messages
  217 + *
  218 + *****************************************************************************/
  219 +
  220 +/*-----------------------------------------------------------------------------
  221 + * Protocol Version
  222 + *
  223 + * The server always sends 12 bytes to start which identifies the latest RFB
  224 + * protocol version number which it supports. These bytes are interpreted
  225 + * as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where
  226 + * xxx and yyy are the major and minor version numbers (for version 3.3
  227 + * this is "RFB 003.003\n").
  228 + *
  229 + * The client then replies with a similar 12-byte message giving the version
  230 + * number of the protocol which should actually be used (which may be different
  231 + * to that quoted by the server).
  232 + *
  233 + * It is intended that both clients and servers may provide some level of
  234 + * backwards compatibility by this mechanism. Servers in particular should
  235 + * attempt to provide backwards compatibility, and even forwards compatibility
  236 + * to some extent. For example if a client demands version 3.1 of the
  237 + * protocol, a 3.0 server can probably assume that by ignoring requests for
  238 + * encoding types it doesn't understand, everything will still work OK. This
  239 + * will probably not be the case for changes in the major version number.
  240 + *
  241 + * The format string below can be used in sprintf or sscanf to generate or
  242 + * decode the version string respectively.
  243 + */
  244 +
  245 +#define rfbProtocolVersionFormat "RFB %03d.%03d\n"
  246 +#define rfbProtocolMajorVersion 3
  247 +#define rfbProtocolMinorVersion 8
  248 +/* UltraVNC Viewer examines rfbProtocolMinorVersion number (4, and 6)
  249 + * to identify if the server supports File Transfer
  250 + */
  251 +
  252 +typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
  253 +
  254 +#define sz_rfbProtocolVersionMsg 12
  255 +
  256 +/*
  257 + * Negotiation of the security type (protocol version 3.7)
  258 + *
  259 + * Once the protocol version has been decided, the server either sends a list
  260 + * of supported security types, or informs the client about an error (when the
  261 + * number of security types is 0). Security type rfbSecTypeTight is used to
  262 + * enable TightVNC-specific protocol extensions. The value rfbSecTypeVncAuth
  263 + * stands for classic VNC authentication.
  264 + *
  265 + * The client selects a particular security type from the list provided by the
  266 + * server.
  267 + */
  268 +
  269 +#define rfbSecTypeInvalid 0
  270 +#define rfbSecTypeNone 1
  271 +#define rfbSecTypeVncAuth 2
  272 +
  273 +
  274 +/*-----------------------------------------------------------------------------
  275 + * Authentication
  276 + *
  277 + * Once the protocol version has been decided, the server then sends a 32-bit
  278 + * word indicating whether any authentication is needed on the connection.
  279 + * The value of this word determines the authentication scheme in use. For
  280 + * version 3.0 of the protocol this may have one of the following values:
  281 + */
  282 +
  283 +#define rfbConnFailed 0
  284 +#define rfbNoAuth 1
  285 +#define rfbVncAuth 2
  286 +
  287 +#define rfbRA2 5
  288 +#define rfbRA2ne 6
  289 +#define rfbSSPI 7
  290 +#define rfbSSPIne 8
  291 +#define rfbTight 16
  292 +#define rfbUltra 17
  293 +#define rfbTLS 18
  294 +#define rfbVeNCrypt 19
  295 +#define rfbSASL 20
  296 +#define rfbARD 30
  297 +#define rfbUltraMSLogonI 0x70 /* UNIMPLEMENTED */
  298 +#define rfbUltraMSLogonII 0x71
  299 +#define rfbMSLogon 0xfffffffa
  300 +
  301 +#define rfbVeNCryptPlain 256
  302 +#define rfbVeNCryptTLSNone 257
  303 +#define rfbVeNCryptTLSVNC 258
  304 +#define rfbVeNCryptTLSPlain 259
  305 +#define rfbVeNCryptX509None 260
  306 +#define rfbVeNCryptX509VNC 261
  307 +#define rfbVeNCryptX509Plain 262
  308 +#define rfbVeNCryptX509SASL 263
  309 +#define rfbVeNCryptTLSSASL 264
  310 +
  311 +/*
  312 + * rfbConnFailed: For some reason the connection failed (e.g. the server
  313 + * cannot support the desired protocol version). This is
  314 + * followed by a string describing the reason (where a
  315 + * string is specified as a 32-bit length followed by that
  316 + * many ASCII characters).
  317 + *
  318 + * rfbNoAuth: No authentication is needed.
  319 + *
  320 + * rfbVncAuth: The VNC authentication scheme is to be used. A 16-byte
  321 + * challenge follows, which the client encrypts as
  322 + * appropriate using the password and sends the resulting
  323 + * 16-byte response. If the response is correct, the
  324 + * server sends the 32-bit word rfbVncAuthOK. If a simple
  325 + * failure happens, the server sends rfbVncAuthFailed and
  326 + * closes the connection. If the server decides that too
  327 + * many failures have occurred, it sends rfbVncAuthTooMany
  328 + * and closes the connection. In the latter case, the
  329 + * server should not allow an immediate reconnection by
  330 + * the client.
  331 + */
  332 +
  333 +#define rfbVncAuthOK 0
  334 +#define rfbVncAuthFailed 1
  335 +#define rfbVncAuthTooMany 2
  336 +
  337 +
  338 +/*-----------------------------------------------------------------------------
  339 + * Client Initialisation Message
  340 + *
  341 + * Once the client and server are sure that they're happy to talk to one
  342 + * another, the client sends an initialisation message. At present this
  343 + * message only consists of a boolean indicating whether the server should try
  344 + * to share the desktop by leaving other clients connected, or give exclusive
  345 + * access to this client by disconnecting all other clients.
  346 + */
  347 +
  348 +typedef struct {
  349 + uint8_t shared;
  350 +} rfbClientInitMsg;
  351 +
  352 +#define sz_rfbClientInitMsg 1
  353 +
  354 +
  355 +/*-----------------------------------------------------------------------------
  356 + * Server Initialisation Message
  357 + *
  358 + * After the client initialisation message, the server sends one of its own.
  359 + * This tells the client the width and height of the server's framebuffer,
  360 + * its pixel format and the name associated with the desktop.
  361 + */
  362 +
  363 +typedef struct {
  364 + uint16_t framebufferWidth;
  365 + uint16_t framebufferHeight;
  366 + rfbPixelFormat format; /* the server's preferred pixel format */
  367 + uint32_t nameLength;
  368 + /* followed by char name[nameLength] */
  369 +} rfbServerInitMsg;
  370 +
  371 +#define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat)
  372 +
  373 +
  374 +/*
  375 + * Following the server initialisation message it's up to the client to send
  376 + * whichever protocol messages it wants. Typically it will send a
  377 + * SetPixelFormat message and a SetEncodings message, followed by a
  378 + * FramebufferUpdateRequest. From then on the server will send
  379 + * FramebufferUpdate messages in response to the client's
  380 + * FramebufferUpdateRequest messages. The client should send
  381 + * FramebufferUpdateRequest messages with incremental set to true when it has
  382 + * finished processing one FramebufferUpdate and is ready to process another.
  383 + * With a fast client, the rate at which FramebufferUpdateRequests are sent
  384 + * should be regulated to avoid hogging the network.
  385 + */
  386 +
  387 +
  388 +
  389 +/*****************************************************************************
  390 + *
  391 + * Message types
  392 + *
  393 + *****************************************************************************/
  394 +
  395 +/* server -> client */
  396 +
  397 +#define rfbFramebufferUpdate 0
  398 +#define rfbSetColourMapEntries 1
  399 +#define rfbBell 2
  400 +#define rfbServerCutText 3
  401 +/* Modif sf@2002 */
  402 +#define rfbResizeFrameBuffer 4
  403 +#define rfbPalmVNCReSizeFrameBuffer 0xF
  404 +
  405 +/* client -> server */
  406 +
  407 +#define rfbSetPixelFormat 0
  408 +#define rfbFixColourMapEntries 1 /* not currently supported */
  409 +#define rfbSetEncodings 2
  410 +#define rfbFramebufferUpdateRequest 3
  411 +#define rfbKeyEvent 4
  412 +#define rfbPointerEvent 5
  413 +#define rfbClientCutText 6
  414 +/* Modif sf@2002 - actually bidirectionnal */
  415 +#define rfbFileTransfer 7
  416 +/* Modif sf@2002 */
  417 +#define rfbSetScale 8
  418 +/* Modif rdv@2002 */
  419 +#define rfbSetServerInput 9
  420 +/* Modif rdv@2002 */
  421 +#define rfbSetSW 10
  422 +/* Modif sf@2002 - TextChat - Bidirectionnal */
  423 +#define rfbTextChat 11
  424 +/* Modif cs@2005 */
  425 +/* PalmVNC 1.4 & 2.0 SetScale Factor message */
  426 +#define rfbPalmVNCSetScaleFactor 0xF
  427 +/* Xvp message - bidirectional */
  428 +#define rfbXvp 250
  429 +/* SetDesktopSize client -> server message */
  430 +#define rfbSetDesktopSize 251
  431 +#define rfbQemuEvent 255
  432 +
  433 +
  434 +
  435 +
  436 +/*****************************************************************************
  437 + *
  438 + * Encoding types
  439 + *
  440 + *****************************************************************************/
  441 +
  442 +#define rfbEncodingRaw 0
  443 +#define rfbEncodingCopyRect 1
  444 +#define rfbEncodingRRE 2
  445 +#define rfbEncodingCoRRE 4
  446 +#define rfbEncodingHextile 5
  447 +#define rfbEncodingZlib 6
  448 +#define rfbEncodingTight 7
  449 +#define rfbEncodingTightPng 0xFFFFFEFC /* -260 */
  450 +#define rfbEncodingZlibHex 8
  451 +#define rfbEncodingUltra 9
  452 +#define rfbEncodingTRLE 15
  453 +#define rfbEncodingZRLE 16
  454 +#define rfbEncodingZYWRLE 17
  455 +
  456 +#define rfbEncodingH264 0x48323634
  457 +
  458 +/* Cache & XOR-Zlib - rdv@2002 */
  459 +#define rfbEncodingCache 0xFFFF0000
  460 +#define rfbEncodingCacheEnable 0xFFFF0001
  461 +#define rfbEncodingXOR_Zlib 0xFFFF0002
  462 +#define rfbEncodingXORMonoColor_Zlib 0xFFFF0003
  463 +#define rfbEncodingXORMultiColor_Zlib 0xFFFF0004
  464 +#define rfbEncodingSolidColor 0xFFFF0005
  465 +#define rfbEncodingXOREnable 0xFFFF0006
  466 +#define rfbEncodingCacheZip 0xFFFF0007
  467 +#define rfbEncodingSolMonoZip 0xFFFF0008
  468 +#define rfbEncodingUltraZip 0xFFFF0009
  469 +
  470 +/* Xvp pseudo-encoding */
  471 +#define rfbEncodingXvp 0xFFFFFECB
  472 +
  473 +/*
  474 + * Special encoding numbers:
  475 + * 0xFFFFFD00 .. 0xFFFFFD05 -- subsampling level
  476 + * 0xFFFFFE00 .. 0xFFFFFE64 -- fine-grained quality level (0-100 scale)
  477 + * 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels;
  478 + * 0xFFFFFF10 .. 0xFFFFFF1F -- mouse cursor shape data;
  479 + * 0xFFFFFF20 .. 0xFFFFFF2F -- various protocol extensions;
  480 + * 0xFFFFFF30 .. 0xFFFFFFDF -- not allocated yet;
  481 + * 0xFFFFFFE0 .. 0xFFFFFFEF -- quality level for JPEG compressor;
  482 + * 0xFFFFFFF0 .. 0xFFFFFFFF -- cross-encoding compression levels.
  483 + */
  484 +
  485 +#define rfbEncodingFineQualityLevel0 0xFFFFFE00
  486 +#define rfbEncodingFineQualityLevel100 0xFFFFFE64
  487 +#define rfbEncodingSubsamp1X 0xFFFFFD00
  488 +#define rfbEncodingSubsamp4X 0xFFFFFD01
  489 +#define rfbEncodingSubsamp2X 0xFFFFFD02
  490 +#define rfbEncodingSubsampGray 0xFFFFFD03
  491 +#define rfbEncodingSubsamp8X 0xFFFFFD04
  492 +#define rfbEncodingSubsamp16X 0xFFFFFD05
  493 +
  494 +#define rfbEncodingCompressLevel0 0xFFFFFF00
  495 +#define rfbEncodingCompressLevel1 0xFFFFFF01
  496 +#define rfbEncodingCompressLevel2 0xFFFFFF02
  497 +#define rfbEncodingCompressLevel3 0xFFFFFF03
  498 +#define rfbEncodingCompressLevel4 0xFFFFFF04
  499 +#define rfbEncodingCompressLevel5 0xFFFFFF05
  500 +#define rfbEncodingCompressLevel6 0xFFFFFF06
  501 +#define rfbEncodingCompressLevel7 0xFFFFFF07
  502 +#define rfbEncodingCompressLevel8 0xFFFFFF08
  503 +#define rfbEncodingCompressLevel9 0xFFFFFF09
  504 +
  505 +#define rfbEncodingXCursor 0xFFFFFF10
  506 +#define rfbEncodingRichCursor 0xFFFFFF11
  507 +#define rfbEncodingPointerPos 0xFFFFFF18
  508 +
  509 +#define rfbEncodingLastRect 0xFFFFFF20
  510 +#define rfbEncodingNewFBSize 0xFFFFFF21
  511 +#define rfbEncodingExtDesktopSize 0xFFFFFECC
  512 +
  513 +#define rfbEncodingQualityLevel0 0xFFFFFFE0
  514 +#define rfbEncodingQualityLevel1 0xFFFFFFE1
  515 +#define rfbEncodingQualityLevel2 0xFFFFFFE2
  516 +#define rfbEncodingQualityLevel3 0xFFFFFFE3
  517 +#define rfbEncodingQualityLevel4 0xFFFFFFE4
  518 +#define rfbEncodingQualityLevel5 0xFFFFFFE5
  519 +#define rfbEncodingQualityLevel6 0xFFFFFFE6
  520 +#define rfbEncodingQualityLevel7 0xFFFFFFE7
  521 +#define rfbEncodingQualityLevel8 0xFFFFFFE8
  522 +#define rfbEncodingQualityLevel9 0xFFFFFFE9
  523 +
  524 +#define rfbEncodingQemuExtendedKeyEvent 0xFFFFFEFE /* -258 */
  525 +#define rfbEncodingExtendedClipboard 0xC0A1E5CE
  526 +
  527 +/* LibVNCServer additions. We claim 0xFFFE0000 - 0xFFFE00FF */
  528 +#define rfbEncodingKeyboardLedState 0xFFFE0000
  529 +#define rfbEncodingSupportedMessages 0xFFFE0001
  530 +#define rfbEncodingSupportedEncodings 0xFFFE0002
  531 +#define rfbEncodingServerIdentity 0xFFFE0003
  532 +
  533 +
  534 +/*****************************************************************************
  535 + *
  536 + * Server -> client message definitions
  537 + *
  538 + *****************************************************************************/
  539 +
  540 +
  541 +/*-----------------------------------------------------------------------------
  542 + * FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
  543 + *
  544 + * This message consists of a header giving the number of rectangles of pixel
  545 + * data followed by the rectangles themselves. The header is padded so that
  546 + * together with the type byte it is an exact multiple of 4 bytes (to help
  547 + * with alignment of 32-bit pixels):
  548 + */
  549 +
  550 +typedef struct {
  551 + uint8_t type; /* always rfbFramebufferUpdate */
  552 + uint8_t pad;
  553 + uint16_t nRects;
  554 + /* followed by nRects rectangles */
  555 +} rfbFramebufferUpdateMsg;
  556 +
  557 +#define sz_rfbFramebufferUpdateMsg 4
  558 +
  559 +/*
  560 + * Each rectangle of pixel data consists of a header describing the position
  561 + * and size of the rectangle and a type word describing the encoding of the
  562 + * pixel data, followed finally by the pixel data. Note that if the client has
  563 + * not sent a SetEncodings message then it will only receive raw pixel data.
  564 + * Also note again that this structure is a multiple of 4 bytes.
  565 + */
  566 +
  567 +typedef struct {
  568 + rfbRectangle r;
  569 + uint32_t encoding; /* one of the encoding types rfbEncoding... */
  570 +} rfbFramebufferUpdateRectHeader;
  571 +
  572 +#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
  573 +
  574 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  575 + * Supported Messages Encoding. This encoding does not contain any pixel data.
  576 + * Instead, it contains 2 sets of bitflags. These bitflags indicate what messages
  577 + * are supported by the server.
  578 + * rect->w contains byte count
  579 + */
  580 +
  581 +typedef struct {
  582 + uint8_t client2server[32]; /* maximum of 256 message types (256/8)=32 */
  583 + uint8_t server2client[32]; /* maximum of 256 message types (256/8)=32 */
  584 +} rfbSupportedMessages;
  585 +
  586 +#define sz_rfbSupportedMessages 64
  587 +
  588 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  589 + * Supported Encodings Encoding. This encoding does not contain any pixel data.
  590 + * Instead, it contains a list of (uint32_t) Encodings supported by this server.
  591 + * rect->w contains byte count
  592 + * rect->h contains encoding count
  593 + */
  594 +
  595 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  596 + * Server Identity Encoding. This encoding does not contain any pixel data.
  597 + * Instead, it contains a text string containing information about the server.
  598 + * ie: "x11vnc: 0.8.1 lastmod: 2006-04-25 (libvncserver 0.9pre)\0"
  599 + * rect->w contains byte count
  600 + */
  601 +
  602 +
  603 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  604 + * Raw Encoding. Pixels are sent in top-to-bottom scanline order,
  605 + * left-to-right within a scanline with no padding in between.
  606 + */
  607 +
  608 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  609 + * KeyboardLedState Encoding. The X coordinate contains the Locked Modifiers
  610 + * so that a remote troubleshooter can identify that the users 'Caps Lock'
  611 + * is set... (It helps a *lot* when the users are untrained)
  612 + */
  613 +#define rfbKeyboardMaskShift 1
  614 +#define rfbKeyboardMaskCapsLock 2
  615 +#define rfbKeyboardMaskControl 4
  616 +#define rfbKeyboardMaskAlt 8
  617 +#define rfbKeyboardMaskMeta 16
  618 +#define rfbKeyboardMaskSuper 32
  619 +#define rfbKeyboardMaskHyper 64
  620 +#define rfbKeyboardMaskNumLock 128
  621 +#define rfbKeyboardMaskScrollLock 256
  622 +#define rfbKeyboardMaskAltGraph 512
  623 +
  624 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  625 + * CopyRect Encoding. The pixels are specified simply by the x and y position
  626 + * of the source rectangle.
  627 + */
  628 +
  629 +typedef struct {
  630 + uint16_t srcX;
  631 + uint16_t srcY;
  632 +} rfbCopyRect;
  633 +
  634 +#define sz_rfbCopyRect 4
  635 +
  636 +
  637 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  638 + * RRE - Rise-and-Run-length Encoding. We have an rfbRREHeader structure
  639 + * giving the number of subrectangles following. Finally the data follows in
  640 + * the form [<bgpixel><subrect><subrect>...] where each <subrect> is
  641 + * [<pixel><rfbRectangle>].
  642 + */
  643 +
  644 +typedef struct {
  645 + uint32_t nSubrects;
  646 +} rfbRREHeader;
  647 +
  648 +#define sz_rfbRREHeader 4
  649 +
  650 +
  651 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  652 + * CoRRE - Compact RRE Encoding. We have an rfbRREHeader structure giving
  653 + * the number of subrectangles following. Finally the data follows in the form
  654 + * [<bgpixel><subrect><subrect>...] where each <subrect> is
  655 + * [<pixel><rfbCoRRERectangle>]. This means that
  656 + * the whole rectangle must be at most 255x255 pixels.
  657 + */
  658 +
  659 +typedef struct {
  660 + uint8_t x;
  661 + uint8_t y;
  662 + uint8_t w;
  663 + uint8_t h;
  664 +} rfbCoRRERectangle;
  665 +
  666 +#define sz_rfbCoRRERectangle 4
  667 +
  668 +
  669 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  670 + * Hextile Encoding. The rectangle is divided up into "tiles" of 16x16 pixels,
  671 + * starting at the top left going in left-to-right, top-to-bottom order. If
  672 + * the width of the rectangle is not an exact multiple of 16 then the width of
  673 + * the last tile in each row will be correspondingly smaller. Similarly if the
  674 + * height is not an exact multiple of 16 then the height of each tile in the
  675 + * final row will also be smaller. Each tile begins with a "subencoding" type
  676 + * byte, which is a mask made up of a number of bits. If the Raw bit is set
  677 + * then the other bits are irrelevant; w*h pixel values follow (where w and h
  678 + * are the width and height of the tile). Otherwise the tile is encoded in a
  679 + * similar way to RRE, except that the position and size of each subrectangle
  680 + * can be specified in just two bytes. The other bits in the mask are as
  681 + * follows:
  682 + *
  683 + * BackgroundSpecified - if set, a pixel value follows which specifies
  684 + * the background colour for this tile. The first non-raw tile in a
  685 + * rectangle must have this bit set. If this bit isn't set then the
  686 + * background is the same as the last tile.
  687 + *
  688 + * ForegroundSpecified - if set, a pixel value follows which specifies
  689 + * the foreground colour to be used for all subrectangles in this tile.
  690 + * If this bit is set then the SubrectsColoured bit must be zero.
  691 + *
  692 + * AnySubrects - if set, a single byte follows giving the number of
  693 + * subrectangles following. If not set, there are no subrectangles (i.e.
  694 + * the whole tile is just solid background colour).
  695 + *
  696 + * SubrectsColoured - if set then each subrectangle is preceded by a pixel
  697 + * value giving the colour of that subrectangle. If not set, all
  698 + * subrectangles are the same colour, the foreground colour; if the
  699 + * ForegroundSpecified bit wasn't set then the foreground is the same as
  700 + * the last tile.
  701 + *
  702 + * The position and size of each subrectangle is specified in two bytes. The
  703 + * Pack macros below can be used to generate the two bytes from x, y, w, h,
  704 + * and the Extract macros can be used to extract the x, y, w, h values from
  705 + * the two bytes.
  706 + */
  707 +
  708 +#define rfbHextileRaw (1 << 0)
  709 +#define rfbHextileBackgroundSpecified (1 << 1)
  710 +#define rfbHextileForegroundSpecified (1 << 2)
  711 +#define rfbHextileAnySubrects (1 << 3)
  712 +#define rfbHextileSubrectsColoured (1 << 4)
  713 +
  714 +#define rfbHextilePackXY(x,y) (((x) << 4) | (y))
  715 +#define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
  716 +#define rfbHextileExtractX(byte) ((byte) >> 4)
  717 +#define rfbHextileExtractY(byte) ((byte) & 0xf)
  718 +#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
  719 +#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
  720 +
  721 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  722 + * zlib - zlib compressed Encoding. We have an rfbZlibHeader structure
  723 + * giving the number of bytes following. Finally the data follows is
  724 + * zlib compressed version of the raw pixel data as negotiated.
  725 + * (NOTE: also used by Ultra Encoding)
  726 + */
  727 +
  728 +typedef struct {
  729 + uint32_t nBytes;
  730 +} rfbZlibHeader;
  731 +
  732 +#define sz_rfbZlibHeader 4
  733 +
  734 +#ifdef LIBVNCSERVER_HAVE_LIBZ
  735 +
  736 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  737 + * Tight and TightPng Encoding.
  738 + *
  739 + *-- TightPng is like Tight but basic compression is not used, instead PNG
  740 + * data is sent.
  741 + *
  742 + *-- The first byte of each Tight-encoded rectangle is a "compression control
  743 + * byte". Its format is as follows (bit 0 is the least significant one):
  744 + *
  745 + * bit 0: if 1, then compression stream 0 should be reset;
  746 + * bit 1: if 1, then compression stream 1 should be reset;
  747 + * bit 2: if 1, then compression stream 2 should be reset;
  748 + * bit 3: if 1, then compression stream 3 should be reset;
  749 + * bits 7-4: if 1000 (0x08), then the compression type is "fill",
  750 + * if 1001 (0x09), then the compression type is "jpeg",
  751 + * (Tight only) if 1010 (0x0A), then the compression type is
  752 + * "basic" and no Zlib compression was used,
  753 + * (Tight only) if 1110 (0x0E), then the compression type is
  754 + * "basic", no Zlib compression was used, and a "filter id" byte
  755 + * follows this byte,
  756 + * (TightPng only) if 1010 (0x0A), then the compression type is
  757 + * "png",
  758 + * if 0xxx, then the compression type is "basic" and Zlib
  759 + * compression was used,
  760 + * values greater than 1010 are not valid.
  761 + *
  762 + * If the compression type is "basic" and Zlib compression was used, then bits
  763 + * 6..4 of the compression control byte (those xxx in 0xxx) specify the
  764 + * following:
  765 + *
  766 + * bits 5-4: decimal representation is the index of a particular zlib
  767 + * stream which should be used for decompressing the data;
  768 + * bit 6: if 1, then a "filter id" byte is following this byte.
  769 + *
  770 + *-- The data that follows after the compression control byte described
  771 + * above depends on the compression type ("fill", "jpeg", "png" or "basic").
  772 + *
  773 + *-- If the compression type is "fill", then the only pixel value follows, in
  774 + * client pixel format (see NOTE 1). This value applies to all pixels of the
  775 + * rectangle.
  776 + *
  777 + *-- If the compression type is "jpeg" or "png", the following data stream
  778 + * looks like this:
  779 + *
  780 + * 1..3 bytes: data size (N) in compact representation;
  781 + * N bytes: JPEG or PNG image.
  782 + *
  783 + * Data size is compactly represented in one, two or three bytes, according
  784 + * to the following scheme:
  785 + *
  786 + * 0xxxxxxx (for values 0..127)
  787 + * 1xxxxxxx 0yyyyyyy (for values 128..16383)
  788 + * 1xxxxxxx 1yyyyyyy zzzzzzzz (for values 16384..4194303)
  789 + *
  790 + * Here each character denotes one bit, xxxxxxx are the least significant 7
  791 + * bits of the value (bits 0-6), yyyyyyy are bits 7-13, and zzzzzzzz are the
  792 + * most significant 8 bits (bits 14-21). For example, decimal value 10000
  793 + * should be represented as two bytes: binary 10010000 01001110, or
  794 + * hexadecimal 90 4E.
  795 + *
  796 + *-- If the compression type is "basic" and bit 6 of the compression control
  797 + * byte was set to 1, then the next (second) byte specifies "filter id" which
  798 + * tells the decoder what filter type was used by the encoder to pre-process
  799 + * pixel data before the compression. The "filter id" byte can be one of the
  800 + * following:
  801 + *
  802 + * 0: no filter ("copy" filter);
  803 + * 1: "palette" filter;
  804 + * 2: "gradient" filter.
  805 + *
  806 + *-- If bit 6 of the compression control byte is set to 0 (no "filter id"
  807 + * byte), or if the filter id is 0, then raw pixel values in the client
  808 + * format (see NOTE 1) will be compressed. See below details on the
  809 + * compression.
  810 + *
  811 + *-- The "gradient" filter pre-processes pixel data with a simple algorithm
  812 + * which converts each color component to a difference between a "predicted"
  813 + * intensity and the actual intensity. Such a technique does not affect
  814 + * uncompressed data size, but helps to compress photo-like images better.
  815 + * Pseudo-code for converting intensities to differences is the following:
  816 + *
  817 + * P[i,j] := V[i-1,j] + V[i,j-1] - V[i-1,j-1];
  818 + * if (P[i,j] < 0) then P[i,j] := 0;
  819 + * if (P[i,j] > MAX) then P[i,j] := MAX;
  820 + * D[i,j] := V[i,j] - P[i,j];
  821 + *
  822 + * Here V[i,j] is the intensity of a color component for a pixel at
  823 + * coordinates (i,j). MAX is the maximum value of intensity for a color
  824 + * component.
  825 + *
  826 + *-- The "palette" filter converts true-color pixel data to indexed colors
  827 + * and a palette which can consist of 2..256 colors. If the number of colors
  828 + * is 2, then each pixel is encoded in 1 bit, otherwise 8 bits is used to
  829 + * encode one pixel. 1-bit encoding is performed such way that the most
  830 + * significant bits correspond to the leftmost pixels, and each raw of pixels
  831 + * is aligned to the byte boundary. When "palette" filter is used, the
  832 + * palette is sent before the pixel data. The palette begins with an unsigned
  833 + * byte which value is the number of colors in the palette minus 1 (i.e. 1
  834 + * means 2 colors, 255 means 256 colors in the palette). Then follows the
  835 + * palette itself which consist of pixel values in client pixel format (see
  836 + * NOTE 1).
  837 + *
  838 + *-- The pixel data is compressed using the zlib library. But if the data
  839 + * size after applying the filter but before the compression is less then 12,
  840 + * then the data is sent as is, uncompressed. Four separate zlib streams
  841 + * (0..3) can be used and the decoder should read the actual stream id from
  842 + * the compression control byte (see NOTE 2).
  843 + *
  844 + * If the compression is not used, then the pixel data is sent as is,
  845 + * otherwise the data stream looks like this:
  846 + *
  847 + * 1..3 bytes: data size (N) in compact representation;
  848 + * N bytes: zlib-compressed data.
  849 + *
  850 + * Data size is compactly represented in one, two or three bytes, just like
  851 + * in the "jpeg" compression method (see above).
  852 + *
  853 + *-- NOTE 1. If the color depth is 24, and all three color components are
  854 + * 8-bit wide, then one pixel in Tight encoding is always represented by
  855 + * three bytes, where the first byte is red component, the second byte is
  856 + * green component, and the third byte is blue component of the pixel color
  857 + * value. This applies to colors in palettes as well.
  858 + *
  859 + *-- NOTE 2. The decoder must reset compression streams' states before
  860 + * decoding the rectangle, if some of bits 0,1,2,3 in the compression control
  861 + * byte are set to 1. Note that the decoder must reset zlib streams even if
  862 + * the compression type is "fill", "jpeg" or "png".
  863 + *
  864 + *-- NOTE 3. The "gradient" filter and "jpeg" compression may be used only
  865 + * when bits-per-pixel value is either 16 or 32, not 8.
  866 + *
  867 + *-- NOTE 4. The width of any Tight-encoded rectangle cannot exceed 2048
  868 + * pixels. If a rectangle is wider, it must be split into several rectangles
  869 + * and each one should be encoded separately.
  870 + *
  871 + */
  872 +
  873 +#define rfbTightExplicitFilter 0x04
  874 +#define rfbTightFill 0x08
  875 +#define rfbTightJpeg 0x09
  876 +#define rfbTightNoZlib 0x0A
  877 +#define rfbTightPng 0x0A
  878 +#define rfbTightMaxSubencoding 0x0A
  879 +
  880 +/* Filters to improve compression efficiency */
  881 +#define rfbTightFilterCopy 0x00
  882 +#define rfbTightFilterPalette 0x01
  883 +#define rfbTightFilterGradient 0x02
  884 +
  885 +#endif
  886 +
  887 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  888 + * XCursor encoding. This is a special encoding used to transmit X-style
  889 + * cursor shapes from server to clients. Note that for this encoding,
  890 + * coordinates in rfbFramebufferUpdateRectHeader structure hold hotspot
  891 + * position (r.x, r.y) and cursor size (r.w, r.h). If (w * h != 0), two RGB
  892 + * samples are sent after header in the rfbXCursorColors structure. They
  893 + * denote foreground and background colors of the cursor. If a client
  894 + * supports only black-and-white cursors, it should ignore these colors and
  895 + * assume that foreground is black and background is white. Next, two bitmaps
  896 + * (1 bits per pixel) follow: first one with actual data (value 0 denotes
  897 + * background color, value 1 denotes foreground color), second one with
  898 + * transparency data (bits with zero value mean that these pixels are
  899 + * transparent). Both bitmaps represent cursor data in a byte stream, from
  900 + * left to right, from top to bottom, and each row is byte-aligned. Most
  901 + * significant bits correspond to leftmost pixels. The number of bytes in
  902 + * each row can be calculated as ((w + 7) / 8). If (w * h == 0), cursor
  903 + * should be hidden (or default local cursor should be set by the client).
  904 + */
  905 +
  906 +typedef struct {
  907 + uint8_t foreRed;
  908 + uint8_t foreGreen;
  909 + uint8_t foreBlue;
  910 + uint8_t backRed;
  911 + uint8_t backGreen;
  912 + uint8_t backBlue;
  913 +} rfbXCursorColors;
  914 +
  915 +#define sz_rfbXCursorColors 6
  916 +
  917 +
  918 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  919 + * RichCursor encoding. This is a special encoding used to transmit cursor
  920 + * shapes from server to clients. It is similar to the XCursor encoding but
  921 + * uses client pixel format instead of two RGB colors to represent cursor
  922 + * image. For this encoding, coordinates in rfbFramebufferUpdateRectHeader
  923 + * structure hold hotspot position (r.x, r.y) and cursor size (r.w, r.h).
  924 + * After header, two pixmaps follow: first one with cursor image in current
  925 + * client pixel format (like in raw encoding), second with transparency data
  926 + * (1 bit per pixel, exactly the same format as used for transparency bitmap
  927 + * in the XCursor encoding). If (w * h == 0), cursor should be hidden (or
  928 + * default local cursor should be set by the client).
  929 + */
  930 +
  931 +
  932 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  933 + * ZRLE - encoding combining Zlib compression, tiling, palettisation and
  934 + * run-length encoding.
  935 + */
  936 +
  937 +typedef struct {
  938 + uint32_t length;
  939 +} rfbZRLEHeader;
  940 +
  941 +#define sz_rfbZRLEHeader 4
  942 +
  943 +#define rfbZRLETileWidth 64
  944 +#define rfbZRLETileHeight 64
  945 +
  946 +
  947 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  948 + * ZLIBHEX - zlib compressed Hextile Encoding. Essentially, this is the
  949 + * hextile encoding with zlib compression on the tiles that can not be
  950 + * efficiently encoded with one of the other hextile subencodings. The
  951 + * new zlib subencoding uses two bytes to specify the length of the
  952 + * compressed tile and then the compressed data follows. As with the
  953 + * raw sub-encoding, the zlib subencoding invalidates the other
  954 + * values, if they are also set.
  955 + */
  956 +
  957 +#define rfbHextileZlibRaw (1 << 5)
  958 +#define rfbHextileZlibHex (1 << 6)
  959 +#define rfbHextileZlibMono (1 << 7)
  960 +
  961 +
  962 +/*-----------------------------------------------------------------------------
  963 + * SetColourMapEntries - these messages are only sent if the pixel
  964 + * format uses a "colour map" (i.e. trueColour false) and the client has not
  965 + * fixed the entire colour map using FixColourMapEntries. In addition they
  966 + * will only start being sent after the client has sent its first
  967 + * FramebufferUpdateRequest. So if the client always tells the server to use
  968 + * trueColour then it never needs to process this type of message.
  969 + */
  970 +
  971 +typedef struct {
  972 + uint8_t type; /* always rfbSetColourMapEntries */
  973 + uint8_t pad;
  974 + uint16_t firstColour;
  975 + uint16_t nColours;
  976 +
  977 + /* Followed by nColours * 3 * uint16_t
  978 + r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
  979 +
  980 +} rfbSetColourMapEntriesMsg;
  981 +
  982 +#define sz_rfbSetColourMapEntriesMsg 6
  983 +
  984 +
  985 +
  986 +/*-----------------------------------------------------------------------------
  987 + * Bell - ring a bell on the client if it has one.
  988 + */
  989 +
  990 +typedef struct {
  991 + uint8_t type; /* always rfbBell */
  992 +} rfbBellMsg;
  993 +
  994 +#define sz_rfbBellMsg 1
  995 +
  996 +
  997 +
  998 +/*-----------------------------------------------------------------------------
  999 + * ServerCutText - the server has new text in its cut buffer.
  1000 + */
  1001 +
  1002 +typedef struct {
  1003 + uint8_t type; /* always rfbServerCutText */
  1004 + uint8_t pad1;
  1005 + uint16_t pad2;
  1006 + uint32_t length;
  1007 + /* followed by char text[length] */
  1008 +} rfbServerCutTextMsg;
  1009 +
  1010 +#define sz_rfbServerCutTextMsg 8
  1011 +
  1012 +
  1013 +/*-----------------------------------------------------------------------------
  1014 + * // Modif sf@2002
  1015 + * FileTransferMsg - The client sends FileTransfer message.
  1016 + * Bidirectional message - Files can be sent from client to server & vice versa
  1017 + */
  1018 +
  1019 +typedef struct _rfbFileTransferMsg {
  1020 + uint8_t type; /* always rfbFileTransfer */
  1021 + uint8_t contentType; /* See defines below */
  1022 + uint8_t contentParam;/* Other possible content classification (Dir or File name, etc..) */
  1023 + uint8_t pad; /* It appears that UltraVNC *forgot* to Swap16IfLE(contentParam) */
  1024 + uint32_t size; /* FileSize or packet index or error or other */
  1025 +/* uint32_t sizeH; Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions) */
  1026 + uint32_t length;
  1027 + /* followed by data char text[length] */
  1028 +} rfbFileTransferMsg;
  1029 +
  1030 +#define sz_rfbFileTransferMsg 12
  1031 +
  1032 +#define rfbFileTransferVersion 2 /* v1 is the old FT version ( <= 1.0.0 RC18 versions) */
  1033 +
  1034 +/* FileTransfer Content types and Params defines */
  1035 +#define rfbDirContentRequest 1 /* Client asks for the content of a given Server directory */
  1036 +#define rfbDirPacket 2 /* Full directory name or full file name. */
  1037 + /* Null content means end of Directory */
  1038 +#define rfbFileTransferRequest 3 /* Client asks the server for the transfer of a given file */
  1039 +#define rfbFileHeader 4 /* First packet of a file transfer, containing file's features */
  1040 +#define rfbFilePacket 5 /* One chunk of the file */
  1041 +#define rfbEndOfFile 6 /* End of file transfer (the file has been received or error) */
  1042 +#define rfbAbortFileTransfer 7 /* The file transfer must be aborted, whatever the state */
  1043 +#define rfbFileTransferOffer 8 /* The client offers to send a file to the server */
  1044 +#define rfbFileAcceptHeader 9 /* The server accepts or rejects the file */
  1045 +#define rfbCommand 10 /* The Client sends a simple command (File Delete, Dir create etc...) */
  1046 +#define rfbCommandReturn 11 /* The Client receives the server's answer about a simple command */
  1047 +#define rfbFileChecksums 12 /* The zipped checksums of the destination file (Delta Transfer) */
  1048 +#define rfbFileTransferAccess 14 /* Request FileTransfer authorization */
  1049 +
  1050 + /* rfbDirContentRequest client Request - content params */
  1051 +#define rfbRDirContent 1 /* Request a Server Directory contents */
  1052 +#define rfbRDrivesList 2 /* Request the server's drives list */
  1053 +#define rfbRDirRecursiveList 3 /* Request a server directory content recursive sorted list */
  1054 +#define rfbRDirRecursiveSize 4 /* Request a server directory content recursive size */
  1055 +
  1056 + /* rfbDirPacket & rfbCommandReturn server Answer - content params */
  1057 +#define rfbADirectory 1 /* Reception of a directory name */
  1058 +#define rfbAFile 2 /* Reception of a file name */
  1059 +#define rfbADrivesList 3 /* Reception of a list of drives */
  1060 +#define rfbADirCreate 4 /* Response to a create dir command */
  1061 +#define rfbADirDelete 5 /* Response to a delete dir command */
  1062 +#define rfbAFileCreate 6 /* Response to a create file command */
  1063 +#define rfbAFileDelete 7 /* Response to a delete file command */
  1064 +#define rfbAFileRename 8 /* Response to a rename file command */
  1065 +#define rfbADirRename 9 /* Response to a rename dir command */
  1066 +#define rfbADirRecursiveListItem 10
  1067 +#define rfbADirRecursiveSize 11
  1068 +
  1069 + /* rfbCommand Command - content params */
  1070 +#define rfbCDirCreate 1 /* Request the server to create the given directory */
  1071 +#define rfbCDirDelete 2 /* Request the server to delete the given directory */
  1072 +#define rfbCFileCreate 3 /* Request the server to create the given file */
  1073 +#define rfbCFileDelete 4 /* Request the server to delete the given file */
  1074 +#define rfbCFileRename 5 /* Request the server to rename the given file */
  1075 +#define rfbCDirRename 6 /* Request the server to rename the given directory */
  1076 +
  1077 + /* Errors - content params or "size" field */
  1078 +#define rfbRErrorUnknownCmd 1 /* Unknown FileTransfer command. */
  1079 +#define rfbRErrorCmd 0xFFFFFFFF/* Error when a command fails on remote side (ret in "size" field) */
  1080 +
  1081 +#define sz_rfbBlockSize 8192 /* Size of a File Transfer packet (before compression) */
  1082 +#define rfbZipDirectoryPrefix "!UVNCDIR-\0" /* Transferred directory are zipped in a file with this prefix. Must end with "-" */
  1083 +#define sz_rfbZipDirectoryPrefix 9
  1084 +#define rfbDirPrefix "[ "
  1085 +#define rfbDirSuffix " ]"
  1086 +
  1087 +
  1088 +
  1089 +/*-----------------------------------------------------------------------------
  1090 + * Modif sf@2002
  1091 + * TextChatMsg - Utilized to order the TextChat mode on server or client
  1092 + * Bidirectional message
  1093 + */
  1094 +
  1095 +typedef struct _rfbTextChatMsg {
  1096 + uint8_t type; /* always rfbTextChat */
  1097 + uint8_t pad1; /* Could be used later as an additionnal param */
  1098 + uint16_t pad2; /* Could be used later as text offset, for instance */
  1099 + uint32_t length; /* Specific values for Open, close, finished (-1, -2, -3) */
  1100 + /* followed by char text[length] */
  1101 +} rfbTextChatMsg;
  1102 +
  1103 +#define sz_rfbTextChatMsg 8
  1104 +
  1105 +#define rfbTextMaxSize 4096
  1106 +#define rfbTextChatOpen 0xFFFFFFFF
  1107 +#define rfbTextChatClose 0xFFFFFFFE
  1108 +#define rfbTextChatFinished 0xFFFFFFFD
  1109 +
  1110 +
  1111 +/*-----------------------------------------------------------------------------
  1112 + * Xvp Message
  1113 + * Bidirectional message
  1114 + * A server which supports the xvp extension declares this by sending a message
  1115 + * with an Xvp_INIT xvp-message-code when it receives a request from the client
  1116 + * to use the xvp Pseudo-encoding. The server must specify in this message the
  1117 + * highest xvp-extension-version it supports: the client may assume that the
  1118 + * server supports all versions from 1 up to this value. The client is then
  1119 + * free to use any supported version. Currently, only version 1 is defined.
  1120 + *
  1121 + * A server which subsequently receives an xvp Client Message requesting an
  1122 + * operation which it is unable to perform, informs the client of this by
  1123 + * sending a message with an Xvp_FAIL xvp-message-code, and the same
  1124 + * xvp-extension-version as included in the client's operation request.
  1125 + *
  1126 + * A client supporting the xvp extension sends this to request that the server
  1127 + * initiate a clean shutdown, clean reboot or abrupt reset of the system whose
  1128 + * framebuffer the client is displaying.
  1129 + */
  1130 +
  1131 +
  1132 +typedef struct {
  1133 + uint8_t type; /* always rfbXvp */
  1134 + uint8_t pad;
  1135 + uint8_t version; /* xvp extension version */
  1136 + uint8_t code; /* xvp message code */
  1137 +} rfbXvpMsg;
  1138 +
  1139 +#define sz_rfbXvpMsg (4)
  1140 +
  1141 +/* server message codes */
  1142 +#define rfbXvp_Fail 0
  1143 +#define rfbXvp_Init 1
  1144 +/* client message codes */
  1145 +#define rfbXvp_Shutdown 2
  1146 +#define rfbXvp_Reboot 3
  1147 +#define rfbXvp_Reset 4
  1148 +
  1149 +/*-----------------------------------------------------------------------------
  1150 + * ExtendedDesktopSize server -> client message
  1151 + *
  1152 + * Informs the client of (re)size of framebuffer, provides information about
  1153 + * physical screens attached, and lets the client knows it can request
  1154 + * resolution changes using SetDesktopSize.
  1155 + */
  1156 +
  1157 +typedef struct rfbExtDesktopSizeMsg {
  1158 + uint8_t numberOfScreens;
  1159 + uint8_t pad[3];
  1160 +
  1161 + /* Followed by rfbExtDesktopScreen[numberOfScreens] */
  1162 +} rfbExtDesktopSizeMsg;
  1163 +
  1164 +typedef struct rfbExtDesktopScreen {
  1165 + uint32_t id;
  1166 + uint16_t x;
  1167 + uint16_t y;
  1168 + uint16_t width;
  1169 + uint16_t height;
  1170 + uint32_t flags;
  1171 +} rfbExtDesktopScreen;
  1172 +
  1173 +#define sz_rfbExtDesktopSizeMsg (4)
  1174 +#define sz_rfbExtDesktopScreen (16)
  1175 +
  1176 +/* x - reason for the change */
  1177 +#define rfbExtDesktopSize_GenericChange 0
  1178 +#define rfbExtDesktopSize_ClientRequestedChange 1
  1179 +#define rfbExtDesktopSize_OtherClientRequestedChange 2
  1180 +
  1181 +/* y - status code for change */
  1182 +#define rfbExtDesktopSize_Success 0
  1183 +#define rfbExtDesktopSize_ResizeProhibited 1
  1184 +#define rfbExtDesktopSize_OutOfResources 2
  1185 +#define rfbExtDesktopSize_InvalidScreenLayout 3
  1186 +
  1187 +/*-----------------------------------------------------------------------------
  1188 + * SetDesktopSize client -> server message
  1189 + *
  1190 + * Allows the client to request that the framebuffer and physical screen
  1191 + * resolutions are changed.
  1192 + */
  1193 +
  1194 +typedef struct rfbSetDesktopSizeMsg {
  1195 + uint8_t type; /* always rfbSetDesktopSize */
  1196 + uint8_t pad1;
  1197 + uint16_t width;
  1198 + uint16_t height;
  1199 + uint8_t numberOfScreens;
  1200 + uint8_t pad2;
  1201 +
  1202 + /* Followed by rfbExtDesktopScreen[numberOfScreens] */
  1203 +} rfbSetDesktopSizeMsg;
  1204 +
  1205 +#define sz_rfbSetDesktopSizeMsg (8)
  1206 +
  1207 +
  1208 +/*-----------------------------------------------------------------------------
  1209 + * Modif sf@2002
  1210 + * ResizeFrameBuffer - The Client must change the size of its framebuffer
  1211 + */
  1212 +
  1213 +typedef struct _rfbResizeFrameBufferMsg {
  1214 + uint8_t type; /* always rfbResizeFrameBuffer */
  1215 + uint8_t pad1;
  1216 + uint16_t framebufferWidth; /* FrameBuffer width */
  1217 + uint16_t framebufferHeigth; /* FrameBuffer height */
  1218 +} rfbResizeFrameBufferMsg;
  1219 +
  1220 +#define sz_rfbResizeFrameBufferMsg 6
  1221 +
  1222 +
  1223 +/*-----------------------------------------------------------------------------
  1224 + * Copyright (C) 2001 Harakan Software
  1225 + * PalmVNC 1.4 & 2.? ResizeFrameBuffer message
  1226 + * ReSizeFrameBuffer - tell the RFB client to alter its framebuffer, either
  1227 + * due to a resize of the server desktop or a client-requested scaling factor.
  1228 + * The pixel format remains unchanged.
  1229 + */
  1230 +
  1231 +typedef struct {
  1232 + uint8_t type; /* always rfbReSizeFrameBuffer */
  1233 + uint8_t pad1;
  1234 + uint16_t desktop_w; /* Desktop width */
  1235 + uint16_t desktop_h; /* Desktop height */
  1236 + uint16_t buffer_w; /* FrameBuffer width */
  1237 + uint16_t buffer_h; /* Framebuffer height */
  1238 + uint16_t pad2;
  1239 +
  1240 +} rfbPalmVNCReSizeFrameBufferMsg;
  1241 +
  1242 +#define sz_rfbPalmVNCReSizeFrameBufferMsg (12)
  1243 +
  1244 +
  1245 +
  1246 +
  1247 +/*-----------------------------------------------------------------------------
  1248 + * Union of all server->client messages.
  1249 + */
  1250 +
  1251 +typedef union {
  1252 + uint8_t type;
  1253 + rfbFramebufferUpdateMsg fu;
  1254 + rfbSetColourMapEntriesMsg scme;
  1255 + rfbBellMsg b;
  1256 + rfbServerCutTextMsg sct;
  1257 + rfbResizeFrameBufferMsg rsfb;
  1258 + rfbPalmVNCReSizeFrameBufferMsg prsfb;
  1259 + rfbFileTransferMsg ft;
  1260 + rfbTextChatMsg tc;
  1261 + rfbXvpMsg xvp;
  1262 + rfbExtDesktopSizeMsg eds;
  1263 +} rfbServerToClientMsg;
  1264 +
  1265 +
  1266 +
  1267 +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1268 + * RDV Cache Encoding.
  1269 + * special is not used at this point, can be used to reset cache or other specials
  1270 + * just put it to make sure we don't have to change the encoding again.
  1271 + */
  1272 +
  1273 +typedef struct {
  1274 + uint16_t special;
  1275 +} rfbCacheRect;
  1276 +
  1277 +#define sz_rfbCacheRect 2
  1278 +
  1279 +
  1280 +
  1281 +
  1282 +/*****************************************************************************
  1283 + *
  1284 + * Message definitions (client -> server)
  1285 + *
  1286 + *****************************************************************************/
  1287 +
  1288 +
  1289 +/*-----------------------------------------------------------------------------
  1290 + * SetPixelFormat - tell the RFB server the format in which the client wants
  1291 + * pixels sent.
  1292 + */
  1293 +
  1294 +typedef struct {
  1295 + uint8_t type; /* always rfbSetPixelFormat */
  1296 + uint8_t pad1;
  1297 + uint16_t pad2;
  1298 + rfbPixelFormat format;
  1299 +} rfbSetPixelFormatMsg;
  1300 +
  1301 +#define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)
  1302 +
  1303 +
  1304 +/*-----------------------------------------------------------------------------
  1305 + * FixColourMapEntries - when the pixel format uses a "colour map", fix
  1306 + * read-only colour map entries.
  1307 + *
  1308 + * ***************** NOT CURRENTLY SUPPORTED *****************
  1309 + */
  1310 +
  1311 +typedef struct {
  1312 + uint8_t type; /* always rfbFixColourMapEntries */
  1313 + uint8_t pad;
  1314 + uint16_t firstColour;
  1315 + uint16_t nColours;
  1316 +
  1317 + /* Followed by nColours * 3 * uint16_t
  1318 + r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
  1319 +
  1320 +} rfbFixColourMapEntriesMsg;
  1321 +
  1322 +#define sz_rfbFixColourMapEntriesMsg 6
  1323 +
  1324 +
  1325 +/*-----------------------------------------------------------------------------
  1326 + * SetEncodings - tell the RFB server which encoding types we accept. Put them
  1327 + * in order of preference, if we have any. We may always receive raw
  1328 + * encoding, even if we don't specify it here.
  1329 + */
  1330 +
  1331 +typedef struct {
  1332 + uint8_t type; /* always rfbSetEncodings */
  1333 + uint8_t pad;
  1334 + uint16_t nEncodings;
  1335 + /* followed by nEncodings * uint32_t encoding types */
  1336 +} rfbSetEncodingsMsg;
  1337 +
  1338 +#define sz_rfbSetEncodingsMsg 4
  1339 +
  1340 +
  1341 +/*-----------------------------------------------------------------------------
  1342 + * FramebufferUpdateRequest - request for a framebuffer update. If incremental
  1343 + * is true then the client just wants the changes since the last update. If
  1344 + * false then it wants the whole of the specified rectangle.
  1345 + */
  1346 +
  1347 +typedef struct {
  1348 + uint8_t type; /* always rfbFramebufferUpdateRequest */
  1349 + uint8_t incremental;
  1350 + uint16_t x;
  1351 + uint16_t y;
  1352 + uint16_t w;
  1353 + uint16_t h;
  1354 +} rfbFramebufferUpdateRequestMsg;
  1355 +
  1356 +#define sz_rfbFramebufferUpdateRequestMsg 10
  1357 +
  1358 +
  1359 +/*-----------------------------------------------------------------------------
  1360 + * KeyEvent - key press or release
  1361 + *
  1362 + * Keys are specified using the "keysym" values defined by the X Window System.
  1363 + * For most ordinary keys, the keysym is the same as the corresponding ASCII
  1364 + * value. Other common keys are:
  1365 + *
  1366 + * BackSpace 0xff08
  1367 + * Tab 0xff09
  1368 + * Return or Enter 0xff0d
  1369 + * Escape 0xff1b
  1370 + * Insert 0xff63
  1371 + * Delete 0xffff
  1372 + * Home 0xff50
  1373 + * End 0xff57
  1374 + * Page Up 0xff55
  1375 + * Page Down 0xff56
  1376 + * Left 0xff51
  1377 + * Up 0xff52
  1378 + * Right 0xff53
  1379 + * Down 0xff54
  1380 + * F1 0xffbe
  1381 + * F2 0xffbf
  1382 + * ... ...
  1383 + * F12 0xffc9
  1384 + * Shift 0xffe1
  1385 + * Control 0xffe3
  1386 + * Meta 0xffe7
  1387 + * Alt 0xffe9
  1388 + */
  1389 +
  1390 +typedef struct {
  1391 + uint8_t type; /* always rfbKeyEvent */
  1392 + uint8_t down; /* true if down (press), false if up */
  1393 + uint16_t pad;
  1394 + uint32_t key; /* key is specified as an X keysym */
  1395 +} rfbKeyEventMsg;
  1396 +
  1397 +#define sz_rfbKeyEventMsg 8
  1398 +
  1399 +
  1400 +typedef struct {
  1401 + uint8_t type; /* always rfbQemuEvent */
  1402 + uint8_t subtype; /* always 0 */
  1403 + uint16_t down;
  1404 + uint32_t keysym; /* keysym is specified as an X keysym, may be 0 */
  1405 + uint32_t keycode; /* keycode is specified as XT key code */
  1406 +} rfbQemuExtendedKeyEventMsg;
  1407 +
  1408 +#define sz_rfbQemuExtendedKeyEventMsg 12
  1409 +
  1410 +
  1411 +/*-----------------------------------------------------------------------------
  1412 + * PointerEvent - mouse/pen move and/or button press.
  1413 + */
  1414 +
  1415 +typedef struct {
  1416 + uint8_t type; /* always rfbPointerEvent */
  1417 + uint8_t buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
  1418 + uint16_t x;
  1419 + uint16_t y;
  1420 +} rfbPointerEventMsg;
  1421 +
  1422 +#define rfbButton1Mask 1
  1423 +#define rfbButton2Mask 2
  1424 +#define rfbButton3Mask 4
  1425 +#define rfbButton4Mask 8
  1426 +#define rfbButton5Mask 16
  1427 +/* RealVNC 335 method */
  1428 +#define rfbWheelUpMask rfbButton4Mask
  1429 +#define rfbWheelDownMask rfbButton5Mask
  1430 +
  1431 +#define sz_rfbPointerEventMsg 6
  1432 +
  1433 +
  1434 +
  1435 +/*-----------------------------------------------------------------------------
  1436 + * ClientCutText - the client has new text in its cut buffer.
  1437 + */
  1438 +
  1439 +typedef struct {
  1440 + uint8_t type; /* always rfbClientCutText */
  1441 + uint8_t pad1;
  1442 + uint16_t pad2;
  1443 + uint32_t length;
  1444 + /* followed by char text[length] */
  1445 +} rfbClientCutTextMsg;
  1446 +
  1447 +#define rfbExtendedClipboard_Text 1
  1448 +#define rfbExtendedClipboard_RTF 2
  1449 +#define rfbExtendedClipboard_HTML 4
  1450 +#define rfbExtendedClipboard_DIB 8
  1451 +#define rfbExtendedClipboard_Files 16
  1452 +#define rfbExtendedClipboard_Caps (1 << 24)
  1453 +#define rfbExtendedClipboard_Request (1 << 25)
  1454 +#define rfbExtendedClipboard_Peek (1 << 26)
  1455 +#define rfbExtendedClipboard_Notify (1 << 27)
  1456 +#define rfbExtendedClipboard_Provide (1 << 28)
  1457 +#define sz_rfbClientCutTextMsg 8
  1458 +
  1459 +
  1460 +
  1461 +/*-----------------------------------------------------------------------------
  1462 + * sf@2002 - Set Server Scale
  1463 + * SetServerScale - Server must change the scale of the client buffer.
  1464 + */
  1465 +
  1466 +typedef struct _rfbSetScaleMsg {
  1467 + uint8_t type; /* always rfbSetScale */
  1468 + uint8_t scale; /* Scale value 1<sv<n */
  1469 + uint16_t pad;
  1470 +} rfbSetScaleMsg;
  1471 +
  1472 +#define sz_rfbSetScaleMsg 4
  1473 +
  1474 +
  1475 +/*-----------------------------------------------------------------------------
  1476 + * Copyright (C) 2001 Harakan Software
  1477 + * PalmVNC 1.4 & 2.? SetScale Factor message
  1478 + * SetScaleFactor - tell the RFB server to alter the scale factor for the
  1479 + * client buffer.
  1480 + */
  1481 +typedef struct {
  1482 + uint8_t type; /* always rfbPalmVNCSetScaleFactor */
  1483 +
  1484 + uint8_t scale; /* Scale factor (positive non-zero integer) */
  1485 + uint16_t pad2;
  1486 +} rfbPalmVNCSetScaleFactorMsg;
  1487 +
  1488 +#define sz_rfbPalmVNCSetScaleFactorMsg (4)
  1489 +
  1490 +
  1491 +/*-----------------------------------------------------------------------------
  1492 + * rdv@2002 - Set input status
  1493 + * SetServerInput - Server input is dis/enabled
  1494 + */
  1495 +
  1496 +typedef struct _rfbSetServerInputMsg {
  1497 + uint8_t type; /* always rfbSetScale */
  1498 + uint8_t status; /* Scale value 1<sv<n */
  1499 + uint16_t pad;
  1500 +} rfbSetServerInputMsg;
  1501 +
  1502 +#define sz_rfbSetServerInputMsg 4
  1503 +
  1504 +/*-----------------------------------------------------------------------------
  1505 + * rdv@2002 - Set SW
  1506 + * SetSW - Server SW/full desktop
  1507 + */
  1508 +
  1509 +typedef struct _rfbSetSWMsg {
  1510 + uint8_t type; /* always rfbSetSW */
  1511 + uint8_t status;
  1512 + uint16_t x;
  1513 + uint16_t y;
  1514 +} rfbSetSWMsg;
  1515 +
  1516 +#define sz_rfbSetSWMsg 6
  1517 +
  1518 +
  1519 +
  1520 +/*-----------------------------------------------------------------------------
  1521 + * Union of all client->server messages.
  1522 + */
  1523 +
  1524 +typedef union {
  1525 + uint8_t type;
  1526 + rfbSetPixelFormatMsg spf;
  1527 + rfbFixColourMapEntriesMsg fcme;
  1528 + rfbSetEncodingsMsg se;
  1529 + rfbFramebufferUpdateRequestMsg fur;
  1530 + rfbKeyEventMsg ke;
  1531 + rfbPointerEventMsg pe;
  1532 + rfbClientCutTextMsg cct;
  1533 + rfbSetScaleMsg ssc;
  1534 + rfbPalmVNCSetScaleFactorMsg pssf;
  1535 + rfbSetServerInputMsg sim;
  1536 + rfbFileTransferMsg ft;
  1537 + rfbSetSWMsg sw;
  1538 + rfbTextChatMsg tc;
  1539 + rfbXvpMsg xvp;
  1540 + rfbSetDesktopSizeMsg sdm;
  1541 +} rfbClientToServerMsg;
  1542 +
  1543 +/*
  1544 + * vncauth.h - describes the functions provided by the vncauth library.
  1545 + */
  1546 +
  1547 +#define MAXPWLEN 8
  1548 +#define CHALLENGESIZE 16
  1549 +
  1550 +extern int rfbEncryptAndStorePasswd(char *passwd, char *fname);
  1551 +extern char *rfbDecryptPasswdFromFile(char *fname);
  1552 +extern void rfbRandomBytes(unsigned char *bytes);
  1553 +extern void rfbEncryptBytes(unsigned char *bytes, char *passwd);
  1554 +
  1555 +
  1556 +#endif
rfb/rfbregion.h
@@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
  1 +#ifndef SRAREGION_H
  2 +#define SRAREGION_H
  3 +
  4 +/* -=- SRA - Simple Region Algorithm
  5 + * A simple rectangular region implementation.
  6 + * Copyright (c) 2001 James "Wez" Weatherall, Johannes E. Schindelin
  7 + */
  8 +
  9 +/* -=- sraRect */
  10 +
  11 +typedef struct _rect {
  12 + int x1;
  13 + int y1;
  14 + int x2;
  15 + int y2;
  16 +} sraRect;
  17 +
  18 +typedef struct sraRegion sraRegion;
  19 +
  20 +/* -=- Region manipulation functions */
  21 +
  22 +extern sraRegion *sraRgnCreate(void);
  23 +extern sraRegion *sraRgnCreateRect(int x1, int y1, int x2, int y2);
  24 +extern sraRegion *sraRgnCreateRgn(const sraRegion *src);
  25 +
  26 +extern void sraRgnDestroy(sraRegion *rgn);
  27 +extern void sraRgnMakeEmpty(sraRegion *rgn);
  28 +extern rfbBool sraRgnAnd(sraRegion *dst, const sraRegion *src);
  29 +extern void sraRgnOr(sraRegion *dst, const sraRegion *src);
  30 +extern rfbBool sraRgnSubtract(sraRegion *dst, const sraRegion *src);
  31 +
  32 +extern void sraRgnOffset(sraRegion *dst, int dx, int dy);
  33 +
  34 +extern rfbBool sraRgnPopRect(sraRegion *region, sraRect *rect,
  35 + unsigned long flags);
  36 +
  37 +extern unsigned long sraRgnCountRects(const sraRegion *rgn);
  38 +extern rfbBool sraRgnEmpty(const sraRegion *rgn);
  39 +
  40 +extern sraRegion *sraRgnBBox(const sraRegion *src);
  41 +
  42 +/* -=- rectangle iterator */
  43 +
  44 +typedef struct sraRectangleIterator {
  45 + rfbBool reverseX,reverseY;
  46 + int ptrSize,ptrPos;
  47 + struct sraSpan** sPtrs;
  48 +} sraRectangleIterator;
  49 +
  50 +extern sraRectangleIterator *sraRgnGetIterator(sraRegion *s);
  51 +extern sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfbBool reverseY);
  52 +extern rfbBool sraRgnIteratorNext(sraRectangleIterator *i,sraRect *r);
  53 +extern void sraRgnReleaseIterator(sraRectangleIterator *i);
  54 +
  55 +void sraRgnPrint(const sraRegion *s);
  56 +
  57 +/* -=- Rectangle clipper (for speed) */
  58 +
  59 +extern rfbBool sraClipRect(int *x, int *y, int *w, int *h,
  60 + int cx, int cy, int cw, int ch);
  61 +
  62 +extern rfbBool sraClipRect2(int *x, int *y, int *x2, int *y2,
  63 + int cx, int cy, int cx2, int cy2);
  64 +
  65 +#endif
rfb/threading.h
@@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
  1 +/*
  2 + * LibVNCServer/LibVNCClient common platform threading defines and includes.
  3 + *
  4 + * Copyright (C) 2020 Christian Beier <dontmind@freeshell.org>
  5 + *
  6 + * This is free software; you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by
  8 + * the Free Software Foundation; either version 2 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * This software is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License
  17 + * along with this software; if not, write to the Free Software
  18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  19 + * USA.
  20 + */
  21 +
  22 +#ifndef _RFB_COMMON_THREADING_H
  23 +#define _RFB_COMMON_THREADING_H
  24 +
  25 +#include <rfb/rfbconfig.h>
  26 +
  27 +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
  28 +#include <pthread.h>
  29 +#if 0 /* debugging */
  30 +#define LOCK(mutex) (rfbLog("%s:%d LOCK(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex)), pthread_mutex_lock(&(mutex)))
  31 +#define UNLOCK(mutex) (rfbLog("%s:%d UNLOCK(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex)), pthread_mutex_unlock(&(mutex)))
  32 +#define MUTEX(mutex) pthread_mutex_t (mutex)
  33 +#define INIT_MUTEX(mutex) (rfbLog("%s:%d INIT_MUTEX(%s,0x%x)\n",__FILE__,__LINE__,#mutex,&(mutex)), pthread_mutex_init(&(mutex),NULL))
  34 +#define TINI_MUTEX(mutex) (rfbLog("%s:%d TINI_MUTEX(%s)\n",__FILE__,__LINE__,#mutex), pthread_mutex_destroy(&(mutex)))
  35 +#define TSIGNAL(cond) (rfbLog("%s:%d TSIGNAL(%s)\n",__FILE__,__LINE__,#cond), pthread_cond_signal(&(cond)))
  36 +#define WAIT(cond,mutex) (rfbLog("%s:%d WAIT(%s,%s)\n",__FILE__,__LINE__,#cond,#mutex), pthread_cond_wait(&(cond),&(mutex)))
  37 +#define COND(cond) pthread_cond_t (cond)
  38 +#define INIT_COND(cond) (rfbLog("%s:%d INIT_COND(%s)\n",__FILE__,__LINE__,#cond), pthread_cond_init(&(cond),NULL))
  39 +#define TINI_COND(cond) (rfbLog("%s:%d TINI_COND(%s)\n",__FILE__,__LINE__,#cond), pthread_cond_destroy(&(cond)))
  40 +#define IF_PTHREADS(x) x
  41 +#else
  42 +#if !NONETWORK
  43 +#define LOCK(mutex) pthread_mutex_lock(&(mutex))
  44 +#define UNLOCK(mutex) pthread_mutex_unlock(&(mutex))
  45 +#endif
  46 +#define MUTEX(mutex) pthread_mutex_t (mutex)
  47 +#define MUTEX_SIZE (sizeof(pthread_mutex_t))
  48 +#define INIT_MUTEX(mutex) pthread_mutex_init(&(mutex),NULL)
  49 +#define TINI_MUTEX(mutex) pthread_mutex_destroy(&(mutex))
  50 +#define TSIGNAL(cond) pthread_cond_signal(&(cond))
  51 +#define WAIT(cond,mutex) pthread_cond_wait(&(cond),&(mutex))
  52 +#define COND(cond) pthread_cond_t (cond)
  53 +#define INIT_COND(cond) pthread_cond_init(&(cond),NULL)
  54 +#define TINI_COND(cond) pthread_cond_destroy(&(cond))
  55 +#define IF_PTHREADS(x) x
  56 +#define THREAD_ROUTINE_RETURN_TYPE void*
  57 +#define THREAD_ROUTINE_RETURN_VALUE NULL
  58 +#define THREAD_SLEEP_MS(ms) usleep(ms*1000)
  59 +#define THREAD_JOIN(thread) pthread_join(thread, NULL)
  60 +#define CURRENT_THREAD_ID pthread_self()
  61 +#endif
  62 +#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS)
  63 +#include <process.h>
  64 +#define LOCK(mutex) EnterCriticalSection(&(mutex))
  65 +#define UNLOCK(mutex) LeaveCriticalSection(&(mutex))
  66 +#define MUTEX(mutex) CRITICAL_SECTION (mutex)
  67 +#define MUTEX_SIZE (sizeof(CRITICAL_SECTION))
  68 +#define INIT_MUTEX(mutex) InitializeCriticalSection(&(mutex))
  69 +#define TINI_MUTEX(mutex) DeleteCriticalSection(&(mutex))
  70 +#define TSIGNAL(cond) WakeAllConditionVariable(&(cond))
  71 +#define WAIT(cond,mutex) SleepConditionVariableCS(&(cond),&(mutex),INFINITE);
  72 +#define COND(cond) CONDITION_VARIABLE (cond)
  73 +#define INIT_COND(cond) InitializeConditionVariable(&(cond));
  74 +#define TINI_COND(cond)
  75 +#define IF_PTHREADS(x)
  76 +#define THREAD_ROUTINE_RETURN_TYPE void
  77 +#define THREAD_ROUTINE_RETURN_VALUE
  78 +#define THREAD_SLEEP_MS(ms) Sleep(ms)
  79 +#define THREAD_JOIN(thread) WaitForSingleObject((HANDLE)thread, INFINITE)
  80 +#define CURRENT_THREAD_ID GetCurrentThreadId()
  81 +#else
  82 +#define LOCK(mutex)
  83 +#define UNLOCK(mutex)
  84 +#define MUTEX(mutex)
  85 +#define INIT_MUTEX(mutex)
  86 +#define TINI_MUTEX(mutex)
  87 +#define TSIGNAL(cond)
  88 +#define WAIT(cond,mutex) this_is_unsupported
  89 +#define COND(cond)
  90 +#define INIT_COND(cond)
  91 +#define TINI_COND(cond)
  92 +#define IF_PTHREADS(x)
  93 +#endif
  94 +
  95 +#endif /* _RFB_COMMON_THREADING_H */
@@ -21,6 +21,9 @@ @@ -21,6 +21,9 @@
21 * DEALINGS IN THE SOFTWARE. 21 * DEALINGS IN THE SOFTWARE.
22 */ 22 */
23 23
  24 +#define LCD_WIDTH 1024
  25 +#define LCD_HEIGHT 768
  26 +
24 #include "config.h" 27 #include "config.h"
25 28
26 #include <stdint.h> 29 #include <stdint.h>
@@ -45,6 +48,9 @@ @@ -45,6 +48,9 @@
45 #include <linux/input.h> 48 #include <linux/input.h>
46 #include <pixman.h> 49 #include <pixman.h>
47 50
  51 +#include <rfb/rfb.h>
  52 +#include <rfb/keysym.h>
  53 +
48 #include <wayland-client.h> 54 #include <wayland-client.h>
49 #include "weston-screenshooter-client-protocol.h" 55 #include "weston-screenshooter-client-protocol.h"
50 #include "shared/os-compatibility.h" 56 #include "shared/os-compatibility.h"
@@ -58,6 +64,12 @@ @@ -58,6 +64,12 @@
58 * the compositor and serves as a test bed for implementing client 64 * the compositor and serves as a test bed for implementing client
59 * side marshalling outside libwayland.so */ 65 * side marshalling outside libwayland.so */
60 66
  67 +// VNC
  68 +const char *passwords[2] = {"1234", 0};
  69 +char *fb = NULL;
  70 +rfbScreenInfoPtr server;
  71 +
  72 +// weston_clone_app
61 int isloop = 1; 73 int isloop = 1;
62 struct image *pimage; 74 struct image *pimage;
63 75
@@ -992,6 +1004,74 @@ char *get_weston_screen_image() @@ -992,6 +1004,74 @@ char *get_weston_screen_image()
992 return cap_img; 1004 return cap_img;
993 } 1005 }
994 1006
  1007 +/************************************************************************************************/
  1008 +/* vnc callback */
  1009 +// https://github.com/LibVNC/libvncserver/blob/master/examples/example.c
  1010 +
  1011 +static void doptr(int buttonMask, int x, int y, rfbClientPtr cl)
  1012 +{
  1013 + printf("buttonMask[%x] x[%d] y[%d]\n",buttonMask, x, y);
  1014 +}
  1015 +
  1016 +static void dokey(rfbBool down, rfbKeySym key, rfbClientPtr cl)
  1017 +{
  1018 + printf("%s[%x] key[%x:%d:%c]\n",down?"down":"up",down, key, key, key & 0x7F);
  1019 +}
  1020 +
  1021 +typedef struct ClientData {
  1022 + rfbBool oldButton;
  1023 + int oldx,oldy;
  1024 +} ClientData;
  1025 +
  1026 +static void clientgone(rfbClientPtr cl)
  1027 +{
  1028 + free(cl->clientData);
  1029 + cl->clientData = NULL;
  1030 +}
  1031 +
  1032 +static enum rfbNewClientAction newclient(rfbClientPtr cl)
  1033 +{
  1034 + cl->clientData = (void*)calloc(sizeof(ClientData),1);
  1035 + cl->clientGoneHook = clientgone;
  1036 + return RFB_CLIENT_ACCEPT;
  1037 +}
  1038 +
  1039 +int init_vnc(int argc, char **argv)
  1040 +{
  1041 + int WIDTH = LCD_WIDTH;
  1042 + int HEIGHT = LCD_HEIGHT;
  1043 + int BPS = 8;
  1044 + int SPP = 3;
  1045 + int BPP = 4;
  1046 +
  1047 + server = rfbGetScreen(&argc, argv, WIDTH, HEIGHT, BPS, SPP, BPP);
  1048 + if (!server) {
  1049 + printf("Get Screen failed");
  1050 + return -1;
  1051 + }
  1052 +
  1053 +
  1054 + server->frameBuffer = fb = (char *)malloc(WIDTH * HEIGHT * BPP);
  1055 + if (!server->frameBuffer) {
  1056 + printf("Memory allocation failed");
  1057 + return -1;
  1058 + }
  1059 +
  1060 + server->authPasswdData = (void *)passwords;
  1061 + server->passwordCheck = rfbCheckPasswordByList;
  1062 +
  1063 + server->ptrAddEvent = doptr;
  1064 + server->kbdAddEvent = dokey;
  1065 +
  1066 + server->newClientHook = newclient;
  1067 + server->httpDir = "./htdocs";
  1068 + server->httpEnableProxyConnect = TRUE;
  1069 +
  1070 + rfbInitServer(server);
  1071 + rfbRunEventLoop(server, -1, TRUE);
  1072 +}
  1073 +
  1074 +/************************************************************************************************/
995 int main(int argc, char *argv[]) 1075 int main(int argc, char *argv[])
996 { 1076 {
997 struct display *d; // image.c variable 1077 struct display *d; // image.c variable
@@ -999,6 +1079,7 @@ int main(int argc, char *argv[]) @@ -999,6 +1079,7 @@ int main(int argc, char *argv[])
999 int image_counter = 0; 1079 int image_counter = 0;
1000 char *cap_img = NULL; 1080 char *cap_img = NULL;
1001 struct timespec start_time, end_time; 1081 struct timespec start_time, end_time;
  1082 + init_vnc(argc, argv);
1002 1083
1003 d = display_create(&argc, argv); 1084 d = display_create(&argc, argv);
1004 cap_img = get_weston_screen_image(); 1085 cap_img = get_weston_screen_image();
@@ -1057,5 +1138,8 @@ int main(int argc, char *argv[]) @@ -1057,5 +1138,8 @@ int main(int argc, char *argv[])
1057 1138
1058 display_destroy(d); 1139 display_destroy(d);
1059 1140
  1141 + free(fb);
  1142 + rfbScreenCleanup(server);
  1143 +
1060 return 0; 1144 return 0;
1061 } 1145 }
weston-vncserver
No preview for this file type