Skip to content

Commit

Permalink
Merge branch 'master' into multicastvnc
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Oct 20, 2024
2 parents 2771ce3 + 2a23c44 commit 19a85d2
Show file tree
Hide file tree
Showing 21 changed files with 405 additions and 1,201 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: LLVM
IndentWidth: 4
4 changes: 3 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Fabrice Fontaine, Cédric Georges, Stefan Weil, Rolf Eike Beer, Andreas Weigel,
Gaurav Ujjwal, Tobias Junghans, Efim Bushmanov, Jonas Ådahl, Andri Yngvason,
Tim Gates, Dinglan Peng, Ryo Ota, Kyle Evans, Kang Lin, Derek Schrock,
Alex Converse, Thorsten Scherer, Marco Fortina, Antenore Gatta, Maxim Devaev
and Maksym Sobolyev.
Maksym Sobolyev, Huben Chang, Peter Vicman, Johann Obermayr, Nicolas Morais,
Volodymyr Samokhatko, Mingjie Shen, Joris Hans Meijer, Sérgio Basto,
Jeffrey Knockel and Christian Hitz.

Probably we forgot quite a few people sending a patch here and there, which
really made a difference. Without those, some obscure bugs still would
Expand Down
68 changes: 43 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 3.4)

project(LibVNCServer VERSION 0.9.14 LANGUAGES C)
set(PROJECT_LANGUAGES C)

if(DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_STANDARD 17)
list(APPEND PROJECT_LANGUAGES CXX)
endif(DEFINED CMAKE_CXX_COMPILER)

project(LibVNCServer VERSION 0.9.15 LANGUAGES ${PROJECT_LANGUAGES})
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckIncludeFile)
Expand All @@ -25,6 +32,7 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja")
# some LSP servers expect compile_commands.json in the project root
add_custom_target(
Expand All @@ -51,7 +59,7 @@ option(WITH_JPEG "Search for the libjpeg compression library to support addition
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_GTK "Search for the GTK library to build an example GTK vnc client" ON)
option(WITH_LIBSSH2 "Search for libssh2 to build an example ssh-tunneled client" ON)
option(WITH_LIBSSHTUNNEL "Search for libsshtunnel to build an example ssh-tunneled client" ON)
option(WITH_THREADS "Search for a threading library to build with multithreading support" ON)
option(PREFER_WIN32THREADS "When searching for a threading library, prefer win32 threads if they are found" OFF)
option(WITH_GNUTLS "Search for the GnuTLS secure communications library to support TLS" ON)
Expand All @@ -67,7 +75,7 @@ option(WITH_SASL "Build with SASL support" ON)
option(WITH_XCB "Build with XCB support" ON)
option(WITH_EXAMPLES "Build examples" ON)
option(WITH_TESTS "Build tests" ON)

option(WITH_QT "Build the Qt client example" ON)

if(WITH_ZLIB)
find_package(ZLIB)
Expand Down Expand Up @@ -125,6 +133,8 @@ if(WITH_JPEG)
file(STRINGS ${JPEGLIB_H_PATH} FOUND_LIBJPEG_TURBO REGEX "JCS_EXT_RGB")
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/ ***")
else()
message(STATUS "Detected libjpeg-turbo via ${JPEGLIB_H_PATH}")
endif()
endif()
endif(JPEG_FOUND)
Expand All @@ -144,9 +154,18 @@ if(WITH_GTK)
find_package(GTK2)
endif(WITH_GTK)

if(WITH_LIBSSH2)
find_package(LibSSH2)
endif(WITH_LIBSSH2)
if(WITH_QT)
find_package(Qt5 COMPONENTS Core Widgets QUIET)
endif(WITH_QT)

if(WITH_LIBSSHTUNNEL)
find_path(LIBSSHTUNNEL_INCLUDE_DIR libsshtunnel.h)
find_library(LIBSSHTUNNEL_LIBRARY sshtunnel)
if("${LIBSSHTUNNEL_LIBRARY}" MATCHES ".*NOTFOUND.*")
# would otherwise contain -NOTFOUND, confusing target_link_libraries()
set(LIBSSHTUNNEL_LIBRARY "")
endif()
endif(WITH_LIBSSHTUNNEL)

if(WITH_THREADS)
find_package(Threads)
Expand Down Expand Up @@ -580,16 +599,6 @@ if(WITH_THREADS AND WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)
)
endif(WITH_THREADS AND WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)

