Browse Source

Merge tag 'LibVNCServer-0.9.12'

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/3/head
Slávek Banko 3 years ago
parent
commit
f3f392caec
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668
  1. 60
      .appveyor.yml
  2. 40
      .gitignore
  3. 21
      .travis.yml
  4. 403
      CMakeLists.txt
  5. 1463
      ChangeLog
  6. 97
      LibVNCServer.spec.in
  7. 28
      Makefile.am
  8. 35
      NEWS
  9. 447
      README
  10. 1
      README.md
  11. 478
      README.md
  12. 23
      TODO
  13. 4
      autogen.sh
  14. 38
      client_examples/Makefile.am
  15. 431
      client_examples/SDLvncviewer.c
  16. 4
      client_examples/backchannel.c
  17. 15
      client_examples/ppmtest.c
  18. 558
      client_examples/scrap.c
  19. 18
      client_examples/scrap.h
  20. 688
      client_examples/vnc2mpg.c
  21. 227
      cmake/Modules/FindFFMPEG.cmake
  22. 31
      cmake/Modules/FindLZO.cmake
  23. 173
      cmake/Modules/FindSDL2.cmake
  24. 315
      common/base64.c
  25. 10
      common/base64.h
  26. 44
      common/d3des.c
  27. 6
      common/d3des.h
  28. 7
      common/md5.c
  29. 20
      common/md5.h
  30. 6
      common/rfbcrypto.h
  31. 0
      common/rfbcrypto_gnutls.c
  32. 0
      common/rfbcrypto_included.c
  33. 0
      common/rfbcrypto_openssl.c
  34. 6
      common/turbojpeg.c
  35. 7
      common/vncauth.c
  36. 599
      configure.ac
  37. 26
      deps/sasl-fix-snprintf-macro.patch
  38. 27
      examples/Makefile.am
  39. 7
      examples/android/Makefile.am
  40. 63
      examples/android/README
  41. 65
      examples/android/jni/Android.mk
  42. 17
      examples/androidvncserver.c
  43. 10
      examples/repeater.c
  44. 6
      examples/vncev.c
  45. 14
      libvncclient.pc.cmakein
  46. 14
      libvncclient.pc.in
  47. 29
      libvncclient/Makefile.am
  48. 6
      libvncclient/corre.c
  49. 8
      libvncclient/hextile.c
  50. 9
      libvncclient/listen.c
  51. 338
      libvncclient/rfbproto.c
  52. 4
      libvncclient/rre.c
  53. 582
      libvncclient/sasl.c
  54. 39
      libvncclient/sasl.h
  55. 66
      libvncclient/sockets.c
  56. 238
      libvncclient/tight.c
  57. 7
      libvncclient/tls.h
  58. 124
      libvncclient/tls_gnutls.c
  59. 11
      libvncclient/tls_none.c
  60. 274
      libvncclient/tls_openssl.c
  61. 296
      libvncclient/trle.c
  62. 8
      libvncclient/ultra.c
  63. 147
      libvncclient/vncviewer.c
  64. 2
      libvncclient/zlib.c
  65. 6
      libvncclient/zrle.c
  66. 78
      libvncserver-config.in
  67. 13
      libvncserver.pc.cmakein
  68. 14
      libvncserver.pc.in
  69. 80
      libvncserver/Makefile.am
  70. 4
      libvncserver/cargs.c
  71. 8
      libvncserver/cursor.c
  72. 1
      libvncserver/font.c
  73. 3
      libvncserver/httpd.c
  74. 74
      libvncserver/main.c
  75. 26
      libvncserver/rfbcrypto_polarssl.c
  76. 48
      libvncserver/rfbserver.c
  77. 13
      libvncserver/scale.c
  78. 6
      libvncserver/sockets.c
  79. 11
      libvncserver/tableinit24.c
  80. 32
      libvncserver/tight.c
  81. 16
      libvncserver/tightvnc-filetransfer/filetransfermsg.c
  82. 3
      libvncserver/tightvnc-filetransfer/filetransfermsg.h
  83. 22
      libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c
  84. 1
      libvncserver/tightvnc-filetransfer/rfbtightproto.h
  85. 7
      libvncserver/tightvnc-filetransfer/rfbtightserver.c
  86. 4
      libvncserver/ultra.c
  87. 613
      libvncserver/websockets.c
  88. 563
      libvncserver/ws_decode.c
  89. 145
      libvncserver/ws_decode.h
  90. 7
      libvncserver/zlib.c
  91. 1
      m4/.gitignore
  92. 203
      m4/ax_prefix_config_h.m4
  93. 61
      m4/ax_type_socklen_t.m4
  94. 123
      m4/libgcrypt.m4
  95. 5
      rfb/default8x16.h
  96. 9
      rfb/rfb.h
  97. 69
      rfb/rfbclient.h
  98. 62
      rfb/rfbconfig.h.cmakein
  99. 4
      rfb/rfbint.h.cmake
  100. 9
      rfb/rfbproto.h
  101. 28
      test/Makefile.am
  102. 1
      test/copyrecttest.c
  103. 15
      test/tjbench.c
  104. 131
      test/wsmaketestframe.py
  105. 206
      test/wstest.c
  106. 146
      test/wstestdata.inc
  107. 4
      webclients/Makefile.am
  108. 4
      webclients/index.vnc
  109. 5
      webclients/java-applet/Makefile.am
  110. 2
      webclients/java-applet/ssl/Makefile.am
  111. 82
      webclients/novnc/LICENSE.txt
  112. 138
      webclients/novnc/README.md
  113. 56
      webclients/novnc/app/error-handler.js
  114. 92
      webclients/novnc/app/images/alt.svg
  115. 106
      webclients/novnc/app/images/clipboard.svg
  116. 96
      webclients/novnc/app/images/connect.svg
  117. 96
      webclients/novnc/app/images/ctrl.svg
  118. 100
      webclients/novnc/app/images/ctrlaltdel.svg
  119. 94
      webclients/novnc/app/images/disconnect.svg
  120. 76
      webclients/novnc/app/images/drag.svg
  121. 81
      webclients/novnc/app/images/error.svg
  122. 92
      webclients/novnc/app/images/esc.svg
  123. 69
      webclients/novnc/app/images/expander.svg
  124. 93
      webclients/novnc/app/images/fullscreen.svg
  125. 82
      webclients/novnc/app/images/handle.svg
  126. 172
      webclients/novnc/app/images/handle_bg.svg
  127. 42
      webclients/novnc/app/images/icons/Makefile
  128. BIN
      webclients/novnc/app/images/icons/novnc-120x120.png
  129. BIN
      webclients/novnc/app/images/icons/novnc-144x144.png
  130. BIN
      webclients/novnc/app/images/icons/novnc-152x152.png
  131. BIN
      webclients/novnc/app/images/icons/novnc-16x16.png
  132. BIN
      webclients/novnc/app/images/icons/novnc-192x192.png
  133. BIN
      webclients/novnc/app/images/icons/novnc-24x24.png
  134. BIN
      webclients/novnc/app/images/icons/novnc-32x32.png
  135. BIN
      webclients/novnc/app/images/icons/novnc-48x48.png
  136. BIN
      webclients/novnc/app/images/icons/novnc-60x60.png
  137. BIN
      webclients/novnc/app/images/icons/novnc-64x64.png
  138. BIN
      webclients/novnc/app/images/icons/novnc-72x72.png
  139. BIN
      webclients/novnc/app/images/icons/novnc-76x76.png
  140. BIN
      webclients/novnc/app/images/icons/novnc-96x96.png
  141. 163
      webclients/novnc/app/images/icons/novnc-icon-sm.svg
  142. 163
      webclients/novnc/app/images/icons/novnc-icon.svg
  143. 81
      webclients/novnc/app/images/info.svg
  144. 88
      webclients/novnc/app/images/keyboard.svg
  145. 92
      webclients/novnc/app/images/mouse_left.svg
  146. 92
      webclients/novnc/app/images/mouse_middle.svg
  147. 92
      webclients/novnc/app/images/mouse_none.svg
  148. 92
      webclients/novnc/app/images/mouse_right.svg
  149. 87
      webclients/novnc/app/images/power.svg
  150. 76
      webclients/novnc/app/images/settings.svg
  151. 86
      webclients/novnc/app/images/tab.svg
  152. 90
      webclients/novnc/app/images/toggleextrakeys.svg
  153. 81
      webclients/novnc/app/images/warning.svg
  154. 69
      webclients/novnc/app/locale/de.json
  155. 69
      webclients/novnc/app/locale/el.json
  156. 68
      webclients/novnc/app/locale/es.json
  157. 68
      webclients/novnc/app/locale/nl.json
  158. 69
      webclients/novnc/app/locale/pl.json
  159. 68
      webclients/novnc/app/locale/sv.json
  160. 69
      webclients/novnc/app/locale/tr.json
  161. 69
      webclients/novnc/app/locale/zh.json
  162. 170
      webclients/novnc/app/localization.js
  163. 4
      webclients/novnc/app/sounds/CREDITS
  164. BIN
      webclients/novnc/app/sounds/bell.mp3
  165. BIN
      webclients/novnc/app/sounds/bell.oga
  166. 0
      webclients/novnc/app/styles/Orbitron700.ttf
  167. 0
      webclients/novnc/app/styles/Orbitron700.woff
  168. 902
      webclients/novnc/app/styles/base.css
  169. 63
      webclients/novnc/app/styles/lite.css
  170. 1669
      webclients/novnc/app/ui.js
  171. 230
      webclients/novnc/app/webutil.js
  172. 17
      webclients/novnc/core/base64.js
  173. 17
      webclients/novnc/core/des.js
  174. 698
      webclients/novnc/core/display.js
  175. 40
      webclients/novnc/core/encodings.js
  176. 38
      webclients/novnc/core/inflator.js
  177. 310
      webclients/novnc/core/input/domkeytable.js
  178. 127
      webclients/novnc/core/input/fixedkeys.js
  179. 314
      webclients/novnc/core/input/keyboard.js
  180. 614
      webclients/novnc/core/input/keysym.js
  181. 688
      webclients/novnc/core/input/keysymdef.js
  182. 280
      webclients/novnc/core/input/mouse.js
  183. 167
      webclients/novnc/core/input/util.js
  184. 116
      webclients/novnc/core/input/vkeys.js
  185. 171
      webclients/novnc/core/input/xtscancodes.js
  186. 2540
      webclients/novnc/core/rfb.js
  187. 69
      webclients/novnc/core/util/browser.js
  188. 138
      webclients/novnc/core/util/events.js
  189. 40
      webclients/novnc/core/util/eventtarget.js
  190. 51
      webclients/novnc/core/util/logging.js
  191. 54
      webclients/novnc/core/util/polyfill.js
  192. 15
      webclients/novnc/core/util/strings.js
  193. 316
      webclients/novnc/core/websock.js
  194. 1
      webclients/novnc/favicon.ico
  195. BIN
      webclients/novnc/images/alt.png
  196. BIN
      webclients/novnc/images/clipboard.png
  197. BIN
      webclients/novnc/images/connect.png
  198. BIN
      webclients/novnc/images/ctrl.png
  199. BIN
      webclients/novnc/images/ctrlaltdel.png
  200. BIN
      webclients/novnc/images/disconnect.png
  201. BIN
      webclients/novnc/images/drag.png
  202. BIN
      webclients/novnc/images/esc.png
  203. BIN
      webclients/novnc/images/favicon.ico
  204. BIN
      webclients/novnc/images/favicon.png
  205. BIN
      webclients/novnc/images/keyboard.png
  206. BIN
      webclients/novnc/images/mouse_left.png
  207. BIN
      webclients/novnc/images/mouse_middle.png
  208. BIN
      webclients/novnc/images/mouse_none.png
  209. BIN
      webclients/novnc/images/mouse_right.png
  210. BIN
      webclients/novnc/images/power.png
  211. BIN
      webclients/novnc/images/screen_320x460.png
  212. BIN
      webclients/novnc/images/screen_57x57.png
  213. BIN
      webclients/novnc/images/screen_700x700.png
  214. BIN
      webclients/novnc/images/settings.png
  215. BIN
      webclients/novnc/images/showextrakeys.png
  216. BIN
      webclients/novnc/images/tab.png
  217. 512
      webclients/novnc/include/base.css
  218. 71
      webclients/novnc/include/black.css
  219. 64
      webclients/novnc/include/blue.css
  220. 321
      webclients/novnc/include/chrome-app/tcp-client.js
  221. 746
      webclients/novnc/include/display.js
  222. 388
      webclients/novnc/include/input.js
  223. 676
      webclients/novnc/include/jsunzip.js
  224. 543
      webclients/novnc/include/keyboard.js
  225. 378
      webclients/novnc/include/keysym.js
  226. 15
      webclients/novnc/include/keysymdef.js
  227. 1
      webclients/novnc/include/logo.js
  228. 102
      webclients/novnc/include/playback.js
  229. 1882
      webclients/novnc/include/rfb.js
  230. 979
      webclients/novnc/include/ui.js
  231. 656
      webclients/novnc/include/util.js
  232. 109
      webclients/novnc/include/web-socket-js/README.txt
  233. BIN
      webclients/novnc/include/web-socket-js/WebSocketMain.swf
  234. 4
      webclients/novnc/include/web-socket-js/swfobject.js
  235. 391
      webclients/novnc/include/web-socket-js/web_socket.js
  236. 384
      webclients/novnc/include/websock.js
  237. 239
      webclients/novnc/include/webutil.js
  238. 0
      webclients/novnc/vendor/browser-es-module-loader/.npmignore
  239. 15
      webclients/novnc/vendor/browser-es-module-loader/README.md
  240. 44024
      webclients/novnc/vendor/browser-es-module-loader/dist/babel-worker.js
  241. 1420
      webclients/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js
  242. 1
      webclients/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js.map
  243. 16
      webclients/novnc/vendor/browser-es-module-loader/rollup.config.js
  244. 23
      webclients/novnc/vendor/browser-es-module-loader/src/babel-worker.js
  245. 273
      webclients/novnc/vendor/browser-es-module-loader/src/browser-es-module-loader.js
  246. 21
      webclients/novnc/vendor/pako/LICENSE
  247. 6
      webclients/novnc/vendor/pako/README.md
  248. 45
      webclients/novnc/vendor/pako/lib/utils/common.js
  249. 27
      webclients/novnc/vendor/pako/lib/zlib/adler32.js
  250. 47
      webclients/novnc/vendor/pako/lib/zlib/constants.js
  251. 36
      webclients/novnc/vendor/pako/lib/zlib/crc32.js
  252. 1846
      webclients/novnc/vendor/pako/lib/zlib/deflate.js
  253. 35
      webclients/novnc/vendor/pako/lib/zlib/gzheader.js
  254. 324
      webclients/novnc/vendor/pako/lib/zlib/inffast.js
  255. 1527
      webclients/novnc/vendor/pako/lib/zlib/inflate.js
  256. 322
      webclients/novnc/vendor/pako/lib/zlib/inftrees.js
  257. 11
      webclients/novnc/vendor/pako/lib/zlib/messages.js
  258. 1195
      webclients/novnc/vendor/pako/lib/zlib/trees.js
  259. 24
      webclients/novnc/vendor/pako/lib/zlib/zstream.js
  260. 255
      webclients/novnc/vendor/promise.js
  261. 14043
      webclients/novnc/vendor/sinon.js
  262. 437
      webclients/novnc/vnc.html
  263. 209
      webclients/novnc/vnc_auto.html