if(APPLE AND NOT IOS AND WITH_THREADS AND CMAKE_USE_PTHREADS_INIT)
set(LIBVNCSERVER_EXAMPLES
${LIBVNCSERVER_EXAMPLES}
mac
)
find_library(CARBON_LIBRARY Carbon)
find_library(IOKIT_LIBRARY IOKit)
find_library(IOSURFACE_LIBRARY IOSurface)
endif(APPLE AND NOT IOS AND WITH_THREADS AND CMAKE_USE_PTHREADS_INIT)

if(ANDROID)
set(LIBVNCSERVER_EXAMPLES
${LIBVNCSERVER_EXAMPLES}
Expand Down Expand Up @@ -630,19 +639,17 @@ if(GTK2_FOUND)
)
endif(GTK2_FOUND)

if(LIBSSH2_FOUND AND (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT))
include_directories(${LIBSSH2_INCLUDE_DIR})
if(WITH_LIBSSHTUNNEL AND LIBSSHTUNNEL_LIBRARY AND LIBSSHTUNNEL_INCLUDE_DIR)
message(STATUS "Building with libsshtunnel: ${LIBSSHTUNNEL_LIBRARY} and ${LIBSSHTUNNEL_INCLUDE_DIR}")
include_directories(${LIBSSHTUNNEL_INCLUDE_DIR})
set(LIBVNCCLIENT_EXAMPLES
${LIBVNCCLIENT_EXAMPLES}
sshtunnel
)
endif()
# if not found, set lib var to empty, otherwise CMake complains
if(NOT LIBSSH2_FOUND)
set(LIBSSH2_LIBRARY "")
endif()

if(FFMPEG_FOUND)
include_directories(${FFMPEG_INCLUDE_DIRS})
set(LIBVNCCLIENT_EXAMPLES
${LIBVNCCLIENT_EXAMPLES}
vnc2mpg
Expand All @@ -654,15 +661,26 @@ if(WITH_EXAMPLES)
add_executable(examples_${e} ${LIBVNCSRVEXAMPLE_DIR}/${e}.c)
set_target_properties(examples_${e} PROPERTIES OUTPUT_NAME ${e})
set_target_properties(examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/server)
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} ${X11_xcb_LIB} ${X11_xcb_xtest_LIB} ${X11_xcb_keysyms_LIB})
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${X11_xcb_LIB} ${X11_xcb_xtest_LIB} ${X11_xcb_keysyms_LIB})
endforeach(e ${LIBVNCSERVER_EXAMPLES})

foreach(e ${LIBVNCCLIENT_EXAMPLES})
add_executable(client_examples_${e} ${LIBVNCCLIEXAMPLE_DIR}/${e}.c ${LIBVNCCLIEXAMPLE_DIR}/${${e}_EXTRA_SOURCES} )
set_target_properties(client_examples_${e} PROPERTIES OUTPUT_NAME ${e})
set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client)
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSH2_LIBRARY})
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSHTUNNEL_LIBRARY})
endforeach(e ${LIBVNCCLIENT_EXAMPLES})

#This example must have its own building instructions,
#apart from the other examples because it is written in
#C++, so it has a distinct file extension and depends on
#a C++ compiler
if(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER)
add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES})
set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client)
set_target_properties(client_examples_qt5client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client)
target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} ${Qt5Widgets_LIBRARIES})
endif(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER)
endif(WITH_EXAMPLES)

#
Expand All @@ -674,7 +692,7 @@ if(WITH_TESTS)
# First fuzzing
if(DEFINED ENV{LIB_FUZZING_ENGINE})
add_executable(fuzz_server ${TESTS_DIR}/fuzz_server.c)
target_link_libraries(fuzz_server vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} $ENV{LIB_FUZZING_ENGINE})
target_link_libraries(fuzz_server vncserver ${CMAKE_THREAD_LIBS_INIT} $ENV{LIB_FUZZING_ENGINE})
endif()

if(UNIX)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Overall changes:

* Added fuzzing with OSS-Fuzz thanks to Catena Cyber.
* Improved build system to have files where they are expected in contemporary open source projects.
Also split out Mac OS server example to own repo at https://github.com/LibVNC/macVNC
* Added Windows CI on GitHub.

## LibVNCServer/LibVNCClient:

Expand All @@ -12,10 +15,15 @@

* Fixed LibVNCClient handling of UltraVNC MSLogonII when built with OpenSSL.
* Added UTF8 clipboard handling.
* Added API to allow the client to specify a subregion of the server's framebuffer and
have LibVNCClient only ask for this, not the whole framebuffer.
* Fixed Tight decoding endianness issues.
* Added a Qt-based client example.

## LibVNCServer:

* Added a proof-of-concept X11 example server.
* Improved SSH example by having it use [libsshtunnel](https://github.com/bk138/libsshtunnel/) instead of custom code.


# 2022-12-18: Version 0.9.14
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
LibVNCServer: A library for easy implementation of a VNC server.
Copyright (C) 2001-2003 Johannes E. Schindelin

If you have a general question, it's best to [ask in the community chat](https://gitter.im/LibVNC/libvncserver). If your concern is about a bug or feature request instead, please use [the issue tracker](https://github.com/LibVNC/libvncserver/issues).

If you already used LibVNCServer, you probably want to read [NEWS](NEWS.md).

What is it?
Expand Down Expand Up @@ -53,7 +55,6 @@ RFB Protocol Support Status
| Hextile | 5 |||
| Zlib | 6 |||
| Tight | 7 |||
| Zlibhex | 8 || |
| Ultra | 9 |||
| TRLE | 15 | ||
| ZRLE | 16 |||
Expand Down Expand Up @@ -123,7 +124,9 @@ Tested with MinGW-w64 on Debian, which you should install via `sudo apt install
You can make use of the [provided toolchainfile](cmake/Toolchain-cross-mingw32-linux.cmake).
It sets CMake to expect (optional) win32 dependencies like libjpeg and friends
in the `deps` directory. Note that you need (probably self-built) development packages for
win32, the `-dev` packages coming with your distribution won't work.
win32, the `-dev` packages coming with your distribution won't work. Also note that you'll
need to put `libwinpthread-1.dll` in the build dir to run the examples. You can find this DLL
on your Linux build machine via `locate libwinpthread-1.dll`.


mkdir build
Expand Down Expand Up @@ -228,10 +231,10 @@ high latency or both.

On a high-latency link, try asking for framebuffer updates continously, as
RFB is client-pull per default, not server-push. One example implementation
can be found [here](https://github.com/bk138/multivnc/blob/master/src/VNCConn.cpp#L1112)
can be found [here](https://github.com/bk138/multivnc/blob/6251169ed11835ed709c0c191599937759856dda/src/VNCConn.cpp#L1112)
and it definitely improves responsiveness.

There also is the [ContinuousUpdates RFB extension](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#continuousupdates-pseudo-encoding),
There also is the [ContinuousUpdates RFB extension](https://github.com/rfbproto/rfbproto/blob/513c651fff1b213188daa5069444145a63e71617/rfbproto.rst#L4052),
but that one is not supported by LibVNC (yet).

### Tackling Low Throughput
Expand All @@ -250,7 +253,7 @@ bytes that get sent per framebuffer update:
* Send a scaled-down version of your framebuffer. You can do the scaling in your
application feeding data into LibVNCServer's framebuffer (would affect all clients)
or let LibVNCServer do the work for you if your client requests a scaled screen
via a [SetScale or SetScaleFactor message](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#74client-to-server-messages)
via a [SetScale or SetScaleFactor message](https://github.com/rfbproto/rfbproto/blob/513c651fff1b213188daa5069444145a63e71617/rfbproto.rst#L1344)
(this is per-client scaling - UltraVNC viewers can request this).


Expand Down
43 changes: 0 additions & 43 deletions cmake/Modules/FindLibSSH2.cmake

This file was deleted.

Loading

0 comments on commit 19a85d2

Please sign in to comment.