60
.appveyor.yml

@ -0,0 +1,60 @@
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
DEVENV_EXE: C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\Common7\IDE\devenv.exe
VSDEVCMD_BAT: C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\Common7\Tools\VsDevCmd.bat
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
DEVENV_EXE: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\Common7\IDE\devenv.exe
VSDEVCMD_BAT: C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\Common7\Tools\VsDevCmd.bat
install:
- if not exist deps mkdir deps
- cd deps
# zlib
- curl -fsSL -o zlib.tar.gz https://github.com/madler/zlib/archive/v1.2.8.tar.gz
- 7z x zlib.tar.gz -so | 7z x -si -ttar > nul
- move zlib-1.2.8 zlib
- cd zlib
- cmake .
- cmake --build .
- cd ..
# libPNG
- curl -fsSL -o libpng.tar.gz http://prdownloads.sourceforge.net/libpng/libpng-1.6.28.tar.gz?download
- 7z x libpng.tar.gz -so | 7z x -si -ttar > nul
- move libpng-1.6.28 libpng
- cd libpng
- cmake . -DZLIB_INCLUDE_DIR=..\zlib -DZLIB_LIBRARY=..\zlib\debug\zlibstaticd.lib
- cmake --build .
- cd ..
# Berkeley DB - required by SASL
- curl -fsSL -o db-4.1.25.tar.gz http://download.oracle.com/berkeley-db/db-4.1.25.tar.gz
- 7z x db-4.1.25.tar.gz -so | 7z x -si -ttar > nul
- move db-4.1.25 db
- cd db\build_win32
- echo using devenv %DEVENV_EXE%
- '%DEVENV_EXE% db_dll.dsp /upgrade'
- msbuild /p:Configuration=Release db_dll.vcxproj
- cd ..\..
# Cyrus SASL
- curl -fsSL -o cyrus-sasl-2.1.26.tar.gz https://www.cyrusimap.org/releases/cyrus-sasl-2.1.26.tar.gz
- 7z x cyrus-sasl-2.1.26.tar.gz -so | 7z x -si -ttar > nul
- move cyrus-sasl-2.1.26 sasl
- cd sasl
- patch -p1 -i ..\sasl-fix-snprintf-macro.patch
- echo using vsdevcmd %VSDEVCMD_BAT%
- '%VSDEVCMD_BAT%'
- nmake /f NTMakefile OPENSSL_INCLUDE=c:\OpenSSL-Win32\include OPENSSL_LIBPATH=c:\OpenSSL-Win32\lib DB_INCLUDE=c:\projects\libvncserver\deps\db\build_win32 DB_LIBPATH=c:\projects\libvncserver\deps\db\build_win32\release DB_LIB=libdb41.lib install
- cd ..
# go back to source root
- cd ..
build_script:
- mkdir build
- cd build
- cmake --version
- cmake .. -DZLIB_INCLUDE_DIR=..\deps\zlib -DZLIB_LIBRARY=..\deps\zlib\debug\zlibstaticd.lib -DPNG_PNG_INCLUDE_DIR=..\deps\libpng -DPNG_LIBRARY=..\deps\libpng\debug\libpng16_staticd.lib -D SASL2_INCLUDE_DIR=c:\cmu\include -D LIBSASL2_LIBRARIES=c:\cmu\lib\libsasl.lib ..
- cmake --build .
- ctest -C Debug --output-on-failure

40
.gitignore vendored

@ -2,44 +2,24 @@
*~
Makefile
Makefile.in
compile
configure
configure.lineno
config.status
config.log
LibVNCServer.spec.in
LibVNCServer.spec
x11vnc.spec.in
.deps
.libs
aclocal.m4
autom4te.cache
libvncserver-config
*.pc
_configs.sed
config.h
LibVNCServer*.tar.gz
upload_beta.sh
stamp-*
x11vnc*.tar.gz
config.h.in
rfbconfig.h
rfbconfig.h.in
install-sh
missing
mkinstalldirs
depcomp
description-pak
libvncserver*.deb
*.o
*.lo
CVS
*.a
*.so
*.so.*
client_examples/SDLvncviewer
client_examples/backchannel
client_examples/gtkvncviewer
client_examples/ppmtest
config.guess
config.sub
client_examples/vnc2mpg
build/
examples/zippy
examples/backchannel
examples/blooptest
@ -58,14 +38,12 @@ examples/simple
examples/simple15
examples/storepasswd
examples/vncev
libtool
libvncclient/libvncclient.la
libvncserver/libvncserver.la
test/blooptest
test/cargstest
test/copyrecttest
test/cursortest
test/encodingstest
test/wstest
/test/tjbench
/test/tjunittest
vncterm/LinuxVNC
@ -73,14 +51,10 @@ vncterm/VNCommand
vncterm/example
/vncterm/linuxvnc
/vncterm/vncommand
x11vnc.spec
x11vnc/x11vnc
CMakeCache.txt
cmake_install.cmake
*.cmake
/CMakeFiles
/rfbproto.pdf
/rfbproto.rst
/vencrypt.txt
/INSTALL
.dirstamp
/ltmain.sh

21
.travis.yml

@ -1,4 +1,6 @@
language: c
dist: trusty
sudo: required
os:
- linux
@ -9,7 +11,20 @@ compiler:
- clang
before_install:
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS" LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"; fi'
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
mkdir -p ${TRAVIS_BUILD_DIR}/deps/cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TRAVIS_BUILD_DIR}/deps/cmake
export PATH=${TRAVIS_BUILD_DIR}/deps/cmake/bin:${PATH}
fi
# Build steps
script:
- mkdir build
- cd build
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; sudo apt-get --no-install-suggests --no-install-recommends install libsdl2-dev liblzo2-dev; fi
- if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew update; brew install sdl2; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl; else cmake ..; fi
- cmake --build .
- ctest --output-on-failure
# before build script, run autoreconf
before_script: autoreconf -fiv

403
CMakeLists.txt

@ -5,139 +5,142 @@ endif( POLICY CMP0037 )
project(LibVNCServer)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(TestBigEndian)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckCSourceRuns)
enable_testing()
set(PACKAGE_NAME "LibVNCServer")
set(FULL_PACKAGE_NAME "LibVNCServer")
set(VERSION_MAJOR "0")
set(VERSION_MINOR "9")
set(VERSION_PATCHLEVEL "11")
set(VERSION_SO "0")
set(VERSION_PATCHLEVEL "12")
set(VERSION_SO "1")
set(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCHLEVEL}")
set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver")
set(CMAKE_C_FLAGS "-O2 -W -Wall -g")
set(PROJECT_BUGREPORT_PATH "https://github.com/LibVNC/libvncserver/issues")
set(LIBVNCSERVER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncserver)
set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(LIBVNCCLIENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncclient)
set(LIBVNCSRVTEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
set(LIBVNCCLITEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/client_examples)
set(LIBVNCSRVEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
set(LIBVNCCLIEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/client_examples)
set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libvncserver ${CMAKE_CURRENT_SOURCE_DIR}/common)
find_package(ZLIB)
find_package(JPEG)
find_package(PNG)
find_package(SDL)
find_package(GnuTLS)
find_package(Threads)
find_package(X11)
find_package(OpenSSL)
find_package(PkgConfig)
find_library(LIBGCRYPT_LIBRARIES gcrypt)
# Check whether the version of libjpeg we found was libjpeg-turbo and print a
# warning if not.
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
set(JPEG_TEST_SOURCE "\n
#include <stdio.h>\n
#include <jpeglib.h>\n
int main(void) {\n
struct jpeg_compress_struct cinfo;\n
struct jpeg_error_mgr jerr;\n
cinfo.err=jpeg_std_error(&jerr);\n
jpeg_create_compress(&cinfo);\n
cinfo.input_components = 3;\n
jpeg_set_defaults(&cinfo);\n
cinfo.in_color_space = JCS_EXT_RGB;\n
jpeg_default_colorspace(&cinfo);\n
return 0;\n
}")
if(CMAKE_CROSSCOMPILING)
check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
else()
check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
# all the build configuration switches
option(BUILD_SHARED_LIBS "Build shared libraries" ${UNIX})
option(WITH_ZLIB "Search for the zlib compression library to support additional encodings" ON)
option(WITH_LZO "Search for the LZO compression library to omit internal miniLZO implementation" ON)
option(WITH_JPEG "Search for the libjpeg compression library to support additional encodings" ON)
option(WITH_PNG "Search for the PNG compression library to support additional encodings" ON)
option(WITH_SDL "Search for the Simple Direct Media Layer library to build an example SDL vnc client" ON)
option(WITH_THREADS "Search for a threading library to build with multithreading support" ON)
option(WITH_GNUTLS "Search for the GnuTLS secure communications library to support encryption" ON)
option(WITH_OPENSSL "Search for the OpenSSL cryptography library to support encryption" ON)
option(WITH_SYSTEMD "Search for libsystemd to build with systemd socket activation support" ON)
option(WITH_GCRYPT "Search for libgcrypt to support additional authentication methods in LibVNCClient" ON)
option(WITH_FFMPEG "Search for FFMPEG to build an example VNC to MPEG encoder" ON)
option(WITH_TIGHTVNC_FILETRANSFER "Enable filetransfer if there is pthreads support" ON)
option(WITH_24BPP "Allow 24 bpp" ON)
option(WITH_IPv6 "Enable IPv6 Support" ON)
option(WITH_WEBSOCKETS "Build with websockets support" ON)
option(WITH_SASL "Build with SASL support" ON)
if(WITH_ZLIB)
find_package(ZLIB)
endif(WITH_ZLIB)
if(WITH_LZO)
find_package(LZO)
endif()
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_DEFINITIONS)
if(NOT FOUND_LIBJPEG_TURBO)
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
endif()
if(WITH_JPEG)
find_package(JPEG)
if(JPEG_FOUND)
# Check whether the version of libjpeg we found was libjpeg-turbo and print a
# warning if not.
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
set(JPEG_TEST_SOURCE "\n
#include <stdio.h>\n
#include <jpeglib.h>\n
int main(void) {\n
struct jpeg_compress_struct cinfo;\n
struct jpeg_error_mgr jerr;\n
cinfo.err=jpeg_std_error(&jerr);\n
jpeg_create_compress(&cinfo);\n
cinfo.input_components = 3;\n
jpeg_set_defaults(&cinfo);\n
cinfo.in_color_space = JCS_EXT_RGB;\n
jpeg_default_colorspace(&cinfo);\n
return 0;\n
}")
if(CMAKE_CROSSCOMPILING)
check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
else()
check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
endif()
# On systems such as GNU/Linux with glibc, __b64_ntop is defined in a
# separate library, libresolv. On some others, such as FreeBSD, it is
# part of libc itself. We first check if __b64_ntop is found without
# additional libraries, and then try looking for it with libresolv if
# the first test fails.
check_function_exists(__b64_ntop HAVE_B64_IN_LIBC)
if(NOT HAVE_B64_IN_LIBC)
set(CMAKE_REQUIRED_LIBRARIES resolv)
check_function_exists(__b64_ntop HAVE_B64_IN_LIBRESOLV)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_DEFINITIONS)
if(HAVE_B64_IN_LIBRESOLV)
set(RESOLV_LIB "resolv")
endif(HAVE_B64_IN_LIBRESOLV)
endif(NOT HAVE_B64_IN_LIBC)
if(NOT FOUND_LIBJPEG_TURBO)
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
endif()
endif(JPEG_FOUND)
endif(WITH_JPEG)
if(Threads_FOUND)
option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON)
endif(Threads_FOUND)
if(ZLIB_FOUND)
set(LIBVNCSERVER_HAVE_LIBZ 1)
endif(ZLIB_FOUND)
if(JPEG_FOUND)
set(LIBVNCSERVER_HAVE_LIBJPEG 1)
endif(JPEG_FOUND)
if(PNG_FOUND)
set(LIBVNCSERVER_HAVE_LIBPNG 1)
endif(PNG_FOUND)
option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON)
pkg_check_modules(SYSTEMD "libsystemd")
if(SYSTEMD_FOUND)
option(LIBVNCSERVER_WITH_SYSTEMD "Build with systemd socket activation support" ON)
endif(SYSTEMD_FOUND)
if(WITH_PNG)
find_package(PNG)
endif(WITH_PNG)
if(LIBVNCSERVER_WITH_SYSTEMD)
add_definitions(-DLIBVNCSERVER_WITH_SYSTEMD)
include_directories(${SYSTEMD_INCLUDE_DIRS})
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${SYSTEMD_LIBRARIES})
endif(LIBVNCSERVER_WITH_SYSTEMD)
if(GNUTLS_FOUND)
set(LIBVNCSERVER_WITH_CLIENT_TLS 1)
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (gnutls)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB} ${GNUTLS_LIBRARIES})
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_gnutls.c ${LIBVNCSERVER_DIR}/rfbcrypto_gnutls.c)
include_directories(${GNUTLS_INCLUDE_DIR})
elseif(OPENSSL_FOUND)
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (openssl)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB} ${OPENSSL_LIBRARIES})
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_openssl.c ${LIBVNCSERVER_DIR}/rfbcrypto_openssl.c)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (no ssl)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB})
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_none.c ${LIBVNCSERVER_DIR}/rfbcrypto_included.c ${COMMON_DIR}/md5.c ${COMMON_DIR}/sha1.c)
endif()
if(WITH_SDL)
find_package(SDL2)
endif(WITH_SDL)
if(WITH_THREADS)
find_package(Threads)
endif(WITH_THREADS)
if(WITH_GNUTLS)
find_package(GnuTLS)
endif(WITH_GNUTLS)
if(WITH_OPENSSL)
find_package(OpenSSL)
endif(WITH_OPENSSL)
if(LIBGCRYPT_LIBRARIES)
message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}")
set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${LIBGCRYPT_LIBRARIES})
endif(LIBGCRYPT_LIBRARIES)
if(WITH_SYSTEMD AND NOT ANDROID)
find_package(PkgConfig)
pkg_check_modules(SYSTEMD "libsystemd")
endif(WITH_SYSTEMD AND NOT ANDROID)
if(WITH_GCRYPT)
find_library(LIBGCRYPT_LIBRARIES gcrypt)
endif(WITH_GCRYPT)
if(WITH_FFMPEG)
find_package(FFMPEG 3.1.0)
endif(WITH_FFMPEG)
check_include_file("endian.h" LIBVNCSERVER_HAVE_ENDIAN_H)
@ -150,6 +153,8 @@ check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H)
check_include_file("sys/types.h" LIBVNCSERVER_HAVE_SYS_TYPES_H)
check_include_file("sys/wait.h" LIBVNCSERVER_HAVE_SYS_WAIT_H)
check_include_file("unistd.h" LIBVNCSERVER_HAVE_UNISTD_H)
check_include_file("sys/uio.h" LIBVNCSERVER_HAVE_SYS_UIO_H)
# headers needed for check_type_size()
check_include_file("vfork.h" LIBVNCSERVER_HAVE_VFORK_H)
@ -159,15 +164,115 @@ check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("stddef.h" HAVE_STDDEF_H)
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
# error out if required headers not found
if(NOT HAVE_STDINT_H)
message(FATAL_ERROR "Could NOT find required header stdint.h")
endif()
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
check_function_exists(vfork LIBVNCSERVER_HAVE_VFORK)
check_function_exists(vprintf LIBVNCSERVER_HAVE_VPRINTF)
check_function_exists(mmap LIBVNCSERVER_HAVE_MMAP)
check_function_exists(fork LIBVNCSERVER_HAVE_FORK)
check_function_exists(ftime LIBVNCSERVER_HAVE_FTIME)
check_function_exists(gethostbyname LIBVNCSERVER_HAVE_GETHOSTBYNAME)
check_function_exists(gethostname LIBVNCSERVER_HAVE_GETHOSTNAME)
check_function_exists(inet_ntoa LIBVNCSERVER_HAVE_INET_NTOA)
check_function_exists(memmove LIBVNCSERVER_HAVE_MEMMOVE)
check_function_exists(memset LIBVNCSERVER_HAVE_MEMSET)
check_function_exists(mkfifo LIBVNCSERVER_HAVE_MKFIFO)
check_function_exists(select LIBVNCSERVER_HAVE_SELECT)
check_function_exists(socket LIBVNCSERVER_HAVE_SOCKET)
check_function_exists(strchr LIBVNCSERVER_HAVE_STRCHR)
check_function_exists(strcspn LIBVNCSERVER_HAVE_STRCSPN)
check_function_exists(strdup LIBVNCSERVER_HAVE_STRDUP)
check_function_exists(strerror LIBVNCSERVER_HAVE_STRERROR)
check_function_exists(strstr LIBVNCSERVER_HAVE_STRSTR)
check_symbol_exists(htobe64 "endian.h" LIBVNCSERVER_HAVE_HTOBE64)
check_symbol_exists(OSSwapHostToBigInt64 "libkern/OSByteOrder.h" LIBVNCSERVER_HAVE_OSSWAPHOSTTOBIGINT64)
if(Threads_FOUND)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
endif(Threads_FOUND)
if(ZLIB_FOUND)
set(LIBVNCSERVER_HAVE_LIBZ 1)
else()
unset(ZLIB_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
endif(ZLIB_FOUND)
if(LZO_FOUND)
set(LIBVNCSERVER_HAVE_LZO 1)
else()
unset(LZO_LIBRARIES CACHE) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
endif()
if(JPEG_FOUND)
set(LIBVNCSERVER_HAVE_LIBJPEG 1)
else()
unset(JPEG_LIBRARIES) # would otherwise confuse target_link_libraries()
endif(JPEG_FOUND)
if(PNG_FOUND)
set(LIBVNCSERVER_HAVE_LIBPNG 1)
endif(PNG_FOUND)
if(NOT OPENSSL_FOUND)
unset(OPENSSL_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries()
endif()
if(SYSTEMD_FOUND)
add_definitions(-DLIBVNCSERVER_WITH_SYSTEMD)
include_directories(${SYSTEMD_INCLUDE_DIRS})
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${SYSTEMD_LIBRARIES})
endif(SYSTEMD_FOUND)
if(LIBVNCSERVER_HAVE_SYS_UIO_H)
if(GNUTLS_FOUND)
message(STATUS "Building crypto with GnuTLS")
set(CRYPTO_LIBRARIES ${GNUTLS_LIBRARIES})
set(CRYPTO_SOURCES ${COMMON_DIR}/rfbcrypto_gnutls.c)
include_directories(${GNUTLS_INCLUDE_DIR})
elseif(OPENSSL_FOUND)
message(STATUS "Building crypto with OpenSSL")
set(CRYPTO_LIBRARIES ${OPENSSL_LIBRARIES})
set(CRYPTO_SOURCES ${COMMON_DIR}/rfbcrypto_openssl.c)
else()
message(STATUS "Building crypto with builtin functions")
set(CRYPTO_SOURCES ${COMMON_DIR}/rfbcrypto_included.c ${COMMON_DIR}/md5.c ${COMMON_DIR}/sha1.c)
endif()
set(LIBVNCSERVER_HAVE_CRYPTO 1)
endif(LIBVNCSERVER_HAVE_SYS_UIO_H)
if(WITH_WEBSOCKETS AND LIBVNCSERVER_HAVE_CRYPTO AND (LIBVNCSERVER_HAVE_HTOBE64 OR LIBVNCSERVER_HAVE_OSSWAPHOSTTOBIGINT64))
set(LIBVNCSERVER_WITH_WEBSOCKETS 1)
endif()
if(WITH_GCRYPT AND LIBGCRYPT_LIBRARIES)
message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}")
set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${LIBGCRYPT_LIBRARIES})
endif(WITH_GCRYPT AND LIBGCRYPT_LIBRARIES)
if(GNUTLS_FOUND)
set(LIBVNCSERVER_HAVE_GNUTLS 1)
endif(GNUTLS_FOUND)
if(OPENSSL_FOUND)
set(LIBVNCSERVER_HAVE_LIBSSL 1)
endif(OPENSSL_FOUND)
if(WITH_IPv6)
if(WIN32 AND LIBVNCSERVER_HAVE_WS2TCPIP_H AND LIBVNCSERVER_HAVE_VPRINTF)
set(LIBVNCSERVER_IPv6 1)
endif()
if(NOT WIN32)
set(LIBVNCSERVER_IPv6 1)
endif()
endif(WITH_IPv6)
if(LIBVNCSERVER_HAVE_WS2TCPIP_H AND LIBVNCSERVER_HAVE_VPRINTF)
option(LIBVNCSERVER_IPv6 "Enable IPv6 Support" ON)
if(WITH_24BPP)
set(LIBVNCSERVER_ALLOW24BPP 1)
endif()
if(CMAKE_USE_PTHREADS_INIT)
set(LIBVNCSERVER_HAVE_LIBPTHREAD 1)
endif(CMAKE_USE_PTHREADS_INIT)
@ -190,11 +295,23 @@ endif(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
TEST_BIG_ENDIAN(LIBVNCSERVER_WORDS_BIGENDIAN)
if(WITH_SASL)
find_path(SASL2_INCLUDE_DIR sasl/sasl.h)
find_library(LIBSASL2_LIBRARIES sasl2 libsasl.lib)
endif(WITH_SASL)
if(WITH_SASL AND LIBSASL2_LIBRARIES AND SASL2_INCLUDE_DIR)
message(STATUS "Building with SASL: ${LIBSASL2_LIBRARIES} and ${SASL2_INCLUDE_DIR}")
set(LIBVNCSERVER_HAVE_SASL 1)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${LIBSASL2_LIBRARIES})
include_directories(${SASL2_INCLUDE_DIR})
endif(WITH_SASL AND LIBSASL2_LIBRARIES AND SASL2_INCLUDE_DIR)
# TODO:
# LIBVNCSERVER_ENOENT_WORKAROUND
# inline
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rfb/rfbconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/rfb/rfbconfig.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rfb/rfbconfig.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/rfb/rfbconfig.h)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_DIR}/main.cc
@ -216,7 +333,6 @@ set(LIBVNCSERVER_SOURCES
${COMMON_DIR}/d3des.c
${COMMON_DIR}/vncauth.c
${LIBVNCSERVER_DIR}/cargs.c
${COMMON_DIR}/minilzo.c
${LIBVNCSERVER_DIR}/ultra.c
${LIBVNCSERVER_DIR}/scale.c
)
@ -227,24 +343,51 @@ set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_DIR}/rfbproto.c
${LIBVNCCLIENT_DIR}/sockets.c
${LIBVNCCLIENT_DIR}/vncviewer.c
${COMMON_DIR}/minilzo.c
)
if(JPEG_FOUND)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${COMMON_DIR}/turbojpeg.c
)
endif()
if(GNUTLS_FOUND)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${LIBVNCCLIENT_DIR}/tls_gnutls.c
)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/rfbssl_gnutls.c
)
include_directories(${GNUTLS_INCLUDE_DIR})
elseif(OPENSSL_FOUND)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${LIBVNCCLIENT_DIR}/tls_openssl.c
)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/rfbssl_openssl.c
)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${LIBVNCCLIENT_DIR}/tls_none.c
)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/rfbssl_none.c
)
endif()
if(LIBVNCSERVER_HAVE_SASL)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${LIBVNCCLIENT_DIR}/sasl.c
)
endif()
if(ZLIB_FOUND)
@ -259,6 +402,20 @@ if(ZLIB_FOUND)
)
endif(ZLIB_FOUND)
if(LZO_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LZO)
include_directories(${LZO_INCLUDE_DIR})
else()
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${COMMON_DIR}/minilzo.c
)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_SOURCES}
${COMMON_DIR}/minilzo.c
)
endif()
if(JPEG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
include_directories(${JPEG_INCLUDE_DIR})
@ -268,7 +425,6 @@ endif(JPEG_FOUND)
if(PNG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBPNG)
include_directories(${PNG_INCLUDE_DIR})
set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c ${COMMON_DIR}/turbojpeg.c)
endif(PNG_FOUND)
set(LIBVNCSERVER_SOURCES
@ -276,7 +432,7 @@ set(LIBVNCSERVER_SOURCES
${TIGHT_C}
)
if(TIGHTVNC_FILETRANSFER)
if(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/rfbtightserver.c
@ -284,14 +440,16 @@ if(TIGHTVNC_FILETRANSFER)
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filetransfermsg.c
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filelistinfo.c
)
endif(TIGHTVNC_FILETRANSFER)
endif(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)
if(LIBVNCSERVER_WITH_WEBSOCKETS)
add_definitions(-DLIBVNCSERVER_WITH_WEBSOCKETS)
set(LIBVNCSERVER_SOURCES
${LIBVNCSERVER_SOURCES}
${LIBVNCSERVER_DIR}/websockets.c
${WSSRCS}
${LIBVNCSERVER_DIR}/ws_decode.c
${COMMON_DIR}/base64.c
${CRYPTO_SOURCES}
)
endif(LIBVNCSERVER_WITH_WEBSOCKETS)
@ -301,7 +459,13 @@ tde_add_library( tdevncclient STATIC_PIC AUTOMOC
SOURCES
${LIBVNCCLIENT_SOURCES}
LINK
pthread ${ADDITIONAL_LIBS} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${GNUTLS_LIBRARIES} ${OPENSSL_LIBRARIES}
pthread
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${LZO_LIBRARIES}
${JPEG_LIBRARIES}
${GNUTLS_LIBRARIES}
${OPENSSL_LIBRARIES}
)
##### tdevncserver (static) ########################
@ -310,5 +474,12 @@ tde_add_library( tdevncserver STATIC_PIC AUTOMOC
SOURCES
${LIBVNCSERVER_SOURCES}
LINK
${ADDITIONAL_LIBS} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${WEBSOCKET_LIBRARIES}
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${LZO_LIBRARIES}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${CRYPTO_LIBRARIES}
${GNUTLS_LIBRARIES}
${OPENSSL_LIBRARIES}
)

1463
ChangeLog

File diff suppressed because it is too large Load Diff

97
LibVNCServer.spec.in

@ -1,97 +0,0 @@
# Note that this is NOT a relocatable package
Name: @PACKAGE@
Version: @VERSION@
Release: 2
Summary: a library to make writing a vnc server easy
Copyright: GPL
Group: Libraries/Network
Packager: Johannes.Schindelin <Johannes.Schindelin@gmx.de>
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%description
LibVNCServer makes writing a VNC server (or more correctly, a program
exporting a framebuffer via the Remote Frame Buffer protocol) easy.
It is based on OSXvnc, which in turn is based on the original Xvnc by
ORL, later AT&T research labs in UK.
It hides the programmer from the tedious task of managing clients and
compression schemata.
LibVNCServer was put together and is (actively ;-) maintained by
Johannes Schindelin <Johannes.Schindelin@gmx.de>
%package devel
Requires: %{name} = %{version}
Summary: Static Libraries and Header Files for LibVNCServer
Group: Libraries/Network
Requires: %{name} = %{version}
%description devel
Static Libraries and Header Files for LibVNCServer.
%package x11vnc
Requires: %{name} = %{version}
Summary: VNC server for the current X11 session
Group: User Interface/X
Requires: %{name} = %{version}
%description x11vnc
x11vnc is to X Window System what WinVNC is to Windows, i.e. a server
which serves the current X Window System desktop via RFB (VNC)
protocol to the user.
Based on the ideas of x0rfbserver and on LibVNCServer, it has evolved
into a versatile and performant while still easy to use program.
%prep
%setup -n %{name}-%{version}
%build
# CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix}
%configure
make
%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
# make install prefix=%{buildroot}%{_prefix}
%makeinstall includedir="%{buildroot}%{_includedir}/rfb"
%{__install} -d -m0755 %{buildroot}%{_datadir}/x11vnc/classes
%{__install} webclients/VncViewer.jar webclients/index.vnc \
%{buildroot}%{_datadir}/x11vnc/classes
%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
%pre
%post
%preun
%postun
%files
%defattr(-,root,root)
%doc README INSTALL AUTHORS ChangeLog NEWS TODO
%{_bindir}/LinuxVNC
%{_bindir}/libvncserver-config
%{_libdir}/libvncclient.*
%{_libdir}/libvncserver.*
%files devel
%defattr(-,root,root)
%{_includedir}/rfb/*
%files x11vnc
%defattr(-,root,root)
%{_bindir}/x11vnc
%{_mandir}/man1/x11vnc.1*
%{_datadir}/x11vnc/classes
%changelog
* Fri Aug 19 2005 Alberto Lusiani <alusiani@gmail.com> release 2
- create separate package for x11vnc to prevent conflicts with x11vnc rpm
- create devel package, needed to compile but not needed for running
* Sun Feb 9 2003 Johannes Schindelin
- created libvncserver.spec.in

28
Makefile.am

@ -1,28 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS=libvncserver examples libvncclient webclients client_examples test
DIST_SUBDIRS=libvncserver examples libvncclient webclients client_examples test
EXTRA_DIST = CMakeLists.txt rfb/rfbconfig.h.cmake
bin_SCRIPTS = libvncserver-config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvncserver.pc libvncclient.pc
includedir=$(prefix)/include/rfb
include_HEADERS=rfb/rfb.h rfb/rfbconfig.h rfb/rfbproto.h \
rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h
$(PACKAGE)-$(VERSION).tar.gz: dist
if HAVE_RPM
# Rule to build RPM distribution package
rpm: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).spec
cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@
rpmbuild -ba $(PACKAGE).spec
endif
t:
$(MAKE) -C test test

35
NEWS

@ -1,3 +1,38 @@
0.9.12
- Overall changes:
* CMake now is the default build system, Autotools were removed.
* In addition to TravisCI, all commits are now build-tested by AppVeyorCI.
- LibVNCServer/LibVNCClient:
* Numerous build fixes for Visual Studio compilers to the extent that
one can now _build_ the project with these. The needed changes for
successfully _running_ stuff will be implemented in 0.9.13.
* Fixed building for Android and added build instructions.
* Removed the unused PolarSSL wrapper.
* Updated the bundled noVNC to latest release 1.0.0.
* Allowed to use global LZO library instead of miniLZO.
- LibVNCClient:
* Support for OpenSSL 1.1.x.
* Support for overriding the default rectangle decode handlers (with
hardware-accelerated ones for instance) thanks to Balazs Ludmany.
* vnc2mpg updated.
* Added support for X509 server certificate verification as part of the
handshake process thanks to Simon Waterman.
* Added a TRLE decoder thanks to Wiki Wang.
* Included Tight decoding optimizations from TurboVNC thanks to DRC.
* Ported the SDL viewer from SDL 1.2 to SDL 2.0.
* Numerous security fixes.
* Added support for custom auth handlers in order to support additional
security types.
- LibVNCServer:
* Websockets rework to remove obsolete code thanks to Andreas Weigel.
* Ensured compatibility with gtk-vnc 0.7.0+ thanks to Michał Kępień.
* The built-in webserver now sends correct MIME type for Javascript.
* Numerous memory management issues fixed.
* Made the TightVNC-style file transfer more stable.
0.9.11
- Overall changes:
* LibVNCServer/LibVNCClient development now uses continous intregration,

447
README

@ -1,447 +0,0 @@
[![Build Status](https://travis-ci.org/LibVNC/libvncserver.svg?branch=master)](https://travis-ci.org/LibVNC/libvncserver)
LibVNCServer: A library for easy implementation of a VNC server.
Copyright (C) 2001-2003 Johannes E. Schindelin
If you already used LibVNCServer, you probably want to read NEWS.
What is it?
-----------
VNC is a set of programs using the RFB (Remote Frame Buffer) protocol. They
are designed to "export" a frame buffer via net (if you don't know VNC, I
suggest you read "Basics" below). It is already in wide use for
administration, but it is not that easy to program a server yourself.
This has been changed by LibVNCServer.
There are two examples included:
- example, a shared scribble sheet
- pnmshow, a program to show PNMs (pictures) over the net.
The examples are not too well documented, but easy straight forward and a
good starting point.
Try example: it outputs on which port it listens (default: 5900), so it is
display 0. To view, call
vncviewer :0
You should see a sheet with a gradient and "Hello World!" written on it. Try
to paint something. Note that every time you click, there is some bigger blot,
whereas when you drag the mouse while clicked you draw a line. The size of the
blot depends on the mouse button you click. Open a second vncviewer with
the same parameters and watch it as you paint in the other window. This also
works over internet. You just have to know either the name or the IP of your
machine. Then it is
vncviewer machine.where.example.runs.com:0
or similar for the remote client. Now you are ready to type something. Be sure
that your mouse sits still, because every time the mouse moves, the cursor is
reset to the position of the pointer! If you are done with that demo, press
the down or up arrows. If your viewer supports it, then the dimensions of the
sheet change. Just press Escape in the viewer. Note that the server still
runs, even if you closed both windows. When you reconnect now, everything you
painted and wrote is still there. You can press "Page Up" for a blank page.
The demo pnmshow is much simpler: you either provide a filename as argument
or pipe a file through stdin. Note that the file has to be a raw pnm/ppm file,
i.e. a truecolour graphics. Only the Escape key is implemented. This may be
the best starting point if you want to learn how to use LibVNCServer. You
are confronted with the fact that the bytes per pixel can only be 8, 16 or 32.
Projects using it
----------------------------------------
VNC for KDE
http://www.tjansen.de/krfb
GemsVNC
http://www.elilabs.com/~rj/gemsvnc/
VNC for Netware
http://forge.novell.com/modules/xfmod/project/?vncnw
RDesktop
http://rdesktop.sourceforge.net
VNCpp
https://github.com/ocrespo/VNCpp
Mail me, if your application is missing!
How to use
----------
To make a server, you just have to initialise a server structure using the
function rfbDefaultScreenInit, like
rfbScreenInfoPtr rfbScreen =
rfbGetScreen(argc,argv,width,height,8,3,bpp);
where byte per pixel should be 1, 2 or 4. If performance doesn't matter,
you may try bpp=3 (internally one cannot use native data types in this
case; if you want to use this, look at pnmshow24).
You then can set hooks and io functions (see below) or other
options (see below).
And you allocate the frame buffer like this:
rfbScreen->frameBuffer = (char*)malloc(width*height*bpp);
After that, you initialize the server, like
rfbInitServer(rfbScreen);
You can use a blocking event loop, a background (pthread based) event loop,
or implement your own using the rfbProcessEvents function.
Making it interactive
---------------------
Input is handled by IO functions (see below).
Whenever you change something in the frame buffer, call rfbMarkRectAsModified.
You should make sure that the cursor is not drawn before drawing yourself
by calling rfbUndrawCursor. You can also draw the cursor using rfbDrawCursor,
but it hardly seems necessary. For cursor details, see below.
Utility functions
-----------------
Whenever you draw something, you have to call
rfbMarkRectAsModified(screen,x1,y1,x2,y2).
This tells LibVNCServer to send updates to all connected clients.
Before you draw something, be sure to call
rfbUndrawCursor(screen).
This tells LibVNCServer to hide the cursor.
Remark: There are vncviewers out there, which know a cursor encoding, so
that network traffic is low, and also the cursor doesn't need to be
drawn the cursor every time an update is sent. LibVNCServer handles
all the details. Just set the cursor and don't bother any more.
To set the mouse coordinates (or emulate mouse clicks), call
rfbDefaultPtrAddEvent(buttonMask,x,y,cl);
IMPORTANT: do this at the end of your function, because this actually draws
the cursor if no cursor encoding is active.
What is the difference between rfbScreenInfoPtr and rfbClientPtr?
-----------------------------------------------------------------
The rfbScreenInfoPtr is a pointer to a rfbScreenInfo structure, which
holds information about the server, like pixel format, io functions,
frame buffer etc.
The rfbClientPtr is a pointer to an rfbClientRec structure, which holds
information about a client, like pixel format, socket of the
connection, etc.
A server can have several clients, but needn't have any. So, if you
have a server and three clients are connected, you have one instance
of a rfbScreenInfo and three instances of rfbClientRec's.
The rfbClientRec structure holds a member
rfbScreenInfoPtr screen
which points to the server and a member
rfbClientPtr next
to the next client.
The rfbScreenInfo structure holds a member
rfbClientPtr rfbClientHead
which points to the first client.
So, to access the server from the client structure, you use client->screen.
To access all clients from a server, get screen->rfbClientHead and
iterate using client->next.
If you change client settings, be sure to use the provided iterator
rfbGetClientIterator(rfbScreen)
with
rfbClientIteratorNext(iterator)
and
rfbReleaseClientIterator
to prevent thread clashes.
Other options
-------------
These options have to be set between rfbGetScreen and rfbInitServer.
If you already have a socket to talk to, just set rfbScreen->inetdSock
(originally this is for inetd handling, but why not use it for your purpose?).
To also start an HTTP server (running on port 5800+display_number), you have
to set rfbScreen->httpdDir to a directory containing vncviewer.jar and
index.vnc (like the included "webclients" directory).
Hooks and IO functions
----------------------
There exist the following IO functions as members of rfbScreen:
kbdAddEvent, kbdReleaseAllKeys, ptrAddEvent and setXCutText
kbdAddEvent(rfbBool down,rfbKeySym key,rfbClientPtr cl)
is called when a key is pressed.
kbdReleaseAllKeys(rfbClientPtr cl)
is not called at all (maybe in the future).
ptrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl)
is called when the mouse moves or a button is pressed.
WARNING: if you want to have proper cursor handling, call
rfbDefaultPtrAddEvent(buttonMask,x,y,cl)
in your own function. This sets the coordinates of the cursor.
setXCutText(char* str,int len,rfbClientPtr cl)
is called when the selection changes.
There are only two hooks:
newClientHook(rfbClientPtr cl)
is called when a new client has connected.
displayHook
is called just before a frame buffer update is sent.
You can also override the following methods:
getCursorPtr(rfbClientPtr cl)
This could be used to make an animated cursor (if you really want ...)
setTranslateFunction(rfbClientPtr cl)
If you insist on colour maps or something more obscure, you have to
implement this. Default is a trueColour mapping.
Cursor handling
---------------
The screen holds a pointer
rfbCursorPtr cursor
to the current cursor. Whenever you set it, remember that any dynamically
created cursor (like return value from rfbMakeXCursor) is not free'd!
The rfbCursor structure consists mainly of a mask and a source. The mask
describes, which pixels are drawn for the cursor (a cursor needn't be
rectangular). The source describes, which colour those pixels should have.
The standard is an XCursor: a cursor with a foreground and a background
colour (stored in backRed,backGreen,backBlue and the same for foreground
in a range from 0-0xffff). Therefore, the arrays "mask" and "source"
contain pixels as single bits stored in bytes in MSB order. The rows are
padded, such that each row begins with a new byte (i.e. a 10x4
cursor's mask has 2x4 bytes, because 2 bytes are needed to hold 10 bits).
It is however very easy to make a cursor like this:
char* cur=" "
" xx "
" x "
" ";
char* mask="xxxx"
"xxxx"
"xxxx"
"xxx ";
rfbCursorPtr c=rfbMakeXCursor(4,4,cur,mask);
You can even set "mask" to NULL in this call and LibVNCServer will calculate
a mask for you (dynamically, so you have to free it yourself).
There is also an array named "richSource" for colourful cursors. They have
the same format as the frameBuffer (i.e. if the server is 32 bit,
a 10x4 cursor has 4x10x4 bytes).
History
-------
LibVNCServer is based on Tridia VNC and OSXvnc, which in turn are based on
the original code from ORL/AT&T.
When I began hacking with computers, my first interest was speed. So, when I
got around assembler, I programmed the floppy to do much of the work, because
its clock rate was higher than that of my C64. This was my first experience
with client/server techniques.
When I came around Xwindows (much later), I was at once intrigued by the
elegance of such connectedness between the different computers. I used it
a lot - not the least priority lay on games. However, when I tried it over
modem from home, it was no longer that much fun.
When I started working with ASP (Application Service Provider) programs, I
tumbled across Tarantella and Citrix. Being a security fanatic, the idea of
running a server on windows didn't appeal to me, so Citrix went down the
basket. However, Tarantella has its own problems (security as well as the
high price). But at the same time somebody told me about this "great little
administrator's tool" named VNC. Being used to windows programs' sizes, the
surprise was reciprocal inverse to the size of VNC!
At the same time, the program "rdesktop" (a native Linux client for the
Terminal Services of Windows servers) came to my attention. There where even
works under way to make a protocol converter "rdp2vnc" out of this. However,
my primary goal was a slow connection and rdp2vnc could only speak RRE
encoding, which is not that funny with just 5kB/s. Tim Edmonds, the original
author of rdp2vnc, suggested that I adapt it to Hextile Encoding, which is
better. I first tried that, but had no success at all (crunchy pictures).
Also, I liked the idea of an HTTP server included and possibly other
encodings like the Tight Encodings from Const Kaplinsky. So I started looking
for libraries implementing a VNC server where I could steal what I can't make.
I found some programs based on the demo server from AT&T, which was also the
basis for rdp2vnc (can only speak Raw and RRE encoding). There were some
rumors that GGI has a VNC backend, but I didn't find any code, so probably
there wasn't a working version anyway.
All of a sudden, everything changed: I read on freshmeat that "OSXvnc" was
released. I looked at the code and it was not much of a problem to work out
a simple server - using every functionality there is in Xvnc. It became clear
to me that I *had* to build a library out of it, so everybody can use it.
Every change, every new feature can propagate to every user of it.
It also makes everything easier:
You don't care about the cursor, once set (or use the standard cursor).
You don't care about those sockets. You don't care about encodings.
You just change your frame buffer and inform the library about it. Every once
in a while you call rfbProcessEvents and that's it.
Basics
------
VNC (Virtual network computing) works like this: You set up a server and can
connect to it via vncviewers. The communication uses a protocol named RFB
(Remote Frame Buffer). If the server supports HTTP, you can also connect
using a java enabled browser. In this case, the server sends back a
vncviewer applet with the correct settings.
There exist several encodings for VNC, which are used to compress the regions
which have changed before they are sent to the client. A client need not be
able to understand every encoding, but at least Raw encoding. Which encoding
it understands is negotiated by the RFB protocol.
The following encodings are known to me:
Raw, RRE, CoRRE, Hextile, CopyRect from the original AT&T code and
Tight, ZLib, LastRect, XCursor, RichCursor from Const Kaplinsky et al.
If you are using a modem, you want to try the "new" encodings. Especially
with my 56k modem I like ZLib or Tight with Quality 0. In my tests, it even
beats Tarantella.
There is the possibility to set a password, which is also negotiated by the
RFB protocol, but IT IS NOT SECURE. Anybody sniffing your net can get the
password. You really should tunnel through SSH.
Windows or: why do you do that to me?
--------------------------------------------
If you love products from Redmod, you better skip this paragraph.
I am always amazed how people react whenever Microsoft(tm) puts in some
features into their products which were around for a long time. Especially
reporters seem to not know dick about what they are reporting about! But
what is every time annoying again, is that they don't do it right. Every
concept has its new name (remember what enumerators used to be until
Mickeysoft(tm) claimed that enumerators are what we thought were iterators.
Yeah right, enumerators are also containers. They are not separated. Muddy.)
There are three packages you want to get hold of: zlib, jpeg and pthreads.
The latter is not strictly necessary, but when you put something like this
into your source:
```
#define MUTEX(s)
struct {
int something;
MUTEX(latex);
}
```
Microsoft's C++ compiler doesn't do it. It complains that this is an error.
This, however, is how I implemented mutexes in case you don't need pthreads,
and so don't need the mutex.
You can find the packages at
http://www.gimp.org/win32/extralibs-dev-20001007.zip
Thanks go to all the GIMP team!
What are those other targets in the Makefile?
---------------------------------------------
OSXvnc-server is the original OSXvnc adapted to use the library, which was in
turn adapted from OSXvnc. As you easily can see, the OSX dependend part is
<