added libvncserver 099
This commit is contained in:
parent
c7ef022903
commit
ef3118c763
42
jni/vnc/LibVNCServer-0.9.9/AUTHORS
Normal file
42
jni/vnc/LibVNCServer-0.9.9/AUTHORS
Normal file
@ -0,0 +1,42 @@
|
||||
* LibVNCServer (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
|
||||
is based on
|
||||
* Original OSXvnc (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>,
|
||||
which in turn is based on
|
||||
* Original Xvnc (C) 1999 AT&T Laboratories Cambridge.
|
||||
|
||||
Lots of improvements of this library are thanks to
|
||||
* TightVNC (C) 2000-2003 Const Kaplinsky
|
||||
|
||||
The ZRLE compression scheme is from
|
||||
* RealVNC (James "Wez" Weatherall, who helped also with regions)
|
||||
|
||||
The good folks from
|
||||
* KRFB (I think it was Tim Jansen)
|
||||
helped also a lot (some *big* bugs!).
|
||||
|
||||
Karl Runge provides an x11vnc, which is a much, much improved version of my
|
||||
original proof-of-concept. It really deserves to replace the old version,
|
||||
as it is a state-of-the-art, fast and usable program by now! However, he
|
||||
maintains it and improves it still in amazing ways!
|
||||
|
||||
The file transfer protocol from TightVNC was implemented by Rohit Kumar.
|
||||
This includes an implementation of RFB protocol version 3.7t.
|
||||
|
||||
Occasional important patches were sent by (in order I found the names in my
|
||||
archives and please don't beat me, if I forgot you, but just send me an
|
||||
email!): Akira Hatakeyama, Karl J. Runge, Justin "Zippy" Dearing,
|
||||
Oliver Mihatsch, Greg Sternberg, Werner Hofer, Giampiero Giancipoli,
|
||||
Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz,
|
||||
Mark McLoughlin, Paul Fox, Juan Jose Costello, Andre Leiadella,
|
||||
Alberto Lusiani, Malvina Mazin, Dave Stuart, Rohit Kumar, Donald Dugger,
|
||||
Steven Carr, Uwe Völker, Charles Coffing, Guillaume Rousse,
|
||||
Alessandro Praduroux, Brad Hards, Timo Ketola, Christian Ehrlicher,
|
||||
Noriaki Yamazaki, Ben Klopfenstein, Vic Lee, Christian Beier,
|
||||
Alexander Dorokhine, Corentin Chary, Wouter Van Meir, George Kiagiadakis,
|
||||
Joel Martin, Gernot Tenchio, William Roberts, Cristian Rodríguez,
|
||||
George Fleury, Kan-Ru Chen, Steve Guo, Luca Stauble, Peter Watkins,
|
||||
Kyle J. McKay, Mateus Cesar Groess, Philip Van Hoof and D. R. Commander.
|
||||
|
||||
Probably I forgot quite a few people sending a patch here and there, which
|
||||
really made a difference. Without those, some obscure bugs still would
|
||||
be unfound.
|
361
jni/vnc/LibVNCServer-0.9.9/CMakeLists.txt
Normal file
361
jni/vnc/LibVNCServer-0.9.9/CMakeLists.txt
Normal file
@ -0,0 +1,361 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
project(LibVNCServer)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckTypeSize)
|
||||
include(TestBigEndian)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCSourceRuns)
|
||||
|
||||
set(PACKAGE_NAME "LibVNCServer")
|
||||
set(FULL_PACKAGE_NAME "LibVNCServer")
|
||||
set(PACKAGE_VERSION "0.9.9")
|
||||
set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver")
|
||||
set(CMAKE_C_FLAGS "-O2 -W -Wall -g")
|
||||
set(LIBVNCSERVER_DIR ${CMAKE_SOURCE_DIR}/libvncserver)
|
||||
set(COMMON_DIR ${CMAKE_SOURCE_DIR}/common)
|
||||
set(LIBVNCCLIENT_DIR ${CMAKE_SOURCE_DIR}/libvncclient)
|
||||
set(LIBVNCSRVTEST_DIR ${CMAKE_SOURCE_DIR}/examples)
|
||||
set(LIBVNCCLITEST_DIR ${CMAKE_SOURCE_DIR}/client_examples)
|
||||
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/libvncserver ${CMAKE_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_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)
|
||||
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()
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES resolv)
|
||||
check_function_exists(__b64_ntop HAVE_B64)
|
||||
|
||||
if(Threads_FOUND)
|
||||
option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON)
|
||||
endif(Threads_FOUND)
|
||||
if (HAVE_B64)
|
||||
endif(HAVE_B64)
|
||||
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)
|
||||
|
||||
if(GNUTLS_FOUND)
|
||||
set(LIBVNCSERVER_WITH_CLIENT_TLS 1)
|
||||
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (gnutls)" ON)
|
||||
set(WEBSOCKET_LIBRARIES -lresolv ${GNUTLS_LIBRARIES})
|
||||
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_gnutls ${LIBVNCSERVER_DIR}/rfbcrypto_gnutls)
|
||||
elseif(OPENSSL_FOUND)
|
||||
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (openssl)" ON)
|
||||
set(WEBSOCKET_LIBRARIES -lresolv ${OPENSSL_LIBRARIES})
|
||||
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_openssl ${LIBVNCSERVER_DIR}/rfbcrypto_openssl)
|
||||
else()
|
||||
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (no ssl)" ON)
|
||||
set(WEBSOCKET_LIBRARIES -lresolv)
|
||||
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_none.c ${LIBVNCSERVER_DIR}/rfbcrypto_included.c ${COMMON_DIR}/md5.c ${COMMON_DIR}/sha1.c)
|
||||
endif()
|
||||
|
||||
if(LIBGCRYPT_LIBRARIES)
|
||||
message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}")
|
||||
set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1)
|
||||
endif(LIBGCRYPT_LIBRARIES)
|
||||
|
||||
|
||||
check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H)
|
||||
check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H)
|
||||
check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H)
|
||||
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)
|
||||
|
||||
# headers needed for check_type_size()
|
||||
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
|
||||
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)
|
||||
|
||||
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
|
||||
|
||||
if(CMAKE_USE_PTHREADS_INIT)
|
||||
set(LIBVNCSERVER_HAVE_LIBPTHREAD 1)
|
||||
endif(CMAKE_USE_PTHREADS_INIT)
|
||||
if(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
# socklen_t
|
||||
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
endif(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
if(HAVE_ARPA_INET_H)
|
||||
# in_addr_t
|
||||
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "arpa/inet.h")
|
||||
endif(HAVE_ARPA_INET_H)
|
||||
|
||||
check_type_size(pid_t LIBVNCSERVER_PID_T)
|
||||
check_type_size(size_t LIBVNCSERVER_SIZE_T)
|
||||
check_type_size(socklen_t LIBVNCSERVER_SOCKLEN_T)
|
||||
check_type_size(in_addr_t LIBVNCSERVER_IN_ADDR_T)
|
||||
if(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
|
||||
set(LIBVNCSERVER_NEED_INADDR_T 1)
|
||||
endif(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
|
||||
|
||||
TEST_BIG_ENDIAN(LIBVNCSERVER_WORDS_BIGENDIAN)
|
||||
|
||||
# TODO:
|
||||
# LIBVNCSERVER_ENOENT_WORKAROUND
|
||||
# inline
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/rfb/rfbconfig.h.cmake ${CMAKE_BINARY_DIR}/rfb/rfbconfig.h)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/rfb/rfbint.h.cmake ${CMAKE_BINARY_DIR}/rfb/rfbint.h)
|
||||
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_DIR}/main.c
|
||||
${LIBVNCSERVER_DIR}/rfbserver.c
|
||||
${LIBVNCSERVER_DIR}/rfbregion.c
|
||||
${LIBVNCSERVER_DIR}/auth.c
|
||||
${LIBVNCSERVER_DIR}/sockets.c
|
||||
${LIBVNCSERVER_DIR}/stats.c
|
||||
${LIBVNCSERVER_DIR}/corre.c
|
||||
${LIBVNCSERVER_DIR}/hextile.c
|
||||
${LIBVNCSERVER_DIR}/rre.c
|
||||
${LIBVNCSERVER_DIR}/translate.c
|
||||
${LIBVNCSERVER_DIR}/cutpaste.c
|
||||
${LIBVNCSERVER_DIR}/httpd.c
|
||||
${LIBVNCSERVER_DIR}/cursor.c
|
||||
${LIBVNCSERVER_DIR}/font.c
|
||||
${LIBVNCSERVER_DIR}/draw.c
|
||||
${LIBVNCSERVER_DIR}/selbox.c
|
||||
${COMMON_DIR}/d3des.c
|
||||
${COMMON_DIR}/vncauth.c
|
||||
${LIBVNCSERVER_DIR}/cargs.c
|
||||
${COMMON_DIR}/minilzo.c
|
||||
${LIBVNCSERVER_DIR}/ultra.c
|
||||
${LIBVNCSERVER_DIR}/scale.c
|
||||
)
|
||||
|
||||
set(LIBVNCCLIENT_SOURCES
|
||||
${LIBVNCCLIENT_DIR}/cursor.c
|
||||
${LIBVNCCLIENT_DIR}/listen.c
|
||||
${LIBVNCCLIENT_DIR}/rfbproto.c
|
||||
${LIBVNCCLIENT_DIR}/sockets.c
|
||||
${LIBVNCCLIENT_DIR}/vncviewer.c
|
||||
${COMMON_DIR}/minilzo.c
|
||||
)
|
||||
|
||||
if(GNUTLS_FOUND)
|
||||
set(LIBVNCCLIENT_SOURCES
|
||||
${LIBVNCCLIENT_SOURCES}
|
||||
${LIBVNCCLIENT_DIR}/tls_gnutls.c
|
||||
)
|
||||
elseif(OPENSSL_FOUND)
|
||||
set(LIBVNCCLIENT_SOURCES
|
||||
${LIBVNCCLIENT_SOURCES}
|
||||
${LIBVNCCLIENT_DIR}/tls_openssl.c
|
||||
)
|
||||
else()
|
||||
set(LIBVNCCLIENT_SOURCES
|
||||
${LIBVNCCLIENT_SOURCES}
|
||||
${LIBVNCCLIENT_DIR}/tls_none.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
add_definitions(-DLIBVNCSERVER_HAVE_LIBZ)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
${LIBVNCSERVER_DIR}/zlib.c
|
||||
${LIBVNCSERVER_DIR}/zrle.c
|
||||
${LIBVNCSERVER_DIR}/zrleoutstream.c
|
||||
${LIBVNCSERVER_DIR}/zrlepalettehelper.c
|
||||
)
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
if(JPEG_FOUND)
|
||||
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
|
||||
include_directories(${JPEG_INCLUDE_DIR})
|
||||
set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c ${COMMON_DIR}/turbojpeg.c)
|
||||
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
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
${TIGHT_C}
|
||||
)
|
||||
|
||||
if(TIGHTVNC_FILETRANSFER)
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/rfbtightserver.c
|
||||
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/handlefiletransferrequest.c
|
||||
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filetransfermsg.c
|
||||
${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filelistinfo.c
|
||||
)
|
||||
endif(TIGHTVNC_FILETRANSFER)
|
||||
|
||||
if(LIBVNCSERVER_WITH_WEBSOCKETS)
|
||||
add_definitions(-DLIBVNCSERVER_WITH_WEBSOCKETS)
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
${LIBVNCSERVER_DIR}/websockets.c
|
||||
${WSSRCS}
|
||||
)
|
||||
endif(LIBVNCSERVER_WITH_WEBSOCKETS)
|
||||
|
||||
|
||||
add_library(vncclient SHARED ${LIBVNCCLIENT_SOURCES})
|
||||
add_library(vncserver SHARED ${LIBVNCSERVER_SOURCES})
|
||||
if(WIN32)
|
||||
set(ADDITIONAL_LIBS ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(vncclient
|
||||
${ADDITIONAL_LIBS}
|
||||
${ZLIB_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(vncserver
|
||||
${ADDITIONAL_LIBS}
|
||||
${ZLIB_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${WEBSOCKET_LIBRARIES}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(vncclient vncserver
|
||||
PROPERTIES SOVERSION "0.0.0"
|
||||
)
|
||||
|
||||
# tests
|
||||
set(LIBVNCSERVER_TESTS
|
||||
backchannel
|
||||
camera
|
||||
colourmaptest
|
||||
example
|
||||
fontsel
|
||||
pnmshow
|
||||
pnmshow24
|
||||
regiontest
|
||||
rotate
|
||||
simple
|
||||
simple15
|
||||
storepasswd
|
||||
vncev
|
||||
)
|
||||
|
||||
if(Threads_FOUND)
|
||||
set(LIBVNCSERVER_TESTS
|
||||
${LIBVNCSERVER_TESTS}
|
||||
blooptest
|
||||
)
|
||||
endif(Threads_FOUND)
|
||||
|
||||
if(TIGHTVNC_FILETRANSFER)
|
||||
set(LIBVNCSERVER_TESTS
|
||||
${LIBVNCSERVER_TESTS}
|
||||
filetransfer
|
||||
)
|
||||
endif(TIGHTVNC_FILETRANSFER)
|
||||
|
||||
if(MACOS)
|
||||
set(LIBVNCSERVER_TESTS
|
||||
${LIBVNCSERVER_TESTS}
|
||||
mac
|
||||
)
|
||||
endif(MACOS)
|
||||
|
||||
set(LIBVNCCLIENT_TESTS
|
||||
backchannel
|
||||
ppmtest
|
||||
)
|
||||
|
||||
if(SDL_FOUND)
|
||||
include_directories(${SDL_INCLUDE_DIR})
|
||||
set(LIBVNCCLIENT_TESTS
|
||||
${LIBVNCCLIENT_TESTS}
|
||||
SDLvncviewer
|
||||
)
|
||||
set(SDLvncviewer_EXTRA_SOURCES scrap.c)
|
||||
endif(SDL_FOUND)
|
||||
|
||||
if(HAVE_FFMPEG)
|
||||
set(LIBVNCCLIENT_TESTS
|
||||
${LIBVNCCLIENT_TESTS}
|
||||
vnc2mpg
|
||||
)
|
||||
endif(HAVE_FFMPEG)
|
||||
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
|
||||
foreach(test ${LIBVNCSERVER_TESTS})
|
||||
add_executable(examples/${test} ${LIBVNCSRVTEST_DIR}/${test}.c)
|
||||
target_link_libraries(examples/${test} vncserver ${CMAKE_THREAD_LIBS_INIT})
|
||||
endforeach(test ${LIBVNCSERVER_TESTS})
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/client_examples)
|
||||
foreach(test ${LIBVNCCLIENT_TESTS})
|
||||
add_executable(client_examples/${test} ${LIBVNCCLITEST_DIR}/${test}.c ${LIBVNCCLITEST_DIR}/${${test}_EXTRA_SOURCES} )
|
||||
target_link_libraries(client_examples/${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${GNUTLS_LIBRARIES} ${X11_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES})
|
||||
endforeach(test ${LIBVNCCLIENT_TESTS})
|
||||
|
||||
install_targets(/lib vncserver)
|
||||
install_targets(/lib vncclient)
|
||||
install_files(/include/rfb FILES
|
||||
rfb/keysym.h
|
||||
rfb/rfb.h
|
||||
rfb/rfbclient.h
|
||||
rfb/rfbconfig.h
|
||||
rfb/rfbint.h
|
||||
rfb/rfbproto.h
|
||||
rfb/rfbregion.h
|
||||
)
|
340
jni/vnc/LibVNCServer-0.9.9/COPYING
Normal file
340
jni/vnc/LibVNCServer-0.9.9/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
7760
jni/vnc/LibVNCServer-0.9.9/ChangeLog
Normal file
7760
jni/vnc/LibVNCServer-0.9.9/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
182
jni/vnc/LibVNCServer-0.9.9/INSTALL
Normal file
182
jni/vnc/LibVNCServer-0.9.9/INSTALL
Normal file
@ -0,0 +1,182 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
97
jni/vnc/LibVNCServer-0.9.9/LibVNCServer.spec.in
Executable file
97
jni/vnc/LibVNCServer-0.9.9/LibVNCServer.spec.in
Executable file
@ -0,0 +1,97 @@
|
||||
# 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
|
||||
|
31
jni/vnc/LibVNCServer-0.9.9/Makefile.am
Normal file
31
jni/vnc/LibVNCServer-0.9.9/Makefile.am
Normal file
@ -0,0 +1,31 @@
|
||||
if WITH_X11VNC
|
||||
X11VNC=x11vnc
|
||||
endif
|
||||
|
||||
SUBDIRS=libvncserver examples libvncclient vncterm webclients client_examples test $(X11VNC)
|
||||
DIST_SUBDIRS=libvncserver examples libvncclient vncterm webclients client_examples test
|
||||
EXTRA_DIST = CMakeLists.txt rfb/rfbint.h.cmake rfb/rfbconfig.h.cmake
|
||||
|
||||
bin_SCRIPTS = libvncserver-config
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libvncserver.pc libvncclient.pc
|
||||
|
||||
includedir=$(prefix)/include/rfb
|
||||
#include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
|
||||
|
||||
include_HEADERS=rfb/rfb.h rfb/rfbconfig.h rfb/rfbint.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
|
||||
|
888
jni/vnc/LibVNCServer-0.9.9/Makefile.in
Normal file
888
jni/vnc/LibVNCServer-0.9.9/Makefile.in
Normal file
@ -0,0 +1,888 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
|
||||
$(srcdir)/LibVNCServer.spec.in $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/libvncclient.pc.in \
|
||||
$(srcdir)/libvncserver-config.in $(srcdir)/libvncserver.pc.in \
|
||||
$(srcdir)/rfbconfig.h.in $(top_srcdir)/configure AUTHORS \
|
||||
COPYING ChangeLog INSTALL NEWS TODO compile config.guess \
|
||||
config.sub depcomp install-sh ltmain.sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = rfbconfig.h
|
||||
CONFIG_CLEAN_FILES = libvncserver.pc libvncclient.pc \
|
||||
libvncserver-config LibVNCServer.spec
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" \
|
||||
"$(DESTDIR)$(includedir)"
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
DATA = $(pkgconfig_DATA)
|
||||
HEADERS = $(include_HEADERS)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = $(prefix)/include/rfb
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
@WITH_X11VNC_TRUE@X11VNC = x11vnc
|
||||
SUBDIRS = libvncserver examples libvncclient vncterm webclients client_examples test $(X11VNC)
|
||||
DIST_SUBDIRS = libvncserver examples libvncclient vncterm webclients client_examples test
|
||||
EXTRA_DIST = CMakeLists.txt rfb/rfbint.h.cmake rfb/rfbconfig.h.cmake
|
||||
bin_SCRIPTS = libvncserver-config
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libvncserver.pc libvncclient.pc
|
||||
#include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
|
||||
include_HEADERS = rfb/rfb.h rfb/rfbconfig.h rfb/rfbint.h rfb/rfbproto.h \
|
||||
rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h
|
||||
|
||||
all: rfbconfig.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
rfbconfig.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/rfbconfig.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status rfbconfig.h
|
||||
$(srcdir)/rfbconfig.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f rfbconfig.h stamp-h1
|
||||
libvncserver.pc: $(top_builddir)/config.status $(srcdir)/libvncserver.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
libvncclient.pc: $(top_builddir)/config.status $(srcdir)/libvncclient.pc.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
libvncserver-config: $(top_builddir)/config.status $(srcdir)/libvncserver-config.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
LibVNCServer.spec: $(top_builddir)/config.status $(srcdir)/LibVNCServer.spec.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n' \
|
||||
-e 'h;s|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
|
||||
if (++n[d] == $(am__install_max)) { \
|
||||
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
|
||||
else { print "f", d "/" $$4, $$1 } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 's,.*/,,;$(transform)'`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
install-pkgconfigDATA: $(pkgconfig_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgconfigDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(includedir)" && rm -f $$files
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) rfbconfig.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) rfbconfig.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) rfbconfig.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) rfbconfig.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(SCRIPTS) $(DATA) $(HEADERS) rfbconfig.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS install-pkgconfigDATA
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binSCRIPTS
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binSCRIPTS uninstall-includeHEADERS \
|
||||
uninstall-pkgconfigDATA
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-binSCRIPTS install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am \
|
||||
install-includeHEADERS install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-pkgconfigDATA \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-binSCRIPTS \
|
||||
uninstall-includeHEADERS uninstall-pkgconfigDATA
|
||||
|
||||
|
||||
$(PACKAGE)-$(VERSION).tar.gz: dist
|
||||
|
||||
# Rule to build RPM distribution package
|
||||
@HAVE_RPM_TRUE@rpm: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).spec
|
||||
@HAVE_RPM_TRUE@ cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@
|
||||
@HAVE_RPM_TRUE@ rpmbuild -ba $(PACKAGE).spec
|
||||
|
||||
t:
|
||||
$(MAKE) -C test test
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
237
jni/vnc/LibVNCServer-0.9.9/NEWS
Normal file
237
jni/vnc/LibVNCServer-0.9.9/NEWS
Normal file
@ -0,0 +1,237 @@
|
||||
0.9.9
|
||||
- Overall changes:
|
||||
* Added noVNC HTML5 VNC viewer (http://kanaka.github.com/noVNC/) connect possibility
|
||||
to our http server. Pure JavaScript, no Java plugin required anymore! (But a
|
||||
recent browser...)
|
||||
* Added a GTK+ VNC viewer example.
|
||||
|
||||
- LibVNCServer/LibVNCClient:
|
||||
* Added support to build for Google Android.
|
||||
* Complete IPv6 support in both LibVNCServer and LibVNCClient.
|
||||
|
||||
- LibVNCServer:
|
||||
* Split two event-loop related functions out of the rfbProcessEvents() mechanism.
|
||||
This is required to be able to do proper event loop integration with Qt. Idea was
|
||||
taken from Vino's libvncserver fork.
|
||||
* Added TightPNG (http://wiki.qemu.org/VNC_Tight_PNG) encoding support. Like the
|
||||
original Tight encoding, this still uses JPEG, but ZLIB encoded rects are encoded
|
||||
with PNG here.
|
||||
* Added suport for serving VNC sessions through WebSockets
|
||||
(http://en.wikipedia.org/wiki/WebSocket), a web technology providing for multiplexing
|
||||
bi-directional, full-duplex communications channels over a single TCP connection.
|
||||
* Support connections from the Mac OS X built-in VNC client to LibVNCServer
|
||||
instances running with no password.
|
||||
* Replaced the Tight encoder with a TurboVNC one which is tremendously faster in most
|
||||
cases, especially with high-color video or 3D workloads.
|
||||
(http://www.virtualgl.org/pmwiki/uploads/About/tighttoturbo.pdf)
|
||||
|
||||
- LibVNCClient:
|
||||
* Added support to only listen for reverse connections on a specific IP address.
|
||||
* Support for using OpenSSL instead of GnuTLS. This could come in handy on embedded
|
||||
devices where only this TLS implementation is available.
|
||||
* Added support to connect to UltraVNC Single Click servers.
|
||||
|
||||
0.9.8.2
|
||||
- Fixed a regression that crept in with the Apple Remote Desktop support.
|
||||
|
||||
0.9.8.1
|
||||
- Fixed an ABI compatibility issue.
|
||||
|
||||
0.9.8
|
||||
- Overall changes:
|
||||
* Automagically generated API documentation using doxygen.
|
||||
* Added support for pkg-config.
|
||||
* Fixed Mingw32 cross compilation.
|
||||
* Fixed CMake build system.
|
||||
|
||||
- LibVNCServer/LibVNCClient:
|
||||
* All files used by _both_ LibVNCServer and LibVNCClient were put into
|
||||
a 'common' directory, reducing code duplication.
|
||||
* Implemented xvp VNC extension.
|
||||
* Updated minilzo library used for Ultra encoding to ver 2.04.
|
||||
According to the minilzo README, this brings a significant
|
||||
speedup on 64-bit architechtures.
|
||||
|
||||
- LibVNCServer:
|
||||
* Thread safety for ZRLE, Zlib, Tight, RRE, CoRRE and Ultra encodings.
|
||||
This makes all VNC encodings safe to use with a multithreaded server.
|
||||
* A DisplayFinishedHook for LibVNCServer. If set, this hook gets called
|
||||
just before rfbSendFrameBufferUpdate() returns.
|
||||
* Fix for tight security type for RFB 3.8 in TightVNC file transfer
|
||||
(Debian Bug #517422).
|
||||
|
||||
- LibVNCClient:
|
||||
* Unix sockets support.
|
||||
* Anonymous TLS security type support.
|
||||
* VeNCrypt security type support.
|
||||
* MSLogon security type support.
|
||||
* ARD (Apple Remote Desktop) security type support.
|
||||
* UltraVNC Repeater support.
|
||||
* A new FinishedFrameBufferUpdate callback that is invoked after each
|
||||
complete framebuffer update.
|
||||
* A new non-forking listen (reverse VNC) function that works under
|
||||
Windows.
|
||||
* IPv6 support. LibVNCClient is now able to connect to IPv6 VNC servers.
|
||||
* IP QoS support. This enables setting the DSCP/Traffic Class field of
|
||||
IP/IPv6 packets sent by a client. For example starting a client with
|
||||
-qosdscp 184 marks all outgoing traffic for expedited forwarding.
|
||||
Implementation for Win32 is still a TODO, though.
|
||||
* Fixed hostname resolution problems under Windows.
|
||||
|
||||
- SDLvncviewer
|
||||
* Is now resizable and can do key repeat, mouse wheel scrolling
|
||||
and clipboard copy and paste.
|
||||
|
||||
- LinuxVNC:
|
||||
* Fix for no input possible because of ctrl key being stuck.
|
||||
Issue was reported as Debian bug #555988.
|
||||
|
||||
|
||||
0.9.7
|
||||
Mark sent me patches to no longer need C++ for ZRLE encoding!
|
||||
added --disable-cxx Option for configure
|
||||
x11vnc changes from Karl Runge:
|
||||
- Changed all those whimpy printf(...)'s into manly fprintf(stdxxx,...)'s.
|
||||
|
||||
- Added -q switch (quiet) to suppress printing all the debug-looking output.
|
||||
|
||||
- Added -bg switch to fork into background after everything is set up.
|
||||
(checks for LIBVNCSERVER_HAVE_FORK and LIBVNCSERVER_HAVE_SETSID)
|
||||
|
||||
- Print this string out to stdout: 'PORT=XXXX' (usually XXXX = 5900).
|
||||
Combining with -bg, easy to write a ssh/rsh wrapper with something like:
|
||||
port=`ssh $host "x11vnc -bg .."` then run vncviewer based on $port output.
|
||||
(tunneling the vnc traffic thru ssh a bit more messy, but doable)
|
||||
|
||||
- Quite a bit of code to be more careful when doing 8bpp indexed color, e.g.
|
||||
not assuming NCOLORS is 256, handling 8bit TrueColor and Direct Color, etc
|
||||
(I did all this probably in April, not quite clear in my mind now, but
|
||||
I did test it out a fair amount on my old Sparcstation 20 wrt a user's
|
||||
questions).
|
||||
introduce rfbErr for Errors (Erik)
|
||||
make rfbLog overridable (suggested by Erik)
|
||||
don't reutrn on EINTR in WriteExact()/ReadExact() (suggested by Erik)
|
||||
use AX_PREFIX_CONFIG_H to prefix constants in config.h to avoid
|
||||
name clashes (also suggested by Erik)
|
||||
transformed Bool, KeySym, Pixel to rfbBool, rfbKeySym, rfbPixel
|
||||
(as suggested by Erik)
|
||||
purged exit() calls (suggested by Erik)
|
||||
fixed bug with maxRectsPerUpdate and Tight Encoding (these are incompatible)
|
||||
checked sync with TightVNC 1.2.8:
|
||||
viewonly/full passwords; if given a list, only the first is a full one
|
||||
vncRandomBytes is a little more secure now
|
||||
new weights for tight encoding
|
||||
checked sync with RealVNC 3.3.7
|
||||
introduced maxRectsPerUpdate
|
||||
added first alpha version of LibVNCClient
|
||||
added simple and simple15 example (really simple examples)
|
||||
finally got around to fix configure in CVS
|
||||
long standing http bug (.jar was sent twice) fixed by a friend of Karl named Mike
|
||||
http options in cargs
|
||||
when closing a client and no longer listening for new ones, don't crash
|
||||
fixed a bug with ClientConnectionGone
|
||||
endianness is checked at configure time
|
||||
fixed a bug that prevented the first client from being closed
|
||||
fixed that annoying "libvncserver-config --link" bug
|
||||
make rfbReverseByte public (for rdp2vnc)
|
||||
fixed compilation on OS X, IRIX, Solaris
|
||||
install target for headers is now ${prefix}/include/rfb ("#include <rfb/rfb.h>")
|
||||
renamed "sraRegion.h" to "rfbregion.h"
|
||||
CARD{8,16,32} are more standard uint{8,16,32}_t now
|
||||
fixed LinuxVNC colour handling
|
||||
fixed a bug with pthreads where the connection was not closed
|
||||
moved vncterm to main package (LinuxVNC included)
|
||||
portability fixes (IRIX, OSX, Solaris)
|
||||
more portable way to determine endianness and types of a given size
|
||||
through autoconf based methods
|
||||
0.5
|
||||
rpm packaging through autoconf
|
||||
autoconf'ed the whole package (including optional support for zlib,
|
||||
pthreads and libjpeg as well as zrle/c++)
|
||||
moved appropriate files to contrib/ and examples/ respectively
|
||||
fixed long standing cargs bug (Justin "Zippy" Dearing)
|
||||
Even better x11vnc from Karl J. Runge! (supports different kbd layouts of
|
||||
client/server)
|
||||
Better x11vnc from Karl J. Runge!
|
||||
fixed severe bug (Const Kaplinsky)
|
||||
got patch from Const Kaplisnky with CursorPosUpdate encoding and some Docs
|
||||
sync'ed with newest RealVNC (ZRLE encoding)
|
||||
a HTTP request for tunnelling was added (to fool strict web proxies)
|
||||
sync'ed with TightVNC 1.2.5
|
||||
0.4
|
||||
support for NewFB from Const Kaplinsky
|
||||
memory leaks squashed (localtime pseudo leak is still there :-)
|
||||
small improvements for OSXvnc (still not working correctly)
|
||||
synced with TightVNC 1.2.3
|
||||
solaris compile cleanups
|
||||
many x11vnc improvements
|
||||
added backchannel, an encoding which needs special clients to pass
|
||||
arbitrary data to the client
|
||||
changes from Tim Jansen regarding multi threading and client blocking
|
||||
as well as C++ compliancy
|
||||
x11vnc can be controlled by starting again with special options if compiling
|
||||
with LOCAL_CONTROL defined
|
||||
0.3
|
||||
added x11vnc, a x0rfbserver clone
|
||||
regard deferUpdateTime in processEvents, if usec<0
|
||||
initialize deferUpdateTime (memory "leak"!)
|
||||
changed command line handling (arguments are parsed and then removed)
|
||||
added very simple example: zippy
|
||||
added rfbDrawLine, rfbDrawPixel
|
||||
0.2
|
||||
inserted a deferUpdate mechanism (X11 independent).
|
||||
removed deletion of requestedRegion
|
||||
added rfbLoadConsoleFont
|
||||
fixed font colour handling.
|
||||
added rfbSelectBox
|
||||
added rfbDrawCharWithClip to allow for clipping and a background colour.
|
||||
fixed font colours
|
||||
added rfbFillRect
|
||||
added IO function to check password.
|
||||
rfbNewClient now sets the socket in the fd_set (for the select() call)
|
||||
when compiling the library with HAVE_PTHREADS and an application
|
||||
which includes "rfb.h" without, the structures got mixed up.
|
||||
So, the pthreads section is now always at the end, and also
|
||||
you get a linker error for rfbInitServer when using two different
|
||||
pthread setups.
|
||||
fixed two deadlocks: when setting a cursor and when using CopyRect
|
||||
fixed CopyRect when copying modified regions (they lost the modified
|
||||
property)
|
||||
WIN32 target compiles and works for example :-)
|
||||
fixed CopyRect (was using the wrong order of rectangles...)
|
||||
should also work with pthreads, because copyrects are
|
||||
always sent immediately (so that two consecutive copy rects
|
||||
cannot conflict).
|
||||
changed rfbUndrawCursor(rfbClientPtr) to (rfbScreenInfoPtr), because
|
||||
this makes more sense!
|
||||
flag backgroundLoop in rfbScreenInfo (if having pthreads)
|
||||
CopyRect & CopyRegion were implemented.
|
||||
if you use a rfbDoCopyR* function, it copies the data in the
|
||||
framebuffer. If you prefer to do that yourself, use rfbScheduleCopyR*
|
||||
instead; this doesn't modify the frameBuffer.
|
||||
added flag to optionally not send XCursor updates, but only RichCursor,
|
||||
or if that is not possible, fall back to server side cursor.
|
||||
This is useful if your cursor has many nice colours.
|
||||
fixed java viewer on server side:
|
||||
SendCursorUpdate would send data even before the client pixel format
|
||||
was set, but the java applet doesn't like the server's format.
|
||||
fixed two pthread issues:
|
||||
rfbSendFramebuffer was sent by a ProcessClientMessage function
|
||||
(unprotected by updateMutex).
|
||||
cursor coordinates were set without protection by cursorMutex
|
||||
source is now equivalent to TridiaVNC 1.2.1
|
||||
pthreads now work (use iterators!)
|
||||
cursors are supported (rfbSetCursor automatically undraws cursor)
|
||||
support for 3 bytes/pixel (slow!)
|
||||
server side colourmap support
|
||||
fixed rfbCloseClient not to close the connection (pthreads!)
|
||||
this is done lazily (and with proper signalling).
|
||||
cleaned up mac.c (from original OSXvnc); now compiles (untested!)
|
||||
compiles cleanly on Linux, IRIX, BSD, Apple (Darwin)
|
||||
fixed prototypes
|
||||
0.1
|
||||
rewrote API to use pseudo-methods instead of required functions.
|
||||
lots of clean up.
|
||||
Example can show symbols now.
|
||||
All encodings
|
||||
HTTP
|
439
jni/vnc/LibVNCServer-0.9.9/README
Normal file
439
jni/vnc/LibVNCServer-0.9.9/README
Normal file
@ -0,0 +1,439 @@
|
||||
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 everytime 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 everytime 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
|
||||
|
||||
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 everytime 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
|
||||
defaultPtrAddEvent(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
|
||||
defaultPtrAddEvent(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
|
||||
it's 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 it's 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 everytime annoying again, is that they don't do it right. Every
|
||||
concept has it's 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
|
||||
minimal.
|
||||
|
||||
storepasswd is the original program to save a vnc style password in a file.
|
||||
Unfortunately, authentication as every vncviewer speaks it means the server
|
||||
has to know the plain password. You really should tunnel via ssh or use
|
||||
your own PasswordCheck to build a PIN/TAN system.
|
||||
|
||||
sratest is a test unit. Run it to assert correct behaviour of sraRegion. I
|
||||
wrote this to test my iterator implementation.
|
||||
|
||||
blooptest is a test of pthreads. It is just the example, but with a background
|
||||
loop to hunt down thread lockups.
|
||||
|
||||
pnmshow24 is like pnmshow, but it uses 3 bytes/pixel internally, which is not
|
||||
as efficient as 4 bytes/pixel for translation, because there is no native data
|
||||
type of that size, so you have to memcpy pixels and be real cautious with
|
||||
endianness. Anyway, it works.
|
||||
|
||||
fontsel is a test for rfbSelectBox and rfbLoadConsoleFont. If you have Linux
|
||||
console fonts, you can browse them via VNC. Directory browsing not implemented
|
||||
yet :-(
|
||||
|
||||
Why I don't feel bad about GPL
|
||||
------------------------------
|
||||
|
||||
At the beginning of this projects I would have liked to make it a BSD
|
||||
license. However, it is based on plenty of GPL'ed code, so it has to be
|
||||
a GPL. I hear BeeGee complaining: "but that's invasive, every derivative
|
||||
work, even just linking, makes my software GPL!"
|
||||
|
||||
Yeah. That's right. It is because there are nasty jarheads out there who
|
||||
would take anybody's work and claim it their own, selling it for much too
|
||||
much money, stealing freedom and innovation from others, saying they were
|
||||
the maintainers of innovation, lying, making money with that.
|
||||
|
||||
The people at AT&T worked really well to produce something as clean and lean
|
||||
as VNC. The managers decided that for their fame, they would release the
|
||||
program for free. But not only that! They realized that by releasing also
|
||||
the code for free, VNC would become an evolving little child, conquering
|
||||
new worlds, making it's parents very proud. As well they can be! To protect
|
||||
this innovation, they decided to make it GPL, not BSD. The principal
|
||||
difference is: You can make closed source programs deriving from BSD, not
|
||||
from GPL. You have to give proper credit with both.
|
||||
|
||||
Now, why not BSD? Well, imagine your child being some famous actor. Along
|
||||
comes a manager who exploits your child exclusively, that is: nobody else
|
||||
can profit from the child, it itself included. Got it?
|
||||
|
||||
What reason do you have now to use this library commercially?
|
||||
|
||||
Several: You don't have to give away your product. Then you have effectively
|
||||
circumvented the GPL, because you have the benefits of other's work and you
|
||||
don't give back anything and you will be in hell for that. In fact, this
|
||||
library, as my other projects, is a payback for all the free software I can
|
||||
use (and sometimes, make better). For example, just now, I am using XEmacs
|
||||
on top of XFree86, all running under Linux.
|
||||
|
||||
Better: Use a concept like MySQL. This is free software, however, they make
|
||||
money with it. If you want something implemented, you have the choice:
|
||||
Ask them to do it (and pay a fair price), or do it yourself, normally giving
|
||||
back your enhancements to the free world of computing.
|
||||
|
||||
Learn from it: If you like the style this is written, learn how to imitate
|
||||
it. If you don't like the style, learn how to avoid those things you don't
|
||||
like. I learnt so much, just from looking at code like Linux, XEmacs,
|
||||
LilyPond, STL, etc.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.dfdf
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
To contact me, mail me: Johannes dot Schindelin at gmx dot de
|
||||
|
26
jni/vnc/LibVNCServer-0.9.9/TODO
Normal file
26
jni/vnc/LibVNCServer-0.9.9/TODO
Normal file
@ -0,0 +1,26 @@
|
||||
immediate:
|
||||
----------
|
||||
|
||||
make SDLvncviewer more versatile
|
||||
- test for missing keys (especially "[]{}" with ./examples/mac),
|
||||
- map Apple/Linux/Windows keys onto each other,
|
||||
- handle selection
|
||||
- handle scroll wheel
|
||||
style fixes: use Linux' coding guidelines & ANSIfy tightvnc-filetransfer:
|
||||
discuss on list
|
||||
LibVNCClient cleanup: prefix with "rfbClient", and make sure it does
|
||||
not deliberately die() or exit() anywhere!
|
||||
java vncviewer doesn't do colour cursors?
|
||||
make corre work again (libvncclient or libvncserver?)
|
||||
teach SDLvncviewer about CopyRect...
|
||||
implement "-record" in libvncclient
|
||||
implement QoS for Windows in libvncclient
|
||||
|
||||
later:
|
||||
------
|
||||
|
||||
selectbox: scroll bars
|
||||
authentification schemes (secure vnc)
|
||||
IO function ptr exists; now explain how to tunnel and implement a
|
||||
client address restriction scheme.
|
||||
VisualNaCro testing
|
7110
jni/vnc/LibVNCServer-0.9.9/acinclude.m4
Normal file
7110
jni/vnc/LibVNCServer-0.9.9/acinclude.m4
Normal file
File diff suppressed because it is too large
Load Diff
1184
jni/vnc/LibVNCServer-0.9.9/aclocal.m4
vendored
Normal file
1184
jni/vnc/LibVNCServer-0.9.9/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
42
jni/vnc/LibVNCServer-0.9.9/client_examples/Makefile.am
Normal file
42
jni/vnc/LibVNCServer-0.9.9/client_examples/Makefile.am
Normal file
@ -0,0 +1,42 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = ../libvncclient/libvncclient.la @WSOCKLIB@
|
||||
|
||||
if WITH_FFMPEG
|
||||
FFMPEG_HOME=@with_ffmpeg@
|
||||
|
||||
if HAVE_MP3LAME
|
||||
MP3LAME_LIB=-lmp3lame
|
||||
endif
|
||||
|
||||
vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec -I$(FFMPEG_HOME)/libavutil
|
||||
vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm
|
||||
|
||||
FFMPEG_CLIENT=vnc2mpg
|
||||
endif
|
||||
|
||||
if HAVE_LIBSDL
|
||||
SDLVIEWER=SDLvncviewer
|
||||
|
||||
SDLvncviewer_CFLAGS=$(SDL_CFLAGS)
|
||||
SDLvncviewer_SOURCES=SDLvncviewer.c scrap.c scrap.h
|
||||
|
||||
if HAVE_X11
|
||||
X11_LIB=-lX11
|
||||
endif
|
||||
|
||||
# thanks to autoconf, this looks ugly
|
||||
SDLvncviewer_LDADD=$(LDADD) $(SDL_LIBS) $(X11_LIB)
|
||||
endif
|
||||
|
||||
if HAVE_LIBGTK
|
||||
GTKVIEWER=gtkvncviewer
|
||||
gtkvncviewer_SOURCES=gtkvncviewer.c
|
||||
gtkvncviewer_CFLAGS=$(GTK_CFLAGS)
|
||||
gtkvncviewer_LDADD=$(LDADD) $(GTK_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
noinst_PROGRAMS=ppmtest $(SDLVIEWER) $(GTKVIEWER) $(FFMPEG_CLIENT) backchannel
|
||||
|
||||
|
||||
|
650
jni/vnc/LibVNCServer-0.9.9/client_examples/Makefile.in
Normal file
650
jni/vnc/LibVNCServer-0.9.9/client_examples/Makefile.in
Normal file
@ -0,0 +1,650 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = ppmtest$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
|
||||
$(am__EXEEXT_3) backchannel$(EXEEXT)
|
||||
subdir = client_examples
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/rfbconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
@HAVE_LIBSDL_TRUE@am__EXEEXT_1 = SDLvncviewer$(EXEEXT)
|
||||
@HAVE_LIBGTK_TRUE@am__EXEEXT_2 = gtkvncviewer$(EXEEXT)
|
||||
@WITH_FFMPEG_TRUE@am__EXEEXT_3 = vnc2mpg$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am__SDLvncviewer_SOURCES_DIST = SDLvncviewer.c scrap.c scrap.h
|
||||
@HAVE_LIBSDL_TRUE@am_SDLvncviewer_OBJECTS = \
|
||||
@HAVE_LIBSDL_TRUE@ SDLvncviewer-SDLvncviewer.$(OBJEXT) \
|
||||
@HAVE_LIBSDL_TRUE@ SDLvncviewer-scrap.$(OBJEXT)
|
||||
SDLvncviewer_OBJECTS = $(am_SDLvncviewer_OBJECTS)
|
||||
am__DEPENDENCIES_1 = ../libvncclient/libvncclient.la
|
||||
am__DEPENDENCIES_2 =
|
||||
@HAVE_LIBSDL_TRUE@SDLvncviewer_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@HAVE_LIBSDL_TRUE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
SDLvncviewer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(SDLvncviewer_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
backchannel_SOURCES = backchannel.c
|
||||
backchannel_OBJECTS = backchannel.$(OBJEXT)
|
||||
backchannel_LDADD = $(LDADD)
|
||||
backchannel_DEPENDENCIES = ../libvncclient/libvncclient.la
|
||||
am__gtkvncviewer_SOURCES_DIST = gtkvncviewer.c
|
||||
@HAVE_LIBGTK_TRUE@am_gtkvncviewer_OBJECTS = \
|
||||
@HAVE_LIBGTK_TRUE@ gtkvncviewer-gtkvncviewer.$(OBJEXT)
|
||||
gtkvncviewer_OBJECTS = $(am_gtkvncviewer_OBJECTS)
|
||||
@HAVE_LIBGTK_TRUE@gtkvncviewer_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@HAVE_LIBGTK_TRUE@ $(am__DEPENDENCIES_2)
|
||||
gtkvncviewer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(gtkvncviewer_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
ppmtest_SOURCES = ppmtest.c
|
||||
ppmtest_OBJECTS = ppmtest.$(OBJEXT)
|
||||
ppmtest_LDADD = $(LDADD)
|
||||
ppmtest_DEPENDENCIES = ../libvncclient/libvncclient.la
|
||||
vnc2mpg_SOURCES = vnc2mpg.c
|
||||
vnc2mpg_OBJECTS = vnc2mpg-vnc2mpg.$(OBJEXT)
|
||||
@WITH_FFMPEG_TRUE@vnc2mpg_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@WITH_FFMPEG_TRUE@ $(FFMPEG_HOME)/libavformat/libavformat.a \
|
||||
@WITH_FFMPEG_TRUE@ $(FFMPEG_HOME)/libavcodec/libavcodec.a \
|
||||
@WITH_FFMPEG_TRUE@ $(am__DEPENDENCIES_2)
|
||||
vnc2mpg_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(vnc2mpg_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(SDLvncviewer_SOURCES) backchannel.c \
|
||||
$(gtkvncviewer_SOURCES) ppmtest.c vnc2mpg.c
|
||||
DIST_SOURCES = $(am__SDLvncviewer_SOURCES_DIST) backchannel.c \
|
||||
$(am__gtkvncviewer_SOURCES_DIST) ppmtest.c vnc2mpg.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = ../libvncclient/libvncclient.la @WSOCKLIB@
|
||||
@WITH_FFMPEG_TRUE@FFMPEG_HOME = @with_ffmpeg@
|
||||
@HAVE_MP3LAME_TRUE@@WITH_FFMPEG_TRUE@MP3LAME_LIB = -lmp3lame
|
||||
@WITH_FFMPEG_TRUE@vnc2mpg_CFLAGS = -I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec -I$(FFMPEG_HOME)/libavutil
|
||||
@WITH_FFMPEG_TRUE@vnc2mpg_LDADD = $(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm
|
||||
@WITH_FFMPEG_TRUE@FFMPEG_CLIENT = vnc2mpg
|
||||
@HAVE_LIBSDL_TRUE@SDLVIEWER = SDLvncviewer
|
||||
@HAVE_LIBSDL_TRUE@SDLvncviewer_CFLAGS = $(SDL_CFLAGS)
|
||||
@HAVE_LIBSDL_TRUE@SDLvncviewer_SOURCES = SDLvncviewer.c scrap.c scrap.h
|
||||
@HAVE_LIBSDL_TRUE@@HAVE_X11_TRUE@X11_LIB = -lX11
|
||||
|
||||
# thanks to autoconf, this looks ugly
|
||||
@HAVE_LIBSDL_TRUE@SDLvncviewer_LDADD = $(LDADD) $(SDL_LIBS) $(X11_LIB)
|
||||
@HAVE_LIBGTK_TRUE@GTKVIEWER = gtkvncviewer
|
||||
@HAVE_LIBGTK_TRUE@gtkvncviewer_SOURCES = gtkvncviewer.c
|
||||
@HAVE_LIBGTK_TRUE@gtkvncviewer_CFLAGS = $(GTK_CFLAGS)
|
||||
@HAVE_LIBGTK_TRUE@gtkvncviewer_LDADD = $(LDADD) $(GTK_LIBS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu client_examples/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu client_examples/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
SDLvncviewer$(EXEEXT): $(SDLvncviewer_OBJECTS) $(SDLvncviewer_DEPENDENCIES)
|
||||
@rm -f SDLvncviewer$(EXEEXT)
|
||||
$(AM_V_CCLD)$(SDLvncviewer_LINK) $(SDLvncviewer_OBJECTS) $(SDLvncviewer_LDADD) $(LIBS)
|
||||
backchannel$(EXEEXT): $(backchannel_OBJECTS) $(backchannel_DEPENDENCIES)
|
||||
@rm -f backchannel$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(backchannel_OBJECTS) $(backchannel_LDADD) $(LIBS)
|
||||
gtkvncviewer$(EXEEXT): $(gtkvncviewer_OBJECTS) $(gtkvncviewer_DEPENDENCIES)
|
||||
@rm -f gtkvncviewer$(EXEEXT)
|
||||
$(AM_V_CCLD)$(gtkvncviewer_LINK) $(gtkvncviewer_OBJECTS) $(gtkvncviewer_LDADD) $(LIBS)
|
||||
ppmtest$(EXEEXT): $(ppmtest_OBJECTS) $(ppmtest_DEPENDENCIES)
|
||||
@rm -f ppmtest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(ppmtest_OBJECTS) $(ppmtest_LDADD) $(LIBS)
|
||||
vnc2mpg$(EXEEXT): $(vnc2mpg_OBJECTS) $(vnc2mpg_DEPENDENCIES)
|
||||
@rm -f vnc2mpg$(EXEEXT)
|
||||
$(AM_V_CCLD)$(vnc2mpg_LINK) $(vnc2mpg_OBJECTS) $(vnc2mpg_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDLvncviewer-SDLvncviewer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDLvncviewer-scrap.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backchannel.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkvncviewer-gtkvncviewer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppmtest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnc2mpg-vnc2mpg.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
SDLvncviewer-SDLvncviewer.o: SDLvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -MT SDLvncviewer-SDLvncviewer.o -MD -MP -MF $(DEPDIR)/SDLvncviewer-SDLvncviewer.Tpo -c -o SDLvncviewer-SDLvncviewer.o `test -f 'SDLvncviewer.c' || echo '$(srcdir)/'`SDLvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SDLvncviewer-SDLvncviewer.Tpo $(DEPDIR)/SDLvncviewer-SDLvncviewer.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='SDLvncviewer.c' object='SDLvncviewer-SDLvncviewer.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -c -o SDLvncviewer-SDLvncviewer.o `test -f 'SDLvncviewer.c' || echo '$(srcdir)/'`SDLvncviewer.c
|
||||
|
||||
SDLvncviewer-SDLvncviewer.obj: SDLvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -MT SDLvncviewer-SDLvncviewer.obj -MD -MP -MF $(DEPDIR)/SDLvncviewer-SDLvncviewer.Tpo -c -o SDLvncviewer-SDLvncviewer.obj `if test -f 'SDLvncviewer.c'; then $(CYGPATH_W) 'SDLvncviewer.c'; else $(CYGPATH_W) '$(srcdir)/SDLvncviewer.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SDLvncviewer-SDLvncviewer.Tpo $(DEPDIR)/SDLvncviewer-SDLvncviewer.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='SDLvncviewer.c' object='SDLvncviewer-SDLvncviewer.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -c -o SDLvncviewer-SDLvncviewer.obj `if test -f 'SDLvncviewer.c'; then $(CYGPATH_W) 'SDLvncviewer.c'; else $(CYGPATH_W) '$(srcdir)/SDLvncviewer.c'; fi`
|
||||
|
||||
SDLvncviewer-scrap.o: scrap.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -MT SDLvncviewer-scrap.o -MD -MP -MF $(DEPDIR)/SDLvncviewer-scrap.Tpo -c -o SDLvncviewer-scrap.o `test -f 'scrap.c' || echo '$(srcdir)/'`scrap.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SDLvncviewer-scrap.Tpo $(DEPDIR)/SDLvncviewer-scrap.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scrap.c' object='SDLvncviewer-scrap.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -c -o SDLvncviewer-scrap.o `test -f 'scrap.c' || echo '$(srcdir)/'`scrap.c
|
||||
|
||||
SDLvncviewer-scrap.obj: scrap.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -MT SDLvncviewer-scrap.obj -MD -MP -MF $(DEPDIR)/SDLvncviewer-scrap.Tpo -c -o SDLvncviewer-scrap.obj `if test -f 'scrap.c'; then $(CYGPATH_W) 'scrap.c'; else $(CYGPATH_W) '$(srcdir)/scrap.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SDLvncviewer-scrap.Tpo $(DEPDIR)/SDLvncviewer-scrap.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scrap.c' object='SDLvncviewer-scrap.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SDLvncviewer_CFLAGS) $(CFLAGS) -c -o SDLvncviewer-scrap.obj `if test -f 'scrap.c'; then $(CYGPATH_W) 'scrap.c'; else $(CYGPATH_W) '$(srcdir)/scrap.c'; fi`
|
||||
|
||||
gtkvncviewer-gtkvncviewer.o: gtkvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtkvncviewer_CFLAGS) $(CFLAGS) -MT gtkvncviewer-gtkvncviewer.o -MD -MP -MF $(DEPDIR)/gtkvncviewer-gtkvncviewer.Tpo -c -o gtkvncviewer-gtkvncviewer.o `test -f 'gtkvncviewer.c' || echo '$(srcdir)/'`gtkvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtkvncviewer-gtkvncviewer.Tpo $(DEPDIR)/gtkvncviewer-gtkvncviewer.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkvncviewer.c' object='gtkvncviewer-gtkvncviewer.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtkvncviewer_CFLAGS) $(CFLAGS) -c -o gtkvncviewer-gtkvncviewer.o `test -f 'gtkvncviewer.c' || echo '$(srcdir)/'`gtkvncviewer.c
|
||||
|
||||
gtkvncviewer-gtkvncviewer.obj: gtkvncviewer.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtkvncviewer_CFLAGS) $(CFLAGS) -MT gtkvncviewer-gtkvncviewer.obj -MD -MP -MF $(DEPDIR)/gtkvncviewer-gtkvncviewer.Tpo -c -o gtkvncviewer-gtkvncviewer.obj `if test -f 'gtkvncviewer.c'; then $(CYGPATH_W) 'gtkvncviewer.c'; else $(CYGPATH_W) '$(srcdir)/gtkvncviewer.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtkvncviewer-gtkvncviewer.Tpo $(DEPDIR)/gtkvncviewer-gtkvncviewer.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkvncviewer.c' object='gtkvncviewer-gtkvncviewer.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtkvncviewer_CFLAGS) $(CFLAGS) -c -o gtkvncviewer-gtkvncviewer.obj `if test -f 'gtkvncviewer.c'; then $(CYGPATH_W) 'gtkvncviewer.c'; else $(CYGPATH_W) '$(srcdir)/gtkvncviewer.c'; fi`
|
||||
|
||||
vnc2mpg-vnc2mpg.o: vnc2mpg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnc2mpg_CFLAGS) $(CFLAGS) -MT vnc2mpg-vnc2mpg.o -MD -MP -MF $(DEPDIR)/vnc2mpg-vnc2mpg.Tpo -c -o vnc2mpg-vnc2mpg.o `test -f 'vnc2mpg.c' || echo '$(srcdir)/'`vnc2mpg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnc2mpg-vnc2mpg.Tpo $(DEPDIR)/vnc2mpg-vnc2mpg.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vnc2mpg.c' object='vnc2mpg-vnc2mpg.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnc2mpg_CFLAGS) $(CFLAGS) -c -o vnc2mpg-vnc2mpg.o `test -f 'vnc2mpg.c' || echo '$(srcdir)/'`vnc2mpg.c
|
||||
|
||||
vnc2mpg-vnc2mpg.obj: vnc2mpg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnc2mpg_CFLAGS) $(CFLAGS) -MT vnc2mpg-vnc2mpg.obj -MD -MP -MF $(DEPDIR)/vnc2mpg-vnc2mpg.Tpo -c -o vnc2mpg-vnc2mpg.obj `if test -f 'vnc2mpg.c'; then $(CYGPATH_W) 'vnc2mpg.c'; else $(CYGPATH_W) '$(srcdir)/vnc2mpg.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vnc2mpg-vnc2mpg.Tpo $(DEPDIR)/vnc2mpg-vnc2mpg.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vnc2mpg.c' object='vnc2mpg-vnc2mpg.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vnc2mpg_CFLAGS) $(CFLAGS) -c -o vnc2mpg-vnc2mpg.obj `if test -f 'vnc2mpg.c'; then $(CYGPATH_W) 'vnc2mpg.c'; else $(CYGPATH_W) '$(srcdir)/vnc2mpg.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstPROGRAMS ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
566
jni/vnc/LibVNCServer-0.9.9/client_examples/SDLvncviewer.c
Normal file
566
jni/vnc/LibVNCServer-0.9.9/client_examples/SDLvncviewer.c
Normal file
@ -0,0 +1,566 @@
|
||||
/**
|
||||
* @example SDLvncviewer.c
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#include <signal.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
#include "scrap.h"
|
||||
|
||||
struct { int sdl; int rfb; } buttonMapping[]={
|
||||
{1, rfbButton1Mask},
|
||||
{2, rfbButton2Mask},
|
||||
{3, rfbButton3Mask},
|
||||
{4, rfbButton4Mask},
|
||||
{5, rfbButton5Mask},
|
||||
{0,0}
|
||||
};
|
||||
|
||||
static int enableResizable = 1, viewOnly, listenLoop, buttonMask;
|
||||
#ifdef SDL_ASYNCBLIT
|
||||
int sdlFlags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
|
||||
#else
|
||||
int sdlFlags = SDL_HWSURFACE | SDL_HWACCEL;
|
||||
#endif
|
||||
static int realWidth, realHeight, bytesPerPixel, rowStride;
|
||||
static char *sdlPixels;
|
||||
|
||||
static int rightAltKeyDown, leftAltKeyDown;
|
||||
|
||||
static rfbBool resize(rfbClient* client) {
|
||||
int width=client->width,height=client->height,
|
||||
depth=client->format.bitsPerPixel;
|
||||
|
||||
if (enableResizable)
|
||||
sdlFlags |= SDL_RESIZABLE;
|
||||
|
||||
client->updateRect.x = client->updateRect.y = 0;
|
||||
client->updateRect.w = width; client->updateRect.h = height;
|
||||
rfbBool okay=SDL_VideoModeOK(width,height,depth,sdlFlags);
|
||||
if(!okay)
|
||||
for(depth=24;!okay && depth>4;depth/=2)
|
||||
okay=SDL_VideoModeOK(width,height,depth,sdlFlags);
|
||||
if(okay) {
|
||||
SDL_Surface* sdl=SDL_SetVideoMode(width,height,depth,sdlFlags);
|
||||
rfbClientSetClientData(client, SDL_Init, sdl);
|
||||
client->width = sdl->pitch / (depth / 8);
|
||||
if (sdlPixels) {
|
||||
free(client->frameBuffer);
|
||||
sdlPixels = NULL;
|
||||
}
|
||||
client->frameBuffer=sdl->pixels;
|
||||
|
||||
client->format.bitsPerPixel=depth;
|
||||
client->format.redShift=sdl->format->Rshift;
|
||||
client->format.greenShift=sdl->format->Gshift;
|
||||
client->format.blueShift=sdl->format->Bshift;
|
||||
client->format.redMax=sdl->format->Rmask>>client->format.redShift;
|
||||
client->format.greenMax=sdl->format->Gmask>>client->format.greenShift;
|
||||
client->format.blueMax=sdl->format->Bmask>>client->format.blueShift;
|
||||
SetFormatAndEncodings(client);
|
||||
|
||||
} else {
|
||||
SDL_Surface* sdl=rfbClientGetClientData(client, SDL_Init);
|
||||
rfbClientLog("Could not set resolution %dx%d!\n",
|
||||
client->width,client->height);
|
||||
if(sdl) {
|
||||
client->width=sdl->pitch / (depth / 8);
|
||||
client->height=sdl->h;
|
||||
} else {
|
||||
client->width=0;
|
||||
client->height=0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
SDL_WM_SetCaption(client->desktopName, "SDL");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rfbKeySym SDL_key2rfbKeySym(SDL_KeyboardEvent* e) {
|
||||
rfbKeySym k = 0;
|
||||
SDLKey sym = e->keysym.sym;
|
||||
|
||||
switch (sym) {
|
||||
case SDLK_BACKSPACE: k = XK_BackSpace; break;
|
||||
case SDLK_TAB: k = XK_Tab; break;
|
||||
case SDLK_CLEAR: k = XK_Clear; break;
|
||||
case SDLK_RETURN: k = XK_Return; break;
|
||||
case SDLK_PAUSE: k = XK_Pause; break;
|
||||
case SDLK_ESCAPE: k = XK_Escape; break;
|
||||
case SDLK_SPACE: k = XK_space; break;
|
||||
case SDLK_DELETE: k = XK_Delete; break;
|
||||
case SDLK_KP0: k = XK_KP_0; break;
|
||||
case SDLK_KP1: k = XK_KP_1; break;
|
||||
case SDLK_KP2: k = XK_KP_2; break;
|
||||
case SDLK_KP3: k = XK_KP_3; break;
|
||||
case SDLK_KP4: k = XK_KP_4; break;
|
||||
case SDLK_KP5: k = XK_KP_5; break;
|
||||
case SDLK_KP6: k = XK_KP_6; break;
|
||||
case SDLK_KP7: k = XK_KP_7; break;
|
||||
case SDLK_KP8: k = XK_KP_8; break;
|
||||
case SDLK_KP9: k = XK_KP_9; break;
|
||||
case SDLK_KP_PERIOD: k = XK_KP_Decimal; break;
|
||||
case SDLK_KP_DIVIDE: k = XK_KP_Divide; break;
|
||||
case SDLK_KP_MULTIPLY: k = XK_KP_Multiply; break;
|
||||
case SDLK_KP_MINUS: k = XK_KP_Subtract; break;
|
||||
case SDLK_KP_PLUS: k = XK_KP_Add; break;
|
||||
case SDLK_KP_ENTER: k = XK_KP_Enter; break;
|
||||
case SDLK_KP_EQUALS: k = XK_KP_Equal; break;
|
||||
case SDLK_UP: k = XK_Up; break;
|
||||
case SDLK_DOWN: k = XK_Down; break;
|
||||
case SDLK_RIGHT: k = XK_Right; break;
|
||||
case SDLK_LEFT: k = XK_Left; break;
|
||||
case SDLK_INSERT: k = XK_Insert; break;
|
||||
case SDLK_HOME: k = XK_Home; break;
|
||||
case SDLK_END: k = XK_End; break;
|
||||
case SDLK_PAGEUP: k = XK_Page_Up; break;
|
||||
case SDLK_PAGEDOWN: k = XK_Page_Down; break;
|
||||
case SDLK_F1: k = XK_F1; break;
|
||||
case SDLK_F2: k = XK_F2; break;
|
||||
case SDLK_F3: k = XK_F3; break;
|
||||
case SDLK_F4: k = XK_F4; break;
|
||||
case SDLK_F5: k = XK_F5; break;
|
||||
case SDLK_F6: k = XK_F6; break;
|
||||
case SDLK_F7: k = XK_F7; break;
|
||||
case SDLK_F8: k = XK_F8; break;
|
||||
case SDLK_F9: k = XK_F9; break;
|
||||
case SDLK_F10: k = XK_F10; break;
|
||||
case SDLK_F11: k = XK_F11; break;
|
||||
case SDLK_F12: k = XK_F12; break;
|
||||
case SDLK_F13: k = XK_F13; break;
|
||||
case SDLK_F14: k = XK_F14; break;
|
||||
case SDLK_F15: k = XK_F15; break;
|
||||
case SDLK_NUMLOCK: k = XK_Num_Lock; break;
|
||||
case SDLK_CAPSLOCK: k = XK_Caps_Lock; break;
|
||||
case SDLK_SCROLLOCK: k = XK_Scroll_Lock; break;
|
||||
case SDLK_RSHIFT: k = XK_Shift_R; break;
|
||||
case SDLK_LSHIFT: k = XK_Shift_L; break;
|
||||
case SDLK_RCTRL: k = XK_Control_R; break;
|
||||
case SDLK_LCTRL: k = XK_Control_L; break;
|
||||
case SDLK_RALT: k = XK_Alt_R; break;
|
||||
case SDLK_LALT: k = XK_Alt_L; break;
|
||||
case SDLK_RMETA: k = XK_Meta_R; break;
|
||||
case SDLK_LMETA: k = XK_Meta_L; break;
|
||||
case SDLK_LSUPER: k = XK_Super_L; break;
|
||||
case SDLK_RSUPER: k = XK_Super_R; break;
|
||||
#if 0
|
||||
case SDLK_COMPOSE: k = XK_Compose; break;
|
||||
#endif
|
||||
case SDLK_MODE: k = XK_Mode_switch; break;
|
||||
case SDLK_HELP: k = XK_Help; break;
|
||||
case SDLK_PRINT: k = XK_Print; break;
|
||||
case SDLK_SYSREQ: k = XK_Sys_Req; break;
|
||||
case SDLK_BREAK: k = XK_Break; break;
|
||||
default: break;
|
||||
}
|
||||
/* both SDL and X11 keysyms match ASCII in the range 0x01-0x7f */
|
||||
if (k == 0 && sym > 0x0 && sym < 0x100) {
|
||||
k = sym;
|
||||
if (e->keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
if (k >= '1' && k <= '9')
|
||||
k &= ~0x10;
|
||||
else if (k >= 'a' && k <= 'f')
|
||||
k &= ~0x20;
|
||||
}
|
||||
}
|
||||
if (k == 0) {
|
||||
if (e->keysym.unicode < 0x100)
|
||||
k = e->keysym.unicode;
|
||||
else
|
||||
rfbClientLog("Unknown keysym: %d\n", sym);
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
static uint32_t get(rfbClient *cl, int x, int y)
|
||||
{
|
||||
switch (bytesPerPixel) {
|
||||
case 1: return ((uint8_t *)cl->frameBuffer)[x + y * cl->width];
|
||||
case 2: return ((uint16_t *)cl->frameBuffer)[x + y * cl->width];
|
||||
case 4: return ((uint32_t *)cl->frameBuffer)[x + y * cl->width];
|
||||
default:
|
||||
rfbClientErr("Unknown bytes/pixel: %d", bytesPerPixel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void put(int x, int y, uint32_t v)
|
||||
{
|
||||
switch (bytesPerPixel) {
|
||||
case 1: ((uint8_t *)sdlPixels)[x + y * rowStride] = v; break;
|
||||
case 2: ((uint16_t *)sdlPixels)[x + y * rowStride] = v; break;
|
||||
case 4: ((uint32_t *)sdlPixels)[x + y * rowStride] = v; break;
|
||||
default:
|
||||
rfbClientErr("Unknown bytes/pixel: %d", bytesPerPixel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void resizeRectangleToReal(rfbClient *cl, int x, int y, int w, int h)
|
||||
{
|
||||
int i0 = x * realWidth / cl->width;
|
||||
int i1 = ((x + w) * realWidth - 1) / cl->width + 1;
|
||||
int j0 = y * realHeight / cl->height;
|
||||
int j1 = ((y + h) * realHeight - 1) / cl->height + 1;
|
||||
int i, j;
|
||||
|
||||
for (j = j0; j < j1; j++)
|
||||
for (i = i0; i < i1; i++) {
|
||||
int x0 = i * cl->width / realWidth;
|
||||
int x1 = ((i + 1) * cl->width - 1) / realWidth + 1;
|
||||
int y0 = j * cl->height / realHeight;
|
||||
int y1 = ((j + 1) * cl->height - 1) / realHeight + 1;
|
||||
uint32_t r = 0, g = 0, b = 0;
|
||||
|
||||
for (y = y0; y < y1; y++)
|
||||
for (x = x0; x < x1; x++) {
|
||||
uint32_t v = get(cl, x, y);
|
||||
#define REDSHIFT cl->format.redShift
|
||||
#define REDMAX cl->format.redMax
|
||||
#define GREENSHIFT cl->format.greenShift
|
||||
#define GREENMAX cl->format.greenMax
|
||||
#define BLUESHIFT cl->format.blueShift
|
||||
#define BLUEMAX cl->format.blueMax
|
||||
r += (v >> REDSHIFT) & REDMAX;
|
||||
g += (v >> GREENSHIFT) & GREENMAX;
|
||||
b += (v >> BLUESHIFT) & BLUEMAX;
|
||||
}
|
||||
r /= (x1 - x0) * (y1 - y0);
|
||||
g /= (x1 - x0) * (y1 - y0);
|
||||
b /= (x1 - x0) * (y1 - y0);
|
||||
|
||||
put(i, j, (r << REDSHIFT) | (g << GREENSHIFT) |
|
||||
(b << BLUESHIFT));
|
||||
}
|
||||
}
|
||||
|
||||
static void update(rfbClient* cl,int x,int y,int w,int h) {
|
||||
if (sdlPixels) {
|
||||
resizeRectangleToReal(cl, x, y, w, h);
|
||||
w = ((x + w) * realWidth - 1) / cl->width + 1;
|
||||
h = ((y + h) * realHeight - 1) / cl->height + 1;
|
||||
x = x * realWidth / cl->width;
|
||||
y = y * realHeight / cl->height;
|
||||
w -= x;
|
||||
h -= y;
|
||||
}
|
||||
SDL_UpdateRect(rfbClientGetClientData(cl, SDL_Init), x, y, w, h);
|
||||
}
|
||||
|
||||
static void setRealDimension(rfbClient *client, int w, int h)
|
||||
{
|
||||
SDL_Surface* sdl;
|
||||
|
||||
if (w < 0) {
|
||||
const SDL_VideoInfo *info = SDL_GetVideoInfo();
|
||||
w = info->current_h;
|
||||
h = info->current_w;
|
||||
}
|
||||
|
||||
if (w == realWidth && h == realHeight)
|
||||
return;
|
||||
|
||||
if (!sdlPixels) {
|
||||
int size;
|
||||
|
||||
sdlPixels = (char *)client->frameBuffer;
|
||||
rowStride = client->width;
|
||||
|
||||
bytesPerPixel = client->format.bitsPerPixel / 8;
|
||||
size = client->width * bytesPerPixel * client->height;
|
||||
client->frameBuffer = malloc(size);
|
||||
if (!client->frameBuffer) {
|
||||
rfbClientErr("Could not allocate %d bytes", size);
|
||||
exit(1);
|
||||
}
|
||||
memcpy(client->frameBuffer, sdlPixels, size);
|
||||
}
|
||||
|
||||
sdl = rfbClientGetClientData(client, SDL_Init);
|
||||
if (sdl->w != w || sdl->h != h) {
|
||||
int depth = sdl->format->BitsPerPixel;
|
||||
sdl = SDL_SetVideoMode(w, h, depth, sdlFlags);
|
||||
rfbClientSetClientData(client, SDL_Init, sdl);
|
||||
sdlPixels = sdl->pixels;
|
||||
rowStride = sdl->pitch / (depth / 8);
|
||||
}
|
||||
|
||||
realWidth = w;
|
||||
realHeight = h;
|
||||
update(client, 0, 0, client->width, client->height);
|
||||
}
|
||||
|
||||
static void kbd_leds(rfbClient* cl, int value, int pad) {
|
||||
/* note: pad is for future expansion 0=unused */
|
||||
fprintf(stderr,"Led State= 0x%02X\n", value);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
/* trivial support for textchat */
|
||||
static void text_chat(rfbClient* cl, int value, char *text) {
|
||||
switch(value) {
|
||||
case rfbTextChatOpen:
|
||||
fprintf(stderr,"TextChat: We should open a textchat window!\n");
|
||||
TextChatOpen(cl);
|
||||
break;
|
||||
case rfbTextChatClose:
|
||||
fprintf(stderr,"TextChat: We should close our window!\n");
|
||||
break;
|
||||
case rfbTextChatFinished:
|
||||
fprintf(stderr,"TextChat: We should close our window!\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"TextChat: Received \"%s\"\n", text);
|
||||
break;
|
||||
}
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define LOG_TO_FILE
|
||||
#endif
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
#include <stdarg.h>
|
||||
static void
|
||||
log_to_file(const char *format, ...)
|
||||
{
|
||||
FILE* logfile;
|
||||
static char* logfile_str=0;
|
||||
va_list args;
|
||||
char buf[256];
|
||||
time_t log_clock;
|
||||
|
||||
if(!rfbEnableClientLogging)
|
||||
return;
|
||||
|
||||
if(logfile_str==0) {
|
||||
logfile_str=getenv("VNCLOG");
|
||||
if(logfile_str==0)
|
||||
logfile_str="vnc.log";
|
||||
}
|
||||
|
||||
logfile=fopen(logfile_str,"a");
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
time(&log_clock);
|
||||
strftime(buf, 255, "%d/%m/%Y %X ", localtime(&log_clock));
|
||||
fprintf(logfile,buf);
|
||||
|
||||
vfprintf(logfile, format, args);
|
||||
fflush(logfile);
|
||||
|
||||
va_end(args);
|
||||
fclose(logfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void cleanup(rfbClient* cl)
|
||||
{
|
||||
/*
|
||||
just in case we're running in listenLoop:
|
||||
close viewer window by restarting SDL video subsystem
|
||||
*/
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
if(cl)
|
||||
rfbClientCleanup(cl);
|
||||
}
|
||||
|
||||
|
||||
static rfbBool handleSDLEvent(rfbClient *cl, SDL_Event *e)
|
||||
{
|
||||
switch(e->type) {
|
||||
#if SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION >= 2
|
||||
case SDL_VIDEOEXPOSE:
|
||||
SendFramebufferUpdateRequest(cl, 0, 0,
|
||||
cl->width, cl->height, FALSE);
|
||||
break;
|
||||
#endif
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEMOTION:
|
||||
{
|
||||
int x, y, state, i;
|
||||
if (viewOnly)
|
||||
break;
|
||||
|
||||
if (e->type == SDL_MOUSEMOTION) {
|
||||
x = e->motion.x;
|
||||
y = e->motion.y;
|
||||
state = e->motion.state;
|
||||
}
|
||||
else {
|
||||
x = e->button.x;
|
||||
y = e->button.y;
|
||||
state = e->button.button;
|
||||
for (i = 0; buttonMapping[i].sdl; i++)
|
||||
if (state == buttonMapping[i].sdl) {
|
||||
state = buttonMapping[i].rfb;
|
||||
if (e->type == SDL_MOUSEBUTTONDOWN)
|
||||
buttonMask |= state;
|
||||
else
|
||||
buttonMask &= ~state;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sdlPixels) {
|
||||
x = x * cl->width / realWidth;
|
||||
y = y * cl->height / realHeight;
|
||||
}
|
||||
SendPointerEvent(cl, x, y, buttonMask);
|
||||
buttonMask &= ~(rfbButton4Mask | rfbButton5Mask);
|
||||
break;
|
||||
}
|
||||
case SDL_KEYUP:
|
||||
case SDL_KEYDOWN:
|
||||
if (viewOnly)
|
||||
break;
|
||||
SendKeyEvent(cl, SDL_key2rfbKeySym(&e->key),
|
||||
e->type == SDL_KEYDOWN ? TRUE : FALSE);
|
||||
if (e->key.keysym.sym == SDLK_RALT)
|
||||
rightAltKeyDown = e->type == SDL_KEYDOWN;
|
||||
if (e->key.keysym.sym == SDLK_LALT)
|
||||
leftAltKeyDown = e->type == SDL_KEYDOWN;
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
if(listenLoop)
|
||||
{
|
||||
cleanup(cl);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rfbClientCleanup(cl);
|
||||
exit(0);
|
||||
}
|
||||
case SDL_ACTIVEEVENT:
|
||||
if (!e->active.gain && rightAltKeyDown) {
|
||||
SendKeyEvent(cl, XK_Alt_R, FALSE);
|
||||
rightAltKeyDown = FALSE;
|
||||
rfbClientLog("released right Alt key\n");
|
||||
}
|
||||
if (!e->active.gain && leftAltKeyDown) {
|
||||
SendKeyEvent(cl, XK_Alt_L, FALSE);
|
||||
leftAltKeyDown = FALSE;
|
||||
rfbClientLog("released left Alt key\n");
|
||||
}
|
||||
|
||||
if (e->active.gain && lost_scrap()) {
|
||||
static char *data = NULL;
|
||||
static int len = 0;
|
||||
get_scrap(T('T', 'E', 'X', 'T'), &len, &data);
|
||||
if (len)
|
||||
SendClientCutText(cl, data, len);
|
||||
}
|
||||
break;
|
||||
case SDL_SYSWMEVENT:
|
||||
clipboard_filter(e);
|
||||
break;
|
||||
case SDL_VIDEORESIZE:
|
||||
setRealDimension(cl, e->resize.w, e->resize.h);
|
||||
break;
|
||||
default:
|
||||
rfbClientLog("ignore SDL event: 0x%x\n", e->type);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void got_selection(rfbClient *cl, const char *text, int len)
|
||||
{
|
||||
put_scrap(T('T', 'E', 'X', 'T'), len, text);
|
||||
}
|
||||
|
||||
|
||||
#ifdef mac
|
||||
#define main SDLmain
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
rfbClient* cl;
|
||||
int i, j;
|
||||
SDL_Event e;
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
rfbClientLog=rfbClientErr=log_to_file;
|
||||
#endif
|
||||
|
||||
for (i = 1, j = 1; i < argc; i++)
|
||||
if (!strcmp(argv[i], "-viewonly"))
|
||||
viewOnly = 1;
|
||||
else if (!strcmp(argv[i], "-resizable"))
|
||||
enableResizable = 1;
|
||||
else if (!strcmp(argv[i], "-no-resizable"))
|
||||
enableResizable = 0;
|
||||
else if (!strcmp(argv[i], "-listen")) {
|
||||
listenLoop = 1;
|
||||
argv[i] = "-listennofork";
|
||||
++j;
|
||||
}
|
||||
else {
|
||||
if (i != j)
|
||||
argv[j] = argv[i];
|
||||
j++;
|
||||
}
|
||||
argc = j;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
|
||||
SDL_EnableUNICODE(1);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
|
||||
SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
atexit(SDL_Quit);
|
||||
signal(SIGINT, exit);
|
||||
|
||||
do {
|
||||
/* 16-bit: cl=rfbGetClient(5,3,2); */
|
||||
cl=rfbGetClient(8,3,4);
|
||||
cl->MallocFrameBuffer=resize;
|
||||
cl->canHandleNewFBSize = TRUE;
|
||||
cl->GotFrameBufferUpdate=update;
|
||||
cl->HandleKeyboardLedState=kbd_leds;
|
||||
cl->HandleTextChat=text_chat;
|
||||
cl->GotXCutText = got_selection;
|
||||
cl->listenPort = LISTEN_PORT_OFFSET;
|
||||
cl->listen6Port = LISTEN_PORT_OFFSET;
|
||||
if(!rfbInitClient(cl,&argc,argv))
|
||||
{
|
||||
cl = NULL; /* rfbInitClient has already freed the client struct */
|
||||
cleanup(cl);
|
||||
break;
|
||||
}
|
||||
|
||||
init_scrap();
|
||||
|
||||
while(1) {
|
||||
if(SDL_PollEvent(&e)) {
|
||||
/*
|
||||
handleSDLEvent() return 0 if user requested window close.
|
||||
In this case, handleSDLEvent() will have called cleanup().
|
||||
*/
|
||||
if(!handleSDLEvent(cl, &e))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
i=WaitForMessage(cl,500);
|
||||
if(i<0)
|
||||
{
|
||||
cleanup(cl);
|
||||
break;
|
||||
}
|
||||
if(i)
|
||||
if(!HandleRFBServerMessage(cl))
|
||||
{
|
||||
cleanup(cl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(listenLoop);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
102
jni/vnc/LibVNCServer-0.9.9/client_examples/backchannel.c
Normal file
102
jni/vnc/LibVNCServer-0.9.9/client_examples/backchannel.c
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @example backchannel-client.c
|
||||
* A simple example of an RFB client
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
static void HandleRect(rfbClient* client, int x, int y, int w, int h) {
|
||||
}
|
||||
|
||||
/*
|
||||
* The client part of the back channel extension example.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rfbBackChannel 155
|
||||
|
||||
typedef struct backChannelMsg {
|
||||
uint8_t type;
|
||||
uint8_t pad1;
|
||||
uint16_t pad2;
|
||||
uint32_t size;
|
||||
} backChannelMsg;
|
||||
|
||||
static void sendMessage(rfbClient* client, char* text)
|
||||
{
|
||||
backChannelMsg msg;
|
||||
uint32_t length = strlen(text)+1;
|
||||
|
||||
msg.type = rfbBackChannel;
|
||||
msg.size = rfbClientSwap32IfLE(length);
|
||||
if(!WriteToRFBServer(client, (char*)&msg, sizeof(msg)) ||
|
||||
!WriteToRFBServer(client, text, length)) {
|
||||
rfbClientLog("enableBackChannel: write error (%d: %s)", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
static rfbBool handleBackChannelMessage(rfbClient* client,
|
||||
rfbServerToClientMsg* message)
|
||||
{
|
||||
backChannelMsg msg;
|
||||
char* text;
|
||||
|
||||
if(message->type != rfbBackChannel)
|
||||
return FALSE;
|
||||
|
||||
rfbClientSetClientData(client, sendMessage, sendMessage);
|
||||
|
||||
if(!ReadFromRFBServer(client, ((char*)&msg)+1, sizeof(msg)-1))
|
||||
return TRUE;
|
||||
msg.size = rfbClientSwap32IfLE(msg.size);
|
||||
text = malloc(msg.size);
|
||||
if(!ReadFromRFBServer(client, text, msg.size)) {
|
||||
free(text);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbClientLog("got back channel message: %s\n", text);
|
||||
free(text);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int backChannelEncodings[] = { rfbBackChannel, 0 };
|
||||
|
||||
static rfbClientProtocolExtension backChannel = {
|
||||
backChannelEncodings, /* encodings */
|
||||
NULL, /* handleEncoding */
|
||||
handleBackChannelMessage, /* handleMessage */
|
||||
NULL /* next extension */
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
rfbClient* client = rfbGetClient(8,3,4);
|
||||
|
||||
client->GotFrameBufferUpdate = HandleRect;
|
||||
rfbClientRegisterExtension(&backChannel);
|
||||
|
||||
if (!rfbInitClient(client,&argc,argv))
|
||||
return 1;
|
||||
|
||||
while (1) {
|
||||
/* After each idle second, send a message */
|
||||
if(WaitForMessage(client,1000000)>0)
|
||||
HandleRFBServerMessage(client);
|
||||
else if(rfbClientGetClientData(client, sendMessage))
|
||||
sendMessage(client, "Dear Server,\n"
|
||||
"thank you for understanding "
|
||||
"back channel messages!");
|
||||
}
|
||||
|
||||
rfbClientCleanup(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
668
jni/vnc/LibVNCServer-0.9.9/client_examples/gtkvncviewer.c
Normal file
668
jni/vnc/LibVNCServer-0.9.9/client_examples/gtkvncviewer.c
Normal file
@ -0,0 +1,668 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 - Mateus Cesar Groess
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
static rfbClient *cl;
|
||||
static gchar *server_cut_text = NULL;
|
||||
static gboolean framebuffer_allocated = FALSE;
|
||||
|
||||
/* Redraw the screen from the backing pixmap */
|
||||
static gboolean expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
static GdkImage *image = NULL;
|
||||
|
||||
if (framebuffer_allocated == FALSE) {
|
||||
|
||||
rfbClientSetClientData (cl, gtk_init, widget);
|
||||
|
||||
image = gdk_drawable_get_image (widget->window, 0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
cl->frameBuffer= image->mem;
|
||||
|
||||
cl->width = widget->allocation.width;
|
||||
cl->height = widget->allocation.height;
|
||||
|
||||
cl->format.bitsPerPixel = image->bits_per_pixel;
|
||||
cl->format.redShift = image->visual->red_shift;
|
||||
cl->format.greenShift = image->visual->green_shift;
|
||||
cl->format.blueShift = image->visual->blue_shift;
|
||||
|
||||
cl->format.redMax = (1 << image->visual->red_prec) - 1;
|
||||
cl->format.greenMax = (1 << image->visual->green_prec) - 1;
|
||||
cl->format.blueMax = (1 << image->visual->blue_prec) - 1;
|
||||
|
||||
SetFormatAndEncodings (cl);
|
||||
|
||||
framebuffer_allocated = TRUE;
|
||||
}
|
||||
|
||||
gdk_draw_image (GDK_DRAWABLE (widget->window),
|
||||
widget->style->fg_gc[gtk_widget_get_state(widget)],
|
||||
image,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct { int gdk; int rfb; } buttonMapping[] = {
|
||||
{ GDK_BUTTON1_MASK, rfbButton1Mask },
|
||||
{ GDK_BUTTON2_MASK, rfbButton2Mask },
|
||||
{ GDK_BUTTON3_MASK, rfbButton3Mask },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static gboolean button_event (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
int i, buttonMask;
|
||||
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
|
||||
for (buttonMask = 0, i = 0; buttonMapping[i].gdk; i++)
|
||||
if (state & buttonMapping[i].gdk)
|
||||
buttonMask |= buttonMapping[i].rfb;
|
||||
SendPointerEvent (cl, x, y, buttonMask);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean motion_notify_event (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
int i, buttonMask;
|
||||
|
||||
if (event->is_hint)
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
else {
|
||||
x = event->x;
|
||||
y = event->y;
|
||||
state = event->state;
|
||||
}
|
||||
|
||||
for (buttonMask = 0, i = 0; buttonMapping[i].gdk; i++)
|
||||
if (state & buttonMapping[i].gdk)
|
||||
buttonMask |= buttonMapping[i].rfb;
|
||||
SendPointerEvent (cl, x, y, buttonMask);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void got_cut_text (rfbClient *cl, const char *text, int textlen)
|
||||
{
|
||||
if (server_cut_text != NULL) {
|
||||
g_free (server_cut_text);
|
||||
server_cut_text = NULL;
|
||||
}
|
||||
|
||||
server_cut_text = g_strdup (text);
|
||||
}
|
||||
|
||||
void received_text_from_clipboard (GtkClipboard *clipboard,
|
||||
const gchar *text,
|
||||
gpointer data)
|
||||
{
|
||||
if (text)
|
||||
SendClientCutText (cl, (char *) text, strlen (text));
|
||||
}
|
||||
|
||||
static void clipboard_local_to_remote (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (menuitem),
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
gtk_clipboard_request_text (clipboard, received_text_from_clipboard,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void clipboard_remote_to_local (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (menuitem),
|
||||
GDK_SELECTION_CLIPBOARD);
|
||||
|
||||
gtk_clipboard_set_text (clipboard, server_cut_text,
|
||||
strlen (server_cut_text));
|
||||
}
|
||||
|
||||
static void request_screen_refresh (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
SendFramebufferUpdateRequest (cl, 0, 0, cl->width, cl->height, FALSE);
|
||||
}
|
||||
|
||||
static void send_f8 (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
SendKeyEvent(cl, XK_F8, TRUE);
|
||||
SendKeyEvent(cl, XK_F8, FALSE);
|
||||
}
|
||||
|
||||
static void send_crtl_alt_del (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
SendKeyEvent(cl, XK_Control_L, TRUE);
|
||||
SendKeyEvent(cl, XK_Alt_L, TRUE);
|
||||
SendKeyEvent(cl, XK_Delete, TRUE);
|
||||
SendKeyEvent(cl, XK_Alt_L, FALSE);
|
||||
SendKeyEvent(cl, XK_Control_L, FALSE);
|
||||
SendKeyEvent(cl, XK_Delete, FALSE);
|
||||
}
|
||||
|
||||
GtkWidget *dialog_connecting = NULL;
|
||||
|
||||
static void show_connect_window(int argc, char **argv)
|
||||
{
|
||||
GtkWidget *label;
|
||||
char buf[256];
|
||||
|
||||
dialog_connecting = gtk_dialog_new_with_buttons ("VNC Viewer",
|
||||
NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
/*GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL,*/
|
||||
NULL);
|
||||
|
||||
/* FIXME: this works only when address[:port] is at end of arg list */
|
||||
char *server;
|
||||
if(argc==1)
|
||||
server = "localhost";
|
||||
else
|
||||
server = argv[argc-1];
|
||||
snprintf(buf, 255, "Connecting to %s...", server);
|
||||
|
||||
label = gtk_label_new (buf);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog_connecting)->vbox),
|
||||
label);
|
||||
|
||||
gtk_widget_show (dialog_connecting);
|
||||
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
|
||||
static void show_popup_menu()
|
||||
{
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *menu_item;
|
||||
|
||||
popup_menu = gtk_menu_new ();
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Dismiss popup");
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Clipboard: local -> remote");
|
||||
g_signal_connect (G_OBJECT (menu_item), "activate",
|
||||
G_CALLBACK (clipboard_local_to_remote), NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Clipboard: local <- remote");
|
||||
g_signal_connect (G_OBJECT (menu_item), "activate",
|
||||
G_CALLBACK (clipboard_remote_to_local), NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Request refresh");
|
||||
g_signal_connect (G_OBJECT (menu_item), "activate",
|
||||
G_CALLBACK (request_screen_refresh), NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Send ctrl-alt-del");
|
||||
g_signal_connect (G_OBJECT (menu_item), "activate",
|
||||
G_CALLBACK (send_crtl_alt_del), NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label ("Send F8");
|
||||
g_signal_connect (G_OBJECT (menu_item), "activate",
|
||||
G_CALLBACK (send_f8), NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menu_item);
|
||||
|
||||
gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL, NULL, NULL, 0,
|
||||
gtk_get_current_event_time());
|
||||
}
|
||||
|
||||
static rfbKeySym gdkKey2rfbKeySym(guint keyval)
|
||||
{
|
||||
rfbKeySym k = 0;
|
||||
switch(keyval) {
|
||||
case GDK_BackSpace: k = XK_BackSpace; break;
|
||||
case GDK_Tab: k = XK_Tab; break;
|
||||
case GDK_Clear: k = XK_Clear; break;
|
||||
case GDK_Return: k = XK_Return; break;
|
||||
case GDK_Pause: k = XK_Pause; break;
|
||||
case GDK_Escape: k = XK_Escape; break;
|
||||
case GDK_space: k = XK_space; break;
|
||||
case GDK_Delete: k = XK_Delete; break;
|
||||
case GDK_KP_0: k = XK_KP_0; break;
|
||||
case GDK_KP_1: k = XK_KP_1; break;
|
||||
case GDK_KP_2: k = XK_KP_2; break;
|
||||
case GDK_KP_3: k = XK_KP_3; break;
|
||||
case GDK_KP_4: k = XK_KP_4; break;
|
||||
case GDK_KP_5: k = XK_KP_5; break;
|
||||
case GDK_KP_6: k = XK_KP_6; break;
|
||||
case GDK_KP_7: k = XK_KP_7; break;
|
||||
case GDK_KP_8: k = XK_KP_8; break;
|
||||
case GDK_KP_9: k = XK_KP_9; break;
|
||||
case GDK_KP_Decimal: k = XK_KP_Decimal; break;
|
||||
case GDK_KP_Divide: k = XK_KP_Divide; break;
|
||||
case GDK_KP_Multiply: k = XK_KP_Multiply; break;
|
||||
case GDK_KP_Subtract: k = XK_KP_Subtract; break;
|
||||
case GDK_KP_Add: k = XK_KP_Add; break;
|
||||
case GDK_KP_Enter: k = XK_KP_Enter; break;
|
||||
case GDK_KP_Equal: k = XK_KP_Equal; break;
|
||||
case GDK_Up: k = XK_Up; break;
|
||||
case GDK_Down: k = XK_Down; break;
|
||||
case GDK_Right: k = XK_Right; break;
|
||||
case GDK_Left: k = XK_Left; break;
|
||||
case GDK_Insert: k = XK_Insert; break;
|
||||
case GDK_Home: k = XK_Home; break;
|
||||
case GDK_End: k = XK_End; break;
|
||||
case GDK_Page_Up: k = XK_Page_Up; break;
|
||||
case GDK_Page_Down: k = XK_Page_Down; break;
|
||||
case GDK_F1: k = XK_F1; break;
|
||||
case GDK_F2: k = XK_F2; break;
|
||||
case GDK_F3: k = XK_F3; break;
|
||||
case GDK_F4: k = XK_F4; break;
|
||||
case GDK_F5: k = XK_F5; break;
|
||||
case GDK_F6: k = XK_F6; break;
|
||||
case GDK_F7: k = XK_F7; break;
|
||||
case GDK_F8: k = XK_F8; break;
|
||||
case GDK_F9: k = XK_F9; break;
|
||||
case GDK_F10: k = XK_F10; break;
|
||||
case GDK_F11: k = XK_F11; break;
|
||||
case GDK_F12: k = XK_F12; break;
|
||||
case GDK_F13: k = XK_F13; break;
|
||||
case GDK_F14: k = XK_F14; break;
|
||||
case GDK_F15: k = XK_F15; break;
|
||||
case GDK_Num_Lock: k = XK_Num_Lock; break;
|
||||
case GDK_Caps_Lock: k = XK_Caps_Lock; break;
|
||||
case GDK_Scroll_Lock: k = XK_Scroll_Lock; break;
|
||||
case GDK_Shift_R: k = XK_Shift_R; break;
|
||||
case GDK_Shift_L: k = XK_Shift_L; break;
|
||||
case GDK_Control_R: k = XK_Control_R; break;
|
||||
case GDK_Control_L: k = XK_Control_L; break;
|
||||
case GDK_Alt_R: k = XK_Alt_R; break;
|
||||
case GDK_Alt_L: k = XK_Alt_L; break;
|
||||
case GDK_Meta_R: k = XK_Meta_R; break;
|
||||
case GDK_Meta_L: k = XK_Meta_L; break;
|
||||
#if 0
|
||||
/* TODO: find out keysyms */
|
||||
case GDK_Super_L: k = XK_LSuper; break; /* left "windows" key */
|
||||
case GDK_Super_R: k = XK_RSuper; break; /* right "windows" key */
|
||||
case GDK_Multi_key: k = XK_Compose; break;
|
||||
#endif
|
||||
case GDK_Mode_switch: k = XK_Mode_switch; break;
|
||||
case GDK_Help: k = XK_Help; break;
|
||||
case GDK_Print: k = XK_Print; break;
|
||||
case GDK_Sys_Req: k = XK_Sys_Req; break;
|
||||
case GDK_Break: k = XK_Break; break;
|
||||
default: break;
|
||||
}
|
||||
if (k == 0) {
|
||||
if (keyval < 0x100)
|
||||
k = keyval;
|
||||
else
|
||||
rfbClientLog ("Unknown keysym: %d\n", keyval);
|
||||
}
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
static gboolean key_event (GtkWidget *widget, GdkEventKey *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
if ((event->type == GDK_KEY_PRESS) && (event->keyval == GDK_F8))
|
||||
show_popup_menu();
|
||||
else
|
||||
SendKeyEvent(cl, gdkKey2rfbKeySym (event->keyval),
|
||||
(event->type == GDK_KEY_PRESS) ? TRUE : FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void quit ()
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static rfbBool resize (rfbClient *client) {
|
||||
GtkWidget *window;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *drawing_area=NULL;
|
||||
static char first=TRUE;
|
||||
int tmp_width, tmp_height;
|
||||
|
||||
if (first) {
|
||||
first=FALSE;
|
||||
|
||||
/* Create the drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
|
||||
client->width, client->height);
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
g_signal_connect (G_OBJECT (drawing_area), "expose_event",
|
||||
G_CALLBACK (expose_event), NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
g_signal_connect (G_OBJECT (drawing_area),
|
||||
"motion-notify-event",
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area),
|
||||
"button-press-event",
|
||||
G_CALLBACK (button_event), NULL);
|
||||
g_signal_connect (G_OBJECT (drawing_area),
|
||||
"button-release-event",
|
||||
G_CALLBACK (button_event), NULL);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_add_with_viewport (
|
||||
GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
drawing_area);
|
||||
g_signal_connect (G_OBJECT (scrolled_window),
|
||||
"key-press-event", G_CALLBACK (key_event),
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (scrolled_window),
|
||||
"key-release-event", G_CALLBACK (key_event),
|
||||
NULL);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), client->desktopName);
|
||||
gtk_container_add (GTK_CONTAINER (window), scrolled_window);
|
||||
tmp_width = (int) (
|
||||
gdk_screen_get_width (gdk_screen_get_default ())
|
||||
* 0.85);
|
||||
if (client->width > tmp_width) {
|
||||
tmp_height = (int) (
|
||||
gdk_screen_get_height (
|
||||
gdk_screen_get_default ())
|
||||
* 0.85);
|
||||
gtk_widget_set_size_request (window,
|
||||
tmp_width, tmp_height);
|
||||
} else {
|
||||
gtk_widget_set_size_request (window,
|
||||
client->width + 2,
|
||||
client->height + 2);
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (window), "destroy",
|
||||
G_CALLBACK (quit), NULL);
|
||||
|
||||
gtk_widget_show (window);
|
||||
} else {
|
||||
gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
|
||||
client->width, client->height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void update (rfbClient *cl, int x, int y, int w, int h) {
|
||||
GtkWidget *drawing_area = rfbClientGetClientData (cl, gtk_init);
|
||||
|
||||
if (drawing_area != NULL)
|
||||
gtk_widget_queue_draw_area (drawing_area, x, y, w, h);
|
||||
}
|
||||
|
||||
static void kbd_leds (rfbClient *cl, int value, int pad) {
|
||||
/* note: pad is for future expansion 0=unused */
|
||||
fprintf (stderr, "Led State= 0x%02X\n", value);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
/* trivial support for textchat */
|
||||
static void text_chat (rfbClient *cl, int value, char *text) {
|
||||
switch (value) {
|
||||
case rfbTextChatOpen:
|
||||
fprintf (stderr, "TextChat: We should open a textchat window!\n");
|
||||
TextChatOpen (cl);
|
||||
break;
|
||||
case rfbTextChatClose:
|
||||
fprintf (stderr, "TextChat: We should close our window!\n");
|
||||
break;
|
||||
case rfbTextChatFinished:
|
||||
fprintf (stderr, "TextChat: We should close our window!\n");
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "TextChat: Received \"%s\"\n", text);
|
||||
break;
|
||||
}
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
static gboolean on_entry_key_press_event (GtkWidget *widget, GdkEventKey *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (event->keyval == GDK_Escape)
|
||||
gtk_dialog_response (GTK_DIALOG(user_data), GTK_RESPONSE_REJECT);
|
||||
else if (event->keyval == GDK_Return)
|
||||
gtk_dialog_response (GTK_DIALOG(user_data), GTK_RESPONSE_ACCEPT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void GtkErrorLog (const char *format, ...)
|
||||
{
|
||||
GtkWidget *dialog, *label;
|
||||
va_list args;
|
||||
char buf[256];
|
||||
|
||||
if (dialog_connecting != NULL) {
|
||||
gtk_widget_destroy (dialog_connecting);
|
||||
dialog_connecting = NULL;
|
||||
}
|
||||
|
||||
va_start (args, format);
|
||||
vsnprintf (buf, 255, format, args);
|
||||
va_end (args);
|
||||
|
||||
if (g_utf8_validate (buf, strlen (buf), NULL)) {
|
||||
label = gtk_label_new (buf);
|
||||
} else {
|
||||
const gchar *charset;
|
||||
gchar *utf8;
|
||||
|
||||
(void) g_get_charset (&charset);
|
||||
utf8 = g_convert_with_fallback (buf, strlen (buf), "UTF-8",
|
||||
charset, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (utf8) {
|
||||
label = gtk_label_new (utf8);
|
||||
g_free (utf8);
|
||||
} else {
|
||||
label = gtk_label_new (buf);
|
||||
g_warning ("Message Output is not in UTF-8"
|
||||
"nor in locale charset.\n");
|
||||
}
|
||||
}
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Error",
|
||||
NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
label = gtk_label_new (buf);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
|
||||
label);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void GtkDefaultLog (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[256];
|
||||
time_t log_clock;
|
||||
|
||||
va_start (args, format);
|
||||
|
||||
time (&log_clock);
|
||||
strftime (buf, 255, "%d/%m/%Y %X ", localtime (&log_clock));
|
||||
fprintf (stdout, buf);
|
||||
|
||||
vfprintf (stdout, format, args);
|
||||
fflush (stdout);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
static char * get_password (rfbClient *client)
|
||||
{
|
||||
GtkWidget *dialog, *entry;
|
||||
char *password;
|
||||
|
||||
gtk_widget_destroy (dialog_connecting);
|
||||
dialog_connecting = NULL;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Password",
|
||||
NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_visibility (GTK_ENTRY (entry),
|
||||
FALSE);
|
||||
g_signal_connect (GTK_OBJECT(entry), "key-press-event",
|
||||
G_CALLBACK(on_entry_key_press_event),
|
||||
GTK_OBJECT (dialog));
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
|
||||
entry);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
password = strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
break;
|
||||
default:
|
||||
password = NULL;
|
||||
break;
|
||||
}
|
||||
gtk_widget_destroy (dialog);
|
||||
return password;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
GdkImage *image;
|
||||
|
||||
rfbClientLog = GtkDefaultLog;
|
||||
rfbClientErr = GtkErrorLog;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a dummy image just to make use of its properties */
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, gdk_visual_get_system(),
|
||||
200, 100);
|
||||
|
||||
cl = rfbGetClient (image->depth / 3, 3, image->bpp);
|
||||
|
||||
cl->format.redShift = image->visual->red_shift;
|
||||
cl->format.greenShift = image->visual->green_shift;
|
||||
cl->format.blueShift = image->visual->blue_shift;
|
||||
|
||||
cl->format.redMax = (1 << image->visual->red_prec) - 1;
|
||||
cl->format.greenMax = (1 << image->visual->green_prec) - 1;
|
||||
cl->format.blueMax = (1 << image->visual->blue_prec) - 1;
|
||||
|
||||
g_object_unref (image);
|
||||
|
||||
cl->MallocFrameBuffer = resize;
|
||||
cl->canHandleNewFBSize = TRUE;
|
||||
cl->GotFrameBufferUpdate = update;
|
||||
cl->GotXCutText = got_cut_text;
|
||||
cl->HandleKeyboardLedState = kbd_leds;
|
||||
cl->HandleTextChat = text_chat;
|
||||
cl->GetPassword = get_password;
|
||||
|
||||
show_connect_window (argc, argv);
|
||||
|
||||
if (!rfbInitClient (cl, &argc, argv))
|
||||
return 1;
|
||||
|
||||
while (1) {
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
i = WaitForMessage (cl, 500);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
if (i && framebuffer_allocated == TRUE)
|
||||
if (!HandleRFBServerMessage(cl))
|
||||
return 0;
|
||||
}
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
100
jni/vnc/LibVNCServer-0.9.9/client_examples/ppmtest.c
Normal file
100
jni/vnc/LibVNCServer-0.9.9/client_examples/ppmtest.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @example ppmtest.c
|
||||
* A simple example of an RFB client
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
static void PrintRect(rfbClient* client, int x, int y, int w, int h) {
|
||||
rfbClientLog("Received an update for %d,%d,%d,%d.\n",x,y,w,h);
|
||||
}
|
||||
|
||||
static void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
|
||||
static time_t t=0,t1;
|
||||
FILE* f;
|
||||
int i,j;
|
||||
rfbPixelFormat* pf=&client->format;
|
||||
int bpp=pf->bitsPerPixel/8;
|
||||
int row_stride=client->width*bpp;
|
||||
|
||||
/* save one picture only if the last is older than 2 seconds */
|
||||
t1=time(NULL);
|
||||
if(t1-t>2)
|
||||
t=t1;
|
||||
else
|
||||
return;
|
||||
|
||||
/* assert bpp=4 */
|
||||
if(bpp!=4 && bpp!=2) {
|
||||
rfbClientLog("bpp = %d (!=4)\n",bpp);
|
||||
return;
|
||||
}
|
||||
|
||||
f=fopen("framebuffer.ppm","wb");
|
||||
if(!f) {
|
||||
rfbClientErr("Could not open framebuffer.ppm\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f,"P6\n# %s\n%d %d\n255\n",client->desktopName,client->width,client->height);
|
||||
for(j=0;j<client->height*row_stride;j+=row_stride)
|
||||
for(i=0;i<client->width*bpp;i+=bpp) {
|
||||
unsigned char* p=client->frameBuffer+j+i;
|
||||
unsigned int v;
|
||||
if(bpp==4)
|
||||
v=*(unsigned int*)p;
|
||||
else if(bpp==2)
|
||||
v=*(unsigned short*)p;
|
||||
else
|
||||
v=*(unsigned char*)p;
|
||||
fputc((v>>pf->redShift)*256/(pf->redMax+1),f);
|
||||
fputc((v>>pf->greenShift)*256/(pf->greenMax+1),f);
|
||||
fputc((v>>pf->blueShift)*256/(pf->blueMax+1),f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
rfbClient* client = rfbGetClient(8,3,4);
|
||||
time_t t=time(NULL);
|
||||
|
||||
if(argc>1 && !strcmp("-print",argv[1])) {
|
||||
client->GotFrameBufferUpdate = PrintRect;
|
||||
argv[1]=argv[0]; argv++; argc--;
|
||||
} else
|
||||
client->GotFrameBufferUpdate = SaveFramebufferAsPPM;
|
||||
|
||||
/* The -listen option is used to make us a daemon process which listens for
|
||||
incoming connections from servers, rather than actively connecting to a
|
||||
given server. The -tunnel and -via options are useful to create
|
||||
connections tunneled via SSH port forwarding. We must test for the
|
||||
-listen option before invoking any Xt functions - this is because we use
|
||||
forking, and Xt doesn't seem to cope with forking very well. For -listen
|
||||
option, when a successful incoming connection has been accepted,
|
||||
listenForIncomingConnections() returns, setting the listenSpecified
|
||||
flag. */
|
||||
|
||||
if (!rfbInitClient(client,&argc,argv))
|
||||
return 1;
|
||||
|
||||
/* TODO: better wait for update completion */
|
||||
while (time(NULL)-t<5) {
|
||||
static int i=0;
|
||||
fprintf(stderr,"\r%d",i++);
|
||||
if(WaitForMessage(client,50)<0)
|
||||
break;
|
||||
if(!HandleRFBServerMessage(client))
|
||||
break;
|
||||
}
|
||||
|
||||
rfbClientCleanup(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
558
jni/vnc/LibVNCServer-0.9.9/client_examples/scrap.c
Normal file
558
jni/vnc/LibVNCServer-0.9.9/client_examples/scrap.c
Normal file
@ -0,0 +1,558 @@
|
||||
/* Handle clipboard text and data in arbitrary formats */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
#else
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_syswm.h>
|
||||
#endif
|
||||
#include "scrap.h"
|
||||
#include "rfb/rfbconfig.h"
|
||||
|
||||
/* Determine what type of clipboard we are using */
|
||||
#if defined(__unix__) && !defined(__QNXNTO__) && defined(LIBVNCSERVER_HAVE_X11)
|
||||
#define X11_SCRAP
|
||||
#elif defined(__WIN32__)
|
||||
#define WIN_SCRAP
|
||||
#elif defined(__QNXNTO__)
|
||||
#define QNX_SCRAP
|
||||
#else
|
||||
#warning Unknown window manager for clipboard handling
|
||||
#endif /* scrap type */
|
||||
|
||||
/* System dependent data types */
|
||||
#if defined(X11_SCRAP)
|
||||
typedef Atom scrap_type;
|
||||
static Atom XA_TARGETS, XA_TEXT, XA_COMPOUND_TEXT, XA_UTF8_STRING;
|
||||
#elif defined(WIN_SCRAP)
|
||||
typedef UINT scrap_type;
|
||||
#elif defined(QNX_SCRAP)
|
||||
typedef uint32_t scrap_type;
|
||||
#define Ph_CL_TEXT T('T', 'E', 'X', 'T')
|
||||
#else
|
||||
typedef int scrap_type;
|
||||
#endif /* scrap type */
|
||||
|
||||
/* System dependent variables */
|
||||
#if defined(X11_SCRAP)
|
||||
static Display *SDL_Display;
|
||||
static Window SDL_Window;
|
||||
static void (*Lock_Display)(void);
|
||||
static void (*Unlock_Display)(void);
|
||||
static Atom XA_UTF8_STRING;
|
||||
#elif defined(WIN_SCRAP)
|
||||
static HWND SDL_Window;
|
||||
#elif defined(QNX_SCRAP)
|
||||
static unsigned short InputGroup;
|
||||
#endif /* scrap type */
|
||||
|
||||
#define FORMAT_PREFIX "SDL_scrap_0x"
|
||||
|
||||
static scrap_type convert_format(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case T('T', 'E', 'X', 'T'):
|
||||
#if defined(X11_SCRAP)
|
||||
return XA_UTF8_STRING ? XA_UTF8_STRING : XA_STRING;
|
||||
#elif defined(WIN_SCRAP)
|
||||
return CF_TEXT;
|
||||
#elif defined(QNX_SCRAP)
|
||||
return Ph_CL_TEXT;
|
||||
#endif /* scrap type */
|
||||
default:
|
||||
{
|
||||
char format[sizeof(FORMAT_PREFIX)+8+1];
|
||||
|
||||
sprintf(format, "%s%08lx", FORMAT_PREFIX,
|
||||
(unsigned long)type);
|
||||
#if defined(X11_SCRAP)
|
||||
return XInternAtom(SDL_Display, format, False);
|
||||
#elif defined(WIN_SCRAP)
|
||||
return RegisterClipboardFormat(format);
|
||||
#endif /* scrap type */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert internal data to scrap format */
|
||||
static int convert_data(int type, char *dst, const char *src, int srclen)
|
||||
{
|
||||
int dstlen;
|
||||
|
||||
dstlen = 0;
|
||||
switch (type) {
|
||||
case T('T', 'E', 'X', 'T'):
|
||||
if (dst) {
|
||||
while (--srclen >= 0) {
|
||||
#if defined(__unix__)
|
||||
if (*src == '\r') {
|
||||
*dst++ = '\n';
|
||||
++dstlen;
|
||||
}
|
||||
else
|
||||
#elif defined(__WIN32__)
|
||||
if (*src == '\r') {
|
||||
*dst++ = '\r';
|
||||
++dstlen;
|
||||
*dst++ = '\n';
|
||||
++dstlen;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*dst++ = *src;
|
||||
++dstlen;
|
||||
}
|
||||
++src;
|
||||
}
|
||||
*dst = '\0';
|
||||
++dstlen;
|
||||
}
|
||||
else {
|
||||
while (--srclen >= 0) {
|
||||
#if defined(__unix__)
|
||||
if (*src == '\r')
|
||||
++dstlen;
|
||||
else
|
||||
#elif defined(__WIN32__)
|
||||
if (*src == '\r') {
|
||||
++dstlen;
|
||||
++dstlen;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
++dstlen;
|
||||
}
|
||||
++src;
|
||||
}
|
||||
++dstlen;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (dst) {
|
||||
*(int *)dst = srclen;
|
||||
dst += sizeof(int);
|
||||
memcpy(dst, src, srclen);
|
||||
}
|
||||
dstlen = sizeof(int)+srclen;
|
||||
break;
|
||||
}
|
||||
return(dstlen);
|
||||
}
|
||||
|
||||
/* Convert scrap data to internal format */
|
||||
static int convert_scrap(int type, char *dst, char *src, int srclen)
|
||||
{
|
||||
int dstlen;
|
||||
|
||||
dstlen = 0;
|
||||
switch (type) {
|
||||
case T('T', 'E', 'X', 'T'):
|
||||
{
|
||||
if (srclen == 0)
|
||||
srclen = strlen(src);
|
||||
if (dst) {
|
||||
while (--srclen >= 0) {
|
||||
#if defined(__WIN32__)
|
||||
if (*src == '\r')
|
||||
/* drop extraneous '\r' */;
|
||||
else
|
||||
#endif
|
||||
if (*src == '\n') {
|
||||
*dst++ = '\r';
|
||||
++dstlen;
|
||||
}
|
||||
else {
|
||||
*dst++ = *src;
|
||||
++dstlen;
|
||||
}
|
||||
++src;
|
||||
}
|
||||
*dst = '\0';
|
||||
++dstlen;
|
||||
}
|
||||
else {
|
||||
while (--srclen >= 0) {
|
||||
#if defined(__WIN32__)
|
||||
/* drop extraneous '\r' */;
|
||||
if (*src != '\r')
|
||||
#endif
|
||||
++dstlen;
|
||||
++src;
|
||||
}
|
||||
++dstlen;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
dstlen = *(int *)src;
|
||||
if (dst)
|
||||
memcpy(dst, src + sizeof(int),
|
||||
srclen ? srclen - sizeof(int) : dstlen);
|
||||
break;
|
||||
}
|
||||
return dstlen;
|
||||
}
|
||||
|
||||
int init_scrap(void)
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
int retval;
|
||||
|
||||
/* Grab the window manager specific information */
|
||||
retval = -1;
|
||||
SDL_SetError("SDL is not running on known window manager");
|
||||
|
||||
SDL_VERSION(&info.version);
|
||||
if (SDL_GetWMInfo(&info)) {
|
||||
/* Save the information for later use */
|
||||
#if defined(X11_SCRAP)
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_Display = info.info.x11.display;
|
||||
SDL_Window = info.info.x11.window;
|
||||
Lock_Display = info.info.x11.lock_func;
|
||||
Unlock_Display = info.info.x11.unlock_func;
|
||||
|
||||
/* Enable the special window hook events */
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
|
||||
SDL_SetEventFilter(clipboard_filter);
|
||||
|
||||
XA_TARGETS = XInternAtom(SDL_Display, "TARGETS", False);
|
||||
XA_TEXT = XInternAtom(SDL_Display, "TEXT", False);
|
||||
XA_COMPOUND_TEXT = XInternAtom(SDL_Display,
|
||||
"COMPOUND_TEXT", False);
|
||||
XA_UTF8_STRING = XInternAtom(SDL_Display,
|
||||
"UTF8_STRING", False);
|
||||
|
||||
retval = 0;
|
||||
}
|
||||
else
|
||||
SDL_SetError("SDL is not running on X11");
|
||||
#elif defined(WIN_SCRAP)
|
||||
SDL_Window = info.window;
|
||||
retval = 0;
|
||||
#elif defined(QNX_SCRAP)
|
||||
InputGroup = PhInputGroup(NULL);
|
||||
retval = 0;
|
||||
#endif /* scrap type */
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
|
||||
int lost_scrap(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
#if defined(X11_SCRAP)
|
||||
if (Lock_Display)
|
||||
Lock_Display();
|
||||
retval = (XGetSelectionOwner(SDL_Display, XA_PRIMARY) != SDL_Window);
|
||||
if (Unlock_Display)
|
||||
Unlock_Display();
|
||||
#elif defined(WIN_SCRAP)
|
||||
retval = (GetClipboardOwner() != SDL_Window);
|
||||
#elif defined(QNX_SCRAP)
|
||||
retval = (PhInputGroup(NULL) != InputGroup);
|
||||
#endif /* scrap type */
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
void put_scrap(int type, int srclen, const char *src)
|
||||
{
|
||||
scrap_type format;
|
||||
int dstlen;
|
||||
char *dst;
|
||||
|
||||
format = convert_format(type);
|
||||
dstlen = convert_data(type, NULL, src, srclen);
|
||||
|
||||
#if defined(X11_SCRAP)
|
||||
dst = (char *)malloc(dstlen);
|
||||
if (dst != NULL) {
|
||||
if (Lock_Display)
|
||||
Lock_Display();
|
||||
convert_data(type, dst, src, srclen);
|
||||
XChangeProperty(SDL_Display, DefaultRootWindow(SDL_Display),
|
||||
XA_CUT_BUFFER0, format, 8, PropModeReplace,
|
||||
(unsigned char *)dst, dstlen);
|
||||
free(dst);
|
||||
if (lost_scrap())
|
||||
XSetSelectionOwner(SDL_Display, XA_PRIMARY,
|
||||
SDL_Window, CurrentTime);
|
||||
if (Unlock_Display)
|
||||
Unlock_Display();
|
||||
}
|
||||
#elif defined(WIN_SCRAP)
|
||||
if (OpenClipboard(SDL_Window)) {
|
||||
HANDLE hMem;
|
||||
|
||||
hMem = GlobalAlloc((GMEM_MOVEABLE|GMEM_DDESHARE), dstlen);
|
||||
if (hMem != NULL) {
|
||||
dst = (char *)GlobalLock(hMem);
|
||||
convert_data(type, dst, src, srclen);
|
||||
GlobalUnlock(hMem);
|
||||
EmptyClipboard();
|
||||
SetClipboardData(format, hMem);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
#elif defined(QNX_SCRAP)
|
||||
#if (_NTO_VERSION < 620) /* before 6.2.0 releases */
|
||||
#define PhClipboardHdr PhClipHeader
|
||||
#endif
|
||||
{
|
||||
PhClipboardHdr clheader = { Ph_CLIPBOARD_TYPE_TEXT, 0, NULL };
|
||||
int* cldata;
|
||||
int status;
|
||||
|
||||
dst = (char *)malloc(dstlen+4);
|
||||
if (dst != NULL) {
|
||||
cldata = (int*)dst;
|
||||
*cldata = type;
|
||||
convert_data(type, dst+4, src, srclen);
|
||||
clheader.data = dst;
|
||||
#if (_NTO_VERSION < 620) /* before 6.2.0 releases */
|
||||
if (dstlen > 65535)
|
||||
/* maximum photon clipboard size :(*/
|
||||
clheader.length = 65535;
|
||||
else
|
||||
#endif
|
||||
clheader.length = dstlen+4;
|
||||
status = PhClipboardCopy(InputGroup, 1, &clheader);
|
||||
if (status == -1)
|
||||
fprintf(stderr,
|
||||
"Photon: copy to clipboard failed!\n");
|
||||
free(dst);
|
||||
}
|
||||
}
|
||||
#endif /* scrap type */
|
||||
}
|
||||
|
||||
void get_scrap(int type, int *dstlen, char **dst)
|
||||
{
|
||||
scrap_type format;
|
||||
|
||||
*dstlen = 0;
|
||||
format = convert_format(type);
|
||||
|
||||
#if defined(X11_SCRAP)
|
||||
{
|
||||
Window owner;
|
||||
Atom selection;
|
||||
Atom seln_type;
|
||||
int seln_format;
|
||||
unsigned long nbytes;
|
||||
unsigned long overflow;
|
||||
char *src;
|
||||
|
||||
if (Lock_Display)
|
||||
Lock_Display();
|
||||
owner = XGetSelectionOwner(SDL_Display, XA_PRIMARY);
|
||||
if (Unlock_Display)
|
||||
Unlock_Display();
|
||||
if ((owner == None) || (owner == SDL_Window)) {
|
||||
owner = DefaultRootWindow(SDL_Display);
|
||||
selection = XA_CUT_BUFFER0;
|
||||
}
|
||||
else {
|
||||
int selection_response = 0;
|
||||
SDL_Event event;
|
||||
|
||||
owner = SDL_Window;
|
||||
if (Lock_Display)
|
||||
Lock_Display();
|
||||
selection = XInternAtom(SDL_Display, "SDL_SELECTION",
|
||||
False);
|
||||
XConvertSelection(SDL_Display, XA_PRIMARY, format,
|
||||
selection, owner, CurrentTime);
|
||||
if (Unlock_Display)
|
||||
Unlock_Display();
|
||||
while (!selection_response) {
|
||||
SDL_WaitEvent(&event);
|
||||
if (event.type == SDL_SYSWMEVENT) {
|
||||
XEvent xevent =
|
||||
event.syswm.msg->event.xevent;
|
||||
|
||||
if ((xevent.type == SelectionNotify) &&
|
||||
(xevent.xselection.requestor
|
||||
== owner))
|
||||
selection_response = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Lock_Display)
|
||||
Lock_Display();
|
||||
if (XGetWindowProperty(SDL_Display, owner, selection,
|
||||
0, INT_MAX/4, False, format, &seln_type,
|
||||
&seln_format, &nbytes, &overflow,
|
||||
(unsigned char **)&src) == Success) {
|
||||
if (seln_type == format) {
|
||||
*dstlen = convert_scrap(type, NULL,
|
||||
src, nbytes);
|
||||
*dst = (char *)realloc(*dst, *dstlen);
|
||||
if (*dst == NULL)
|
||||
*dstlen = 0;
|
||||
else
|
||||
convert_scrap(type, *dst, src, nbytes);
|
||||
}
|
||||
XFree(src);
|
||||
}
|
||||
}
|
||||
if (Unlock_Display)
|
||||
Unlock_Display();
|
||||
#elif defined(WIN_SCRAP)
|
||||
if (IsClipboardFormatAvailable(format) && OpenClipboard(SDL_Window)) {
|
||||
HANDLE hMem;
|
||||
char *src;
|
||||
|
||||
hMem = GetClipboardData(format);
|
||||
if (hMem != NULL) {
|
||||
src = (char *)GlobalLock(hMem);
|
||||
*dstlen = convert_scrap(type, NULL, src, 0);
|
||||
*dst = (char *)realloc(*dst, *dstlen);
|
||||
if (*dst == NULL)
|
||||
*dstlen = 0;
|
||||
else
|
||||
convert_scrap(type, *dst, src, 0);
|
||||
GlobalUnlock(hMem);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
#elif defined(QNX_SCRAP)
|
||||
#if (_NTO_VERSION < 620) /* before 6.2.0 releases */
|
||||
{
|
||||
void* clhandle;
|
||||
PhClipHeader* clheader;
|
||||
int* cldata;
|
||||
|
||||
clhandle = PhClipboardPasteStart(InputGroup);
|
||||
if (clhandle != NULL) {
|
||||
clheader = PhClipboardPasteType(clhandle,
|
||||
Ph_CLIPBOARD_TYPE_TEXT);
|
||||
if (clheader != NULL) {
|
||||
cldata = clheader->data;
|
||||
if ((clheader->length>4) && (*cldata == type)) {
|
||||
*dstlen = convert_scrap(type, NULL,
|
||||
(char*)clheader->data+4,
|
||||
clheader->length-4);
|
||||
*dst = (char *)realloc(*dst, *dstlen);
|
||||
if (*dst == NULL)
|
||||
*dstlen = 0;
|
||||
else
|
||||
convert_scrap(type, *dst,
|
||||
(char*)clheader->data+4,
|
||||
clheader->length-4);
|
||||
}
|
||||
}
|
||||
PhClipboardPasteFinish(clhandle);
|
||||
}
|
||||
}
|
||||
#else /* 6.2.0 and 6.2.1 and future releases */
|
||||
{
|
||||
void* clhandle;
|
||||
PhClipboardHdr* clheader;
|
||||
int* cldata;
|
||||
|
||||
clheader=PhClipboardRead(InputGroup, Ph_CLIPBOARD_TYPE_TEXT);
|
||||
if (clheader!=NULL) {
|
||||
cldata=clheader->data;
|
||||
if ((clheader->length>4) && (*cldata==type)) {
|
||||
*dstlen = convert_scrap(type, NULL,
|
||||
(char*)clheader->data+4,
|
||||
clheader->length-4);
|
||||
*dst = (char *)realloc(*dst, *dstlen);
|
||||
if (*dst == NULL)
|
||||
*dstlen = 0;
|
||||
else
|
||||
convert_scrap(type, *dst,
|
||||
(char*)clheader->data+4,
|
||||
clheader->length-4);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* scrap type */
|
||||
}
|
||||
|
||||
int clipboard_filter(const SDL_Event *event)
|
||||
{
|
||||
#if defined(X11_SCRAP)
|
||||
/* Post all non-window manager specific events */
|
||||
if (event->type != SDL_SYSWMEVENT)
|
||||
return(1);
|
||||
|
||||
/* Handle window-manager specific clipboard events */
|
||||
switch (event->syswm.msg->event.xevent.type) {
|
||||
/* Copy the selection from XA_CUT_BUFFER0 to the requested property */
|
||||
case SelectionRequest: {
|
||||
XSelectionRequestEvent *req;
|
||||
XEvent sevent;
|
||||
int seln_format;
|
||||
unsigned long nbytes;
|
||||
unsigned long overflow;
|
||||
unsigned char *seln_data;
|
||||
|
||||
req = &event->syswm.msg->event.xevent.xselectionrequest;
|
||||
if (req->target == XA_TARGETS) {
|
||||
Atom supported[] = {
|
||||
XA_TEXT, XA_COMPOUND_TEXT, XA_UTF8_STRING,
|
||||
XA_TARGETS, XA_STRING
|
||||
};
|
||||
XEvent response;
|
||||
|
||||
XChangeProperty(SDL_Display, req->requestor,
|
||||
req->property, req->target, 32, PropModeReplace,
|
||||
(unsigned char*)supported,
|
||||
sizeof(supported) / sizeof(supported[0]));
|
||||
response.xselection.property=None;
|
||||
response.xselection.type= SelectionNotify;
|
||||
response.xselection.display= req->display;
|
||||
response.xselection.requestor= req->requestor;
|
||||
response.xselection.selection=req->selection;
|
||||
response.xselection.target= req->target;
|
||||
response.xselection.time = req->time;
|
||||
XSendEvent (SDL_Display, req->requestor,0,0,&response);
|
||||
XFlush (SDL_Display);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sevent.xselection.type = SelectionNotify;
|
||||
sevent.xselection.display = req->display;
|
||||
sevent.xselection.selection = req->selection;
|
||||
sevent.xselection.target = None;
|
||||
sevent.xselection.property = req->property;
|
||||
sevent.xselection.requestor = req->requestor;
|
||||
sevent.xselection.time = req->time;
|
||||
if (XGetWindowProperty(SDL_Display,
|
||||
DefaultRootWindow(SDL_Display), XA_CUT_BUFFER0,
|
||||
0, INT_MAX/4, False, req->target,
|
||||
&sevent.xselection.target, &seln_format,
|
||||
&nbytes, &overflow, &seln_data) == Success) {
|
||||
if (sevent.xselection.target == req->target) {
|
||||
if (sevent.xselection.target == XA_STRING &&
|
||||
nbytes > 0 &&
|
||||
seln_data[nbytes-1] == '\0')
|
||||
--nbytes;
|
||||
XChangeProperty(SDL_Display, req->requestor,
|
||||
req->property, sevent.xselection.target,
|
||||
seln_format, PropModeReplace,
|
||||
seln_data, nbytes);
|
||||
sevent.xselection.property = req->property;
|
||||
}
|
||||
XFree(seln_data);
|
||||
}
|
||||
XSendEvent(SDL_Display,req->requestor,False,0,&sevent);
|
||||
XSync(SDL_Display, False);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Post the event for X11 clipboard reading above */
|
||||
#endif /* X11_SCRAP */
|
||||
return(1);
|
||||
}
|
18
jni/vnc/LibVNCServer-0.9.9/client_examples/scrap.h
Normal file
18
jni/vnc/LibVNCServer-0.9.9/client_examples/scrap.h
Normal file
@ -0,0 +1,18 @@
|
||||
/* Handle clipboard text and data in arbitrary formats */
|
||||
|
||||
/* Miscellaneous defines */
|
||||
#define T(A, B, C, D) (int)((A<<24)|(B<<16)|(C<<8)|(D<<0))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern int init_scrap(void);
|
||||
extern int lost_scrap(void);
|
||||
extern void put_scrap(int type, int srclen, const char *src);
|
||||
extern void get_scrap(int type, int *dstlen, char **dst);
|
||||
extern int clipboard_filter(const SDL_Event *event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
436
jni/vnc/LibVNCServer-0.9.9/client_examples/vnc2mpg.c
Normal file
436
jni/vnc/LibVNCServer-0.9.9/client_examples/vnc2mpg.c
Normal file
@ -0,0 +1,436 @@
|
||||
/**
|
||||
* @example vnc2mpg.c
|
||||
* Simple movie writer for vnc; based on Libavformat API example from FFMPEG
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard, 2004 Johannes E. Schindelin
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897931
|
||||
#endif
|
||||
|
||||
#include "avformat.h"
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
#define STREAM_FRAME_RATE 25 /* 25 images/s */
|
||||
|
||||
/**************************************************************/
|
||||
/* video output */
|
||||
|
||||
AVFrame *picture, *tmp_picture;
|
||||
uint8_t *video_outbuf;
|
||||
int frame_count, video_outbuf_size;
|
||||
|
||||
/* add a video output stream */
|
||||
AVStream *add_video_stream(AVFormatContext *oc, int codec_id, int w, int h)
|
||||
{
|
||||
AVCodecContext *c;
|
||||
AVStream *st;
|
||||
|
||||
st = av_new_stream(oc, 0);
|
||||
if (!st) {
|
||||
fprintf(stderr, "Could not alloc stream\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if LIBAVFORMAT_BUILD<4629
|
||||
c = &st->codec;
|
||||
#else
|
||||
c = st->codec;
|
||||
#endif
|
||||
c->codec_id = codec_id;
|
||||
c->codec_type = CODEC_TYPE_VIDEO;
|
||||
|
||||
/* put sample parameters */
|
||||
c->bit_rate = 800000;
|
||||
/* resolution must be a multiple of two */
|
||||
c->width = w;
|
||||
c->height = h;
|
||||
/* frames per second */
|
||||
#if LIBAVCODEC_BUILD<4754
|
||||
c->frame_rate = STREAM_FRAME_RATE;
|
||||
c->frame_rate_base = 1;
|
||||
#else
|
||||
c->time_base.den = STREAM_FRAME_RATE;
|
||||
c->time_base.num = 1;
|
||||
c->pix_fmt = PIX_FMT_YUV420P;
|
||||
#endif
|
||||
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||
if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
|
||||
/* just for testing, we also add B frames */
|
||||
c->max_b_frames = 2;
|
||||
}
|
||||
if (c->codec_id == CODEC_ID_MPEG1VIDEO){
|
||||
/* needed to avoid using macroblocks in which some coeffs overflow
|
||||
this doesnt happen with normal video, it just happens here as the
|
||||
motion of the chroma plane doesnt match the luma plane */
|
||||
c->mb_decision=2;
|
||||
}
|
||||
/* some formats want stream headers to be seperate */
|
||||
if(!strcmp(oc->oformat->name, "mp4") || !strcmp(oc->oformat->name, "mov") || !strcmp(oc->oformat->name, "3gp"))
|
||||
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
AVFrame *alloc_picture(int pix_fmt, int width, int height)
|
||||
{
|
||||
AVFrame *picture;
|
||||
uint8_t *picture_buf;
|
||||
int size;
|
||||
|
||||
picture = avcodec_alloc_frame();
|
||||
if (!picture)
|
||||
return NULL;
|
||||
size = avpicture_get_size(pix_fmt, width, height);
|
||||
picture_buf = malloc(size);
|
||||
if (!picture_buf) {
|
||||
av_free(picture);
|
||||
return NULL;
|
||||
}
|
||||
avpicture_fill((AVPicture *)picture, picture_buf,
|
||||
pix_fmt, width, height);
|
||||
return picture;
|
||||
}
|
||||
|
||||
void open_video(AVFormatContext *oc, AVStream *st)
|
||||
{
|
||||
AVCodec *codec;
|
||||
AVCodecContext *c;
|
||||
|
||||
#if LIBAVFORMAT_BUILD<4629
|
||||
c = &st->codec;
|
||||
#else
|
||||
c = st->codec;
|
||||
#endif
|
||||
|
||||
/* find the video encoder */
|
||||
codec = avcodec_find_encoder(c->codec_id);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "codec not found\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* open the codec */
|
||||
if (avcodec_open(c, codec) < 0) {
|
||||
fprintf(stderr, "could not open codec\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
video_outbuf = NULL;
|
||||
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
|
||||
/* allocate output buffer */
|
||||
/* XXX: API change will be done */
|
||||
video_outbuf_size = 200000;
|
||||
video_outbuf = malloc(video_outbuf_size);
|
||||
}
|
||||
|
||||
/* allocate the encoded raw picture */
|
||||
picture = alloc_picture(c->pix_fmt, c->width, c->height);
|
||||
if (!picture) {
|
||||
fprintf(stderr, "Could not allocate picture\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* if the output format is not RGB565, then a temporary RGB565
|
||||
picture is needed too. It is then converted to the required
|
||||
output format */
|
||||
tmp_picture = NULL;
|
||||
if (c->pix_fmt != PIX_FMT_RGB565) {
|
||||
tmp_picture = alloc_picture(PIX_FMT_RGB565, c->width, c->height);
|
||||
if (!tmp_picture) {
|
||||
fprintf(stderr, "Could not allocate temporary picture\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_video_frame(AVFormatContext *oc, AVStream *st)
|
||||
{
|
||||
int out_size, ret;
|
||||
AVCodecContext *c;
|
||||
AVFrame *picture_ptr;
|
||||
|
||||
#if LIBAVFORMAT_BUILD<4629
|
||||
c = &st->codec;
|
||||
#else
|
||||
c = st->codec;
|
||||
#endif
|
||||
|
||||
if (c->pix_fmt != PIX_FMT_RGB565) {
|
||||
/* as we only generate a RGB565 picture, we must convert it
|
||||
to the codec pixel format if needed */
|
||||
img_convert((AVPicture *)picture, c->pix_fmt,
|
||||
(AVPicture *)tmp_picture, PIX_FMT_RGB565,
|
||||
c->width, c->height);
|
||||
}
|
||||
picture_ptr = picture;
|
||||
|
||||
|
||||
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
|
||||
/* raw video case. The API will change slightly in the near
|
||||
futur for that */
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
|
||||
pkt.flags |= PKT_FLAG_KEY;
|
||||
pkt.stream_index= st->index;
|
||||
pkt.data= (uint8_t *)picture_ptr;
|
||||
pkt.size= sizeof(AVPicture);
|
||||
|
||||
ret = av_write_frame(oc, &pkt);
|
||||
} else {
|
||||
/* encode the image */
|
||||
out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture_ptr);
|
||||
/* if zero size, it means the image was buffered */
|
||||
if (out_size != 0) {
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
|
||||
pkt.pts= c->coded_frame->pts;
|
||||
if(c->coded_frame->key_frame)
|
||||
pkt.flags |= PKT_FLAG_KEY;
|
||||
pkt.stream_index= st->index;
|
||||
pkt.data= video_outbuf;
|
||||
pkt.size= out_size;
|
||||
|
||||
/* write the compressed frame in the media file */
|
||||
ret = av_write_frame(oc, &pkt);
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Error while writing video frame\n");
|
||||
exit(1);
|
||||
}
|
||||
frame_count++;
|
||||
}
|
||||
|
||||
void close_video(AVFormatContext *oc, AVStream *st)
|
||||
{
|
||||
avcodec_close(st->codec);
|
||||
av_free(picture->data[0]);
|
||||
av_free(picture);
|
||||
if (tmp_picture) {
|
||||
av_free(tmp_picture->data[0]);
|
||||
av_free(tmp_picture);
|
||||
}
|
||||
av_free(video_outbuf);
|
||||
}
|
||||
|
||||
static const char *filename;
|
||||
static AVOutputFormat *fmt;
|
||||
static AVFormatContext *oc;
|
||||
static AVStream *video_st;
|
||||
static double video_pts;
|
||||
|
||||
static int movie_open(int w, int h) {
|
||||
if (fmt->video_codec != CODEC_ID_NONE) {
|
||||
video_st = add_video_stream(oc, fmt->video_codec, w, h);
|
||||
} else
|
||||
return 1;
|
||||
|
||||
/* set the output parameters (must be done even if no
|
||||
parameters). */
|
||||
if (av_set_parameters(oc, NULL) < 0) {
|
||||
fprintf(stderr, "Invalid output format parameters\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
dump_format(oc, 0, filename, 1);
|
||||
|
||||
/* now that all the parameters are set, we can open the audio and
|
||||
video codecs and allocate the necessary encode buffers */
|
||||
if (video_st)
|
||||
open_video(oc, video_st);
|
||||
|
||||
/* open the output file, if needed */
|
||||
if (!(fmt->flags & AVFMT_NOFILE)) {
|
||||
if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
|
||||
fprintf(stderr, "Could not open '%s'\n", filename);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
/* write the stream header, if any */
|
||||
av_write_header(oc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int movie_close() {
|
||||
int i;
|
||||
|
||||
/* close each codec */
|
||||
close_video(oc, video_st);
|
||||
|
||||
/* write the trailer, if any */
|
||||
av_write_trailer(oc);
|
||||
|
||||
/* free the streams */
|
||||
for(i = 0; i < oc->nb_streams; i++) {
|
||||
av_freep(&oc->streams[i]);
|
||||
}
|
||||
|
||||
if (!(fmt->flags & AVFMT_NOFILE)) {
|
||||
/* close the output file */
|
||||
url_fclose(&oc->pb);
|
||||
}
|
||||
|
||||
/* free the stream */
|
||||
av_free(oc);
|
||||
|
||||
}
|
||||
|
||||
static rfbBool quit=FALSE;
|
||||
static void signal_handler(int signal) {
|
||||
fprintf(stderr,"Cleaning up.\n");
|
||||
quit=TRUE;
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/* VNC callback functions */
|
||||
static rfbBool resize(rfbClient* client) {
|
||||
static rfbBool first=TRUE;
|
||||
if(!first) {
|
||||
movie_close();
|
||||
perror("I don't know yet how to change resolutions!\n");
|
||||
}
|
||||
movie_open(client->width, client->height);
|
||||
signal(SIGINT,signal_handler);
|
||||
if(tmp_picture)
|
||||
client->frameBuffer=tmp_picture->data[0];
|
||||
else
|
||||
client->frameBuffer=picture->data[0];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void update(rfbClient* client,int x,int y,int w,int h) {
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/* media file output */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
time_t stop=0;
|
||||
rfbClient* client;
|
||||
int i,j;
|
||||
|
||||
/* get a vnc client structure (don't connect yet). */
|
||||
client = rfbGetClient(5,3,2);
|
||||
client->format.redShift=11; client->format.redMax=31;
|
||||
client->format.greenShift=5; client->format.greenMax=63;
|
||||
client->format.blueShift=0; client->format.blueMax=31;
|
||||
|
||||
/* initialize libavcodec, and register all codecs and formats */
|
||||
av_register_all();
|
||||
|
||||
if(!strncmp(argv[argc-1],":",1) ||
|
||||
!strncmp(argv[argc-1],"127.0.0.1",9) ||
|
||||
!strncmp(argv[argc-1],"localhost",9))
|
||||
client->appData.encodingsString="raw";
|
||||
|
||||
filename=0;
|
||||
for(i=1;i<argc;i++) {
|
||||
j=i;
|
||||
if(argc>i+1 && !strcmp("-o",argv[i])) {
|
||||
filename=argv[2];
|
||||
j+=2;
|
||||
} else if(argc>i+1 && !strcmp("-t",argv[i])) {
|
||||
stop=time(0)+atoi(argv[i+1]);
|
||||
j+=2;
|
||||
}
|
||||
if(j>i) {
|
||||
argc-=j-i;
|
||||
memmove(argv+i,argv+j,(argc-i)*sizeof(char*));
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* auto detect the output format from the name. default is
|
||||
mpeg. */
|
||||
fmt = filename?guess_format(NULL, filename, NULL):0;
|
||||
if (!fmt) {
|
||||
printf("Could not deduce output format from file extension: using MPEG.\n");
|
||||
fmt = guess_format("mpeg", NULL, NULL);
|
||||
}
|
||||
if (!fmt) {
|
||||
fprintf(stderr, "Could not find suitable output format\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* allocate the output media context */
|
||||
oc = av_alloc_format_context();
|
||||
if (!oc) {
|
||||
fprintf(stderr, "Memory error\n");
|
||||
exit(1);
|
||||
}
|
||||
oc->oformat = fmt;
|
||||
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
|
||||
|
||||
/* add the audio and video streams using the default format codecs
|
||||
and initialize the codecs */
|
||||
video_st = NULL;
|
||||
|
||||
/* open VNC connection */
|
||||
client->MallocFrameBuffer=resize;
|
||||
client->GotFrameBufferUpdate=update;
|
||||
if(!rfbInitClient(client,&argc,argv)) {
|
||||
printf("usage: %s [-o output_file] [-t seconds] server:port\n"
|
||||
"Shoot a movie from a VNC server.\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if(client->serverPort==-1)
|
||||
client->vncRec->doNotSleep = TRUE; /* vncrec playback */
|
||||
|
||||
/* main loop */
|
||||
|
||||
while(!quit) {
|
||||
int i=WaitForMessage(client,1000000/STREAM_FRAME_RATE);
|
||||
if(i<0) {
|
||||
movie_close();
|
||||
return 0;
|
||||
}
|
||||
if(i)
|
||||
if(!HandleRFBServerMessage(client))
|
||||
quit=TRUE;
|
||||
else {
|
||||
/* compute current audio and video time */
|
||||
video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
|
||||
|
||||
/* write interleaved audio and video frames */
|
||||
write_video_frame(oc, video_st);
|
||||
}
|
||||
if(stop!=0 && stop<time(0))
|
||||
quit=TRUE;
|
||||
}
|
||||
|
||||
movie_close();
|
||||
return 0;
|
||||
}
|
436
jni/vnc/LibVNCServer-0.9.9/common/d3des.c
Normal file
436
jni/vnc/LibVNCServer-0.9.9/common/d3des.c
Normal file
@ -0,0 +1,436 @@
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC. Also the bytebit[] array
|
||||
* has been reversed so that the most significant bit in each byte of the
|
||||
* key is ignored, not the least significant.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* D3DES (V5.09) -
|
||||
*
|
||||
* A portable, public domain, version of the Data Encryption Standard.
|
||||
*
|
||||
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
|
||||
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
|
||||
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
|
||||
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
|
||||
* for humouring me on.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
|
||||
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
|
||||
*/
|
||||
|
||||
#include "d3des.h"
|
||||
|
||||
static void scrunch(unsigned char *, unsigned long *);
|
||||
static void unscrun(unsigned long *, unsigned char *);
|
||||
static void desfunc(unsigned long *, unsigned long *);
|
||||
static void cookey(unsigned long *);
|
||||
|
||||
static unsigned long KnL[32] = { 0L };
|
||||
/*
|
||||
static unsigned long KnR[32] = { 0L };
|
||||
static unsigned long Kn3[32] = { 0L };
|
||||
static unsigned char Df_Key[24] = {
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
|
||||
*/
|
||||
|
||||
static unsigned short bytebit[8] = {
|
||||
01, 02, 04, 010, 020, 040, 0100, 0200 };
|
||||
|
||||
static unsigned long bigbyte[24] = {
|
||||
0x800000L, 0x400000L, 0x200000L, 0x100000L,
|
||||
0x80000L, 0x40000L, 0x20000L, 0x10000L,
|
||||
0x8000L, 0x4000L, 0x2000L, 0x1000L,
|
||||
0x800L, 0x400L, 0x200L, 0x100L,
|
||||
0x80L, 0x40L, 0x20L, 0x10L,
|
||||
0x8L, 0x4L, 0x2L, 0x1L };
|
||||
|
||||
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
|
||||
|
||||
static unsigned char pc1[56] = {
|
||||
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
|
||||
|
||||
static unsigned char totrot[16] = {
|
||||
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
|
||||
|
||||
static unsigned char pc2[48] = {
|
||||
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
|
||||
|
||||
void rfbDesKey(unsigned char *key,
|
||||
int edf)
|
||||
{
|
||||
register int i, j, l, m, n;
|
||||
unsigned char pc1m[56], pcr[56];
|
||||
unsigned long kn[32];
|
||||
|
||||
for ( j = 0; j < 56; j++ ) {
|
||||
l = pc1[j];
|
||||
m = l & 07;
|
||||
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
|
||||
}
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
if( edf == DE1 ) m = (15 - i) << 1;
|
||||
else m = i << 1;
|
||||
n = m + 1;
|
||||
kn[m] = kn[n] = 0L;
|
||||
for( j = 0; j < 28; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 28 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 28; j < 56; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 56 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 0; j < 24; j++ ) {
|
||||
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
|
||||
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
|
||||
}
|
||||
}
|
||||
cookey(kn);
|
||||
return;
|
||||
}
|
||||
|
||||
static void cookey(register unsigned long *raw1)
|
||||
{
|
||||
register unsigned long *cook, *raw0;
|
||||
unsigned long dough[32];
|
||||
register int i;
|
||||
|
||||
cook = dough;
|
||||
for( i = 0; i < 16; i++, raw1++ ) {
|
||||
raw0 = raw1++;
|
||||
*cook = (*raw0 & 0x00fc0000L) << 6;
|
||||
*cook |= (*raw0 & 0x00000fc0L) << 10;
|
||||
*cook |= (*raw1 & 0x00fc0000L) >> 10;
|
||||
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
|
||||
*cook = (*raw0 & 0x0003f000L) << 12;
|
||||
*cook |= (*raw0 & 0x0000003fL) << 16;
|
||||
*cook |= (*raw1 & 0x0003f000L) >> 4;
|
||||
*cook++ |= (*raw1 & 0x0000003fL);
|
||||
}
|
||||
rfbUseKey(dough);
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbCPKey(register unsigned long *into)
|
||||
{
|
||||
register unsigned long *from, *endp;
|
||||
|
||||
from = KnL, endp = &KnL[32];
|
||||
while( from < endp ) *into++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbUseKey(register unsigned long *from)
|
||||
{
|
||||
register unsigned long *to, *endp;
|
||||
|
||||
to = KnL, endp = &KnL[32];
|
||||
while( to < endp ) *to++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbDes(unsigned char *inblock,
|
||||
unsigned char *outblock)
|
||||
{
|
||||
unsigned long work[2];
|
||||
|
||||
scrunch(inblock, work);
|
||||
desfunc(work, KnL);
|
||||
unscrun(work, outblock);
|
||||
return;
|
||||
}
|
||||
|
||||
static void scrunch(register unsigned char *outof,
|
||||
register unsigned long *into)
|
||||
{
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into++ |= (*outof++ & 0xffL);
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into |= (*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static void unscrun(register unsigned long *outof,
|
||||
register unsigned char *into)
|
||||
{
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into++ = (unsigned char)( *outof++ & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into = (unsigned char)( *outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned long SP1[64] = {
|
||||
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
|
||||
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
|
||||
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
|
||||
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
|
||||
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
|
||||
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
|
||||
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
|
||||
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
|
||||
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
|
||||
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
|
||||
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
|
||||
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
|
||||
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
|
||||
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
|
||||
|
||||
static unsigned long SP2[64] = {
|
||||
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
|
||||
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
|
||||
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
|
||||
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
|
||||
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
|
||||
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
|
||||
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
|
||||
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
|
||||
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
|
||||
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
|
||||
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
|
||||
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
|
||||
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
|
||||
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
|
||||
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
|
||||
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
|
||||
|
||||
static unsigned long SP3[64] = {
|
||||
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
|
||||
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
|
||||
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
|
||||
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
|
||||
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
|
||||
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
|
||||
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
|
||||
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
|
||||
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
|
||||
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
|
||||
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
|
||||
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
|
||||
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
|
||||
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
|
||||
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
|
||||
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
|
||||
|
||||
static unsigned long SP4[64] = {
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
|
||||
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
|
||||
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
|
||||
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
|
||||
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
|
||||
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
|
||||
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
|
||||
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
|
||||
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
|
||||
|
||||
static unsigned long SP5[64] = {
|
||||
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
|
||||
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
|
||||
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
|
||||
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
|
||||
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
|
||||
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
|
||||
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
|
||||
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
|
||||
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
|
||||
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
|
||||
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
|
||||
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
|
||||
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
|
||||
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
|
||||
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
|
||||
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
|
||||
|
||||
static unsigned long SP6[64] = {
|
||||
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
|
||||
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
|
||||
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
|
||||
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
|
||||
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
|
||||
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
|
||||
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
|
||||
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
|
||||
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
|
||||
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
|
||||
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
|
||||
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
|
||||
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
|
||||
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
|
||||
|
||||
static unsigned long SP7[64] = {
|
||||
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
|
||||
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
|
||||
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
|
||||
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
|
||||
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
|
||||
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
|
||||
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
|
||||
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
|
||||
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
|
||||
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
|
||||
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
|
||||
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
|
||||
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
|
||||
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
|
||||
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
|
||||
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
|
||||
|
||||
static unsigned long SP8[64] = {
|
||||
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
|
||||
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
|
||||
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
|
||||
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
|
||||
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
|
||||
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
|
||||
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
|
||||
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
|
||||
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
|
||||
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
|
||||
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
|
||||
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
|
||||
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
|
||||
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
|
||||
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
|
||||
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
|
||||
|
||||
static void desfunc(register unsigned long *block,
|
||||
register unsigned long *keys)
|
||||
{
|
||||
register unsigned long fval, work, right, leftt;
|
||||
register int round;
|
||||
|
||||
leftt = block[0];
|
||||
right = block[1];
|
||||
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 4);
|
||||
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 16);
|
||||
work = ((right >> 2) ^ leftt) & 0x33333333L;
|
||||
leftt ^= work;
|
||||
right ^= (work << 2);
|
||||
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 8);
|
||||
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
|
||||
|
||||
for( round = 0; round < 8; round++ ) {
|
||||
work = (right << 28) | (right >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = right ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
leftt ^= fval;
|
||||
work = (leftt << 28) | (leftt >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = leftt ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
right ^= fval;
|
||||
}
|
||||
|
||||
right = (right << 31) | (right >> 1);
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = (leftt << 31) | (leftt >> 1);
|
||||
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 8);
|
||||
work = ((leftt >> 2) ^ right) & 0x33333333L;
|
||||
right ^= work;
|
||||
leftt ^= (work << 2);
|
||||
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 16);
|
||||
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 4);
|
||||
*block++ = right;
|
||||
*block = leftt;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Validation sets:
|
||||
*
|
||||
* Single-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : c957 4425 6a5e d31d
|
||||
*
|
||||
* Double-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : 7f1d 0a77 826b 8aff
|
||||
*
|
||||
* Double-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
|
||||
*
|
||||
* Triple-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : de0b 7c06 ae5e 0ed5
|
||||
*
|
||||
* Triple-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
|
||||
*
|
||||
* d3des V5.0a rwo 9208.07 18:44 Graven Imagery
|
||||
**********************************************************************/
|
56
jni/vnc/LibVNCServer-0.9.9/common/d3des.h
Normal file
56
jni/vnc/LibVNCServer-0.9.9/common/d3des.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef D3DES_H
|
||||
#define D3DES_H
|
||||
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* d3des.h -
|
||||
*
|
||||
* Headers and defines for d3des.c
|
||||
* Graven Imagery, 1992.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
|
||||
* (GEnie : OUTER; CIS : [71755,204])
|
||||
*/
|
||||
|
||||
#define EN0 0 /* MODE == encrypt */
|
||||
#define DE1 1 /* MODE == decrypt */
|
||||
|
||||
extern void rfbDesKey(unsigned char *, int);
|
||||
/* hexkey[8] MODE
|
||||
* Sets the internal key register according to the hexadecimal
|
||||
* key contained in the 8 bytes of hexkey, according to the DES,
|
||||
* for encryption or decryption according to MODE.
|
||||
*/
|
||||
|
||||
extern void rfbUseKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Loads the internal key register with the data in cookedkey.
|
||||
*/
|
||||
|
||||
extern void rfbCPKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Copies the contents of the internal key register into the storage
|
||||
* located at &cookedkey[0].
|
||||
*/
|
||||
|
||||
extern void rfbDes(unsigned char *, unsigned char *);
|
||||
/* from[8] to[8]
|
||||
* Encrypts/Decrypts (according to the key currently loaded in the
|
||||
* internal key register) one block of eight bytes at address 'from'
|
||||
* into the block at address 'to'. They can be the same.
|
||||
*/
|
||||
|
||||
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
|
||||
********************************************************************/
|
||||
|
||||
#endif
|
419
jni/vnc/LibVNCServer-0.9.9/common/lzoconf.h
Normal file
419
jni/vnc/LibVNCServer-0.9.9/common/lzoconf.h
Normal file
@ -0,0 +1,419 @@
|
||||
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LZOCONF_H_INCLUDED
|
||||
#define __LZOCONF_H_INCLUDED 1
|
||||
|
||||
#define LZO_VERSION 0x2040
|
||||
#define LZO_VERSION_STRING "2.04"
|
||||
#define LZO_VERSION_DATE "Oct 31 2010"
|
||||
|
||||
/* internal Autoconf configuration file - only used when building LZO */
|
||||
#if defined(LZO_HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// LZO requires a conforming <limits.h>
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||
# error "invalid CHAR_BIT"
|
||||
#endif
|
||||
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
||||
# error "check your compiler installation"
|
||||
#endif
|
||||
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
||||
# error "your limits.h macros are broken"
|
||||
#endif
|
||||
|
||||
/* get OS and architecture defines */
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#include "lzodefs.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// some core defines
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(LZO_UINT32_C)
|
||||
# if (UINT_MAX < LZO_0xffffffffL)
|
||||
# define LZO_UINT32_C(c) c ## UL
|
||||
# else
|
||||
# define LZO_UINT32_C(c) ((c) + 0U)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* memory checkers */
|
||||
#if !defined(__LZO_CHECKER)
|
||||
# if defined(__BOUNDS_CHECKING_ON)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__CHECKER__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__INSURE__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__PURIFY__)
|
||||
# define __LZO_CHECKER 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// integral and pointer types
|
||||
************************************************************************/
|
||||
|
||||
/* lzo_uint should match size_t */
|
||||
#if !defined(LZO_UINT_MAX)
|
||||
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
||||
# if defined(LZO_OS_WIN64)
|
||||
typedef unsigned __int64 lzo_uint;
|
||||
typedef __int64 lzo_int;
|
||||
# else
|
||||
typedef unsigned long long lzo_uint;
|
||||
typedef long long lzo_int;
|
||||
# endif
|
||||
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_UINT_MAX UINT_MAX
|
||||
# define LZO_INT_MAX INT_MAX
|
||||
# define LZO_INT_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint;
|
||||
typedef long lzo_int;
|
||||
# define LZO_UINT_MAX ULONG_MAX
|
||||
# define LZO_INT_MAX LONG_MAX
|
||||
# define LZO_INT_MIN LONG_MIN
|
||||
# else
|
||||
# error "lzo_uint"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Integral types with 32 bits or more. */
|
||||
#if !defined(LZO_UINT32_MAX)
|
||||
# if (UINT_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned int lzo_uint32;
|
||||
typedef int lzo_int32;
|
||||
# define LZO_UINT32_MAX UINT_MAX
|
||||
# define LZO_INT32_MAX INT_MAX
|
||||
# define LZO_INT32_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint32;
|
||||
typedef long lzo_int32;
|
||||
# define LZO_UINT32_MAX ULONG_MAX
|
||||
# define LZO_INT32_MAX LONG_MAX
|
||||
# define LZO_INT32_MIN LONG_MIN
|
||||
# else
|
||||
# error "lzo_uint32"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The larger type of lzo_uint and lzo_uint32. */
|
||||
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
||||
# define lzo_xint lzo_uint
|
||||
#else
|
||||
# define lzo_xint lzo_uint32
|
||||
#endif
|
||||
|
||||
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
||||
#if !defined(__LZO_MMODEL)
|
||||
# if (LZO_UINT_MAX <= UINT_MAX)
|
||||
# define __LZO_MMODEL /*empty*/
|
||||
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
||||
# define __LZO_MMODEL_HUGE 1
|
||||
# define __LZO_MMODEL __huge
|
||||
# else
|
||||
# define __LZO_MMODEL /*empty*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* no typedef here because of const-pointer issues */
|
||||
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||
#define lzo_charp char __LZO_MMODEL *
|
||||
#define lzo_voidp void __LZO_MMODEL *
|
||||
#define lzo_shortp short __LZO_MMODEL *
|
||||
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
||||
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
|
||||
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
||||
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||
/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
|
||||
#define lzo_byte unsigned char __LZO_MMODEL
|
||||
|
||||
typedef int lzo_bool;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// function types
|
||||
************************************************************************/
|
||||
|
||||
/* name mangling */
|
||||
#if !defined(__LZO_EXTERN_C)
|
||||
# ifdef __cplusplus
|
||||
# define __LZO_EXTERN_C extern "C"
|
||||
# else
|
||||
# define __LZO_EXTERN_C extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling convention */
|
||||
#if !defined(__LZO_CDECL)
|
||||
# define __LZO_CDECL __lzo_cdecl
|
||||
#endif
|
||||
|
||||
/* DLL export information */
|
||||
#if !defined(__LZO_EXPORT1)
|
||||
# define __LZO_EXPORT1 /*empty*/
|
||||
#endif
|
||||
#if !defined(__LZO_EXPORT2)
|
||||
# define __LZO_EXPORT2 /*empty*/
|
||||
#endif
|
||||
|
||||
/* __cdecl calling convention for public C and assembly functions */
|
||||
#if !defined(LZO_PUBLIC)
|
||||
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
||||
#endif
|
||||
#if !defined(LZO_EXTERN)
|
||||
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
||||
#endif
|
||||
#if !defined(LZO_PRIVATE)
|
||||
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
||||
#endif
|
||||
|
||||
/* function types */
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
|
||||
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||
* is used, but this may change in a future release. */
|
||||
|
||||
struct lzo_callback_t;
|
||||
typedef struct lzo_callback_t lzo_callback_t;
|
||||
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||
|
||||
/* malloc & free function types */
|
||||
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||
(lzo_callback_p self, lzo_voidp ptr);
|
||||
|
||||
/* a progress indicator callback function */
|
||||
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||
|
||||
struct lzo_callback_t
|
||||
{
|
||||
/* custom allocators (set to 0 to disable) */
|
||||
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||
lzo_free_func_t nfree; /* [not used right now] */
|
||||
|
||||
/* a progress indicator callback function (set to 0 to disable) */
|
||||
lzo_progress_func_t nprogress;
|
||||
|
||||
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
||||
* callbacks points back to this struct, so you are free to store
|
||||
* some extra info in the following variables. */
|
||||
lzo_voidp user1;
|
||||
lzo_xint user2;
|
||||
lzo_xint user3;
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// error codes and prototypes
|
||||
************************************************************************/
|
||||
|
||||
/* Error codes for the compression/decompression functions. Negative
|
||||
* values are errors, positive values will be used for special but
|
||||
* normal events.
|
||||
*/
|
||||
#define LZO_E_OK 0
|
||||
#define LZO_E_ERROR (-1)
|
||||
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
||||
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||
#define LZO_E_INPUT_OVERRUN (-4)
|
||||
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||
|
||||
|
||||
#ifndef lzo_sizeof_dict_t
|
||||
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||
#endif
|
||||
|
||||
/* lzo_init() should be the first function you call.
|
||||
* Check the return code !
|
||||
*
|
||||
* lzo_init() is a macro to allow checking that the library and the
|
||||
* compiler's view of various types are consistent.
|
||||
*/
|
||||
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
||||
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||
(int)sizeof(lzo_callback_t))
|
||||
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||
|
||||
/* version functions (useful for shared libraries) */
|
||||
LZO_EXTERN(unsigned) lzo_version(void);
|
||||
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||
|
||||
/* string functions */
|
||||
LZO_EXTERN(int)
|
||||
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||
|
||||
/* checksum functions */
|
||||
LZO_EXTERN(lzo_uint32)
|
||||
lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(lzo_uint32)
|
||||
lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(const lzo_uint32p)
|
||||
lzo_get_crc32_table(void);
|
||||
|
||||
/* misc. */
|
||||
LZO_EXTERN(int) _lzo_config_check(void);
|
||||
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
||||
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
||||
typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t;
|
||||
|
||||
/* align a char pointer on a boundary that is a multiple of 'size' */
|
||||
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
|
||||
#define LZO_PTR_ALIGN_UP(p,size) \
|
||||
((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// deprecated macros - only for backward compatibility with LZO v1.xx
|
||||
************************************************************************/
|
||||
|
||||
#if defined(LZO_CFG_COMPAT)
|
||||
|
||||
#define __LZOCONF_H 1
|
||||
|
||||
#if defined(LZO_ARCH_I086)
|
||||
# define __LZO_i386 1
|
||||
#elif defined(LZO_ARCH_I386)
|
||||
# define __LZO_i386 1
|
||||
#endif
|
||||
|
||||
#if defined(LZO_OS_DOS16)
|
||||
# define __LZO_DOS 1
|
||||
# define __LZO_DOS16 1
|
||||
#elif defined(LZO_OS_DOS32)
|
||||
# define __LZO_DOS 1
|
||||
#elif defined(LZO_OS_WIN16)
|
||||
# define __LZO_WIN 1
|
||||
# define __LZO_WIN16 1
|
||||
#elif defined(LZO_OS_WIN32)
|
||||
# define __LZO_WIN 1
|
||||
#endif
|
||||
|
||||
#define __LZO_CMODEL /*empty*/
|
||||
#define __LZO_DMODEL /*empty*/
|
||||
#define __LZO_ENTRY __LZO_CDECL
|
||||
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||
|
||||
#define lzo_compress_asm_t lzo_compress_t
|
||||
#define lzo_decompress_asm_t lzo_decompress_t
|
||||
|
||||
#endif /* LZO_CFG_COMPAT */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/* vim:set ts=4 et: */
|
1851
jni/vnc/LibVNCServer-0.9.9/common/lzodefs.h
Normal file
1851
jni/vnc/LibVNCServer-0.9.9/common/lzodefs.h
Normal file
File diff suppressed because it is too large
Load Diff
452
jni/vnc/LibVNCServer-0.9.9/common/md5.c
Normal file
452
jni/vnc/LibVNCServer-0.9.9/common/md5.c
Normal file
@ -0,0 +1,452 @@
|
||||
/* Functions to compute MD5 message digest of files or memory blocks.
|
||||
according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
Copyright (C) 1995,1996,1997,1999,2000,2001,2005
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
/* #ifdef _LIBC */
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
/* We need to keep the namespace clean so define the MD5 function
|
||||
protected using leading __ . */
|
||||
# define md5_init_ctx __md5_init_ctx
|
||||
# define md5_process_block __md5_process_block
|
||||
# define md5_process_bytes __md5_process_bytes
|
||||
# define md5_finish_ctx __md5_finish_ctx
|
||||
# define md5_read_ctx __md5_read_ctx
|
||||
# define md5_stream __md5_stream
|
||||
# define md5_buffer __md5_buffer
|
||||
/* #endif */
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define SWAP(n) \
|
||||
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||||
#else
|
||||
# define SWAP(n) (n)
|
||||
#endif
|
||||
|
||||
void
|
||||
md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx);
|
||||
void
|
||||
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx);
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next
|
||||
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
||||
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
void
|
||||
md5_init_ctx (ctx)
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
ctx->A = 0x67452301;
|
||||
ctx->B = 0xefcdab89;
|
||||
ctx->C = 0x98badcfe;
|
||||
ctx->D = 0x10325476;
|
||||
|
||||
ctx->total[0] = ctx->total[1] = 0;
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result
|
||||
must be in little endian byte order.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *
|
||||
md5_read_ctx (ctx, resbuf)
|
||||
const struct md5_ctx *ctx;
|
||||
void *resbuf;
|
||||
{
|
||||
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *
|
||||
md5_finish_ctx (ctx, resbuf)
|
||||
struct md5_ctx *ctx;
|
||||
void *resbuf;
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
md5_uint32 bytes = ctx->buflen;
|
||||
size_t pad;
|
||||
|
||||
/* Now count remaining bytes. */
|
||||
ctx->total[0] += bytes;
|
||||
if (ctx->total[0] < bytes)
|
||||
++ctx->total[1];
|
||||
|
||||
pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
|
||||
memcpy (&ctx->buffer[bytes], fillbuf, pad);
|
||||
|
||||
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||||
*(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
|
||||
*(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
|
||||
(ctx->total[0] >> 29));
|
||||
|
||||
/* Process last bytes. */
|
||||
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
|
||||
|
||||
return md5_read_ctx (ctx, resbuf);
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int
|
||||
md5_stream (stream, resblock)
|
||||
FILE *stream;
|
||||
void *resblock;
|
||||
{
|
||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||
#define BLOCKSIZE 4096
|
||||
struct md5_ctx ctx;
|
||||
char buffer[BLOCKSIZE + 72];
|
||||
size_t sum;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Iterate over full file contents. */
|
||||
while (1)
|
||||
{
|
||||
/* We read the file in blocks of BLOCKSIZE bytes. One call of the
|
||||
computation function processes the whole buffer so that with the
|
||||
next round of the loop another block can be read. */
|
||||
size_t n;
|
||||
sum = 0;
|
||||
|
||||
/* Read block. Take care for partial reads. */
|
||||
do
|
||||
{
|
||||
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
|
||||
|
||||
sum += n;
|
||||
}
|
||||
while (sum < BLOCKSIZE && n != 0);
|
||||
if (n == 0 && ferror (stream))
|
||||
return 1;
|
||||
|
||||
/* If end of file is reached, end the loop. */
|
||||
if (n == 0)
|
||||
break;
|
||||
|
||||
/* Process buffer with BLOCKSIZE bytes. Note that
|
||||
BLOCKSIZE % 64 == 0
|
||||
*/
|
||||
md5_process_block (buffer, BLOCKSIZE, &ctx);
|
||||
}
|
||||
|
||||
/* Add the last bytes if necessary. */
|
||||
if (sum > 0)
|
||||
md5_process_bytes (buffer, sum, &ctx);
|
||||
|
||||
/* Construct result in desired memory. */
|
||||
md5_finish_ctx (&ctx, resblock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *
|
||||
md5_buffer (buffer, len, resblock)
|
||||
const char *buffer;
|
||||
size_t len;
|
||||
void *resblock;
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
|
||||
/* Initialize the computation context. */
|
||||
md5_init_ctx (&ctx);
|
||||
|
||||
/* Process whole buffer but last len % 64 bytes. */
|
||||
md5_process_bytes (buffer, len, &ctx);
|
||||
|
||||
/* Put result in desired memory area. */
|
||||
return md5_finish_ctx (&ctx, resblock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
md5_process_bytes (buffer, len, ctx)
|
||||
const void *buffer;
|
||||
size_t len;
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
if (ctx->buflen != 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
size_t add = 128 - left_over > len ? len : 128 - left_over;
|
||||
|
||||
memcpy (&ctx->buffer[left_over], buffer, add);
|
||||
ctx->buflen += add;
|
||||
|
||||
if (ctx->buflen > 64)
|
||||
{
|
||||
md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
|
||||
|
||||
ctx->buflen &= 63;
|
||||
/* The regions in the following copy operation cannot overlap. */
|
||||
memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
|
||||
ctx->buflen);
|
||||
}
|
||||
|
||||
buffer = (const char *) buffer + add;
|
||||
len -= add;
|
||||
}
|
||||
|
||||
/* Process available complete blocks. */
|
||||
if (len >= 64)
|
||||
{
|
||||
#if !_STRING_ARCH_unaligned
|
||||
/* To check alignment gcc has an appropriate operator. Other
|
||||
compilers don't. */
|
||||
# if __GNUC__ >= 2
|
||||
# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0)
|
||||
# else
|
||||
# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0)
|
||||
# endif
|
||||
if (UNALIGNED_P (buffer))
|
||||
while (len > 64)
|
||||
{
|
||||
md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
|
||||
buffer = (const char *) buffer + 64;
|
||||
len -= 64;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
md5_process_block (buffer, len & ~63, ctx);
|
||||
buffer = (const char *) buffer + (len & ~63);
|
||||
len &= 63;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move remaining bytes in internal buffer. */
|
||||
if (len > 0)
|
||||
{
|
||||
size_t left_over = ctx->buflen;
|
||||
|
||||
memcpy (&ctx->buffer[left_over], buffer, len);
|
||||
left_over += len;
|
||||
if (left_over >= 64)
|
||||
{
|
||||
md5_process_block (ctx->buffer, 64, ctx);
|
||||
left_over -= 64;
|
||||
memcpy (ctx->buffer, &ctx->buffer[64], left_over);
|
||||
}
|
||||
ctx->buflen = left_over;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* These are the four functions used in the four steps of the MD5 algorithm
|
||||
and defined in the RFC 1321. The first function is a little bit optimized
|
||||
(as found in Colin Plumbs public domain implementation). */
|
||||
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
|
||||
#define FF(b, c, d) (d ^ (b & (c ^ d)))
|
||||
#define FG(b, c, d) FF (d, b, c)
|
||||
#define FH(b, c, d) (b ^ c ^ d)
|
||||
#define FI(b, c, d) (c ^ (b | ~d))
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0. */
|
||||
|
||||
void
|
||||
md5_process_block (buffer, len, ctx)
|
||||
const void *buffer;
|
||||
size_t len;
|
||||
struct md5_ctx *ctx;
|
||||
{
|
||||
md5_uint32 correct_words[16];
|
||||
const md5_uint32 *words = buffer;
|
||||
size_t nwords = len / sizeof (md5_uint32);
|
||||
const md5_uint32 *endp = words + nwords;
|
||||
md5_uint32 A = ctx->A;
|
||||
md5_uint32 B = ctx->B;
|
||||
md5_uint32 C = ctx->C;
|
||||
md5_uint32 D = ctx->D;
|
||||
|
||||
/* First increment the byte count. RFC 1321 specifies the possible
|
||||
length of the file up to 2^64 bits. Here we only compute the
|
||||
number of bytes. Do a double word increment. */
|
||||
ctx->total[0] += len;
|
||||
if (ctx->total[0] < len)
|
||||
++ctx->total[1];
|
||||
|
||||
/* Process all bytes in the buffer with 64 bytes in each round of
|
||||
the loop. */
|
||||
while (words < endp)
|
||||
{
|
||||
md5_uint32 *cwp = correct_words;
|
||||
md5_uint32 A_save = A;
|
||||
md5_uint32 B_save = B;
|
||||
md5_uint32 C_save = C;
|
||||
md5_uint32 D_save = D;
|
||||
|
||||
/* First round: using the given function, the context and a constant
|
||||
the next context is computed. Because the algorithms processing
|
||||
unit is a 32-bit word and it is determined to work on words in
|
||||
little endian byte order we perhaps have to change the byte order
|
||||
before the computation. To reduce the work for the next steps
|
||||
we store the swapped words in the array CORRECT_WORDS. */
|
||||
|
||||
#define OP(a, b, c, d, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
|
||||
++words; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
They are defined in RFC 1321 as
|
||||
|
||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
||||
*/
|
||||
|
||||
/* Round 1. */
|
||||
OP (A, B, C, D, 7, 0xd76aa478);
|
||||
OP (D, A, B, C, 12, 0xe8c7b756);
|
||||
OP (C, D, A, B, 17, 0x242070db);
|
||||
OP (B, C, D, A, 22, 0xc1bdceee);
|
||||
OP (A, B, C, D, 7, 0xf57c0faf);
|
||||
OP (D, A, B, C, 12, 0x4787c62a);
|
||||
OP (C, D, A, B, 17, 0xa8304613);
|
||||
OP (B, C, D, A, 22, 0xfd469501);
|
||||
OP (A, B, C, D, 7, 0x698098d8);
|
||||
OP (D, A, B, C, 12, 0x8b44f7af);
|
||||
OP (C, D, A, B, 17, 0xffff5bb1);
|
||||
OP (B, C, D, A, 22, 0x895cd7be);
|
||||
OP (A, B, C, D, 7, 0x6b901122);
|
||||
OP (D, A, B, C, 12, 0xfd987193);
|
||||
OP (C, D, A, B, 17, 0xa679438e);
|
||||
OP (B, C, D, A, 22, 0x49b40821);
|
||||
|
||||
/* For the second to fourth round we have the possibly swapped words
|
||||
in CORRECT_WORDS. Redefine the macro to take an additional first
|
||||
argument specifying the function to use. */
|
||||
#undef OP
|
||||
#define OP(f, a, b, c, d, k, s, T) \
|
||||
do \
|
||||
{ \
|
||||
a += f (b, c, d) + correct_words[k] + T; \
|
||||
CYCLIC (a, s); \
|
||||
a += b; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Round 2. */
|
||||
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
|
||||
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
|
||||
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
|
||||
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
|
||||
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
|
||||
OP (FG, D, A, B, C, 10, 9, 0x02441453);
|
||||
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
|
||||
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
|
||||
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
|
||||
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
|
||||
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
|
||||
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
|
||||
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
|
||||
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
|
||||
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
|
||||
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
|
||||
|
||||
/* Round 3. */
|
||||
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
|
||||
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
|
||||
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
|
||||
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
|
||||
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
|
||||
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
|
||||
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
|
||||
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
|
||||
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
|
||||
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
|
||||
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
|
||||
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
|
||||
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
|
||||
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
|
||||
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
|
||||
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
|
||||
|
||||
/* Round 4. */
|
||||
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
|
||||
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
|
||||
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
|
||||
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
|
||||
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
|
||||
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
|
||||
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
|
||||
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
|
||||
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
|
||||
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
|
||||
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
|
||||
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
|
||||
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
|
||||
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
|
||||
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
|
||||
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
|
||||
|
||||
/* Add the starting values of the context. */
|
||||
A += A_save;
|
||||
B += B_save;
|
||||
C += C_save;
|
||||
D += D_save;
|
||||
}
|
||||
|
||||
/* Put checksum in context given as argument. */
|
||||
ctx->A = A;
|
||||
ctx->B = B;
|
||||
ctx->C = C;
|
||||
ctx->D = D;
|
||||
}
|
148
jni/vnc/LibVNCServer-0.9.9/common/md5.h
Normal file
148
jni/vnc/LibVNCServer-0.9.9/common/md5.h
Normal file
@ -0,0 +1,148 @@
|
||||
/* Declaration of functions and data types used for MD5 sum computing
|
||||
library functions.
|
||||
Copyright (C) 1995-1997,1999,2000,2001,2004,2005
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _MD5_H
|
||||
#define _MD5_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined HAVE_LIMITS_H || _LIBC
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#define MD5_DIGEST_SIZE 16
|
||||
#define MD5_BLOCK_SIZE 64
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
doing that would require that the configure script compile and *run*
|
||||
the resulting executable. Locally running cross-compiled executables
|
||||
is usually not possible. */
|
||||
|
||||
#ifdef _LIBC
|
||||
# include <stdint.h>
|
||||
typedef uint32_t md5_uint32;
|
||||
typedef uintptr_t md5_uintptr;
|
||||
#else
|
||||
# if defined __STDC__ && __STDC__
|
||||
# define UINT_MAX_32_BITS 4294967295U
|
||||
# else
|
||||
# define UINT_MAX_32_BITS 0xFFFFFFFF
|
||||
# endif
|
||||
|
||||
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
|
||||
This should be valid for all systems GNU cares about because
|
||||
that doesn't include 16-bit systems, and only modern systems
|
||||
(that certainly have <limits.h>) have 64+-bit integral types. */
|
||||
|
||||
# ifndef UINT_MAX
|
||||
# define UINT_MAX UINT_MAX_32_BITS
|
||||
# endif
|
||||
|
||||
# if UINT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned int md5_uint32;
|
||||
# else
|
||||
# if USHRT_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned short md5_uint32;
|
||||
# else
|
||||
# if ULONG_MAX == UINT_MAX_32_BITS
|
||||
typedef unsigned long md5_uint32;
|
||||
# else
|
||||
/* The following line is intended to evoke an error.
|
||||
Using #error is not portable enough. */
|
||||
"Cannot determine unsigned 32-bit data type."
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
/* We have to make a guess about the integer type equivalent in size
|
||||
to pointers which should always be correct. */
|
||||
typedef unsigned long int md5_uintptr;
|
||||
#endif
|
||||
|
||||
/* Structure to save state of computation between the single steps. */
|
||||
struct md5_ctx
|
||||
{
|
||||
md5_uint32 A;
|
||||
md5_uint32 B;
|
||||
md5_uint32 C;
|
||||
md5_uint32 D;
|
||||
|
||||
md5_uint32 total[2];
|
||||
md5_uint32 buflen;
|
||||
char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
|
||||
};
|
||||
|
||||
/*
|
||||
* The following three functions are build up the low level used in
|
||||
* the functions `md5_stream' and `md5_buffer'.
|
||||
*/
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void __md5_process_block (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void __md5_process_bytes (const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx) __THROW;
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
in first 16 bytes following RESBUF. The result is always in little
|
||||
endian byte order, so that a byte-wise output yields to the wanted
|
||||
ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int __md5_stream (FILE *stream, void *resblock) __THROW;
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *__md5_buffer (const char *buffer, size_t len,
|
||||
void *resblock) __THROW;
|
||||
|
||||
#endif /* md5.h */
|
4192
jni/vnc/LibVNCServer-0.9.9/common/minilzo.c
Normal file
4192
jni/vnc/LibVNCServer-0.9.9/common/minilzo.c
Normal file
File diff suppressed because it is too large
Load Diff
108
jni/vnc/LibVNCServer-0.9.9/common/minilzo.h
Normal file
108
jni/vnc/LibVNCServer-0.9.9/common/minilzo.h
Normal file
@ -0,0 +1,108 @@
|
||||
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* the full LZO package can be found at
|
||||
* http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MINILZO_H
|
||||
#define __MINILZO_H 1
|
||||
|
||||
#define MINILZO_VERSION 0x2040
|
||||
|
||||
#ifdef __LZOCONF_H
|
||||
# error "you cannot use both LZO and miniLZO"
|
||||
#endif
|
||||
|
||||
#undef LZO_HAVE_CONFIG_H
|
||||
#include "lzoconf.h"
|
||||
|
||||
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
|
||||
# error "version mismatch in header files"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
/* Memory required for the wrkmem parameter.
|
||||
* When the required size is 0, you can also pass a NULL pointer.
|
||||
*/
|
||||
|
||||
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
|
||||
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
|
||||
#define LZO1X_MEM_DECOMPRESS (0)
|
||||
|
||||
|
||||
/* compression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
411
jni/vnc/LibVNCServer-0.9.9/common/sha1.c
Normal file
411
jni/vnc/LibVNCServer-0.9.9/common/sha1.c
Normal file
@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (C) The Internet Society (2001). All Rights Reserved.
|
||||
*
|
||||
* This document and translations of it may be copied and furnished to
|
||||
* others, and derivative works that comment on or otherwise explain it
|
||||
* or assist in its implementation may be prepared, copied, published
|
||||
* and distributed, in whole or in part, without restriction of any
|
||||
* kind, provided that the above copyright notice and this paragraph are
|
||||
* included on all such copies and derivative works. However, this
|
||||
* document itself may not be modified in any way, such as by removing
|
||||
* the copyright notice or references to the Internet Society or other
|
||||
* Internet organizations, except as needed for the purpose of
|
||||
* developing Internet standards in which case the procedures for
|
||||
* copyrights defined in the Internet Standards process must be
|
||||
* followed, or as required to translate it into languages other than
|
||||
* English.
|
||||
*
|
||||
* The limited permissions granted above are perpetual and will not be
|
||||
* revoked by the Internet Society or its successors or assigns.
|
||||
*
|
||||
* This document and the information contained herein is provided on an
|
||||
* "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
* TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
* BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
* HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sha1.c
|
||||
*
|
||||
* Description:
|
||||
* This file implements the Secure Hashing Algorithm 1 as
|
||||
* defined in FIPS PUB 180-1 published April 17, 1995.
|
||||
*
|
||||
* The SHA-1, produces a 160-bit message digest for a given
|
||||
* data stream. It should take about 2**n steps to find a
|
||||
* message with the same digest as a given message and
|
||||
* 2**(n/2) to find any two messages with the same digest,
|
||||
* when n is the digest size in bits. Therefore, this
|
||||
* algorithm can serve as a means of providing a
|
||||
* "fingerprint" for a message.
|
||||
*
|
||||
* Portability Issues:
|
||||
* SHA-1 is defined in terms of 32-bit "words". This code
|
||||
* uses <stdint.h> (included via "sha1.h" to define 32 and 8
|
||||
* bit unsigned integer types. If your C compiler does not
|
||||
* support 32 bit unsigned integers, this code is not
|
||||
* appropriate.
|
||||
*
|
||||
* Caveats:
|
||||
* SHA-1 is designed to work with messages less than 2^64 bits
|
||||
* long. Although SHA-1 allows a message digest to be generated
|
||||
* for messages of any number of bits less than 2^64, this
|
||||
* implementation only works with messages with a length that is
|
||||
* a multiple of the size of an 8-bit character.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sha1.h"
|
||||
|
||||
/*
|
||||
* Define the SHA1 circular left shift macro
|
||||
*/
|
||||
#define SHA1CircularShift(bits,word) \
|
||||
(((word) << (bits)) | ((word) >> (32-(bits))))
|
||||
|
||||
/* Local Function Prototyptes */
|
||||
void SHA1PadMessage(SHA1Context *);
|
||||
void SHA1ProcessMessageBlock(SHA1Context *);
|
||||
|
||||
/*
|
||||
* SHA1Reset
|
||||
*
|
||||
* Description:
|
||||
* This function will initialize the SHA1Context in preparation
|
||||
* for computing a new SHA1 message digest.
|
||||
*
|
||||
* Parameters:
|
||||
* context: [in/out]
|
||||
* The context to reset.
|
||||
*
|
||||
* Returns:
|
||||
* sha Error Code.
|
||||
*
|
||||
*/
|
||||
int SHA1Reset(SHA1Context *context)
|
||||
{
|
||||
if (!context)
|
||||
{
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
context->Length_Low = 0;
|
||||
context->Length_High = 0;
|
||||
context->Message_Block_Index = 0;
|
||||
|
||||
context->Intermediate_Hash[0] = 0x67452301;
|
||||
context->Intermediate_Hash[1] = 0xEFCDAB89;
|
||||
context->Intermediate_Hash[2] = 0x98BADCFE;
|
||||
context->Intermediate_Hash[3] = 0x10325476;
|
||||
context->Intermediate_Hash[4] = 0xC3D2E1F0;
|
||||
|
||||
context->Computed = 0;
|
||||
context->Corrupted = 0;
|
||||
return shaSuccess;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA1Result
|
||||
*
|
||||
* Description:
|
||||
* This function will return the 160-bit message digest into the
|
||||
* Message_Digest array provided by the caller.
|
||||
* NOTE: The first octet of hash is stored in the 0th element,
|
||||
* the last octet of hash in the 19th element.
|
||||
*
|
||||
* Parameters:
|
||||
* context: [in/out]
|
||||
* The context to use to calculate the SHA-1 hash.
|
||||
* Message_Digest: [out]
|
||||
* Where the digest is returned.
|
||||
*
|
||||
* Returns:
|
||||
* sha Error Code.
|
||||
*
|
||||
*/
|
||||
int SHA1Result( SHA1Context *context,
|
||||
uint8_t Message_Digest[SHA1HashSize])
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!context || !Message_Digest)
|
||||
{
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
if (context->Corrupted)
|
||||
{
|
||||
return context->Corrupted;
|
||||
}
|
||||
|
||||
if (!context->Computed)
|
||||
{
|
||||
SHA1PadMessage(context);
|
||||
for(i=0; i<64; ++i)
|
||||
{
|
||||
/* message may be sensitive, clear it out */
|
||||
context->Message_Block[i] = 0;
|
||||
}
|
||||
context->Length_Low = 0; /* and clear length */
|
||||
context->Length_High = 0;
|
||||
context->Computed = 1;
|
||||
}
|
||||
|
||||
for(i = 0; i < SHA1HashSize; ++i)
|
||||
{
|
||||
Message_Digest[i] = context->Intermediate_Hash[i>>2]
|
||||
>> 8 * ( 3 - ( i & 0x03 ) );
|
||||
}
|
||||
|
||||
return shaSuccess;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA1Input
|
||||
*
|
||||
* Description:
|
||||
* This function accepts an array of octets as the next portion
|
||||
* of the message.
|
||||
*
|
||||
* Parameters:
|
||||
* context: [in/out]
|
||||
* The SHA context to update
|
||||
* message_array: [in]
|
||||
* An array of characters representing the next portion of
|
||||
* the message.
|
||||
* length: [in]
|
||||
* The length of the message in message_array
|
||||
*
|
||||
* Returns:
|
||||
* sha Error Code.
|
||||
*
|
||||
*/
|
||||
int SHA1Input( SHA1Context *context,
|
||||
const uint8_t *message_array,
|
||||
unsigned length)
|
||||
{
|
||||
if (!length)
|
||||
{
|
||||
return shaSuccess;
|
||||
}
|
||||
|
||||
if (!context || !message_array)
|
||||
{
|
||||
return shaNull;
|
||||
}
|
||||
|
||||
if (context->Computed)
|
||||
{
|
||||
context->Corrupted = shaStateError;
|
||||
return shaStateError;
|
||||
}
|
||||
|
||||
if (context->Corrupted)
|
||||
{
|
||||
return context->Corrupted;
|
||||
}
|
||||
while(length-- && !context->Corrupted)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] =
|
||||
(*message_array & 0xFF);
|
||||
|
||||
context->Length_Low += 8;
|
||||
if (context->Length_Low == 0)
|
||||
{
|
||||
context->Length_High++;
|
||||
if (context->Length_High == 0)
|
||||
{
|
||||
/* Message is too long */
|
||||
context->Corrupted = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (context->Message_Block_Index == 64)
|
||||
{
|
||||
SHA1ProcessMessageBlock(context);
|
||||
}
|
||||
|
||||
message_array++;
|
||||
}
|
||||
|
||||
return shaSuccess;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA1ProcessMessageBlock
|
||||
*
|
||||
* Description:
|
||||
* This function will process the next 512 bits of the message
|
||||
* stored in the Message_Block array.
|
||||
*
|
||||
* Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returns:
|
||||
* Nothing.
|
||||
*
|
||||
* Comments:
|
||||
* Many of the variable names in this code, especially the
|
||||
* single character names, were used because those were the
|
||||
* names used in the publication.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void SHA1ProcessMessageBlock(SHA1Context *context)
|
||||
{
|
||||
const uint32_t K[] = { /* Constants defined in SHA-1 */
|
||||
0x5A827999,
|
||||
0x6ED9EBA1,
|
||||
0x8F1BBCDC,
|
||||
0xCA62C1D6
|
||||
};
|
||||
int t; /* Loop counter */
|
||||
uint32_t temp; /* Temporary word value */
|
||||
uint32_t W[80]; /* Word sequence */
|
||||
uint32_t A, B, C, D, E; /* Word buffers */
|
||||
|
||||
/*
|
||||
* Initialize the first 16 words in the array W
|
||||
*/
|
||||
for(t = 0; t < 16; t++)
|
||||
{
|
||||
W[t] = context->Message_Block[t * 4] << 24;
|
||||
W[t] |= context->Message_Block[t * 4 + 1] << 16;
|
||||
W[t] |= context->Message_Block[t * 4 + 2] << 8;
|
||||
W[t] |= context->Message_Block[t * 4 + 3];
|
||||
}
|
||||
|
||||
for(t = 16; t < 80; t++)
|
||||
{
|
||||
W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
|
||||
}
|
||||
|
||||
A = context->Intermediate_Hash[0];
|
||||
B = context->Intermediate_Hash[1];
|
||||
C = context->Intermediate_Hash[2];
|
||||
D = context->Intermediate_Hash[3];
|
||||
E = context->Intermediate_Hash[4];
|
||||
|
||||
for(t = 0; t < 20; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) +
|
||||
((B & C) | ((~B) & D)) + E + W[t] + K[0];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
B = A;
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 20; t < 40; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
B = A;
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 40; t < 60; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) +
|
||||
((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
B = A;
|
||||
A = temp;
|
||||
}
|
||||
|
||||
for(t = 60; t < 80; t++)
|
||||
{
|
||||
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
|
||||
E = D;
|
||||
D = C;
|
||||
C = SHA1CircularShift(30,B);
|
||||
B = A;
|
||||
A = temp;
|
||||
}
|
||||
|
||||
context->Intermediate_Hash[0] += A;
|
||||
context->Intermediate_Hash[1] += B;
|
||||
context->Intermediate_Hash[2] += C;
|
||||
context->Intermediate_Hash[3] += D;
|
||||
context->Intermediate_Hash[4] += E;
|
||||
|
||||
context->Message_Block_Index = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SHA1PadMessage
|
||||
*
|
||||
* Description:
|
||||
* According to the standard, the message must be padded to an even
|
||||
* 512 bits. The first padding bit must be a '1'. The last 64
|
||||
* bits represent the length of the original message. All bits in
|
||||
* between should be 0. This function will pad the message
|
||||
* according to those rules by filling the Message_Block array
|
||||
* accordingly. It will also call the ProcessMessageBlock function
|
||||
* provided appropriately. When it returns, it can be assumed that
|
||||
* the message digest has been computed.
|
||||
*
|
||||
* Parameters:
|
||||
* context: [in/out]
|
||||
* The context to pad
|
||||
* ProcessMessageBlock: [in]
|
||||
* The appropriate SHA*ProcessMessageBlock function
|
||||
* Returns:
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
|
||||
void SHA1PadMessage(SHA1Context *context)
|
||||
{
|
||||
/*
|
||||
* Check to see if the current message block is too small to hold
|
||||
* the initial padding bits and length. If so, we will pad the
|
||||
* block, process it, and then continue padding into a second
|
||||
* block.
|
||||
*/
|
||||
if (context->Message_Block_Index > 55)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] = 0x80;
|
||||
while(context->Message_Block_Index < 64)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
|
||||
SHA1ProcessMessageBlock(context);
|
||||
|
||||
while(context->Message_Block_Index < 56)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] = 0x80;
|
||||
while(context->Message_Block_Index < 56)
|
||||
{
|
||||
context->Message_Block[context->Message_Block_Index++] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the message length as the last 8 octets
|
||||
*/
|
||||
context->Message_Block[56] = context->Length_High >> 24;
|
||||
context->Message_Block[57] = context->Length_High >> 16;
|
||||
context->Message_Block[58] = context->Length_High >> 8;
|
||||
context->Message_Block[59] = context->Length_High;
|
||||
context->Message_Block[60] = context->Length_Low >> 24;
|
||||
context->Message_Block[61] = context->Length_Low >> 16;
|
||||
context->Message_Block[62] = context->Length_Low >> 8;
|
||||
context->Message_Block[63] = context->Length_Low;
|
||||
|
||||
SHA1ProcessMessageBlock(context);
|
||||
}
|
101
jni/vnc/LibVNCServer-0.9.9/common/sha1.h
Normal file
101
jni/vnc/LibVNCServer-0.9.9/common/sha1.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) The Internet Society (2001). All Rights Reserved.
|
||||
*
|
||||
* This document and translations of it may be copied and furnished to
|
||||
* others, and derivative works that comment on or otherwise explain it
|
||||
* or assist in its implementation may be prepared, copied, published
|
||||
* and distributed, in whole or in part, without restriction of any
|
||||
* kind, provided that the above copyright notice and this paragraph are
|
||||
* included on all such copies and derivative works. However, this
|
||||
* document itself may not be modified in any way, such as by removing
|
||||
* the copyright notice or references to the Internet Society or other
|
||||
* Internet organizations, except as needed for the purpose of
|
||||
* developing Internet standards in which case the procedures for
|
||||
* copyrights defined in the Internet Standards process must be
|
||||
* followed, or as required to translate it into languages other than
|
||||
* English.
|
||||
*
|
||||
* The limited permissions granted above are perpetual and will not be
|
||||
* revoked by the Internet Society or its successors or assigns.
|
||||
*
|
||||
* This document and the information contained herein is provided on an
|
||||
* "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
* TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
* BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
* HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sha1.h
|
||||
*
|
||||
* Description:
|
||||
* This is the header file for code which implements the Secure
|
||||
* Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
|
||||
* April 17, 1995.
|
||||
*
|
||||
* Many of the variable names in this code, especially the
|
||||
* single character names, were used because those were the names
|
||||
* used in the publication.
|
||||
*
|
||||
* Please read the file sha1.c for more information.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SHA1_H_
|
||||
#define _SHA1_H_
|
||||
|
||||
#include <stdint.h>
|
||||
/*
|
||||
* If you do not have the ISO standard stdint.h header file, then you
|
||||
* must typdef the following:
|
||||
* name meaning
|
||||
* uint32_t unsigned 32 bit integer
|
||||
* uint8_t unsigned 8 bit integer (i.e., unsigned char)
|
||||
* int_least16_t integer of >= 16 bits
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SHA_enum_
|
||||
#define _SHA_enum_
|
||||
enum
|
||||
{
|
||||
shaSuccess = 0,
|
||||
shaNull, /* Null pointer parameter */
|
||||
shaInputTooLong, /* input data too long */
|
||||
shaStateError /* called Input after Result */
|
||||
};
|
||||
#endif
|
||||
#define SHA1HashSize 20
|
||||
|
||||
/*
|
||||
* This structure will hold context information for the SHA-1
|
||||
* hashing operation
|
||||
*/
|
||||
typedef struct SHA1Context
|
||||
{
|
||||
uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
|
||||
|
||||
uint32_t Length_Low; /* Message length in bits */
|
||||
uint32_t Length_High; /* Message length in bits */
|
||||
|
||||
/* Index into message block array */
|
||||
int_least16_t Message_Block_Index;
|
||||
uint8_t Message_Block[64]; /* 512-bit message blocks */
|
||||
|
||||
int Computed; /* Is the digest computed? */
|
||||
int Corrupted; /* Is the message digest corrupted? */
|
||||
} SHA1Context;
|
||||
|
||||
/*
|
||||
* Function Prototypes
|
||||
*/
|
||||
int SHA1Reset( SHA1Context *);
|
||||
int SHA1Input( SHA1Context *,
|
||||
const uint8_t *,
|
||||
unsigned int);
|
||||
int SHA1Result( SHA1Context *,
|
||||
uint8_t Message_Digest[SHA1HashSize]);
|
||||
|
||||
#endif
|
850
jni/vnc/LibVNCServer-0.9.9/common/turbojpeg.c
Normal file
850
jni/vnc/LibVNCServer-0.9.9/common/turbojpeg.c
Normal file
@ -0,0 +1,850 @@
|
||||
/*
|
||||
* Copyright (C)2009-2012 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* TurboJPEG/OSS: this implements the TurboJPEG API using libjpeg-turbo */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef JCS_EXTENSIONS
|
||||
#define JPEG_INTERNAL_OPTIONS
|
||||
#endif
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
#include <setjmp.h>
|
||||
#include "./turbojpeg.h"
|
||||
|
||||
#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
|
||||
|
||||
#define CSTATE_START 100
|
||||
#define DSTATE_START 200
|
||||
#define MEMZERO(ptr, size) memset(ptr, 0, size)
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
/* Error handling (based on example in example.c) */
|
||||
|
||||
static char errStr[JMSG_LENGTH_MAX]="No error";
|
||||
|
||||
struct my_error_mgr
|
||||
{
|
||||
struct jpeg_error_mgr pub;
|
||||
jmp_buf setjmp_buffer;
|
||||
};
|
||||
typedef struct my_error_mgr *my_error_ptr;
|
||||
|
||||
static void my_error_exit(j_common_ptr cinfo)
|
||||
{
|
||||
my_error_ptr myerr=(my_error_ptr)cinfo->err;
|
||||
(*cinfo->err->output_message)(cinfo);
|
||||
longjmp(myerr->setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
/* Based on output_message() in jerror.c */
|
||||
|
||||
static void my_output_message(j_common_ptr cinfo)
|
||||
{
|
||||
(*cinfo->err->format_message)(cinfo, errStr);
|
||||
}
|
||||
|
||||
|
||||
/* Global structures, macros, etc. */
|
||||
|
||||
enum {COMPRESS=1, DECOMPRESS=2};
|
||||
|
||||
typedef struct _tjinstance
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_decompress_struct dinfo;
|
||||
struct jpeg_destination_mgr jdst;
|
||||
struct jpeg_source_mgr jsrc;
|
||||
struct my_error_mgr jerr;
|
||||
int init;
|
||||
} tjinstance;
|
||||
|
||||
static const int pixelsize[TJ_NUMSAMP]={3, 3, 3, 1, 3};
|
||||
|
||||
#define NUMSF 4
|
||||
static const tjscalingfactor sf[NUMSF]={
|
||||
{1, 1},
|
||||
{1, 2},
|
||||
{1, 4},
|
||||
{1, 8}
|
||||
};
|
||||
|
||||
#define _throw(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s", m); \
|
||||
retval=-1; goto bailout;}
|
||||
#define getinstance(handle) tjinstance *this=(tjinstance *)handle; \
|
||||
j_compress_ptr cinfo=NULL; j_decompress_ptr dinfo=NULL; \
|
||||
(void) cinfo; (void) dinfo; /* silence warnings */ \
|
||||
if(!this) {snprintf(errStr, JMSG_LENGTH_MAX, "Invalid handle"); \
|
||||
return -1;} \
|
||||
cinfo=&this->cinfo; dinfo=&this->dinfo;
|
||||
|
||||
static int getPixelFormat(int pixelSize, int flags)
|
||||
{
|
||||
if(pixelSize==1) return TJPF_GRAY;
|
||||
if(pixelSize==3)
|
||||
{
|
||||
if(flags&TJ_BGR) return TJPF_BGR;
|
||||
else return TJPF_RGB;
|
||||
}
|
||||
if(pixelSize==4)
|
||||
{
|
||||
if(flags&TJ_ALPHAFIRST)
|
||||
{
|
||||
if(flags&TJ_BGR) return TJPF_XBGR;
|
||||
else return TJPF_XRGB;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(flags&TJ_BGR) return TJPF_BGRX;
|
||||
else return TJPF_RGBX;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int setCompDefaults(struct jpeg_compress_struct *cinfo,
|
||||
int pixelFormat, int subsamp, int jpegQual)
|
||||
{
|
||||
int retval=0;
|
||||
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case TJPF_GRAY:
|
||||
cinfo->in_color_space=JCS_GRAYSCALE; break;
|
||||
#if JCS_EXTENSIONS==1
|
||||
case TJPF_RGB:
|
||||
cinfo->in_color_space=JCS_EXT_RGB; break;
|
||||
case TJPF_BGR:
|
||||
cinfo->in_color_space=JCS_EXT_BGR; break;
|
||||
case TJPF_RGBX:
|
||||
case TJPF_RGBA:
|
||||
cinfo->in_color_space=JCS_EXT_RGBX; break;
|
||||
case TJPF_BGRX:
|
||||
case TJPF_BGRA:
|
||||
cinfo->in_color_space=JCS_EXT_BGRX; break;
|
||||
case TJPF_XRGB:
|
||||
case TJPF_ARGB:
|
||||
cinfo->in_color_space=JCS_EXT_XRGB; break;
|
||||
case TJPF_XBGR:
|
||||
case TJPF_ABGR:
|
||||
cinfo->in_color_space=JCS_EXT_XBGR; break;
|
||||
#else
|
||||
case TJPF_RGB:
|
||||
case TJPF_BGR:
|
||||
case TJPF_RGBX:
|
||||
case TJPF_BGRX:
|
||||
case TJPF_XRGB:
|
||||
case TJPF_XBGR:
|
||||
case TJPF_RGBA:
|
||||
case TJPF_BGRA:
|
||||
case TJPF_ARGB:
|
||||
case TJPF_ABGR:
|
||||
cinfo->in_color_space=JCS_RGB; pixelFormat=TJPF_RGB;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
cinfo->input_components=tjPixelSize[pixelFormat];
|
||||
jpeg_set_defaults(cinfo);
|
||||
if(jpegQual>=0)
|
||||
{
|
||||
jpeg_set_quality(cinfo, jpegQual, TRUE);
|
||||
if(jpegQual>=96) cinfo->dct_method=JDCT_ISLOW;
|
||||
else cinfo->dct_method=JDCT_FASTEST;
|
||||
}
|
||||
if(subsamp==TJSAMP_GRAY)
|
||||
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
|
||||
else
|
||||
jpeg_set_colorspace(cinfo, JCS_YCbCr);
|
||||
|
||||
cinfo->comp_info[0].h_samp_factor=tjMCUWidth[subsamp]/8;
|
||||
cinfo->comp_info[1].h_samp_factor=1;
|
||||
cinfo->comp_info[2].h_samp_factor=1;
|
||||
cinfo->comp_info[0].v_samp_factor=tjMCUHeight[subsamp]/8;
|
||||
cinfo->comp_info[1].v_samp_factor=1;
|
||||
cinfo->comp_info[2].v_samp_factor=1;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int setDecompDefaults(struct jpeg_decompress_struct *dinfo,
|
||||
int pixelFormat)
|
||||
{
|
||||
int retval=0;
|
||||
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case TJPF_GRAY:
|
||||
dinfo->out_color_space=JCS_GRAYSCALE; break;
|
||||
#if JCS_EXTENSIONS==1
|
||||
case TJPF_RGB:
|
||||
dinfo->out_color_space=JCS_EXT_RGB; break;
|
||||
case TJPF_BGR:
|
||||
dinfo->out_color_space=JCS_EXT_BGR; break;
|
||||
case TJPF_RGBX:
|
||||
dinfo->out_color_space=JCS_EXT_RGBX; break;
|
||||
case TJPF_BGRX:
|
||||
dinfo->out_color_space=JCS_EXT_BGRX; break;
|
||||
case TJPF_XRGB:
|
||||
dinfo->out_color_space=JCS_EXT_XRGB; break;
|
||||
case TJPF_XBGR:
|
||||
dinfo->out_color_space=JCS_EXT_XBGR; break;
|
||||
#if JCS_ALPHA_EXTENSIONS==1
|
||||
case TJPF_RGBA:
|
||||
dinfo->out_color_space=JCS_EXT_RGBA; break;
|
||||
case TJPF_BGRA:
|
||||
dinfo->out_color_space=JCS_EXT_BGRA; break;
|
||||
case TJPF_ARGB:
|
||||
dinfo->out_color_space=JCS_EXT_ARGB; break;
|
||||
case TJPF_ABGR:
|
||||
dinfo->out_color_space=JCS_EXT_ABGR; break;
|
||||
#endif
|
||||
#else
|
||||
case TJPF_RGB:
|
||||
case TJPF_BGR:
|
||||
case TJPF_RGBX:
|
||||
case TJPF_BGRX:
|
||||
case TJPF_XRGB:
|
||||
case TJPF_XBGR:
|
||||
case TJPF_RGBA:
|
||||
case TJPF_BGRA:
|
||||
case TJPF_ARGB:
|
||||
case TJPF_ABGR:
|
||||
dinfo->out_color_space=JCS_RGB; break;
|
||||
#endif
|
||||
default:
|
||||
_throw("Unsupported pixel format");
|
||||
}
|
||||
|
||||
bailout:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static int getSubsamp(j_decompress_ptr dinfo)
|
||||
{
|
||||
int retval=-1, i, k;
|
||||
for(i=0; i<NUMSUBOPT; i++)
|
||||
{
|
||||
if(dinfo->num_components==pixelsize[i])
|
||||
{
|
||||
if(dinfo->comp_info[0].h_samp_factor==tjMCUWidth[i]/8
|
||||
&& dinfo->comp_info[0].v_samp_factor==tjMCUHeight[i]/8)
|
||||
{
|
||||
int match=0;
|
||||
for(k=1; k<dinfo->num_components; k++)
|
||||
{
|
||||
if(dinfo->comp_info[k].h_samp_factor==1
|
||||
&& dinfo->comp_info[k].v_samp_factor==1)
|
||||
match++;
|
||||
}
|
||||
if(match==dinfo->num_components-1)
|
||||
{
|
||||
retval=i; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
|
||||
/* Conversion functions to emulate the colorspace extensions. This allows the
|
||||
TurboJPEG wrapper to be used with libjpeg */
|
||||
|
||||
#define TORGB(PS, ROFFSET, GOFFSET, BOFFSET) { \
|
||||
int rowPad=pitch-width*PS; \
|
||||
while(height--) \
|
||||
{ \
|
||||
unsigned char *endOfRow=src+width*PS; \
|
||||
while(src<endOfRow) \
|
||||
{ \
|
||||
dst[RGB_RED]=src[ROFFSET]; \
|
||||
dst[RGB_GREEN]=src[GOFFSET]; \
|
||||
dst[RGB_BLUE]=src[BOFFSET]; \
|
||||
dst+=RGB_PIXELSIZE; src+=PS; \
|
||||
} \
|
||||
src+=rowPad; \
|
||||
} \
|
||||
}
|
||||
|
||||
static unsigned char *toRGB(unsigned char *src, int width, int pitch,
|
||||
int height, int pixelFormat, unsigned char *dst)
|
||||
{
|
||||
unsigned char *retval=src;
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case TJPF_RGB:
|
||||
#if RGB_RED!=0 || RGB_GREEN!=1 || RGB_BLUE!=2 || RGB_PIXELSIZE!=3
|
||||
retval=dst; TORGB(3, 0, 1, 2);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_BGR:
|
||||
#if RGB_RED!=2 || RGB_GREEN!=1 || RGB_BLUE!=0 || RGB_PIXELSIZE!=3
|
||||
retval=dst; TORGB(3, 2, 1, 0);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_RGBX:
|
||||
case TJPF_RGBA:
|
||||
#if RGB_RED!=0 || RGB_GREEN!=1 || RGB_BLUE!=2 || RGB_PIXELSIZE!=4
|
||||
retval=dst; TORGB(4, 0, 1, 2);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_BGRX:
|
||||
case TJPF_BGRA:
|
||||
#if RGB_RED!=2 || RGB_GREEN!=1 || RGB_BLUE!=0 || RGB_PIXELSIZE!=4
|
||||
retval=dst; TORGB(4, 2, 1, 0);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_XRGB:
|
||||
case TJPF_ARGB:
|
||||
#if RGB_RED!=1 || RGB_GREEN!=2 || RGB_BLUE!=3 || RGB_PIXELSIZE!=4
|
||||
retval=dst; TORGB(4, 1, 2, 3);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_XBGR:
|
||||
case TJPF_ABGR:
|
||||
#if RGB_RED!=3 || RGB_GREEN!=2 || RGB_BLUE!=1 || RGB_PIXELSIZE!=4
|
||||
retval=dst; TORGB(4, 3, 2, 1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define FROMRGB(PS, ROFFSET, GOFFSET, BOFFSET, SETALPHA) { \
|
||||
int rowPad=pitch-width*PS; \
|
||||
while(height--) \
|
||||
{ \
|
||||
unsigned char *endOfRow=dst+width*PS; \
|
||||
while(dst<endOfRow) \
|
||||
{ \
|
||||
dst[ROFFSET]=src[RGB_RED]; \
|
||||
dst[GOFFSET]=src[RGB_GREEN]; \
|
||||
dst[BOFFSET]=src[RGB_BLUE]; \
|
||||
SETALPHA \
|
||||
dst+=PS; src+=RGB_PIXELSIZE; \
|
||||
} \
|
||||
dst+=rowPad; \
|
||||
} \
|
||||
}
|
||||
|
||||
static void fromRGB(unsigned char *src, unsigned char *dst, int width,
|
||||
int pitch, int height, int pixelFormat)
|
||||
{
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case TJPF_RGB:
|
||||
#if RGB_RED!=0 || RGB_GREEN!=1 || RGB_BLUE!=2 || RGB_PIXELSIZE!=3
|
||||
FROMRGB(3, 0, 1, 2,);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_BGR:
|
||||
#if RGB_RED!=2 || RGB_GREEN!=1 || RGB_BLUE!=0 || RGB_PIXELSIZE!=3
|
||||
FROMRGB(3, 2, 1, 0,);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_RGBX:
|
||||
#if RGB_RED!=0 || RGB_GREEN!=1 || RGB_BLUE!=2 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 0, 1, 2,);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_RGBA:
|
||||
#if RGB_RED!=0 || RGB_GREEN!=1 || RGB_BLUE!=2 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 0, 1, 2, dst[3]=0xFF;);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_BGRX:
|
||||
#if RGB_RED!=2 || RGB_GREEN!=1 || RGB_BLUE!=0 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 2, 1, 0,);
|
||||
#endif
|
||||
break;
|
||||
case TJPF_BGRA:
|
||||
#if RGB_RED!=2 || RGB_GREEN!=1 || RGB_BLUE!=0 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 2, 1, 0, dst[3]=0xFF;); return;
|
||||
#endif
|
||||
break;
|
||||
case TJPF_XRGB:
|
||||
#if RGB_RED!=1 || RGB_GREEN!=2 || RGB_BLUE!=3 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 1, 2, 3,); return;
|
||||
#endif
|
||||
break;
|
||||
case TJPF_ARGB:
|
||||
#if RGB_RED!=1 || RGB_GREEN!=2 || RGB_BLUE!=3 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 1, 2, 3, dst[0]=0xFF;); return;
|
||||
#endif
|
||||
break;
|
||||
case TJPF_XBGR:
|
||||
#if RGB_RED!=3 || RGB_GREEN!=2 || RGB_BLUE!=1 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 3, 2, 1,); return;
|
||||
#endif
|
||||
break;
|
||||
case TJPF_ABGR:
|
||||
#if RGB_RED!=3 || RGB_GREEN!=2 || RGB_BLUE!=1 || RGB_PIXELSIZE!=4
|
||||
FROMRGB(4, 3, 2, 1, dst[0]=0xFF;); return;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* General API functions */
|
||||
|
||||
DLLEXPORT char* DLLCALL tjGetErrorStr(void)
|
||||
{
|
||||
return errStr;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT int DLLCALL tjDestroy(tjhandle handle)
|
||||
{
|
||||
getinstance(handle);
|
||||
if(setjmp(this->jerr.setjmp_buffer)) return -1;
|
||||
if(this->init&COMPRESS) jpeg_destroy_compress(cinfo);
|
||||
if(this->init&DECOMPRESS) jpeg_destroy_decompress(dinfo);
|
||||
free(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Compressor */
|
||||
|
||||
static boolean empty_output_buffer(j_compress_ptr cinfo)
|
||||
{
|
||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void dst_noop(j_compress_ptr cinfo)
|
||||
{
|
||||
}
|
||||
|
||||
static tjhandle _tjInitCompress(tjinstance *this)
|
||||
{
|
||||
/* This is also straight out of example.c */
|
||||
this->cinfo.err=jpeg_std_error(&this->jerr.pub);
|
||||
this->jerr.pub.error_exit=my_error_exit;
|
||||
this->jerr.pub.output_message=my_output_message;
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
if(this) free(this); return NULL;
|
||||
}
|
||||
|
||||
jpeg_create_compress(&this->cinfo);
|
||||
this->cinfo.dest=&this->jdst;
|
||||
this->jdst.init_destination=dst_noop;
|
||||
this->jdst.empty_output_buffer=empty_output_buffer;
|
||||
this->jdst.term_destination=dst_noop;
|
||||
|
||||
this->init|=COMPRESS;
|
||||
return (tjhandle)this;
|
||||
}
|
||||
|
||||
DLLEXPORT tjhandle DLLCALL tjInitCompress(void)
|
||||
{
|
||||
tjinstance *this=NULL;
|
||||
if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL)
|
||||
{
|
||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
||||
"tjInitCompress(): Memory allocation failure");
|
||||
return NULL;
|
||||
}
|
||||
MEMZERO(this, sizeof(tjinstance));
|
||||
return _tjInitCompress(this);
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height,
|
||||
int jpegSubsamp)
|
||||
{
|
||||
unsigned long retval=0; int mcuw, mcuh, chromasf;
|
||||
if(width<1 || height<1 || jpegSubsamp<0 || jpegSubsamp>=NUMSUBOPT)
|
||||
_throw("tjBufSize(): Invalid argument");
|
||||
|
||||
// This allows for rare corner cases in which a JPEG image can actually be
|
||||
// larger than the uncompressed input (we wouldn't mention it if it hadn't
|
||||
// happened before.)
|
||||
mcuw=tjMCUWidth[jpegSubsamp];
|
||||
mcuh=tjMCUHeight[jpegSubsamp];
|
||||
chromasf=jpegSubsamp==TJSAMP_GRAY? 0: 4*64/(mcuw*mcuh);
|
||||
retval=PAD(width, mcuw) * PAD(height, mcuh) * (2 + chromasf) + 2048;
|
||||
|
||||
bailout:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
|
||||
{
|
||||
unsigned long retval=0;
|
||||
if(width<1 || height<1)
|
||||
_throw("TJBUFSIZE(): Invalid argument");
|
||||
|
||||
// This allows for rare corner cases in which a JPEG image can actually be
|
||||
// larger than the uncompressed input (we wouldn't mention it if it hadn't
|
||||
// happened before.)
|
||||
retval=PAD(width, 16) * PAD(height, 16) * 6 + 2048;
|
||||
|
||||
bailout:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
|
||||
int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
|
||||
unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
|
||||
{
|
||||
int i, retval=0; JSAMPROW *row_pointer=NULL;
|
||||
#ifndef JCS_EXTENSIONS
|
||||
unsigned char *rgbBuf=NULL;
|
||||
#endif
|
||||
|
||||
getinstance(handle)
|
||||
if((this->init&COMPRESS)==0)
|
||||
_throw("tjCompress2(): Instance has not been initialized for compression");
|
||||
|
||||
if(srcBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0
|
||||
|| pixelFormat>=TJ_NUMPF || jpegBuf==NULL || jpegSize==NULL
|
||||
|| jpegSubsamp<0 || jpegSubsamp>=NUMSUBOPT || jpegQual<0 || jpegQual>100)
|
||||
_throw("tjCompress2(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if(pitch==0) pitch=width*tjPixelSize[pixelFormat];
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
if(pixelFormat!=TJPF_GRAY)
|
||||
{
|
||||
rgbBuf=(unsigned char *)malloc(width*height*RGB_PIXELSIZE);
|
||||
if(!rgbBuf) _throw("tjCompress2(): Memory allocation failure");
|
||||
srcBuf=toRGB(srcBuf, width, pitch, height, pixelFormat, rgbBuf);
|
||||
pitch=width*RGB_PIXELSIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
cinfo->image_width=width;
|
||||
cinfo->image_height=height;
|
||||
|
||||
if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
|
||||
else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
|
||||
else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
|
||||
|
||||
if(setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual)==-1)
|
||||
return -1;
|
||||
|
||||
this->jdst.next_output_byte=*jpegBuf;
|
||||
this->jdst.free_in_buffer=tjBufSize(width, height, jpegSubsamp);
|
||||
|
||||
jpeg_start_compress(cinfo, TRUE);
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
|
||||
_throw("tjCompress2(): Memory allocation failure");
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
|
||||
else row_pointer[i]=&srcBuf[i*pitch];
|
||||
}
|
||||
while(cinfo->next_scanline<cinfo->image_height)
|
||||
{
|
||||
jpeg_write_scanlines(cinfo, &row_pointer[cinfo->next_scanline],
|
||||
cinfo->image_height-cinfo->next_scanline);
|
||||
}
|
||||
jpeg_finish_compress(cinfo);
|
||||
*jpegSize=tjBufSize(width, height, jpegSubsamp)
|
||||
-(unsigned long)(this->jdst.free_in_buffer);
|
||||
|
||||
bailout:
|
||||
if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
|
||||
#ifndef JCS_EXTENSIONS
|
||||
if(rgbBuf) free(rgbBuf);
|
||||
#endif
|
||||
if(row_pointer) free(row_pointer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf,
|
||||
int width, int pitch, int height, int pixelSize, unsigned char *jpegBuf,
|
||||
unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
|
||||
{
|
||||
int retval=0; unsigned long size;
|
||||
retval=tjCompress2(handle, srcBuf, width, pitch, height,
|
||||
getPixelFormat(pixelSize, flags), &jpegBuf, &size, jpegSubsamp, jpegQual,
|
||||
flags);
|
||||
*jpegSize=size;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* Decompressor */
|
||||
|
||||
static boolean fill_input_buffer(j_decompress_ptr dinfo)
|
||||
{
|
||||
ERREXIT(dinfo, JERR_BUFFER_SIZE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void skip_input_data(j_decompress_ptr dinfo, long num_bytes)
|
||||
{
|
||||
dinfo->src->next_input_byte += (size_t) num_bytes;
|
||||
dinfo->src->bytes_in_buffer -= (size_t) num_bytes;
|
||||
}
|
||||
|
||||
static void src_noop(j_decompress_ptr dinfo)
|
||||
{
|
||||
}
|
||||
|
||||
static tjhandle _tjInitDecompress(tjinstance *this)
|
||||
{
|
||||
/* This is also straight out of example.c */
|
||||
this->dinfo.err=jpeg_std_error(&this->jerr.pub);
|
||||
this->jerr.pub.error_exit=my_error_exit;
|
||||
this->jerr.pub.output_message=my_output_message;
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
if(this) free(this); return NULL;
|
||||
}
|
||||
|
||||
jpeg_create_decompress(&this->dinfo);
|
||||
this->dinfo.src=&this->jsrc;
|
||||
this->jsrc.init_source=src_noop;
|
||||
this->jsrc.fill_input_buffer=fill_input_buffer;
|
||||
this->jsrc.skip_input_data=skip_input_data;
|
||||
this->jsrc.resync_to_restart=jpeg_resync_to_restart;
|
||||
this->jsrc.term_source=src_noop;
|
||||
|
||||
this->init|=DECOMPRESS;
|
||||
return (tjhandle)this;
|
||||
}
|
||||
|
||||
DLLEXPORT tjhandle DLLCALL tjInitDecompress(void)
|
||||
{
|
||||
tjinstance *this;
|
||||
if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL)
|
||||
{
|
||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
||||
"tjInitDecompress(): Memory allocation failure");
|
||||
return NULL;
|
||||
}
|
||||
MEMZERO(this, sizeof(tjinstance));
|
||||
return _tjInitDecompress(this);
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height,
|
||||
int *jpegSubsamp)
|
||||
{
|
||||
int retval=0;
|
||||
|
||||
getinstance(handle);
|
||||
if((this->init&DECOMPRESS)==0)
|
||||
_throw("tjDecompressHeader2(): Instance has not been initialized for decompression");
|
||||
|
||||
if(jpegBuf==NULL || jpegSize<=0 || width==NULL || height==NULL
|
||||
|| jpegSubsamp==NULL)
|
||||
_throw("tjDecompressHeader2(): Invalid argument");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
this->jsrc.bytes_in_buffer=jpegSize;
|
||||
this->jsrc.next_input_byte=jpegBuf;
|
||||
jpeg_read_header(dinfo, TRUE);
|
||||
|
||||
*width=dinfo->image_width;
|
||||
*height=dinfo->image_height;
|
||||
*jpegSubsamp=getSubsamp(dinfo);
|
||||
|
||||
jpeg_abort_decompress(dinfo);
|
||||
|
||||
if(*jpegSubsamp<0)
|
||||
_throw("tjDecompressHeader2(): Could not determine subsampling type for JPEG image");
|
||||
if(*width<1 || *height<1)
|
||||
_throw("tjDecompressHeader2(): Invalid data returned in header");
|
||||
|
||||
bailout:
|
||||
return retval;
|
||||
}
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height)
|
||||
{
|
||||
int jpegSubsamp;
|
||||
return tjDecompressHeader2(handle, jpegBuf, jpegSize, width, height,
|
||||
&jpegSubsamp);
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors)
|
||||
{
|
||||
if(numscalingfactors==NULL)
|
||||
{
|
||||
snprintf(errStr, JMSG_LENGTH_MAX,
|
||||
"tjGetScalingFactors(): Invalid argument");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*numscalingfactors=NUMSF;
|
||||
return (tjscalingfactor *)sf;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch,
|
||||
int height, int pixelFormat, int flags)
|
||||
{
|
||||
int i, retval=0; JSAMPROW *row_pointer=NULL;
|
||||
int jpegwidth, jpegheight, scaledw, scaledh;
|
||||
#ifndef JCS_EXTENSIONS
|
||||
unsigned char *rgbBuf=NULL;
|
||||
unsigned char *_dstBuf=NULL; int _pitch=0;
|
||||
#endif
|
||||
|
||||
getinstance(handle);
|
||||
if((this->init&DECOMPRESS)==0)
|
||||
_throw("tjDecompress2(): Instance has not been initialized for decompression");
|
||||
|
||||
if(jpegBuf==NULL || jpegSize<=0 || dstBuf==NULL || width<0 || pitch<0
|
||||
|| height<0 || pixelFormat<0 || pixelFormat>=TJ_NUMPF)
|
||||
_throw("tjDecompress2(): Invalid argument");
|
||||
|
||||
if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
|
||||
else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
|
||||
else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
|
||||
|
||||
if(setjmp(this->jerr.setjmp_buffer))
|
||||
{
|
||||
/* If we get here, the JPEG code has signaled an error. */
|
||||
retval=-1;
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
this->jsrc.bytes_in_buffer=jpegSize;
|
||||
this->jsrc.next_input_byte=jpegBuf;
|
||||
jpeg_read_header(dinfo, TRUE);
|
||||
if(setDecompDefaults(dinfo, pixelFormat)==-1)
|
||||
{
|
||||
retval=-1; goto bailout;
|
||||
}
|
||||
|
||||
if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
|
||||
|
||||
jpegwidth=dinfo->image_width; jpegheight=dinfo->image_height;
|
||||
if(width==0) width=jpegwidth;
|
||||
if(height==0) height=jpegheight;
|
||||
for(i=0; i<NUMSF; i++)
|
||||
{
|
||||
scaledw=TJSCALED(jpegwidth, sf[i]);
|
||||
scaledh=TJSCALED(jpegheight, sf[i]);
|
||||
if(scaledw<=width && scaledh<=height)
|
||||
break;
|
||||
}
|
||||
if(scaledw>width || scaledh>height)
|
||||
_throw("tjDecompress2(): Could not scale down to desired image dimensions");
|
||||
width=scaledw; height=scaledh;
|
||||
dinfo->scale_num=sf[i].num;
|
||||
dinfo->scale_denom=sf[i].denom;
|
||||
|
||||
jpeg_start_decompress(dinfo);
|
||||
if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat];
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
if(pixelFormat!=TJPF_GRAY &&
|
||||
(RGB_RED!=tjRedOffset[pixelFormat] ||
|
||||
RGB_GREEN!=tjGreenOffset[pixelFormat] ||
|
||||
RGB_BLUE!=tjBlueOffset[pixelFormat] ||
|
||||
RGB_PIXELSIZE!=tjPixelSize[pixelFormat]))
|
||||
{
|
||||
rgbBuf=(unsigned char *)malloc(width*height*3);
|
||||
if(!rgbBuf) _throw("tjDecompress2(): Memory allocation failure");
|
||||
_pitch=pitch; pitch=width*3;
|
||||
_dstBuf=dstBuf; dstBuf=rgbBuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)
|
||||
*dinfo->output_height))==NULL)
|
||||
_throw("tjDecompress2(): Memory allocation failure");
|
||||
for(i=0; i<(int)dinfo->output_height; i++)
|
||||
{
|
||||
if(flags&TJFLAG_BOTTOMUP)
|
||||
row_pointer[i]=&dstBuf[(dinfo->output_height-i-1)*pitch];
|
||||
else row_pointer[i]=&dstBuf[i*pitch];
|
||||
}
|
||||
while(dinfo->output_scanline<dinfo->output_height)
|
||||
{
|
||||
jpeg_read_scanlines(dinfo, &row_pointer[dinfo->output_scanline],
|
||||
dinfo->output_height-dinfo->output_scanline);
|
||||
}
|
||||
jpeg_finish_decompress(dinfo);
|
||||
|
||||
#ifndef JCS_EXTENSIONS
|
||||
fromRGB(rgbBuf, _dstBuf, width, _pitch, height, pixelFormat);
|
||||
#endif
|
||||
|
||||
bailout:
|
||||
if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
|
||||
#ifndef JCS_EXTENSIONS
|
||||
if(rgbBuf) free(rgbBuf);
|
||||
#endif
|
||||
if(row_pointer) free(row_pointer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompress(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch,
|
||||
int height, int pixelSize, int flags)
|
||||
{
|
||||
return tjDecompress2(handle, jpegBuf, jpegSize, dstBuf, width, pitch,
|
||||
height, getPixelFormat(pixelSize, flags), flags);
|
||||
}
|
529
jni/vnc/LibVNCServer-0.9.9/common/turbojpeg.h
Normal file
529
jni/vnc/LibVNCServer-0.9.9/common/turbojpeg.h
Normal file
@ -0,0 +1,529 @@
|
||||
/*
|
||||
* Copyright (C)2009-2012 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __TURBOJPEG_H__
|
||||
#define __TURBOJPEG_H__
|
||||
|
||||
#if defined(_WIN32) && defined(DLLDEFINE)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#endif
|
||||
#define DLLCALL
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup TurboJPEG Lite
|
||||
* TurboJPEG API. This API provides an interface for generating and decoding
|
||||
* JPEG images in memory.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The number of chrominance subsampling options
|
||||
*/
|
||||
#define TJ_NUMSAMP 5
|
||||
|
||||
/**
|
||||
* Chrominance subsampling options.
|
||||
* When an image is converted from the RGB to the YCbCr colorspace as part of
|
||||
* the JPEG compression process, some of the Cb and Cr (chrominance) components
|
||||
* can be discarded or averaged together to produce a smaller image with little
|
||||
* perceptible loss of image clarity (the human eye is more sensitive to small
|
||||
* changes in brightness than small changes in color.) This is called
|
||||
* "chrominance subsampling".
|
||||
*/
|
||||
enum TJSAMP
|
||||
{
|
||||
/**
|
||||
* 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or
|
||||
* YUV image will contain one chrominance component for every pixel in the
|
||||
* source image.
|
||||
*/
|
||||
TJSAMP_444=0,
|
||||
/**
|
||||
* 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one
|
||||
* chrominance component for every 2x1 block of pixels in the source image.
|
||||
*/
|
||||
TJSAMP_422,
|
||||
/**
|
||||
* 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one
|
||||
* chrominance component for every 2x2 block of pixels in the source image.
|
||||
*/
|
||||
TJSAMP_420,
|
||||
/**
|
||||
* Grayscale. The JPEG or YUV image will contain no chrominance components.
|
||||
*/
|
||||
TJSAMP_GRAY,
|
||||
/**
|
||||
* 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one
|
||||
* chrominance component for every 1x2 block of pixels in the source image.
|
||||
*/
|
||||
TJSAMP_440
|
||||
};
|
||||
|
||||
/**
|
||||
* MCU block width (in pixels) for a given level of chrominance subsampling.
|
||||
* MCU block sizes:
|
||||
* - 8x8 for no subsampling or grayscale
|
||||
* - 16x8 for 4:2:2
|
||||
* - 8x16 for 4:4:0
|
||||
* - 16x16 for 4:2:0
|
||||
*/
|
||||
static const int tjMCUWidth[TJ_NUMSAMP] = {8, 16, 16, 8, 8};
|
||||
|
||||
/**
|
||||
* MCU block height (in pixels) for a given level of chrominance subsampling.
|
||||
* MCU block sizes:
|
||||
* - 8x8 for no subsampling or grayscale
|
||||
* - 16x8 for 4:2:2
|
||||
* - 8x16 for 4:4:0
|
||||
* - 16x16 for 4:2:0
|
||||
*/
|
||||
static const int tjMCUHeight[TJ_NUMSAMP] = {8, 8, 16, 8, 16};
|
||||
|
||||
|
||||
/**
|
||||
* The number of pixel formats
|
||||
*/
|
||||
#define TJ_NUMPF 11
|
||||
|
||||
/**
|
||||
* Pixel formats
|
||||
*/
|
||||
enum TJPF
|
||||
{
|
||||
/**
|
||||
* RGB pixel format. The red, green, and blue components in the image are
|
||||
* stored in 3-byte pixels in the order R, G, B from lowest to highest byte
|
||||
* address within each pixel.
|
||||
*/
|
||||
TJPF_RGB=0,
|
||||
/**
|
||||
* BGR pixel format. The red, green, and blue components in the image are
|
||||
* stored in 3-byte pixels in the order B, G, R from lowest to highest byte
|
||||
* address within each pixel.
|
||||
*/
|
||||
TJPF_BGR,
|
||||
/**
|
||||
* RGBX pixel format. The red, green, and blue components in the image are
|
||||
* stored in 4-byte pixels in the order R, G, B from lowest to highest byte
|
||||
* address within each pixel. The X component is ignored when compressing
|
||||
* and undefined when decompressing.
|
||||
*/
|
||||
TJPF_RGBX,
|
||||
/**
|
||||
* BGRX pixel format. The red, green, and blue components in the image are
|
||||
* stored in 4-byte pixels in the order B, G, R from lowest to highest byte
|
||||
* address within each pixel. The X component is ignored when compressing
|
||||
* and undefined when decompressing.
|
||||
*/
|
||||
TJPF_BGRX,
|
||||
/**
|
||||
* XBGR pixel format. The red, green, and blue components in the image are
|
||||
* stored in 4-byte pixels in the order R, G, B from highest to lowest byte
|
||||
* address within each pixel. The X component is ignored when compressing
|
||||
* and undefined when decompressing.
|
||||
*/
|
||||
TJPF_XBGR,
|
||||
/**
|
||||
* XRGB pixel format. The red, green, and blue components in the image are
|
||||
* stored in 4-byte pixels in the order B, G, R from highest to lowest byte
|
||||
* address within each pixel. The X component is ignored when compressing
|
||||
* and undefined when decompressing.
|
||||
*/
|
||||
TJPF_XRGB,
|
||||
/**
|
||||
* Grayscale pixel format. Each 1-byte pixel represents a luminance
|
||||
* (brightness) level from 0 to 255.
|
||||
*/
|
||||
TJPF_GRAY,
|
||||
/**
|
||||
* RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when
|
||||
* decompressing, the X component is guaranteed to be 0xFF, which can be
|
||||
* interpreted as an opaque alpha channel.
|
||||
*/
|
||||
TJPF_RGBA,
|
||||
/**
|
||||
* BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when
|
||||
* decompressing, the X component is guaranteed to be 0xFF, which can be
|
||||
* interpreted as an opaque alpha channel.
|
||||
*/
|
||||
TJPF_BGRA,
|
||||
/**
|
||||
* ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when
|
||||
* decompressing, the X component is guaranteed to be 0xFF, which can be
|
||||
* interpreted as an opaque alpha channel.
|
||||
*/
|
||||
TJPF_ABGR,
|
||||
/**
|
||||
* ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when
|
||||
* decompressing, the X component is guaranteed to be 0xFF, which can be
|
||||
* interpreted as an opaque alpha channel.
|
||||
*/
|
||||
TJPF_ARGB
|
||||
};
|
||||
|
||||
/**
|
||||
* Red offset (in bytes) for a given pixel format. This specifies the number
|
||||
* of bytes that the red component is offset from the start of the pixel. For
|
||||
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
||||
* then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>.
|
||||
*/
|
||||
static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1};
|
||||
/**
|
||||
* Green offset (in bytes) for a given pixel format. This specifies the number
|
||||
* of bytes that the green component is offset from the start of the pixel.
|
||||
* For instance, if a pixel of format TJ_BGRX is stored in
|
||||
* <tt>char pixel[]</tt>, then the green component will be
|
||||
* <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>.
|
||||
*/
|
||||
static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2};
|
||||
/**
|
||||
* Blue offset (in bytes) for a given pixel format. This specifies the number
|
||||
* of bytes that the Blue component is offset from the start of the pixel. For
|
||||
* instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
|
||||
* then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>.
|
||||
*/
|
||||
static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3};
|
||||
|
||||
/**
|
||||
* Pixel size (in bytes) for a given pixel format.
|
||||
*/
|
||||
static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4};
|
||||
|
||||
|
||||
/**
|
||||
* The uncompressed source/destination image is stored in bottom-up (Windows,
|
||||
* OpenGL) order, not top-down (X11) order.
|
||||
*/
|
||||
#define TJFLAG_BOTTOMUP 2
|
||||
/**
|
||||
* Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and
|
||||
* 32-bit libjpeg-turbo versions only.)
|
||||
*/
|
||||
#define TJFLAG_FORCEMMX 8
|
||||
/**
|
||||
* Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP
|
||||
* and 32-bit libjpeg-turbo versions only)
|
||||
*/
|
||||
#define TJFLAG_FORCESSE 16
|
||||
/**
|
||||
* Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP
|
||||
* and 32-bit libjpeg-turbo versions only)
|
||||
*/
|
||||
#define TJFLAG_FORCESSE2 32
|
||||
/**
|
||||
* Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP
|
||||
* version only)
|
||||
*/
|
||||
#define TJFLAG_FORCESSE3 128
|
||||
/**
|
||||
* Use fast, inaccurate chrominance upsampling routines in the JPEG
|
||||
* decompressor (libjpeg and libjpeg-turbo versions only)
|
||||
*/
|
||||
#define TJFLAG_FASTUPSAMPLE 256
|
||||
|
||||
|
||||
/**
|
||||
* Scaling factor
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* Numerator
|
||||
*/
|
||||
int num;
|
||||
/**
|
||||
* Denominator
|
||||
*/
|
||||
int denom;
|
||||
} tjscalingfactor;
|
||||
|
||||
|
||||
/**
|
||||
* TurboJPEG instance handle
|
||||
*/
|
||||
typedef void* tjhandle;
|
||||
|
||||
|
||||
/**
|
||||
* Pad the given width to the nearest 32-bit boundary
|
||||
*/
|
||||
#define TJPAD(width) (((width)+3)&(~3))
|
||||
|
||||
/**
|
||||
* Compute the scaled value of <tt>dimension</tt> using the given scaling
|
||||
* factor. This macro performs the integer equivalent of <tt>ceil(dimension *
|
||||
* scalingFactor)</tt>.
|
||||
*/
|
||||
#define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \
|
||||
+ scalingFactor.denom - 1) / scalingFactor.denom)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG compressor instance.
|
||||
*
|
||||
* @return a handle to the newly-created instance, or NULL if an error
|
||||
* occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
|
||||
|
||||
|
||||
/**
|
||||
* Compress an RGB or grayscale image into a JPEG image.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG compressor or transformer instance
|
||||
* @param srcBuf pointer to an image buffer containing RGB or grayscale pixels
|
||||
* to be compressed
|
||||
* @param width width (in pixels) of the source image
|
||||
* @param pitch bytes per line of the source image. Normally, this should be
|
||||
* <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded,
|
||||
* or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of
|
||||
* the image is padded to the nearest 32-bit boundary, as is the case
|
||||
* for Windows bitmaps. You can also be clever and use this parameter
|
||||
* to skip lines, etc. Setting this parameter to 0 is the equivalent of
|
||||
* setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>.
|
||||
* @param height height (in pixels) of the source image
|
||||
* @param pixelFormat pixel format of the source image (see @ref TJPF
|
||||
* "Pixel formats".)
|
||||
* @param jpegBuf address of a pointer to an image buffer that will receive the
|
||||
* JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer
|
||||
* to accommodate the size of the JPEG image. Thus, you can choose to:
|
||||
* -# pre-allocate the JPEG buffer with an arbitrary size using
|
||||
* #tjAlloc() and let TurboJPEG grow the buffer as needed,
|
||||
* -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the
|
||||
* buffer for you, or
|
||||
* -# pre-allocate the buffer to a "worst case" size determined by
|
||||
* calling #tjBufSize(). This should ensure that the buffer never has
|
||||
* to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
|
||||
* .
|
||||
* If you choose option 1, <tt>*jpegSize</tt> should be set to the
|
||||
* size of your pre-allocated buffer. In any case, unless you have
|
||||
* set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon
|
||||
* return from this function, as it may have changed.
|
||||
* @param jpegSize pointer to an unsigned long variable that holds the size of
|
||||
* the JPEG image buffer. If <tt>*jpegBuf</tt> points to a
|
||||
* pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
|
||||
* size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the
|
||||
* size of the JPEG image (in bytes.)
|
||||
* @param jpegSubsamp the level of chrominance subsampling to be used when
|
||||
* generating the JPEG image (see @ref TJSAMP
|
||||
* "Chrominance subsampling options".)
|
||||
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
|
||||
100 = best)
|
||||
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
|
||||
* "flags".
|
||||
*
|
||||
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
|
||||
int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
|
||||
unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags);
|
||||
|
||||
|
||||
/**
|
||||
* The maximum size of the buffer (in bytes) required to hold a JPEG image with
|
||||
* the given parameters. The number of bytes returned by this function is
|
||||
* larger than the size of the uncompressed source image. The reason for this
|
||||
* is that the JPEG format uses 16-bit coefficients, and it is thus possible
|
||||
* for a very high-quality JPEG image with very high frequency content to
|
||||
* expand rather than compress when converted to the JPEG format. Such images
|
||||
* represent a very rare corner case, but since there is no way to predict the
|
||||
* size of a JPEG image prior to compression, the corner case has to be
|
||||
* handled.
|
||||
*
|
||||
* @param width width of the image (in pixels)
|
||||
* @param height height of the image (in pixels)
|
||||
* @param jpegSubsamp the level of chrominance subsampling to be used when
|
||||
* generating the JPEG image (see @ref TJSAMP
|
||||
* "Chrominance subsampling options".)
|
||||
*
|
||||
* @return the maximum size of the buffer (in bytes) required to hold the
|
||||
* image, or -1 if the arguments are out of bounds.
|
||||
*/
|
||||
DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height,
|
||||
int jpegSubsamp);
|
||||
|
||||
|
||||
/**
|
||||
* Create a TurboJPEG decompressor instance.
|
||||
*
|
||||
* @return a handle to the newly-created instance, or NULL if an error
|
||||
* occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT tjhandle DLLCALL tjInitDecompress(void);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve information about a JPEG image without decompressing it.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG decompressor or transformer instance
|
||||
* @param jpegBuf pointer to a buffer containing a JPEG image
|
||||
* @param jpegSize size of the JPEG image (in bytes)
|
||||
* @param width pointer to an integer variable that will receive the width (in
|
||||
* pixels) of the JPEG image
|
||||
* @param height pointer to an integer variable that will receive the height
|
||||
* (in pixels) of the JPEG image
|
||||
* @param jpegSubsamp pointer to an integer variable that will receive the
|
||||
* level of chrominance subsampling used when compressing the JPEG image
|
||||
* (see @ref TJSAMP "Chrominance subsampling options".)
|
||||
*
|
||||
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height,
|
||||
int *jpegSubsamp);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of fractional scaling factors that the JPEG decompressor in
|
||||
* this implementation of TurboJPEG supports.
|
||||
*
|
||||
* @param numscalingfactors pointer to an integer variable that will receive
|
||||
* the number of elements in the list
|
||||
*
|
||||
* @return a pointer to a list of fractional scaling factors, or NULL if an
|
||||
* error is encountered (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors);
|
||||
|
||||
|
||||
/**
|
||||
* Decompress a JPEG image to an RGB or grayscale image.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG decompressor or transformer instance
|
||||
* @param jpegBuf pointer to a buffer containing the JPEG image to decompress
|
||||
* @param jpegSize size of the JPEG image (in bytes)
|
||||
* @param dstBuf pointer to an image buffer that will receive the decompressed
|
||||
* image. This buffer should normally be <tt>pitch * scaledHeight</tt>
|
||||
* bytes in size, where <tt>scaledHeight</tt> can be determined by
|
||||
* calling #TJSCALED() with the JPEG image height and one of the scaling
|
||||
* factors returned by #tjGetScalingFactors(). The dstBuf pointer may
|
||||
* also be used to decompress into a specific region of a larger buffer.
|
||||
* @param width desired width (in pixels) of the destination image. If this is
|
||||
* smaller than the width of the JPEG image being decompressed, then
|
||||
* TurboJPEG will use scaling in the JPEG decompressor to generate the
|
||||
* largest possible image that will fit within the desired width. If
|
||||
* width is set to 0, then only the height will be considered when
|
||||
* determining the scaled image size.
|
||||
* @param pitch bytes per line of the destination image. Normally, this is
|
||||
* <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt> if the decompressed
|
||||
* image is unpadded, else <tt>#TJPAD(scaledWidth *
|
||||
* #tjPixelSize[pixelFormat])</tt> if each line of the decompressed
|
||||
* image is padded to the nearest 32-bit boundary, as is the case for
|
||||
* Windows bitmaps. (NOTE: <tt>scaledWidth</tt> can be determined by
|
||||
* calling #TJSCALED() with the JPEG image width and one of the scaling
|
||||
* factors returned by #tjGetScalingFactors().) You can also be clever
|
||||
* and use the pitch parameter to skip lines, etc. Setting this
|
||||
* parameter to 0 is the equivalent of setting it to <tt>scaledWidth
|
||||
* * #tjPixelSize[pixelFormat]</tt>.
|
||||
* @param height desired height (in pixels) of the destination image. If this
|
||||
* is smaller than the height of the JPEG image being decompressed, then
|
||||
* TurboJPEG will use scaling in the JPEG decompressor to generate the
|
||||
* largest possible image that will fit within the desired height. If
|
||||
* height is set to 0, then only the width will be considered when
|
||||
* determining the scaled image size.
|
||||
* @param pixelFormat pixel format of the destination image (see @ref
|
||||
* TJPF "Pixel formats".)
|
||||
* @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
|
||||
* "flags".
|
||||
*
|
||||
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
|
||||
int width, int pitch, int height, int pixelFormat, int flags);
|
||||
|
||||
|
||||
/**
|
||||
* Destroy a TurboJPEG compressor, decompressor, or transformer instance.
|
||||
*
|
||||
* @param handle a handle to a TurboJPEG compressor, decompressor or
|
||||
* transformer instance
|
||||
*
|
||||
* @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
|
||||
*/
|
||||
DLLEXPORT int DLLCALL tjDestroy(tjhandle handle);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a descriptive error message explaining why the last command failed.
|
||||
*
|
||||
* @return a descriptive error message explaining why the last command failed.
|
||||
*/
|
||||
DLLEXPORT char* DLLCALL tjGetErrorStr(void);
|
||||
|
||||
|
||||
/* Backward compatibility functions and macros (nothing to see here) */
|
||||
#define NUMSUBOPT TJ_NUMSAMP
|
||||
#define TJ_444 TJSAMP_444
|
||||
#define TJ_422 TJSAMP_422
|
||||
#define TJ_420 TJSAMP_420
|
||||
#define TJ_411 TJSAMP_420
|
||||
#define TJ_GRAYSCALE TJSAMP_GRAY
|
||||
|
||||
#define TJ_BGR 1
|
||||
#define TJ_BOTTOMUP TJFLAG_BOTTOMUP
|
||||
#define TJ_FORCEMMX TJFLAG_FORCEMMX
|
||||
#define TJ_FORCESSE TJFLAG_FORCESSE
|
||||
#define TJ_FORCESSE2 TJFLAG_FORCESSE2
|
||||
#define TJ_ALPHAFIRST 64
|
||||
#define TJ_FORCESSE3 TJFLAG_FORCESSE3
|
||||
#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE
|
||||
|
||||
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
|
||||
|
||||
DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf,
|
||||
int width, int pitch, int height, int pixelSize, unsigned char *dstBuf,
|
||||
unsigned long *compressedSize, int jpegSubsamp, int jpegQual, int flags);
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height);
|
||||
|
||||
DLLEXPORT int DLLCALL tjDecompress(tjhandle handle,
|
||||
unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
|
||||
int width, int pitch, int height, int pixelSize, int flags);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
211
jni/vnc/LibVNCServer-0.9.9/common/vncauth.c
Normal file
211
jni/vnc/LibVNCServer-0.9.9/common/vncauth.c
Normal file
@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* vncauth.c - Functions for VNC password management and authentication.
|
||||
*/
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#define _POSIX_SOURCE
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <rfb/rfbproto.h>
|
||||
#include "d3des.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define srandom srand
|
||||
#define random rand
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* libvncclient does not need this */
|
||||
#ifndef rfbEncryptBytes
|
||||
|
||||
/*
|
||||
* We use a fixed key to store passwords, since we assume that our local
|
||||
* file system is secure but nonetheless don't want to store passwords
|
||||
* as plaintext.
|
||||
*/
|
||||
|
||||
static unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
|
||||
|
||||
|
||||
/*
|
||||
* Encrypt a password and store it in a file. Returns 0 if successful,
|
||||
* 1 if the file could not be written.
|
||||
*/
|
||||
|
||||
int
|
||||
rfbEncryptAndStorePasswd(char *passwd, char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
unsigned int i;
|
||||
unsigned char encryptedPasswd[8];
|
||||
|
||||
if ((fp = fopen(fname,"w")) == NULL) return 1;
|
||||
|
||||
/* windows security sux */
|
||||
#ifndef WIN32
|
||||
fchmod(fileno(fp), S_IRUSR|S_IWUSR);
|
||||
#endif
|
||||
|
||||
/* pad password with nulls */
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (i < strlen(passwd)) {
|
||||
encryptedPasswd[i] = passwd[i];
|
||||
} else {
|
||||
encryptedPasswd[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do encryption in-place - this way we overwrite our copy of the plaintext
|
||||
password */
|
||||
|
||||
rfbDesKey(fixedkey, EN0);
|
||||
rfbDes(encryptedPasswd, encryptedPasswd);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
putc(encryptedPasswd[i], fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Decrypt a password from a file. Returns a pointer to a newly allocated
|
||||
* string containing the password or a null pointer if the password could
|
||||
* not be retrieved for some reason.
|
||||
*/
|
||||
|
||||
char *
|
||||
rfbDecryptPasswdFromFile(char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
int i, ch;
|
||||
unsigned char *passwd = (unsigned char *)malloc(9);
|
||||
|
||||
if ((fp = fopen(fname,"r")) == NULL) {
|
||||
free(passwd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
ch = getc(fp);
|
||||
if (ch == EOF) {
|
||||
fclose(fp);
|
||||
free(passwd);
|
||||
return NULL;
|
||||
}
|
||||
passwd[i] = ch;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
rfbDesKey(fixedkey, DE1);
|
||||
rfbDes(passwd, passwd);
|
||||
|
||||
passwd[8] = 0;
|
||||
|
||||
return (char *)passwd;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Generate CHALLENGESIZE random bytes for use in challenge-response
|
||||
* authentication.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbRandomBytes(unsigned char *bytes)
|
||||
{
|
||||
int i;
|
||||
static rfbBool s_srandom_called = FALSE;
|
||||
|
||||
if (!s_srandom_called) {
|
||||
srandom((unsigned int)time(NULL) ^ (unsigned int)getpid());
|
||||
s_srandom_called = TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < CHALLENGESIZE; i++) {
|
||||
bytes[i] = (unsigned char)(random() & 255);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Encrypt CHALLENGESIZE bytes in memory using a password.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbEncryptBytes(unsigned char *bytes, char *passwd)
|
||||
{
|
||||
unsigned char key[8];
|
||||
unsigned int i;
|
||||
|
||||
/* key is simply password padded with nulls */
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (i < strlen(passwd)) {
|
||||
key[i] = passwd[i];
|
||||
} else {
|
||||
key[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
rfbDesKey(key, EN0);
|
||||
|
||||
for (i = 0; i < CHALLENGESIZE; i += 8) {
|
||||
rfbDes(bytes+i, bytes+i);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rfbEncryptBytes2(unsigned char *where, const int length, unsigned char *key) {
|
||||
int i, j;
|
||||
rfbDesKey(key, EN0);
|
||||
for (i = 0; i< 8; i++)
|
||||
where[i] ^= key[i];
|
||||
rfbDes(where, where);
|
||||
for (i = 8; i < length; i += 8) {
|
||||
for (j = 0; j < 8; j++)
|
||||
where[i + j] ^= where[i + j - 8];
|
||||
rfbDes(where + i, where + i);
|
||||
}
|
||||
}
|
828
jni/vnc/LibVNCServer-0.9.9/common/zywrletemplate.c
Normal file
828
jni/vnc/LibVNCServer-0.9.9/common/zywrletemplate.c
Normal file
@ -0,0 +1,828 @@
|
||||
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE 'ZYWRLE' VNC CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A FOLLOWING BSD-STYLE SOURCE LICENSE. *
|
||||
* PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE 'ZYWRLE' VNC CODEC SOURCE CODE IS (C) COPYRIGHT 2006 *
|
||||
* BY Hitachi Systems & Services, Ltd. *
|
||||
* (Noriaki Yamazaki, Research & Developement Center) * *
|
||||
* *
|
||||
********************************************************************
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Hitachi Systems & Services, Ltd. nor
|
||||
the names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
********************************************************************/
|
||||
|
||||
/* Change Log:
|
||||
V0.02 : 2008/02/04 : Fix mis encode/decode when width != scanline
|
||||
(Thanks Johannes Schindelin, author of LibVNC
|
||||
Server/Client)
|
||||
V0.01 : 2007/02/06 : Initial release
|
||||
*/
|
||||
|
||||
/* #define ZYWRLE_ENCODE */
|
||||
/* #define ZYWRLE_DECODE */
|
||||
#define ZYWRLE_QUANTIZE
|
||||
|
||||
/*
|
||||
[References]
|
||||
PLHarr:
|
||||
Senecal, J. G., P. Lindstrom, M. A. Duchaineau, and K. I. Joy, "An Improved N-Bit to N-Bit Reversible Haar-Like Transform," Pacific Graphics 2004, October 2004, pp. 371-380.
|
||||
EZW:
|
||||
Shapiro, JM: Embedded Image Coding Using Zerotrees of Wavelet Coefficients, IEEE Trans. Signal. Process., Vol.41, pp.3445-3462 (1993).
|
||||
*/
|
||||
|
||||
|
||||
/* Template Macro stuffs. */
|
||||
#undef ZYWRLE_ANALYZE
|
||||
#undef ZYWRLE_SYNTHESIZE
|
||||
#define ZYWRLE_ANALYZE __RFB_CONCAT3E(zywrleAnalyze,BPP,END_FIX)
|
||||
#define ZYWRLE_SYNTHESIZE __RFB_CONCAT3E(zywrleSynthesize,BPP,END_FIX)
|
||||
|
||||
#define ZYWRLE_RGBYUV __RFB_CONCAT3E(zywrleRGBYUV,BPP,END_FIX)
|
||||
#define ZYWRLE_YUVRGB __RFB_CONCAT3E(zywrleYUVRGB,BPP,END_FIX)
|
||||
#define ZYWRLE_YMASK __RFB_CONCAT2E(ZYWRLE_YMASK,BPP)
|
||||
#define ZYWRLE_UVMASK __RFB_CONCAT2E(ZYWRLE_UVMASK,BPP)
|
||||
#define ZYWRLE_LOAD_PIXEL __RFB_CONCAT2E(ZYWRLE_LOAD_PIXEL,BPP)
|
||||
#define ZYWRLE_SAVE_PIXEL __RFB_CONCAT2E(ZYWRLE_SAVE_PIXEL,BPP)
|
||||
|
||||
/* Packing/Unpacking pixel stuffs.
|
||||
Endian conversion stuffs. */
|
||||
#undef S_0
|
||||
#undef S_1
|
||||
#undef L_0
|
||||
#undef L_1
|
||||
#undef L_2
|
||||
#if ZYWRLE_ENDIAN == ENDIAN_BIG
|
||||
# define S_0 1
|
||||
# define S_1 0
|
||||
# define L_0 3
|
||||
# define L_1 2
|
||||
# define L_2 1
|
||||
#else
|
||||
# define S_0 0
|
||||
# define S_1 1
|
||||
# define L_0 0
|
||||
# define L_1 1
|
||||
# define L_2 2
|
||||
#endif
|
||||
|
||||
/* Load/Save pixel stuffs. */
|
||||
#define ZYWRLE_YMASK15 0xFFFFFFF8
|
||||
#define ZYWRLE_UVMASK15 0xFFFFFFF8
|
||||
#define ZYWRLE_LOAD_PIXEL15(pSrc,R,G,B) { \
|
||||
R = (((unsigned char*)pSrc)[S_1]<< 1)& 0xF8; \
|
||||
G = ((((unsigned char*)pSrc)[S_1]<< 6)|(((unsigned char*)pSrc)[S_0]>> 2))& 0xF8; \
|
||||
B = (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8; \
|
||||
}
|
||||
#define ZYWRLE_SAVE_PIXEL15(pDst,R,G,B) { \
|
||||
R &= 0xF8; \
|
||||
G &= 0xF8; \
|
||||
B &= 0xF8; \
|
||||
((unsigned char*)pDst)[S_1] = (unsigned char)( (R>>1)|(G>>6) ); \
|
||||
((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<2))& 0xFF); \
|
||||
}
|
||||
#define ZYWRLE_YMASK16 0xFFFFFFFC
|
||||
#define ZYWRLE_UVMASK16 0xFFFFFFF8
|
||||
#define ZYWRLE_LOAD_PIXEL16(pSrc,R,G,B) { \
|
||||
R = ((unsigned char*)pSrc)[S_1] & 0xF8; \
|
||||
G = ((((unsigned char*)pSrc)[S_1]<< 5)|(((unsigned char*)pSrc)[S_0]>> 3))& 0xFC; \
|
||||
B = (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8; \
|
||||
}
|
||||
#define ZYWRLE_SAVE_PIXEL16(pDst,R,G,B) { \
|
||||
R &= 0xF8; \
|
||||
G &= 0xFC; \
|
||||
B &= 0xF8; \
|
||||
((unsigned char*)pDst)[S_1] = (unsigned char)( R |(G>>5) ); \
|
||||
((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<3))& 0xFF); \
|
||||
}
|
||||
#define ZYWRLE_YMASK32 0xFFFFFFFF
|
||||
#define ZYWRLE_UVMASK32 0xFFFFFFFF
|
||||
#define ZYWRLE_LOAD_PIXEL32(pSrc,R,G,B) { \
|
||||
R = ((unsigned char*)pSrc)[L_2]; \
|
||||
G = ((unsigned char*)pSrc)[L_1]; \
|
||||
B = ((unsigned char*)pSrc)[L_0]; \
|
||||
}
|
||||
#define ZYWRLE_SAVE_PIXEL32(pDst,R,G,B) { \
|
||||
((unsigned char*)pDst)[L_2] = (unsigned char)R; \
|
||||
((unsigned char*)pDst)[L_1] = (unsigned char)G; \
|
||||
((unsigned char*)pDst)[L_0] = (unsigned char)B; \
|
||||
}
|
||||
|
||||
#ifndef ZYWRLE_ONCE
|
||||
#define ZYWRLE_ONCE
|
||||
|
||||
#ifdef WIN32
|
||||
#define InlineX __inline
|
||||
#else
|
||||
# ifndef __STRICT_ANSI__
|
||||
# define InlineX inline
|
||||
# else
|
||||
# define InlineX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ZYWRLE_ENCODE
|
||||
/* Tables for Coefficients filtering. */
|
||||
# ifndef ZYWRLE_QUANTIZE
|
||||
/* Type A:lower bit omitting of EZW style. */
|
||||
const static unsigned int zywrleParam[3][3]={
|
||||
{0x0000F000,0x00000000,0x00000000},
|
||||
{0x0000C000,0x00F0F0F0,0x00000000},
|
||||
{0x0000C000,0x00C0C0C0,0x00F0F0F0},
|
||||
/* {0x0000FF00,0x00000000,0x00000000},
|
||||
{0x0000FF00,0x00FFFFFF,0x00000000},
|
||||
{0x0000FF00,0x00FFFFFF,0x00FFFFFF}, */
|
||||
};
|
||||
# else
|
||||
/* Type B:Non liner quantization filter. */
|
||||
static const signed char zywrleConv[4][256]={
|
||||
{ /* bi=5, bo=5 r=0.0:PSNR=24.849 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{ /* bi=5, bo=5 r=2.0:PSNR=74.031 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 56, 56, 56, 56, 56,
|
||||
56, 56, 56, 56, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 72, 72, 72, 72,
|
||||
72, 72, 72, 72, 80, 80, 80, 80,
|
||||
80, 80, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 96, 96,
|
||||
96, 96, 96, 104, 104, 104, 104, 104,
|
||||
104, 104, 104, 104, 104, 112, 112, 112,
|
||||
112, 112, 112, 112, 112, 112, 120, 120,
|
||||
120, 120, 120, 120, 120, 120, 120, 120,
|
||||
0, -120, -120, -120, -120, -120, -120, -120,
|
||||
-120, -120, -120, -112, -112, -112, -112, -112,
|
||||
-112, -112, -112, -112, -104, -104, -104, -104,
|
||||
-104, -104, -104, -104, -104, -104, -96, -96,
|
||||
-96, -96, -96, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -80,
|
||||
-80, -80, -80, -80, -80, -72, -72, -72,
|
||||
-72, -72, -72, -72, -72, -64, -64, -64,
|
||||
-64, -64, -64, -64, -64, -56, -56, -56,
|
||||
-56, -56, -56, -56, -56, -56, -48, -48,
|
||||
-48, -48, -48, -48, -48, -48, -48, -48,
|
||||
-48, -32, -32, -32, -32, -32, -32, -32,
|
||||
-32, -32, -32, -32, -32, -32, -32, -32,
|
||||
-32, -32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{ /* bi=5, bo=4 r=2.0:PSNR=64.441 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
48, 48, 48, 48, 48, 48, 48, 48,
|
||||
64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64,
|
||||
80, 80, 80, 80, 80, 80, 80, 80,
|
||||
80, 80, 80, 80, 80, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
104, 104, 104, 104, 104, 104, 104, 104,
|
||||
104, 104, 104, 112, 112, 112, 112, 112,
|
||||
112, 112, 112, 112, 120, 120, 120, 120,
|
||||
120, 120, 120, 120, 120, 120, 120, 120,
|
||||
0, -120, -120, -120, -120, -120, -120, -120,
|
||||
-120, -120, -120, -120, -120, -112, -112, -112,
|
||||
-112, -112, -112, -112, -112, -112, -104, -104,
|
||||
-104, -104, -104, -104, -104, -104, -104, -104,
|
||||
-104, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -80, -80, -80, -80,
|
||||
-80, -80, -80, -80, -80, -80, -80, -80,
|
||||
-80, -64, -64, -64, -64, -64, -64, -64,
|
||||
-64, -64, -64, -64, -64, -64, -64, -64,
|
||||
-64, -48, -48, -48, -48, -48, -48, -48,
|
||||
-48, -48, -48, -48, -48, -48, -48, -48,
|
||||
-48, -48, -48, -48, -48, -48, -48, -48,
|
||||
-48, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
},
|
||||
{ /* bi=5, bo=2 r=2.0:PSNR=43.175 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88,
|
||||
0, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, -88, -88, -88, -88, -88, -88, -88,
|
||||
-88, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
}
|
||||
};
|
||||
const static signed char* zywrleParam[3][3][3]={
|
||||
{{zywrleConv[0],zywrleConv[2],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
|
||||
{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
|
||||
{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[2],zywrleConv[2],zywrleConv[2]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]}},
|
||||
};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static InlineX void Harr(signed char* pX0, signed char* pX1)
|
||||
{
|
||||
/* Piecewise-Linear Harr(PLHarr) */
|
||||
int X0 = (int)*pX0, X1 = (int)*pX1;
|
||||
int orgX0 = X0, orgX1 = X1;
|
||||
if ((X0 ^ X1) & 0x80) {
|
||||
/* differ sign */
|
||||
X1 += X0;
|
||||
if (((X1^orgX1)&0x80)==0) {
|
||||
/* |X1| > |X0| */
|
||||
X0 -= X1; /* H = -B */
|
||||
}
|
||||
} else {
|
||||
/* same sign */
|
||||
X0 -= X1;
|
||||
if (((X0 ^ orgX0) & 0x80) == 0) {
|
||||
/* |X0| > |X1| */
|
||||
X1 += X0; /* L = A */
|
||||
}
|
||||
}
|
||||
*pX0 = (signed char)X1;
|
||||
*pX1 = (signed char)X0;
|
||||
}
|
||||
/*
|
||||
1D-Wavelet transform.
|
||||
|
||||
In coefficients array, the famous 'pyramid' decomposition is well used.
|
||||
|
||||
1D Model:
|
||||
|L0L0L0L0|L0L0L0L0|H0H0H0H0|H0H0H0H0| : level 0
|
||||
|L1L1L1L1|H1H1H1H1|H0H0H0H0|H0H0H0H0| : level 1
|
||||
|
||||
But this method needs line buffer because H/L is different position from X0/X1.
|
||||
So, I used 'interleave' decomposition instead of it.
|
||||
|
||||
1D Model:
|
||||
|L0H0L0H0|L0H0L0H0|L0H0L0H0|L0H0L0H0| : level 0
|
||||
|L1H0H1H0|L1H0H1H0|L1H0H1H0|L1H0H1H0| : level 1
|
||||
|
||||
In this method, H/L and X0/X1 is always same position.
|
||||
This lead us to more speed and less memory.
|
||||
Of cause, the result of both method is quite same
|
||||
because it's only difference that coefficient position.
|
||||
*/
|
||||
static InlineX void WaveletLevel(int* data, int size, int l, int SkipPixel)
|
||||
{
|
||||
int s, ofs;
|
||||
signed char* pX0;
|
||||
signed char* end;
|
||||
|
||||
pX0 = (signed char*)data;
|
||||
s = (8<<l)*SkipPixel;
|
||||
end = pX0+(size>>(l+1))*s;
|
||||
s -= 2;
|
||||
ofs = (4<<l)*SkipPixel;
|
||||
while (pX0 < end) {
|
||||
Harr(pX0, pX0+ofs);
|
||||
pX0++;
|
||||
Harr(pX0, pX0+ofs);
|
||||
pX0++;
|
||||
Harr(pX0, pX0+ofs);
|
||||
pX0 += s;
|
||||
}
|
||||
}
|
||||
#define InvWaveletLevel(d,s,l,pix) WaveletLevel(d,s,l,pix)
|
||||
|
||||
#ifdef ZYWRLE_ENCODE
|
||||
# ifndef ZYWRLE_QUANTIZE
|
||||
/* Type A:lower bit omitting of EZW style. */
|
||||
static InlineX void FilterWaveletSquare(int* pBuf, int width, int height, int level, int l)
|
||||
{
|
||||
int r, s;
|
||||
int x, y;
|
||||
int* pH;
|
||||
const unsigned int* pM;
|
||||
|
||||
pM = &(zywrleParam[level-1][l]);
|
||||
s = 2<<l;
|
||||
for (r = 1; r < 4; r++) {
|
||||
pH = pBuf;
|
||||
if (r & 0x01)
|
||||
pH += s>>1;
|
||||
if (r & 0x02)
|
||||
pH += (s>>1)*width;
|
||||
for (y = 0; y < height / s; y++) {
|
||||
for (x = 0; x < width / s; x++) {
|
||||
/*
|
||||
these are same following code.
|
||||
pH[x] = pH[x] / (~pM[x]+1) * (~pM[x]+1);
|
||||
( round pH[x] with pM[x] bit )
|
||||
'&' operator isn't 'round' but is 'floor'.
|
||||
So, we must offset when pH[x] is negative.
|
||||
*/
|
||||
if (((signed char*)pH)[0] & 0x80)
|
||||
((signed char*)pH)[0] += ~((signed char*)pM)[0];
|
||||
if (((signed char*)pH)[1] & 0x80)
|
||||
((signed char*)pH)[1] += ~((signed char*)pM)[1];
|
||||
if (((signed char*)pH)[2] & 0x80)
|
||||
((signed char*)pH)[2] += ~((signed char*)pM)[2];
|
||||
*pH &= *pM;
|
||||
pH += s;
|
||||
}
|
||||
pH += (s-1)*width;
|
||||
}
|
||||
}
|
||||
}
|
||||
# else
|
||||
/*
|
||||
Type B:Non liner quantization filter.
|
||||
|
||||
Coefficients have Gaussian curve and smaller value which is
|
||||
large part of coefficients isn't more important than larger value.
|
||||
So, I use filter of Non liner quantize/dequantize table.
|
||||
In general, Non liner quantize formula is explained as following.
|
||||
|
||||
y=f(x) = sign(x)*round( ((abs(x)/(2^7))^ r )* 2^(bo-1) )*2^(8-bo)
|
||||
x=f-1(y) = sign(y)*round( ((abs(y)/(2^7))^(1/r))* 2^(bi-1) )*2^(8-bi)
|
||||
( r:power coefficient bi:effective MSB in input bo:effective MSB in output )
|
||||
|
||||
r < 1.0 : Smaller value is more important than larger value.
|
||||
r > 1.0 : Larger value is more important than smaller value.
|
||||
r = 1.0 : Liner quantization which is same with EZW style.
|
||||
|
||||
r = 0.75 is famous non liner quantization used in MP3 audio codec.
|
||||
In contrast to audio data, larger value is important in wavelet coefficients.
|
||||
So, I select r = 2.0 table( quantize is x^2, dequantize sqrt(x) ).
|
||||
|
||||
As compared with EZW style liner quantization, this filter tended to be
|
||||
more sharp edge and be more compression rate but be more blocking noise and be less quality.
|
||||
Especially, the surface of graphic objects has distinguishable noise in middle quality mode.
|
||||
|
||||
We need only quantized-dequantized(filtered) value rather than quantized value itself
|
||||
because all values are packed or palette-lized in later ZRLE section.
|
||||
This lead us not to need to modify client decoder when we change
|
||||
the filtering procedure in future.
|
||||
Client only decodes coefficients given by encoder.
|
||||
*/
|
||||
static InlineX void FilterWaveletSquare(int* pBuf, int width, int height, int level, int l)
|
||||
{
|
||||
int r, s;
|
||||
int x, y;
|
||||
int* pH;
|
||||
const signed char** pM;
|
||||
|
||||
pM = zywrleParam[level-1][l];
|
||||
s = 2<<l;
|
||||
for (r = 1; r < 4; r++) {
|
||||
pH = pBuf;
|
||||
if (r & 0x01)
|
||||
pH += s>>1;
|
||||
if (r & 0x02)
|
||||
pH += (s>>1)*width;
|
||||
for (y = 0; y < height / s; y++) {
|
||||
for (x = 0; x < width / s; x++) {
|
||||
((signed char*)pH)[0] = pM[0][((unsigned char*)pH)[0]];
|
||||
((signed char*)pH)[1] = pM[1][((unsigned char*)pH)[1]];
|
||||
((signed char*)pH)[2] = pM[2][((unsigned char*)pH)[2]];
|
||||
pH += s;
|
||||
}
|
||||
pH += (s-1)*width;
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
static InlineX void Wavelet(int* pBuf, int width, int height, int level)
|
||||
{
|
||||
int l, s;
|
||||
int* pTop;
|
||||
int* pEnd;
|
||||
|
||||
for (l = 0; l < level; l++) {
|
||||
pTop = pBuf;
|
||||
pEnd = pBuf+height*width;
|
||||
s = width<<l;
|
||||
while (pTop < pEnd) {
|
||||
WaveletLevel(pTop, width, l, 1);
|
||||
pTop += s;
|
||||
}
|
||||
pTop = pBuf;
|
||||
pEnd = pBuf+width;
|
||||
s = 1<<l;
|
||||
while (pTop < pEnd) {
|
||||
WaveletLevel(pTop, height,l, width);
|
||||
pTop += s;
|
||||
}
|
||||
FilterWaveletSquare(pBuf, width, height, level, l);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef ZYWRLE_DECODE
|
||||
static InlineX void InvWavelet(int* pBuf, int width, int height, int level)
|
||||
{
|
||||
int l, s;
|
||||
int* pTop;
|
||||
int* pEnd;
|
||||
|
||||
for (l = level - 1; l >= 0; l--) {
|
||||
pTop = pBuf;
|
||||
pEnd = pBuf+width;
|
||||
s = 1<<l;
|
||||
while (pTop < pEnd) {
|
||||
InvWaveletLevel(pTop, height,l, width);
|
||||
pTop += s;
|
||||
}
|
||||
pTop = pBuf;
|
||||
pEnd = pBuf+height*width;
|
||||
s = width<<l;
|
||||
while (pTop < pEnd) {
|
||||
InvWaveletLevel(pTop, width, l, 1);
|
||||
pTop += s;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Load/Save coefficients stuffs.
|
||||
Coefficients manages as 24 bits little-endian pixel. */
|
||||
#define ZYWRLE_LOAD_COEFF(pSrc,R,G,B) { \
|
||||
R = ((signed char*)pSrc)[2]; \
|
||||
G = ((signed char*)pSrc)[1]; \
|
||||
B = ((signed char*)pSrc)[0]; \
|
||||
}
|
||||
#define ZYWRLE_SAVE_COEFF(pDst,R,G,B) { \
|
||||
((signed char*)pDst)[2] = (signed char)R; \
|
||||
((signed char*)pDst)[1] = (signed char)G; \
|
||||
((signed char*)pDst)[0] = (signed char)B; \
|
||||
}
|
||||
|
||||
/*
|
||||
RGB <=> YUV conversion stuffs.
|
||||
YUV coversion is explained as following formula in strict meaning:
|
||||
Y = 0.299R + 0.587G + 0.114B ( 0<=Y<=255)
|
||||
U = -0.169R - 0.331G + 0.500B (-128<=U<=127)
|
||||
V = 0.500R - 0.419G - 0.081B (-128<=V<=127)
|
||||
|
||||
I use simple conversion RCT(reversible color transform) which is described
|
||||
in JPEG-2000 specification.
|
||||
Y = (R + 2G + B)/4 ( 0<=Y<=255)
|
||||
U = B-G (-256<=U<=255)
|
||||
V = R-G (-256<=V<=255)
|
||||
*/
|
||||
#define ROUND(x) (((x)<0)?0:(((x)>255)?255:(x)))
|
||||
/* RCT is N-bit RGB to N-bit Y and N+1-bit UV.
|
||||
For make Same N-bit, UV is lossy.
|
||||
More exact PLHarr, we reduce to odd range(-127<=x<=127). */
|
||||
#define ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ymask,uvmask) { \
|
||||
Y = (R+(G<<1)+B)>>2; \
|
||||
U = B-G; \
|
||||
V = R-G; \
|
||||
Y -= 128; \
|
||||
U >>= 1; \
|
||||
V >>= 1; \
|
||||
Y &= ymask; \
|
||||
U &= uvmask; \
|
||||
V &= uvmask; \
|
||||
if (Y == -128) \
|
||||
Y += (0xFFFFFFFF-ymask+1); \
|
||||
if (U == -128) \
|
||||
U += (0xFFFFFFFF-uvmask+1); \
|
||||
if (V == -128) \
|
||||
V += (0xFFFFFFFF-uvmask+1); \
|
||||
}
|
||||
#define ZYWRLE_YUVRGB1(R,G,B,Y,U,V) { \
|
||||
Y += 128; \
|
||||
U <<= 1; \
|
||||
V <<= 1; \
|
||||
G = Y-((U+V)>>2); \
|
||||
B = U+G; \
|
||||
R = V+G; \
|
||||
G = ROUND(G); \
|
||||
B = ROUND(B); \
|
||||
R = ROUND(R); \
|
||||
}
|
||||
|
||||
/*
|
||||
coefficient packing/unpacking stuffs.
|
||||
Wavelet transform makes 4 sub coefficient image from 1 original image.
|
||||
|
||||
model with pyramid decomposition:
|
||||
+------+------+
|
||||
| | |
|
||||
| L | Hx |
|
||||
| | |
|
||||
+------+------+
|
||||
| | |
|
||||
| H | Hxy |
|
||||
| | |
|
||||
+------+------+
|
||||
|
||||
So, we must transfer each sub images individually in strict meaning.
|
||||
But at least ZRLE meaning, following one decompositon image is same as
|
||||
avobe individual sub image. I use this format.
|
||||
(Strictly saying, transfer order is reverse(Hxy->Hy->Hx->L)
|
||||
for simplified procedure for any wavelet level.)
|
||||
|
||||
+------+------+
|
||||
| L |
|
||||
+------+------+
|
||||
| Hx |
|
||||
+------+------+
|
||||
| Hy |
|
||||
+------+------+
|
||||
| Hxy |
|
||||
+------+------+
|
||||
*/
|
||||
#define INC_PTR(data) \
|
||||
data++; \
|
||||
if( data-pData >= (w+uw) ){ \
|
||||
data += scanline-(w+uw); \
|
||||
pData = data; \
|
||||
}
|
||||
|
||||
#define ZYWRLE_TRANSFER_COEFF(pBuf,data,r,w,h,scanline,level,TRANS) \
|
||||
pH = pBuf; \
|
||||
s = 2<<level; \
|
||||
if (r & 0x01) \
|
||||
pH += s>>1; \
|
||||
if (r & 0x02) \
|
||||
pH += (s>>1)*w; \
|
||||
pEnd = pH+h*w; \
|
||||
while (pH < pEnd) { \
|
||||
pLine = pH+w; \
|
||||
while (pH < pLine) { \
|
||||
TRANS \
|
||||
INC_PTR(data) \
|
||||
pH += s; \
|
||||
} \
|
||||
pH += (s-1)*w; \
|
||||
}
|
||||
|
||||
#define ZYWRLE_PACK_COEFF(pBuf,data,r,width,height,scanline,level) \
|
||||
ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,scanline,level,ZYWRLE_LOAD_COEFF(pH,R,G,B);ZYWRLE_SAVE_PIXEL(data,R,G,B);)
|
||||
|
||||
#define ZYWRLE_UNPACK_COEFF(pBuf,data,r,width,height,scanline,level) \
|
||||
ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,scanline,level,ZYWRLE_LOAD_PIXEL(data,R,G,B);ZYWRLE_SAVE_COEFF(pH,R,G,B);)
|
||||
|
||||
#define ZYWRLE_SAVE_UNALIGN(data,TRANS) \
|
||||
pTop = pBuf+w*h; \
|
||||
pEnd = pBuf + (w+uw)*(h+uh); \
|
||||
while (pTop < pEnd) { \
|
||||
TRANS \
|
||||
INC_PTR(data) \
|
||||
pTop++; \
|
||||
}
|
||||
|
||||
#define ZYWRLE_LOAD_UNALIGN(data,TRANS) \
|
||||
pTop = pBuf+w*h; \
|
||||
if (uw) { \
|
||||
pData= data + w; \
|
||||
pEnd = (int*)(pData+ h*scanline); \
|
||||
while (pData < (PIXEL_T*)pEnd) { \
|
||||
pLine = (int*)(pData + uw); \
|
||||
while (pData < (PIXEL_T*)pLine) { \
|
||||
TRANS \
|
||||
pData++; \
|
||||
pTop++; \
|
||||
} \
|
||||
pData += scanline-uw; \
|
||||
} \
|
||||
} \
|
||||
if (uh) { \
|
||||
pData= data + h*scanline; \
|
||||
pEnd = (int*)(pData+ uh*scanline); \
|
||||
while (pData < (PIXEL_T*)pEnd) { \
|
||||
pLine = (int*)(pData + w); \
|
||||
while (pData < (PIXEL_T*)pLine) { \
|
||||
TRANS \
|
||||
pData++; \
|
||||
pTop++; \
|
||||
} \
|
||||
pData += scanline-w; \
|
||||
} \
|
||||
} \
|
||||
if (uw && uh) { \
|
||||
pData= data + w+ h*scanline; \
|
||||
pEnd = (int*)(pData+ uh*scanline); \
|
||||
while (pData < (PIXEL_T*)pEnd) { \
|
||||
pLine = (int*)(pData + uw); \
|
||||
while (pData < (PIXEL_T*)pLine) { \
|
||||
TRANS \
|
||||
pData++; \
|
||||
pTop++; \
|
||||
} \
|
||||
pData += scanline-uw; \
|
||||
} \
|
||||
}
|
||||
|
||||
static InlineX void zywrleCalcSize(int* pW, int* pH, int level)
|
||||
{
|
||||
*pW &= ~((1<<level)-1);
|
||||
*pH &= ~((1<<level)-1);
|
||||
}
|
||||
|
||||
#endif /* ZYWRLE_ONCE */
|
||||
|
||||
#ifndef CPIXEL
|
||||
#ifdef ZYWRLE_ENCODE
|
||||
static InlineX void ZYWRLE_RGBYUV(int* pBuf, PIXEL_T* data, int width, int height, int scanline)
|
||||
{
|
||||
int R, G, B;
|
||||
int Y, U, V;
|
||||
int* pLine;
|
||||
int* pEnd;
|
||||
pEnd = pBuf+height*width;
|
||||
while (pBuf < pEnd) {
|
||||
pLine = pBuf+width;
|
||||
while (pBuf < pLine) {
|
||||
ZYWRLE_LOAD_PIXEL(data,R,G,B);
|
||||
ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ZYWRLE_YMASK,ZYWRLE_UVMASK);
|
||||
ZYWRLE_SAVE_COEFF(pBuf,V,Y,U);
|
||||
pBuf++;
|
||||
data++;
|
||||
}
|
||||
data += scanline-width;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef ZYWRLE_DECODE
|
||||
static InlineX void ZYWRLE_YUVRGB(int* pBuf, PIXEL_T* data, int width, int height, int scanline) {
|
||||
int R, G, B;
|
||||
int Y, U, V;
|
||||
int* pLine;
|
||||
int* pEnd;
|
||||
pEnd = pBuf+height*width;
|
||||
while (pBuf < pEnd) {
|
||||
pLine = pBuf+width;
|
||||
while (pBuf < pLine) {
|
||||
ZYWRLE_LOAD_COEFF(pBuf,V,Y,U);
|
||||
ZYWRLE_YUVRGB1(R,G,B,Y,U,V);
|
||||
ZYWRLE_SAVE_PIXEL(data,R,G,B);
|
||||
pBuf++;
|
||||
data++;
|
||||
}
|
||||
data += scanline-width;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ZYWRLE_ENCODE
|
||||
PIXEL_T* ZYWRLE_ANALYZE(PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf) {
|
||||
int l;
|
||||
int uw = w;
|
||||
int uh = h;
|
||||
int* pTop;
|
||||
int* pEnd;
|
||||
int* pLine;
|
||||
PIXEL_T* pData;
|
||||
int R, G, B;
|
||||
int s;
|
||||
int* pH;
|
||||
|
||||
zywrleCalcSize(&w, &h, level);
|
||||
if (w == 0 || h == 0)
|
||||
return NULL;
|
||||
uw -= w;
|
||||
uh -= h;
|
||||
|
||||
pData = dst;
|
||||
ZYWRLE_LOAD_UNALIGN(src,*(PIXEL_T*)pTop=*pData;)
|
||||
ZYWRLE_RGBYUV(pBuf, src, w, h, scanline);
|
||||
Wavelet(pBuf, w, h, level);
|
||||
for (l = 0; l < level; l++) {
|
||||
ZYWRLE_PACK_COEFF(pBuf, dst, 3, w, h, scanline, l);
|
||||
ZYWRLE_PACK_COEFF(pBuf, dst, 2, w, h, scanline, l);
|
||||
ZYWRLE_PACK_COEFF(pBuf, dst, 1, w, h, scanline, l);
|
||||
if (l == level - 1) {
|
||||
ZYWRLE_PACK_COEFF(pBuf, dst, 0, w, h, scanline, l);
|
||||
}
|
||||
}
|
||||
ZYWRLE_SAVE_UNALIGN(dst,*dst=*(PIXEL_T*)pTop;)
|
||||
return dst;
|
||||
}
|
||||
#endif
|
||||
#ifdef ZYWRLE_DECODE
|
||||
PIXEL_T* ZYWRLE_SYNTHESIZE(PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf)
|
||||
{
|
||||
int l;
|
||||
int uw = w;
|
||||
int uh = h;
|
||||
int* pTop;
|
||||
int* pEnd;
|
||||
int* pLine;
|
||||
PIXEL_T* pData;
|
||||
int R, G, B;
|
||||
int s;
|
||||
int* pH;
|
||||
|
||||
zywrleCalcSize(&w, &h, level);
|
||||
if (w == 0 || h == 0)
|
||||
return NULL;
|
||||
uw -= w;
|
||||
uh -= h;
|
||||
|
||||
pData = src;
|
||||
for (l = 0; l < level; l++) {
|
||||
ZYWRLE_UNPACK_COEFF(pBuf, src, 3, w, h, scanline, l);
|
||||
ZYWRLE_UNPACK_COEFF(pBuf, src, 2, w, h, scanline, l);
|
||||
ZYWRLE_UNPACK_COEFF(pBuf, src, 1, w, h, scanline, l);
|
||||
if (l == level - 1) {
|
||||
ZYWRLE_UNPACK_COEFF(pBuf, src, 0, w, h, scanline, l);
|
||||
}
|
||||
}
|
||||
ZYWRLE_SAVE_UNALIGN(src,*(PIXEL_T*)pTop=*src;)
|
||||
InvWavelet(pBuf, w, h, level);
|
||||
ZYWRLE_YUVRGB(pBuf, dst, w, h, scanline);
|
||||
ZYWRLE_LOAD_UNALIGN(dst,*pData=*(PIXEL_T*)pTop;)
|
||||
return src;
|
||||
}
|
||||
#endif
|
||||
#endif /* CPIXEL */
|
||||
|
||||
#undef ZYWRLE_RGBYUV
|
||||
#undef ZYWRLE_YUVRGB
|
||||
#undef ZYWRLE_LOAD_PIXEL
|
||||
#undef ZYWRLE_SAVE_PIXEL
|
143
jni/vnc/LibVNCServer-0.9.9/compile
Executable file
143
jni/vnc/LibVNCServer-0.9.9/compile
Executable file
@ -0,0 +1,143 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2009-10-06.20; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1502
jni/vnc/LibVNCServer-0.9.9/config.guess
vendored
Executable file
1502
jni/vnc/LibVNCServer-0.9.9/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1714
jni/vnc/LibVNCServer-0.9.9/config.sub
vendored
Executable file
1714
jni/vnc/LibVNCServer-0.9.9/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
26504
jni/vnc/LibVNCServer-0.9.9/configure
vendored
Executable file
26504
jni/vnc/LibVNCServer-0.9.9/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1015
jni/vnc/LibVNCServer-0.9.9/configure.ac
Normal file
1015
jni/vnc/LibVNCServer-0.9.9/configure.ac
Normal file
File diff suppressed because it is too large
Load Diff
630
jni/vnc/LibVNCServer-0.9.9/depcomp
Executable file
630
jni/vnc/LibVNCServer-0.9.9/depcomp
Executable file
@ -0,0 +1,630 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
27
jni/vnc/LibVNCServer-0.9.9/examples/Makefile.am
Normal file
27
jni/vnc/LibVNCServer-0.9.9/examples/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = ../libvncserver/libvncserver.la @WSOCKLIB@
|
||||
|
||||
if OSX
|
||||
MAC=mac
|
||||
mac_LDFLAGS=-framework ApplicationServices -framework Carbon -framework IOKit
|
||||
endif
|
||||
|
||||
if ANDROID
|
||||
SUBDIRS=android
|
||||
endif
|
||||
|
||||
if WITH_TIGHTVNC_FILETRANSFER
|
||||
FILETRANSFER=filetransfer
|
||||
endif
|
||||
|
||||
if HAVE_LIBPTHREAD
|
||||
BLOOPTEST=blooptest
|
||||
endif
|
||||
|
||||
noinst_HEADERS=radon.h rotatetemplate.c
|
||||
|
||||
noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
|
||||
vncev storepasswd colourmaptest simple simple15 $(MAC) \
|
||||
$(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \
|
||||
zippy
|
||||
|
820
jni/vnc/LibVNCServer-0.9.9/examples/Makefile.in
Normal file
820
jni/vnc/LibVNCServer-0.9.9/examples/Makefile.in
Normal file
@ -0,0 +1,820 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = example$(EXEEXT) pnmshow$(EXEEXT) \
|
||||
regiontest$(EXEEXT) pnmshow24$(EXEEXT) fontsel$(EXEEXT) \
|
||||
vncev$(EXEEXT) storepasswd$(EXEEXT) colourmaptest$(EXEEXT) \
|
||||
simple$(EXEEXT) simple15$(EXEEXT) $(am__EXEEXT_1) \
|
||||
$(am__EXEEXT_2) backchannel$(EXEEXT) $(am__EXEEXT_3) \
|
||||
camera$(EXEEXT) rotate$(EXEEXT) zippy$(EXEEXT)
|
||||
subdir = examples
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/rfbconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
@OSX_TRUE@am__EXEEXT_1 = mac$(EXEEXT)
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@am__EXEEXT_2 = filetransfer$(EXEEXT)
|
||||
@HAVE_LIBPTHREAD_TRUE@am__EXEEXT_3 = blooptest$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
backchannel_SOURCES = backchannel.c
|
||||
backchannel_OBJECTS = backchannel.$(OBJEXT)
|
||||
backchannel_LDADD = $(LDADD)
|
||||
backchannel_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
blooptest_SOURCES = blooptest.c
|
||||
blooptest_OBJECTS = blooptest.$(OBJEXT)
|
||||
blooptest_LDADD = $(LDADD)
|
||||
blooptest_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
camera_SOURCES = camera.c
|
||||
camera_OBJECTS = camera.$(OBJEXT)
|
||||
camera_LDADD = $(LDADD)
|
||||
camera_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
colourmaptest_SOURCES = colourmaptest.c
|
||||
colourmaptest_OBJECTS = colourmaptest.$(OBJEXT)
|
||||
colourmaptest_LDADD = $(LDADD)
|
||||
colourmaptest_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
example_SOURCES = example.c
|
||||
example_OBJECTS = example.$(OBJEXT)
|
||||
example_LDADD = $(LDADD)
|
||||
example_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
filetransfer_SOURCES = filetransfer.c
|
||||
filetransfer_OBJECTS = filetransfer.$(OBJEXT)
|
||||
filetransfer_LDADD = $(LDADD)
|
||||
filetransfer_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
fontsel_SOURCES = fontsel.c
|
||||
fontsel_OBJECTS = fontsel.$(OBJEXT)
|
||||
fontsel_LDADD = $(LDADD)
|
||||
fontsel_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
mac_SOURCES = mac.c
|
||||
mac_OBJECTS = mac.$(OBJEXT)
|
||||
mac_LDADD = $(LDADD)
|
||||
mac_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
mac_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(mac_LDFLAGS) $(LDFLAGS) -o $@
|
||||
pnmshow_SOURCES = pnmshow.c
|
||||
pnmshow_OBJECTS = pnmshow.$(OBJEXT)
|
||||
pnmshow_LDADD = $(LDADD)
|
||||
pnmshow_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
pnmshow24_SOURCES = pnmshow24.c
|
||||
pnmshow24_OBJECTS = pnmshow24.$(OBJEXT)
|
||||
pnmshow24_LDADD = $(LDADD)
|
||||
pnmshow24_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
regiontest_SOURCES = regiontest.c
|
||||
regiontest_OBJECTS = regiontest.$(OBJEXT)
|
||||
regiontest_LDADD = $(LDADD)
|
||||
regiontest_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
rotate_SOURCES = rotate.c
|
||||
rotate_OBJECTS = rotate.$(OBJEXT)
|
||||
rotate_LDADD = $(LDADD)
|
||||
rotate_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
simple_SOURCES = simple.c
|
||||
simple_OBJECTS = simple.$(OBJEXT)
|
||||
simple_LDADD = $(LDADD)
|
||||
simple_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
simple15_SOURCES = simple15.c
|
||||
simple15_OBJECTS = simple15.$(OBJEXT)
|
||||
simple15_LDADD = $(LDADD)
|
||||
simple15_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
storepasswd_SOURCES = storepasswd.c
|
||||
storepasswd_OBJECTS = storepasswd.$(OBJEXT)
|
||||
storepasswd_LDADD = $(LDADD)
|
||||
storepasswd_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
vncev_SOURCES = vncev.c
|
||||
vncev_OBJECTS = vncev.$(OBJEXT)
|
||||
vncev_LDADD = $(LDADD)
|
||||
vncev_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
zippy_SOURCES = zippy.c
|
||||
zippy_OBJECTS = zippy.$(OBJEXT)
|
||||
zippy_LDADD = $(LDADD)
|
||||
zippy_DEPENDENCIES = ../libvncserver/libvncserver.la
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = backchannel.c blooptest.c camera.c colourmaptest.c example.c \
|
||||
filetransfer.c fontsel.c mac.c pnmshow.c pnmshow24.c \
|
||||
regiontest.c rotate.c simple.c simple15.c storepasswd.c \
|
||||
vncev.c zippy.c
|
||||
DIST_SOURCES = backchannel.c blooptest.c camera.c colourmaptest.c \
|
||||
example.c filetransfer.c fontsel.c mac.c pnmshow.c pnmshow24.c \
|
||||
regiontest.c rotate.c simple.c simple15.c storepasswd.c \
|
||||
vncev.c zippy.c
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = android
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = ../libvncserver/libvncserver.la @WSOCKLIB@
|
||||
@OSX_TRUE@MAC = mac
|
||||
@OSX_TRUE@mac_LDFLAGS = -framework ApplicationServices -framework Carbon -framework IOKit
|
||||
@ANDROID_TRUE@SUBDIRS = android
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@FILETRANSFER = filetransfer
|
||||
@HAVE_LIBPTHREAD_TRUE@BLOOPTEST = blooptest
|
||||
noinst_HEADERS = radon.h rotatetemplate.c
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
backchannel$(EXEEXT): $(backchannel_OBJECTS) $(backchannel_DEPENDENCIES)
|
||||
@rm -f backchannel$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(backchannel_OBJECTS) $(backchannel_LDADD) $(LIBS)
|
||||
blooptest$(EXEEXT): $(blooptest_OBJECTS) $(blooptest_DEPENDENCIES)
|
||||
@rm -f blooptest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(blooptest_OBJECTS) $(blooptest_LDADD) $(LIBS)
|
||||
camera$(EXEEXT): $(camera_OBJECTS) $(camera_DEPENDENCIES)
|
||||
@rm -f camera$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(camera_OBJECTS) $(camera_LDADD) $(LIBS)
|
||||
colourmaptest$(EXEEXT): $(colourmaptest_OBJECTS) $(colourmaptest_DEPENDENCIES)
|
||||
@rm -f colourmaptest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(colourmaptest_OBJECTS) $(colourmaptest_LDADD) $(LIBS)
|
||||
example$(EXEEXT): $(example_OBJECTS) $(example_DEPENDENCIES)
|
||||
@rm -f example$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(example_OBJECTS) $(example_LDADD) $(LIBS)
|
||||
filetransfer$(EXEEXT): $(filetransfer_OBJECTS) $(filetransfer_DEPENDENCIES)
|
||||
@rm -f filetransfer$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(filetransfer_OBJECTS) $(filetransfer_LDADD) $(LIBS)
|
||||
fontsel$(EXEEXT): $(fontsel_OBJECTS) $(fontsel_DEPENDENCIES)
|
||||
@rm -f fontsel$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(fontsel_OBJECTS) $(fontsel_LDADD) $(LIBS)
|
||||
mac$(EXEEXT): $(mac_OBJECTS) $(mac_DEPENDENCIES)
|
||||
@rm -f mac$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mac_LINK) $(mac_OBJECTS) $(mac_LDADD) $(LIBS)
|
||||
pnmshow$(EXEEXT): $(pnmshow_OBJECTS) $(pnmshow_DEPENDENCIES)
|
||||
@rm -f pnmshow$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(pnmshow_OBJECTS) $(pnmshow_LDADD) $(LIBS)
|
||||
pnmshow24$(EXEEXT): $(pnmshow24_OBJECTS) $(pnmshow24_DEPENDENCIES)
|
||||
@rm -f pnmshow24$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(pnmshow24_OBJECTS) $(pnmshow24_LDADD) $(LIBS)
|
||||
regiontest$(EXEEXT): $(regiontest_OBJECTS) $(regiontest_DEPENDENCIES)
|
||||
@rm -f regiontest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(regiontest_OBJECTS) $(regiontest_LDADD) $(LIBS)
|
||||
rotate$(EXEEXT): $(rotate_OBJECTS) $(rotate_DEPENDENCIES)
|
||||
@rm -f rotate$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(rotate_OBJECTS) $(rotate_LDADD) $(LIBS)
|
||||
simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES)
|
||||
@rm -f simple$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
|
||||
simple15$(EXEEXT): $(simple15_OBJECTS) $(simple15_DEPENDENCIES)
|
||||
@rm -f simple15$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(simple15_OBJECTS) $(simple15_LDADD) $(LIBS)
|
||||
storepasswd$(EXEEXT): $(storepasswd_OBJECTS) $(storepasswd_DEPENDENCIES)
|
||||
@rm -f storepasswd$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(storepasswd_OBJECTS) $(storepasswd_LDADD) $(LIBS)
|
||||
vncev$(EXEEXT): $(vncev_OBJECTS) $(vncev_DEPENDENCIES)
|
||||
@rm -f vncev$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(vncev_OBJECTS) $(vncev_LDADD) $(LIBS)
|
||||
zippy$(EXEEXT): $(zippy_OBJECTS) $(zippy_DEPENDENCIES)
|
||||
@rm -f zippy$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(zippy_OBJECTS) $(zippy_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backchannel.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blooptest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colourmaptest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filetransfer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontsel.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pnmshow.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pnmshow24.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regiontest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotate.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple15.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/storepasswd.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncev.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zippy.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile $(PROGRAMS) $(HEADERS)
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
|
||||
install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am check check-am clean clean-generic clean-libtool \
|
||||
clean-noinstPROGRAMS ctags ctags-recursive distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
7
jni/vnc/LibVNCServer-0.9.9/examples/android/Makefile.am
Normal file
7
jni/vnc/LibVNCServer-0.9.9/examples/android/Makefile.am
Normal file
@ -0,0 +1,7 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = $(top_srcdir)/libvncserver/libvncserver.la @WSOCKLIB@
|
||||
|
||||
noinst_PROGRAMS=androidvncserver
|
||||
androidvncserver_SOURCES=jni/fbvncserver.c
|
||||
|
||||
EXTRA_DIST=jni/Android.mk
|
532
jni/vnc/LibVNCServer-0.9.9/examples/android/Makefile.in
Normal file
532
jni/vnc/LibVNCServer-0.9.9/examples/android/Makefile.in
Normal file
@ -0,0 +1,532 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
noinst_PROGRAMS = androidvncserver$(EXEEXT)
|
||||
subdir = examples/android
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/rfbconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_androidvncserver_OBJECTS = fbvncserver.$(OBJEXT)
|
||||
androidvncserver_OBJECTS = $(am_androidvncserver_OBJECTS)
|
||||
androidvncserver_LDADD = $(LDADD)
|
||||
androidvncserver_DEPENDENCIES = \
|
||||
$(top_srcdir)/libvncserver/libvncserver.la
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(androidvncserver_SOURCES)
|
||||
DIST_SOURCES = $(androidvncserver_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
LDADD = $(top_srcdir)/libvncserver/libvncserver.la @WSOCKLIB@
|
||||
androidvncserver_SOURCES = jni/fbvncserver.c
|
||||
EXTRA_DIST = jni/Android.mk
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/android/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/android/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
androidvncserver$(EXEEXT): $(androidvncserver_OBJECTS) $(androidvncserver_DEPENDENCIES)
|
||||
@rm -f androidvncserver$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(androidvncserver_OBJECTS) $(androidvncserver_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbvncserver.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
fbvncserver.o: jni/fbvncserver.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbvncserver.o -MD -MP -MF $(DEPDIR)/fbvncserver.Tpo -c -o fbvncserver.o `test -f 'jni/fbvncserver.c' || echo '$(srcdir)/'`jni/fbvncserver.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbvncserver.Tpo $(DEPDIR)/fbvncserver.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/fbvncserver.c' object='fbvncserver.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbvncserver.o `test -f 'jni/fbvncserver.c' || echo '$(srcdir)/'`jni/fbvncserver.c
|
||||
|
||||
fbvncserver.obj: jni/fbvncserver.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbvncserver.obj -MD -MP -MF $(DEPDIR)/fbvncserver.Tpo -c -o fbvncserver.obj `if test -f 'jni/fbvncserver.c'; then $(CYGPATH_W) 'jni/fbvncserver.c'; else $(CYGPATH_W) '$(srcdir)/jni/fbvncserver.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fbvncserver.Tpo $(DEPDIR)/fbvncserver.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jni/fbvncserver.c' object='fbvncserver.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbvncserver.obj `if test -f 'jni/fbvncserver.c'; then $(CYGPATH_W) 'jni/fbvncserver.c'; else $(CYGPATH_W) '$(srcdir)/jni/fbvncserver.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstPROGRAMS ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
63
jni/vnc/LibVNCServer-0.9.9/examples/android/README
Normal file
63
jni/vnc/LibVNCServer-0.9.9/examples/android/README
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
This example VNC server for Android is adopted from
|
||||
http://code.google.com/p/android-vnc-server/ with some additional
|
||||
fixes applied.
|
||||
|
||||
To build, you'll need the Android Native Development Kit from
|
||||
http://developer.android.com/sdk/ndk/.
|
||||
|
||||
|
||||
Building with autotools
|
||||
-----------------------
|
||||
|
||||
This has the advantage that the LibVNCServer sources are properly set up
|
||||
using the configure script.
|
||||
|
||||
1. Read <NDK location>/docs/STANDALONE-TOOLCHAIN.html.
|
||||
|
||||
2. Setup your toolchain according to step 3 in the above file.
|
||||
|
||||
3. Execute
|
||||
|
||||
./configure --host=arm-eabi CC=arm-linux-androideabi-gcc
|
||||
|
||||
in the LibVNCServer root directory.
|
||||
|
||||
4. Execute
|
||||
|
||||
make
|
||||
|
||||
in the LibVNCServer root directory. This will build the whole
|
||||
LibVNCServer distribution for Android, including androidvncserver.
|
||||
|
||||
|
||||
|
||||
|
||||
Building with the NDK build system
|
||||
----------------------------------
|
||||
|
||||
This is probably easier than the autotools method, but you'll have to edit
|
||||
some files manually.
|
||||
|
||||
1. Edit rfb/rfbconfig.h to match your Android target. For instance, comment out
|
||||
LIBVNCSERVER_HAVE_LIBJPEG if you don't have libjpeg for Android.
|
||||
|
||||
2. Edit the HAVE_X variables in jni/Android.mk accordingly.
|
||||
|
||||
3. Execute
|
||||
|
||||
ndk-build -C .
|
||||
|
||||
in the examples/android directory. The resulting binary will be in libs/.
|
||||
|
||||
|
||||
|
||||
Installing && Running
|
||||
---------------------
|
||||
|
||||
This can be done via
|
||||
|
||||
adb push androidvncserver /data/local/
|
||||
adb shell /data/local/androidvncserver
|
||||
|
||||
|
65
jni/vnc/LibVNCServer-0.9.9/examples/android/jni/Android.mk
Normal file
65
jni/vnc/LibVNCServer-0.9.9/examples/android/jni/Android.mk
Normal file
@ -0,0 +1,65 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LIBVNCSERVER_ROOT:=../../..
|
||||
|
||||
HAVE_LIBZ=1
|
||||
#HAVE_LIBJPEG=1
|
||||
|
||||
ifdef HAVE_LIBZ
|
||||
ZLIBSRCS := \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/zlib.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/zrle.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/zrleoutstream.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/zrlepalettehelper.c \
|
||||
$(LIBVNCSERVER_ROOT)/common/zywrletemplate.c
|
||||
ifdef HAVE_LIBJPEG
|
||||
TIGHTSRCS := $(LIBVNCSERVER_ROOT)/libvncserver/tight.c
|
||||
endif
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
fbvncserver.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/main.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/rfbserver.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/rfbregion.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/auth.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/sockets.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/stats.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/corre.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/hextile.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/rre.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/translate.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/cutpaste.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/httpd.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/cursor.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/font.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/draw.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/selbox.c \
|
||||
$(LIBVNCSERVER_ROOT)/common/d3des.c \
|
||||
$(LIBVNCSERVER_ROOT)/common/vncauth.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/cargs.c \
|
||||
$(LIBVNCSERVER_ROOT)/common/minilzo.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/ultra.c \
|
||||
$(LIBVNCSERVER_ROOT)/libvncserver/scale.c \
|
||||
$(ZLIBSRCS) \
|
||||
$(TIGHTSRCS)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/libvncserver \
|
||||
$(LOCAL_PATH)/$(LIBVNCSERVER_ROOT)/common \
|
||||
$(LOCAL_PATH)/$(LIBVNCSERVER_ROOT) \
|
||||
external/jpeg
|
||||
|
||||
ifdef HAVE_LIBZ
|
||||
LOCAL_SHARED_LIBRARIES := libz
|
||||
LOCAL_LDLIBS := -lz
|
||||
endif
|
||||
ifdef HAVE_LIBJPEG
|
||||
LOCAL_STATIC_LIBRARIES := libjpeg
|
||||
endif
|
||||
|
||||
LOCAL_MODULE:= androidvncserver
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
522
jni/vnc/LibVNCServer-0.9.9/examples/android/jni/fbvncserver.c
Normal file
522
jni/vnc/LibVNCServer-0.9.9/examples/android/jni/fbvncserver.c
Normal file
@ -0,0 +1,522 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* This project is an adaptation of the original fbvncserver for the iPAQ
|
||||
* and Zaurus.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h> /* For makedev() */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* libvncserver */
|
||||
#include "rfb/rfb.h"
|
||||
#include "rfb/keysym.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Android does not use /dev/fb0. */
|
||||
#define FB_DEVICE "/dev/graphics/fb0"
|
||||
static char KBD_DEVICE[256] = "/dev/input/event3";
|
||||
static char TOUCH_DEVICE[256] = "/dev/input/event1";
|
||||
static struct fb_var_screeninfo scrinfo;
|
||||
static int fbfd = -1;
|
||||
static int kbdfd = -1;
|
||||
static int touchfd = -1;
|
||||
static unsigned short int *fbmmap = MAP_FAILED;
|
||||
static unsigned short int *vncbuf;
|
||||
static unsigned short int *fbbuf;
|
||||
|
||||
/* Android already has 5900 bound natively. */
|
||||
#define VNC_PORT 5901
|
||||
static rfbScreenInfoPtr vncscr;
|
||||
|
||||
static int xmin, xmax;
|
||||
static int ymin, ymax;
|
||||
|
||||
/* No idea, just copied from fbvncserver as part of the frame differerencing
|
||||
* algorithm. I will probably be later rewriting all of this. */
|
||||
static struct varblock_t
|
||||
{
|
||||
int min_i;
|
||||
int min_j;
|
||||
int max_i;
|
||||
int max_j;
|
||||
int r_offset;
|
||||
int g_offset;
|
||||
int b_offset;
|
||||
int rfb_xres;
|
||||
int rfb_maxy;
|
||||
} varblock;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl);
|
||||
static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void init_fb(void)
|
||||
{
|
||||
size_t pixels;
|
||||
size_t bytespp;
|
||||
|
||||
if ((fbfd = open(FB_DEVICE, O_RDONLY)) == -1)
|
||||
{
|
||||
printf("cannot open fb device %s\n", FB_DEVICE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &scrinfo) != 0)
|
||||
{
|
||||
printf("ioctl error\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
pixels = scrinfo.xres * scrinfo.yres;
|
||||
bytespp = scrinfo.bits_per_pixel / 8;
|
||||
|
||||
fprintf(stderr, "xres=%d, yres=%d, xresv=%d, yresv=%d, xoffs=%d, yoffs=%d, bpp=%d\n",
|
||||
(int)scrinfo.xres, (int)scrinfo.yres,
|
||||
(int)scrinfo.xres_virtual, (int)scrinfo.yres_virtual,
|
||||
(int)scrinfo.xoffset, (int)scrinfo.yoffset,
|
||||
(int)scrinfo.bits_per_pixel);
|
||||
|
||||
fbmmap = mmap(NULL, pixels * bytespp, PROT_READ, MAP_SHARED, fbfd, 0);
|
||||
|
||||
if (fbmmap == MAP_FAILED)
|
||||
{
|
||||
printf("mmap failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup_fb(void)
|
||||
{
|
||||
if(fbfd != -1)
|
||||
{
|
||||
close(fbfd);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_kbd()
|
||||
{
|
||||
if((kbdfd = open(KBD_DEVICE, O_RDWR)) == -1)
|
||||
{
|
||||
printf("cannot open kbd device %s\n", KBD_DEVICE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup_kbd()
|
||||
{
|
||||
if(kbdfd != -1)
|
||||
{
|
||||
close(kbdfd);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_touch()
|
||||
{
|
||||
struct input_absinfo info;
|
||||
if((touchfd = open(TOUCH_DEVICE, O_RDWR)) == -1)
|
||||
{
|
||||
printf("cannot open touch device %s\n", TOUCH_DEVICE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// Get the Range of X and Y
|
||||
if(ioctl(touchfd, EVIOCGABS(ABS_X), &info)) {
|
||||
printf("cannot get ABS_X info, %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
xmin = info.minimum;
|
||||
xmax = info.maximum;
|
||||
if(ioctl(touchfd, EVIOCGABS(ABS_Y), &info)) {
|
||||
printf("cannot get ABS_Y, %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
ymin = info.minimum;
|
||||
ymax = info.maximum;
|
||||
|
||||
}
|
||||
|
||||
static void cleanup_touch()
|
||||
{
|
||||
if(touchfd != -1)
|
||||
{
|
||||
close(touchfd);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void init_fb_server(int argc, char **argv)
|
||||
{
|
||||
printf("Initializing server...\n");
|
||||
|
||||
/* Allocate the VNC server buffer to be managed (not manipulated) by
|
||||
* libvncserver. */
|
||||
vncbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8);
|
||||
assert(vncbuf != NULL);
|
||||
|
||||
/* Allocate the comparison buffer for detecting drawing updates from frame
|
||||
* to frame. */
|
||||
fbbuf = calloc(scrinfo.xres * scrinfo.yres, scrinfo.bits_per_pixel / 8);
|
||||
assert(fbbuf != NULL);
|
||||
|
||||
/* TODO: This assumes scrinfo.bits_per_pixel is 16. */
|
||||
vncscr = rfbGetScreen(&argc, argv, scrinfo.xres, scrinfo.yres, 5, 2, (scrinfo.bits_per_pixel / 8));
|
||||
assert(vncscr != NULL);
|
||||
|
||||
vncscr->desktopName = "Android";
|
||||
vncscr->frameBuffer = (char *)vncbuf;
|
||||
vncscr->alwaysShared = TRUE;
|
||||
vncscr->httpDir = NULL;
|
||||
vncscr->port = VNC_PORT;
|
||||
|
||||
vncscr->kbdAddEvent = keyevent;
|
||||
vncscr->ptrAddEvent = ptrevent;
|
||||
|
||||
rfbInitServer(vncscr);
|
||||
|
||||
/* Mark as dirty since we haven't sent any updates at all yet. */
|
||||
rfbMarkRectAsModified(vncscr, 0, 0, scrinfo.xres, scrinfo.yres);
|
||||
|
||||
/* No idea. */
|
||||
varblock.r_offset = scrinfo.red.offset + scrinfo.red.length - 5;
|
||||
varblock.g_offset = scrinfo.green.offset + scrinfo.green.length - 5;
|
||||
varblock.b_offset = scrinfo.blue.offset + scrinfo.blue.length - 5;
|
||||
varblock.rfb_xres = scrinfo.yres;
|
||||
varblock.rfb_maxy = scrinfo.xres - 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void injectKeyEvent(uint16_t code, uint16_t value)
|
||||
{
|
||||
struct input_event ev;
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
gettimeofday(&ev.time,0);
|
||||
ev.type = EV_KEY;
|
||||
ev.code = code;
|
||||
ev.value = value;
|
||||
if(write(kbdfd, &ev, sizeof(ev)) < 0)
|
||||
{
|
||||
printf("write event failed, %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
printf("injectKey (%d, %d)\n", code , value);
|
||||
}
|
||||
|
||||
static int keysym2scancode(rfbBool down, rfbKeySym key, rfbClientPtr cl)
|
||||
{
|
||||
int scancode = 0;
|
||||
|
||||
int code = (int)key;
|
||||
if (code>='0' && code<='9') {
|
||||
scancode = (code & 0xF) - 1;
|
||||
if (scancode<0) scancode += 10;
|
||||
scancode += KEY_1;
|
||||
} else if (code>=0xFF50 && code<=0xFF58) {
|
||||
static const uint16_t map[] =
|
||||
{ KEY_HOME, KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN,
|
||||
KEY_SOFT1, KEY_SOFT2, KEY_END, 0 };
|
||||
scancode = map[code & 0xF];
|
||||
} else if (code>=0xFFE1 && code<=0xFFEE) {
|
||||
static const uint16_t map[] =
|
||||
{ KEY_LEFTSHIFT, KEY_LEFTSHIFT,
|
||||
KEY_COMPOSE, KEY_COMPOSE,
|
||||
KEY_LEFTSHIFT, KEY_LEFTSHIFT,
|
||||
0,0,
|
||||
KEY_LEFTALT, KEY_RIGHTALT,
|
||||
0, 0, 0, 0 };
|
||||
scancode = map[code & 0xF];
|
||||
} else if ((code>='A' && code<='Z') || (code>='a' && code<='z')) {
|
||||
static const uint16_t map[] = {
|
||||
KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
|
||||
KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
|
||||
KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
|
||||
KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
|
||||
KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z };
|
||||
scancode = map[(code & 0x5F) - 'A'];
|
||||
} else {
|
||||
switch (code) {
|
||||
case 0x0003: scancode = KEY_CENTER; break;
|
||||
case 0x0020: scancode = KEY_SPACE; break;
|
||||
case 0x0023: scancode = KEY_SHARP; break;
|
||||
case 0x0033: scancode = KEY_SHARP; break;
|
||||
case 0x002C: scancode = KEY_COMMA; break;
|
||||
case 0x003C: scancode = KEY_COMMA; break;
|
||||
case 0x002E: scancode = KEY_DOT; break;
|
||||
case 0x003E: scancode = KEY_DOT; break;
|
||||
case 0x002F: scancode = KEY_SLASH; break;
|
||||
case 0x003F: scancode = KEY_SLASH; break;
|
||||
case 0x0032: scancode = KEY_EMAIL; break;
|
||||
case 0x0040: scancode = KEY_EMAIL; break;
|
||||
case 0xFF08: scancode = KEY_BACKSPACE; break;
|
||||
case 0xFF1B: scancode = KEY_BACK; break;
|
||||
case 0xFF09: scancode = KEY_TAB; break;
|
||||
case 0xFF0D: scancode = KEY_ENTER; break;
|
||||
case 0x002A: scancode = KEY_STAR; break;
|
||||
case 0xFFBE: scancode = KEY_F1; break; // F1
|
||||
case 0xFFBF: scancode = KEY_F2; break; // F2
|
||||
case 0xFFC0: scancode = KEY_F3; break; // F3
|
||||
case 0xFFC5: scancode = KEY_F4; break; // F8
|
||||
case 0xFFC8: rfbShutdownServer(cl->screen,TRUE); break; // F11
|
||||
}
|
||||
}
|
||||
|
||||
return scancode;
|
||||
}
|
||||
|
||||
static void keyevent(rfbBool down, rfbKeySym key, rfbClientPtr cl)
|
||||
{
|
||||
int scancode;
|
||||
|
||||
printf("Got keysym: %04x (down=%d)\n", (unsigned int)key, (int)down);
|
||||
|
||||
if ((scancode = keysym2scancode(down, key, cl)))
|
||||
{
|
||||
injectKeyEvent(scancode, down);
|
||||
}
|
||||
}
|
||||
|
||||
void injectTouchEvent(int down, int x, int y)
|
||||
{
|
||||
struct input_event ev;
|
||||
|
||||
// Calculate the final x and y
|
||||
/* Fake touch screen always reports zero */
|
||||
if (xmin != 0 && xmax != 0 && ymin != 0 && ymax != 0)
|
||||
{
|
||||
x = xmin + (x * (xmax - xmin)) / (scrinfo.xres);
|
||||
y = ymin + (y * (ymax - ymin)) / (scrinfo.yres);
|
||||
}
|
||||
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
|
||||
// Then send a BTN_TOUCH
|
||||
gettimeofday(&ev.time,0);
|
||||
ev.type = EV_KEY;
|
||||
ev.code = BTN_TOUCH;
|
||||
ev.value = down;
|
||||
if(write(touchfd, &ev, sizeof(ev)) < 0)
|
||||
{
|
||||
printf("write event failed, %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
// Then send the X
|
||||
gettimeofday(&ev.time,0);
|
||||
ev.type = EV_ABS;
|
||||
ev.code = ABS_X;
|
||||
ev.value = x;
|
||||
if(write(touchfd, &ev, sizeof(ev)) < 0)
|
||||
{
|
||||
printf("write event failed, %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
// Then send the Y
|
||||
gettimeofday(&ev.time,0);
|
||||
ev.type = EV_ABS;
|
||||
ev.code = ABS_Y;
|
||||
ev.value = y;
|
||||
if(write(touchfd, &ev, sizeof(ev)) < 0)
|
||||
{
|
||||
printf("write event failed, %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
// Finally send the SYN
|
||||
gettimeofday(&ev.time,0);
|
||||
ev.type = EV_SYN;
|
||||
ev.code = 0;
|
||||
ev.value = 0;
|
||||
if(write(touchfd, &ev, sizeof(ev)) < 0)
|
||||
{
|
||||
printf("write event failed, %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
printf("injectTouchEvent (x=%d, y=%d, down=%d)\n", x , y, down);
|
||||
}
|
||||
|
||||
static void ptrevent(int buttonMask, int x, int y, rfbClientPtr cl)
|
||||
{
|
||||
/* Indicates either pointer movement or a pointer button press or release. The pointer is
|
||||
now at (x-position, y-position), and the current state of buttons 1 to 8 are represented
|
||||
by bits 0 to 7 of button-mask respectively, 0 meaning up, 1 meaning down (pressed).
|
||||
On a conventional mouse, buttons 1, 2 and 3 correspond to the left, middle and right
|
||||
buttons on the mouse. On a wheel mouse, each step of the wheel upwards is represented
|
||||
by a press and release of button 4, and each step downwards is represented by
|
||||
a press and release of button 5.
|
||||
From: http://www.vislab.usyd.edu.au/blogs/index.php/2009/05/22/an-headerless-indexed-protocol-for-input-1?blog=61 */
|
||||
|
||||
//printf("Got ptrevent: %04x (x=%d, y=%d)\n", buttonMask, x, y);
|
||||
if(buttonMask & 1) {
|
||||
// Simulate left mouse event as touch event
|
||||
injectTouchEvent(1, x, y);
|
||||
injectTouchEvent(0, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
#define PIXEL_FB_TO_RFB(p,r,g,b) ((p>>r)&0x1f001f)|(((p>>g)&0x1f001f)<<5)|(((p>>b)&0x1f001f)<<10)
|
||||
|
||||
static void update_screen(void)
|
||||
{
|
||||
unsigned int *f, *c, *r;
|
||||
int x, y;
|
||||
|
||||
varblock.min_i = varblock.min_j = 9999;
|
||||
varblock.max_i = varblock.max_j = -1;
|
||||
|
||||
f = (unsigned int *)fbmmap; /* -> framebuffer */
|
||||
c = (unsigned int *)fbbuf; /* -> compare framebuffer */
|
||||
r = (unsigned int *)vncbuf; /* -> remote framebuffer */
|
||||
|
||||
for (y = 0; y < scrinfo.yres; y++)
|
||||
{
|
||||
/* Compare every 2 pixels at a time, assuming that changes are likely
|
||||
* in pairs. */
|
||||
for (x = 0; x < scrinfo.xres; x += 2)
|
||||
{
|
||||
unsigned int pixel = *f;
|
||||
|
||||
if (pixel != *c)
|
||||
{
|
||||
*c = pixel;
|
||||
|
||||
/* XXX: Undo the checkered pattern to test the efficiency
|
||||
* gain using hextile encoding. */
|
||||
if (pixel == 0x18e320e4 || pixel == 0x20e418e3)
|
||||
pixel = 0x18e318e3;
|
||||
|
||||
*r = PIXEL_FB_TO_RFB(pixel,
|
||||
varblock.r_offset, varblock.g_offset, varblock.b_offset);
|
||||
|
||||
if (x < varblock.min_i)
|
||||
varblock.min_i = x;
|
||||
else
|
||||
{
|
||||
if (x > varblock.max_i)
|
||||
varblock.max_i = x;
|
||||
|
||||
if (y > varblock.max_j)
|
||||
varblock.max_j = y;
|
||||
else if (y < varblock.min_j)
|
||||
varblock.min_j = y;
|
||||
}
|
||||
}
|
||||
|
||||
f++, c++;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
|
||||
if (varblock.min_i < 9999)
|
||||
{
|
||||
if (varblock.max_i < 0)
|
||||
varblock.max_i = varblock.min_i;
|
||||
|
||||
if (varblock.max_j < 0)
|
||||
varblock.max_j = varblock.min_j;
|
||||
|
||||
fprintf(stderr, "Dirty page: %dx%d+%d+%d...\n",
|
||||
(varblock.max_i+2) - varblock.min_i, (varblock.max_j+1) - varblock.min_j,
|
||||
varblock.min_i, varblock.min_j);
|
||||
|
||||
rfbMarkRectAsModified(vncscr, varblock.min_i, varblock.min_j,
|
||||
varblock.max_i + 2, varblock.max_j + 1);
|
||||
|
||||
rfbProcessEvents(vncscr, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void print_usage(char **argv)
|
||||
{
|
||||
printf("%s [-k device] [-t device] [-h]\n"
|
||||
"-k device: keyboard device node, default is /dev/input/event3\n"
|
||||
"-t device: touch device node, default is /dev/input/event1\n"
|
||||
"-h : print this help\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc > 1)
|
||||
{
|
||||
int i=1;
|
||||
while(i < argc)
|
||||
{
|
||||
if(*argv[i] == '-')
|
||||
{
|
||||
switch(*(argv[i] + 1))
|
||||
{
|
||||
case 'h':
|
||||
print_usage(argv);
|
||||
exit(0);
|
||||
break;
|
||||
case 'k':
|
||||
i++;
|
||||
strcpy(KBD_DEVICE, argv[i]);
|
||||
break;
|
||||
case 't':
|
||||
i++;
|
||||
strcpy(TOUCH_DEVICE, argv[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Initializing framebuffer device " FB_DEVICE "...\n");
|
||||
init_fb();
|
||||
printf("Initializing keyboard device %s ...\n", KBD_DEVICE);
|
||||
init_kbd();
|
||||
printf("Initializing touch device %s ...\n", TOUCH_DEVICE);
|
||||
init_touch();
|
||||
|
||||
printf("Initializing VNC server:\n");
|
||||
printf(" width: %d\n", (int)scrinfo.xres);
|
||||
printf(" height: %d\n", (int)scrinfo.yres);
|
||||
printf(" bpp: %d\n", (int)scrinfo.bits_per_pixel);
|
||||
printf(" port: %d\n", (int)VNC_PORT);
|
||||
init_fb_server(argc, argv);
|
||||
|
||||
/* Implement our own event loop to detect changes in the framebuffer. */
|
||||
while (1)
|
||||
{
|
||||
while (vncscr->clientHead == NULL)
|
||||
rfbProcessEvents(vncscr, 100000);
|
||||
|
||||
rfbProcessEvents(vncscr, 100000);
|
||||
update_screen();
|
||||
}
|
||||
|
||||
printf("Cleaning up...\n");
|
||||
cleanup_fb();
|
||||
cleanup_kdb();
|
||||
cleanup_touch();
|
||||
}
|
116
jni/vnc/LibVNCServer-0.9.9/examples/backchannel.c
Normal file
116
jni/vnc/LibVNCServer-0.9.9/examples/backchannel.c
Normal file
@ -0,0 +1,116 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
/**
|
||||
* @example backchannel.c
|
||||
* This is a simple example demonstrating a protocol extension.
|
||||
*
|
||||
* The "back channel" permits sending commands between client and server.
|
||||
* It works by sending plain text messages.
|
||||
*
|
||||
* As suggested in the RFB protocol, the back channel is enabled by asking
|
||||
* for a "pseudo encoding", and enabling the back channel on the client side
|
||||
* as soon as it gets a back channel message from the server.
|
||||
*
|
||||
* This implements the server part.
|
||||
*
|
||||
* Note: If you design your own extension and want it to be useful for others,
|
||||
* too, you should make sure that
|
||||
*
|
||||
* - your server as well as your client can speak to other clients and
|
||||
* servers respectively (i.e. they are nice if they are talking to a
|
||||
* program which does not know about your extension).
|
||||
*
|
||||
* - if the machine is little endian, all 16-bit and 32-bit integers are
|
||||
* swapped before they are sent and after they are received.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rfbBackChannel 155
|
||||
|
||||
typedef struct backChannelMsg {
|
||||
uint8_t type;
|
||||
uint8_t pad1;
|
||||
uint16_t pad2;
|
||||
uint32_t size;
|
||||
} backChannelMsg;
|
||||
|
||||
rfbBool enableBackChannel(rfbClientPtr cl, void** data, int encoding)
|
||||
{
|
||||
if(encoding == rfbBackChannel) {
|
||||
backChannelMsg msg;
|
||||
const char* text="Server acknowledges back channel encoding\n";
|
||||
uint32_t length = strlen(text)+1;
|
||||
int n;
|
||||
|
||||
rfbLog("Enabling the back channel\n");
|
||||
|
||||
msg.type = rfbBackChannel;
|
||||
msg.size = Swap32IfLE(length);
|
||||
if((n = rfbWriteExact(cl, (char*)&msg, sizeof(msg))) <= 0 ||
|
||||
(n = rfbWriteExact(cl, text, length)) <= 0) {
|
||||
rfbLogPerror("enableBackChannel: write");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static rfbBool handleBackChannelMessage(rfbClientPtr cl, void* data,
|
||||
const rfbClientToServerMsg* message)
|
||||
{
|
||||
if(message->type == rfbBackChannel) {
|
||||
backChannelMsg msg;
|
||||
char* text;
|
||||
int n;
|
||||
if((n = rfbReadExact(cl, ((char*)&msg)+1, sizeof(backChannelMsg)-1)) <= 0) {
|
||||
if(n != 0)
|
||||
rfbLogPerror("handleBackChannelMessage: read");
|
||||
rfbCloseClient(cl);
|
||||
return TRUE;
|
||||
}
|
||||
msg.size = Swap32IfLE(msg.size);
|
||||
if((text = malloc(msg.size)) == NULL) {
|
||||
rfbErr("Could not allocate %d bytes\n", msg.size);
|
||||
return TRUE;
|
||||
}
|
||||
if((n = rfbReadExact(cl, text, msg.size)) <= 0) {
|
||||
if(n != 0)
|
||||
rfbLogPerror("handleBackChannelMessage: read");
|
||||
rfbCloseClient(cl);
|
||||
return TRUE;
|
||||
}
|
||||
rfbLog("got message:\n%s\n", text);
|
||||
free(text);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int backChannelEncodings[] = {rfbBackChannel, 0};
|
||||
|
||||
static rfbProtocolExtension backChannelExtension = {
|
||||
NULL, /* newClient */
|
||||
NULL, /* init */
|
||||
backChannelEncodings, /* pseudoEncodings */
|
||||
enableBackChannel, /* enablePseudoEncoding */
|
||||
handleBackChannelMessage, /* handleMessage */
|
||||
NULL, /* close */
|
||||
NULL, /* usage */
|
||||
NULL, /* processArgument */
|
||||
NULL /* next extension */
|
||||
};
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbScreenInfoPtr server;
|
||||
|
||||
rfbRegisterProtocolExtension(&backChannelExtension);
|
||||
|
||||
server=rfbGetScreen(&argc,argv,400,300,8,3,4);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->frameBuffer=(char*)malloc(400*300*4);
|
||||
rfbInitServer(server);
|
||||
rfbRunEventLoop(server,-1,FALSE);
|
||||
return(0);
|
||||
}
|
2
jni/vnc/LibVNCServer-0.9.9/examples/blooptest.c
Normal file
2
jni/vnc/LibVNCServer-0.9.9/examples/blooptest.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define BACKGROUND_LOOP_TEST
|
||||
#include "example.c"
|
155
jni/vnc/LibVNCServer-0.9.9/examples/camera.c
Normal file
155
jni/vnc/LibVNCServer-0.9.9/examples/camera.c
Normal file
@ -0,0 +1,155 @@
|
||||
|
||||
/**
|
||||
* @example camera.c
|
||||
* Question: I need to display a live camera image via VNC. Until now I just
|
||||
* grab an image, set the rect to modified and do a 0.1 s sleep to give the
|
||||
* system time to transfer the data.
|
||||
* This is obviously a solution which doesn't scale very well to different
|
||||
* connection speeds/cpu horsepowers, so I wonder if there is a way for the
|
||||
* server application to determine if the updates have been sent. This would
|
||||
* cause the live image update rate to always be the maximum the connection
|
||||
* supports while avoiding excessive loads.
|
||||
*
|
||||
* Thanks in advance,
|
||||
*
|
||||
*
|
||||
* Christian Daschill
|
||||
*
|
||||
*
|
||||
* Answer: Originally, I thought about using seperate threads and using a
|
||||
* mutex to determine when the frame buffer was being accessed by any client
|
||||
* so we could determine a safe time to take a picture. The probem is, we
|
||||
* are lock-stepping everything with framebuffer access. Why not be a
|
||||
* single-thread application and in-between rfbProcessEvents perform a
|
||||
* camera snapshot. And this is what I do here. It guarantees that the
|
||||
* clients have been serviced before taking another picture.
|
||||
*
|
||||
* The downside to this approach is that the more clients you have, there is
|
||||
* less time available for you to service the camera equating to reduced
|
||||
* frame rate. (or, your clients are on really slow links). Increasing your
|
||||
* systems ethernet transmit queues may help improve the overall performance
|
||||
* as the libvncserver should not stall on transmitting to any single
|
||||
* client.
|
||||
*
|
||||
* Another solution would be to provide a seperate framebuffer for each
|
||||
* client and use mutexes to determine if any particular client is ready for
|
||||
* a snapshot. This way, your not updating a framebuffer for a slow client
|
||||
* while it is being transferred.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
|
||||
#define WIDTH 640
|
||||
#define HEIGHT 480
|
||||
#define BPP 4
|
||||
|
||||
/* 15 frames per second (if we can) */
|
||||
#define PICTURE_TIMEOUT (1.0/15.0)
|
||||
|
||||
|
||||
/*
|
||||
* throttle camera updates
|
||||
*/
|
||||
int TimeToTakePicture() {
|
||||
static struct timeval now={0,0}, then={0,0};
|
||||
double elapsed, dnow, dthen;
|
||||
|
||||
gettimeofday(&now,NULL);
|
||||
|
||||
dnow = now.tv_sec + (now.tv_usec /1000000.0);
|
||||
dthen = then.tv_sec + (then.tv_usec/1000000.0);
|
||||
elapsed = dnow - dthen;
|
||||
|
||||
if (elapsed > PICTURE_TIMEOUT)
|
||||
memcpy((char *)&then, (char *)&now, sizeof(struct timeval));
|
||||
return elapsed > PICTURE_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* simulate grabbing a picture from some device
|
||||
*/
|
||||
int TakePicture(unsigned char *buffer)
|
||||
{
|
||||
static int last_line=0, fps=0, fcount=0;
|
||||
int line=0;
|
||||
int i,j;
|
||||
struct timeval now;
|
||||
|
||||
/*
|
||||
* simulate grabbing data from a device by updating the entire framebuffer
|
||||
*/
|
||||
|
||||
for(j=0;j<HEIGHT;++j) {
|
||||
for(i=0;i<WIDTH;++i) {
|
||||
buffer[(j*WIDTH+i)*BPP+0]=(i+j)*128/(WIDTH+HEIGHT); /* red */
|
||||
buffer[(j*WIDTH+i)*BPP+1]=i*128/WIDTH; /* green */
|
||||
buffer[(j*WIDTH+i)*BPP+2]=j*256/HEIGHT; /* blue */
|
||||
}
|
||||
buffer[j*WIDTH*BPP+0]=0xff;
|
||||
buffer[j*WIDTH*BPP+1]=0xff;
|
||||
buffer[j*WIDTH*BPP+2]=0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* simulate the passage of time
|
||||
*
|
||||
* draw a simple black line that moves down the screen. The faster the
|
||||
* client, the more updates it will get, the smoother it will look!
|
||||
*/
|
||||
gettimeofday(&now,NULL);
|
||||
line = now.tv_usec / (1000000/HEIGHT);
|
||||
if (line>HEIGHT) line=HEIGHT-1;
|
||||
memset(&buffer[(WIDTH * BPP) * line], 0, (WIDTH * BPP));
|
||||
|
||||
/* frames per second (informational only) */
|
||||
fcount++;
|
||||
if (last_line > line) {
|
||||
fps = fcount;
|
||||
fcount = 0;
|
||||
}
|
||||
last_line = line;
|
||||
fprintf(stderr,"%03d/%03d Picture (%03d fps)\r", line, HEIGHT, fps);
|
||||
|
||||
/* success! We have a new picture! */
|
||||
return (1==1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Single-threaded application that interleaves client servicing with taking
|
||||
* pictures from the camera. This way, we do not update the framebuffer
|
||||
* while an encoding is working on it too (banding, and image artifacts).
|
||||
*/
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
long usec;
|
||||
|
||||
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,WIDTH,HEIGHT,8,3,BPP);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->desktopName = "Live Video Feed Example";
|
||||
server->frameBuffer=(char*)malloc(WIDTH*HEIGHT*BPP);
|
||||
server->alwaysShared=(1==1);
|
||||
|
||||
/* Initialize the server */
|
||||
rfbInitServer(server);
|
||||
|
||||
/* Loop, processing clients and taking pictures */
|
||||
while (rfbIsActive(server)) {
|
||||
if (TimeToTakePicture())
|
||||
if (TakePicture((unsigned char *)server->frameBuffer))
|
||||
rfbMarkRectAsModified(server,0,0,WIDTH,HEIGHT);
|
||||
|
||||
usec = server->deferUpdateTime*1000;
|
||||
rfbProcessEvents(server,usec);
|
||||
}
|
||||
return(0);
|
||||
}
|
33
jni/vnc/LibVNCServer-0.9.9/examples/colourmaptest.c
Normal file
33
jni/vnc/LibVNCServer-0.9.9/examples/colourmaptest.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
int i;
|
||||
uint8_t bytes[256*3];
|
||||
|
||||
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->serverFormat.trueColour=FALSE;
|
||||
server->colourMap.count=256;
|
||||
server->colourMap.is16=FALSE;
|
||||
for(i=0;i<256;i++) {
|
||||
bytes[i*3+0]=255-i; /* red */
|
||||
bytes[i*3+1]=0; /* green */
|
||||
bytes[i*3+2]=i; /* blue */
|
||||
}
|
||||
bytes[128*3+0]=0xff;
|
||||
bytes[128*3+1]=0;
|
||||
bytes[128*3+2]=0;
|
||||
server->colourMap.data.bytes=bytes;
|
||||
|
||||
server->frameBuffer=(char*)malloc(256*256);
|
||||
for(i=0;i<256*256;i++)
|
||||
server->frameBuffer[i]=(i/256);
|
||||
|
||||
rfbInitServer(server);
|
||||
rfbRunEventLoop(server,-1,FALSE);
|
||||
|
||||
return(0);
|
||||
}
|
337
jni/vnc/LibVNCServer-0.9.9/examples/example.c
Normal file
337
jni/vnc/LibVNCServer-0.9.9/examples/example.c
Normal file
@ -0,0 +1,337 @@
|
||||
/**
|
||||
* @example example.c
|
||||
* This is an example of how to use libvncserver.
|
||||
*
|
||||
* libvncserver example
|
||||
* Copyright (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#define sleep Sleep
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __IRIX__
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
|
||||
static const int bpp=4;
|
||||
static int maxx=800, maxy=600;
|
||||
/* TODO: odd maxx doesn't work (vncviewer bug) */
|
||||
|
||||
/* This initializes a nice (?) background */
|
||||
|
||||
static void initBuffer(unsigned char* buffer)
|
||||
{
|
||||
int i,j;
|
||||
for(j=0;j<maxy;++j) {
|
||||
for(i=0;i<maxx;++i) {
|
||||
buffer[(j*maxx+i)*bpp+0]=(i+j)*128/(maxx+maxy); /* red */
|
||||
buffer[(j*maxx+i)*bpp+1]=i*128/maxx; /* green */
|
||||
buffer[(j*maxx+i)*bpp+2]=j*256/maxy; /* blue */
|
||||
}
|
||||
buffer[j*maxx*bpp+0]=0xff;
|
||||
buffer[j*maxx*bpp+1]=0xff;
|
||||
buffer[j*maxx*bpp+2]=0xff;
|
||||
buffer[j*maxx*bpp+3]=0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here we create a structure so that every client has it's own pointer */
|
||||
|
||||
typedef struct ClientData {
|
||||
rfbBool oldButton;
|
||||
int oldx,oldy;
|
||||
} ClientData;
|
||||
|
||||
static void clientgone(rfbClientPtr cl)
|
||||
{
|
||||
free(cl->clientData);
|
||||
}
|
||||
|
||||
static enum rfbNewClientAction newclient(rfbClientPtr cl)
|
||||
{
|
||||
cl->clientData = (void*)calloc(sizeof(ClientData),1);
|
||||
cl->clientGoneHook = clientgone;
|
||||
return RFB_CLIENT_ACCEPT;
|
||||
}
|
||||
|
||||
/* switch to new framebuffer contents */
|
||||
|
||||
static void newframebuffer(rfbScreenInfoPtr screen, int width, int height)
|
||||
{
|
||||
unsigned char *oldfb, *newfb;
|
||||
|
||||
maxx = width;
|
||||
maxy = height;
|
||||
oldfb = (unsigned char*)screen->frameBuffer;
|
||||
newfb = (unsigned char*)malloc(maxx * maxy * bpp);
|
||||
initBuffer(newfb);
|
||||
rfbNewFramebuffer(screen, (char*)newfb, maxx, maxy, 8, 3, bpp);
|
||||
free(oldfb);
|
||||
|
||||
/*** FIXME: Re-install cursor. ***/
|
||||
}
|
||||
|
||||
/* aux function to draw a line */
|
||||
|
||||
static void drawline(unsigned char* buffer,int rowstride,int bpp,int x1,int y1,int x2,int y2)
|
||||
{
|
||||
int i,j;
|
||||
i=x1-x2; j=y1-y2;
|
||||
if(i==0 && j==0) {
|
||||
for(i=0;i<bpp;i++)
|
||||
buffer[y1*rowstride+x1*bpp+i]=0xff;
|
||||
return;
|
||||
}
|
||||
if(i<0) i=-i;
|
||||
if(j<0) j=-j;
|
||||
if(i<j) {
|
||||
if(y1>y2) { i=y2; y2=y1; y1=i; i=x2; x2=x1; x1=i; }
|
||||
for(j=y1;j<=y2;j++)
|
||||
for(i=0;i<bpp;i++)
|
||||
buffer[j*rowstride+(x1+(j-y1)*(x2-x1)/(y2-y1))*bpp+i]=0xff;
|
||||
} else {
|
||||
if(x1>x2) { i=y2; y2=y1; y1=i; i=x2; x2=x1; x1=i; }
|
||||
for(i=x1;i<=x2;i++)
|
||||
for(j=0;j<bpp;j++)
|
||||
buffer[(y1+(i-x1)*(y2-y1)/(x2-x1))*rowstride+i*bpp+j]=0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here the pointer events are handled */
|
||||
|
||||
static void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
|
||||
{
|
||||
ClientData* cd=cl->clientData;
|
||||
|
||||
if(x>=0 && y>=0 && x<maxx && y<maxy) {
|
||||
if(buttonMask) {
|
||||
int i,j,x1,x2,y1,y2;
|
||||
|
||||
if(cd->oldButton==buttonMask) { /* draw a line */
|
||||
drawline((unsigned char*)cl->screen->frameBuffer,cl->screen->paddedWidthInBytes,bpp,
|
||||
x,y,cd->oldx,cd->oldy);
|
||||
x1=x; y1=y;
|
||||
if(x1>cd->oldx) x1++; else cd->oldx++;
|
||||
if(y1>cd->oldy) y1++; else cd->oldy++;
|
||||
rfbMarkRectAsModified(cl->screen,x,y,cd->oldx,cd->oldy);
|
||||
} else { /* draw a point (diameter depends on button) */
|
||||
int w=cl->screen->paddedWidthInBytes;
|
||||
x1=x-buttonMask; if(x1<0) x1=0;
|
||||
x2=x+buttonMask; if(x2>maxx) x2=maxx;
|
||||
y1=y-buttonMask; if(y1<0) y1=0;
|
||||
y2=y+buttonMask; if(y2>maxy) y2=maxy;
|
||||
|
||||
for(i=x1*bpp;i<x2*bpp;i++)
|
||||
for(j=y1;j<y2;j++)
|
||||
cl->screen->frameBuffer[j*w+i]=(char)0xff;
|
||||
rfbMarkRectAsModified(cl->screen,x1,y1,x2,y2);
|
||||
}
|
||||
|
||||
/* we could get a selection like that:
|
||||
rfbGotXCutText(cl->screen,"Hallo",5);
|
||||
*/
|
||||
} else
|
||||
cd->oldButton=0;
|
||||
|
||||
cd->oldx=x; cd->oldy=y; cd->oldButton=buttonMask;
|
||||
}
|
||||
rfbDefaultPtrAddEvent(buttonMask,x,y,cl);
|
||||
}
|
||||
|
||||
/* aux function to draw a character to x, y */
|
||||
|
||||
#include "radon.h"
|
||||
|
||||
/* Here the key events are handled */
|
||||
|
||||
static void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
|
||||
{
|
||||
if(down) {
|
||||
if(key==XK_Escape)
|
||||
rfbCloseClient(cl);
|
||||
else if(key==XK_F12)
|
||||
/* close down server, disconnecting clients */
|
||||
rfbShutdownServer(cl->screen,TRUE);
|
||||
else if(key==XK_F11)
|
||||
/* close down server, but wait for all clients to disconnect */
|
||||
rfbShutdownServer(cl->screen,FALSE);
|
||||
else if(key==XK_Page_Up) {
|
||||
initBuffer((unsigned char*)cl->screen->frameBuffer);
|
||||
rfbMarkRectAsModified(cl->screen,0,0,maxx,maxy);
|
||||
} else if (key == XK_Up) {
|
||||
if (maxx < 1024) {
|
||||
if (maxx < 800) {
|
||||
newframebuffer(cl->screen, 800, 600);
|
||||
} else {
|
||||
newframebuffer(cl->screen, 1024, 768);
|
||||
}
|
||||
}
|
||||
} else if(key==XK_Down) {
|
||||
if (maxx > 640) {
|
||||
if (maxx > 800) {
|
||||
newframebuffer(cl->screen, 800, 600);
|
||||
} else {
|
||||
newframebuffer(cl->screen, 640, 480);
|
||||
}
|
||||
}
|
||||
} else if(key>=' ' && key<0x100) {
|
||||
ClientData* cd=cl->clientData;
|
||||
int x1=cd->oldx,y1=cd->oldy,x2,y2;
|
||||
cd->oldx+=rfbDrawCharWithClip(cl->screen,&radonFont,cd->oldx,cd->oldy,(char)key,0,0,cl->screen->width,cl->screen->height,0x00ffffff,0x00ffffff);
|
||||
rfbFontBBox(&radonFont,(char)key,&x1,&y1,&x2,&y2);
|
||||
rfbMarkRectAsModified(cl->screen,x1,y1,x2-1,y2-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Example for an XCursor (foreground/background only) */
|
||||
|
||||
#ifdef JUST_AN_EXAMPLE
|
||||
|
||||
static int exampleXCursorWidth=9,exampleXCursorHeight=7;
|
||||
static char exampleXCursor[]=
|
||||
" "
|
||||
" xx xx "
|
||||
" xx xx "
|
||||
" xxx "
|
||||
" xx xx "
|
||||
" xx xx "
|
||||
" ";
|
||||
|
||||
#endif
|
||||
|
||||
/* Example for a rich cursor (full-colour) */
|
||||
|
||||
static void MakeRichCursor(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
int i,j,w=32,h=32;
|
||||
rfbCursorPtr c = rfbScreen->cursor;
|
||||
char bitmap[]=
|
||||
" "
|
||||
" xxxxxx "
|
||||
" xxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxx xxxxxxxx xxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxx xxxxxxxxxxx xxxxxxx "
|
||||
" xxxx xxxxxxxxx xxxxxx "
|
||||
" xxxxx xxxxxxxxxxx xxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxx xxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxx xxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxx xxxxxxxxxxxx "
|
||||
" xxxxxxxxx xxxxxxxxx "
|
||||
" xxxxxxxxxx xxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxx "
|
||||
" xxxx xxxxxxxxxxxxx "
|
||||
" xx x xxxxxxxxxxx "
|
||||
" xxx xxxxxxxxxxx "
|
||||
" xxxx xxxxxxxxxxx "
|
||||
" xxxxxx xxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxxxxxxxx "
|
||||
" xxxxxxxxxxxxxxxx "
|
||||
" ";
|
||||
c=rfbScreen->cursor = rfbMakeXCursor(w,h,bitmap,bitmap);
|
||||
c->xhot = 16; c->yhot = 24;
|
||||
|
||||
c->richSource = (unsigned char*)malloc(w*h*bpp);
|
||||
c->cleanupRichSource = TRUE;
|
||||
for(j=0;j<h;j++) {
|
||||
for(i=0;i<w;i++) {
|
||||
c->richSource[j*w*bpp+i*bpp+0]=i*0xff/w;
|
||||
c->richSource[j*w*bpp+i*bpp+1]=(i+j)*0xff/(w+h);
|
||||
c->richSource[j*w*bpp+i*bpp+2]=j*0xff/h;
|
||||
c->richSource[j*w*bpp+i*bpp+3]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialization */
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp);
|
||||
if(!rfbScreen)
|
||||
return 0;
|
||||
rfbScreen->desktopName = "LibVNCServer Example";
|
||||
rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp);
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
rfbScreen->ptrAddEvent = doptr;
|
||||
rfbScreen->kbdAddEvent = dokey;
|
||||
rfbScreen->newClientHook = newclient;
|
||||
rfbScreen->httpDir = "../webclients";
|
||||
rfbScreen->httpEnableProxyConnect = TRUE;
|
||||
|
||||
initBuffer((unsigned char*)rfbScreen->frameBuffer);
|
||||
rfbDrawString(rfbScreen,&radonFont,20,100,"Hello, World!",0xffffff);
|
||||
|
||||
/* This call creates a mask and then a cursor: */
|
||||
/* rfbScreen->defaultCursor =
|
||||
rfbMakeXCursor(exampleCursorWidth,exampleCursorHeight,exampleCursor,0);
|
||||
*/
|
||||
|
||||
MakeRichCursor(rfbScreen);
|
||||
|
||||
/* initialize the server */
|
||||
rfbInitServer(rfbScreen);
|
||||
|
||||
#ifndef BACKGROUND_LOOP_TEST
|
||||
#ifdef USE_OWN_LOOP
|
||||
{
|
||||
int i;
|
||||
for(i=0;rfbIsActive(rfbScreen);i++) {
|
||||
fprintf(stderr,"%d\r",i);
|
||||
rfbProcessEvents(rfbScreen,100000);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* this is the blocking event loop, i.e. it never returns */
|
||||
/* 40000 are the microseconds to wait on select(), i.e. 0.04 seconds */
|
||||
rfbRunEventLoop(rfbScreen,40000,FALSE);
|
||||
#endif /* OWN LOOP */
|
||||
#else
|
||||
#if !defined(LIBVNCSERVER_HAVE_LIBPTHREAD)
|
||||
#error "I need pthreads for that."
|
||||
#endif
|
||||
|
||||
/* this is the non-blocking event loop; a background thread is started */
|
||||
rfbRunEventLoop(rfbScreen,-1,TRUE);
|
||||
fprintf(stderr, "Running background loop...\n");
|
||||
/* now we could do some cool things like rendering in idle time */
|
||||
while(1) sleep(5); /* render(); */
|
||||
#endif /* BACKGROUND_LOOP */
|
||||
|
||||
free(rfbScreen->frameBuffer);
|
||||
rfbScreenCleanup(rfbScreen);
|
||||
|
||||
return(0);
|
||||
}
|
17
jni/vnc/LibVNCServer-0.9.9/examples/filetransfer.c
Normal file
17
jni/vnc/LibVNCServer-0.9.9/examples/filetransfer.c
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @example filetransfer.c
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->frameBuffer=(char*)malloc(400*300*4);
|
||||
rfbRegisterTightVNCFileTransferExtension();
|
||||
rfbInitServer(server);
|
||||
rfbRunEventLoop(server,-1,FALSE);
|
||||
return(0);
|
||||
}
|
76
jni/vnc/LibVNCServer-0.9.9/examples/fontsel.c
Normal file
76
jni/vnc/LibVNCServer-0.9.9/examples/fontsel.c
Normal file
@ -0,0 +1,76 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
#define FONTDIR "/usr/lib/kbd/consolefonts/"
|
||||
#define DEFAULTFONT FONTDIR "default8x16"
|
||||
|
||||
static char *fontlist[50]={
|
||||
"8x16alt", "b.fnt", "c.fnt", "default8x16", "m.fnt", "ml.fnt", "mod_d.fnt",
|
||||
"mod_s.fnt", "mr.fnt", "mu.fnt", "r.fnt", "rl.fnt", "ro.fnt", "s.fnt",
|
||||
"sc.fnt", "scrawl_s.fnt", "scrawl_w.fnt", "sd.fnt", "t.fnt",
|
||||
NULL
|
||||
};
|
||||
|
||||
static rfbScreenInfoPtr rfbScreen = NULL;
|
||||
static rfbFontDataPtr curFont = NULL;
|
||||
static void showFont(int index)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
if(!rfbScreen) return;
|
||||
|
||||
if(curFont)
|
||||
rfbFreeFont(curFont);
|
||||
|
||||
strcpy(buffer,FONTDIR);
|
||||
strcat(buffer,fontlist[index]);
|
||||
curFont = rfbLoadConsoleFont(buffer);
|
||||
|
||||
rfbFillRect(rfbScreen,210,30-20,210+10*16,30-20+256*20/16,0xb77797);
|
||||
if(curFont) {
|
||||
int i,j;
|
||||
for(j=0;j<256;j+=16)
|
||||
for(i=0;i<16;i++)
|
||||
rfbDrawCharWithClip(rfbScreen,curFont,210+10*i,30+j*20/16,j+i,
|
||||
0,0,640,480,0xffffff,0x000000);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbFontDataPtr font;
|
||||
rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,640,480,8,3,3);
|
||||
int i,j;
|
||||
|
||||
if(!s)
|
||||
return 0;
|
||||
|
||||
s->frameBuffer=(char*)malloc(640*480*3);
|
||||
rfbInitServer(s);
|
||||
|
||||
for(j=0;j<480;j++)
|
||||
for(i=0;i<640;i++) {
|
||||
s->frameBuffer[(j*640+i)*3+0]=j*256/480;
|
||||
s->frameBuffer[(j*640+i)*3+1]=i*256/640;
|
||||
s->frameBuffer[(j*640+i)*3+2]=(i+j)*256/(480+640);
|
||||
}
|
||||
|
||||
rfbScreen = s;
|
||||
font=rfbLoadConsoleFont(DEFAULTFONT);
|
||||
if(!font) {
|
||||
rfbErr("Couldn't find %s\n",DEFAULTFONT);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for(j=0;j<0 && rfbIsActive(s);j++)
|
||||
rfbProcessEvents(s,900000);
|
||||
|
||||
i = rfbSelectBox(s,font,fontlist,10,20,200,300,0xffdfdf,0x602040,2,showFont);
|
||||
rfbLog("Selection: %d: %s\n",i,(i>=0)?fontlist[i]:"cancelled");
|
||||
|
||||
rfbFreeFont(font);
|
||||
free(s->frameBuffer);
|
||||
rfbScreenCleanup(s);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
553
jni/vnc/LibVNCServer-0.9.9/examples/mac.c
Normal file
553
jni/vnc/LibVNCServer-0.9.9/examples/mac.c
Normal file
@ -0,0 +1,553 @@
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Cut in two parts by Johannes Schindelin (2001): libvncserver and OSXvnc.
|
||||
*
|
||||
*
|
||||
* This file implements every system specific function for Mac OS X.
|
||||
*
|
||||
* It includes the keyboard functions:
|
||||
*
|
||||
void KbdAddEvent(down, keySym, cl)
|
||||
rfbBool down;
|
||||
rfbKeySym keySym;
|
||||
rfbClientPtr cl;
|
||||
void KbdReleaseAllKeys()
|
||||
*
|
||||
* the mouse functions:
|
||||
*
|
||||
void PtrAddEvent(buttonMask, x, y, cl)
|
||||
int buttonMask;
|
||||
int x;
|
||||
int y;
|
||||
rfbClientPtr cl;
|
||||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
/* zlib doesn't like Byte already defined */
|
||||
#undef Byte
|
||||
#undef TRUE
|
||||
#undef rfbBool
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
|
||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||
#include <IOKit/pwr_mgt/IOPM.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
rfbBool rfbNoDimming = FALSE;
|
||||
rfbBool rfbNoSleep = TRUE;
|
||||
|
||||
static pthread_mutex_t dimming_mutex;
|
||||
static unsigned long dim_time;
|
||||
static unsigned long sleep_time;
|
||||
static mach_port_t master_dev_port;
|
||||
static io_connect_t power_mgt;
|
||||
static rfbBool initialized = FALSE;
|
||||
static rfbBool dim_time_saved = FALSE;
|
||||
static rfbBool sleep_time_saved = FALSE;
|
||||
|
||||
static int
|
||||
saveDimSettings(void)
|
||||
{
|
||||
if (IOPMGetAggressiveness(power_mgt,
|
||||
kPMMinutesToDim,
|
||||
&dim_time) != kIOReturnSuccess)
|
||||
return -1;
|
||||
|
||||
dim_time_saved = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
restoreDimSettings(void)
|
||||
{
|
||||
if (!dim_time_saved)
|
||||
return -1;
|
||||
|
||||
if (IOPMSetAggressiveness(power_mgt,
|
||||
kPMMinutesToDim,
|
||||
dim_time) != kIOReturnSuccess)
|
||||
return -1;
|
||||
|
||||
dim_time_saved = FALSE;
|
||||
dim_time = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
saveSleepSettings(void)
|
||||
{
|
||||
if (IOPMGetAggressiveness(power_mgt,
|
||||
kPMMinutesToSleep,
|
||||
&sleep_time) != kIOReturnSuccess)
|
||||
return -1;
|
||||
|
||||
sleep_time_saved = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
restoreSleepSettings(void)
|
||||
{
|
||||
if (!sleep_time_saved)
|
||||
return -1;
|
||||
|
||||
if (IOPMSetAggressiveness(power_mgt,
|
||||
kPMMinutesToSleep,
|
||||
sleep_time) != kIOReturnSuccess)
|
||||
return -1;
|
||||
|
||||
sleep_time_saved = FALSE;
|
||||
sleep_time = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rfbDimmingInit(void)
|
||||
{
|
||||
pthread_mutex_init(&dimming_mutex, NULL);
|
||||
|
||||
if (IOMasterPort(bootstrap_port, &master_dev_port) != kIOReturnSuccess)
|
||||
return -1;
|
||||
|
||||
if (!(power_mgt = IOPMFindPowerManagement(master_dev_port)))
|
||||
return -1;
|
||||
|
||||
if (rfbNoDimming) {
|
||||
if (saveDimSettings() < 0)
|
||||
return -1;
|
||||
if (IOPMSetAggressiveness(power_mgt,
|
||||
kPMMinutesToDim, 0) != kIOReturnSuccess)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rfbNoSleep) {
|
||||
if (saveSleepSettings() < 0)
|
||||
return -1;
|
||||
if (IOPMSetAggressiveness(power_mgt,
|
||||
kPMMinutesToSleep, 0) != kIOReturnSuccess)
|
||||
return -1;
|
||||
}
|
||||
|
||||
initialized = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rfbUndim(void)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
pthread_mutex_lock(&dimming_mutex);
|
||||
|
||||
if (!initialized)
|
||||
goto DONE;
|
||||
|
||||
if (!rfbNoDimming) {
|
||||
if (saveDimSettings() < 0)
|
||||
goto DONE;
|
||||
if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) != kIOReturnSuccess)
|
||||
goto DONE;
|
||||
if (restoreDimSettings() < 0)
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
if (!rfbNoSleep) {
|
||||
if (saveSleepSettings() < 0)
|
||||
goto DONE;
|
||||
if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) != kIOReturnSuccess)
|
||||
goto DONE;
|
||||
if (restoreSleepSettings() < 0)
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
DONE:
|
||||
pthread_mutex_unlock(&dimming_mutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rfbDimmingShutdown(void)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if (!initialized)
|
||||
goto DONE;
|
||||
|
||||
pthread_mutex_lock(&dimming_mutex);
|
||||
if (dim_time_saved)
|
||||
if (restoreDimSettings() < 0)
|
||||
goto DONE;
|
||||
if (sleep_time_saved)
|
||||
if (restoreSleepSettings() < 0)
|
||||
goto DONE;
|
||||
|
||||
result = 0;
|
||||
|
||||
DONE:
|
||||
pthread_mutex_unlock(&dimming_mutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
rfbScreenInfoPtr rfbScreen;
|
||||
|
||||
void rfbShutdown(rfbClientPtr cl);
|
||||
|
||||
/* some variables to enable special behaviour */
|
||||
int startTime = -1, maxSecsToConnect = 0;
|
||||
rfbBool disconnectAfterFirstClient = TRUE;
|
||||
|
||||
/* Where do I get the "official" list of Mac key codes?
|
||||
Ripped these out of a Mac II emulator called Basilisk II
|
||||
that I found on the net. */
|
||||
static int keyTable[] = {
|
||||
/* The alphabet */
|
||||
XK_A, 0, /* A */
|
||||
XK_B, 11, /* B */
|
||||
XK_C, 8, /* C */
|
||||
XK_D, 2, /* D */
|
||||
XK_E, 14, /* E */
|
||||
XK_F, 3, /* F */
|
||||
XK_G, 5, /* G */
|
||||
XK_H, 4, /* H */
|
||||
XK_I, 34, /* I */
|
||||
XK_J, 38, /* J */
|
||||
XK_K, 40, /* K */
|
||||
XK_L, 37, /* L */
|
||||
XK_M, 46, /* M */
|
||||
XK_N, 45, /* N */
|
||||
XK_O, 31, /* O */
|
||||
XK_P, 35, /* P */
|
||||
XK_Q, 12, /* Q */
|
||||
XK_R, 15, /* R */
|
||||
XK_S, 1, /* S */
|
||||
XK_T, 17, /* T */
|
||||
XK_U, 32, /* U */
|
||||
XK_V, 9, /* V */
|
||||
XK_W, 13, /* W */
|
||||
XK_X, 7, /* X */
|
||||
XK_Y, 16, /* Y */
|
||||
XK_Z, 6, /* Z */
|
||||
XK_a, 0, /* a */
|
||||
XK_b, 11, /* b */
|
||||
XK_c, 8, /* c */
|
||||
XK_d, 2, /* d */
|
||||
XK_e, 14, /* e */
|
||||
XK_f, 3, /* f */
|
||||
XK_g, 5, /* g */
|
||||
XK_h, 4, /* h */
|
||||
XK_i, 34, /* i */
|
||||
XK_j, 38, /* j */
|
||||
XK_k, 40, /* k */
|
||||
XK_l, 37, /* l */
|
||||
XK_m, 46, /* m */
|
||||
XK_n, 45, /* n */
|
||||
XK_o, 31, /* o */
|
||||
XK_p, 35, /* p */
|
||||
XK_q, 12, /* q */
|
||||
XK_r, 15, /* r */
|
||||
XK_s, 1, /* s */
|
||||
XK_t, 17, /* t */
|
||||
XK_u, 32, /* u */
|
||||
XK_v, 9, /* v */
|
||||
XK_w, 13, /* w */
|
||||
XK_x, 7, /* x */
|
||||
XK_y, 16, /* y */
|
||||
XK_z, 6, /* z */
|
||||
|
||||
/* Numbers */
|
||||
XK_0, 29, /* 0 */
|
||||
XK_1, 18, /* 1 */
|
||||
XK_2, 19, /* 2 */
|
||||
XK_3, 20, /* 3 */
|
||||
XK_4, 21, /* 4 */
|
||||
XK_5, 23, /* 5 */
|
||||
XK_6, 22, /* 6 */
|
||||
XK_7, 26, /* 7 */
|
||||
XK_8, 28, /* 8 */
|
||||
XK_9, 25, /* 9 */
|
||||
|
||||
/* Symbols */
|
||||
XK_exclam, 18, /* ! */
|
||||
XK_at, 19, /* @ */
|
||||
XK_numbersign, 20, /* # */
|
||||
XK_dollar, 21, /* $ */
|
||||
XK_percent, 23, /* % */
|
||||
XK_asciicircum, 22, /* ^ */
|
||||
XK_ampersand, 26, /* & */
|
||||
XK_asterisk, 28, /* * */
|
||||
XK_parenleft, 25, /* ( */
|
||||
XK_parenright, 29, /* ) */
|
||||
XK_minus, 27, /* - */
|
||||
XK_underscore, 27, /* _ */
|
||||
XK_equal, 24, /* = */
|
||||
XK_plus, 24, /* + */
|
||||
XK_grave, 10, /* ` */ /* XXX ? */
|
||||
XK_asciitilde, 10, /* ~ */
|
||||
XK_bracketleft, 33, /* [ */
|
||||
XK_braceleft, 33, /* { */
|
||||
XK_bracketright, 30, /* ] */
|
||||
XK_braceright, 30, /* } */
|
||||
XK_semicolon, 41, /* ; */
|
||||
XK_colon, 41, /* : */
|
||||
XK_apostrophe, 39, /* ' */
|
||||
XK_quotedbl, 39, /* " */
|
||||
XK_comma, 43, /* , */
|
||||
XK_less, 43, /* < */
|
||||
XK_period, 47, /* . */
|
||||
XK_greater, 47, /* > */
|
||||
XK_slash, 44, /* / */
|
||||
XK_question, 44, /* ? */
|
||||
XK_backslash, 42, /* \ */
|
||||
XK_bar, 42, /* | */
|
||||
|
||||
/* "Special" keys */
|
||||
XK_space, 49, /* Space */
|
||||
XK_Return, 36, /* Return */
|
||||
XK_Delete, 117, /* Delete */
|
||||
XK_Tab, 48, /* Tab */
|
||||
XK_Escape, 53, /* Esc */
|
||||
XK_Caps_Lock, 57, /* Caps Lock */
|
||||
XK_Num_Lock, 71, /* Num Lock */
|
||||
XK_Scroll_Lock, 107, /* Scroll Lock */
|
||||
XK_Pause, 113, /* Pause */
|
||||
XK_BackSpace, 51, /* Backspace */
|
||||
XK_Insert, 114, /* Insert */
|
||||
|
||||
/* Cursor movement */
|
||||
XK_Up, 126, /* Cursor Up */
|
||||
XK_Down, 125, /* Cursor Down */
|
||||
XK_Left, 123, /* Cursor Left */
|
||||
XK_Right, 124, /* Cursor Right */
|
||||
XK_Page_Up, 116, /* Page Up */
|
||||
XK_Page_Down, 121, /* Page Down */
|
||||
XK_Home, 115, /* Home */
|
||||
XK_End, 119, /* End */
|
||||
|
||||
/* Numeric keypad */
|
||||
XK_KP_0, 82, /* KP 0 */
|
||||
XK_KP_1, 83, /* KP 1 */
|
||||
XK_KP_2, 84, /* KP 2 */
|
||||
XK_KP_3, 85, /* KP 3 */
|
||||
XK_KP_4, 86, /* KP 4 */
|
||||
XK_KP_5, 87, /* KP 5 */
|
||||
XK_KP_6, 88, /* KP 6 */
|
||||
XK_KP_7, 89, /* KP 7 */
|
||||
XK_KP_8, 91, /* KP 8 */
|
||||
XK_KP_9, 92, /* KP 9 */
|
||||
XK_KP_Enter, 76, /* KP Enter */
|
||||
XK_KP_Decimal, 65, /* KP . */
|
||||
XK_KP_Add, 69, /* KP + */
|
||||
XK_KP_Subtract, 78, /* KP - */
|
||||
XK_KP_Multiply, 67, /* KP * */
|
||||
XK_KP_Divide, 75, /* KP / */
|
||||
|
||||
/* Function keys */
|
||||
XK_F1, 122, /* F1 */
|
||||
XK_F2, 120, /* F2 */
|
||||
XK_F3, 99, /* F3 */
|
||||
XK_F4, 118, /* F4 */
|
||||
XK_F5, 96, /* F5 */
|
||||
XK_F6, 97, /* F6 */
|
||||
XK_F7, 98, /* F7 */
|
||||
XK_F8, 100, /* F8 */
|
||||
XK_F9, 101, /* F9 */
|
||||
XK_F10, 109, /* F10 */
|
||||
XK_F11, 103, /* F11 */
|
||||
XK_F12, 111, /* F12 */
|
||||
|
||||
/* Modifier keys */
|
||||
XK_Shift_L, 56, /* Shift Left */
|
||||
XK_Shift_R, 56, /* Shift Right */
|
||||
XK_Control_L, 59, /* Ctrl Left */
|
||||
XK_Control_R, 59, /* Ctrl Right */
|
||||
XK_Meta_L, 58, /* Logo Left (-> Option) */
|
||||
XK_Meta_R, 58, /* Logo Right (-> Option) */
|
||||
XK_Alt_L, 55, /* Alt Left (-> Command) */
|
||||
XK_Alt_R, 55, /* Alt Right (-> Command) */
|
||||
|
||||
/* Weirdness I can't figure out */
|
||||
#if 0
|
||||
XK_3270_PrintScreen, 105, /* PrintScrn */
|
||||
??? 94, 50, /* International */
|
||||
XK_Menu, 50, /* Menu (-> International) */
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
KbdAddEvent(rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl)
|
||||
{
|
||||
int i;
|
||||
CGKeyCode keyCode = -1;
|
||||
int found = 0;
|
||||
|
||||
if(((int)cl->clientData)==-1) return; /* viewOnly */
|
||||
|
||||
rfbUndim();
|
||||
|
||||
for (i = 0; i < (sizeof(keyTable) / sizeof(int)); i += 2) {
|
||||
if (keyTable[i] == keySym) {
|
||||
keyCode = keyTable[i+1];
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
rfbErr("warning: couldn't figure out keycode for X keysym %d (0x%x)\n",
|
||||
(int)keySym, (int)keySym);
|
||||
} else {
|
||||
/* Hopefully I can get away with not specifying a CGCharCode.
|
||||
(Why would you need both?) */
|
||||
CGPostKeyboardEvent((CGCharCode)0, keyCode, down);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PtrAddEvent(buttonMask, x, y, cl)
|
||||
int buttonMask;
|
||||
int x;
|
||||
int y;
|
||||
rfbClientPtr cl;
|
||||
{
|
||||
CGPoint position;
|
||||
|
||||
if(((int)cl->clientData)==-1) return; /* viewOnly */
|
||||
|
||||
rfbUndim();
|
||||
|
||||
position.x = x;
|
||||
position.y = y;
|
||||
|
||||
CGPostMouseEvent(position, TRUE, 8,
|
||||
(buttonMask & (1 << 0)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 1)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 2)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 3)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 4)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 5)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 6)) ? TRUE : FALSE,
|
||||
(buttonMask & (1 << 7)) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
rfbBool viewOnly = FALSE, sharedMode = FALSE;
|
||||
|
||||
void
|
||||
ScreenInit(int argc, char**argv)
|
||||
{
|
||||
int bitsPerSample=CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
||||
rfbScreen = rfbGetScreen(&argc,argv,
|
||||
CGDisplayPixelsWide(kCGDirectMainDisplay),
|
||||
CGDisplayPixelsHigh(kCGDirectMainDisplay),
|
||||
bitsPerSample,
|
||||
CGDisplaySamplesPerPixel(kCGDirectMainDisplay),4);
|
||||
if(!rfbScreen)
|
||||
exit(0);
|
||||
rfbScreen->serverFormat.redShift = bitsPerSample*2;
|
||||
rfbScreen->serverFormat.greenShift = bitsPerSample*1;
|
||||
rfbScreen->serverFormat.blueShift = 0;
|
||||
|
||||
gethostname(rfbScreen->thisHost, 255);
|
||||
rfbScreen->paddedWidthInBytes = CGDisplayBytesPerRow(kCGDirectMainDisplay);
|
||||
rfbScreen->frameBuffer =
|
||||
(char *)CGDisplayBaseAddress(kCGDirectMainDisplay);
|
||||
|
||||
/* we cannot write to the frame buffer */
|
||||
rfbScreen->cursor = NULL;
|
||||
|
||||
rfbScreen->ptrAddEvent = PtrAddEvent;
|
||||
rfbScreen->kbdAddEvent = KbdAddEvent;
|
||||
|
||||
if(sharedMode) {
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
}
|
||||
|
||||
rfbInitServer(rfbScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(startTime>0 && time(0)>startTime+maxSecsToConnect)
|
||||
rfbShutdown(0);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
rfbMarkRectAsModified(rfbScreen,
|
||||
rectArray[i].origin.x,rectArray[i].origin.y,
|
||||
rectArray[i].origin.x + rectArray[i].size.width,
|
||||
rectArray[i].origin.y + rectArray[i].size.height);
|
||||
}
|
||||
|
||||
void clientGone(rfbClientPtr cl)
|
||||
{
|
||||
rfbShutdown(cl);
|
||||
}
|
||||
|
||||
enum rfbNewClientAction newClient(rfbClientPtr cl)
|
||||
{
|
||||
if(startTime>0 && time(0)>startTime+maxSecsToConnect)
|
||||
rfbShutdown(cl);
|
||||
|
||||
if(disconnectAfterFirstClient)
|
||||
cl->clientGoneHook = clientGone;
|
||||
|
||||
cl->clientData=(void*)((viewOnly)?-1:0);
|
||||
|
||||
return(RFB_CLIENT_ACCEPT);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=argc-1;i>0;i--)
|
||||
if(i<argc-1 && strcmp(argv[i],"-wait4client")==0) {
|
||||
maxSecsToConnect = atoi(argv[i+1])/1000;
|
||||
startTime = time(0);
|
||||
} else if(strcmp(argv[i],"-runforever")==0) {
|
||||
disconnectAfterFirstClient = FALSE;
|
||||
} else if(strcmp(argv[i],"-viewonly")==0) {
|
||||
viewOnly=TRUE;
|
||||
} else if(strcmp(argv[i],"-shared")==0) {
|
||||
sharedMode=TRUE;
|
||||
}
|
||||
|
||||
rfbDimmingInit();
|
||||
|
||||
ScreenInit(argc,argv);
|
||||
rfbScreen->newClientHook = newClient;
|
||||
|
||||
/* enter background event loop */
|
||||
rfbRunEventLoop(rfbScreen,40,TRUE);
|
||||
|
||||
/* enter OS X loop */
|
||||
CGRegisterScreenRefreshCallback(refreshCallback, NULL);
|
||||
RunApplicationEventLoop();
|
||||
|
||||
rfbDimmingShutdown();
|
||||
|
||||
return(0); /* never ... */
|
||||
}
|
||||
|
||||
void rfbShutdown(rfbClientPtr cl)
|
||||
{
|
||||
rfbScreenCleanup(rfbScreen);
|
||||
rfbDimmingShutdown();
|
||||
exit(0);
|
||||
}
|
126
jni/vnc/LibVNCServer-0.9.9/examples/pnmshow.c
Normal file
126
jni/vnc/LibVNCServer-0.9.9/examples/pnmshow.c
Normal file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* @example pnmshow.c
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
|
||||
#ifndef HAVE_HANDLEKEY
|
||||
static void HandleKey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
|
||||
{
|
||||
if(down && (key==XK_Escape || key=='q' || key=='Q'))
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
FILE* in=stdin;
|
||||
int i,j,k,l,width,height,paddedWidth;
|
||||
char buffer[1024];
|
||||
rfbScreenInfoPtr rfbScreen;
|
||||
enum { BW, GRAY, TRUECOLOUR } picType=TRUECOLOUR;
|
||||
int bytesPerPixel,bitsPerPixelInFile;
|
||||
|
||||
if(argc>1) {
|
||||
in=fopen(argv[1],"rb");
|
||||
if(!in) {
|
||||
printf("Couldn't find file %s.\n",argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fgets(buffer,1024,in);
|
||||
if(!strncmp(buffer,"P6",2)) {
|
||||
picType=TRUECOLOUR;
|
||||
bytesPerPixel=4; bitsPerPixelInFile=3*8;
|
||||
} else if(!strncmp(buffer,"P5",2)) {
|
||||
picType=GRAY;
|
||||
bytesPerPixel=1; bitsPerPixelInFile=1*8;
|
||||
} else if(!strncmp(buffer,"P4",2)) {
|
||||
picType=BW;
|
||||
bytesPerPixel=1; bitsPerPixelInFile=1;
|
||||
} else {
|
||||
printf("Not a ppm.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* skip comments */
|
||||
do {
|
||||
fgets(buffer,1024,in);
|
||||
} while(buffer[0]=='#');
|
||||
|
||||
/* get width & height */
|
||||
sscanf(buffer,"%d %d",&width,&height);
|
||||
rfbLog("Got width %d and height %d.\n",width,height);
|
||||
if(picType!=BW)
|
||||
fgets(buffer,1024,in);
|
||||
else
|
||||
width=1+((width-1)|7);
|
||||
|
||||
/* vncviewers have problems with widths which are no multiple of 4. */
|
||||
paddedWidth = width;
|
||||
if(width&3)
|
||||
paddedWidth+=4-(width&3);
|
||||
|
||||
/* initialize data for vnc server */
|
||||
rfbScreen = rfbGetScreen(&argc,argv,paddedWidth,height,8,(bitsPerPixelInFile+7)/8,bytesPerPixel);
|
||||
if(!rfbScreen)
|
||||
return 0;
|
||||
if(argc>1)
|
||||
rfbScreen->desktopName = argv[1];
|
||||
else
|
||||
rfbScreen->desktopName = "Picture";
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
rfbScreen->kbdAddEvent = HandleKey;
|
||||
|
||||
/* enable http */
|
||||
rfbScreen->httpDir = "../webclients";
|
||||
|
||||
/* allocate picture and read it */
|
||||
rfbScreen->frameBuffer = (char*)malloc(paddedWidth*bytesPerPixel*height);
|
||||
fread(rfbScreen->frameBuffer,width*bitsPerPixelInFile/8,height,in);
|
||||
fclose(in);
|
||||
|
||||
if(picType!=TRUECOLOUR) {
|
||||
rfbScreen->serverFormat.trueColour=FALSE;
|
||||
rfbScreen->colourMap.count=256;
|
||||
rfbScreen->colourMap.is16=FALSE;
|
||||
rfbScreen->colourMap.data.bytes=malloc(256*3);
|
||||
for(i=0;i<256;i++)
|
||||
memset(rfbScreen->colourMap.data.bytes+3*i,i,3);
|
||||
}
|
||||
|
||||
switch(picType) {
|
||||
case TRUECOLOUR:
|
||||
/* correct the format to 4 bytes instead of 3 (and pad to paddedWidth) */
|
||||
for(j=height-1;j>=0;j--) {
|
||||
for(i=width-1;i>=0;i--)
|
||||
for(k=2;k>=0;k--)
|
||||
rfbScreen->frameBuffer[(j*paddedWidth+i)*4+k]=
|
||||
rfbScreen->frameBuffer[(j*width+i)*3+k];
|
||||
for(i=width*4;i<paddedWidth*4;i++)
|
||||
rfbScreen->frameBuffer[j*paddedWidth*4+i]=0;
|
||||
}
|
||||
break;
|
||||
case GRAY:
|
||||
break;
|
||||
case BW:
|
||||
/* correct the format from 1 bit to 8 bits */
|
||||
for(j=height-1;j>=0;j--)
|
||||
for(i=width-1;i>=0;i-=8) {
|
||||
l=(unsigned char)rfbScreen->frameBuffer[(j*width+i)/8];
|
||||
for(k=7;k>=0;k--)
|
||||
rfbScreen->frameBuffer[j*paddedWidth+i+7-k]=(l&(1<<k))?0:255;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* initialize server */
|
||||
rfbInitServer(rfbScreen);
|
||||
|
||||
/* run event loop */
|
||||
rfbRunEventLoop(rfbScreen,40000,FALSE);
|
||||
|
||||
return(0);
|
||||
}
|
100
jni/vnc/LibVNCServer-0.9.9/examples/pnmshow24.c
Normal file
100
jni/vnc/LibVNCServer-0.9.9/examples/pnmshow24.c
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @example pnmshow24.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
|
||||
#ifndef LIBVNCSERVER_ALLOW24BPP
|
||||
int main() {
|
||||
printf("I need the ALLOW24BPP LibVNCServer flag to work\n");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
|
||||
static void HandleKey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
|
||||
{
|
||||
if(down && (key==XK_Escape || key=='q' || key=='Q'))
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
FILE* in=stdin;
|
||||
int j,width,height,paddedWidth;
|
||||
char buffer[1024];
|
||||
rfbScreenInfoPtr rfbScreen;
|
||||
|
||||
if(argc>1) {
|
||||
in=fopen(argv[1],"rb");
|
||||
if(!in) {
|
||||
printf("Couldn't find file %s.\n",argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fgets(buffer,1024,in);
|
||||
if(strncmp(buffer,"P6",2)) {
|
||||
printf("Not a ppm.\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* skip comments */
|
||||
do {
|
||||
fgets(buffer,1024,in);
|
||||
} while(buffer[0]=='#');
|
||||
|
||||
/* get width & height */
|
||||
sscanf(buffer,"%d %d",&width,&height);
|
||||
rfbLog("Got width %d and height %d.\n",width,height);
|
||||
fgets(buffer,1024,in);
|
||||
|
||||
/* vncviewers have problems with widths which are no multiple of 4. */
|
||||
paddedWidth = width;
|
||||
|
||||
/* if your vncviewer doesn't have problems with a width
|
||||
which is not a multiple of 4, you can comment this. */
|
||||
if(width&3)
|
||||
paddedWidth+=4-(width&3);
|
||||
|
||||
/* initialize data for vnc server */
|
||||
rfbScreen = rfbGetScreen(&argc,argv,paddedWidth,height,8,3,3);
|
||||
if(!rfbScreen)
|
||||
return 0;
|
||||
if(argc>1)
|
||||
rfbScreen->desktopName = argv[1];
|
||||
else
|
||||
rfbScreen->desktopName = "Picture";
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
rfbScreen->kbdAddEvent = HandleKey;
|
||||
|
||||
/* enable http */
|
||||
rfbScreen->httpDir = "../webclients";
|
||||
|
||||
/* allocate picture and read it */
|
||||
rfbScreen->frameBuffer = (char*)malloc(paddedWidth*3*height);
|
||||
fread(rfbScreen->frameBuffer,width*3,height,in);
|
||||
fclose(in);
|
||||
|
||||
/* pad to paddedWidth */
|
||||
if(width != paddedWidth) {
|
||||
int padCount = 3*(paddedWidth - width);
|
||||
for(j=height-1;j>=0;j--) {
|
||||
memmove(rfbScreen->frameBuffer+3*paddedWidth*j,
|
||||
rfbScreen->frameBuffer+3*width*j,
|
||||
3*width);
|
||||
memset(rfbScreen->frameBuffer+3*paddedWidth*(j+1)-padCount,
|
||||
0,padCount);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize server */
|
||||
rfbInitServer(rfbScreen);
|
||||
|
||||
/* run event loop */
|
||||
rfbRunEventLoop(rfbScreen,40000,FALSE);
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
195
jni/vnc/LibVNCServer-0.9.9/examples/radon.h
Normal file
195
jni/vnc/LibVNCServer-0.9.9/examples/radon.h
Normal file
@ -0,0 +1,195 @@
|
||||
static unsigned char radonFontData[2280]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 32 */
|
||||
0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x00,0x00, /* 33 */
|
||||
0x00,0x28,0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 34 */
|
||||
0x00,0x44,0x44,0xba,0x44,0x44,0x44,0xba,0x44,0x44,0x00,0x00, /* 35 */
|
||||
0x10,0x7e,0x80,0x90,0x80,0x7c,0x02,0x12,0x02,0xfc,0x10,0x00, /* 36 */
|
||||
0x00,0x62,0x92,0x94,0x68,0x10,0x2c,0x52,0x92,0x8c,0x00,0x00, /* 37 */
|
||||
0x00,0x60,0x90,0x90,0x40,0x20,0x90,0x8a,0x84,0x7a,0x00,0x00, /* 38 */
|
||||
0x00,0x10,0x10,0x10,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 39 */
|
||||
0x00,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x00,0x00, /* 40 */
|
||||
0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x00,0x00, /* 41 */
|
||||
0x00,0x10,0x92,0x54,0x10,0x10,0x54,0x92,0x10,0x00,0x00,0x00, /* 42 */
|
||||
0x00,0x00,0x10,0x10,0x10,0xd6,0x10,0x10,0x10,0x00,0x00,0x00, /* 43 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x30,0x00, /* 44 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00, /* 45 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00, /* 46 */
|
||||
0x00,0x02,0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00, /* 47 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x82,0x7c,0x00,0x00, /* 48 */
|
||||
0x00,0x08,0x28,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00, /* 49 */
|
||||
0x00,0xfc,0x02,0x02,0x02,0x7c,0x80,0x80,0x00,0xfe,0x00,0x00, /* 50 */
|
||||
0x00,0xfc,0x02,0x02,0x02,0x3c,0x02,0x02,0x02,0xfc,0x00,0x00, /* 51 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x7a,0x02,0x02,0x02,0x02,0x00,0x00, /* 52 */
|
||||
0x00,0xfe,0x00,0x80,0x80,0x7c,0x02,0x02,0x02,0xfc,0x00,0x00, /* 53 */
|
||||
0x00,0x7c,0x80,0x80,0xbc,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 54 */
|
||||
0x00,0xfc,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00, /* 55 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x7c,0x82,0x82,0x82,0x7c,0x00,0x00, /* 56 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x82,0x7a,0x02,0x02,0xfc,0x00,0x00, /* 57 */
|
||||
0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00, /* 58 */
|
||||
0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10,0x10,0x60,0x00,0x00, /* 59 */
|
||||
0x00,0x08,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x08,0x00,0x00, /* 60 */
|
||||
0x00,0x00,0x00,0x00,0xfe,0x00,0xfe,0x00,0x00,0x00,0x00,0x00, /* 61 */
|
||||
0x00,0x10,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x10,0x00,0x00, /* 62 */
|
||||
0x00,0xfc,0x02,0x02,0x02,0x1c,0x20,0x20,0x00,0x20,0x00,0x00, /* 63 */
|
||||
0x00,0x7c,0x82,0x8a,0x92,0x92,0x92,0x8c,0x80,0x7c,0x00,0x00, /* 64 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x82,0xba,0x82,0x82,0x82,0x00,0x00, /* 65 */
|
||||
0x00,0xbc,0x82,0x82,0x82,0xbc,0x82,0x82,0x82,0xbc,0x00,0x00, /* 66 */
|
||||
0x00,0x7c,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7c,0x00,0x00, /* 67 */
|
||||
0x00,0xbc,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0xbc,0x00,0x00, /* 68 */
|
||||
0x00,0x7c,0x80,0x80,0x80,0xb8,0x80,0x80,0x80,0x7c,0x00,0x00, /* 69 */
|
||||
0x00,0x7c,0x80,0x80,0x80,0xb8,0x80,0x80,0x80,0x80,0x00,0x00, /* 70 */
|
||||
0x00,0x7c,0x80,0x80,0x80,0x80,0x9a,0x82,0x82,0x7c,0x00,0x00, /* 71 */
|
||||
0x00,0x82,0x82,0x82,0x82,0xba,0x82,0x82,0x82,0x82,0x00,0x00, /* 72 */
|
||||
0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 73 */
|
||||
0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x84,0x78,0x00,0x00, /* 74 */
|
||||
0x00,0x82,0x82,0x82,0x82,0xbc,0x82,0x82,0x82,0x82,0x00,0x00, /* 75 */
|
||||
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7e,0x00,0x00, /* 76 */
|
||||
0x00,0x7c,0x82,0x92,0x92,0x92,0x92,0x82,0x82,0x82,0x00,0x00, /* 77 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x00,0x00, /* 78 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 79 */
|
||||
0x00,0xbc,0x82,0x82,0x82,0xbc,0x80,0x80,0x80,0x80,0x00,0x00, /* 80 */
|
||||
0x00,0x7c,0x82,0x82,0x82,0x82,0x8a,0x8a,0x82,0x7c,0x00,0x00, /* 81 */
|
||||
0x00,0xbc,0x82,0x82,0x82,0xbc,0x82,0x82,0x82,0x82,0x00,0x00, /* 82 */
|
||||
0x00,0x7e,0x80,0x80,0x80,0x7c,0x02,0x02,0x02,0xfc,0x00,0x00, /* 83 */
|
||||
0x00,0xfe,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 84 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 85 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x82,0x84,0x88,0x90,0xa0,0x00,0x00, /* 86 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x92,0x92,0x92,0x82,0x7c,0x00,0x00, /* 87 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x7c,0x82,0x82,0x82,0x82,0x00,0x00, /* 88 */
|
||||
0x00,0x82,0x82,0x82,0x82,0x7c,0x00,0x10,0x10,0x10,0x00,0x00, /* 89 */
|
||||
0x00,0xfc,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x7e,0x00,0x00, /* 90 */
|
||||
0x00,0x1c,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1c,0x00,0x00, /* 91 */
|
||||
0x00,0x80,0x80,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00, /* 92 */
|
||||
0x00,0x38,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x38,0x00,0x00, /* 93 */
|
||||
0x00,0x38,0x44,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 94 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00, /* 95 */
|
||||
0x00,0x08,0x08,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 96 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 97 */
|
||||
0x00,0x00,0x40,0x40,0x5c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 98 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x40,0x40,0x40,0x40,0x3c,0x00,0x00, /* 99 */
|
||||
0x00,0x00,0x02,0x02,0x3a,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 100 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x5c,0x40,0x3c,0x00,0x00, /* 101 */
|
||||
0x00,0x00,0x0c,0x10,0x10,0x10,0x54,0x10,0x10,0x10,0x00,0x00, /* 102 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3a,0x02,0x3c, /* 103 */
|
||||
0x00,0x00,0x40,0x40,0x5c,0x42,0x42,0x42,0x42,0x42,0x00,0x00, /* 104 */
|
||||
0x00,0x00,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00, /* 105 */
|
||||
0x00,0x00,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x30, /* 106 */
|
||||
0x00,0x00,0x40,0x40,0x42,0x42,0x5c,0x42,0x42,0x42,0x00,0x00, /* 107 */
|
||||
0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00, /* 108 */
|
||||
0x00,0x00,0x00,0x00,0x7c,0x82,0x92,0x92,0x92,0x92,0x00,0x00, /* 109 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x00,0x00, /* 110 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 111 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x5c,0x40,0x40, /* 112 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3a,0x02,0x02, /* 113 */
|
||||
0x00,0x00,0x00,0x00,0x0c,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 114 */
|
||||
0x00,0x00,0x00,0x00,0x3e,0x40,0x3c,0x02,0x02,0x7c,0x00,0x00, /* 115 */
|
||||
0x00,0x00,0x10,0x10,0x10,0x54,0x10,0x10,0x10,0x0c,0x00,0x00, /* 116 */
|
||||
0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 117 */
|
||||
0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x44,0x48,0x50,0x00,0x00, /* 118 */
|
||||
0x00,0x00,0x00,0x00,0x92,0x92,0x92,0x92,0x82,0x7c,0x00,0x00, /* 119 */
|
||||
0x00,0x00,0x00,0x00,0x42,0x42,0x3c,0x42,0x42,0x42,0x00,0x00, /* 120 */
|
||||
0x00,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3a,0x02,0x3c, /* 121 */
|
||||
0x00,0x00,0x00,0x00,0x7c,0x02,0x0c,0x30,0x40,0x3e,0x00,0x00, /* 122 */
|
||||
0x00,0x1c,0x20,0x20,0x20,0x40,0x20,0x20,0x20,0x1c,0x00,0x00, /* 123 */
|
||||
0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x00,0x00, /* 124 */
|
||||
0x00,0x38,0x04,0x04,0x04,0x02,0x04,0x04,0x04,0x38,0x00,0x00, /* 125 */
|
||||
0x00,0x04,0x38,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 126 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160 */
|
||||
0x00,0x10,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 161 */
|
||||
0x00,0x00,0x08,0x3e,0x40,0x48,0x48,0x40,0x3e,0x08,0x00,0x00, /* 162 */
|
||||
0x00,0x1c,0x20,0x20,0x20,0xa8,0x20,0x20,0x42,0xbc,0x00,0x00, /* 163 */
|
||||
0x00,0x00,0x82,0x38,0x44,0x44,0x44,0x38,0x82,0x00,0x00,0x00, /* 164 */
|
||||
0x00,0x82,0x82,0x82,0x7c,0x00,0x54,0x10,0x54,0x10,0x00,0x00, /* 165 */
|
||||
0x00,0x10,0x10,0x10,0x00,0x00,0x00,0x10,0x10,0x10,0x00,0x00, /* 166 */
|
||||
0x00,0x38,0x40,0x38,0x44,0x44,0x44,0x44,0x38,0x04,0x38,0x00, /* 167 */
|
||||
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168 */
|
||||
0x00,0x7c,0x82,0x9a,0xa2,0xa2,0xa2,0x9a,0x82,0x7c,0x00,0x00, /* 169 */
|
||||
0x38,0x04,0x34,0x44,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00, /* 170 */
|
||||
0x00,0x00,0x00,0x24,0x48,0x00,0x48,0x24,0x00,0x00,0x00,0x00, /* 171 */
|
||||
0x00,0x00,0x00,0x00,0x00,0xfc,0x02,0x02,0x02,0x00,0x00,0x00, /* 172 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00, /* 173 */
|
||||
0x00,0x7c,0x82,0x92,0xaa,0xb2,0xaa,0xaa,0x82,0x7c,0x00,0x00, /* 174 */
|
||||
0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 175 */
|
||||
0x38,0x44,0x44,0x44,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176 */
|
||||
0x00,0x10,0x10,0xd6,0x10,0x10,0x00,0xfe,0x00,0x00,0x00,0x00, /* 177 */
|
||||
0x38,0x04,0x18,0x20,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 178 */
|
||||
0x38,0x04,0x38,0x04,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 179 */
|
||||
0x18,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 180 */
|
||||
0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,0x58,0x40,0x40, /* 181 */
|
||||
0x00,0x79,0xfa,0xfa,0xfa,0x7a,0x02,0x0a,0x0a,0x0a,0x0a,0x00, /* 182 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 183 */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00, /* 184 */
|
||||
0x08,0x18,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 185 */
|
||||
0x38,0x44,0x44,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00, /* 186 */
|
||||
0x00,0x00,0x00,0x48,0x24,0x00,0x24,0x48,0x00,0x00,0x00,0x00, /* 187 */
|
||||
0x20,0xa2,0x22,0x22,0x24,0x08,0x10,0x29,0x49,0x85,0x01,0x01, /* 188 */
|
||||
0x20,0xa2,0x22,0x22,0x24,0x08,0x10,0x2e,0x41,0x86,0x08,0x0f, /* 189 */
|
||||
0xe0,0x12,0xe2,0x12,0xe4,0x08,0x10,0x29,0x49,0x85,0x01,0x01, /* 190 */
|
||||
0x00,0x08,0x00,0x08,0x08,0x70,0x80,0x80,0x80,0x7e,0x00,0x00, /* 191 */
|
||||
0x20,0x18,0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 192 */
|
||||
0x08,0x30,0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 193 */
|
||||
0x38,0x44,0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 194 */
|
||||
0x32,0x4c,0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 195 */
|
||||
0x6c,0x00,0x00,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 196 */
|
||||
0x38,0x44,0x38,0x7c,0x82,0x82,0x82,0xba,0x82,0x82,0x00,0x00, /* 197 */
|
||||
0x00,0x77,0x88,0x88,0x88,0x8b,0xa8,0x88,0x88,0x8b,0x00,0x00, /* 198 */
|
||||
0x00,0x7c,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x6c,0x10,0x20, /* 199 */
|
||||
0x20,0x18,0x00,0x7c,0x80,0x80,0xb8,0x80,0x80,0x7c,0x00,0x00, /* 200 */
|
||||
0x08,0x30,0x00,0x7c,0x80,0x80,0xb8,0x80,0x80,0x7c,0x00,0x00, /* 201 */
|
||||
0x38,0x44,0x00,0x7c,0x80,0x80,0xb8,0x80,0x80,0x7c,0x00,0x00, /* 202 */
|
||||
0x6c,0x00,0x00,0x7c,0x80,0x80,0xb8,0x80,0x80,0x7c,0x00,0x00, /* 203 */
|
||||
0x20,0x18,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 204 */
|
||||
0x08,0x30,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 205 */
|
||||
0x38,0x44,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 206 */
|
||||
0x6c,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 207 */
|
||||
0x00,0xbc,0x82,0x82,0x82,0xb2,0x82,0x82,0x82,0xbc,0x00,0x00, /* 208 */
|
||||
0x32,0x4c,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x00,0x00, /* 209 */
|
||||
0x20,0x18,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 210 */
|
||||
0x08,0x30,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 211 */
|
||||
0x38,0x44,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 212 */
|
||||
0x32,0x4c,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 213 */
|
||||
0x6c,0x00,0x00,0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 214 */
|
||||
0x00,0x00,0x00,0x00,0x44,0x28,0x00,0x28,0x44,0x00,0x00,0x00, /* 215 */
|
||||
0x00,0x7a,0x84,0x82,0x8a,0x92,0xa2,0x82,0x42,0xbc,0x00,0x00, /* 216 */
|
||||
0x20,0x18,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 217 */
|
||||
0x08,0x30,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 218 */
|
||||
0x38,0x44,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 219 */
|
||||
0x6c,0x00,0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x00,0x00, /* 220 */
|
||||
0x08,0xb2,0x82,0x82,0x82,0x7c,0x00,0x10,0x10,0x10,0x00,0x00, /* 221 */
|
||||
0x00,0x80,0x80,0xbc,0x82,0x82,0x82,0xbc,0x80,0x80,0x00,0x00, /* 222 */
|
||||
0x00,0x3c,0x42,0x42,0x42,0x5c,0x42,0x42,0x42,0x9c,0x00,0x00, /* 223 */
|
||||
0x20,0x18,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 224 */
|
||||
0x08,0x30,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 225 */
|
||||
0x38,0x44,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 226 */
|
||||
0x32,0x4c,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 227 */
|
||||
0x6c,0x00,0x00,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 228 */
|
||||
0x18,0x24,0x18,0x00,0x3c,0x02,0x3a,0x42,0x42,0x3c,0x00,0x00, /* 229 */
|
||||
0x00,0x00,0x00,0x00,0x6c,0x12,0x52,0x94,0x90,0x6e,0x00,0x00, /* 230 */
|
||||
0x00,0x00,0x00,0x00,0x3c,0x40,0x40,0x40,0x40,0x34,0x08,0x10, /* 231 */
|
||||
0x20,0x18,0x00,0x00,0x3c,0x42,0x42,0x5c,0x40,0x3c,0x00,0x00, /* 232 */
|
||||
0x08,0x30,0x00,0x00,0x3c,0x42,0x42,0x5c,0x40,0x3c,0x00,0x00, /* 233 */
|
||||
0x38,0x44,0x00,0x00,0x3c,0x42,0x42,0x5c,0x40,0x3c,0x00,0x00, /* 234 */
|
||||
0x6c,0x00,0x00,0x00,0x3c,0x42,0x42,0x5c,0x40,0x3c,0x00,0x00, /* 235 */
|
||||
0x20,0x18,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 236 */
|
||||
0x08,0x30,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 237 */
|
||||
0x38,0x44,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 238 */
|
||||
0x6c,0x00,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x10,0x00,0x00, /* 239 */
|
||||
0x00,0x14,0x08,0x14,0x02,0x3a,0x42,0x42,0x42,0x3c,0x00,0x00, /* 240 */
|
||||
0x00,0x32,0x4c,0x00,0x3c,0x42,0x42,0x42,0x42,0x42,0x00,0x00, /* 241 */
|
||||
0x20,0x18,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 242 */
|
||||
0x08,0x30,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 243 */
|
||||
0x38,0x44,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 244 */
|
||||
0x32,0x4c,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 245 */
|
||||
0x6c,0x00,0x00,0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 246 */
|
||||
0x00,0x00,0x00,0x00,0x38,0x00,0xfe,0x00,0x38,0x00,0x00,0x00, /* 247 */
|
||||
0x00,0x00,0x00,0x00,0x3a,0x44,0x4a,0x52,0x22,0x5c,0x00,0x00, /* 248 */
|
||||
0x20,0x18,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 249 */
|
||||
0x08,0x30,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 250 */
|
||||
0x38,0x44,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 251 */
|
||||
0x6c,0x00,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00,0x00, /* 252 */
|
||||
0x04,0x18,0x00,0x00,0x42,0x42,0x42,0x42,0x42,0x3a,0x02,0x3c, /* 253 */
|
||||
0x00,0x80,0x80,0x9c,0xa2,0x82,0xa2,0x9c,0x80,0x80,0x00,0x00, /* 254 */
|
||||
};
|
||||
static int radonFontMetaData[256*5]={
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,0,-2,12,8,12,0,-2,24,8,12,0,-2,36,8,12,0,-2,48,8,12,0,-2,60,8,12,0,-2,72,8,12,0,-2,84,8,12,0,-2,96,8,12,0,-2,108,8,12,0,-2,120,8,12,0,-2,132,8,12,0,-2,144,8,12,0,-2,156,8,12,0,-2,168,8,12,0,-2,180,8,12,0,-2,192,8,12,0,-2,204,8,12,0,-2,216,8,12,0,-2,228,8,12,0,-2,240,8,12,0,-2,252,8,12,0,-2,264,8,12,0,-2,276,8,12,0,-2,288,8,12,0,-2,300,8,12,0,-2,312,8,12,0,-2,324,8,12,0,-2,336,8,12,0,-2,348,8,12,0,-2,360,8,12,0,-2,372,8,12,0,-2,384,8,12,0,-2,396,8,12,0,-2,408,8,12,0,-2,420,8,12,0,-2,432,8,12,0,-2,444,8,12,0,-2,456,8,12,0,-2,468,8,12,0,-2,480,8,12,0,-2,492,8,12,0,-2,504,8,12,0,-2,516,8,12,0,-2,528,8,12,0,-2,540,8,12,0,-2,552,8,12,0,-2,564,8,12,0,-2,576,8,12,0,-2,588,8,12,0,-2,600,8,12,0,-2,612,8,12,0,-2,624,8,12,0,-2,636,8,12,0,-2,648,8,12,0,-2,660,8,12,0,-2,672,8,12,0,-2,684,8,12,0,-2,696,8,12,0,-2,708,8,12,0,-2,720,8,12,0,-2,732,8,12,0,-2,744,8,12,0,-2,756,8,12,0,-2,768,8,12,0,-2,780,8,12,0,-2,792,8,12,0,-2,804,8,12,0,-2,816,8,12,0,-2,828,8,12,0,-2,840,8,12,0,-2,852,8,12,0,-2,864,8,12,0,-2,876,8,12,0,-2,888,8,12,0,-2,900,8,12,0,-2,912,8,12,0,-2,924,8,12,0,-2,936,8,12,0,-2,948,8,12,0,-2,960,8,12,0,-2,972,8,12,0,-2,984,8,12,0,-2,996,8,12,0,-2,1008,8,12,0,-2,1020,8,12,0,-2,1032,8,12,0,-2,1044,8,12,0,-2,1056,8,12,0,-2,1068,8,12,0,-2,1080,8,12,0,-2,1092,8,12,0,-2,1104,8,12,0,-2,1116,8,12,0,-2,1128,8,12,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1140,8,12,0,-2,1152,8,12,0,-2,1164,8,12,0,-2,1176,8,12,0,-2,1188,8,12,0,-2,1200,8,12,0,-2,1212,8,12,0,-2,1224,8,12,0,-2,1236,8,12,0,-2,1248,8,12,0,-2,1260,8,12,0,-2,1272,8,12,0,-2,1284,8,12,0,-2,1296,8,12,0,-2,1308,8,12,0,-2,1320,8,12,0,-2,1332,8,12,0,-2,1344,8,12,0,-2,1356,8,12,0,-2,1368,8,12,0,-2,1380,8,12,0,-2,1392,8,12,0,-2,1404,8,12,0,-2,1416,8,12,0,-2,1428,8,12,0,-2,1440,8,12,0,-2,1452,8,12,0,-2,1464,8,12,0,-2,1476,8,12,0,-2,1488,8,12,0,-2,1500,8,12,0,-2,1512,8,12,0,-2,1524,8,12,0,-2,1536,8,12,0,-2,1548,8,12,0,-2,1560,8,12,0,-2,1572,8,12,0,-2,1584,8,12,0,-2,1596,8,12,0,-2,1608,8,12,0,-2,1620,8,12,0,-2,1632,8,12,0,-2,1644,8,12,0,-2,1656,8,12,0,-2,1668,8,12,0,-2,1680,8,12,0,-2,1692,8,12,0,-2,1704,8,12,0,-2,1716,8,12,0,-2,1728,8,12,0,-2,1740,8,12,0,-2,1752,8,12,0,-2,1764,8,12,0,-2,1776,8,12,0,-2,1788,8,12,0,-2,1800,8,12,0,-2,1812,8,12,0,-2,1824,8,12,0,-2,1836,8,12,0,-2,1848,8,12,0,-2,1860,8,12,0,-2,1872,8,12,0,-2,1884,8,12,0,-2,1896,8,12,0,-2,1908,8,12,0,-2,1920,8,12,0,-2,1932,8,12,0,-2,1944,8,12,0,-2,1956,8,12,0,-2,1968,8,12,0,-2,1980,8,12,0,-2,1992,8,12,0,-2,2004,8,12,0,-2,2016,8,12,0,-2,2028,8,12,0,-2,2040,8,12,0,-2,2052,8,12,0,-2,2064,8,12,0,-2,2076,8,12,0,-2,2088,8,12,0,-2,2100,8,12,0,-2,2112,8,12,0,-2,2124,8,12,0,-2,2136,8,12,0,-2,2148,8,12,0,-2,2160,8,12,0,-2,2172,8,12,0,-2,2184,8,12,0,-2,2196,8,12,0,-2,2208,8,12,0,-2,2220,8,12,0,-2,2232,8,12,0,-2,2244,8,12,0,-2,2256,8,12,0,-2,2268,8,12,0,-2,0,0,0,0,0,};
|
||||
static rfbFontData radonFont={radonFontData, radonFontMetaData};
|
3
jni/vnc/LibVNCServer-0.9.9/examples/regiontest.c
Normal file
3
jni/vnc/LibVNCServer-0.9.9/examples/regiontest.c
Normal file
@ -0,0 +1,3 @@
|
||||
#define SRA_TEST
|
||||
#include "../libvncserver/rfbregion.c"
|
||||
|
85
jni/vnc/LibVNCServer-0.9.9/examples/rotate.c
Normal file
85
jni/vnc/LibVNCServer-0.9.9/examples/rotate.c
Normal file
@ -0,0 +1,85 @@
|
||||
#include <stdio.h>
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
|
||||
#define CONCAT2(a,b) a##b
|
||||
#define CONCAT2E(a,b) CONCAT2(a,b)
|
||||
#define CONCAT3(a,b,c) a##b##c
|
||||
#define CONCAT3E(a,b,c) CONCAT3(a,b,c)
|
||||
|
||||
#define FUNCNAME rfbRotate
|
||||
#define FUNC(i, j) (h - 1 - j + i * h)
|
||||
#define SWAPDIMENSIONS
|
||||
#define OUTBITS 8
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 16
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 32
|
||||
#include "rotatetemplate.c"
|
||||
#undef FUNCNAME
|
||||
#undef FUNC
|
||||
|
||||
#define FUNCNAME rfbRotateCounterClockwise
|
||||
#define FUNC(i, j) (j + (w - 1 - i) * h)
|
||||
#define OUTBITS 8
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 16
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 32
|
||||
#include "rotatetemplate.c"
|
||||
#undef FUNCNAME
|
||||
#undef FUNC
|
||||
#undef SWAPDIMENSIONS
|
||||
|
||||
#define FUNCNAME rfbFlipHorizontally
|
||||
#define FUNC(i, j) ((w - 1 - i) + j * w)
|
||||
#define OUTBITS 8
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 16
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 32
|
||||
#include "rotatetemplate.c"
|
||||
#undef FUNCNAME
|
||||
#undef FUNC
|
||||
|
||||
#define FUNCNAME rfbFlipVertically
|
||||
#define FUNC(i, j) (i + (h - 1 - j) * w)
|
||||
#define OUTBITS 8
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 16
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 32
|
||||
#include "rotatetemplate.c"
|
||||
#undef FUNCNAME
|
||||
#undef FUNC
|
||||
|
||||
#define FUNCNAME rfbRotateHundredAndEighty
|
||||
#define FUNC(i, j) ((w - 1 - i) + (h - 1 - j) * w)
|
||||
#define OUTBITS 8
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 16
|
||||
#include "rotatetemplate.c"
|
||||
#define OUTBITS 32
|
||||
#include "rotatetemplate.c"
|
||||
#undef FUNCNAME
|
||||
#undef FUNC
|
||||
|
||||
static void HandleKey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
|
||||
{
|
||||
if(down) {
|
||||
if (key==XK_Escape || key=='q' || key=='Q')
|
||||
rfbCloseClient(cl);
|
||||
else if (key == 'r')
|
||||
rfbRotate(cl->screen);
|
||||
else if (key == 'R')
|
||||
rfbRotateCounterClockwise(cl->screen);
|
||||
else if (key == 'f')
|
||||
rfbFlipHorizontally(cl->screen);
|
||||
else if (key == 'F')
|
||||
rfbFlipVertically(cl->screen);
|
||||
}
|
||||
}
|
||||
|
||||
#define HAVE_HANDLEKEY
|
||||
#include "pnmshow.c"
|
||||
|
52
jni/vnc/LibVNCServer-0.9.9/examples/rotatetemplate.c
Normal file
52
jni/vnc/LibVNCServer-0.9.9/examples/rotatetemplate.c
Normal file
@ -0,0 +1,52 @@
|
||||
#define OUT_T CONCAT3E(uint,OUTBITS,_t)
|
||||
#define FUNCTION CONCAT2E(FUNCNAME,OUTBITS)
|
||||
|
||||
static void FUNCTION(rfbScreenInfoPtr screen)
|
||||
{
|
||||
OUT_T* buffer = (OUT_T*)screen->frameBuffer;
|
||||
int i, j, w = screen->width, h = screen->height;
|
||||
OUT_T* newBuffer = (OUT_T*)malloc(w * h * sizeof(OUT_T));
|
||||
|
||||
for (j = 0; j < h; j++)
|
||||
for (i = 0; i < w; i++)
|
||||
newBuffer[FUNC(i, j)] = buffer[i + j * w];
|
||||
|
||||
memcpy(buffer, newBuffer, w * h * sizeof(OUT_T));
|
||||
free(newBuffer);
|
||||
|
||||
#ifdef SWAPDIMENSIONS
|
||||
screen->width = h;
|
||||
screen->paddedWidthInBytes = h * OUTBITS / 8;
|
||||
screen->height = w;
|
||||
|
||||
{
|
||||
rfbClientIteratorPtr iterator;
|
||||
rfbClientPtr cl;
|
||||
iterator = rfbGetClientIterator(screen);
|
||||
while ((cl = rfbClientIteratorNext(iterator)) != NULL)
|
||||
cl->newFBSizePending = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
rfbMarkRectAsModified(screen, 0, 0, screen->width, screen->height);
|
||||
}
|
||||
|
||||
#if OUTBITS == 32
|
||||
void FUNCNAME(rfbScreenInfoPtr screen) {
|
||||
if (screen->serverFormat.bitsPerPixel == 32)
|
||||
CONCAT2E(FUNCNAME,32)(screen);
|
||||
else if (screen->serverFormat.bitsPerPixel == 16)
|
||||
CONCAT2E(FUNCNAME,16)(screen);
|
||||
else if (screen->serverFormat.bitsPerPixel == 8)
|
||||
CONCAT2E(FUNCNAME,8)(screen);
|
||||
else {
|
||||
rfbErr("Unsupported pixel depth: %d\n",
|
||||
screen->serverFormat.bitsPerPixel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef FUNCTION
|
||||
#undef OUTBITS
|
||||
|
12
jni/vnc/LibVNCServer-0.9.9/examples/simple.c
Normal file
12
jni/vnc/LibVNCServer-0.9.9/examples/simple.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->frameBuffer=(char*)malloc(400*300*4);
|
||||
rfbInitServer(server);
|
||||
rfbRunEventLoop(server,-1,FALSE);
|
||||
return(0);
|
||||
}
|
25
jni/vnc/LibVNCServer-0.9.9/examples/simple15.c
Normal file
25
jni/vnc/LibVNCServer-0.9.9/examples/simple15.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* This example shows how to use 15-bit (which is handled as 16-bit
|
||||
internally). */
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
int i,j;
|
||||
uint16_t* f;
|
||||
|
||||
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,5,3,2);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->frameBuffer=(char*)malloc(400*300*2);
|
||||
f=(uint16_t*)server->frameBuffer;
|
||||
for(j=0;j<300;j++)
|
||||
for(i=0;i<400;i++)
|
||||
f[j*400+i]=/* red */ ((j*32/300) << 10) |
|
||||
/* green */ (((j+400-i)*32/700) << 5) |
|
||||
/* blue */ ((i*32/400));
|
||||
|
||||
rfbInitServer(server);
|
||||
rfbRunEventLoop(server,-1,FALSE);
|
||||
return(0);
|
||||
}
|
46
jni/vnc/LibVNCServer-0.9.9/examples/storepasswd.c
Normal file
46
jni/vnc/LibVNCServer-0.9.9/examples/storepasswd.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("\nusage: storepasswd <password> <filename>\n\n");
|
||||
|
||||
printf("Stores a password in encrypted format.\n");
|
||||
printf("The resulting file can be used with the -rfbauth argument to OSXvnc.\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
usage();
|
||||
|
||||
if (rfbEncryptAndStorePasswd(argv[1], argv[2]) != 0) {
|
||||
printf("storing password failed.\n");
|
||||
return 1;
|
||||
} else {
|
||||
printf("storing password succeeded.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
134
jni/vnc/LibVNCServer-0.9.9/examples/vncev.c
Normal file
134
jni/vnc/LibVNCServer-0.9.9/examples/vncev.c
Normal file
@ -0,0 +1,134 @@
|
||||
/**
|
||||
* @example vncev.c
|
||||
* This program is a simple server to show events coming from the client
|
||||
*/
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef __MINGW32__
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/default8x16.h>
|
||||
|
||||
#define width 100
|
||||
#define height 100
|
||||
static char f[width*height];
|
||||
static char* keys[0x400];
|
||||
|
||||
static int hex2number(unsigned char c)
|
||||
{
|
||||
if(c>'f') return(-1);
|
||||
else if(c>'F')
|
||||
return(10+c-'a');
|
||||
else if(c>'9')
|
||||
return(10+c-'A');
|
||||
else
|
||||
return(c-'0');
|
||||
}
|
||||
|
||||
static void read_keys(void)
|
||||
{
|
||||
int i,j,k;
|
||||
char buffer[1024];
|
||||
FILE* keysyms=fopen("keysym.h","r");
|
||||
|
||||
memset(keys,0,0x400*sizeof(char*));
|
||||
|
||||
if(!keysyms)
|
||||
return;
|
||||
|
||||
while(!feof(keysyms)) {
|
||||
fgets(buffer,1024,keysyms);
|
||||
if(!strncmp(buffer,"#define XK_",strlen("#define XK_"))) {
|
||||
for(i=strlen("#define XK_");buffer[i] && buffer[i]!=' '
|
||||
&& buffer[i]!='\t';i++);
|
||||
if(buffer[i]==0) /* don't support wrapped lines */
|
||||
continue;
|
||||
buffer[i]=0;
|
||||
for(i++;buffer[i] && buffer[i]!='0';i++);
|
||||
if(buffer[i]==0 || buffer[i+1]!='x') continue;
|
||||
for(j=0,i+=2;(k=hex2number(buffer[i]))>=0;i++)
|
||||
j=j*16+k;
|
||||
if(keys[j&0x3ff]) {
|
||||
char* x=(char*)malloc(1+strlen(keys[j&0x3ff])+1+strlen(buffer+strlen("#define ")));
|
||||
strcpy(x,keys[j&0x3ff]);
|
||||
strcat(x,",");
|
||||
strcat(x,buffer+strlen("#define "));
|
||||
free(keys[j&0x3ff]);
|
||||
keys[j&0x3ff]=x;
|
||||
} else
|
||||
keys[j&0x3ff] = strdup(buffer+strlen("#define "));
|
||||
}
|
||||
|
||||
}
|
||||
fclose(keysyms);
|
||||
}
|
||||
|
||||
static int lineHeight=16,lineY=height-16;
|
||||
static void output(rfbScreenInfoPtr s,char* line)
|
||||
{
|
||||
rfbDoCopyRect(s,0,0,width,height-lineHeight,0,-lineHeight);
|
||||
rfbDrawString(s,&default8x16Font,10,lineY,line,0x01);
|
||||
rfbLog("%s\n",line);
|
||||
}
|
||||
|
||||
static void dokey(rfbBool down,rfbKeySym k,rfbClientPtr cl)
|
||||
{
|
||||
char buffer[1024+32];
|
||||
|
||||
sprintf(buffer,"%s: %s (0x%x)",
|
||||
down?"down":"up",keys[k&0x3ff]?keys[k&0x3ff]:"",(unsigned int)k);
|
||||
output(cl->screen,buffer);
|
||||
}
|
||||
|
||||
static void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
|
||||
{
|
||||
char buffer[1024];
|
||||
if(buttonMask) {
|
||||
sprintf(buffer,"Ptr: mouse button mask 0x%x at %d,%d",buttonMask,x,y);
|
||||
output(cl->screen,buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static enum rfbNewClientAction newclient(rfbClientPtr cl)
|
||||
{
|
||||
char buffer[1024];
|
||||
struct sockaddr_in addr;
|
||||
socklen_t len=sizeof(addr);
|
||||
unsigned int ip;
|
||||
|
||||
getpeername(cl->sock,(struct sockaddr*)&addr,&len);
|
||||
ip=ntohl(addr.sin_addr.s_addr);
|
||||
sprintf(buffer,"Client connected from ip %d.%d.%d.%d",
|
||||
(ip>>24)&0xff,(ip>>16)&0xff,(ip>>8)&0xff,ip&0xff);
|
||||
output(cl->screen,buffer);
|
||||
return RFB_CLIENT_ACCEPT;
|
||||
}
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,width,height,8,1,1);
|
||||
if(!s)
|
||||
return 0;
|
||||
s->colourMap.is16=FALSE;
|
||||
s->colourMap.count=2;
|
||||
s->colourMap.data.bytes=(unsigned char*)"\xd0\xd0\xd0\x30\x01\xe0";
|
||||
s->serverFormat.trueColour=FALSE;
|
||||
s->frameBuffer=f;
|
||||
s->kbdAddEvent=dokey;
|
||||
s->ptrAddEvent=doptr;
|
||||
s->newClientHook=newclient;
|
||||
|
||||
memset(f,0,width*height);
|
||||
read_keys();
|
||||
rfbInitServer(s);
|
||||
|
||||
while(1) {
|
||||
rfbProcessEvents(s,999999);
|
||||
}
|
||||
}
|
183
jni/vnc/LibVNCServer-0.9.9/examples/zippy.c
Normal file
183
jni/vnc/LibVNCServer-0.9.9/examples/zippy.c
Normal file
@ -0,0 +1,183 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/keysym.h>
|
||||
#include <rfb/default8x16.h>
|
||||
|
||||
static int maxx=400, maxy=400, bpp=4;
|
||||
/* odd maxx doesn't work (vncviewer bug) */
|
||||
|
||||
/* Here we create a structure so that every client has it's own pointer */
|
||||
|
||||
/* turns the framebuffer black */
|
||||
void blank_framebuffer(char* frame_buffer, int x1, int y1, int x2, int y2);
|
||||
/* displays a red bar, a green bar, and a blue bar */
|
||||
void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2);
|
||||
void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2);
|
||||
void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2);
|
||||
void linecount (char* frame_buffer);
|
||||
/* handles mouse events */
|
||||
void on_mouse_event (int buttonMask,int x,int y,rfbClientPtr cl);
|
||||
/* handles keyboard events */
|
||||
void on_key_press (rfbBool down,rfbKeySym key,rfbClientPtr cl);
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
rfbScreenInfoPtr server;
|
||||
|
||||
if(!rfbProcessSizeArguments(&maxx,&maxy,&bpp,&argc,argv))
|
||||
return 1;
|
||||
|
||||
server = rfbGetScreen (&argc, argv, maxx, maxy, 8, 3, bpp);
|
||||
if(!server)
|
||||
return 0;
|
||||
server->desktopName = "Zippy das wundersquirrel\'s VNC server";
|
||||
server->frameBuffer = (char*)malloc(maxx*maxy*bpp);
|
||||
server->alwaysShared = TRUE;
|
||||
server->kbdAddEvent = on_key_press;
|
||||
server->ptrAddEvent = on_mouse_event;
|
||||
|
||||
rfbInitServer (server);
|
||||
|
||||
blank_framebuffer(server->frameBuffer, 0, 0, maxx, maxy);
|
||||
rfbRunEventLoop (server, -1, FALSE);
|
||||
free(server->frameBuffer);
|
||||
rfbScreenCleanup (server);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void blank_framebuffer(char* frame_buffer, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < maxx * maxy * bpp; i++) frame_buffer[i]=(char) 0;
|
||||
}
|
||||
|
||||
void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int i, j, current_pixel;
|
||||
for (i=y1; i < y2; i++){
|
||||
for (j=x1; j < x2; j++) {
|
||||
current_pixel = (i*x2 + j) * bpp;
|
||||
if (i < y2 ) {
|
||||
frame_buffer[current_pixel+0] = (char) 128;
|
||||
frame_buffer[current_pixel+1] = (char) 0;
|
||||
frame_buffer[current_pixel+2] = (char) 0;
|
||||
}
|
||||
if (i < y2/3*2) {
|
||||
frame_buffer[current_pixel+0] = (char) 0;
|
||||
frame_buffer[current_pixel+1] = (char) 128;
|
||||
frame_buffer[current_pixel+2] = (char) 0;
|
||||
}
|
||||
if (i < y2/3) {
|
||||
frame_buffer[current_pixel+0] = (char) 0;
|
||||
frame_buffer[current_pixel+1] = (char) 0;
|
||||
frame_buffer[current_pixel+2] = (char) 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Dscho's versions (slower, but works for bpp != 3 or 4) */
|
||||
void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
|
||||
{
|
||||
rfbPixelFormat f=s->serverFormat;
|
||||
int i,j;
|
||||
for(j=y1;j<y2;j++)
|
||||
for(i=x1;i<x2;i++)
|
||||
if(j<y1*2/3+y2/3)
|
||||
rfbDrawPixel(s,i,j,f.redMax<<f.redShift);
|
||||
else if(j<y1/3+y2*2/3)
|
||||
rfbDrawPixel(s,i,j,f.greenMax<<f.greenShift);
|
||||
else
|
||||
rfbDrawPixel(s,i,j,f.blueMax<<f.blueShift);
|
||||
}
|
||||
|
||||
void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
|
||||
{
|
||||
rfbPixelFormat f=s->serverFormat;
|
||||
int i,j,y3=(y1*2+y2)/3,y4=(y1+y2*2)/3;
|
||||
/* draw first pixel */
|
||||
rfbDrawPixel(s,x1,y1,f.redMax<<f.redShift);
|
||||
rfbDrawPixel(s,x1,y3,f.greenMax<<f.greenShift);
|
||||
rfbDrawPixel(s,x1,y4,f.blueMax<<f.blueShift);
|
||||
/* then copy stripes */
|
||||
for(j=0;j<y2-y4;j++)
|
||||
for(i=x1;i<x2;i++) {
|
||||
#define ADDR(x,y) s->frameBuffer+(x)*bpp+(y)*s->paddedWidthInBytes
|
||||
memcpy(ADDR(i,j+y1),ADDR(x1,y1),bpp);
|
||||
memcpy(ADDR(i,j+y3),ADDR(x1,y3),bpp);
|
||||
memcpy(ADDR(i,j+y4),ADDR(x1,y4),bpp);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_primary_colours_generic_ultrafast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
|
||||
{
|
||||
rfbPixelFormat f=s->serverFormat;
|
||||
int y3=(y1*2+y2)/3,y4=(y1+y2*2)/3;
|
||||
/* fill rectangles */
|
||||
rfbFillRect(s,x1,y1,x2,y3,f.redMax<<f.redShift);
|
||||
rfbFillRect(s,x1,y3,x2,y4,f.greenMax<<f.greenShift);
|
||||
rfbFillRect(s,x1,y4,x2,y2,f.blueMax<<f.blueShift);
|
||||
}
|
||||
|
||||
void linecount (char* frame_buffer)
|
||||
{
|
||||
int i,j,k, current_pixel;
|
||||
for (i=maxy-4; i>maxy-20; i-=4)
|
||||
for (j=0; j<4; j++) for (k=0; k < maxx; k++) {
|
||||
current_pixel = (i*j*maxx + k) * bpp;
|
||||
if (i%2 == 0) {
|
||||
frame_buffer[current_pixel+0] = (char) 0;
|
||||
frame_buffer[current_pixel+1] = (char) 0;
|
||||
frame_buffer[current_pixel+2] = (char) 128;
|
||||
}
|
||||
|
||||
if (i%2 == 1) {
|
||||
frame_buffer[current_pixel+0] = (char) 128;
|
||||
frame_buffer[current_pixel+1] = (char) 0;
|
||||
frame_buffer[current_pixel+2] = (char) 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void on_key_press (rfbBool down,rfbKeySym key,rfbClientPtr cl)
|
||||
{
|
||||
if (down) /* or else the action occurs on both the press and depress */
|
||||
switch (key) {
|
||||
|
||||
case XK_b:
|
||||
case XK_B:
|
||||
blank_framebuffer(cl->screen->frameBuffer, 0, 0, maxx, maxy);
|
||||
rfbDrawString(cl->screen,&default8x16Font,20,maxy-20,"Hello, World!",0xffffff);
|
||||
rfbMarkRectAsModified(cl->screen,0, 0,maxx,maxy);
|
||||
rfbLog("Framebuffer blanked\n");
|
||||
break;
|
||||
case XK_p:
|
||||
case XK_P:
|
||||
/* draw_primary_colors (cl->screen->frameBuffer, 0, 0, maxx, maxy); */
|
||||
draw_primary_colours_generic_ultrafast (cl->screen, 0, 0, maxx, maxy);
|
||||
rfbMarkRectAsModified(cl->screen,0, 0,maxx,maxy);
|
||||
rfbLog("Primary colors displayed\n");
|
||||
break;
|
||||
case XK_Q:
|
||||
case XK_q:
|
||||
rfbLog("Exiting now\n");
|
||||
exit(0);
|
||||
case XK_C:
|
||||
case XK_c:
|
||||
rfbDrawString(cl->screen,&default8x16Font,20,100,"Hello, World!",0xffffff);
|
||||
rfbMarkRectAsModified(cl->screen,0, 0,maxx,maxy);
|
||||
break;
|
||||
default:
|
||||
rfbLog("The %c key was pressed\n", (char) key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void on_mouse_event (int buttonMask,int x,int y,rfbClientPtr cl)
|
||||
{
|
||||
printf("buttonMask: %i\n"
|
||||
"x: %i\n" "y: %i\n", buttonMask, x, y);
|
||||
}
|
520
jni/vnc/LibVNCServer-0.9.9/install-sh
Executable file
520
jni/vnc/LibVNCServer-0.9.9/install-sh
Executable file
@ -0,0 +1,520 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
12
jni/vnc/LibVNCServer-0.9.9/libvncclient.pc.in
Normal file
12
jni/vnc/LibVNCServer-0.9.9/libvncclient.pc.in
Normal file
@ -0,0 +1,12 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: LibVNCClient
|
||||
Description: A library for easy implementation of a VNC client.
|
||||
Version: @VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -lvncclient @LIBS@ @WSOCKLIB@
|
||||
Cflags: -I${includedir}
|
||||
|
29
jni/vnc/LibVNCServer-0.9.9/libvncclient/Makefile.am
Normal file
29
jni/vnc/LibVNCServer-0.9.9/libvncclient/Makefile.am
Normal file
@ -0,0 +1,29 @@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/common
|
||||
|
||||
if HAVE_GNUTLS
|
||||
TLSSRCS = tls_gnutls.c
|
||||
TLSLIBS = @GNUTLS_LIBS@
|
||||
else
|
||||
if HAVE_LIBSSL
|
||||
TLSSRCS = tls_openssl.c
|
||||
TLSLIBS = @SSL_LIBS@ @CRYPT_LIBS@
|
||||
else
|
||||
TLSSRCS = tls_none.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
libvncclient_la_SOURCES=cursor.c listen.c rfbproto.c sockets.c vncviewer.c ../common/minilzo.c $(TLSSRCS)
|
||||
libvncclient_la_LIBADD=$(TLSLIBS)
|
||||
|
||||
noinst_HEADERS=../common/lzodefs.h ../common/lzoconf.h ../common/minilzo.h tls.h
|
||||
|
||||
rfbproto.o: rfbproto.c corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c
|
||||
|
||||
EXTRA_DIST=corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c tls_gnutls.c tls_openssl.c tls_none.c
|
||||
|
||||
$(libvncclient_la_OBJECTS): ../rfb/rfbclient.h
|
||||
|
||||
lib_LTLIBRARIES=libvncclient.la
|
||||
|
||||
|
598
jni/vnc/LibVNCServer-0.9.9/libvncclient/Makefile.in
Normal file
598
jni/vnc/LibVNCServer-0.9.9/libvncclient/Makefile.in
Normal file
@ -0,0 +1,598 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = libvncclient
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/rfbconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libvncclient_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am__libvncclient_la_SOURCES_DIST = cursor.c listen.c rfbproto.c \
|
||||
sockets.c vncviewer.c ../common/minilzo.c tls_none.c \
|
||||
tls_openssl.c tls_gnutls.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@am__objects_1 = tls_none.lo
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@am__objects_1 = tls_openssl.lo
|
||||
@HAVE_GNUTLS_TRUE@am__objects_1 = tls_gnutls.lo
|
||||
am_libvncclient_la_OBJECTS = cursor.lo listen.lo rfbproto.lo \
|
||||
sockets.lo vncviewer.lo minilzo.lo $(am__objects_1)
|
||||
libvncclient_la_OBJECTS = $(am_libvncclient_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(libvncclient_la_SOURCES)
|
||||
DIST_SOURCES = $(am__libvncclient_la_SOURCES_DIST)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/common
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@TLSSRCS = tls_none.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@TLSSRCS = tls_openssl.c
|
||||
@HAVE_GNUTLS_TRUE@TLSSRCS = tls_gnutls.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@TLSLIBS = @SSL_LIBS@ @CRYPT_LIBS@
|
||||
@HAVE_GNUTLS_TRUE@TLSLIBS = @GNUTLS_LIBS@
|
||||
libvncclient_la_SOURCES = cursor.c listen.c rfbproto.c sockets.c vncviewer.c ../common/minilzo.c $(TLSSRCS)
|
||||
libvncclient_la_LIBADD = $(TLSLIBS)
|
||||
noinst_HEADERS = ../common/lzodefs.h ../common/lzoconf.h ../common/minilzo.h tls.h
|
||||
EXTRA_DIST = corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c tls_gnutls.c tls_openssl.c tls_none.c
|
||||
lib_LTLIBRARIES = libvncclient.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libvncclient/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libvncclient/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libvncclient.la: $(libvncclient_la_OBJECTS) $(libvncclient_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libvncclient_la_OBJECTS) $(libvncclient_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listen.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minilzo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbproto.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_gnutls.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_none.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_openssl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncviewer.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
minilzo.lo: ../common/minilzo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT minilzo.lo -MD -MP -MF $(DEPDIR)/minilzo.Tpo -c -o minilzo.lo `test -f '../common/minilzo.c' || echo '$(srcdir)/'`../common/minilzo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/minilzo.Tpo $(DEPDIR)/minilzo.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/minilzo.c' object='minilzo.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minilzo.lo `test -f '../common/minilzo.c' || echo '$(srcdir)/'`../common/minilzo.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
rfbproto.o: rfbproto.c corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c
|
||||
|
||||
$(libvncclient_la_OBJECTS): ../rfb/rfbclient.h
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
70
jni/vnc/LibVNCServer-0.9.9/libvncclient/corre.c
Normal file
70
jni/vnc/LibVNCServer-0.9.9/libvncclient/corre.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* corre.c - handle CoRRE encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles a CoRRE
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#define HandleCoRREBPP CONCAT2E(HandleCoRRE,BPP)
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
|
||||
static rfbBool
|
||||
HandleCoRREBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbRREHeader hdr;
|
||||
int i;
|
||||
CARDBPP pix;
|
||||
uint8_t *ptr;
|
||||
int x, y, w, h;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbRREHeader))
|
||||
return FALSE;
|
||||
|
||||
hdr.nSubrects = rfbClientSwap32IfLE(hdr.nSubrects);
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
|
||||
return FALSE;
|
||||
|
||||
FillRectangle(client, rx, ry, rw, rh, pix);
|
||||
|
||||
if (!ReadFromRFBServer(client, client->buffer, hdr.nSubrects * (4 + (BPP / 8))))
|
||||
return FALSE;
|
||||
|
||||
ptr = (uint8_t *)client->buffer;
|
||||
|
||||
for (i = 0; i < hdr.nSubrects; i++) {
|
||||
pix = *(CARDBPP *)ptr;
|
||||
ptr += BPP/8;
|
||||
x = *ptr++;
|
||||
y = *ptr++;
|
||||
w = *ptr++;
|
||||
h = *ptr++;
|
||||
|
||||
FillRectangle(client, rx+x, ry+y, w, h, pix);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
179
jni/vnc/LibVNCServer-0.9.9/libvncclient/cursor.c
Normal file
179
jni/vnc/LibVNCServer-0.9.9/libvncclient/cursor.c
Normal file
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (C) 2001,2002 Constantin Kaplinsky. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cursor.c - code to support cursor shape updates (XCursor and
|
||||
* RichCursor preudo-encodings).
|
||||
*/
|
||||
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
|
||||
#define OPER_SAVE 0
|
||||
#define OPER_RESTORE 1
|
||||
|
||||
#define RGB24_TO_PIXEL(bpp,r,g,b) \
|
||||
((((uint##bpp##_t)(r) & 0xFF) * client->format.redMax + 127) / 255 \
|
||||
<< client->format.redShift | \
|
||||
(((uint##bpp##_t)(g) & 0xFF) * client->format.greenMax + 127) / 255 \
|
||||
<< client->format.greenShift | \
|
||||
(((uint##bpp##_t)(b) & 0xFF) * client->format.blueMax + 127) / 255 \
|
||||
<< client->format.blueShift)
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* HandleCursorShape(). Support for XCursor and RichCursor shape
|
||||
* updates. We emulate cursor operating on the frame buffer (that is
|
||||
* why we call it "software cursor").
|
||||
********************************************************************/
|
||||
|
||||
rfbBool HandleCursorShape(rfbClient* client,int xhot, int yhot, int width, int height, uint32_t enc)
|
||||
{
|
||||
int bytesPerPixel;
|
||||
size_t bytesPerRow, bytesMaskData;
|
||||
rfbXCursorColors rgb;
|
||||
uint32_t colors[2];
|
||||
char *buf;
|
||||
uint8_t *ptr;
|
||||
int x, y, b;
|
||||
|
||||
bytesPerPixel = client->format.bitsPerPixel / 8;
|
||||
bytesPerRow = (width + 7) / 8;
|
||||
bytesMaskData = bytesPerRow * height;
|
||||
|
||||
if (width * height == 0)
|
||||
return TRUE;
|
||||
|
||||
/* Allocate memory for pixel data and temporary mask data. */
|
||||
if(client->rcSource)
|
||||
free(client->rcSource);
|
||||
|
||||
client->rcSource = malloc(width * height * bytesPerPixel);
|
||||
if (client->rcSource == NULL)
|
||||
return FALSE;
|
||||
|
||||
buf = malloc(bytesMaskData);
|
||||
if (buf == NULL) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Read and decode cursor pixel data, depending on the encoding type. */
|
||||
|
||||
if (enc == rfbEncodingXCursor) {
|
||||
/* Read and convert background and foreground colors. */
|
||||
if (!ReadFromRFBServer(client, (char *)&rgb, sz_rfbXCursorColors)) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
free(buf);
|
||||
return FALSE;
|
||||
}
|
||||
colors[0] = RGB24_TO_PIXEL(32, rgb.backRed, rgb.backGreen, rgb.backBlue);
|
||||
colors[1] = RGB24_TO_PIXEL(32, rgb.foreRed, rgb.foreGreen, rgb.foreBlue);
|
||||
|
||||
/* Read 1bpp pixel data into a temporary buffer. */
|
||||
if (!ReadFromRFBServer(client, buf, bytesMaskData)) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
free(buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Convert 1bpp data to byte-wide color indices. */
|
||||
ptr = client->rcSource;
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width / 8; x++) {
|
||||
for (b = 7; b >= 0; b--) {
|
||||
*ptr = buf[y * bytesPerRow + x] >> b & 1;
|
||||
ptr += bytesPerPixel;
|
||||
}
|
||||
}
|
||||
for (b = 7; b > 7 - width % 8; b--) {
|
||||
*ptr = buf[y * bytesPerRow + x] >> b & 1;
|
||||
ptr += bytesPerPixel;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert indices into the actual pixel values. */
|
||||
switch (bytesPerPixel) {
|
||||
case 1:
|
||||
for (x = 0; x < width * height; x++)
|
||||
client->rcSource[x] = (uint8_t)colors[client->rcSource[x]];
|
||||
break;
|
||||
case 2:
|
||||
for (x = 0; x < width * height; x++)
|
||||
((uint16_t *)client->rcSource)[x] = (uint16_t)colors[client->rcSource[x * 2]];
|
||||
break;
|
||||
case 4:
|
||||
for (x = 0; x < width * height; x++)
|
||||
((uint32_t *)client->rcSource)[x] = colors[client->rcSource[x * 4]];
|
||||
break;
|
||||
}
|
||||
|
||||
} else { /* enc == rfbEncodingRichCursor */
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)client->rcSource, width * height * bytesPerPixel)) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
free(buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Read and decode mask data. */
|
||||
|
||||
if (!ReadFromRFBServer(client, buf, bytesMaskData)) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
free(buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
client->rcMask = malloc(width * height);
|
||||
if (client->rcMask == NULL) {
|
||||
free(client->rcSource);
|
||||
client->rcSource = NULL;
|
||||
free(buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ptr = client->rcMask;
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width / 8; x++) {
|
||||
for (b = 7; b >= 0; b--) {
|
||||
*ptr++ = buf[y * bytesPerRow + x] >> b & 1;
|
||||
}
|
||||
}
|
||||
for (b = 7; b > 7 - width % 8; b--) {
|
||||
*ptr++ = buf[y * bytesPerRow + x] >> b & 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (client->GotCursorShape != NULL) {
|
||||
client->GotCursorShape(client, xhot, yhot, width, height, bytesPerPixel);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
127
jni/vnc/LibVNCServer-0.9.9/libvncclient/hextile.c
Normal file
127
jni/vnc/LibVNCServer-0.9.9/libvncclient/hextile.c
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* hextile.c - handle hextile encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles a hextile
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#define HandleHextileBPP CONCAT2E(HandleHextile,BPP)
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
|
||||
static rfbBool
|
||||
HandleHextileBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
CARDBPP bg, fg;
|
||||
int i;
|
||||
uint8_t *ptr;
|
||||
int x, y, w, h;
|
||||
int sx, sy, sw, sh;
|
||||
uint8_t subencoding;
|
||||
uint8_t nSubrects;
|
||||
|
||||
for (y = ry; y < ry+rh; y += 16) {
|
||||
for (x = rx; x < rx+rw; x += 16) {
|
||||
w = h = 16;
|
||||
if (rx+rw - x < 16)
|
||||
w = rx+rw - x;
|
||||
if (ry+rh - y < 16)
|
||||
h = ry+rh - y;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&subencoding, 1))
|
||||
return FALSE;
|
||||
|
||||
if (subencoding & rfbHextileRaw) {
|
||||
if (!ReadFromRFBServer(client, client->buffer, w * h * (BPP / 8)))
|
||||
return FALSE;
|
||||
|
||||
CopyRectangle(client, (uint8_t *)client->buffer, x, y, w, h);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (subencoding & rfbHextileBackgroundSpecified)
|
||||
if (!ReadFromRFBServer(client, (char *)&bg, sizeof(bg)))
|
||||
return FALSE;
|
||||
|
||||
FillRectangle(client, x, y, w, h, bg);
|
||||
|
||||
if (subencoding & rfbHextileForegroundSpecified)
|
||||
if (!ReadFromRFBServer(client, (char *)&fg, sizeof(fg)))
|
||||
return FALSE;
|
||||
|
||||
if (!(subencoding & rfbHextileAnySubrects)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&nSubrects, 1))
|
||||
return FALSE;
|
||||
|
||||
ptr = (uint8_t*)client->buffer;
|
||||
|
||||
if (subencoding & rfbHextileSubrectsColoured) {
|
||||
if (!ReadFromRFBServer(client, client->buffer, nSubrects * (2 + (BPP / 8))))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < nSubrects; i++) {
|
||||
#if BPP==8
|
||||
GET_PIXEL8(fg, ptr);
|
||||
#elif BPP==16
|
||||
GET_PIXEL16(fg, ptr);
|
||||
#elif BPP==32
|
||||
GET_PIXEL32(fg, ptr);
|
||||
#else
|
||||
#error "Invalid BPP"
|
||||
#endif
|
||||
sx = rfbHextileExtractX(*ptr);
|
||||
sy = rfbHextileExtractY(*ptr);
|
||||
ptr++;
|
||||
sw = rfbHextileExtractW(*ptr);
|
||||
sh = rfbHextileExtractH(*ptr);
|
||||
ptr++;
|
||||
|
||||
FillRectangle(client, x+sx, y+sy, sw, sh, fg);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!ReadFromRFBServer(client, client->buffer, nSubrects * 2))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < nSubrects; i++) {
|
||||
sx = rfbHextileExtractX(*ptr);
|
||||
sy = rfbHextileExtractY(*ptr);
|
||||
ptr++;
|
||||
sw = rfbHextileExtractW(*ptr);
|
||||
sh = rfbHextileExtractH(*ptr);
|
||||
ptr++;
|
||||
|
||||
FillRectangle(client, x+sx, y+sy, sw, sh, fg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
227
jni/vnc/LibVNCServer-0.9.9/libvncclient/listen.c
Normal file
227
jni/vnc/LibVNCServer-0.9.9/libvncclient/listen.c
Normal file
@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Christian Beier <dontmind@freeshell.org>
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* listen.c - listen for incoming connections
|
||||
*/
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __MINGW32__
|
||||
#define close closesocket
|
||||
#include <winsock2.h>
|
||||
#undef max
|
||||
#else
|
||||
#include <sys/wait.h>
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
|
||||
/*
|
||||
* listenForIncomingConnections() - listen for incoming connections from
|
||||
* servers, and fork a new process to deal with each connection.
|
||||
*/
|
||||
|
||||
void
|
||||
listenForIncomingConnections(rfbClient* client)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
/* FIXME */
|
||||
rfbClientErr("listenForIncomingConnections on MinGW32 NOT IMPLEMENTED\n");
|
||||
return;
|
||||
#else
|
||||
int listenSocket, listen6Socket = -1;
|
||||
fd_set fds;
|
||||
|
||||
client->listenSpecified = TRUE;
|
||||
|
||||
listenSocket = ListenAtTcpPortAndAddress(client->listenPort, client->listenAddress);
|
||||
|
||||
if ((listenSocket < 0))
|
||||
return;
|
||||
|
||||
rfbClientLog("%s -listen: Listening on port %d\n",
|
||||
client->programName,client->listenPort);
|
||||
rfbClientLog("%s -listen: Command line errors are not reported until "
|
||||
"a connection comes in.\n", client->programName);
|
||||
|
||||
#ifdef LIBVNCSERVER_IPv6 /* only try that if we're IPv6-capable, otherwise we may try to bind to the same port which would make all that listening fail */
|
||||
/* only do IPv6 listen of listen6Port is set */
|
||||
if (client->listen6Port > 0)
|
||||
{
|
||||
listen6Socket = ListenAtTcpPortAndAddress(client->listen6Port, client->listen6Address);
|
||||
|
||||
if (listen6Socket < 0)
|
||||
return;
|
||||
|
||||
rfbClientLog("%s -listen: Listening on IPV6 port %d\n",
|
||||
client->programName,client->listenPort);
|
||||
rfbClientLog("%s -listen: Command line errors are not reported until "
|
||||
"a connection comes in.\n", client->programName);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (TRUE) {
|
||||
int r;
|
||||
/* reap any zombies */
|
||||
int status, pid;
|
||||
while ((pid= wait3(&status, WNOHANG, (struct rusage *)0))>0);
|
||||
|
||||
/* TODO: callback for discard any events (like X11 events) */
|
||||
|
||||
FD_ZERO(&fds);
|
||||
|
||||
if(listenSocket >= 0)
|
||||
FD_SET(listenSocket, &fds);
|
||||
if(listen6Socket >= 0)
|
||||
FD_SET(listen6Socket, &fds);
|
||||
|
||||
r = select(max(listenSocket, listen6Socket)+1, &fds, NULL, NULL, NULL);
|
||||
|
||||
if (r > 0) {
|
||||
if (FD_ISSET(listenSocket, &fds))
|
||||
client->sock = AcceptTcpConnection(client->listenSock);
|
||||
else if (FD_ISSET(listen6Socket, &fds))
|
||||
client->sock = AcceptTcpConnection(client->listen6Sock);
|
||||
|
||||
if (client->sock < 0)
|
||||
return;
|
||||
if (!SetNonBlocking(client->sock))
|
||||
return;
|
||||
|
||||
/* Now fork off a new process to deal with it... */
|
||||
|
||||
switch (fork()) {
|
||||
|
||||
case -1:
|
||||
rfbClientErr("fork\n");
|
||||
return;
|
||||
|
||||
case 0:
|
||||
/* child - return to caller */
|
||||
close(listenSocket);
|
||||
close(listen6Socket);
|
||||
return;
|
||||
|
||||
default:
|
||||
/* parent - go round and listen again */
|
||||
close(client->sock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* listenForIncomingConnectionsNoFork() - listen for incoming connections
|
||||
* from servers, but DON'T fork, instead just wait timeout microseconds.
|
||||
* If timeout is negative, block indefinitly.
|
||||
* Returns 1 on success (there was an incoming connection on the listen socket
|
||||
* and we accepted it successfully), -1 on error, 0 on timeout.
|
||||
*/
|
||||
|
||||
int
|
||||
listenForIncomingConnectionsNoFork(rfbClient* client, int timeout)
|
||||
{
|
||||
fd_set fds;
|
||||
struct timeval to;
|
||||
int r;
|
||||
|
||||
to.tv_sec= timeout / 1000000;
|
||||
to.tv_usec= timeout % 1000000;
|
||||
|
||||
client->listenSpecified = TRUE;
|
||||
|
||||
if (client->listenSock < 0)
|
||||
{
|
||||
client->listenSock = ListenAtTcpPortAndAddress(client->listenPort, client->listenAddress);
|
||||
|
||||
if (client->listenSock < 0)
|
||||
return -1;
|
||||
|
||||
rfbClientLog("%s -listennofork: Listening on port %d\n",
|
||||
client->programName,client->listenPort);
|
||||
rfbClientLog("%s -listennofork: Command line errors are not reported until "
|
||||
"a connection comes in.\n", client->programName);
|
||||
}
|
||||
|
||||
#ifdef LIBVNCSERVER_IPv6 /* only try that if we're IPv6-capable, otherwise we may try to bind to the same port which would make all that listening fail */
|
||||
/* only do IPv6 listen of listen6Port is set */
|
||||
if (client->listen6Port > 0 && client->listen6Sock < 0)
|
||||
{
|
||||
client->listen6Sock = ListenAtTcpPortAndAddress(client->listen6Port, client->listen6Address);
|
||||
|
||||
if (client->listen6Sock < 0)
|
||||
return -1;
|
||||
|
||||
rfbClientLog("%s -listennofork: Listening on IPV6 port %d\n",
|
||||
client->programName,client->listenPort);
|
||||
rfbClientLog("%s -listennofork: Command line errors are not reported until "
|
||||
"a connection comes in.\n", client->programName);
|
||||
}
|
||||
#endif
|
||||
|
||||
FD_ZERO(&fds);
|
||||
|
||||
if(client->listenSock >= 0)
|
||||
FD_SET(client->listenSock, &fds);
|
||||
if(client->listen6Sock >= 0)
|
||||
FD_SET(client->listen6Sock, &fds);
|
||||
|
||||
if (timeout < 0)
|
||||
r = select(max(client->listenSock, client->listen6Sock) +1, &fds, NULL, NULL, NULL);
|
||||
else
|
||||
r = select(max(client->listenSock, client->listen6Sock) +1, &fds, NULL, NULL, &to);
|
||||
|
||||
if (r > 0)
|
||||
{
|
||||
if (FD_ISSET(client->listenSock, &fds))
|
||||
client->sock = AcceptTcpConnection(client->listenSock);
|
||||
else if (FD_ISSET(client->listen6Sock, &fds))
|
||||
client->sock = AcceptTcpConnection(client->listen6Sock);
|
||||
|
||||
if (client->sock < 0)
|
||||
return -1;
|
||||
if (!SetNonBlocking(client->sock))
|
||||
return -1;
|
||||
|
||||
if(client->listenSock >= 0) {
|
||||
close(client->listenSock);
|
||||
client->listenSock = -1;
|
||||
}
|
||||
if(client->listen6Sock >= 0) {
|
||||
close(client->listen6Sock);
|
||||
client->listen6Sock = -1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* r is now either 0 (timeout) or -1 (error) */
|
||||
return r;
|
||||
}
|
||||
|
||||
|
2403
jni/vnc/LibVNCServer-0.9.9/libvncclient/rfbproto.c
Normal file
2403
jni/vnc/LibVNCServer-0.9.9/libvncclient/rfbproto.c
Normal file
File diff suppressed because it is too large
Load Diff
68
jni/vnc/LibVNCServer-0.9.9/libvncclient/rre.c
Normal file
68
jni/vnc/LibVNCServer-0.9.9/libvncclient/rre.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rre.c - handle RRE encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles an RRE
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#define HandleRREBPP CONCAT2E(HandleRRE,BPP)
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
|
||||
static rfbBool
|
||||
HandleRREBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbRREHeader hdr;
|
||||
int i;
|
||||
CARDBPP pix;
|
||||
rfbRectangle subrect;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbRREHeader))
|
||||
return FALSE;
|
||||
|
||||
hdr.nSubrects = rfbClientSwap32IfLE(hdr.nSubrects);
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
|
||||
return FALSE;
|
||||
|
||||
FillRectangle(client, rx, ry, rw, rh, pix);
|
||||
|
||||
for (i = 0; i < hdr.nSubrects; i++) {
|
||||
if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
|
||||
return FALSE;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&subrect, sz_rfbRectangle))
|
||||
return FALSE;
|
||||
|
||||
subrect.x = rfbClientSwap16IfLE(subrect.x);
|
||||
subrect.y = rfbClientSwap16IfLE(subrect.y);
|
||||
subrect.w = rfbClientSwap16IfLE(subrect.w);
|
||||
subrect.h = rfbClientSwap16IfLE(subrect.h);
|
||||
|
||||
FillRectangle(client, rx+subrect.x, ry+subrect.y, subrect.w, subrect.h, pix);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
813
jni/vnc/LibVNCServer-0.9.9/libvncclient/sockets.c
Normal file
813
jni/vnc/LibVNCServer-0.9.9/libvncclient/sockets.c
Normal file
@ -0,0 +1,813 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Christian Beier <dontmind@freeshell.org>
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sockets.c - functions to deal with sockets.
|
||||
*/
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
#ifdef WIN32
|
||||
#undef SOCKET
|
||||
#include <winsock2.h>
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define close closesocket
|
||||
#define read(sock,buf,len) recv(sock,buf,len,0)
|
||||
#define write(sock,buf,len) send(sock,buf,len,0)
|
||||
#define socklen_t int
|
||||
#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
|
||||
#undef socklen_t
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include "tls.h"
|
||||
|
||||
void PrintInHex(char *buf, int len);
|
||||
|
||||
rfbBool errorMessageOnReadFailure = TRUE;
|
||||
|
||||
/*
|
||||
* ReadFromRFBServer is called whenever we want to read some data from the RFB
|
||||
* server. It is non-trivial for two reasons:
|
||||
*
|
||||
* 1. For efficiency it performs some intelligent buffering, avoiding invoking
|
||||
* the read() system call too often. For small chunks of data, it simply
|
||||
* copies the data out of an internal buffer. For large amounts of data it
|
||||
* reads directly into the buffer provided by the caller.
|
||||
*
|
||||
* 2. Whenever read() would block, it invokes the Xt event dispatching
|
||||
* mechanism to process X events. In fact, this is the only place these
|
||||
* events are processed, as there is no XtAppMainLoop in the program.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
|
||||
{
|
||||
#undef DEBUG_READ_EXACT
|
||||
#ifdef DEBUG_READ_EXACT
|
||||
char* oout=out;
|
||||
int nn=n;
|
||||
rfbClientLog("ReadFromRFBServer %d bytes\n",n);
|
||||
#endif
|
||||
if (client->serverPort==-1) {
|
||||
/* vncrec playing */
|
||||
rfbVNCRec* rec = client->vncRec;
|
||||
struct timeval tv;
|
||||
|
||||
if (rec->readTimestamp) {
|
||||
rec->readTimestamp = FALSE;
|
||||
if (!fread(&tv,sizeof(struct timeval),1,rec->file))
|
||||
return FALSE;
|
||||
|
||||
tv.tv_sec = rfbClientSwap32IfLE (tv.tv_sec);
|
||||
tv.tv_usec = rfbClientSwap32IfLE (tv.tv_usec);
|
||||
|
||||
if (rec->tv.tv_sec!=0 && !rec->doNotSleep) {
|
||||
struct timeval diff;
|
||||
diff.tv_sec = tv.tv_sec - rec->tv.tv_sec;
|
||||
diff.tv_usec = tv.tv_usec - rec->tv.tv_usec;
|
||||
if(diff.tv_usec<0) {
|
||||
diff.tv_sec--;
|
||||
diff.tv_usec+=1000000;
|
||||
}
|
||||
#ifndef __MINGW32__
|
||||
sleep (diff.tv_sec);
|
||||
usleep (diff.tv_usec);
|
||||
#else
|
||||
Sleep (diff.tv_sec * 1000 + diff.tv_usec/1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
rec->tv=tv;
|
||||
}
|
||||
|
||||
return (fread(out,1,n,rec->file)<0?FALSE:TRUE);
|
||||
}
|
||||
|
||||
if (n <= client->buffered) {
|
||||
memcpy(out, client->bufoutptr, n);
|
||||
client->bufoutptr += n;
|
||||
client->buffered -= n;
|
||||
#ifdef DEBUG_READ_EXACT
|
||||
goto hexdump;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
memcpy(out, client->bufoutptr, client->buffered);
|
||||
|
||||
out += client->buffered;
|
||||
n -= client->buffered;
|
||||
|
||||
client->bufoutptr = client->buf;
|
||||
client->buffered = 0;
|
||||
|
||||
if (n <= RFB_BUF_SIZE) {
|
||||
|
||||
while (client->buffered < n) {
|
||||
int i;
|
||||
if (client->tlsSession) {
|
||||
i = ReadFromTLS(client, client->buf + client->buffered, RFB_BUF_SIZE - client->buffered);
|
||||
} else {
|
||||
i = read(client->sock, client->buf + client->buffered, RFB_BUF_SIZE - client->buffered);
|
||||
}
|
||||
if (i <= 0) {
|
||||
if (i < 0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||
/* TODO:
|
||||
ProcessXtEvents();
|
||||
*/
|
||||
WaitForMessage(client, 100000);
|
||||
i = 0;
|
||||
} else {
|
||||
rfbClientErr("read (%d: %s)\n",errno,strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (errorMessageOnReadFailure) {
|
||||
rfbClientLog("VNC server closed connection\n");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
client->buffered += i;
|
||||
}
|
||||
|
||||
memcpy(out, client->bufoutptr, n);
|
||||
client->bufoutptr += n;
|
||||
client->buffered -= n;
|
||||
|
||||
} else {
|
||||
|
||||
while (n > 0) {
|
||||
int i;
|
||||
if (client->tlsSession) {
|
||||
i = ReadFromTLS(client, out, n);
|
||||
} else {
|
||||
i = read(client->sock, out, n);
|
||||
}
|
||||
|
||||
if (i <= 0) {
|
||||
if (i < 0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||
/* TODO:
|
||||
ProcessXtEvents();
|
||||
*/
|
||||
WaitForMessage(client, 100000);
|
||||
i = 0;
|
||||
} else {
|
||||
rfbClientErr("read (%s)\n",strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (errorMessageOnReadFailure) {
|
||||
rfbClientLog("VNC server closed connection\n");
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
out += i;
|
||||
n -= i;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_READ_EXACT
|
||||
hexdump:
|
||||
{ int ii;
|
||||
for(ii=0;ii<nn;ii++)
|
||||
fprintf(stderr,"%02x ",(unsigned char)oout[ii]);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write an exact number of bytes, and don't return until you've sent them.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
WriteToRFBServer(rfbClient* client, char *buf, int n)
|
||||
{
|
||||
fd_set fds;
|
||||
int i = 0;
|
||||
int j;
|
||||
|
||||
if (client->serverPort==-1)
|
||||
return TRUE; /* vncrec playing */
|
||||
|
||||
if (client->tlsSession) {
|
||||
/* WriteToTLS() will guarantee either everything is written, or error/eof returns */
|
||||
i = WriteToTLS(client, buf, n);
|
||||
if (i <= 0) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
while (i < n) {
|
||||
j = write(client->sock, buf + i, (n - i));
|
||||
if (j <= 0) {
|
||||
if (j < 0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EWOULDBLOCK ||
|
||||
#ifdef LIBVNCSERVER_ENOENT_WORKAROUND
|
||||
errno == ENOENT ||
|
||||
#endif
|
||||
errno == EAGAIN) {
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(client->sock,&fds);
|
||||
|
||||
if (select(client->sock+1, NULL, &fds, NULL, NULL) <= 0) {
|
||||
rfbClientErr("select\n");
|
||||
return FALSE;
|
||||
}
|
||||
j = 0;
|
||||
} else {
|
||||
rfbClientErr("write\n");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
rfbClientLog("write failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
i += j;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int initSockets() {
|
||||
#ifdef WIN32
|
||||
WSADATA trash;
|
||||
static rfbBool WSAinitted=FALSE;
|
||||
if(!WSAinitted) {
|
||||
int i=WSAStartup(MAKEWORD(2,0),&trash);
|
||||
if(i!=0) {
|
||||
rfbClientErr("Couldn't init Windows Sockets\n");
|
||||
return 0;
|
||||
}
|
||||
WSAinitted=TRUE;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ConnectToTcpAddr connects to the given TCP port.
|
||||
*/
|
||||
|
||||
int
|
||||
ConnectClientToTcpAddr(unsigned int host, int port)
|
||||
{
|
||||
int sock;
|
||||
struct sockaddr_in addr;
|
||||
int one = 1;
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.s_addr = host;
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
rfbClientErr("ConnectToTcpAddr: socket (%s)\n",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
rfbClientErr("ConnectToTcpAddr: connect\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("ConnectToTcpAddr: setsockopt\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
int
|
||||
ConnectClientToTcpAddr6(const char *hostname, int port)
|
||||
{
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
int sock;
|
||||
int n;
|
||||
struct addrinfo hints, *res, *ressave;
|
||||
char port_s[10];
|
||||
int one = 1;
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
snprintf(port_s, 10, "%d", port);
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
if ((n = getaddrinfo(hostname, port_s, &hints, &res)))
|
||||
{
|
||||
rfbClientErr("ConnectClientToTcpAddr6: getaddrinfo (%s)\n", gai_strerror(n));
|
||||
return -1;
|
||||
}
|
||||
|
||||
ressave = res;
|
||||
sock = -1;
|
||||
while (res)
|
||||
{
|
||||
sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (sock >= 0)
|
||||
{
|
||||
if (connect(sock, res->ai_addr, res->ai_addrlen) == 0)
|
||||
break;
|
||||
close(sock);
|
||||
sock = -1;
|
||||
}
|
||||
res = res->ai_next;
|
||||
}
|
||||
freeaddrinfo(ressave);
|
||||
|
||||
if (sock == -1)
|
||||
{
|
||||
rfbClientErr("ConnectClientToTcpAddr6: connect\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("ConnectToTcpAddr: setsockopt\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
|
||||
#else
|
||||
|
||||
rfbClientErr("ConnectClientToTcpAddr6: IPv6 disabled\n");
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
ConnectClientToUnixSock(const char *sockFile)
|
||||
{
|
||||
#ifdef WIN32
|
||||
rfbClientErr("Windows doesn't support UNIX sockets\n");
|
||||
return -1;
|
||||
#else
|
||||
int sock;
|
||||
struct sockaddr_un addr;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strcpy(addr.sun_path, sockFile);
|
||||
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
rfbClientErr("ConnectToUnixSock: socket (%s)\n",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr.sun_family) + strlen(addr.sun_path)) < 0) {
|
||||
rfbClientErr("ConnectToUnixSock: connect\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* FindFreeTcpPort tries to find unused TCP port in the range
|
||||
* (TUNNEL_PORT_OFFSET, TUNNEL_PORT_OFFSET + 99]. Returns 0 on failure.
|
||||
*/
|
||||
|
||||
int
|
||||
FindFreeTcpPort(void)
|
||||
{
|
||||
int sock, port;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
rfbClientErr(": FindFreeTcpPort: socket\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (port = TUNNEL_PORT_OFFSET + 99; port > TUNNEL_PORT_OFFSET; port--) {
|
||||
addr.sin_port = htons((unsigned short)port);
|
||||
if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
|
||||
close(sock);
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
close(sock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ListenAtTcpPort starts listening at the given TCP port.
|
||||
*/
|
||||
|
||||
int
|
||||
ListenAtTcpPort(int port)
|
||||
{
|
||||
return ListenAtTcpPortAndAddress(port, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ListenAtTcpPortAndAddress starts listening at the given TCP port on
|
||||
* the given IP address
|
||||
*/
|
||||
|
||||
int
|
||||
ListenAtTcpPortAndAddress(int port, const char *address)
|
||||
{
|
||||
int sock;
|
||||
int one = 1;
|
||||
#ifndef LIBVNCSERVER_IPv6
|
||||
struct sockaddr_in addr;
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
if (address) {
|
||||
addr.sin_addr.s_addr = inet_addr(address);
|
||||
} else {
|
||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
}
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
rfbClientErr("ListenAtTcpPort: socket\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(const char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("ListenAtTcpPort: setsockopt\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
rfbClientErr("ListenAtTcpPort: bind\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
int rv;
|
||||
struct addrinfo hints, *servinfo, *p;
|
||||
char port_str[8];
|
||||
|
||||
snprintf(port_str, 8, "%d", port);
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE; /* fill in wildcard address if address == NULL */
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
if ((rv = getaddrinfo(address, port_str, &hints, &servinfo)) != 0) {
|
||||
rfbClientErr("ListenAtTcpPortAndAddress: error in getaddrinfo: %s\n", gai_strerror(rv));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* loop through all the results and bind to the first we can */
|
||||
for(p = servinfo; p != NULL; p = p->ai_next) {
|
||||
if ((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef IPV6_V6ONLY
|
||||
/* we have seperate IPv4 and IPv6 sockets since some OS's do not support dual binding */
|
||||
if (p->ai_family == AF_INET6 && setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("ListenAtTcpPortAndAddress: error in setsockopt IPV6_V6ONLY: %s\n", strerror(errno));
|
||||
close(sock);
|
||||
freeaddrinfo(servinfo);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("ListenAtTcpPortAndAddress: error in setsockopt SO_REUSEADDR: %s\n", strerror(errno));
|
||||
close(sock);
|
||||
freeaddrinfo(servinfo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bind(sock, p->ai_addr, p->ai_addrlen) < 0) {
|
||||
close(sock);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (p == NULL) {
|
||||
rfbClientErr("ListenAtTcpPortAndAddress: error in bind: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* all done with this structure now */
|
||||
freeaddrinfo(servinfo);
|
||||
#endif
|
||||
|
||||
if (listen(sock, 5) < 0) {
|
||||
rfbClientErr("ListenAtTcpPort: listen\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* AcceptTcpConnection accepts a TCP connection.
|
||||
*/
|
||||
|
||||
int
|
||||
AcceptTcpConnection(int listenSock)
|
||||
{
|
||||
int sock;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
int one = 1;
|
||||
|
||||
sock = accept(listenSock, (struct sockaddr *) &addr, &addrlen);
|
||||
if (sock < 0) {
|
||||
rfbClientErr("AcceptTcpConnection: accept\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbClientErr("AcceptTcpConnection: setsockopt\n");
|
||||
close(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SetNonBlocking sets a socket into non-blocking mode.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
SetNonBlocking(int sock)
|
||||
{
|
||||
#ifdef WIN32
|
||||
unsigned long block=1;
|
||||
if(ioctlsocket(sock, FIONBIO, &block) == SOCKET_ERROR) {
|
||||
errno=WSAGetLastError();
|
||||
#else
|
||||
int flags = fcntl(sock, F_GETFL);
|
||||
if(flags < 0 || fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
#endif
|
||||
rfbClientErr("Setting socket to non-blocking failed: %s\n",strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* SetDSCP sets a socket's IP QoS parameters aka Differentiated Services Code Point field
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
SetDSCP(int sock, int dscp)
|
||||
{
|
||||
#ifdef WIN32
|
||||
rfbClientErr("Setting of QoS IP DSCP not implemented for Windows\n");
|
||||
return TRUE;
|
||||
#else
|
||||
int level, cmd;
|
||||
struct sockaddr addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
if(getsockname(sock, &addr, &addrlen) != 0) {
|
||||
rfbClientErr("Setting socket QoS failed while getting socket address: %s\n",strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch(addr.sa_family)
|
||||
{
|
||||
#if defined LIBVNCSERVER_IPv6 && defined IPV6_TCLASS
|
||||
case AF_INET6:
|
||||
level = IPPROTO_IPV6;
|
||||
cmd = IPV6_TCLASS;
|
||||
break;
|
||||
#endif
|
||||
case AF_INET:
|
||||
level = IPPROTO_IP;
|
||||
cmd = IP_TOS;
|
||||
break;
|
||||
default:
|
||||
rfbClientErr("Setting socket QoS failed: Not bound to IP address");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(setsockopt(sock, level, cmd, (void*)&dscp, sizeof(dscp)) != 0) {
|
||||
rfbClientErr("Setting socket QoS failed: %s\n", strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* StringToIPAddr - convert a host string to an IP address.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
StringToIPAddr(const char *str, unsigned int *addr)
|
||||
{
|
||||
struct hostent *hp;
|
||||
|
||||
if (strcmp(str,"") == 0) {
|
||||
*addr = htonl(INADDR_LOOPBACK); /* local */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*addr = inet_addr(str);
|
||||
|
||||
if (*addr != -1)
|
||||
return TRUE;
|
||||
|
||||
if (!initSockets())
|
||||
return -1;
|
||||
|
||||
hp = gethostbyname(str);
|
||||
|
||||
if (hp) {
|
||||
*addr = *(unsigned int *)hp->h_addr;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test if the other end of a socket is on the same machine.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
SameMachine(int sock)
|
||||
{
|
||||
struct sockaddr_in peeraddr, myaddr;
|
||||
socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||
|
||||
getpeername(sock, (struct sockaddr *)&peeraddr, &addrlen);
|
||||
getsockname(sock, (struct sockaddr *)&myaddr, &addrlen);
|
||||
|
||||
return (peeraddr.sin_addr.s_addr == myaddr.sin_addr.s_addr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print out the contents of a packet for debugging.
|
||||
*/
|
||||
|
||||
void
|
||||
PrintInHex(char *buf, int len)
|
||||
{
|
||||
int i, j;
|
||||
char c, str[17];
|
||||
|
||||
str[16] = 0;
|
||||
|
||||
rfbClientLog("ReadExact: ");
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if ((i % 16 == 0) && (i != 0)) {
|
||||
rfbClientLog(" ");
|
||||
}
|
||||
c = buf[i];
|
||||
str[i % 16] = (((c > 31) && (c < 127)) ? c : '.');
|
||||
rfbClientLog("%02x ",(unsigned char)c);
|
||||
if ((i % 4) == 3)
|
||||
rfbClientLog(" ");
|
||||
if ((i % 16) == 15)
|
||||
{
|
||||
rfbClientLog("%s\n",str);
|
||||
}
|
||||
}
|
||||
if ((i % 16) != 0)
|
||||
{
|
||||
for (j = i % 16; j < 16; j++)
|
||||
{
|
||||
rfbClientLog(" ");
|
||||
if ((j % 4) == 3) rfbClientLog(" ");
|
||||
}
|
||||
str[i % 16] = 0;
|
||||
rfbClientLog("%s\n",str);
|
||||
}
|
||||
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
int WaitForMessage(rfbClient* client,unsigned int usecs)
|
||||
{
|
||||
fd_set fds;
|
||||
struct timeval timeout;
|
||||
int num;
|
||||
|
||||
if (client->serverPort==-1)
|
||||
/* playing back vncrec file */
|
||||
return 1;
|
||||
|
||||
timeout.tv_sec=(usecs/1000000);
|
||||
timeout.tv_usec=(usecs%1000000);
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(client->sock,&fds);
|
||||
|
||||
num=select(client->sock+1, &fds, NULL, NULL, &timeout);
|
||||
if(num<0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
rfbClientLog("Waiting for message failed: %d (%s)\n",errno,strerror(errno));
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
688
jni/vnc/LibVNCServer-0.9.9/libvncclient/tight.c
Normal file
688
jni/vnc/LibVNCServer-0.9.9/libvncclient/tight.c
Normal file
@ -0,0 +1,688 @@
|
||||
/*
|
||||
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
|
||||
/*
|
||||
* tight.c - handle ``tight'' encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple
|
||||
* times by rfbproto.c, each time with a different definition of the
|
||||
* macro BPP. For each value of BPP, this file defines a function
|
||||
* which handles a tight-encoded rectangle with BPP bits per pixel.
|
||||
*
|
||||
*/
|
||||
|
||||
#define TIGHT_MIN_TO_COMPRESS 12
|
||||
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
#define filterPtrBPP CONCAT2E(filterPtr,BPP)
|
||||
|
||||
#define HandleTightBPP CONCAT2E(HandleTight,BPP)
|
||||
#define InitFilterCopyBPP CONCAT2E(InitFilterCopy,BPP)
|
||||
#define InitFilterPaletteBPP CONCAT2E(InitFilterPalette,BPP)
|
||||
#define InitFilterGradientBPP CONCAT2E(InitFilterGradient,BPP)
|
||||
#define FilterCopyBPP CONCAT2E(FilterCopy,BPP)
|
||||
#define FilterPaletteBPP CONCAT2E(FilterPalette,BPP)
|
||||
#define FilterGradientBPP CONCAT2E(FilterGradient,BPP)
|
||||
|
||||
#if BPP != 8
|
||||
#define DecompressJpegRectBPP CONCAT2E(DecompressJpegRect,BPP)
|
||||
#endif
|
||||
|
||||
#ifndef RGB_TO_PIXEL
|
||||
|
||||
#define RGB_TO_PIXEL(bpp,r,g,b) \
|
||||
(((CARD##bpp)(r) & client->format.redMax) << client->format.redShift | \
|
||||
((CARD##bpp)(g) & client->format.greenMax) << client->format.greenShift | \
|
||||
((CARD##bpp)(b) & client->format.blueMax) << client->format.blueShift)
|
||||
|
||||
#define RGB24_TO_PIXEL(bpp,r,g,b) \
|
||||
((((CARD##bpp)(r) & 0xFF) * client->format.redMax + 127) / 255 \
|
||||
<< client->format.redShift | \
|
||||
(((CARD##bpp)(g) & 0xFF) * client->format.greenMax + 127) / 255 \
|
||||
<< client->format.greenShift | \
|
||||
(((CARD##bpp)(b) & 0xFF) * client->format.blueMax + 127) / 255 \
|
||||
<< client->format.blueShift)
|
||||
|
||||
#define RGB24_TO_PIXEL32(r,g,b) \
|
||||
(((uint32_t)(r) & 0xFF) << client->format.redShift | \
|
||||
((uint32_t)(g) & 0xFF) << client->format.greenShift | \
|
||||
((uint32_t)(b) & 0xFF) << client->format.blueShift)
|
||||
|
||||
#endif
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
typedef void (*filterPtrBPP)(rfbClient* client, int, CARDBPP *);
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
static int InitFilterCopyBPP (rfbClient* client, int rw, int rh);
|
||||
static int InitFilterPaletteBPP (rfbClient* client, int rw, int rh);
|
||||
static int InitFilterGradientBPP (rfbClient* client, int rw, int rh);
|
||||
static void FilterCopyBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
|
||||
static void FilterPaletteBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
|
||||
static void FilterGradientBPP (rfbClient* client, int numRows, CARDBPP *destBuffer);
|
||||
|
||||
#if BPP != 8
|
||||
static rfbBool DecompressJpegRectBPP(rfbClient* client, int x, int y, int w, int h);
|
||||
#endif
|
||||
|
||||
/* Definitions */
|
||||
|
||||
static rfbBool
|
||||
HandleTightBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
CARDBPP fill_colour;
|
||||
uint8_t comp_ctl;
|
||||
uint8_t filter_id;
|
||||
filterPtrBPP filterFn;
|
||||
z_streamp zs;
|
||||
char *buffer2;
|
||||
int err, stream_id, compressedLen, bitsPixel;
|
||||
int bufferSize, rowSize, numRows, portionLen, rowsProcessed, extraBytes;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&comp_ctl, 1))
|
||||
return FALSE;
|
||||
|
||||
/* Flush zlib streams if we are told by the server to do so. */
|
||||
for (stream_id = 0; stream_id < 4; stream_id++) {
|
||||
if ((comp_ctl & 1) && client->zlibStreamActive[stream_id]) {
|
||||
if (inflateEnd (&client->zlibStream[stream_id]) != Z_OK &&
|
||||
client->zlibStream[stream_id].msg != NULL)
|
||||
rfbClientLog("inflateEnd: %s\n", client->zlibStream[stream_id].msg);
|
||||
client->zlibStreamActive[stream_id] = FALSE;
|
||||
}
|
||||
comp_ctl >>= 1;
|
||||
}
|
||||
|
||||
/* Handle solid rectangles. */
|
||||
if (comp_ctl == rfbTightFill) {
|
||||
#if BPP == 32
|
||||
if (client->format.depth == 24 && client->format.redMax == 0xFF &&
|
||||
client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) {
|
||||
if (!ReadFromRFBServer(client, client->buffer, 3))
|
||||
return FALSE;
|
||||
fill_colour = RGB24_TO_PIXEL32(client->buffer[0], client->buffer[1], client->buffer[2]);
|
||||
} else {
|
||||
if (!ReadFromRFBServer(client, (char*)&fill_colour, sizeof(fill_colour)))
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
if (!ReadFromRFBServer(client, (char*)&fill_colour, sizeof(fill_colour)))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
FillRectangle(client, rx, ry, rw, rh, fill_colour);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if BPP == 8
|
||||
if (comp_ctl == rfbTightJpeg) {
|
||||
rfbClientLog("Tight encoding: JPEG is not supported in 8 bpp mode.\n");
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
if (comp_ctl == rfbTightJpeg) {
|
||||
return DecompressJpegRectBPP(client, rx, ry, rw, rh);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Quit on unsupported subencoding value. */
|
||||
if (comp_ctl > rfbTightMaxSubencoding) {
|
||||
rfbClientLog("Tight encoding: bad subencoding value received.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here primary compression mode handling begins.
|
||||
* Data was processed with optional filter + zlib compression.
|
||||
*/
|
||||
|
||||
/* First, we should identify a filter to use. */
|
||||
if ((comp_ctl & rfbTightExplicitFilter) != 0) {
|
||||
if (!ReadFromRFBServer(client, (char*)&filter_id, 1))
|
||||
return FALSE;
|
||||
|
||||
switch (filter_id) {
|
||||
case rfbTightFilterCopy:
|
||||
filterFn = FilterCopyBPP;
|
||||
bitsPixel = InitFilterCopyBPP(client, rw, rh);
|
||||
break;
|
||||
case rfbTightFilterPalette:
|
||||
filterFn = FilterPaletteBPP;
|
||||
bitsPixel = InitFilterPaletteBPP(client, rw, rh);
|
||||
break;
|
||||
case rfbTightFilterGradient:
|
||||
filterFn = FilterGradientBPP;
|
||||
bitsPixel = InitFilterGradientBPP(client, rw, rh);
|
||||
break;
|
||||
default:
|
||||
rfbClientLog("Tight encoding: unknown filter code received.\n");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
filterFn = FilterCopyBPP;
|
||||
bitsPixel = InitFilterCopyBPP(client, rw, rh);
|
||||
}
|
||||
if (bitsPixel == 0) {
|
||||
rfbClientLog("Tight encoding: error receiving palette.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Determine if the data should be decompressed or just copied. */
|
||||
rowSize = (rw * bitsPixel + 7) / 8;
|
||||
if (rh * rowSize < TIGHT_MIN_TO_COMPRESS) {
|
||||
if (!ReadFromRFBServer(client, (char*)client->buffer, rh * rowSize))
|
||||
return FALSE;
|
||||
|
||||
buffer2 = &client->buffer[TIGHT_MIN_TO_COMPRESS * 4];
|
||||
filterFn(client, rh, (CARDBPP *)buffer2);
|
||||
|
||||
CopyRectangle(client, (uint8_t *)buffer2, rx, ry, rw, rh);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Read the length (1..3 bytes) of compressed data following. */
|
||||
compressedLen = (int)ReadCompactLen(client);
|
||||
if (compressedLen <= 0) {
|
||||
rfbClientLog("Incorrect data received from the server.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Now let's initialize compression stream if needed. */
|
||||
stream_id = comp_ctl & 0x03;
|
||||
zs = &client->zlibStream[stream_id];
|
||||
if (!client->zlibStreamActive[stream_id]) {
|
||||
zs->zalloc = Z_NULL;
|
||||
zs->zfree = Z_NULL;
|
||||
zs->opaque = Z_NULL;
|
||||
err = inflateInit(zs);
|
||||
if (err != Z_OK) {
|
||||
if (zs->msg != NULL)
|
||||
rfbClientLog("InflateInit error: %s.\n", zs->msg);
|
||||
return FALSE;
|
||||
}
|
||||
client->zlibStreamActive[stream_id] = TRUE;
|
||||
}
|
||||
|
||||
/* Read, decode and draw actual pixel data in a loop. */
|
||||
|
||||
bufferSize = RFB_BUFFER_SIZE * bitsPixel / (bitsPixel + BPP) & 0xFFFFFFFC;
|
||||
buffer2 = &client->buffer[bufferSize];
|
||||
if (rowSize > bufferSize) {
|
||||
/* Should be impossible when RFB_BUFFER_SIZE >= 16384 */
|
||||
rfbClientLog("Internal error: incorrect buffer size.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rowsProcessed = 0;
|
||||
extraBytes = 0;
|
||||
|
||||
while (compressedLen > 0) {
|
||||
if (compressedLen > ZLIB_BUFFER_SIZE)
|
||||
portionLen = ZLIB_BUFFER_SIZE;
|
||||
else
|
||||
portionLen = compressedLen;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char*)client->zlib_buffer, portionLen))
|
||||
return FALSE;
|
||||
|
||||
compressedLen -= portionLen;
|
||||
|
||||
zs->next_in = (Bytef *)client->zlib_buffer;
|
||||
zs->avail_in = portionLen;
|
||||
|
||||
do {
|
||||
zs->next_out = (Bytef *)&client->buffer[extraBytes];
|
||||
zs->avail_out = bufferSize - extraBytes;
|
||||
|
||||
err = inflate(zs, Z_SYNC_FLUSH);
|
||||
if (err == Z_BUF_ERROR) /* Input exhausted -- no problem. */
|
||||
break;
|
||||
if (err != Z_OK && err != Z_STREAM_END) {
|
||||
if (zs->msg != NULL) {
|
||||
rfbClientLog("Inflate error: %s.\n", zs->msg);
|
||||
} else {
|
||||
rfbClientLog("Inflate error: %d.\n", err);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
numRows = (bufferSize - zs->avail_out) / rowSize;
|
||||
|
||||
filterFn(client, numRows, (CARDBPP *)buffer2);
|
||||
|
||||
extraBytes = bufferSize - zs->avail_out - numRows * rowSize;
|
||||
if (extraBytes > 0)
|
||||
memcpy(client->buffer, &client->buffer[numRows * rowSize], extraBytes);
|
||||
|
||||
CopyRectangle(client, (uint8_t *)buffer2, rx, ry+rowsProcessed, rw, numRows);
|
||||
|
||||
rowsProcessed += numRows;
|
||||
}
|
||||
while (zs->avail_out == 0);
|
||||
}
|
||||
|
||||
if (rowsProcessed != rh) {
|
||||
rfbClientLog("Incorrect number of scan lines after decompression.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* Filter stuff.
|
||||
*
|
||||
*/
|
||||
|
||||
static int
|
||||
InitFilterCopyBPP (rfbClient* client, int rw, int rh)
|
||||
{
|
||||
client->rectWidth = rw;
|
||||
|
||||
#if BPP == 32
|
||||
if (client->format.depth == 24 && client->format.redMax == 0xFF &&
|
||||
client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) {
|
||||
client->cutZeros = TRUE;
|
||||
return 24;
|
||||
} else {
|
||||
client->cutZeros = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return BPP;
|
||||
}
|
||||
|
||||
static void
|
||||
FilterCopyBPP (rfbClient* client, int numRows, CARDBPP *dst)
|
||||
{
|
||||
|
||||
#if BPP == 32
|
||||
int x, y;
|
||||
|
||||
if (client->cutZeros) {
|
||||
for (y = 0; y < numRows; y++) {
|
||||
for (x = 0; x < client->rectWidth; x++) {
|
||||
dst[y*client->rectWidth+x] =
|
||||
RGB24_TO_PIXEL32(client->buffer[(y*client->rectWidth+x)*3],
|
||||
client->buffer[(y*client->rectWidth+x)*3+1],
|
||||
client->buffer[(y*client->rectWidth+x)*3+2]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy (dst, client->buffer, numRows * client->rectWidth * (BPP / 8));
|
||||
}
|
||||
|
||||
static int
|
||||
InitFilterGradientBPP (rfbClient* client, int rw, int rh)
|
||||
{
|
||||
int bits;
|
||||
|
||||
bits = InitFilterCopyBPP(client, rw, rh);
|
||||
if (client->cutZeros)
|
||||
memset(client->tightPrevRow, 0, rw * 3);
|
||||
else
|
||||
memset(client->tightPrevRow, 0, rw * 3 * sizeof(uint16_t));
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
||||
#if BPP == 32
|
||||
|
||||
static void
|
||||
FilterGradient24 (rfbClient* client, int numRows, uint32_t *dst)
|
||||
{
|
||||
int x, y, c;
|
||||
uint8_t thisRow[2048*3];
|
||||
uint8_t pix[3];
|
||||
int est[3];
|
||||
|
||||
for (y = 0; y < numRows; y++) {
|
||||
|
||||
/* First pixel in a row */
|
||||
for (c = 0; c < 3; c++) {
|
||||
pix[c] = client->tightPrevRow[c] + client->buffer[y*client->rectWidth*3+c];
|
||||
thisRow[c] = pix[c];
|
||||
}
|
||||
dst[y*client->rectWidth] = RGB24_TO_PIXEL32(pix[0], pix[1], pix[2]);
|
||||
|
||||
/* Remaining pixels of a row */
|
||||
for (x = 1; x < client->rectWidth; x++) {
|
||||
for (c = 0; c < 3; c++) {
|
||||
est[c] = (int)client->tightPrevRow[x*3+c] + (int)pix[c] -
|
||||
(int)client->tightPrevRow[(x-1)*3+c];
|
||||
if (est[c] > 0xFF) {
|
||||
est[c] = 0xFF;
|
||||
} else if (est[c] < 0x00) {
|
||||
est[c] = 0x00;
|
||||
}
|
||||
pix[c] = (uint8_t)est[c] + client->buffer[(y*client->rectWidth+x)*3+c];
|
||||
thisRow[x*3+c] = pix[c];
|
||||
}
|
||||
dst[y*client->rectWidth+x] = RGB24_TO_PIXEL32(pix[0], pix[1], pix[2]);
|
||||
}
|
||||
|
||||
memcpy(client->tightPrevRow, thisRow, client->rectWidth * 3);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
FilterGradientBPP (rfbClient* client, int numRows, CARDBPP *dst)
|
||||
{
|
||||
int x, y, c;
|
||||
CARDBPP *src = (CARDBPP *)client->buffer;
|
||||
uint16_t *thatRow = (uint16_t *)client->tightPrevRow;
|
||||
uint16_t thisRow[2048*3];
|
||||
uint16_t pix[3];
|
||||
uint16_t max[3];
|
||||
int shift[3];
|
||||
int est[3];
|
||||
|
||||
#if BPP == 32
|
||||
if (client->cutZeros) {
|
||||
FilterGradient24(client, numRows, dst);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
max[0] = client->format.redMax;
|
||||
max[1] = client->format.greenMax;
|
||||
max[2] = client->format.blueMax;
|
||||
|
||||
shift[0] = client->format.redShift;
|
||||
shift[1] = client->format.greenShift;
|
||||
shift[2] = client->format.blueShift;
|
||||
|
||||
for (y = 0; y < numRows; y++) {
|
||||
|
||||
/* First pixel in a row */
|
||||
for (c = 0; c < 3; c++) {
|
||||
pix[c] = (uint16_t)(((src[y*client->rectWidth] >> shift[c]) + thatRow[c]) & max[c]);
|
||||
thisRow[c] = pix[c];
|
||||
}
|
||||
dst[y*client->rectWidth] = RGB_TO_PIXEL(BPP, pix[0], pix[1], pix[2]);
|
||||
|
||||
/* Remaining pixels of a row */
|
||||
for (x = 1; x < client->rectWidth; x++) {
|
||||
for (c = 0; c < 3; c++) {
|
||||
est[c] = (int)thatRow[x*3+c] + (int)pix[c] - (int)thatRow[(x-1)*3+c];
|
||||
if (est[c] > (int)max[c]) {
|
||||
est[c] = (int)max[c];
|
||||
} else if (est[c] < 0) {
|
||||
est[c] = 0;
|
||||
}
|
||||
pix[c] = (uint16_t)(((src[y*client->rectWidth+x] >> shift[c]) + est[c]) & max[c]);
|
||||
thisRow[x*3+c] = pix[c];
|
||||
}
|
||||
dst[y*client->rectWidth+x] = RGB_TO_PIXEL(BPP, pix[0], pix[1], pix[2]);
|
||||
}
|
||||
memcpy(thatRow, thisRow, client->rectWidth * 3 * sizeof(uint16_t));
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
InitFilterPaletteBPP (rfbClient* client, int rw, int rh)
|
||||
{
|
||||
uint8_t numColors;
|
||||
#if BPP == 32
|
||||
int i;
|
||||
CARDBPP *palette = (CARDBPP *)client->tightPalette;
|
||||
#endif
|
||||
|
||||
client->rectWidth = rw;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char*)&numColors, 1))
|
||||
return 0;
|
||||
|
||||
client->rectColors = (int)numColors;
|
||||
if (++client->rectColors < 2)
|
||||
return 0;
|
||||
|
||||
#if BPP == 32
|
||||
if (client->format.depth == 24 && client->format.redMax == 0xFF &&
|
||||
client->format.greenMax == 0xFF && client->format.blueMax == 0xFF) {
|
||||
if (!ReadFromRFBServer(client, (char*)&client->tightPalette, client->rectColors * 3))
|
||||
return 0;
|
||||
for (i = client->rectColors - 1; i >= 0; i--) {
|
||||
palette[i] = RGB24_TO_PIXEL32(client->tightPalette[i*3],
|
||||
client->tightPalette[i*3+1],
|
||||
client->tightPalette[i*3+2]);
|
||||
}
|
||||
return (client->rectColors == 2) ? 1 : 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ReadFromRFBServer(client, (char*)&client->tightPalette, client->rectColors * (BPP / 8)))
|
||||
return 0;
|
||||
|
||||
return (client->rectColors == 2) ? 1 : 8;
|
||||
}
|
||||
|
||||
static void
|
||||
FilterPaletteBPP (rfbClient* client, int numRows, CARDBPP *dst)
|
||||
{
|
||||
int x, y, b, w;
|
||||
uint8_t *src = (uint8_t *)client->buffer;
|
||||
CARDBPP *palette = (CARDBPP *)client->tightPalette;
|
||||
|
||||
if (client->rectColors == 2) {
|
||||
w = (client->rectWidth + 7) / 8;
|
||||
for (y = 0; y < numRows; y++) {
|
||||
for (x = 0; x < client->rectWidth / 8; x++) {
|
||||
for (b = 7; b >= 0; b--)
|
||||
dst[y*client->rectWidth+x*8+7-b] = palette[src[y*w+x] >> b & 1];
|
||||
}
|
||||
for (b = 7; b >= 8 - client->rectWidth % 8; b--) {
|
||||
dst[y*client->rectWidth+x*8+7-b] = palette[src[y*w+x] >> b & 1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (y = 0; y < numRows; y++)
|
||||
for (x = 0; x < client->rectWidth; x++)
|
||||
dst[y*client->rectWidth+x] = palette[(int)src[y*client->rectWidth+x]];
|
||||
}
|
||||
}
|
||||
|
||||
#if BPP != 8
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* JPEG decompression.
|
||||
*
|
||||
*/
|
||||
|
||||
static rfbBool
|
||||
DecompressJpegRectBPP(rfbClient* client, int x, int y, int w, int h)
|
||||
{
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
int compressedLen;
|
||||
uint8_t *compressedData;
|
||||
CARDBPP *pixelPtr;
|
||||
JSAMPROW rowPointer[1];
|
||||
int dx, dy;
|
||||
|
||||
compressedLen = (int)ReadCompactLen(client);
|
||||
if (compressedLen <= 0) {
|
||||
rfbClientLog("Incorrect data received from the server.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
compressedData = malloc(compressedLen);
|
||||
if (compressedData == NULL) {
|
||||
rfbClientLog("Memory allocation error.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReadFromRFBServer(client, (char*)compressedData, compressedLen)) {
|
||||
free(compressedData);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
cinfo.client_data = client;
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
JpegSetSrcManager(&cinfo, compressedData, compressedLen);
|
||||
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
|
||||
jpeg_start_decompress(&cinfo);
|
||||
if (cinfo.output_width != w || cinfo.output_height != h ||
|
||||
cinfo.output_components != 3) {
|
||||
rfbClientLog("Tight Encoding: Wrong JPEG data received.\n");
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
free(compressedData);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rowPointer[0] = (JSAMPROW)client->buffer;
|
||||
dy = 0;
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
jpeg_read_scanlines(&cinfo, rowPointer, 1);
|
||||
if (client->jpegError) {
|
||||
break;
|
||||
}
|
||||
pixelPtr = (CARDBPP *)&client->buffer[RFB_BUFFER_SIZE / 2];
|
||||
for (dx = 0; dx < w; dx++) {
|
||||
*pixelPtr++ =
|
||||
RGB24_TO_PIXEL(BPP, client->buffer[dx*3], client->buffer[dx*3+1], client->buffer[dx*3+2]);
|
||||
}
|
||||
CopyRectangle(client, (uint8_t *)&client->buffer[RFB_BUFFER_SIZE / 2], x, y + dy, w, 1);
|
||||
dy++;
|
||||
}
|
||||
|
||||
if (!client->jpegError)
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
free(compressedData);
|
||||
|
||||
return !client->jpegError;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static long
|
||||
ReadCompactLen (rfbClient* client)
|
||||
{
|
||||
long len;
|
||||
uint8_t b;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&b, 1))
|
||||
return -1;
|
||||
len = (int)b & 0x7F;
|
||||
if (b & 0x80) {
|
||||
if (!ReadFromRFBServer(client, (char *)&b, 1))
|
||||
return -1;
|
||||
len |= ((int)b & 0x7F) << 7;
|
||||
if (b & 0x80) {
|
||||
if (!ReadFromRFBServer(client, (char *)&b, 1))
|
||||
return -1;
|
||||
len |= ((int)b & 0xFF) << 14;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* JPEG source manager functions for JPEG decompression in Tight decoder.
|
||||
*/
|
||||
|
||||
static void
|
||||
JpegInitSource(j_decompress_ptr cinfo)
|
||||
{
|
||||
rfbClient* client=(rfbClient*)cinfo->client_data;
|
||||
client->jpegError = FALSE;
|
||||
}
|
||||
|
||||
static boolean
|
||||
JpegFillInputBuffer(j_decompress_ptr cinfo)
|
||||
{
|
||||
rfbClient* client=(rfbClient*)cinfo->client_data;
|
||||
client->jpegError = TRUE;
|
||||
client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen;
|
||||
client->jpegSrcManager->next_input_byte = (JOCTET *)client->jpegBufferPtr;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
rfbClient* client=(rfbClient*)cinfo->client_data;
|
||||
if (num_bytes < 0 || num_bytes > client->jpegSrcManager->bytes_in_buffer) {
|
||||
client->jpegError = TRUE;
|
||||
client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen;
|
||||
client->jpegSrcManager->next_input_byte = (JOCTET *)client->jpegBufferPtr;
|
||||
} else {
|
||||
client->jpegSrcManager->next_input_byte += (size_t) num_bytes;
|
||||
client->jpegSrcManager->bytes_in_buffer -= (size_t) num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
JpegTermSource(j_decompress_ptr cinfo)
|
||||
{
|
||||
/* nothing to do here. */
|
||||
}
|
||||
|
||||
static void
|
||||
JpegSetSrcManager(j_decompress_ptr cinfo,
|
||||
uint8_t *compressedData,
|
||||
int compressedLen)
|
||||
{
|
||||
rfbClient* client=(rfbClient*)cinfo->client_data;
|
||||
client->jpegBufferPtr = compressedData;
|
||||
client->jpegBufferLen = (size_t)compressedLen;
|
||||
|
||||
if(client->jpegSrcManager == NULL)
|
||||
client->jpegSrcManager = malloc(sizeof(struct jpeg_source_mgr));
|
||||
client->jpegSrcManager->init_source = JpegInitSource;
|
||||
client->jpegSrcManager->fill_input_buffer = JpegFillInputBuffer;
|
||||
client->jpegSrcManager->skip_input_data = JpegSkipInputData;
|
||||
client->jpegSrcManager->resync_to_restart = jpeg_resync_to_restart;
|
||||
client->jpegSrcManager->term_source = JpegTermSource;
|
||||
client->jpegSrcManager->next_input_byte = (JOCTET*)client->jpegBufferPtr;
|
||||
client->jpegSrcManager->bytes_in_buffer = client->jpegBufferLen;
|
||||
|
||||
cinfo->src = client->jpegSrcManager;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#undef CARDBPP
|
||||
|
||||
/* LIBVNCSERVER_HAVE_LIBZ and LIBVNCSERVER_HAVE_LIBJPEG */
|
||||
#endif
|
||||
#endif
|
||||
|
51
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls.h
Normal file
51
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef TLS_H
|
||||
#define TLS_H
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Vic Lee.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/* Handle Anonymous TLS Authentication (18) with the server.
|
||||
* After authentication, client->tlsSession will be set.
|
||||
*/
|
||||
rfbBool HandleAnonTLSAuth(rfbClient* client);
|
||||
|
||||
/* Handle VeNCrypt Authentication (19) with the server.
|
||||
* The callback function GetX509Credential will be called.
|
||||
* After authentication, client->tlsSession will be set.
|
||||
*/
|
||||
rfbBool HandleVeNCryptAuth(rfbClient* client);
|
||||
|
||||
/* Read desired bytes from TLS session.
|
||||
* It's a wrapper function over gnutls_record_recv() and return values
|
||||
* are same as read(), that is, >0 for actual bytes read, 0 for EOF,
|
||||
* or EAGAIN, EINTR.
|
||||
* This should be a non-blocking call. Blocking is handled in sockets.c.
|
||||
*/
|
||||
int ReadFromTLS(rfbClient* client, char *out, unsigned int n);
|
||||
|
||||
/* Write desired bytes to TLS session.
|
||||
* It's a wrapper function over gnutls_record_send() and it will be
|
||||
* blocking call, until all bytes are written or error returned.
|
||||
*/
|
||||
int WriteToTLS(rfbClient* client, char *buf, unsigned int n);
|
||||
|
||||
/* Free TLS resources */
|
||||
void FreeTLS(rfbClient* client);
|
||||
|
||||
#endif /* TLS_H */
|
505
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_gnutls.c
Normal file
505
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_gnutls.c
Normal file
@ -0,0 +1,505 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Vic Lee.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
#include <errno.h>
|
||||
#ifdef WIN32
|
||||
#undef SOCKET
|
||||
#include <windows.h> /* for Sleep() */
|
||||
#define sleep(X) Sleep(1000*X) /* MinGW32 has no sleep() */
|
||||
#include <winsock2.h>
|
||||
#define read(sock,buf,len) recv(sock,buf,len,0)
|
||||
#define write(sock,buf,len) send(sock,buf,len,0)
|
||||
#endif
|
||||
#include "tls.h"
|
||||
|
||||
|
||||
static const char *rfbTLSPriority = "NORMAL:+DHE-DSS:+RSA:+DHE-RSA:+SRP";
|
||||
static const char *rfbAnonTLSPriority= "NORMAL:+ANON-DH";
|
||||
|
||||
#define DH_BITS 1024
|
||||
static gnutls_dh_params_t rfbDHParams;
|
||||
|
||||
static rfbBool rfbTLSInitialized = FALSE;
|
||||
|
||||
static rfbBool
|
||||
InitializeTLS(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (rfbTLSInitialized) return TRUE;
|
||||
if ((ret = gnutls_global_init()) < 0 ||
|
||||
(ret = gnutls_dh_params_init(&rfbDHParams)) < 0 ||
|
||||
(ret = gnutls_dh_params_generate2(rfbDHParams, DH_BITS)) < 0)
|
||||
{
|
||||
rfbClientLog("Failed to initialized GnuTLS: %s.\n", gnutls_strerror(ret));
|
||||
return FALSE;
|
||||
}
|
||||
rfbClientLog("GnuTLS initialized.\n");
|
||||
rfbTLSInitialized = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* On Windows, translate WSAGetLastError() to errno values as GNU TLS does it
|
||||
* internally too. This is necessary because send() and recv() on Windows
|
||||
* don't set errno when they fail but GNUTLS expects a proper errno value.
|
||||
*
|
||||
* Use gnutls_transport_set_global_errno() like the GNU TLS documentation
|
||||
* suggests to avoid problems with different errno variables when GNU TLS and
|
||||
* libvncclient are linked to different versions of msvcrt.dll.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
static void WSAtoTLSErrno()
|
||||
{
|
||||
switch(WSAGetLastError()) {
|
||||
case WSAEWOULDBLOCK:
|
||||
gnutls_transport_set_global_errno(EAGAIN);
|
||||
break;
|
||||
case WSAEINTR:
|
||||
gnutls_transport_set_global_errno(EINTR);
|
||||
break;
|
||||
default:
|
||||
gnutls_transport_set_global_errno(EIO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static ssize_t
|
||||
PushTLS(gnutls_transport_ptr_t transport, const void *data, size_t len)
|
||||
{
|
||||
rfbClient *client = (rfbClient*)transport;
|
||||
int ret;
|
||||
|
||||
while (1)
|
||||
{
|
||||
ret = write(client->sock, data, len);
|
||||
if (ret < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
WSAtoTLSErrno();
|
||||
#endif
|
||||
if (errno == EINTR) continue;
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
PullTLS(gnutls_transport_ptr_t transport, void *data, size_t len)
|
||||
{
|
||||
rfbClient *client = (rfbClient*)transport;
|
||||
int ret;
|
||||
|
||||
while (1)
|
||||
{
|
||||
ret = read(client->sock, data, len);
|
||||
if (ret < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
WSAtoTLSErrno();
|
||||
#endif
|
||||
if (errno == EINTR) continue;
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
InitializeTLSSession(rfbClient* client, rfbBool anonTLS)
|
||||
{
|
||||
int ret;
|
||||
const char *p;
|
||||
|
||||
if (client->tlsSession) return TRUE;
|
||||
|
||||
if ((ret = gnutls_init((gnutls_session_t*)&client->tlsSession, GNUTLS_CLIENT)) < 0)
|
||||
{
|
||||
rfbClientLog("Failed to initialized TLS session: %s.\n", gnutls_strerror(ret));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((ret = gnutls_priority_set_direct((gnutls_session_t)client->tlsSession,
|
||||
anonTLS ? rfbAnonTLSPriority : rfbTLSPriority, &p)) < 0)
|
||||
{
|
||||
rfbClientLog("Warning: Failed to set TLS priority: %s (%s).\n", gnutls_strerror(ret), p);
|
||||
}
|
||||
|
||||
gnutls_transport_set_ptr((gnutls_session_t)client->tlsSession, (gnutls_transport_ptr_t)client);
|
||||
gnutls_transport_set_push_function((gnutls_session_t)client->tlsSession, PushTLS);
|
||||
gnutls_transport_set_pull_function((gnutls_session_t)client->tlsSession, PullTLS);
|
||||
|
||||
rfbClientLog("TLS session initialized.\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
SetTLSAnonCredential(rfbClient* client)
|
||||
{
|
||||
gnutls_anon_client_credentials anonCred;
|
||||
int ret;
|
||||
|
||||
if ((ret = gnutls_anon_allocate_client_credentials(&anonCred)) < 0 ||
|
||||
(ret = gnutls_credentials_set((gnutls_session_t)client->tlsSession, GNUTLS_CRD_ANON, anonCred)) < 0)
|
||||
{
|
||||
FreeTLS(client);
|
||||
rfbClientLog("Failed to create anonymous credentials: %s", gnutls_strerror(ret));
|
||||
return FALSE;
|
||||
}
|
||||
rfbClientLog("TLS anonymous credential created.\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
HandshakeTLS(rfbClient* client)
|
||||
{
|
||||
int timeout = 15;
|
||||
int ret;
|
||||
|
||||
while (timeout > 0 && (ret = gnutls_handshake((gnutls_session_t)client->tlsSession)) < 0)
|
||||
{
|
||||
if (!gnutls_error_is_fatal(ret))
|
||||
{
|
||||
rfbClientLog("TLS handshake blocking.\n");
|
||||
sleep(1);
|
||||
timeout--;
|
||||
continue;
|
||||
}
|
||||
rfbClientLog("TLS handshake failed: %s.\n", gnutls_strerror(ret));
|
||||
FreeTLS(client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (timeout <= 0)
|
||||
{
|
||||
rfbClientLog("TLS handshake timeout.\n");
|
||||
FreeTLS(client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rfbClientLog("TLS handshake done.\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* VeNCrypt sub auth. 1 byte auth count, followed by count * 4 byte integers */
|
||||
static rfbBool
|
||||
ReadVeNCryptSecurityType(rfbClient* client, uint32_t *result)
|
||||
{
|
||||
uint8_t count=0;
|
||||
uint8_t loop=0;
|
||||
uint8_t flag=0;
|
||||
uint32_t tAuth[256], t;
|
||||
char buf1[500],buf2[10];
|
||||
uint32_t authScheme;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&count, 1)) return FALSE;
|
||||
|
||||
if (count==0)
|
||||
{
|
||||
rfbClientLog("List of security types is ZERO. Giving up.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count>sizeof(tAuth))
|
||||
{
|
||||
rfbClientLog("%d security types are too many; maximum is %d\n", count, sizeof(tAuth));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rfbClientLog("We have %d security types to read\n", count);
|
||||
authScheme=0;
|
||||
/* now, we have a list of available security types to read ( uint8_t[] ) */
|
||||
for (loop=0;loop<count;loop++)
|
||||
{
|
||||
if (!ReadFromRFBServer(client, (char *)&tAuth[loop], 4)) return FALSE;
|
||||
t=rfbClientSwap32IfLE(tAuth[loop]);
|
||||
rfbClientLog("%d) Received security type %d\n", loop, t);
|
||||
if (flag) continue;
|
||||
if (t==rfbVeNCryptTLSNone ||
|
||||
t==rfbVeNCryptTLSVNC ||
|
||||
t==rfbVeNCryptTLSPlain ||
|
||||
t==rfbVeNCryptX509None ||
|
||||
t==rfbVeNCryptX509VNC ||
|
||||
t==rfbVeNCryptX509Plain)
|
||||
{
|
||||
flag++;
|
||||
authScheme=t;
|
||||
rfbClientLog("Selecting security type %d (%d/%d in the list)\n", authScheme, loop, count);
|
||||
/* send back 4 bytes (in original byte order!) indicating which security type to use */
|
||||
if (!WriteToRFBServer(client, (char *)&tAuth[loop], 4)) return FALSE;
|
||||
}
|
||||
tAuth[loop]=t;
|
||||
}
|
||||
if (authScheme==0)
|
||||
{
|
||||
memset(buf1, 0, sizeof(buf1));
|
||||
for (loop=0;loop<count;loop++)
|
||||
{
|
||||
if (strlen(buf1)>=sizeof(buf1)-1) break;
|
||||
snprintf(buf2, sizeof(buf2), (loop>0 ? ", %d" : "%d"), (int)tAuth[loop]);
|
||||
strncat(buf1, buf2, sizeof(buf1)-strlen(buf1)-1);
|
||||
}
|
||||
rfbClientLog("Unknown VeNCrypt authentication scheme from VNC server: %s\n",
|
||||
buf1);
|
||||
return FALSE;
|
||||
}
|
||||
*result = authScheme;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
FreeX509Credential(rfbCredential *cred)
|
||||
{
|
||||
if (cred->x509Credential.x509CACertFile) free(cred->x509Credential.x509CACertFile);
|
||||
if (cred->x509Credential.x509CACrlFile) free(cred->x509Credential.x509CACrlFile);
|
||||
if (cred->x509Credential.x509ClientCertFile) free(cred->x509Credential.x509ClientCertFile);
|
||||
if (cred->x509Credential.x509ClientKeyFile) free(cred->x509Credential.x509ClientKeyFile);
|
||||
free(cred);
|
||||
}
|
||||
|
||||
static gnutls_certificate_credentials_t
|
||||
CreateX509CertCredential(rfbCredential *cred)
|
||||
{
|
||||
gnutls_certificate_credentials_t x509_cred;
|
||||
int ret;
|
||||
|
||||
if (!cred->x509Credential.x509CACertFile)
|
||||
{
|
||||
rfbClientLog("No CA certificate provided.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((ret = gnutls_certificate_allocate_credentials(&x509_cred)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot allocate credentials: %s.\n", gnutls_strerror(ret));
|
||||
return NULL;
|
||||
}
|
||||
if ((ret = gnutls_certificate_set_x509_trust_file(x509_cred,
|
||||
cred->x509Credential.x509CACertFile, GNUTLS_X509_FMT_PEM)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot load CA credentials: %s.\n", gnutls_strerror(ret));
|
||||
gnutls_certificate_free_credentials (x509_cred);
|
||||
return NULL;
|
||||
}
|
||||
if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)
|
||||
{
|
||||
if ((ret = gnutls_certificate_set_x509_key_file(x509_cred,
|
||||
cred->x509Credential.x509ClientCertFile, cred->x509Credential.x509ClientKeyFile,
|
||||
GNUTLS_X509_FMT_PEM)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot load client certificate or key: %s.\n", gnutls_strerror(ret));
|
||||
gnutls_certificate_free_credentials (x509_cred);
|
||||
return NULL;
|
||||
}
|
||||
} else
|
||||
{
|
||||
rfbClientLog("No client certificate or key provided.\n");
|
||||
}
|
||||
if (cred->x509Credential.x509CACrlFile)
|
||||
{
|
||||
if ((ret = gnutls_certificate_set_x509_crl_file(x509_cred,
|
||||
cred->x509Credential.x509CACrlFile, GNUTLS_X509_FMT_PEM)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot load CRL: %s.\n", gnutls_strerror(ret));
|
||||
gnutls_certificate_free_credentials (x509_cred);
|
||||
return NULL;
|
||||
}
|
||||
} else
|
||||
{
|
||||
rfbClientLog("No CRL provided.\n");
|
||||
}
|
||||
gnutls_certificate_set_dh_params (x509_cred, rfbDHParams);
|
||||
return x509_cred;
|
||||
}
|
||||
|
||||
|
||||
rfbBool
|
||||
HandleAnonTLSAuth(rfbClient* client)
|
||||
{
|
||||
if (!InitializeTLS() || !InitializeTLSSession(client, TRUE)) return FALSE;
|
||||
|
||||
if (!SetTLSAnonCredential(client)) return FALSE;
|
||||
|
||||
if (!HandshakeTLS(client)) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
HandleVeNCryptAuth(rfbClient* client)
|
||||
{
|
||||
uint8_t major, minor, status;
|
||||
uint32_t authScheme;
|
||||
rfbBool anonTLS;
|
||||
gnutls_certificate_credentials_t x509_cred = NULL;
|
||||
int ret;
|
||||
|
||||
if (!InitializeTLS()) return FALSE;
|
||||
|
||||
/* Read VeNCrypt version */
|
||||
if (!ReadFromRFBServer(client, (char *)&major, 1) ||
|
||||
!ReadFromRFBServer(client, (char *)&minor, 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
rfbClientLog("Got VeNCrypt version %d.%d from server.\n", (int)major, (int)minor);
|
||||
|
||||
if (major != 0 && minor != 2)
|
||||
{
|
||||
rfbClientLog("Unsupported VeNCrypt version.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!WriteToRFBServer(client, (char *)&major, 1) ||
|
||||
!WriteToRFBServer(client, (char *)&minor, 1) ||
|
||||
!ReadFromRFBServer(client, (char *)&status, 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
rfbClientLog("Server refused VeNCrypt version %d.%d.\n", (int)major, (int)minor);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReadVeNCryptSecurityType(client, &authScheme)) return FALSE;
|
||||
if (!ReadFromRFBServer(client, (char *)&status, 1) || status != 1)
|
||||
{
|
||||
rfbClientLog("Server refused VeNCrypt authentication %d (%d).\n", authScheme, (int)status);
|
||||
return FALSE;
|
||||
}
|
||||
client->subAuthScheme = authScheme;
|
||||
|
||||
/* Some VeNCrypt security types are anonymous TLS, others are X509 */
|
||||
switch (authScheme)
|
||||
{
|
||||
case rfbVeNCryptTLSNone:
|
||||
case rfbVeNCryptTLSVNC:
|
||||
case rfbVeNCryptTLSPlain:
|
||||
anonTLS = TRUE;
|
||||
break;
|
||||
default:
|
||||
anonTLS = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get X509 Credentials if it's not anonymous */
|
||||
if (!anonTLS)
|
||||
{
|
||||
rfbCredential *cred;
|
||||
|
||||
if (!client->GetCredential)
|
||||
{
|
||||
rfbClientLog("GetCredential callback is not set.\n");
|
||||
return FALSE;
|
||||
}
|
||||
cred = client->GetCredential(client, rfbCredentialTypeX509);
|
||||
if (!cred)
|
||||
{
|
||||
rfbClientLog("Reading credential failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
x509_cred = CreateX509CertCredential(cred);
|
||||
FreeX509Credential(cred);
|
||||
if (!x509_cred) return FALSE;
|
||||
}
|
||||
|
||||
/* Start up the TLS session */
|
||||
if (!InitializeTLSSession(client, anonTLS)) return FALSE;
|
||||
|
||||
if (anonTLS)
|
||||
{
|
||||
if (!SetTLSAnonCredential(client)) return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ret = gnutls_credentials_set((gnutls_session_t)client->tlsSession, GNUTLS_CRD_CERTIFICATE, x509_cred)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot set x509 credential: %s.\n", gnutls_strerror(ret));
|
||||
FreeTLS(client);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!HandshakeTLS(client)) return FALSE;
|
||||
|
||||
/* TODO: validate certificate */
|
||||
|
||||
/* We are done here. The caller should continue with client->subAuthScheme
|
||||
* to do actual sub authentication.
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ReadFromTLS(rfbClient* client, char *out, unsigned int n)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = gnutls_record_recv((gnutls_session_t)client->tlsSession, out, n);
|
||||
if (ret >= 0) return ret;
|
||||
if (ret == GNUTLS_E_REHANDSHAKE || ret == GNUTLS_E_AGAIN)
|
||||
{
|
||||
errno = EAGAIN;
|
||||
} else
|
||||
{
|
||||
rfbClientLog("Error reading from TLS: %s.\n", gnutls_strerror(ret));
|
||||
errno = EINTR;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
WriteToTLS(rfbClient* client, char *buf, unsigned int n)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
ssize_t ret;
|
||||
|
||||
while (offset < n)
|
||||
{
|
||||
ret = gnutls_record_send((gnutls_session_t)client->tlsSession, buf+offset, (size_t)(n-offset));
|
||||
if (ret == 0) continue;
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) continue;
|
||||
rfbClientLog("Error writing to TLS: %s.\n", gnutls_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
offset += (unsigned int)ret;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
void FreeTLS(rfbClient* client)
|
||||
{
|
||||
if (client->tlsSession)
|
||||
{
|
||||
gnutls_deinit((gnutls_session_t)client->tlsSession);
|
||||
client->tlsSession = NULL;
|
||||
}
|
||||
}
|
58
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_none.c
Normal file
58
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_none.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Christian Beier.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfbclient.h>
|
||||
#include <errno.h>
|
||||
#include "tls.h"
|
||||
|
||||
rfbBool HandleAnonTLSAuth(rfbClient* client)
|
||||
{
|
||||
rfbClientLog("TLS is not supported.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
rfbBool HandleVeNCryptAuth(rfbClient* client)
|
||||
{
|
||||
rfbClientLog("TLS is not supported.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int ReadFromTLS(rfbClient* client, char *out, unsigned int n)
|
||||
{
|
||||
rfbClientLog("TLS is not supported.\n");
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int WriteToTLS(rfbClient* client, char *buf, unsigned int n)
|
||||
{
|
||||
rfbClientLog("TLS is not supported.\n");
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void FreeTLS(rfbClient* client)
|
||||
{
|
||||
|
||||
}
|
||||
|
587
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_openssl.c
Normal file
587
jni/vnc/LibVNCServer-0.9.9/libvncclient/tls_openssl.c
Normal file
@ -0,0 +1,587 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Philip Van Hoof <philip@codeminded.be>
|
||||
* Copyright (C) 2009 Vic Lee.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfbclient.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "tls.h"
|
||||
|
||||
static rfbBool rfbTLSInitialized = FALSE;
|
||||
static pthread_mutex_t *mutex_buf = NULL;
|
||||
|
||||
struct CRYPTO_dynlock_value {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
static void locking_function(int mode, int n, const char *file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock(&mutex_buf[n]);
|
||||
else
|
||||
pthread_mutex_unlock(&mutex_buf[n]);
|
||||
}
|
||||
|
||||
static unsigned long id_function(void)
|
||||
{
|
||||
return ((unsigned long) pthread_self());
|
||||
}
|
||||
|
||||
static struct CRYPTO_dynlock_value *dyn_create_function(const char *file, int line)
|
||||
{
|
||||
struct CRYPTO_dynlock_value *value;
|
||||
|
||||
value = (struct CRYPTO_dynlock_value *)
|
||||
malloc(sizeof(struct CRYPTO_dynlock_value));
|
||||
if (!value)
|
||||
goto err;
|
||||
pthread_mutex_init(&value->mutex, NULL);
|
||||
|
||||
return value;
|
||||
|
||||
err:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static void dyn_lock_function (int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock(&l->mutex);
|
||||
else
|
||||
pthread_mutex_unlock(&l->mutex);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dyn_destroy_function(struct CRYPTO_dynlock_value *l, const char *file, int line)
|
||||
{
|
||||
pthread_mutex_destroy(&l->mutex);
|
||||
free(l);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ssl_errno (SSL *ssl, int ret)
|
||||
{
|
||||
switch (SSL_get_error (ssl, ret)) {
|
||||
case SSL_ERROR_NONE:
|
||||
return 0;
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
/* this one does not map well at all */
|
||||
//d(printf ("ssl_errno: SSL_ERROR_ZERO_RETURN\n"));
|
||||
return EINVAL;
|
||||
case SSL_ERROR_WANT_READ: /* non-fatal; retry */
|
||||
case SSL_ERROR_WANT_WRITE: /* non-fatal; retry */
|
||||
//d(printf ("ssl_errno: SSL_ERROR_WANT_[READ,WRITE]\n"));
|
||||
return EAGAIN;
|
||||
case SSL_ERROR_SYSCALL:
|
||||
//d(printf ("ssl_errno: SSL_ERROR_SYSCALL\n"));
|
||||
return EINTR;
|
||||
case SSL_ERROR_SSL:
|
||||
//d(printf ("ssl_errno: SSL_ERROR_SSL <-- very useful error...riiiiight\n"));
|
||||
return EINTR;
|
||||
default:
|
||||
//d(printf ("ssl_errno: default error\n"));
|
||||
return EINTR;
|
||||
}
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
InitializeTLS(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (rfbTLSInitialized) return TRUE;
|
||||
|
||||
mutex_buf = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
|
||||
if (mutex_buf == NULL) {
|
||||
rfbClientLog("Failed to initialized OpenSSL: memory.\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++)
|
||||
pthread_mutex_init(&mutex_buf[i], NULL);
|
||||
|
||||
CRYPTO_set_locking_callback(locking_function);
|
||||
CRYPTO_set_id_callback(id_function);
|
||||
CRYPTO_set_dynlock_create_callback(dyn_create_function);
|
||||
CRYPTO_set_dynlock_lock_callback(dyn_lock_function);
|
||||
CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function);
|
||||
SSL_load_error_strings();
|
||||
SSLeay_add_ssl_algorithms();
|
||||
RAND_load_file("/dev/urandom", 1024);
|
||||
|
||||
rfbClientLog("OpenSSL initialized.\n");
|
||||
rfbTLSInitialized = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
ssl_verify (int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
unsigned char md5sum[16], fingerprint[40], *f;
|
||||
rfbClient *client;
|
||||
char *prompt, *cert_str;
|
||||
int err, i;
|
||||
unsigned int md5len;
|
||||
//char buf[257];
|
||||
X509 *cert;
|
||||
SSL *ssl;
|
||||
|
||||
if (ok)
|
||||
return TRUE;
|
||||
|
||||
ssl = X509_STORE_CTX_get_ex_data (ctx, SSL_get_ex_data_X509_STORE_CTX_idx ());
|
||||
|
||||
client = SSL_CTX_get_app_data (ssl->ctx);
|
||||
|
||||
cert = X509_STORE_CTX_get_current_cert (ctx);
|
||||
err = X509_STORE_CTX_get_error (ctx);
|
||||
|
||||
/* calculate the MD5 hash of the raw certificate */
|
||||
md5len = sizeof (md5sum);
|
||||
X509_digest (cert, EVP_md5 (), md5sum, &md5len);
|
||||
for (i = 0, f = fingerprint; i < 16; i++, f += 3)
|
||||
sprintf ((char *) f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
|
||||
|
||||
#define GET_STRING(name) X509_NAME_oneline (name, buf, 256)
|
||||
|
||||
/* TODO: Don't just ignore certificate checks
|
||||
|
||||
fingerprint = key to check in db
|
||||
|
||||
GET_STRING (X509_get_issuer_name (cert));
|
||||
GET_STRING (X509_get_subject_name (cert));
|
||||
cert->valid (bool: GOOD or BAD) */
|
||||
|
||||
ok = TRUE;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int sock_read_ready(SSL *ssl, uint32_t ms)
|
||||
{
|
||||
int r = 0;
|
||||
fd_set fds;
|
||||
struct timeval tv;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
|
||||
FD_SET(SSL_get_fd(ssl), &fds);
|
||||
|
||||
tv.tv_sec = ms / 1000;
|
||||
tv.tv_usec = (ms % 1000) * ms;
|
||||
|
||||
r = select (SSL_get_fd(ssl) + 1, &fds, NULL, NULL, &tv);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int wait_for_data(SSL *ssl, int ret, int timeout)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set fds;
|
||||
int err;
|
||||
int retval = 1;
|
||||
|
||||
err = SSL_get_error(ssl, ret);
|
||||
|
||||
switch(err)
|
||||
{
|
||||
case SSL_ERROR_WANT_READ:
|
||||
case SSL_ERROR_WANT_WRITE:
|
||||
ret = sock_read_ready(ssl, timeout*1000);
|
||||
|
||||
if (ret == -1) {
|
||||
retval = 2;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
retval = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
ERR_clear_error();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static SSL *
|
||||
open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS)
|
||||
{
|
||||
SSL_CTX *ssl_ctx = NULL;
|
||||
SSL *ssl = NULL;
|
||||
int n, finished = 0;
|
||||
BIO *sbio;
|
||||
|
||||
ssl_ctx = SSL_CTX_new (SSLv23_client_method ());
|
||||
SSL_CTX_set_default_verify_paths (ssl_ctx);
|
||||
SSL_CTX_set_verify (ssl_ctx, SSL_VERIFY_NONE, &ssl_verify);
|
||||
ssl = SSL_new (ssl_ctx);
|
||||
|
||||
/* TODO: finetune this list, take into account anonTLS bool */
|
||||
SSL_set_cipher_list(ssl, "ALL");
|
||||
|
||||
SSL_set_fd (ssl, sockfd);
|
||||
SSL_CTX_set_app_data (ssl_ctx, client);
|
||||
|
||||
do
|
||||
{
|
||||
n = SSL_connect(ssl);
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
if (wait_for_data(ssl, n, 1) != 1)
|
||||
{
|
||||
finished = 1;
|
||||
if (ssl->ctx)
|
||||
SSL_CTX_free (ssl->ctx);
|
||||
SSL_free(ssl);
|
||||
SSL_shutdown (ssl);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} while( n != 1 && finished != 1 );
|
||||
|
||||
return ssl;
|
||||
}
|
||||
|
||||
|
||||
static rfbBool
|
||||
InitializeTLSSession(rfbClient* client, rfbBool anonTLS)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (client->tlsSession) return TRUE;
|
||||
|
||||
client->tlsSession = open_ssl_connection (client, client->sock, anonTLS);
|
||||
|
||||
if (!client->tlsSession)
|
||||
return FALSE;
|
||||
|
||||
rfbClientLog("TLS session initialized.\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
SetTLSAnonCredential(rfbClient* client)
|
||||
{
|
||||
rfbClientLog("TLS anonymous credential created.\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
HandshakeTLS(rfbClient* client)
|
||||
{
|
||||
int timeout = 15;
|
||||
int ret;
|
||||
|
||||
return TRUE;
|
||||
|
||||
while (timeout > 0 && (ret = SSL_do_handshake(client->tlsSession)) < 0)
|
||||
{
|
||||
if (ret != -1)
|
||||
{
|
||||
rfbClientLog("TLS handshake blocking.\n");
|
||||
sleep(1);
|
||||
timeout--;
|
||||
continue;
|
||||
}
|
||||
rfbClientLog("TLS handshake failed: -.\n");
|
||||
FreeTLS(client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (timeout <= 0)
|
||||
{
|
||||
rfbClientLog("TLS handshake timeout.\n");
|
||||
FreeTLS(client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rfbClientLog("TLS handshake done.\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* VeNCrypt sub auth. 1 byte auth count, followed by count * 4 byte integers */
|
||||
static rfbBool
|
||||
ReadVeNCryptSecurityType(rfbClient* client, uint32_t *result)
|
||||
{
|
||||
uint8_t count=0;
|
||||
uint8_t loop=0;
|
||||
uint8_t flag=0;
|
||||
uint32_t tAuth[256], t;
|
||||
char buf1[500],buf2[10];
|
||||
uint32_t authScheme;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&count, 1)) return FALSE;
|
||||
|
||||
if (count==0)
|
||||
{
|
||||
rfbClientLog("List of security types is ZERO. Giving up.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count>sizeof(tAuth))
|
||||
{
|
||||
rfbClientLog("%d security types are too many; maximum is %d\n", count, sizeof(tAuth));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rfbClientLog("We have %d security types to read\n", count);
|
||||
authScheme=0;
|
||||
/* now, we have a list of available security types to read ( uint8_t[] ) */
|
||||
for (loop=0;loop<count;loop++)
|
||||
{
|
||||
if (!ReadFromRFBServer(client, (char *)&tAuth[loop], 4)) return FALSE;
|
||||
t=rfbClientSwap32IfLE(tAuth[loop]);
|
||||
rfbClientLog("%d) Received security type %d\n", loop, t);
|
||||
if (flag) continue;
|
||||
if (t==rfbVeNCryptTLSNone ||
|
||||
t==rfbVeNCryptTLSVNC ||
|
||||
t==rfbVeNCryptTLSPlain ||
|
||||
t==rfbVeNCryptX509None ||
|
||||
t==rfbVeNCryptX509VNC ||
|
||||
t==rfbVeNCryptX509Plain)
|
||||
{
|
||||
flag++;
|
||||
authScheme=t;
|
||||
rfbClientLog("Selecting security type %d (%d/%d in the list)\n", authScheme, loop, count);
|
||||
/* send back 4 bytes (in original byte order!) indicating which security type to use */
|
||||
if (!WriteToRFBServer(client, (char *)&tAuth[loop], 4)) return FALSE;
|
||||
}
|
||||
tAuth[loop]=t;
|
||||
}
|
||||
if (authScheme==0)
|
||||
{
|
||||
memset(buf1, 0, sizeof(buf1));
|
||||
for (loop=0;loop<count;loop++)
|
||||
{
|
||||
if (strlen(buf1)>=sizeof(buf1)-1) break;
|
||||
snprintf(buf2, sizeof(buf2), (loop>0 ? ", %d" : "%d"), (int)tAuth[loop]);
|
||||
strncat(buf1, buf2, sizeof(buf1)-strlen(buf1)-1);
|
||||
}
|
||||
rfbClientLog("Unknown VeNCrypt authentication scheme from VNC server: %s\n",
|
||||
buf1);
|
||||
return FALSE;
|
||||
}
|
||||
*result = authScheme;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
HandleAnonTLSAuth(rfbClient* client)
|
||||
{
|
||||
if (!InitializeTLS() || !InitializeTLSSession(client, TRUE)) return FALSE;
|
||||
|
||||
if (!SetTLSAnonCredential(client)) return FALSE;
|
||||
|
||||
if (!HandshakeTLS(client)) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
HandleVeNCryptAuth(rfbClient* client)
|
||||
{
|
||||
uint8_t major, minor, status;
|
||||
uint32_t authScheme;
|
||||
rfbBool anonTLS;
|
||||
// gnutls_certificate_credentials_t x509_cred = NULL;
|
||||
int ret;
|
||||
|
||||
if (!InitializeTLS()) return FALSE;
|
||||
|
||||
/* Read VeNCrypt version */
|
||||
if (!ReadFromRFBServer(client, (char *)&major, 1) ||
|
||||
!ReadFromRFBServer(client, (char *)&minor, 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
rfbClientLog("Got VeNCrypt version %d.%d from server.\n", (int)major, (int)minor);
|
||||
|
||||
if (major != 0 && minor != 2)
|
||||
{
|
||||
rfbClientLog("Unsupported VeNCrypt version.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!WriteToRFBServer(client, (char *)&major, 1) ||
|
||||
!WriteToRFBServer(client, (char *)&minor, 1) ||
|
||||
!ReadFromRFBServer(client, (char *)&status, 1))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
rfbClientLog("Server refused VeNCrypt version %d.%d.\n", (int)major, (int)minor);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ReadVeNCryptSecurityType(client, &authScheme)) return FALSE;
|
||||
if (!ReadFromRFBServer(client, (char *)&status, 1) || status != 1)
|
||||
{
|
||||
rfbClientLog("Server refused VeNCrypt authentication %d (%d).\n", authScheme, (int)status);
|
||||
return FALSE;
|
||||
}
|
||||
client->subAuthScheme = authScheme;
|
||||
|
||||
/* Some VeNCrypt security types are anonymous TLS, others are X509 */
|
||||
switch (authScheme)
|
||||
{
|
||||
case rfbVeNCryptTLSNone:
|
||||
case rfbVeNCryptTLSVNC:
|
||||
case rfbVeNCryptTLSPlain:
|
||||
anonTLS = TRUE;
|
||||
break;
|
||||
default:
|
||||
anonTLS = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get X509 Credentials if it's not anonymous */
|
||||
if (!anonTLS)
|
||||
{
|
||||
rfbCredential *cred;
|
||||
|
||||
if (!client->GetCredential)
|
||||
{
|
||||
rfbClientLog("GetCredential callback is not set.\n");
|
||||
return FALSE;
|
||||
}
|
||||
cred = client->GetCredential(client, rfbCredentialTypeX509);
|
||||
if (!cred)
|
||||
{
|
||||
rfbClientLog("Reading credential failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* TODO: don't just ignore this
|
||||
x509_cred = CreateX509CertCredential(cred);
|
||||
FreeX509Credential(cred);
|
||||
if (!x509_cred) return FALSE; */
|
||||
}
|
||||
|
||||
/* Start up the TLS session */
|
||||
if (!InitializeTLSSession(client, anonTLS)) return FALSE;
|
||||
|
||||
if (anonTLS)
|
||||
{
|
||||
if (!SetTLSAnonCredential(client)) return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: don't just ignore this
|
||||
if ((ret = gnutls_credentials_set(client->tlsSession, GNUTLS_CRD_CERTIFICATE, x509_cred)) < 0)
|
||||
{
|
||||
rfbClientLog("Cannot set x509 credential: %s.\n", gnutls_strerror(ret));
|
||||
FreeTLS(client); */
|
||||
return FALSE;
|
||||
// }
|
||||
}
|
||||
|
||||
if (!HandshakeTLS(client)) return FALSE;
|
||||
|
||||
/* TODO: validate certificate */
|
||||
|
||||
/* We are done here. The caller should continue with client->subAuthScheme
|
||||
* to do actual sub authentication.
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
ReadFromTLS(rfbClient* client, char *out, unsigned int n)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
ret = SSL_read (client->tlsSession, out, n);
|
||||
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
else {
|
||||
errno = ssl_errno (client->tlsSession, ret);
|
||||
|
||||
if (errno != EAGAIN) {
|
||||
rfbClientLog("Error reading from TLS: -.\n");
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
WriteToTLS(rfbClient* client, char *buf, unsigned int n)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
ssize_t ret;
|
||||
|
||||
while (offset < n)
|
||||
{
|
||||
|
||||
ret = SSL_write (client->tlsSession, buf + offset, (size_t)(n-offset));
|
||||
|
||||
if (ret < 0)
|
||||
errno = ssl_errno (client->tlsSession, ret);
|
||||
|
||||
if (ret == 0) continue;
|
||||
if (ret < 0)
|
||||
{
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) continue;
|
||||
rfbClientLog("Error writing to TLS: -\n");
|
||||
return -1;
|
||||
}
|
||||
offset += (unsigned int)ret;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
void FreeTLS(rfbClient* client)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (mutex_buf != NULL) {
|
||||
CRYPTO_set_dynlock_create_callback(NULL);
|
||||
CRYPTO_set_dynlock_lock_callback(NULL);
|
||||
CRYPTO_set_dynlock_destroy_callback(NULL);
|
||||
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++)
|
||||
pthread_mutex_destroy(&mutex_buf[i]);
|
||||
free(mutex_buf);
|
||||
mutex_buf = NULL;
|
||||
}
|
||||
|
||||
SSL_free(client->tlsSession);
|
||||
}
|
||||
|
210
jni/vnc/LibVNCServer-0.9.9/libvncclient/ultra.c
Normal file
210
jni/vnc/LibVNCServer-0.9.9/libvncclient/ultra.c
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ultrazip.c - handle ultrazip encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles an zlib
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#define HandleUltraZipBPP CONCAT2E(HandleUltraZip,BPP)
|
||||
#define HandleUltraBPP CONCAT2E(HandleUltra,BPP)
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
|
||||
static rfbBool
|
||||
HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbZlibHeader hdr;
|
||||
int toRead=0;
|
||||
int inflateResult=0;
|
||||
lzo_uint uncompressedBytes = (( rw * rh ) * ( BPP / 8 ));
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
|
||||
return FALSE;
|
||||
|
||||
toRead = rfbClientSwap32IfLE(hdr.nBytes);
|
||||
if (toRead==0) return TRUE;
|
||||
|
||||
if (uncompressedBytes==0)
|
||||
{
|
||||
rfbClientLog("ultra error: rectangle has 0 uncomressed bytes ((%dw * %dh) * (%d / 8))\n", rw, rh, BPP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* First make sure we have a large enough raw buffer to hold the
|
||||
* decompressed data. In practice, with a fixed BPP, fixed frame
|
||||
* buffer size and the first update containing the entire frame
|
||||
* buffer, this buffer allocation should only happen once, on the
|
||||
* first update.
|
||||
*/
|
||||
if ( client->raw_buffer_size < (int)uncompressedBytes) {
|
||||
if ( client->raw_buffer != NULL ) {
|
||||
free( client->raw_buffer );
|
||||
}
|
||||
client->raw_buffer_size = uncompressedBytes;
|
||||
/* buffer needs to be aligned on 4-byte boundaries */
|
||||
if ((client->raw_buffer_size % 4)!=0)
|
||||
client->raw_buffer_size += (4-(client->raw_buffer_size % 4));
|
||||
client->raw_buffer = (char*) malloc( client->raw_buffer_size );
|
||||
}
|
||||
|
||||
/* allocate enough space to store the incoming compressed packet */
|
||||
if ( client->ultra_buffer_size < toRead ) {
|
||||
if ( client->ultra_buffer != NULL ) {
|
||||
free( client->ultra_buffer );
|
||||
}
|
||||
client->ultra_buffer_size = toRead;
|
||||
/* buffer needs to be aligned on 4-byte boundaries */
|
||||
if ((client->ultra_buffer_size % 4)!=0)
|
||||
client->ultra_buffer_size += (4-(client->ultra_buffer_size % 4));
|
||||
client->ultra_buffer = (char*) malloc( client->ultra_buffer_size );
|
||||
}
|
||||
|
||||
/* Fill the buffer, obtaining data from the server. */
|
||||
if (!ReadFromRFBServer(client, client->ultra_buffer, toRead))
|
||||
return FALSE;
|
||||
|
||||
/* uncompress the data */
|
||||
uncompressedBytes = client->raw_buffer_size;
|
||||
inflateResult = lzo1x_decompress(
|
||||
(lzo_byte *)client->ultra_buffer, toRead,
|
||||
(lzo_byte *)client->raw_buffer, (lzo_uintp) &uncompressedBytes,
|
||||
NULL);
|
||||
|
||||
|
||||
if ((rw * rh * (BPP / 8)) != uncompressedBytes)
|
||||
rfbClientLog("Ultra decompressed too little (%d < %d)", (rw * rh * (BPP / 8)), uncompressedBytes);
|
||||
|
||||
/* Put the uncompressed contents of the update on the screen. */
|
||||
if ( inflateResult == LZO_E_OK )
|
||||
{
|
||||
CopyRectangle(client, (unsigned char *)client->raw_buffer, rx, ry, rw, rh);
|
||||
}
|
||||
else
|
||||
{
|
||||
rfbClientLog("ultra decompress returned error: %d\n",
|
||||
inflateResult);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* UltraZip is like rre in that it is composed of subrects */
|
||||
static rfbBool
|
||||
HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbZlibHeader hdr;
|
||||
int i=0;
|
||||
int toRead=0;
|
||||
int inflateResult=0;
|
||||
unsigned char *ptr=NULL;
|
||||
lzo_uint uncompressedBytes = ry + (rw * 65535);
|
||||
unsigned int numCacheRects = rx;
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
|
||||
return FALSE;
|
||||
|
||||
toRead = rfbClientSwap32IfLE(hdr.nBytes);
|
||||
|
||||
if (toRead==0) return TRUE;
|
||||
|
||||
if (uncompressedBytes==0)
|
||||
{
|
||||
rfbClientLog("ultrazip error: rectangle has 0 uncomressed bytes (%dy + (%dw * 65535)) (%d rectangles)\n", ry, rw, rx);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* First make sure we have a large enough raw buffer to hold the
|
||||
* decompressed data. In practice, with a fixed BPP, fixed frame
|
||||
* buffer size and the first update containing the entire frame
|
||||
* buffer, this buffer allocation should only happen once, on the
|
||||
* first update.
|
||||
*/
|
||||
if ( client->raw_buffer_size < (int)(uncompressedBytes + 500)) {
|
||||
if ( client->raw_buffer != NULL ) {
|
||||
free( client->raw_buffer );
|
||||
}
|
||||
client->raw_buffer_size = uncompressedBytes + 500;
|
||||
/* buffer needs to be aligned on 4-byte boundaries */
|
||||
if ((client->raw_buffer_size % 4)!=0)
|
||||
client->raw_buffer_size += (4-(client->raw_buffer_size % 4));
|
||||
client->raw_buffer = (char*) malloc( client->raw_buffer_size );
|
||||
}
|
||||
|
||||
|
||||
/* allocate enough space to store the incoming compressed packet */
|
||||
if ( client->ultra_buffer_size < toRead ) {
|
||||
if ( client->ultra_buffer != NULL ) {
|
||||
free( client->ultra_buffer );
|
||||
}
|
||||
client->ultra_buffer_size = toRead;
|
||||
client->ultra_buffer = (char*) malloc( client->ultra_buffer_size );
|
||||
}
|
||||
|
||||
/* Fill the buffer, obtaining data from the server. */
|
||||
if (!ReadFromRFBServer(client, client->ultra_buffer, toRead))
|
||||
return FALSE;
|
||||
|
||||
/* uncompress the data */
|
||||
uncompressedBytes = client->raw_buffer_size;
|
||||
inflateResult = lzo1x_decompress(
|
||||
(lzo_byte *)client->ultra_buffer, toRead,
|
||||
(lzo_byte *)client->raw_buffer, &uncompressedBytes, NULL);
|
||||
if ( inflateResult != LZO_E_OK )
|
||||
{
|
||||
rfbClientLog("ultra decompress returned error: %d\n",
|
||||
inflateResult);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Put the uncompressed contents of the update on the screen. */
|
||||
ptr = (unsigned char *)client->raw_buffer;
|
||||
for (i=0; i<numCacheRects; i++)
|
||||
{
|
||||
unsigned short sx, sy, sw, sh;
|
||||
unsigned int se;
|
||||
|
||||
memcpy((char *)&sx, ptr, 2); ptr += 2;
|
||||
memcpy((char *)&sy, ptr, 2); ptr += 2;
|
||||
memcpy((char *)&sw, ptr, 2); ptr += 2;
|
||||
memcpy((char *)&sh, ptr, 2); ptr += 2;
|
||||
memcpy((char *)&se, ptr, 4); ptr += 4;
|
||||
|
||||
sx = rfbClientSwap16IfLE(sx);
|
||||
sy = rfbClientSwap16IfLE(sy);
|
||||
sw = rfbClientSwap16IfLE(sw);
|
||||
sh = rfbClientSwap16IfLE(sh);
|
||||
se = rfbClientSwap32IfLE(se);
|
||||
|
||||
if (se == rfbEncodingRaw)
|
||||
{
|
||||
CopyRectangle(client, (unsigned char *)ptr, sx, sy, sw, sh);
|
||||
ptr += ((sw * sh) * (BPP / 8));
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
379
jni/vnc/LibVNCServer-0.9.9/libvncclient/vncviewer.c
Normal file
379
jni/vnc/LibVNCServer-0.9.9/libvncclient/vncviewer.c
Normal file
@ -0,0 +1,379 @@
|
||||
/*
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* vncviewer.c - the Xt-based VNC viewer.
|
||||
*/
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#define _POSIX_SOURCE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <rfb/rfbclient.h>
|
||||
#include "tls.h"
|
||||
|
||||
static void Dummy(rfbClient* client) {
|
||||
}
|
||||
static rfbBool DummyPoint(rfbClient* client, int x, int y) {
|
||||
return TRUE;
|
||||
}
|
||||
static void DummyRect(rfbClient* client, int x, int y, int w, int h) {
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
static char* NoPassword(rfbClient* client) {
|
||||
return strdup("");
|
||||
}
|
||||
#undef SOCKET
|
||||
#include <winsock2.h>
|
||||
#define close closesocket
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
static char* ReadPassword(rfbClient* client) {
|
||||
#ifdef __MINGW32__
|
||||
/* FIXME */
|
||||
rfbClientErr("ReadPassword on MinGW32 NOT IMPLEMENTED\n");
|
||||
return NoPassword(client);
|
||||
#else
|
||||
int i;
|
||||
char* p=malloc(9);
|
||||
struct termios save,noecho;
|
||||
p[0]=0;
|
||||
if(tcgetattr(fileno(stdin),&save)!=0) return p;
|
||||
noecho=save; noecho.c_lflag &= ~ECHO;
|
||||
if(tcsetattr(fileno(stdin),TCSAFLUSH,&noecho)!=0) return p;
|
||||
fprintf(stderr,"Password: ");
|
||||
i=0;
|
||||
while(1) {
|
||||
int c=fgetc(stdin);
|
||||
if(c=='\n')
|
||||
break;
|
||||
if(i<8) {
|
||||
p[i]=c;
|
||||
i++;
|
||||
p[i]=0;
|
||||
}
|
||||
}
|
||||
tcsetattr(fileno(stdin),TCSAFLUSH,&save);
|
||||
return p;
|
||||
#endif
|
||||
}
|
||||
static rfbBool MallocFrameBuffer(rfbClient* client) {
|
||||
if(client->frameBuffer)
|
||||
free(client->frameBuffer);
|
||||
client->frameBuffer=malloc(client->width*client->height*client->format.bitsPerPixel/8);
|
||||
return client->frameBuffer?TRUE:FALSE;
|
||||
}
|
||||
|
||||
static void initAppData(AppData* data) {
|
||||
data->shareDesktop=TRUE;
|
||||
data->viewOnly=FALSE;
|
||||
data->encodingsString="tight zrle ultra copyrect hextile zlib corre rre raw";
|
||||
data->useBGR233=FALSE;
|
||||
data->nColours=0;
|
||||
data->forceOwnCmap=FALSE;
|
||||
data->forceTrueColour=FALSE;
|
||||
data->requestedDepth=0;
|
||||
data->compressLevel=3;
|
||||
data->qualityLevel=5;
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
data->enableJPEG=TRUE;
|
||||
#else
|
||||
data->enableJPEG=FALSE;
|
||||
#endif
|
||||
data->useRemoteCursor=FALSE;
|
||||
}
|
||||
|
||||
rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
|
||||
int bytesPerPixel) {
|
||||
rfbClient* client=(rfbClient*)calloc(sizeof(rfbClient),1);
|
||||
if(!client) {
|
||||
rfbClientErr("Couldn't allocate client structure!\n");
|
||||
return NULL;
|
||||
}
|
||||
initAppData(&client->appData);
|
||||
client->endianTest = 1;
|
||||
client->programName="";
|
||||
client->serverHost=strdup("");
|
||||
client->serverPort=5900;
|
||||
|
||||
client->destHost = NULL;
|
||||
client->destPort = 5900;
|
||||
|
||||
client->CurrentKeyboardLedState = 0;
|
||||
client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint;
|
||||
|
||||
/* default: use complete frame buffer */
|
||||
client->updateRect.x = -1;
|
||||
|
||||
client->format.bitsPerPixel = bytesPerPixel*8;
|
||||
client->format.depth = bitsPerSample*samplesPerPixel;
|
||||
client->appData.requestedDepth=client->format.depth;
|
||||
client->format.bigEndian = *(char *)&client->endianTest?FALSE:TRUE;
|
||||
client->format.trueColour = TRUE;
|
||||
|
||||
if (client->format.bitsPerPixel == 8) {
|
||||
client->format.redMax = 7;
|
||||
client->format.greenMax = 7;
|
||||
client->format.blueMax = 3;
|
||||
client->format.redShift = 0;
|
||||
client->format.greenShift = 3;
|
||||
client->format.blueShift = 6;
|
||||
} else {
|
||||
client->format.redMax = (1 << bitsPerSample) - 1;
|
||||
client->format.greenMax = (1 << bitsPerSample) - 1;
|
||||
client->format.blueMax = (1 << bitsPerSample) - 1;
|
||||
if(!client->format.bigEndian) {
|
||||
client->format.redShift = 0;
|
||||
client->format.greenShift = bitsPerSample;
|
||||
client->format.blueShift = bitsPerSample * 2;
|
||||
} else {
|
||||
if(client->format.bitsPerPixel==8*3) {
|
||||
client->format.redShift = bitsPerSample*2;
|
||||
client->format.greenShift = bitsPerSample*1;
|
||||
client->format.blueShift = 0;
|
||||
} else {
|
||||
client->format.redShift = bitsPerSample*3;
|
||||
client->format.greenShift = bitsPerSample*2;
|
||||
client->format.blueShift = bitsPerSample;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client->bufoutptr=client->buf;
|
||||
client->buffered=0;
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
client->raw_buffer_size = -1;
|
||||
client->decompStreamInited = FALSE;
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
memset(client->zlibStreamActive,0,sizeof(rfbBool)*4);
|
||||
client->jpegSrcManager = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
client->HandleCursorPos = DummyPoint;
|
||||
client->SoftCursorLockArea = DummyRect;
|
||||
client->SoftCursorUnlockScreen = Dummy;
|
||||
client->GotFrameBufferUpdate = DummyRect;
|
||||
client->FinishedFrameBufferUpdate = NULL;
|
||||
client->GetPassword = ReadPassword;
|
||||
client->MallocFrameBuffer = MallocFrameBuffer;
|
||||
client->Bell = Dummy;
|
||||
client->CurrentKeyboardLedState = 0;
|
||||
client->HandleKeyboardLedState = (HandleKeyboardLedStateProc)DummyPoint;
|
||||
client->QoS_DSCP = 0;
|
||||
|
||||
client->authScheme = 0;
|
||||
client->subAuthScheme = 0;
|
||||
client->GetCredential = NULL;
|
||||
client->tlsSession = NULL;
|
||||
client->sock = -1;
|
||||
client->listenSock = -1;
|
||||
client->listenAddress = NULL;
|
||||
client->listen6Sock = -1;
|
||||
client->listen6Address = NULL;
|
||||
client->clientAuthSchemes = NULL;
|
||||
return client;
|
||||
}
|
||||
|
||||
static rfbBool rfbInitConnection(rfbClient* client)
|
||||
{
|
||||
/* Unless we accepted an incoming connection, make a TCP connection to the
|
||||
given VNC server */
|
||||
|
||||
if (!client->listenSpecified) {
|
||||
if (!client->serverHost)
|
||||
return FALSE;
|
||||
if (client->destHost) {
|
||||
if (!ConnectToRFBRepeater(client,client->serverHost,client->serverPort,client->destHost,client->destPort))
|
||||
return FALSE;
|
||||
} else {
|
||||
if (!ConnectToRFBServer(client,client->serverHost,client->serverPort))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialise the VNC connection, including reading the password */
|
||||
|
||||
if (!InitialiseRFBConnection(client))
|
||||
return FALSE;
|
||||
|
||||
client->width=client->si.framebufferWidth;
|
||||
client->height=client->si.framebufferHeight;
|
||||
client->MallocFrameBuffer(client);
|
||||
|
||||
if (!SetFormatAndEncodings(client))
|
||||
return FALSE;
|
||||
|
||||
if (client->updateRect.x < 0) {
|
||||
client->updateRect.x = client->updateRect.y = 0;
|
||||
client->updateRect.w = client->width;
|
||||
client->updateRect.h = client->height;
|
||||
}
|
||||
|
||||
if (client->appData.scaleSetting>1)
|
||||
{
|
||||
if (!SendScaleSetting(client, client->appData.scaleSetting))
|
||||
return FALSE;
|
||||
if (!SendFramebufferUpdateRequest(client,
|
||||
client->updateRect.x / client->appData.scaleSetting,
|
||||
client->updateRect.y / client->appData.scaleSetting,
|
||||
client->updateRect.w / client->appData.scaleSetting,
|
||||
client->updateRect.h / client->appData.scaleSetting,
|
||||
FALSE))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SendFramebufferUpdateRequest(client,
|
||||
client->updateRect.x, client->updateRect.y,
|
||||
client->updateRect.w, client->updateRect.h,
|
||||
FALSE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
|
||||
int i,j;
|
||||
|
||||
if(argv && argc && *argc) {
|
||||
if(client->programName==0)
|
||||
client->programName=argv[0];
|
||||
|
||||
for (i = 1; i < *argc; i++) {
|
||||
j = i;
|
||||
if (strcmp(argv[i], "-listen") == 0) {
|
||||
listenForIncomingConnections(client);
|
||||
break;
|
||||
} else if (strcmp(argv[i], "-listennofork") == 0) {
|
||||
listenForIncomingConnectionsNoFork(client, -1);
|
||||
break;
|
||||
} else if (strcmp(argv[i], "-play") == 0) {
|
||||
client->serverPort = -1;
|
||||
j++;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-encodings") == 0) {
|
||||
client->appData.encodingsString = argv[i+1];
|
||||
j+=2;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-compress") == 0) {
|
||||
client->appData.compressLevel = atoi(argv[i+1]);
|
||||
j+=2;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-quality") == 0) {
|
||||
client->appData.qualityLevel = atoi(argv[i+1]);
|
||||
j+=2;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-scale") == 0) {
|
||||
client->appData.scaleSetting = atoi(argv[i+1]);
|
||||
j+=2;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-qosdscp") == 0) {
|
||||
client->QoS_DSCP = atoi(argv[i+1]);
|
||||
j+=2;
|
||||
} else if (i+1<*argc && strcmp(argv[i], "-repeaterdest") == 0) {
|
||||
char* colon=strchr(argv[i+1],':');
|
||||
|
||||
if(client->destHost)
|
||||
free(client->destHost);
|
||||
client->destPort = 5900;
|
||||
|
||||
client->destHost = strdup(argv[i+1]);
|
||||
if(colon) {
|
||||
client->destHost[(int)(colon-argv[i+1])] = '\0';
|
||||
client->destPort = atoi(colon+1);
|
||||
}
|
||||
j+=2;
|
||||
} else {
|
||||
char* colon=strchr(argv[i],':');
|
||||
|
||||
if(client->serverHost)
|
||||
free(client->serverHost);
|
||||
|
||||
if(colon) {
|
||||
client->serverHost = strdup(argv[i]);
|
||||
client->serverHost[(int)(colon-argv[i])] = '\0';
|
||||
client->serverPort = atoi(colon+1);
|
||||
} else {
|
||||
client->serverHost = strdup(argv[i]);
|
||||
}
|
||||
if(client->serverPort >= 0 && client->serverPort < 5900)
|
||||
client->serverPort += 5900;
|
||||
}
|
||||
/* purge arguments */
|
||||
if (j>i) {
|
||||
*argc-=j-i;
|
||||
memmove(argv+i,argv+j,(*argc-i)*sizeof(char*));
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!rfbInitConnection(client)) {
|
||||
rfbClientCleanup(client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void rfbClientCleanup(rfbClient* client) {
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < 4; i++ ) {
|
||||
if (client->zlibStreamActive[i] == TRUE ) {
|
||||
if (inflateEnd (&client->zlibStream[i]) != Z_OK &&
|
||||
client->zlibStream[i].msg != NULL)
|
||||
rfbClientLog("inflateEnd: %s\n", client->zlibStream[i].msg);
|
||||
}
|
||||
}
|
||||
|
||||
if ( client->decompStreamInited == TRUE ) {
|
||||
if (inflateEnd (&client->decompStream) != Z_OK &&
|
||||
client->decompStream.msg != NULL)
|
||||
rfbClientLog("inflateEnd: %s\n", client->decompStream.msg );
|
||||
}
|
||||
|
||||
if (client->jpegSrcManager)
|
||||
free(client->jpegSrcManager);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FreeTLS(client);
|
||||
|
||||
if (client->sock >= 0)
|
||||
close(client->sock);
|
||||
if (client->listenSock >= 0)
|
||||
close(client->listenSock);
|
||||
free(client->desktopName);
|
||||
free(client->serverHost);
|
||||
if (client->destHost)
|
||||
free(client->destHost);
|
||||
if (client->clientAuthSchemes)
|
||||
free(client->clientAuthSchemes);
|
||||
free(client);
|
||||
}
|
162
jni/vnc/LibVNCServer-0.9.9/libvncclient/zlib.c
Normal file
162
jni/vnc/LibVNCServer-0.9.9/libvncclient/zlib.c
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
|
||||
/*
|
||||
* zlib.c - handle zlib encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles an zlib
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#define HandleZlibBPP CONCAT2E(HandleZlib,BPP)
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
|
||||
static rfbBool
|
||||
HandleZlibBPP (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbZlibHeader hdr;
|
||||
int remaining;
|
||||
int inflateResult;
|
||||
int toRead;
|
||||
|
||||
/* First make sure we have a large enough raw buffer to hold the
|
||||
* decompressed data. In practice, with a fixed BPP, fixed frame
|
||||
* buffer size and the first update containing the entire frame
|
||||
* buffer, this buffer allocation should only happen once, on the
|
||||
* first update.
|
||||
*/
|
||||
if ( client->raw_buffer_size < (( rw * rh ) * ( BPP / 8 ))) {
|
||||
|
||||
if ( client->raw_buffer != NULL ) {
|
||||
|
||||
free( client->raw_buffer );
|
||||
|
||||
}
|
||||
|
||||
client->raw_buffer_size = (( rw * rh ) * ( BPP / 8 ));
|
||||
client->raw_buffer = (char*) malloc( client->raw_buffer_size );
|
||||
|
||||
}
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
|
||||
return FALSE;
|
||||
|
||||
remaining = rfbClientSwap32IfLE(hdr.nBytes);
|
||||
|
||||
/* Need to initialize the decompressor state. */
|
||||
client->decompStream.next_in = ( Bytef * )client->buffer;
|
||||
client->decompStream.avail_in = 0;
|
||||
client->decompStream.next_out = ( Bytef * )client->raw_buffer;
|
||||
client->decompStream.avail_out = client->raw_buffer_size;
|
||||
client->decompStream.data_type = Z_BINARY;
|
||||
|
||||
/* Initialize the decompression stream structures on the first invocation. */
|
||||
if ( client->decompStreamInited == FALSE ) {
|
||||
|
||||
inflateResult = inflateInit( &client->decompStream );
|
||||
|
||||
if ( inflateResult != Z_OK ) {
|
||||
rfbClientLog(
|
||||
"inflateInit returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
client->decompStreamInited = TRUE;
|
||||
|
||||
}
|
||||
|
||||
inflateResult = Z_OK;
|
||||
|
||||
/* Process buffer full of data until no more to process, or
|
||||
* some type of inflater error, or Z_STREAM_END.
|
||||
*/
|
||||
while (( remaining > 0 ) &&
|
||||
( inflateResult == Z_OK )) {
|
||||
|
||||
if ( remaining > RFB_BUFFER_SIZE ) {
|
||||
toRead = RFB_BUFFER_SIZE;
|
||||
}
|
||||
else {
|
||||
toRead = remaining;
|
||||
}
|
||||
|
||||
/* Fill the buffer, obtaining data from the server. */
|
||||
if (!ReadFromRFBServer(client, client->buffer,toRead))
|
||||
return FALSE;
|
||||
|
||||
client->decompStream.next_in = ( Bytef * )client->buffer;
|
||||
client->decompStream.avail_in = toRead;
|
||||
|
||||
/* Need to uncompress buffer full. */
|
||||
inflateResult = inflate( &client->decompStream, Z_SYNC_FLUSH );
|
||||
|
||||
/* We never supply a dictionary for compression. */
|
||||
if ( inflateResult == Z_NEED_DICT ) {
|
||||
rfbClientLog("zlib inflate needs a dictionary!\n");
|
||||
return FALSE;
|
||||
}
|
||||
if ( inflateResult < 0 ) {
|
||||
rfbClientLog(
|
||||
"zlib inflate returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Result buffer allocated to be at least large enough. We should
|
||||
* never run out of space!
|
||||
*/
|
||||
if (( client->decompStream.avail_in > 0 ) &&
|
||||
( client->decompStream.avail_out <= 0 )) {
|
||||
rfbClientLog("zlib inflate ran out of space!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
remaining -= toRead;
|
||||
|
||||
} /* while ( remaining > 0 ) */
|
||||
|
||||
if ( inflateResult == Z_OK ) {
|
||||
|
||||
/* Put the uncompressed contents of the update on the screen. */
|
||||
CopyRectangle(client, (uint8_t *)client->raw_buffer, rx, ry, rw, rh);
|
||||
}
|
||||
else {
|
||||
|
||||
rfbClientLog(
|
||||
"zlib inflate returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
||||
|
||||
#endif
|
427
jni/vnc/LibVNCServer-0.9.9/libvncclient/zrle.c
Normal file
427
jni/vnc/LibVNCServer-0.9.9/libvncclient/zrle.c
Normal file
@ -0,0 +1,427 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Johannes E. Schindelin. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
|
||||
/*
|
||||
* zrle.c - handle zrle encoding.
|
||||
*
|
||||
* This file shouldn't be compiled directly. It is included multiple times by
|
||||
* rfbproto.c, each time with a different definition of the macro BPP. For
|
||||
* each value of BPP, this file defines a function which handles an zrle
|
||||
* encoded rectangle with BPP bits per pixel.
|
||||
*/
|
||||
|
||||
#ifndef REALBPP
|
||||
#define REALBPP BPP
|
||||
#endif
|
||||
|
||||
#if !defined(UNCOMP) || UNCOMP==0
|
||||
#define HandleZRLE CONCAT2E(HandleZRLE,REALBPP)
|
||||
#define HandleZRLETile CONCAT2E(HandleZRLETile,REALBPP)
|
||||
#elif UNCOMP>0
|
||||
#define HandleZRLE CONCAT3E(HandleZRLE,REALBPP,Down)
|
||||
#define HandleZRLETile CONCAT3E(HandleZRLETile,REALBPP,Down)
|
||||
#else
|
||||
#define HandleZRLE CONCAT3E(HandleZRLE,REALBPP,Up)
|
||||
#define HandleZRLETile CONCAT3E(HandleZRLETile,REALBPP,Up)
|
||||
#endif
|
||||
#define CARDBPP CONCAT3E(uint,BPP,_t)
|
||||
#define CARDREALBPP CONCAT3E(uint,REALBPP,_t)
|
||||
|
||||
#define ENDIAN_LITTLE 0
|
||||
#define ENDIAN_BIG 1
|
||||
#define ENDIAN_NO 2
|
||||
#define ZYWRLE_ENDIAN ENDIAN_LITTLE
|
||||
#undef END_FIX
|
||||
#if ZYWRLE_ENDIAN == ENDIAN_LITTLE
|
||||
# define END_FIX LE
|
||||
#elif ZYWRLE_ENDIAN == ENDIAN_BIG
|
||||
# define END_FIX BE
|
||||
#else
|
||||
# define END_FIX NE
|
||||
#endif
|
||||
#define __RFB_CONCAT3E(a,b,c) CONCAT3E(a,b,c)
|
||||
#define __RFB_CONCAT2E(a,b) CONCAT2E(a,b)
|
||||
#undef CPIXEL
|
||||
#if REALBPP != BPP
|
||||
#if UNCOMP == 0
|
||||
#define CPIXEL REALBPP
|
||||
#elif UNCOMP>0
|
||||
#define CPIXEL CONCAT2E(REALBPP,Down)
|
||||
#else
|
||||
#define CPIXEL CONCAT2E(REALBPP,Up)
|
||||
#endif
|
||||
#endif
|
||||
#define PIXEL_T __RFB_CONCAT3E(uint,BPP,_t)
|
||||
#if BPP!=8
|
||||
#define ZYWRLE_DECODE 1
|
||||
#include "zywrletemplate.c"
|
||||
#endif
|
||||
#undef CPIXEL
|
||||
|
||||
static int HandleZRLETile(rfbClient* client,
|
||||
uint8_t* buffer,size_t buffer_length,
|
||||
int x,int y,int w,int h);
|
||||
|
||||
static rfbBool
|
||||
HandleZRLE (rfbClient* client, int rx, int ry, int rw, int rh)
|
||||
{
|
||||
rfbZRLEHeader header;
|
||||
int remaining;
|
||||
int inflateResult;
|
||||
int toRead;
|
||||
int min_buffer_size = rw * rh * (REALBPP / 8) * 2;
|
||||
|
||||
/* First make sure we have a large enough raw buffer to hold the
|
||||
* decompressed data. In practice, with a fixed REALBPP, fixed frame
|
||||
* buffer size and the first update containing the entire frame
|
||||
* buffer, this buffer allocation should only happen once, on the
|
||||
* first update.
|
||||
*/
|
||||
if ( client->raw_buffer_size < min_buffer_size) {
|
||||
|
||||
if ( client->raw_buffer != NULL ) {
|
||||
|
||||
free( client->raw_buffer );
|
||||
|
||||
}
|
||||
|
||||
client->raw_buffer_size = min_buffer_size;
|
||||
client->raw_buffer = (char*) malloc( client->raw_buffer_size );
|
||||
|
||||
}
|
||||
|
||||
if (!ReadFromRFBServer(client, (char *)&header, sz_rfbZRLEHeader))
|
||||
return FALSE;
|
||||
|
||||
remaining = rfbClientSwap32IfLE(header.length);
|
||||
|
||||
/* Need to initialize the decompressor state. */
|
||||
client->decompStream.next_in = ( Bytef * )client->buffer;
|
||||
client->decompStream.avail_in = 0;
|
||||
client->decompStream.next_out = ( Bytef * )client->raw_buffer;
|
||||
client->decompStream.avail_out = client->raw_buffer_size;
|
||||
client->decompStream.data_type = Z_BINARY;
|
||||
|
||||
/* Initialize the decompression stream structures on the first invocation. */
|
||||
if ( client->decompStreamInited == FALSE ) {
|
||||
|
||||
inflateResult = inflateInit( &client->decompStream );
|
||||
|
||||
if ( inflateResult != Z_OK ) {
|
||||
rfbClientLog(
|
||||
"inflateInit returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
client->decompStreamInited = TRUE;
|
||||
|
||||
}
|
||||
|
||||
inflateResult = Z_OK;
|
||||
|
||||
/* Process buffer full of data until no more to process, or
|
||||
* some type of inflater error, or Z_STREAM_END.
|
||||
*/
|
||||
while (( remaining > 0 ) &&
|
||||
( inflateResult == Z_OK )) {
|
||||
|
||||
if ( remaining > RFB_BUFFER_SIZE ) {
|
||||
toRead = RFB_BUFFER_SIZE;
|
||||
}
|
||||
else {
|
||||
toRead = remaining;
|
||||
}
|
||||
|
||||
/* Fill the buffer, obtaining data from the server. */
|
||||
if (!ReadFromRFBServer(client, client->buffer,toRead))
|
||||
return FALSE;
|
||||
|
||||
client->decompStream.next_in = ( Bytef * )client->buffer;
|
||||
client->decompStream.avail_in = toRead;
|
||||
|
||||
/* Need to uncompress buffer full. */
|
||||
inflateResult = inflate( &client->decompStream, Z_SYNC_FLUSH );
|
||||
|
||||
/* We never supply a dictionary for compression. */
|
||||
if ( inflateResult == Z_NEED_DICT ) {
|
||||
rfbClientLog("zlib inflate needs a dictionary!\n");
|
||||
return FALSE;
|
||||
}
|
||||
if ( inflateResult < 0 ) {
|
||||
rfbClientLog(
|
||||
"zlib inflate returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Result buffer allocated to be at least large enough. We should
|
||||
* never run out of space!
|
||||
*/
|
||||
if (( client->decompStream.avail_in > 0 ) &&
|
||||
( client->decompStream.avail_out <= 0 )) {
|
||||
rfbClientLog("zlib inflate ran out of space!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
remaining -= toRead;
|
||||
|
||||
} /* while ( remaining > 0 ) */
|
||||
|
||||
if ( inflateResult == Z_OK ) {
|
||||
void* buf=client->raw_buffer;
|
||||
int i,j;
|
||||
|
||||
remaining = client->raw_buffer_size-client->decompStream.avail_out;
|
||||
|
||||
for(j=0; j<rh; j+=rfbZRLETileHeight)
|
||||
for(i=0; i<rw; i+=rfbZRLETileWidth) {
|
||||
int subWidth=(i+rfbZRLETileWidth>rw)?rw-i:rfbZRLETileWidth;
|
||||
int subHeight=(j+rfbZRLETileHeight>rh)?rh-j:rfbZRLETileHeight;
|
||||
int result=HandleZRLETile(client,buf,remaining,rx+i,ry+j,subWidth,subHeight);
|
||||
|
||||
if(result<0) {
|
||||
rfbClientLog("ZRLE decoding failed (%d)\n",result);
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buf+=result;
|
||||
remaining-=result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
rfbClientLog(
|
||||
"zlib inflate returned error: %d, msg: %s\n",
|
||||
inflateResult,
|
||||
client->decompStream.msg);
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if REALBPP!=BPP && defined(UNCOMP) && UNCOMP!=0
|
||||
#if UNCOMP>0
|
||||
#define UncompressCPixel(pointer) ((*(CARDBPP*)pointer)>>UNCOMP)
|
||||
#else
|
||||
#define UncompressCPixel(pointer) ((*(CARDBPP*)pointer)<<(-(UNCOMP)))
|
||||
#endif
|
||||
#else
|
||||
#define UncompressCPixel(pointer) (*(CARDBPP*)pointer)
|
||||
#endif
|
||||
|
||||
static int HandleZRLETile(rfbClient* client,
|
||||
uint8_t* buffer,size_t buffer_length,
|
||||
int x,int y,int w,int h) {
|
||||
uint8_t* buffer_copy = buffer;
|
||||
uint8_t* buffer_end = buffer+buffer_length;
|
||||
uint8_t type;
|
||||
#if BPP!=8
|
||||
uint8_t zywrle_level = (client->appData.qualityLevel & 0x80) ?
|
||||
0 : (3 - client->appData.qualityLevel / 3);
|
||||
#endif
|
||||
|
||||
if(buffer_length<1)
|
||||
return -2;
|
||||
|
||||
type = *buffer;
|
||||
buffer++;
|
||||
{
|
||||
if( type == 0 ) /* raw */
|
||||
#if BPP!=8
|
||||
if( zywrle_level > 0 ){
|
||||
CARDBPP* pFrame = (CARDBPP*)client->frameBuffer + y*client->width+x;
|
||||
int ret;
|
||||
client->appData.qualityLevel |= 0x80;
|
||||
ret = HandleZRLETile(client, buffer, buffer_end-buffer, x, y, w, h);
|
||||
client->appData.qualityLevel &= 0x7F;
|
||||
if( ret < 0 ){
|
||||
return ret;
|
||||
}
|
||||
ZYWRLE_SYNTHESIZE( pFrame, pFrame, w, h, client->width, zywrle_level, (int*)client->zlib_buffer );
|
||||
buffer += ret;
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
#if REALBPP!=BPP
|
||||
int i,j;
|
||||
|
||||
if(1+w*h*REALBPP/8>buffer_length) {
|
||||
rfbClientLog("expected %d bytes, got only %d (%dx%d)\n",1+w*h*REALBPP/8,buffer_length,w,h);
|
||||
return -3;
|
||||
}
|
||||
|
||||
for(j=y*client->width; j<(y+h)*client->width; j+=client->width)
|
||||
for(i=x; i<x+w; i++,buffer+=REALBPP/8)
|
||||
((CARDBPP*)client->frameBuffer)[j+i] = UncompressCPixel(buffer);
|
||||
#else
|
||||
CopyRectangle(client, buffer, x, y, w, h);
|
||||
buffer+=w*h*REALBPP/8;
|
||||
#endif
|
||||
}
|
||||
else if( type == 1 ) /* solid */
|
||||
{
|
||||
CARDBPP color = UncompressCPixel(buffer);
|
||||
|
||||
if(1+REALBPP/8>buffer_length)
|
||||
return -4;
|
||||
|
||||
FillRectangle(client, x, y, w, h, color);
|
||||
|
||||
buffer+=REALBPP/8;
|
||||
|
||||
}
|
||||
else if( (type >= 2)&&(type <= 127) ) /* packed Palette */
|
||||
{
|
||||
CARDBPP palette[16];
|
||||
int i,j,shift,
|
||||
bpp=(type>4?(type>16?8:4):(type>2?2:1)),
|
||||
mask=(1<<bpp)-1,
|
||||
divider=(8/bpp);
|
||||
|
||||
if(1+type*REALBPP/8+((w+divider-1)/divider)*h>buffer_length)
|
||||
return -5;
|
||||
|
||||
/* read palette */
|
||||
for(i=0; i<type; i++,buffer+=REALBPP/8)
|
||||
palette[i] = UncompressCPixel(buffer);
|
||||
|
||||
/* read palettized pixels */
|
||||
for(j=y*client->width; j<(y+h)*client->width; j+=client->width) {
|
||||
for(i=x,shift=8-bpp; i<x+w; i++) {
|
||||
((CARDBPP*)client->frameBuffer)[j+i] = palette[((*buffer)>>shift)&mask];
|
||||
shift-=bpp;
|
||||
if(shift<0) {
|
||||
shift=8-bpp;
|
||||
buffer++;
|
||||
}
|
||||
}
|
||||
if(shift<8-bpp)
|
||||
buffer++;
|
||||
}
|
||||
|
||||
}
|
||||
/* case 17 ... 127: not used, but valid */
|
||||
else if( type == 128 ) /* plain RLE */
|
||||
{
|
||||
int i=0,j=0;
|
||||
while(j<h) {
|
||||
int color,length;
|
||||
/* read color */
|
||||
if(buffer+REALBPP/8+1>buffer_end)
|
||||
return -7;
|
||||
color = UncompressCPixel(buffer);
|
||||
buffer+=REALBPP/8;
|
||||
/* read run length */
|
||||
length=1;
|
||||
while(*buffer==0xff) {
|
||||
if(buffer+1>=buffer_end)
|
||||
return -8;
|
||||
length+=*buffer;
|
||||
buffer++;
|
||||
}
|
||||
length+=*buffer;
|
||||
buffer++;
|
||||
while(j<h && length>0) {
|
||||
((CARDBPP*)client->frameBuffer)[(y+j)*client->width+x+i] = color;
|
||||
length--;
|
||||
i++;
|
||||
if(i>=w) {
|
||||
i=0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if(length>0)
|
||||
rfbClientLog("Warning: possible ZRLE corruption\n");
|
||||
}
|
||||
|
||||
}
|
||||
else if( type == 129 ) /* unused */
|
||||
{
|
||||
return -8;
|
||||
}
|
||||
else if( type >= 130 ) /* palette RLE */
|
||||
{
|
||||
CARDBPP palette[128];
|
||||
int i,j;
|
||||
|
||||
if(2+(type-128)*REALBPP/8>buffer_length)
|
||||
return -9;
|
||||
|
||||
/* read palette */
|
||||
for(i=0; i<type-128; i++,buffer+=REALBPP/8)
|
||||
palette[i] = UncompressCPixel(buffer);
|
||||
/* read palettized pixels */
|
||||
i=j=0;
|
||||
while(j<h) {
|
||||
int color,length;
|
||||
/* read color */
|
||||
if(buffer>=buffer_end)
|
||||
return -10;
|
||||
color = palette[(*buffer)&0x7f];
|
||||
length=1;
|
||||
if(*buffer&0x80) {
|
||||
if(buffer+1>=buffer_end)
|
||||
return -11;
|
||||
buffer++;
|
||||
/* read run length */
|
||||
while(*buffer==0xff) {
|
||||
if(buffer+1>=buffer_end)
|
||||
return -8;
|
||||
length+=*buffer;
|
||||
buffer++;
|
||||
}
|
||||
length+=*buffer;
|
||||
}
|
||||
buffer++;
|
||||
while(j<h && length>0) {
|
||||
((CARDBPP*)client->frameBuffer)[(y+j)*client->width+x+i] = color;
|
||||
length--;
|
||||
i++;
|
||||
if(i>=w) {
|
||||
i=0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if(length>0)
|
||||
rfbClientLog("Warning: possible ZRLE corruption\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buffer-buffer_copy;
|
||||
}
|
||||
|
||||
#undef CARDBPP
|
||||
#undef CARDREALBPP
|
||||
#undef HandleZRLE
|
||||
#undef HandleZRLETile
|
||||
#undef UncompressCPixel
|
||||
#undef REALBPP
|
||||
|
||||
#endif
|
||||
|
||||
#undef UNCOMP
|
78
jni/vnc/LibVNCServer-0.9.9/libvncserver-config.in
Normal file
78
jni/vnc/LibVNCServer-0.9.9/libvncserver-config.in
Normal file
@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
exec_prefix_set=no
|
||||
includedir=@includedir@
|
||||
libdir=@libdir@
|
||||
|
||||
# if this script is in the same directory as libvncserver-config.in, assume not installed
|
||||
if [ -f "`dirname "$0"`/libvncserver-config.in" ]; then
|
||||
dir="`dirname "$0"`"
|
||||
prefix="`cd "$dir"; pwd`"
|
||||
includedir="$prefix"
|
||||
libdir="$prefix/libvncserver/.libs $prefix/libvncclient/.libs"
|
||||
fi
|
||||
|
||||
usage="\
|
||||
Usage: @PACKAGE@-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--link] [--libs] [--cflags]"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
if test $exec_prefix_set = no ; then
|
||||
exec_prefix=$optarg
|
||||
fi
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
exec_prefix_set=yes
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo $exec_prefix
|
||||
;;
|
||||
--version)
|
||||
echo @VERSION@
|
||||
;;
|
||||
--cflags)
|
||||
if [ "$includedir" != /usr/include ]; then
|
||||
includes=-I"$includedir"
|
||||
fi
|
||||
echo "$includes"
|
||||
;;
|
||||
--libs)
|
||||
libs=""
|
||||
for dir in $libdir; do
|
||||
libs="$libs -L$dir"
|
||||
if [ "`uname`" = "SunOS" ]; then
|
||||
# why only Solaris??
|
||||
libs="$libs -R$dir"
|
||||
fi
|
||||
done
|
||||
echo "$libs" -lvncserver -lvncclient @LIBS@ @WSOCKLIB@
|
||||
;;
|
||||
--link)
|
||||
echo @CC@
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
12
jni/vnc/LibVNCServer-0.9.9/libvncserver.pc.in
Normal file
12
jni/vnc/LibVNCServer-0.9.9/libvncserver.pc.in
Normal file
@ -0,0 +1,12 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: LibVNCServer
|
||||
Description: A library for easy implementation of a VNC server.
|
||||
Version: @VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -lvncserver @LIBS@ @WSOCKLIB@
|
||||
Cflags: -I${includedir}
|
||||
|
74
jni/vnc/LibVNCServer-0.9.9/libvncserver/Makefile.am
Normal file
74
jni/vnc/LibVNCServer-0.9.9/libvncserver/Makefile.am
Normal file
@ -0,0 +1,74 @@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/common
|
||||
|
||||
if WITH_TIGHTVNC_FILETRANSFER
|
||||
TIGHTVNCFILETRANSFERHDRS=tightvnc-filetransfer/filelistinfo.h \
|
||||
tightvnc-filetransfer/filetransfermsg.h \
|
||||
tightvnc-filetransfer/handlefiletransferrequest.h \
|
||||
tightvnc-filetransfer/rfbtightproto.h
|
||||
|
||||
TIGHTVNCFILETRANSFERSRCS = tightvnc-filetransfer/rfbtightserver.c \
|
||||
tightvnc-filetransfer/handlefiletransferrequest.c \
|
||||
tightvnc-filetransfer/filetransfermsg.c \
|
||||
tightvnc-filetransfer/filelistinfo.c
|
||||
endif
|
||||
|
||||
if WITH_WEBSOCKETS
|
||||
|
||||
if HAVE_GNUTLS
|
||||
WEBSOCKETSSSLSRCS = rfbssl_gnutls.c rfbcrypto_gnutls.c
|
||||
WEBSOCKETSSSLLIBS = @GNUTLS_LIBS@
|
||||
else
|
||||
if HAVE_LIBSSL
|
||||
WEBSOCKETSSSLSRCS = rfbssl_openssl.c rfbcrypto_openssl.c
|
||||
WEBSOCKETSSSLLIBS = @SSL_LIBS@ @CRYPT_LIBS@
|
||||
else
|
||||
WEBSOCKETSSSLSRCS = rfbssl_none.c rfbcrypto_included.c ../common/md5.c ../common/sha1.c
|
||||
endif
|
||||
endif
|
||||
|
||||
WEBSOCKETSSRCS = websockets.c $(WEBSOCKETSSSLSRCS)
|
||||
endif
|
||||
|
||||
includedir=$(prefix)/include/rfb
|
||||
#include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
|
||||
|
||||
include_HEADERS=../rfb/rfb.h ../rfb/rfbconfig.h ../rfb/rfbint.h \
|
||||
../rfb/rfbproto.h ../rfb/keysym.h ../rfb/rfbregion.h ../rfb/rfbclient.h
|
||||
|
||||
noinst_HEADERS=../common/d3des.h ../rfb/default8x16.h zrleoutstream.h \
|
||||
zrlepalettehelper.h zrletypes.h private.h scale.h rfbssl.h rfbcrypto.h \
|
||||
../common/minilzo.h ../common/lzoconf.h ../common/lzodefs.h ../common/md5.h ../common/sha1.h \
|
||||
$(TIGHTVNCFILETRANSFERHDRS)
|
||||
|
||||
EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \
|
||||
tableinitcmtemplate.c tabletrans24template.c \
|
||||
zrleencodetemplate.c
|
||||
|
||||
if HAVE_LIBZ
|
||||
ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c
|
||||
if HAVE_LIBJPEG
|
||||
TIGHTSRCS = tight.c ../common/turbojpeg.c
|
||||
endif
|
||||
endif
|
||||
|
||||
LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c $(WEBSOCKETSSRCS) \
|
||||
stats.c corre.c hextile.c rre.c translate.c cutpaste.c \
|
||||
httpd.c cursor.c font.c \
|
||||
draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \
|
||||
$(ZLIBSRCS) $(TIGHTSRCS) $(TIGHTVNCFILETRANSFERSRCS)
|
||||
|
||||
libvncserver_la_SOURCES=$(LIB_SRCS)
|
||||
libvncserver_la_LIBADD=$(WEBSOCKETSSSLLIBS)
|
||||
|
||||
lib_LTLIBRARIES=libvncserver.la
|
||||
|
||||
if HAVE_RPM
|
||||
$(PACKAGE)-$(VERSION).tar.gz: dist
|
||||
|
||||
# Rule to build RPM distribution package
|
||||
rpm: $(PACKAGE)-$(VERSION).tar.gz libvncserver.spec
|
||||
cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@
|
||||
rpmbuild -ba libvncserver.spec
|
||||
endif
|
||||
|
||||
|
803
jni/vnc/LibVNCServer-0.9.9/libvncserver/Makefile.in
Normal file
803
jni/vnc/LibVNCServer-0.9.9/libvncserver/Makefile.in
Normal file
@ -0,0 +1,803 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = libvncserver
|
||||
DIST_COMMON = $(am__noinst_HEADERS_DIST) $(include_HEADERS) \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/rfbconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libvncserver_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am__libvncserver_la_SOURCES_DIST = main.c rfbserver.c rfbregion.c \
|
||||
auth.c sockets.c websockets.c rfbssl_none.c \
|
||||
rfbcrypto_included.c ../common/md5.c ../common/sha1.c \
|
||||
rfbssl_openssl.c rfbcrypto_openssl.c rfbssl_gnutls.c \
|
||||
rfbcrypto_gnutls.c stats.c corre.c hextile.c rre.c translate.c \
|
||||
cutpaste.c httpd.c cursor.c font.c draw.c selbox.c \
|
||||
../common/d3des.c ../common/vncauth.c cargs.c \
|
||||
../common/minilzo.c ultra.c scale.c zlib.c zrle.c \
|
||||
zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c \
|
||||
tight.c ../common/turbojpeg.c \
|
||||
tightvnc-filetransfer/rfbtightserver.c \
|
||||
tightvnc-filetransfer/handlefiletransferrequest.c \
|
||||
tightvnc-filetransfer/filetransfermsg.c \
|
||||
tightvnc-filetransfer/filelistinfo.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@@WITH_WEBSOCKETS_TRUE@am__objects_1 = rfbssl_none.lo \
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@@WITH_WEBSOCKETS_TRUE@ rfbcrypto_included.lo \
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@@WITH_WEBSOCKETS_TRUE@ md5.lo \
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@@WITH_WEBSOCKETS_TRUE@ sha1.lo
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@@WITH_WEBSOCKETS_TRUE@am__objects_1 = rfbssl_openssl.lo \
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@@WITH_WEBSOCKETS_TRUE@ rfbcrypto_openssl.lo
|
||||
@HAVE_GNUTLS_TRUE@@WITH_WEBSOCKETS_TRUE@am__objects_1 = \
|
||||
@HAVE_GNUTLS_TRUE@@WITH_WEBSOCKETS_TRUE@ rfbssl_gnutls.lo \
|
||||
@HAVE_GNUTLS_TRUE@@WITH_WEBSOCKETS_TRUE@ rfbcrypto_gnutls.lo
|
||||
@WITH_WEBSOCKETS_TRUE@am__objects_2 = websockets.lo $(am__objects_1)
|
||||
@HAVE_LIBZ_TRUE@am__objects_3 = zlib.lo zrle.lo zrleoutstream.lo \
|
||||
@HAVE_LIBZ_TRUE@ zrlepalettehelper.lo zywrletemplate.lo
|
||||
@HAVE_LIBJPEG_TRUE@@HAVE_LIBZ_TRUE@am__objects_4 = tight.lo \
|
||||
@HAVE_LIBJPEG_TRUE@@HAVE_LIBZ_TRUE@ turbojpeg.lo
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@am__objects_5 = rfbtightserver.lo \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ handlefiletransferrequest.lo \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ filetransfermsg.lo \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ filelistinfo.lo
|
||||
am__objects_6 = main.lo rfbserver.lo rfbregion.lo auth.lo sockets.lo \
|
||||
$(am__objects_2) stats.lo corre.lo hextile.lo rre.lo \
|
||||
translate.lo cutpaste.lo httpd.lo cursor.lo font.lo draw.lo \
|
||||
selbox.lo d3des.lo vncauth.lo cargs.lo minilzo.lo ultra.lo \
|
||||
scale.lo $(am__objects_3) $(am__objects_4) $(am__objects_5)
|
||||
am_libvncserver_la_OBJECTS = $(am__objects_6)
|
||||
libvncserver_la_OBJECTS = $(am_libvncserver_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(libvncserver_la_SOURCES)
|
||||
DIST_SOURCES = $(am__libvncserver_la_SOURCES_DIST)
|
||||
am__noinst_HEADERS_DIST = ../common/d3des.h ../rfb/default8x16.h \
|
||||
zrleoutstream.h zrlepalettehelper.h zrletypes.h private.h \
|
||||
scale.h rfbssl.h rfbcrypto.h ../common/minilzo.h \
|
||||
../common/lzoconf.h ../common/lzodefs.h ../common/md5.h \
|
||||
../common/sha1.h tightvnc-filetransfer/filelistinfo.h \
|
||||
tightvnc-filetransfer/filetransfermsg.h \
|
||||
tightvnc-filetransfer/handlefiletransferrequest.h \
|
||||
tightvnc-filetransfer/rfbtightproto.h
|
||||
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AVAHI_CFLAGS = @AVAHI_CFLAGS@
|
||||
AVAHI_LIBS = @AVAHI_LIBS@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CRYPT_LIBS = @CRYPT_LIBS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JPEG_LDFLAGS = @JPEG_LDFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RPMSOURCEDIR = @RPMSOURCEDIR@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SYSTEM_LIBVNCSERVER_CFLAGS = @SYSTEM_LIBVNCSERVER_CFLAGS@
|
||||
SYSTEM_LIBVNCSERVER_LIBS = @SYSTEM_LIBVNCSERVER_LIBS@
|
||||
VERSION = @VERSION@
|
||||
WSOCKLIB = @WSOCKLIB@
|
||||
XMKMF = @XMKMF@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = $(prefix)/include/rfb
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
with_ffmpeg = @with_ffmpeg@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/common
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@TIGHTVNCFILETRANSFERHDRS = tightvnc-filetransfer/filelistinfo.h \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/filetransfermsg.h \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/handlefiletransferrequest.h \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/rfbtightproto.h
|
||||
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@TIGHTVNCFILETRANSFERSRCS = tightvnc-filetransfer/rfbtightserver.c \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/handlefiletransferrequest.c \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/filetransfermsg.c \
|
||||
@WITH_TIGHTVNC_FILETRANSFER_TRUE@ tightvnc-filetransfer/filelistinfo.c
|
||||
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_FALSE@@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSSLSRCS = rfbssl_none.c rfbcrypto_included.c ../common/md5.c ../common/sha1.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSSLSRCS = rfbssl_openssl.c rfbcrypto_openssl.c
|
||||
@HAVE_GNUTLS_TRUE@@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSSLSRCS = rfbssl_gnutls.c rfbcrypto_gnutls.c
|
||||
@HAVE_GNUTLS_FALSE@@HAVE_LIBSSL_TRUE@@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSSLLIBS = @SSL_LIBS@ @CRYPT_LIBS@
|
||||
@HAVE_GNUTLS_TRUE@@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSSLLIBS = @GNUTLS_LIBS@
|
||||
@WITH_WEBSOCKETS_TRUE@WEBSOCKETSSRCS = websockets.c $(WEBSOCKETSSSLSRCS)
|
||||
#include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
|
||||
include_HEADERS = ../rfb/rfb.h ../rfb/rfbconfig.h ../rfb/rfbint.h \
|
||||
../rfb/rfbproto.h ../rfb/keysym.h ../rfb/rfbregion.h ../rfb/rfbclient.h
|
||||
|
||||
noinst_HEADERS = ../common/d3des.h ../rfb/default8x16.h zrleoutstream.h \
|
||||
zrlepalettehelper.h zrletypes.h private.h scale.h rfbssl.h rfbcrypto.h \
|
||||
../common/minilzo.h ../common/lzoconf.h ../common/lzodefs.h ../common/md5.h ../common/sha1.h \
|
||||
$(TIGHTVNCFILETRANSFERHDRS)
|
||||
|
||||
EXTRA_DIST = tableinit24.c tableinittctemplate.c tabletranstemplate.c \
|
||||
tableinitcmtemplate.c tabletrans24template.c \
|
||||
zrleencodetemplate.c
|
||||
|
||||
@HAVE_LIBZ_TRUE@ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c
|
||||
@HAVE_LIBJPEG_TRUE@@HAVE_LIBZ_TRUE@TIGHTSRCS = tight.c ../common/turbojpeg.c
|
||||
LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c $(WEBSOCKETSSRCS) \
|
||||
stats.c corre.c hextile.c rre.c translate.c cutpaste.c \
|
||||
httpd.c cursor.c font.c \
|
||||
draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \
|
||||
$(ZLIBSRCS) $(TIGHTSRCS) $(TIGHTVNCFILETRANSFERSRCS)
|
||||
|
||||
libvncserver_la_SOURCES = $(LIB_SRCS)
|
||||
libvncserver_la_LIBADD = $(WEBSOCKETSSSLLIBS)
|
||||
lib_LTLIBRARIES = libvncserver.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libvncserver/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libvncserver/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libvncserver.la: $(libvncserver_la_OBJECTS) $(libvncserver_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libvncserver_la_OBJECTS) $(libvncserver_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cargs.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corre.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cutpaste.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/d3des.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/draw.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filelistinfo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filetransfermsg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handlefiletransferrequest.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hextile.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minilzo.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbcrypto_gnutls.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbcrypto_included.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbcrypto_openssl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbregion.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbserver.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbssl_gnutls.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbssl_none.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbssl_openssl.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfbtightserver.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rre.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selbox.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tight.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/translate.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/turbojpeg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ultra.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncauth.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/websockets.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zlib.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrle.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrleoutstream.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zrlepalettehelper.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zywrletemplate.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
md5.lo: ../common/md5.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT md5.lo -MD -MP -MF $(DEPDIR)/md5.Tpo -c -o md5.lo `test -f '../common/md5.c' || echo '$(srcdir)/'`../common/md5.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/md5.Tpo $(DEPDIR)/md5.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/md5.c' object='md5.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o md5.lo `test -f '../common/md5.c' || echo '$(srcdir)/'`../common/md5.c
|
||||
|
||||
sha1.lo: ../common/sha1.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha1.lo -MD -MP -MF $(DEPDIR)/sha1.Tpo -c -o sha1.lo `test -f '../common/sha1.c' || echo '$(srcdir)/'`../common/sha1.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha1.Tpo $(DEPDIR)/sha1.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/sha1.c' object='sha1.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha1.lo `test -f '../common/sha1.c' || echo '$(srcdir)/'`../common/sha1.c
|
||||
|
||||
d3des.lo: ../common/d3des.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT d3des.lo -MD -MP -MF $(DEPDIR)/d3des.Tpo -c -o d3des.lo `test -f '../common/d3des.c' || echo '$(srcdir)/'`../common/d3des.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/d3des.Tpo $(DEPDIR)/d3des.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/d3des.c' object='d3des.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o d3des.lo `test -f '../common/d3des.c' || echo '$(srcdir)/'`../common/d3des.c
|
||||
|
||||
vncauth.lo: ../common/vncauth.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vncauth.lo -MD -MP -MF $(DEPDIR)/vncauth.Tpo -c -o vncauth.lo `test -f '../common/vncauth.c' || echo '$(srcdir)/'`../common/vncauth.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vncauth.Tpo $(DEPDIR)/vncauth.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/vncauth.c' object='vncauth.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vncauth.lo `test -f '../common/vncauth.c' || echo '$(srcdir)/'`../common/vncauth.c
|
||||
|
||||
minilzo.lo: ../common/minilzo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT minilzo.lo -MD -MP -MF $(DEPDIR)/minilzo.Tpo -c -o minilzo.lo `test -f '../common/minilzo.c' || echo '$(srcdir)/'`../common/minilzo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/minilzo.Tpo $(DEPDIR)/minilzo.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/minilzo.c' object='minilzo.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minilzo.lo `test -f '../common/minilzo.c' || echo '$(srcdir)/'`../common/minilzo.c
|
||||
|
||||
zywrletemplate.lo: ../common/zywrletemplate.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zywrletemplate.lo -MD -MP -MF $(DEPDIR)/zywrletemplate.Tpo -c -o zywrletemplate.lo `test -f '../common/zywrletemplate.c' || echo '$(srcdir)/'`../common/zywrletemplate.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zywrletemplate.Tpo $(DEPDIR)/zywrletemplate.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/zywrletemplate.c' object='zywrletemplate.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zywrletemplate.lo `test -f '../common/zywrletemplate.c' || echo '$(srcdir)/'`../common/zywrletemplate.c
|
||||
|
||||
turbojpeg.lo: ../common/turbojpeg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT turbojpeg.lo -MD -MP -MF $(DEPDIR)/turbojpeg.Tpo -c -o turbojpeg.lo `test -f '../common/turbojpeg.c' || echo '$(srcdir)/'`../common/turbojpeg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/turbojpeg.Tpo $(DEPDIR)/turbojpeg.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/turbojpeg.c' object='turbojpeg.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o turbojpeg.lo `test -f '../common/turbojpeg.c' || echo '$(srcdir)/'`../common/turbojpeg.c
|
||||
|
||||
rfbtightserver.lo: tightvnc-filetransfer/rfbtightserver.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rfbtightserver.lo -MD -MP -MF $(DEPDIR)/rfbtightserver.Tpo -c -o rfbtightserver.lo `test -f 'tightvnc-filetransfer/rfbtightserver.c' || echo '$(srcdir)/'`tightvnc-filetransfer/rfbtightserver.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rfbtightserver.Tpo $(DEPDIR)/rfbtightserver.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tightvnc-filetransfer/rfbtightserver.c' object='rfbtightserver.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rfbtightserver.lo `test -f 'tightvnc-filetransfer/rfbtightserver.c' || echo '$(srcdir)/'`tightvnc-filetransfer/rfbtightserver.c
|
||||
|
||||
handlefiletransferrequest.lo: tightvnc-filetransfer/handlefiletransferrequest.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT handlefiletransferrequest.lo -MD -MP -MF $(DEPDIR)/handlefiletransferrequest.Tpo -c -o handlefiletransferrequest.lo `test -f 'tightvnc-filetransfer/handlefiletransferrequest.c' || echo '$(srcdir)/'`tightvnc-filetransfer/handlefiletransferrequest.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/handlefiletransferrequest.Tpo $(DEPDIR)/handlefiletransferrequest.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tightvnc-filetransfer/handlefiletransferrequest.c' object='handlefiletransferrequest.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o handlefiletransferrequest.lo `test -f 'tightvnc-filetransfer/handlefiletransferrequest.c' || echo '$(srcdir)/'`tightvnc-filetransfer/handlefiletransferrequest.c
|
||||
|
||||
filetransfermsg.lo: tightvnc-filetransfer/filetransfermsg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT filetransfermsg.lo -MD -MP -MF $(DEPDIR)/filetransfermsg.Tpo -c -o filetransfermsg.lo `test -f 'tightvnc-filetransfer/filetransfermsg.c' || echo '$(srcdir)/'`tightvnc-filetransfer/filetransfermsg.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/filetransfermsg.Tpo $(DEPDIR)/filetransfermsg.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tightvnc-filetransfer/filetransfermsg.c' object='filetransfermsg.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o filetransfermsg.lo `test -f 'tightvnc-filetransfer/filetransfermsg.c' || echo '$(srcdir)/'`tightvnc-filetransfer/filetransfermsg.c
|
||||
|
||||
filelistinfo.lo: tightvnc-filetransfer/filelistinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT filelistinfo.lo -MD -MP -MF $(DEPDIR)/filelistinfo.Tpo -c -o filelistinfo.lo `test -f 'tightvnc-filetransfer/filelistinfo.c' || echo '$(srcdir)/'`tightvnc-filetransfer/filelistinfo.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/filelistinfo.Tpo $(DEPDIR)/filelistinfo.Plo
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tightvnc-filetransfer/filelistinfo.c' object='filelistinfo.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o filelistinfo.lo `test -f 'tightvnc-filetransfer/filelistinfo.c' || echo '$(srcdir)/'`tightvnc-filetransfer/filelistinfo.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(includedir)" && rm -f $$files
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-includeHEADERS install-info \
|
||||
install-info-am install-libLTLIBRARIES install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-includeHEADERS \
|
||||
uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
@HAVE_RPM_TRUE@$(PACKAGE)-$(VERSION).tar.gz: dist
|
||||
|
||||
# Rule to build RPM distribution package
|
||||
@HAVE_RPM_TRUE@rpm: $(PACKAGE)-$(VERSION).tar.gz libvncserver.spec
|
||||
@HAVE_RPM_TRUE@ cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@
|
||||
@HAVE_RPM_TRUE@ rpmbuild -ba libvncserver.spec
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
405
jni/vnc/LibVNCServer-0.9.9/libvncserver/auth.c
Normal file
405
jni/vnc/LibVNCServer-0.9.9/libvncserver/auth.c
Normal file
@ -0,0 +1,405 @@
|
||||
/*
|
||||
* auth.c - deal with authentication.
|
||||
*
|
||||
* This file implements the VNC authentication protocol when setting up an RFB
|
||||
* connection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
/* RFB 3.8 clients are well informed */
|
||||
void rfbClientSendString(rfbClientPtr cl, const char *reason);
|
||||
|
||||
|
||||
/*
|
||||
* Handle security types
|
||||
*/
|
||||
|
||||
static rfbSecurityHandler* securityHandlers = NULL;
|
||||
|
||||
/*
|
||||
* This method registers a list of new security types.
|
||||
* It avoids same security type getting registered multiple times.
|
||||
* The order is not preserved if multiple security types are
|
||||
* registered at one-go.
|
||||
*/
|
||||
void
|
||||
rfbRegisterSecurityHandler(rfbSecurityHandler* handler)
|
||||
{
|
||||
rfbSecurityHandler *head = securityHandlers, *next = NULL;
|
||||
|
||||
if(handler == NULL)
|
||||
return;
|
||||
|
||||
next = handler->next;
|
||||
|
||||
while(head != NULL) {
|
||||
if(head == handler) {
|
||||
rfbRegisterSecurityHandler(next);
|
||||
return;
|
||||
}
|
||||
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
handler->next = securityHandlers;
|
||||
securityHandlers = handler;
|
||||
|
||||
rfbRegisterSecurityHandler(next);
|
||||
}
|
||||
|
||||
/*
|
||||
* This method unregisters a list of security types.
|
||||
* These security types won't be available for any new
|
||||
* client connection.
|
||||
*/
|
||||
void
|
||||
rfbUnregisterSecurityHandler(rfbSecurityHandler* handler)
|
||||
{
|
||||
rfbSecurityHandler *cur = NULL, *pre = NULL;
|
||||
|
||||
if(handler == NULL)
|
||||
return;
|
||||
|
||||
if(securityHandlers == handler) {
|
||||
securityHandlers = securityHandlers->next;
|
||||
rfbUnregisterSecurityHandler(handler->next);
|
||||
return;
|
||||
}
|
||||
|
||||
cur = pre = securityHandlers;
|
||||
|
||||
while(cur) {
|
||||
if(cur == handler) {
|
||||
pre->next = cur->next;
|
||||
break;
|
||||
}
|
||||
pre = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
rfbUnregisterSecurityHandler(handler->next);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the authentication challenge.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbVncAuthSendChallenge(rfbClientPtr cl)
|
||||
{
|
||||
|
||||
/* 4 byte header is alreay sent. Which is rfbSecTypeVncAuth
|
||||
(same as rfbVncAuth). Just send the challenge. */
|
||||
rfbRandomBytes(cl->authChallenge);
|
||||
if (rfbWriteExact(cl, (char *)cl->authChallenge, CHALLENGESIZE) < 0) {
|
||||
rfbLogPerror("rfbAuthNewClient: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dispatch client input to rfbVncAuthProcessResponse. */
|
||||
cl->state = RFB_AUTHENTICATION;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the NO AUTHENTICATION. SCARR
|
||||
*/
|
||||
|
||||
/*
|
||||
* The rfbVncAuthNone function is currently the only function that contains
|
||||
* special logic for the built-in Mac OS X VNC client which is activated by
|
||||
* a protocolMinorVersion == 889 coming from the Mac OS X VNC client.
|
||||
* The rfbProcessClientInitMessage function does understand how to handle the
|
||||
* RFB_INITIALISATION_SHARED state which was introduced to support the built-in
|
||||
* Mac OS X VNC client, but rfbProcessClientInitMessage does not examine the
|
||||
* protocolMinorVersion version field and so its support for the
|
||||
* RFB_INITIALISATION_SHARED state is not restricted to just the OS X client.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbVncAuthNone(rfbClientPtr cl)
|
||||
{
|
||||
/* The built-in Mac OS X VNC client behaves in a non-conforming fashion
|
||||
* when the server version is 3.7 or later AND the list of security types
|
||||
* sent to the OS X client contains the 'None' authentication type AND
|
||||
* the OS X client sends back the 'None' type as its choice. In this case,
|
||||
* and this case ONLY, the built-in Mac OS X VNC client will NOT send the
|
||||
* ClientInit message and instead will behave as though an implicit
|
||||
* ClientInit message containing a shared-flag of true has been sent.
|
||||
* The special state RFB_INITIALISATION_SHARED represents this case.
|
||||
* The Mac OS X VNC client can be detected by checking protocolMinorVersion
|
||||
* for a value of 889. No other VNC client is known to use this value
|
||||
* for protocolMinorVersion. */
|
||||
uint32_t authResult;
|
||||
|
||||
/* The built-in Mac OS X VNC client expects to NOT receive a SecurityResult
|
||||
* message for authentication type 'None'. Since its protocolMinorVersion
|
||||
* is greater than 7 (it is 889) this case must be tested for specially. */
|
||||
if (cl->protocolMajorVersion==3 && cl->protocolMinorVersion > 7 && cl->protocolMinorVersion != 889) {
|
||||
rfbLog("rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8\n");
|
||||
authResult = Swap32IfLE(rfbVncAuthOK);
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cl->state = cl->protocolMinorVersion == 889 ? RFB_INITIALISATION_SHARED : RFB_INITIALISATION;
|
||||
if (cl->state == RFB_INITIALISATION_SHARED)
|
||||
/* In this case we must call rfbProcessClientMessage now because
|
||||
* otherwise we would hang waiting for data to be received from the
|
||||
* client (the ClientInit message which will never come). */
|
||||
rfbProcessClientMessage(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Advertise the supported security types (protocol 3.7). Here before sending
|
||||
* the list of security types to the client one more security type is added
|
||||
* to the list if primaryType is not set to rfbSecTypeInvalid. This security
|
||||
* type is the standard vnc security type which does the vnc authentication
|
||||
* or it will be security type for no authentication.
|
||||
* Different security types will be added by applications using this library.
|
||||
*/
|
||||
|
||||
static rfbSecurityHandler VncSecurityHandlerVncAuth = {
|
||||
rfbSecTypeVncAuth,
|
||||
rfbVncAuthSendChallenge,
|
||||
NULL
|
||||
};
|
||||
|
||||
static rfbSecurityHandler VncSecurityHandlerNone = {
|
||||
rfbSecTypeNone,
|
||||
rfbVncAuthNone,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType)
|
||||
{
|
||||
/* The size of the message is the count of security types +1,
|
||||
* since the first byte is the number of types. */
|
||||
int size = 1;
|
||||
rfbSecurityHandler* handler;
|
||||
#define MAX_SECURITY_TYPES 255
|
||||
uint8_t buffer[MAX_SECURITY_TYPES+1];
|
||||
|
||||
|
||||
/* Fill in the list of security types in the client structure. (NOTE: Not really in the client structure) */
|
||||
switch (primaryType) {
|
||||
case rfbSecTypeNone:
|
||||
rfbRegisterSecurityHandler(&VncSecurityHandlerNone);
|
||||
break;
|
||||
case rfbSecTypeVncAuth:
|
||||
rfbRegisterSecurityHandler(&VncSecurityHandlerVncAuth);
|
||||
break;
|
||||
}
|
||||
|
||||
for (handler = securityHandlers;
|
||||
handler && size<MAX_SECURITY_TYPES; handler = handler->next) {
|
||||
buffer[size] = handler->type;
|
||||
size++;
|
||||
}
|
||||
buffer[0] = (unsigned char)size-1;
|
||||
|
||||
/* Send the list. */
|
||||
if (rfbWriteExact(cl, (char *)buffer, size) < 0) {
|
||||
rfbLogPerror("rfbSendSecurityTypeList: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* if count is 0, we need to send the reason and close the connection.
|
||||
*/
|
||||
if(size <= 1) {
|
||||
/* This means total count is Zero and so reason msg should be sent */
|
||||
/* The execution should never reach here */
|
||||
char* reason = "No authentication mode is registered!";
|
||||
|
||||
rfbClientSendString(cl, reason);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dispatch client input to rfbProcessClientSecurityType. */
|
||||
cl->state = RFB_SECURITY_TYPE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Tell the client what security type will be used (protocol 3.3).
|
||||
*/
|
||||
static void
|
||||
rfbSendSecurityType(rfbClientPtr cl, int32_t securityType)
|
||||
{
|
||||
uint32_t value32;
|
||||
|
||||
/* Send the value. */
|
||||
value32 = Swap32IfLE(securityType);
|
||||
if (rfbWriteExact(cl, (char *)&value32, 4) < 0) {
|
||||
rfbLogPerror("rfbSendSecurityType: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Decide what to do next. */
|
||||
switch (securityType) {
|
||||
case rfbSecTypeNone:
|
||||
/* Dispatch client input to rfbProcessClientInitMessage. */
|
||||
cl->state = RFB_INITIALISATION;
|
||||
break;
|
||||
case rfbSecTypeVncAuth:
|
||||
/* Begin the standard VNC authentication procedure. */
|
||||
rfbVncAuthSendChallenge(cl);
|
||||
break;
|
||||
default:
|
||||
/* Impossible case (hopefully). */
|
||||
rfbLogPerror("rfbSendSecurityType: assertion failed");
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbAuthNewClient is called right after negotiating the protocol
|
||||
* version. Depending on the protocol version, we send either a code
|
||||
* for authentication scheme to be used (protocol 3.3), or a list of
|
||||
* possible "security types" (protocol 3.7).
|
||||
*/
|
||||
|
||||
void
|
||||
rfbAuthNewClient(rfbClientPtr cl)
|
||||
{
|
||||
int32_t securityType = rfbSecTypeInvalid;
|
||||
|
||||
if (!cl->screen->authPasswdData || cl->reverseConnection) {
|
||||
/* chk if this condition is valid or not. */
|
||||
securityType = rfbSecTypeNone;
|
||||
} else if (cl->screen->authPasswdData) {
|
||||
securityType = rfbSecTypeVncAuth;
|
||||
}
|
||||
|
||||
if (cl->protocolMajorVersion==3 && cl->protocolMinorVersion < 7)
|
||||
{
|
||||
/* Make sure we use only RFB 3.3 compatible security types. */
|
||||
if (securityType == rfbSecTypeInvalid) {
|
||||
rfbLog("VNC authentication disabled - RFB 3.3 client rejected\n");
|
||||
rfbClientConnFailed(cl, "Your viewer cannot handle required "
|
||||
"authentication methods");
|
||||
return;
|
||||
}
|
||||
rfbSendSecurityType(cl, securityType);
|
||||
} else {
|
||||
/* Here it's ok when securityType is set to rfbSecTypeInvalid. */
|
||||
rfbSendSecurityTypeList(cl, securityType);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the security type chosen by the client (protocol 3.7).
|
||||
*/
|
||||
|
||||
void
|
||||
rfbProcessClientSecurityType(rfbClientPtr cl)
|
||||
{
|
||||
int n;
|
||||
uint8_t chosenType;
|
||||
rfbSecurityHandler* handler;
|
||||
|
||||
/* Read the security type. */
|
||||
n = rfbReadExact(cl, (char *)&chosenType, 1);
|
||||
if (n <= 0) {
|
||||
if (n == 0)
|
||||
rfbLog("rfbProcessClientSecurityType: client gone\n");
|
||||
else
|
||||
rfbLogPerror("rfbProcessClientSecurityType: read");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure it was present in the list sent by the server. */
|
||||
for (handler = securityHandlers; handler; handler = handler->next) {
|
||||
if (chosenType == handler->type) {
|
||||
rfbLog("rfbProcessClientSecurityType: executing handler for type %d\n", chosenType);
|
||||
handler->handler(cl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rfbLog("rfbProcessClientSecurityType: wrong security type (%d) requested\n", chosenType);
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbAuthProcessClientMessage is called when the client sends its
|
||||
* authentication response.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbAuthProcessClientMessage(rfbClientPtr cl)
|
||||
{
|
||||
int n;
|
||||
uint8_t response[CHALLENGESIZE];
|
||||
uint32_t authResult;
|
||||
|
||||
if ((n = rfbReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
|
||||
if (n != 0)
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: read");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) {
|
||||
rfbErr("rfbAuthProcessClientMessage: password check failed\n");
|
||||
authResult = Swap32IfLE(rfbVncAuthFailed);
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
}
|
||||
/* support RFB 3.8 clients, they expect a reason *why* it was disconnected */
|
||||
if (cl->protocolMinorVersion > 7) {
|
||||
rfbClientSendString(cl, "password check failed!");
|
||||
}
|
||||
else
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
authResult = Swap32IfLE(rfbVncAuthOK);
|
||||
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
cl->state = RFB_INITIALISATION;
|
||||
}
|
261
jni/vnc/LibVNCServer-0.9.9/libvncserver/cargs.c
Normal file
261
jni/vnc/LibVNCServer-0.9.9/libvncserver/cargs.c
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
* This parses the command line arguments. It was seperated from main.c by
|
||||
* Justin Dearing <jdeari01@longisland.poly.edu>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* LibVNCServer (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
|
||||
* Original OSXvnc (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* see GPL (latest version) for full details
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
extern int rfbStringToAddr(char *str, in_addr_t *iface);
|
||||
|
||||
void
|
||||
rfbUsage(void)
|
||||
{
|
||||
rfbProtocolExtension* extension;
|
||||
|
||||
fprintf(stderr, "-rfbport port TCP port for RFB protocol\n");
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
fprintf(stderr, "-rfbportv6 port TCP6 port for RFB protocol\n");
|
||||
#endif
|
||||
fprintf(stderr, "-rfbwait time max time in ms to wait for RFB client\n");
|
||||
fprintf(stderr, "-rfbauth passwd-file use authentication on RFB protocol\n"
|
||||
" (use 'storepasswd' to create a password file)\n");
|
||||
fprintf(stderr, "-rfbversion 3.x Set the version of the RFB we choose to advertise\n");
|
||||
fprintf(stderr, "-permitfiletransfer permit file transfer support\n");
|
||||
fprintf(stderr, "-passwd plain-password use authentication \n"
|
||||
" (use plain-password as password, USE AT YOUR RISK)\n");
|
||||
fprintf(stderr, "-deferupdate time time in ms to defer updates "
|
||||
"(default 40)\n");
|
||||
fprintf(stderr, "-deferptrupdate time time in ms to defer pointer updates"
|
||||
" (default none)\n");
|
||||
fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n");
|
||||
fprintf(stderr, "-alwaysshared always treat new clients as shared\n");
|
||||
fprintf(stderr, "-nevershared never treat new clients as shared\n");
|
||||
fprintf(stderr, "-dontdisconnect don't disconnect existing clients when a "
|
||||
"new non-shared\n"
|
||||
" connection comes in (refuse new connection "
|
||||
"instead)\n");
|
||||
fprintf(stderr, "-httpdir dir-path enable http server using dir-path home\n");
|
||||
fprintf(stderr, "-httpport portnum use portnum for http connection\n");
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
fprintf(stderr, "-httpportv6 portnum use portnum for IPv6 http connection\n");
|
||||
#endif
|
||||
fprintf(stderr, "-enablehttpproxy enable http proxy support\n");
|
||||
fprintf(stderr, "-progressive height enable progressive updating for slow links\n");
|
||||
fprintf(stderr, "-listen ipaddr listen for connections only on network interface with\n");
|
||||
fprintf(stderr, " addr ipaddr. '-listen localhost' and hostname work too.\n");
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
fprintf(stderr, "-listenv6 ipv6addr listen for IPv6 connections only on network interface with\n");
|
||||
fprintf(stderr, " addr ipv6addr. '-listen localhost' and hostname work too.\n");
|
||||
#endif
|
||||
|
||||
for(extension=rfbGetExtensionIterator();extension;extension=extension->next)
|
||||
if(extension->usage)
|
||||
extension->usage();
|
||||
rfbReleaseExtensionIterator();
|
||||
}
|
||||
|
||||
/* purges COUNT arguments from ARGV at POSITION and decrements ARGC.
|
||||
POSITION points to the first non purged argument afterwards. */
|
||||
void rfbPurgeArguments(int* argc,int* position,int count,char *argv[])
|
||||
{
|
||||
int amount=(*argc)-(*position)-count;
|
||||
if(amount)
|
||||
memmove(argv+(*position),argv+(*position)+count,sizeof(char*)*amount);
|
||||
(*argc)-=count;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
|
||||
{
|
||||
int i,i1;
|
||||
|
||||
if(!argc) return TRUE;
|
||||
|
||||
for (i = i1 = 1; i < *argc;) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
} else if (strcmp(argv[i], "-rfbport") == 0) { /* -rfbport port */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->port = atoi(argv[++i]);
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
} else if (strcmp(argv[i], "-rfbportv6") == 0) { /* -rfbportv6 port */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->ipv6port = atoi(argv[++i]);
|
||||
#endif
|
||||
} else if (strcmp(argv[i], "-rfbwait") == 0) { /* -rfbwait ms */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->maxClientWait = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->authPasswdData = argv[++i];
|
||||
|
||||
} else if (strcmp(argv[i], "-permitfiletransfer") == 0) { /* -permitfiletransfer */
|
||||
rfbScreen->permitFileTransfer = TRUE;
|
||||
} else if (strcmp(argv[i], "-rfbversion") == 0) { /* -rfbversion 3.6 */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
sscanf(argv[++i],"%d.%d", &rfbScreen->protocolMajorVersion, &rfbScreen->protocolMinorVersion);
|
||||
} else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
|
||||
char **passwds = malloc(sizeof(char**)*2);
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
passwds[0] = argv[++i];
|
||||
passwds[1] = NULL;
|
||||
rfbScreen->authPasswdData = (void*)passwds;
|
||||
rfbScreen->passwordCheck = rfbCheckPasswordByList;
|
||||
} else if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate milliseconds */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->deferUpdateTime = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-deferptrupdate") == 0) { /* -deferptrupdate milliseconds */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->deferPtrUpdateTime = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->desktopName = argv[++i];
|
||||
} else if (strcmp(argv[i], "-alwaysshared") == 0) {
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
} else if (strcmp(argv[i], "-nevershared") == 0) {
|
||||
rfbScreen->neverShared = TRUE;
|
||||
} else if (strcmp(argv[i], "-dontdisconnect") == 0) {
|
||||
rfbScreen->dontDisconnect = TRUE;
|
||||
} else if (strcmp(argv[i], "-httpdir") == 0) { /* -httpdir directory-path */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->httpDir = argv[++i];
|
||||
} else if (strcmp(argv[i], "-httpport") == 0) { /* -httpport portnum */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->httpPort = atoi(argv[++i]);
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
} else if (strcmp(argv[i], "-httpportv6") == 0) { /* -httpportv6 portnum */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->http6Port = atoi(argv[++i]);
|
||||
#endif
|
||||
} else if (strcmp(argv[i], "-enablehttpproxy") == 0) {
|
||||
rfbScreen->httpEnableProxyConnect = TRUE;
|
||||
} else if (strcmp(argv[i], "-progressive") == 0) { /* -httpport portnum */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->progressiveSliceHeight = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-listen") == 0) { /* -listen ipaddr */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
if (! rfbStringToAddr(argv[++i], &(rfbScreen->listenInterface))) {
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef LIBVNCSERVER_IPv6
|
||||
} else if (strcmp(argv[i], "-listenv6") == 0) { /* -listenv6 ipv6addr */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->listen6Interface = argv[++i];
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
|
||||
} else if (strcmp(argv[i], "-sslkeyfile") == 0) { /* -sslkeyfile sslkeyfile */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->sslkeyfile = argv[++i];
|
||||
} else if (strcmp(argv[i], "-sslcertfile") == 0) { /* -sslcertfile sslcertfile */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->sslcertfile = argv[++i];
|
||||
#endif
|
||||
} else {
|
||||
rfbProtocolExtension* extension;
|
||||
int handled=0;
|
||||
|
||||
for(extension=rfbGetExtensionIterator();handled==0 && extension;
|
||||
extension=extension->next)
|
||||
if(extension->processArgument)
|
||||
handled = extension->processArgument(*argc - i, argv + i);
|
||||
rfbReleaseExtensionIterator();
|
||||
|
||||
if(handled==0) {
|
||||
i++;
|
||||
i1=i;
|
||||
continue;
|
||||
}
|
||||
i+=handled-1;
|
||||
}
|
||||
/* we just remove the processed arguments from the list */
|
||||
rfbPurgeArguments(argc,&i1,i-i1+1,argv);
|
||||
i=i1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[])
|
||||
{
|
||||
int i,i1;
|
||||
|
||||
if(!argc) return TRUE;
|
||||
for (i = i1 = 1; i < *argc-1;) {
|
||||
if (strcmp(argv[i], "-bpp") == 0) {
|
||||
*bpp = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-width") == 0) {
|
||||
*width = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-height") == 0) {
|
||||
*height = atoi(argv[++i]);
|
||||
} else {
|
||||
i++;
|
||||
i1=i;
|
||||
continue;
|
||||
}
|
||||
rfbPurgeArguments(argc,&i1,i-i1,argv);
|
||||
i=i1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
342
jni/vnc/LibVNCServer-0.9.9/libvncserver/corre.c
Normal file
342
jni/vnc/LibVNCServer-0.9.9/libvncserver/corre.c
Normal file
@ -0,0 +1,342 @@
|
||||
/*
|
||||
* corre.c
|
||||
*
|
||||
* Routines to implement Compact Rise-and-Run-length Encoding (CoRRE). This
|
||||
* code is based on krw's original javatel rfbserver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 RealVNC Ltd.
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
/*
|
||||
* cl->beforeEncBuf contains pixel data in the client's format.
|
||||
* cl->afterEncBuf contains the RRE encoded version. If the RRE encoded version is
|
||||
* larger than the raw data or if it exceeds cl->afterEncBufSize then
|
||||
* raw encoding is used instead.
|
||||
*/
|
||||
|
||||
static int subrectEncode8(rfbClientPtr cl, uint8_t *data, int w, int h);
|
||||
static int subrectEncode16(rfbClientPtr cl, uint16_t *data, int w, int h);
|
||||
static int subrectEncode32(rfbClientPtr cl, uint32_t *data, int w, int h);
|
||||
static uint32_t getBgColour(char *data, int size, int bpp);
|
||||
static rfbBool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
|
||||
int w, int h);
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendRectEncodingCoRRE - send an arbitrary size rectangle using CoRRE
|
||||
* encoding.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendRectEncodingCoRRE(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
if (h > cl->correMaxHeight) {
|
||||
return (rfbSendRectEncodingCoRRE(cl, x, y, w, cl->correMaxHeight) &&
|
||||
rfbSendRectEncodingCoRRE(cl, x, y + cl->correMaxHeight, w,
|
||||
h - cl->correMaxHeight));
|
||||
}
|
||||
|
||||
if (w > cl->correMaxWidth) {
|
||||
return (rfbSendRectEncodingCoRRE(cl, x, y, cl->correMaxWidth, h) &&
|
||||
rfbSendRectEncodingCoRRE(cl, x + cl->correMaxWidth, y,
|
||||
w - cl->correMaxWidth, h));
|
||||
}
|
||||
|
||||
rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendSmallRectEncodingCoRRE - send a small (guaranteed < 256x256)
|
||||
* rectangle using CoRRE encoding.
|
||||
*/
|
||||
|
||||
static rfbBool
|
||||
rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
rfbRREHeader hdr;
|
||||
int nSubrects;
|
||||
int i;
|
||||
char *fbptr = (cl->scaledScreen->frameBuffer + (cl->scaledScreen->paddedWidthInBytes * y)
|
||||
+ (x * (cl->scaledScreen->bitsPerPixel / 8)));
|
||||
|
||||
int maxRawSize = (cl->scaledScreen->width * cl->scaledScreen->height
|
||||
* (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->beforeEncBufSize < maxRawSize) {
|
||||
cl->beforeEncBufSize = maxRawSize;
|
||||
if (cl->beforeEncBuf == NULL)
|
||||
cl->beforeEncBuf = (char *)malloc(cl->beforeEncBufSize);
|
||||
else
|
||||
cl->beforeEncBuf = (char *)realloc(cl->beforeEncBuf, cl->beforeEncBufSize);
|
||||
}
|
||||
|
||||
if (cl->afterEncBufSize < maxRawSize) {
|
||||
cl->afterEncBufSize = maxRawSize;
|
||||
if (cl->afterEncBuf == NULL)
|
||||
cl->afterEncBuf = (char *)malloc(cl->afterEncBufSize);
|
||||
else
|
||||
cl->afterEncBuf = (char *)realloc(cl->afterEncBuf, cl->afterEncBufSize);
|
||||
}
|
||||
|
||||
(*cl->translateFn)(cl->translateLookupTable,&(cl->screen->serverFormat),
|
||||
&cl->format, fbptr, cl->beforeEncBuf,
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h);
|
||||
|
||||
switch (cl->format.bitsPerPixel) {
|
||||
case 8:
|
||||
nSubrects = subrectEncode8(cl, (uint8_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 16:
|
||||
nSubrects = subrectEncode16(cl, (uint16_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 32:
|
||||
nSubrects = subrectEncode32(cl, (uint32_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
default:
|
||||
rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nSubrects < 0) {
|
||||
|
||||
/* RRE encoding was too large, use raw */
|
||||
|
||||
return rfbSendRectEncodingRaw(cl, x, y, w, h);
|
||||
}
|
||||
|
||||
rfbStatRecordEncodingSent(cl,rfbEncodingCoRRE,
|
||||
sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + cl->afterEncBufLen,
|
||||
sz_rfbFramebufferUpdateRectHeader + w * h * (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
|
||||
> UPDATE_BUF_SIZE)
|
||||
{
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.r.x = Swap16IfLE(x);
|
||||
rect.r.y = Swap16IfLE(y);
|
||||
rect.r.w = Swap16IfLE(w);
|
||||
rect.r.h = Swap16IfLE(h);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingCoRRE);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
hdr.nSubrects = Swap32IfLE(nSubrects);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&hdr, sz_rfbRREHeader);
|
||||
cl->ublen += sz_rfbRREHeader;
|
||||
|
||||
for (i = 0; i < cl->afterEncBufLen;) {
|
||||
|
||||
int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen;
|
||||
|
||||
if (i + bytesToCopy > cl->afterEncBufLen) {
|
||||
bytesToCopy = cl->afterEncBufLen - i;
|
||||
}
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], &cl->afterEncBuf[i], bytesToCopy);
|
||||
|
||||
cl->ublen += bytesToCopy;
|
||||
i += bytesToCopy;
|
||||
|
||||
if (cl->ublen == UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* subrectEncode() encodes the given multicoloured rectangle as a background
|
||||
* colour overwritten by single-coloured rectangles. It returns the number
|
||||
* of subrectangles in the encoded buffer, or -1 if subrect encoding won't
|
||||
* fit in the buffer. It puts the encoded rectangles in cl->afterEncBuf. The
|
||||
* single-colour rectangle partition is not optimal, but does find the biggest
|
||||
* horizontal or vertical rectangle top-left anchored to each consecutive
|
||||
* coordinate position.
|
||||
*
|
||||
* The coding scheme is simply [<bgcolour><subrect><subrect>...] where each
|
||||
* <subrect> is [<colour><x><y><w><h>].
|
||||
*/
|
||||
|
||||
#define DEFINE_SUBRECT_ENCODE(bpp) \
|
||||
static int \
|
||||
subrectEncode##bpp(rfbClientPtr client, uint##bpp##_t *data, int w, int h) { \
|
||||
uint##bpp##_t cl; \
|
||||
rfbCoRRERectangle subrect; \
|
||||
int x,y; \
|
||||
int i,j; \
|
||||
int hx=0,hy,vx=0,vy; \
|
||||
int hyflag; \
|
||||
uint##bpp##_t *seg; \
|
||||
uint##bpp##_t *line; \
|
||||
int hw,hh,vw,vh; \
|
||||
int thex,they,thew,theh; \
|
||||
int numsubs = 0; \
|
||||
int newLen; \
|
||||
uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp); \
|
||||
\
|
||||
*((uint##bpp##_t*)client->afterEncBuf) = bg; \
|
||||
\
|
||||
client->afterEncBufLen = (bpp/8); \
|
||||
\
|
||||
for (y=0; y<h; y++) { \
|
||||
line = data+(y*w); \
|
||||
for (x=0; x<w; x++) { \
|
||||
if (line[x] != bg) { \
|
||||
cl = line[x]; \
|
||||
hy = y-1; \
|
||||
hyflag = 1; \
|
||||
for (j=y; j<h; j++) { \
|
||||
seg = data+(j*w); \
|
||||
if (seg[x] != cl) {break;} \
|
||||
i = x; \
|
||||
while ((seg[i] == cl) && (i < w)) i += 1; \
|
||||
i -= 1; \
|
||||
if (j == y) vx = hx = i; \
|
||||
if (i < vx) vx = i; \
|
||||
if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \
|
||||
} \
|
||||
vy = j-1; \
|
||||
\
|
||||
/* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \
|
||||
* We'll choose the bigger of the two. \
|
||||
*/ \
|
||||
hw = hx-x+1; \
|
||||
hh = hy-y+1; \
|
||||
vw = vx-x+1; \
|
||||
vh = vy-y+1; \
|
||||
\
|
||||
thex = x; \
|
||||
they = y; \
|
||||
\
|
||||
if ((hw*hh) > (vw*vh)) { \
|
||||
thew = hw; \
|
||||
theh = hh; \
|
||||
} else { \
|
||||
thew = vw; \
|
||||
theh = vh; \
|
||||
} \
|
||||
\
|
||||
subrect.x = thex; \
|
||||
subrect.y = they; \
|
||||
subrect.w = thew; \
|
||||
subrect.h = theh; \
|
||||
\
|
||||
newLen = client->afterEncBufLen + (bpp/8) + sz_rfbCoRRERectangle; \
|
||||
if ((newLen > (w * h * (bpp/8))) || (newLen > client->afterEncBufSize)) \
|
||||
return -1; \
|
||||
\
|
||||
numsubs += 1; \
|
||||
*((uint##bpp##_t*)(client->afterEncBuf + client->afterEncBufLen)) = cl; \
|
||||
client->afterEncBufLen += (bpp/8); \
|
||||
memcpy(&client->afterEncBuf[client->afterEncBufLen],&subrect,sz_rfbCoRRERectangle); \
|
||||
client->afterEncBufLen += sz_rfbCoRRERectangle; \
|
||||
\
|
||||
/* \
|
||||
* Now mark the subrect as done. \
|
||||
*/ \
|
||||
for (j=they; j < (they+theh); j++) { \
|
||||
for (i=thex; i < (thex+thew); i++) { \
|
||||
data[j*w+i] = bg; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return numsubs; \
|
||||
}
|
||||
|
||||
DEFINE_SUBRECT_ENCODE(8)
|
||||
DEFINE_SUBRECT_ENCODE(16)
|
||||
DEFINE_SUBRECT_ENCODE(32)
|
||||
|
||||
|
||||
/*
|
||||
* getBgColour() gets the most prevalent colour in a byte array.
|
||||
*/
|
||||
static uint32_t
|
||||
getBgColour(char *data, int size, int bpp)
|
||||
{
|
||||
|
||||
#define NUMCLRS 256
|
||||
|
||||
static int counts[NUMCLRS];
|
||||
int i,j,k;
|
||||
|
||||
int maxcount = 0;
|
||||
uint8_t maxclr = 0;
|
||||
|
||||
if (bpp != 8) {
|
||||
if (bpp == 16) {
|
||||
return ((uint16_t *)data)[0];
|
||||
} else if (bpp == 32) {
|
||||
return ((uint32_t *)data)[0];
|
||||
} else {
|
||||
rfbLog("getBgColour: bpp %d?\n",bpp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUMCLRS; i++) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
for (j=0; j<size; j++) {
|
||||
k = (int)(((uint8_t *)data)[j]);
|
||||
if (k >= NUMCLRS) {
|
||||
rfbLog("getBgColour: unusual colour = %d\n", k);
|
||||
return 0;
|
||||
}
|
||||
counts[k] += 1;
|
||||
if (counts[k] > maxcount) {
|
||||
maxcount = counts[k];
|
||||
maxclr = ((uint8_t *)data)[j];
|
||||
}
|
||||
}
|
||||
|
||||
return maxclr;
|
||||
}
|
756
jni/vnc/LibVNCServer-0.9.9/libvncserver/cursor.c
Normal file
756
jni/vnc/LibVNCServer-0.9.9/libvncserver/cursor.c
Normal file
@ -0,0 +1,756 @@
|
||||
/*
|
||||
* cursor.c - support for cursor shape updates.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
#include <rfb/rfbregion.h>
|
||||
#include "private.h"
|
||||
|
||||
void rfbScaledScreenUpdate(rfbScreenInfoPtr screen, int x1, int y1, int x2, int y2);
|
||||
|
||||
/*
|
||||
* Send cursor shape either in X-style format or in client pixel format.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendCursorShape(rfbClientPtr cl)
|
||||
{
|
||||
rfbCursorPtr pCursor;
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
rfbXCursorColors colors;
|
||||
int saved_ublen;
|
||||
int bitmapRowBytes, maskBytes, dataBytes;
|
||||
int i, j;
|
||||
uint8_t *bitmapData;
|
||||
uint8_t bitmapByte;
|
||||
|
||||
/* TODO: scale the cursor data to the correct size */
|
||||
|
||||
pCursor = cl->screen->getCursorPtr(cl);
|
||||
/*if(!pCursor) return TRUE;*/
|
||||
|
||||
if (cl->useRichCursorEncoding) {
|
||||
if(pCursor && !pCursor->richSource)
|
||||
rfbMakeRichCursorFromXCursor(cl->screen,pCursor);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingRichCursor);
|
||||
} else {
|
||||
if(pCursor && !pCursor->source)
|
||||
rfbMakeXCursorFromRichCursor(cl->screen,pCursor);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingXCursor);
|
||||
}
|
||||
|
||||
/* If there is no cursor, send update with empty cursor data. */
|
||||
|
||||
if ( pCursor && pCursor->width == 1 &&
|
||||
pCursor->height == 1 &&
|
||||
pCursor->mask[0] == 0 ) {
|
||||
pCursor = NULL;
|
||||
}
|
||||
|
||||
if (pCursor == NULL) {
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE ) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
rect.r.x = rect.r.y = 0;
|
||||
rect.r.w = rect.r.h = 0;
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Calculate data sizes. */
|
||||
|
||||
bitmapRowBytes = (pCursor->width + 7) / 8;
|
||||
maskBytes = bitmapRowBytes * pCursor->height;
|
||||
dataBytes = (cl->useRichCursorEncoding) ?
|
||||
(pCursor->width * pCursor->height *
|
||||
(cl->format.bitsPerPixel / 8)) : maskBytes;
|
||||
|
||||
/* Send buffer contents if needed. */
|
||||
|
||||
if ( cl->ublen + sz_rfbFramebufferUpdateRectHeader +
|
||||
sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( cl->ublen + sz_rfbFramebufferUpdateRectHeader +
|
||||
sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) {
|
||||
return FALSE; /* FIXME. */
|
||||
}
|
||||
|
||||
saved_ublen = cl->ublen;
|
||||
|
||||
/* Prepare rectangle header. */
|
||||
|
||||
rect.r.x = Swap16IfLE(pCursor->xhot);
|
||||
rect.r.y = Swap16IfLE(pCursor->yhot);
|
||||
rect.r.w = Swap16IfLE(pCursor->width);
|
||||
rect.r.h = Swap16IfLE(pCursor->height);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
/* Prepare actual cursor data (depends on encoding used). */
|
||||
|
||||
if (!cl->useRichCursorEncoding) {
|
||||
/* XCursor encoding. */
|
||||
colors.foreRed = (char)(pCursor->foreRed >> 8);
|
||||
colors.foreGreen = (char)(pCursor->foreGreen >> 8);
|
||||
colors.foreBlue = (char)(pCursor->foreBlue >> 8);
|
||||
colors.backRed = (char)(pCursor->backRed >> 8);
|
||||
colors.backGreen = (char)(pCursor->backGreen >> 8);
|
||||
colors.backBlue = (char)(pCursor->backBlue >> 8);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&colors, sz_rfbXCursorColors);
|
||||
cl->ublen += sz_rfbXCursorColors;
|
||||
|
||||
bitmapData = (uint8_t *)pCursor->source;
|
||||
|
||||
for (i = 0; i < pCursor->height; i++) {
|
||||
for (j = 0; j < bitmapRowBytes; j++) {
|
||||
bitmapByte = bitmapData[i * bitmapRowBytes + j];
|
||||
cl->updateBuf[cl->ublen++] = (char)bitmapByte;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* RichCursor encoding. */
|
||||
int bpp1=cl->screen->serverFormat.bitsPerPixel/8,
|
||||
bpp2=cl->format.bitsPerPixel/8;
|
||||
(*cl->translateFn)(cl->translateLookupTable,
|
||||
&(cl->screen->serverFormat),
|
||||
&cl->format, (char*)pCursor->richSource,
|
||||
&cl->updateBuf[cl->ublen],
|
||||
pCursor->width*bpp1, pCursor->width, pCursor->height);
|
||||
|
||||
cl->ublen += pCursor->width*bpp2*pCursor->height;
|
||||
}
|
||||
|
||||
/* Prepare transparency mask. */
|
||||
|
||||
bitmapData = (uint8_t *)pCursor->mask;
|
||||
|
||||
for (i = 0; i < pCursor->height; i++) {
|
||||
for (j = 0; j < bitmapRowBytes; j++) {
|
||||
bitmapByte = bitmapData[i * bitmapRowBytes + j];
|
||||
cl->updateBuf[cl->ublen++] = (char)bitmapByte;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send everything we have prepared in the cl->updateBuf[]. */
|
||||
rfbStatRecordEncodingSent(cl, (cl->useRichCursorEncoding ? rfbEncodingRichCursor : rfbEncodingXCursor),
|
||||
sz_rfbFramebufferUpdateRectHeader + (cl->ublen - saved_ublen), sz_rfbFramebufferUpdateRectHeader + (cl->ublen - saved_ublen));
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send cursor position (PointerPos pseudo-encoding).
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendCursorPos(rfbClientPtr cl)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.encoding = Swap32IfLE(rfbEncodingPointerPos);
|
||||
rect.r.x = Swap16IfLE(cl->screen->cursorX);
|
||||
rect.r.y = Swap16IfLE(cl->screen->cursorY);
|
||||
rect.r.w = 0;
|
||||
rect.r.h = 0;
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
rfbStatRecordEncodingSent(cl, rfbEncodingPointerPos, sz_rfbFramebufferUpdateRectHeader, sz_rfbFramebufferUpdateRectHeader);
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* conversion routine for predefined cursors in LSB order */
|
||||
unsigned char rfbReverseByte[0x100] = {
|
||||
/* copied from Xvnc/lib/font/util/utilbitmap.c */
|
||||
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
|
||||
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
|
||||
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
|
||||
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
|
||||
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
|
||||
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
|
||||
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
|
||||
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
|
||||
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
|
||||
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
|
||||
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
|
||||
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
|
||||
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
|
||||
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
|
||||
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
|
||||
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
|
||||
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
|
||||
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
|
||||
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
|
||||
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
|
||||
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
|
||||
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
|
||||
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
|
||||
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
|
||||
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
|
||||
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
|
||||
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
|
||||
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
|
||||
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
|
||||
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
|
||||
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
|
||||
};
|
||||
|
||||
void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap)
|
||||
{
|
||||
int i,t=(width+7)/8*height;
|
||||
for(i=0;i<t;i++)
|
||||
bitmap[i]=rfbReverseByte[(int)bitmap[i]];
|
||||
}
|
||||
|
||||
/* Cursor creation. You "paint" a cursor and let these routines do the work */
|
||||
|
||||
rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString)
|
||||
{
|
||||
int i,j,w=(width+7)/8;
|
||||
rfbCursorPtr cursor = (rfbCursorPtr)calloc(1,sizeof(rfbCursor));
|
||||
char* cp;
|
||||
unsigned char bit;
|
||||
|
||||
cursor->cleanup=TRUE;
|
||||
cursor->width=width;
|
||||
cursor->height=height;
|
||||
/*cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;*/
|
||||
cursor->foreRed=cursor->foreGreen=cursor->foreBlue=0xffff;
|
||||
|
||||
cursor->source = (unsigned char*)calloc(w,height);
|
||||
cursor->cleanupSource = TRUE;
|
||||
for(j=0,cp=cursorString;j<height;j++)
|
||||
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
|
||||
if(*cp!=' ') cursor->source[j*w+i/8]|=bit;
|
||||
|
||||
if(maskString) {
|
||||
cursor->mask = (unsigned char*)calloc(w,height);
|
||||
for(j=0,cp=maskString;j<height;j++)
|
||||
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
|
||||
if(*cp!=' ') cursor->mask[j*w+i/8]|=bit;
|
||||
} else
|
||||
cursor->mask = (unsigned char*)rfbMakeMaskForXCursor(width,height,(char*)cursor->source);
|
||||
cursor->cleanupMask = TRUE;
|
||||
|
||||
return(cursor);
|
||||
}
|
||||
|
||||
char* rfbMakeMaskForXCursor(int width,int height,char* source)
|
||||
{
|
||||
int i,j,w=(width+7)/8;
|
||||
char* mask=(char*)calloc(w,height);
|
||||
unsigned char c;
|
||||
|
||||
for(j=0;j<height;j++)
|
||||
for(i=w-1;i>=0;i--) {
|
||||
c=source[j*w+i];
|
||||
if(j>0) c|=source[(j-1)*w+i];
|
||||
if(j<height-1) c|=source[(j+1)*w+i];
|
||||
|
||||
if(i>0 && (c&0x80))
|
||||
mask[j*w+i-1]|=0x01;
|
||||
if(i<w-1 && (c&0x01))
|
||||
mask[j*w+i+1]|=0x80;
|
||||
|
||||
mask[j*w+i]|=(c<<1)|c|(c>>1);
|
||||
}
|
||||
|
||||
return(mask);
|
||||
}
|
||||
|
||||
/* this function dithers the alpha using Floyd-Steinberg */
|
||||
|
||||
char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource)
|
||||
{
|
||||
int* error=(int*)calloc(sizeof(int),width);
|
||||
int i,j,currentError=0,maskStride=(width+7)/8;
|
||||
unsigned char* result=(unsigned char*)calloc(maskStride,height);
|
||||
|
||||
for(j=0;j<height;j++)
|
||||
for(i=0;i<width;i++) {
|
||||
int right,middle,left;
|
||||
currentError+=alphaSource[i+width*j]+error[i];
|
||||
|
||||
if(currentError<0x80) {
|
||||
/* set to transparent */
|
||||
/* alpha was treated as 0 */
|
||||
} else {
|
||||
/* set to solid */
|
||||
result[i/8+j*maskStride]|=(0x100>>(i&7));
|
||||
/* alpha was treated as 0xff */
|
||||
currentError-=0xff;
|
||||
}
|
||||
/* propagate to next row */
|
||||
right=currentError/16;
|
||||
middle=currentError*5/16;
|
||||
left=currentError*3/16;
|
||||
currentError-=right+middle+left;
|
||||
error[i]=right;
|
||||
if(i>0) {
|
||||
error[i-1]=middle;
|
||||
if(i>1)
|
||||
error[i-2]=left;
|
||||
}
|
||||
}
|
||||
free(error);
|
||||
return (char *) result;
|
||||
}
|
||||
|
||||
void rfbFreeCursor(rfbCursorPtr cursor)
|
||||
{
|
||||
if(cursor) {
|
||||
if(cursor->cleanupRichSource && cursor->richSource)
|
||||
free(cursor->richSource);
|
||||
if(cursor->cleanupRichSource && cursor->alphaSource)
|
||||
free(cursor->alphaSource);
|
||||
if(cursor->cleanupSource && cursor->source)
|
||||
free(cursor->source);
|
||||
if(cursor->cleanupMask && cursor->mask)
|
||||
free(cursor->mask);
|
||||
if(cursor->cleanup)
|
||||
free(cursor);
|
||||
else {
|
||||
cursor->cleanup=cursor->cleanupSource=cursor->cleanupMask
|
||||
=cursor->cleanupRichSource=FALSE;
|
||||
cursor->source=cursor->mask=cursor->richSource=NULL;
|
||||
cursor->alphaSource=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* background and foregroud colour have to be set beforehand */
|
||||
void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
|
||||
{
|
||||
rfbPixelFormat* format=&rfbScreen->serverFormat;
|
||||
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8,
|
||||
width=cursor->width*bpp;
|
||||
uint32_t background;
|
||||
char *back=(char*)&background;
|
||||
unsigned char bit;
|
||||
int interp = 0, db = 0;
|
||||
|
||||
if(cursor->source && cursor->cleanupSource)
|
||||
free(cursor->source);
|
||||
cursor->source=(unsigned char*)calloc(w,cursor->height);
|
||||
cursor->cleanupSource=TRUE;
|
||||
|
||||
if(format->bigEndian) {
|
||||
back+=4-bpp;
|
||||
}
|
||||
|
||||
/* all zeros means we should interpolate to black+white ourselves */
|
||||
if (!cursor->backRed && !cursor->backGreen && !cursor->backBlue &&
|
||||
!cursor->foreRed && !cursor->foreGreen && !cursor->foreBlue) {
|
||||
if (format->trueColour && (bpp == 1 || bpp == 2 || bpp == 4)) {
|
||||
interp = 1;
|
||||
cursor->foreRed = cursor->foreGreen = cursor->foreBlue = 0xffff;
|
||||
}
|
||||
}
|
||||
|
||||
background = ((format->redMax * cursor->backRed) / 0xffff) << format->redShift |
|
||||
((format->greenMax * cursor->backGreen) / 0xffff) << format->greenShift |
|
||||
((format->blueMax * cursor->backBlue) / 0xffff) << format->blueShift;
|
||||
|
||||
#define SETRGB(u) \
|
||||
r = (255 * (((format->redMax << format->redShift) & (*u)) >> format->redShift)) / format->redMax; \
|
||||
g = (255 * (((format->greenMax << format->greenShift) & (*u)) >> format->greenShift)) / format->greenMax; \
|
||||
b = (255 * (((format->blueMax << format->blueShift) & (*u)) >> format->blueShift)) / format->blueMax;
|
||||
|
||||
if (db) fprintf(stderr, "interp: %d\n", interp);
|
||||
|
||||
for(j=0;j<cursor->height;j++) {
|
||||
for(i=0,bit=0x80;i<cursor->width;i++,bit=(bit&1)?0x80:bit>>1) {
|
||||
if (interp) {
|
||||
int r = 0, g = 0, b = 0, grey;
|
||||
unsigned char *p = cursor->richSource+j*width+i*bpp;
|
||||
if (bpp == 1) {
|
||||
unsigned char* uc = (unsigned char*) p;
|
||||
SETRGB(uc);
|
||||
} else if (bpp == 2) {
|
||||
unsigned short* us = (unsigned short*) p;
|
||||
SETRGB(us);
|
||||
} else if (bpp == 4) {
|
||||
unsigned int* ui = (unsigned int*) p;
|
||||
SETRGB(ui);
|
||||
}
|
||||
grey = (r + g + b) / 3;
|
||||
if (grey >= 128) {
|
||||
cursor->source[j*w+i/8]|=bit;
|
||||
if (db) fprintf(stderr, "1");
|
||||
} else {
|
||||
if (db) fprintf(stderr, "0");
|
||||
}
|
||||
|
||||
} else if(memcmp(cursor->richSource+j*width+i*bpp, back, bpp)) {
|
||||
cursor->source[j*w+i/8]|=bit;
|
||||
}
|
||||
}
|
||||
if (db) fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
|
||||
{
|
||||
rfbPixelFormat* format=&rfbScreen->serverFormat;
|
||||
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8;
|
||||
uint32_t background,foreground;
|
||||
char *back=(char*)&background,*fore=(char*)&foreground;
|
||||
unsigned char *cp;
|
||||
unsigned char bit;
|
||||
|
||||
if(cursor->richSource && cursor->cleanupRichSource)
|
||||
free(cursor->richSource);
|
||||
cp=cursor->richSource=(unsigned char*)calloc(cursor->width*bpp,cursor->height);
|
||||
cursor->cleanupRichSource=TRUE;
|
||||
|
||||
if(format->bigEndian) {
|
||||
back+=4-bpp;
|
||||
fore+=4-bpp;
|
||||
}
|
||||
|
||||
background=cursor->backRed<<format->redShift|
|
||||
cursor->backGreen<<format->greenShift|cursor->backBlue<<format->blueShift;
|
||||
foreground=cursor->foreRed<<format->redShift|
|
||||
cursor->foreGreen<<format->greenShift|cursor->foreBlue<<format->blueShift;
|
||||
|
||||
for(j=0;j<cursor->height;j++)
|
||||
for(i=0,bit=0x80;i<cursor->width;i++,bit=(bit&1)?0x80:bit>>1,cp+=bpp)
|
||||
if(cursor->source[j*w+i/8]&bit) memcpy(cp,fore,bpp);
|
||||
else memcpy(cp,back,bpp);
|
||||
}
|
||||
|
||||
/* functions to draw/hide cursor directly in the frame buffer */
|
||||
|
||||
void rfbHideCursor(rfbClientPtr cl)
|
||||
{
|
||||
rfbScreenInfoPtr s=cl->screen;
|
||||
rfbCursorPtr c=s->cursor;
|
||||
int j,x1,x2,y1,y2,bpp=s->serverFormat.bitsPerPixel/8,
|
||||
rowstride=s->paddedWidthInBytes;
|
||||
LOCK(s->cursorMutex);
|
||||
if(!c) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* restore what is under the cursor */
|
||||
x1=cl->cursorX-c->xhot;
|
||||
x2=x1+c->width;
|
||||
if(x1<0) x1=0;
|
||||
if(x2>=s->width) x2=s->width-1;
|
||||
x2-=x1; if(x2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
y1=cl->cursorY-c->yhot;
|
||||
y2=y1+c->height;
|
||||
if(y1<0) y1=0;
|
||||
if(y2>=s->height) y2=s->height-1;
|
||||
y2-=y1; if(y2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get saved data */
|
||||
for(j=0;j<y2;j++)
|
||||
memcpy(s->frameBuffer+(y1+j)*rowstride+x1*bpp,
|
||||
s->underCursorBuffer+j*x2*bpp,
|
||||
x2*bpp);
|
||||
|
||||
/* Copy to all scaled versions */
|
||||
rfbScaledScreenUpdate(s, x1, y1, x1+x2, y1+y2);
|
||||
|
||||
UNLOCK(s->cursorMutex);
|
||||
}
|
||||
|
||||
void rfbShowCursor(rfbClientPtr cl)
|
||||
{
|
||||
rfbScreenInfoPtr s=cl->screen;
|
||||
rfbCursorPtr c=s->cursor;
|
||||
int i,j,x1,x2,y1,y2,i1,j1,bpp=s->serverFormat.bitsPerPixel/8,
|
||||
rowstride=s->paddedWidthInBytes,
|
||||
bufSize,w;
|
||||
rfbBool wasChanged=FALSE;
|
||||
|
||||
if(!c) return;
|
||||
LOCK(s->cursorMutex);
|
||||
|
||||
bufSize=c->width*c->height*bpp;
|
||||
w=(c->width+7)/8;
|
||||
if(s->underCursorBufferLen<bufSize) {
|
||||
if(s->underCursorBuffer!=NULL)
|
||||
free(s->underCursorBuffer);
|
||||
s->underCursorBuffer=malloc(bufSize);
|
||||
s->underCursorBufferLen=bufSize;
|
||||
}
|
||||
|
||||
/* save what is under the cursor */
|
||||
i1=j1=0; /* offset in cursor */
|
||||
x1=cl->cursorX-c->xhot;
|
||||
x2=x1+c->width;
|
||||
if(x1<0) { i1=-x1; x1=0; }
|
||||
if(x2>=s->width) x2=s->width-1;
|
||||
x2-=x1; if(x2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return; /* nothing to do */
|
||||
}
|
||||
|
||||
y1=cl->cursorY-c->yhot;
|
||||
y2=y1+c->height;
|
||||
if(y1<0) { j1=-y1; y1=0; }
|
||||
if(y2>=s->height) y2=s->height-1;
|
||||
y2-=y1; if(y2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return; /* nothing to do */
|
||||
}
|
||||
|
||||
/* save data */
|
||||
for(j=0;j<y2;j++) {
|
||||
char* dest=s->underCursorBuffer+j*x2*bpp;
|
||||
const char* src=s->frameBuffer+(y1+j)*rowstride+x1*bpp;
|
||||
unsigned int count=x2*bpp;
|
||||
if(wasChanged || memcmp(dest,src,count)) {
|
||||
wasChanged=TRUE;
|
||||
memcpy(dest,src,count);
|
||||
}
|
||||
}
|
||||
|
||||
if(!c->richSource)
|
||||
rfbMakeRichCursorFromXCursor(s,c);
|
||||
|
||||
if (c->alphaSource) {
|
||||
int rmax, rshift;
|
||||
int gmax, gshift;
|
||||
int bmax, bshift;
|
||||
int amax = 255; /* alphaSource is always 8bits of info per pixel */
|
||||
unsigned int rmask, gmask, bmask;
|
||||
|
||||
rmax = s->serverFormat.redMax;
|
||||
gmax = s->serverFormat.greenMax;
|
||||
bmax = s->serverFormat.blueMax;
|
||||
rshift = s->serverFormat.redShift;
|
||||
gshift = s->serverFormat.greenShift;
|
||||
bshift = s->serverFormat.blueShift;
|
||||
|
||||
rmask = (rmax << rshift);
|
||||
gmask = (gmax << gshift);
|
||||
bmask = (bmax << bshift);
|
||||
|
||||
for(j=0;j<y2;j++) {
|
||||
for(i=0;i<x2;i++) {
|
||||
/*
|
||||
* we loop over the whole cursor ignoring c->mask[],
|
||||
* using the extracted alpha value instead.
|
||||
*/
|
||||
char *dest;
|
||||
unsigned char *src, *aptr;
|
||||
unsigned int val, dval, sval;
|
||||
int rdst, gdst, bdst; /* fb RGB */
|
||||
int asrc, rsrc, gsrc, bsrc; /* rich source ARGB */
|
||||
|
||||
dest = s->frameBuffer + (j+y1)*rowstride + (i+x1)*bpp;
|
||||
src = c->richSource + (j+j1)*c->width*bpp + (i+i1)*bpp;
|
||||
aptr = c->alphaSource + (j+j1)*c->width + (i+i1);
|
||||
|
||||
asrc = *aptr;
|
||||
if (!asrc) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bpp == 1) {
|
||||
dval = *((unsigned char*) dest);
|
||||
sval = *((unsigned char*) src);
|
||||
} else if (bpp == 2) {
|
||||
dval = *((unsigned short*) dest);
|
||||
sval = *((unsigned short*) src);
|
||||
} else if (bpp == 3) {
|
||||
unsigned char *dst = (unsigned char *) dest;
|
||||
dval = 0;
|
||||
dval |= ((*(dst+0)) << 0);
|
||||
dval |= ((*(dst+1)) << 8);
|
||||
dval |= ((*(dst+2)) << 16);
|
||||
sval = 0;
|
||||
sval |= ((*(src+0)) << 0);
|
||||
sval |= ((*(src+1)) << 8);
|
||||
sval |= ((*(src+2)) << 16);
|
||||
} else if (bpp == 4) {
|
||||
dval = *((unsigned int*) dest);
|
||||
sval = *((unsigned int*) src);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* extract dest and src RGB */
|
||||
rdst = (dval & rmask) >> rshift; /* fb */
|
||||
gdst = (dval & gmask) >> gshift;
|
||||
bdst = (dval & bmask) >> bshift;
|
||||
|
||||
rsrc = (sval & rmask) >> rshift; /* richcursor */
|
||||
gsrc = (sval & gmask) >> gshift;
|
||||
bsrc = (sval & bmask) >> bshift;
|
||||
|
||||
/* blend in fb data. */
|
||||
if (! c->alphaPreMultiplied) {
|
||||
rsrc = (asrc * rsrc)/amax;
|
||||
gsrc = (asrc * gsrc)/amax;
|
||||
bsrc = (asrc * bsrc)/amax;
|
||||
}
|
||||
rdst = rsrc + ((amax - asrc) * rdst)/amax;
|
||||
gdst = gsrc + ((amax - asrc) * gdst)/amax;
|
||||
bdst = bsrc + ((amax - asrc) * bdst)/amax;
|
||||
|
||||
val = 0;
|
||||
val |= (rdst << rshift);
|
||||
val |= (gdst << gshift);
|
||||
val |= (bdst << bshift);
|
||||
|
||||
/* insert the cooked pixel into the fb */
|
||||
memcpy(dest, &val, bpp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* now the cursor has to be drawn */
|
||||
for(j=0;j<y2;j++)
|
||||
for(i=0;i<x2;i++)
|
||||
if((c->mask[(j+j1)*w+(i+i1)/8]<<((i+i1)&7))&0x80)
|
||||
memcpy(s->frameBuffer+(j+y1)*rowstride+(i+x1)*bpp,
|
||||
c->richSource+(j+j1)*c->width*bpp+(i+i1)*bpp,bpp);
|
||||
}
|
||||
|
||||
/* Copy to all scaled versions */
|
||||
rfbScaledScreenUpdate(s, x1, y1, x1+x2, y1+y2);
|
||||
|
||||
UNLOCK(s->cursorMutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* If enableCursorShapeUpdates is FALSE, and the cursor is hidden, make sure
|
||||
* that if the frameBuffer was transmitted with a cursor drawn, then that
|
||||
* region gets redrawn.
|
||||
*/
|
||||
|
||||
void rfbRedrawAfterHideCursor(rfbClientPtr cl,sraRegionPtr updateRegion)
|
||||
{
|
||||
rfbScreenInfoPtr s = cl->screen;
|
||||
rfbCursorPtr c = s->cursor;
|
||||
|
||||
if(c) {
|
||||
int x,y,x2,y2;
|
||||
|
||||
x = cl->cursorX-c->xhot;
|
||||
y = cl->cursorY-c->yhot;
|
||||
x2 = x+c->width;
|
||||
y2 = y+c->height;
|
||||
|
||||
if(sraClipRect2(&x,&y,&x2,&y2,0,0,s->width,s->height)) {
|
||||
sraRegionPtr rect;
|
||||
rect = sraRgnCreateRect(x,y,x2,y2);
|
||||
if(updateRegion) {
|
||||
sraRgnOr(updateRegion,rect);
|
||||
} else {
|
||||
LOCK(cl->updateMutex);
|
||||
sraRgnOr(cl->modifiedRegion,rect);
|
||||
UNLOCK(cl->updateMutex);
|
||||
}
|
||||
sraRgnDestroy(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
static void rfbPrintXCursor(rfbCursorPtr cursor)
|
||||
{
|
||||
int i,i1,j,w=(cursor->width+7)/8;
|
||||
unsigned char bit;
|
||||
for(j=0;j<cursor->height;j++) {
|
||||
for(i=0,i1=0,bit=0x80;i1<cursor->width;i1++,i+=(bit&1)?1:0,bit=(bit&1)?0x80:bit>>1)
|
||||
if(cursor->source[j*w+i]&bit) putchar('#'); else putchar(' ');
|
||||
putchar(':');
|
||||
for(i=0,i1=0,bit=0x80;i1<cursor->width;i1++,i+=(bit&1)?1:0,bit=(bit&1)?0x80:bit>>1)
|
||||
if(cursor->mask[j*w+i]&bit) putchar('#'); else putchar(' ');
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
|
||||
{
|
||||
rfbClientIteratorPtr iterator;
|
||||
rfbClientPtr cl;
|
||||
|
||||
LOCK(rfbScreen->cursorMutex);
|
||||
|
||||
if(rfbScreen->cursor) {
|
||||
iterator=rfbGetClientIterator(rfbScreen);
|
||||
while((cl=rfbClientIteratorNext(iterator)))
|
||||
if(!cl->enableCursorShapeUpdates)
|
||||
rfbRedrawAfterHideCursor(cl,NULL);
|
||||
rfbReleaseClientIterator(iterator);
|
||||
|
||||
if(rfbScreen->cursor->cleanup)
|
||||
rfbFreeCursor(rfbScreen->cursor);
|
||||
}
|
||||
|
||||
rfbScreen->cursor = c;
|
||||
|
||||
iterator=rfbGetClientIterator(rfbScreen);
|
||||
while((cl=rfbClientIteratorNext(iterator))) {
|
||||
cl->cursorWasChanged = TRUE;
|
||||
if(!cl->enableCursorShapeUpdates)
|
||||
rfbRedrawAfterHideCursor(cl,NULL);
|
||||
}
|
||||
rfbReleaseClientIterator(iterator);
|
||||
|
||||
UNLOCK(rfbScreen->cursorMutex);
|
||||
}
|
||||
|
38
jni/vnc/LibVNCServer-0.9.9/libvncserver/cutpaste.c
Normal file
38
jni/vnc/LibVNCServer-0.9.9/libvncserver/cutpaste.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* cutpaste.c - routines to deal with cut & paste buffers / selection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
|
||||
/*
|
||||
* rfbSetXCutText sets the cut buffer to be the given string. We also clear
|
||||
* the primary selection. Ideally we'd like to set it to the same thing, but I
|
||||
* can't work out how to do that without some kind of helper X client.
|
||||
*/
|
||||
|
||||
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
|
||||
{
|
||||
rfbSendServerCutText(rfbScreen, str, len);
|
||||
}
|
61
jni/vnc/LibVNCServer-0.9.9/libvncserver/draw.c
Normal file
61
jni/vnc/LibVNCServer-0.9.9/libvncserver/draw.c
Normal file
@ -0,0 +1,61 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
void rfbFillRect(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
int i,j;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
for(j=y1;j<y2;j++)
|
||||
for(i=x1;i<x2;i++)
|
||||
memcpy(s->frameBuffer+j*rowstride+i*bpp,colour,bpp);
|
||||
rfbMarkRectAsModified(s,x1,y1,x2,y2);
|
||||
}
|
||||
|
||||
#define SETPIXEL(x,y) \
|
||||
memcpy(s->frameBuffer+(y)*rowstride+(x)*bpp,colour,bpp)
|
||||
|
||||
void rfbDrawPixel(rfbScreenInfoPtr s,int x,int y,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
SETPIXEL(x,y);
|
||||
rfbMarkRectAsModified(s,x,y,x+1,y+1);
|
||||
}
|
||||
|
||||
void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
int i;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
|
||||
#define SWAPPOINTS { i=x1; x1=x2; x2=i; i=y1; y1=y2; y2=i; }
|
||||
if(abs(x1-x2)<abs(y1-y2)) {
|
||||
if(y1>y2)
|
||||
SWAPPOINTS
|
||||
for(i=y1;i<=y2;i++)
|
||||
SETPIXEL(x1+(i-y1)*(x2-x1)/(y2-y1),i);
|
||||
/* TODO: Maybe make this more intelligently? */
|
||||
if(x2<x1) { i=x1; x1=x2; x2=i; }
|
||||
rfbMarkRectAsModified(s,x1,y1,x2+1,y2+1);
|
||||
} else {
|
||||
if(x1>x2)
|
||||
SWAPPOINTS
|
||||
else if(x1==x2) {
|
||||
rfbDrawPixel(s,x1,y1,col);
|
||||
return;
|
||||
}
|
||||
for(i=x1;i<=x2;i++)
|
||||
SETPIXEL(i,y1+(i-x1)*(y2-y1)/(x2-x1));
|
||||
if(y2<y1) { i=y1; y1=y2; y2=i; }
|
||||
rfbMarkRectAsModified(s,x1,y1,x2+1,y2+1);
|
||||
}
|
||||
}
|
196
jni/vnc/LibVNCServer-0.9.9/libvncserver/font.c
Normal file
196
jni/vnc/LibVNCServer-0.9.9/libvncserver/font.c
Normal file
@ -0,0 +1,196 @@
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,unsigned char c,rfbPixel col)
|
||||
{
|
||||
int i,j,width,height;
|
||||
unsigned char* data=font->data+font->metaData[c*5];
|
||||
unsigned char d=*data;
|
||||
int rowstride=rfbScreen->paddedWidthInBytes;
|
||||
int bpp=rfbScreen->serverFormat.bitsPerPixel/8;
|
||||
char *colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
|
||||
width=font->metaData[c*5+1];
|
||||
height=font->metaData[c*5+2];
|
||||
x+=font->metaData[c*5+3];
|
||||
y+=-font->metaData[c*5+4]-height+1;
|
||||
|
||||
for(j=0;j<height;j++) {
|
||||
for(i=0;i<width;i++) {
|
||||
if((i&7)==0) {
|
||||
d=*data;
|
||||
data++;
|
||||
}
|
||||
if(d&0x80 && y+j >= 0 && y+j < rfbScreen->height &&
|
||||
x+i >= 0 && x+i < rfbScreen->width)
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,colour,bpp);
|
||||
d<<=1;
|
||||
}
|
||||
/* if((i&7)!=0) data++; */
|
||||
}
|
||||
return(width);
|
||||
}
|
||||
|
||||
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,const char* string,rfbPixel colour)
|
||||
{
|
||||
while(*string) {
|
||||
x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: these two functions need to be more efficient */
|
||||
/* if col==bcol, assume transparent background */
|
||||
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,unsigned char c,
|
||||
int x1,int y1,int x2,int y2,
|
||||
rfbPixel col,rfbPixel bcol)
|
||||
{
|
||||
int i,j,width,height;
|
||||
unsigned char* data=font->data+font->metaData[c*5];
|
||||
unsigned char d;
|
||||
int rowstride=rfbScreen->paddedWidthInBytes;
|
||||
int bpp=rfbScreen->serverFormat.bitsPerPixel/8,extra_bytes=0;
|
||||
char* colour=(char*)&col;
|
||||
char* bcolour=(char*)&bcol;
|
||||
|
||||
if(!rfbEndianTest) {
|
||||
colour+=4-bpp;
|
||||
bcolour+=4-bpp;
|
||||
}
|
||||
|
||||
width=font->metaData[c*5+1];
|
||||
height=font->metaData[c*5+2];
|
||||
x+=font->metaData[c*5+3];
|
||||
y+=-font->metaData[c*5+4]-height+1;
|
||||
|
||||
/* after clipping, x2 will be count of bytes between rows,
|
||||
* x1 start of i, y1 start of j, width and height will be adjusted. */
|
||||
if(y1>y) { y1-=y; data+=(width+7)/8; height-=y1; y+=y1; } else y1=0;
|
||||
if(x1>x) { x1-=x; data+=x1; width-=x1; x+=x1; extra_bytes+=x1/8; } else x1=0;
|
||||
if(y2<y+height) height-=y+height-y2;
|
||||
if(x2<x+width) { extra_bytes+=(x1+width)/8-(x+width-x2+7)/8; width-=x+width-x2; }
|
||||
|
||||
d=*data;
|
||||
for(j=y1;j<height;j++) {
|
||||
if((x1&7)!=0)
|
||||
d=data[-1]; /* TODO: check if in this case extra_bytes is correct! */
|
||||
for(i=x1;i<width;i++) {
|
||||
if((i&7)==0) {
|
||||
d=*data;
|
||||
data++;
|
||||
}
|
||||
/* if(x+i>=x1 && x+i<x2 && y+j>=y1 && y+j<y2) */ {
|
||||
if(d&0x80) {
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,
|
||||
colour,bpp);
|
||||
} else if(bcol!=col) {
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,
|
||||
bcolour,bpp);
|
||||
}
|
||||
}
|
||||
d<<=1;
|
||||
}
|
||||
/* if((i&7)==0) data++; */
|
||||
data += extra_bytes;
|
||||
}
|
||||
return(width);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
while(*string) {
|
||||
x+=rfbDrawCharWithClip(rfbScreen,font,x,y,*string,x1,y1,x2,y2,
|
||||
colour,backColour);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
int rfbWidthOfString(rfbFontDataPtr font,const char* string)
|
||||
{
|
||||
int i=0;
|
||||
while(*string) {
|
||||
i+=font->metaData[*string*5+1];
|
||||
string++;
|
||||
}
|
||||
return(i);
|
||||
}
|
||||
|
||||
int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c)
|
||||
{
|
||||
return(font->metaData[c*5+1]+font->metaData[c*5+3]);
|
||||
}
|
||||
|
||||
void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2)
|
||||
{
|
||||
*x1+=font->metaData[c*5+3];
|
||||
*y1+=-font->metaData[c*5+4]-font->metaData[c*5+2]+1;
|
||||
*x2=*x1+font->metaData[c*5+1]+1;
|
||||
*y2=*y1+font->metaData[c*5+2]+1;
|
||||
}
|
||||
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
void rfbWholeFontBBox(rfbFontDataPtr font,
|
||||
int *x1, int *y1, int *x2, int *y2)
|
||||
{
|
||||
int i;
|
||||
int* m=font->metaData;
|
||||
|
||||
(*x1)=(*y1)=INT_MAX; (*x2)=(*y2)=1-(INT_MAX);
|
||||
for(i=0;i<256;i++) {
|
||||
if(m[i*5+1]-m[i*5+3]>(*x2))
|
||||
(*x2)=m[i*5+1]-m[i*5+3];
|
||||
if(-m[i*5+2]+m[i*5+4]<(*y1))
|
||||
(*y1)=-m[i*5+2]+m[i*5+4];
|
||||
if(m[i*5+3]<(*x1))
|
||||
(*x1)=m[i*5+3];
|
||||
if(-m[i*5+4]>(*y2))
|
||||
(*y2)=-m[i*5+4];
|
||||
}
|
||||
(*x2)++;
|
||||
(*y2)++;
|
||||
}
|
||||
|
||||
rfbFontDataPtr rfbLoadConsoleFont(char *filename)
|
||||
{
|
||||
FILE *f=fopen(filename,"rb");
|
||||
rfbFontDataPtr p;
|
||||
int i;
|
||||
|
||||
if(!f) return NULL;
|
||||
|
||||
p=(rfbFontDataPtr)malloc(sizeof(rfbFontData));
|
||||
p->data=(unsigned char*)malloc(4096);
|
||||
if(1!=fread(p->data,4096,1,f)) {
|
||||
free(p->data);
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
fclose(f);
|
||||
p->metaData=(int*)malloc(256*5*sizeof(int));
|
||||
for(i=0;i<256;i++) {
|
||||
p->metaData[i*5+0]=i*16; /* offset */
|
||||
p->metaData[i*5+1]=8; /* width */
|
||||
p->metaData[i*5+2]=16; /* height */
|
||||
p->metaData[i*5+3]=0; /* xhot */
|
||||
p->metaData[i*5+4]=0; /* yhot */
|
||||
}
|
||||
return(p);
|
||||
}
|
||||
|
||||
void rfbFreeFont(rfbFontDataPtr f)
|
||||
{
|
||||
free(f->data);
|
||||
free(f->metaData);
|
||||
free(f);
|
||||
}
|
342
jni/vnc/LibVNCServer-0.9.9/libvncserver/hextile.c
Normal file
342
jni/vnc/LibVNCServer-0.9.9/libvncserver/hextile.c
Normal file
@ -0,0 +1,342 @@
|
||||
/*
|
||||
* hextile.c
|
||||
*
|
||||
* Routines to implement Hextile Encoding
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <rfb/rfb.h>
|
||||
|
||||
static rfbBool sendHextiles8(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
static rfbBool sendHextiles16(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
static rfbBool sendHextiles32(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendRectEncodingHextile - send a rectangle using hextile encoding.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendRectEncodingHextile(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.r.x = Swap16IfLE(x);
|
||||
rect.r.y = Swap16IfLE(y);
|
||||
rect.r.w = Swap16IfLE(w);
|
||||
rect.r.h = Swap16IfLE(h);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingHextile);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
rfbStatRecordEncodingSent(cl, rfbEncodingHextile,
|
||||
sz_rfbFramebufferUpdateRectHeader,
|
||||
sz_rfbFramebufferUpdateRectHeader + w * (cl->format.bitsPerPixel / 8) * h);
|
||||
|
||||
switch (cl->format.bitsPerPixel) {
|
||||
case 8:
|
||||
return sendHextiles8(cl, x, y, w, h);
|
||||
case 16:
|
||||
return sendHextiles16(cl, x, y, w, h);
|
||||
case 32:
|
||||
return sendHextiles32(cl, x, y, w, h);
|
||||
}
|
||||
|
||||
rfbLog("rfbSendRectEncodingHextile: bpp %d?\n", cl->format.bitsPerPixel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define PUT_PIXEL8(pix) (cl->updateBuf[cl->ublen++] = (pix))
|
||||
|
||||
#define PUT_PIXEL16(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1])
|
||||
|
||||
#define PUT_PIXEL32(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[2], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[3])
|
||||
|
||||
|
||||
#define DEFINE_SEND_HEXTILES(bpp) \
|
||||
\
|
||||
\
|
||||
static rfbBool subrectEncode##bpp(rfbClientPtr cli, uint##bpp##_t *data, \
|
||||
int w, int h, uint##bpp##_t bg, uint##bpp##_t fg, rfbBool mono);\
|
||||
static void testColours##bpp(uint##bpp##_t *data, int size, rfbBool *mono, \
|
||||
rfbBool *solid, uint##bpp##_t *bg, uint##bpp##_t *fg); \
|
||||
\
|
||||
\
|
||||
/* \
|
||||
* rfbSendHextiles \
|
||||
*/ \
|
||||
\
|
||||
static rfbBool \
|
||||
sendHextiles##bpp(rfbClientPtr cl, int rx, int ry, int rw, int rh) { \
|
||||
int x, y, w, h; \
|
||||
int startUblen; \
|
||||
char *fbptr; \
|
||||
uint##bpp##_t bg = 0, fg = 0, newBg, newFg; \
|
||||
rfbBool mono, solid; \
|
||||
rfbBool validBg = FALSE; \
|
||||
rfbBool validFg = FALSE; \
|
||||
uint##bpp##_t clientPixelData[16*16*(bpp/8)]; \
|
||||
\
|
||||
for (y = ry; y < ry+rh; y += 16) { \
|
||||
for (x = rx; x < rx+rw; x += 16) { \
|
||||
w = h = 16; \
|
||||
if (rx+rw - x < 16) \
|
||||
w = rx+rw - x; \
|
||||
if (ry+rh - y < 16) \
|
||||
h = ry+rh - y; \
|
||||
\
|
||||
if ((cl->ublen + 1 + (2 + 16 * 16) * (bpp/8)) > \
|
||||
UPDATE_BUF_SIZE) { \
|
||||
if (!rfbSendUpdateBuf(cl)) \
|
||||
return FALSE; \
|
||||
} \
|
||||
\
|
||||
fbptr = (cl->scaledScreen->frameBuffer + (cl->scaledScreen->paddedWidthInBytes * y) \
|
||||
+ (x * (cl->scaledScreen->bitsPerPixel / 8))); \
|
||||
\
|
||||
(*cl->translateFn)(cl->translateLookupTable, &(cl->screen->serverFormat), \
|
||||
&cl->format, fbptr, (char *)clientPixelData, \
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h); \
|
||||
\
|
||||
startUblen = cl->ublen; \
|
||||
cl->updateBuf[startUblen] = 0; \
|
||||
cl->ublen++; \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
testColours##bpp(clientPixelData, w * h, \
|
||||
&mono, &solid, &newBg, &newFg); \
|
||||
\
|
||||
if (!validBg || (newBg != bg)) { \
|
||||
validBg = TRUE; \
|
||||
bg = newBg; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileBackgroundSpecified; \
|
||||
PUT_PIXEL##bpp(bg); \
|
||||
} \
|
||||
\
|
||||
if (solid) { \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
cl->updateBuf[startUblen] |= rfbHextileAnySubrects; \
|
||||
\
|
||||
if (mono) { \
|
||||
if (!validFg || (newFg != fg)) { \
|
||||
validFg = TRUE; \
|
||||
fg = newFg; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileForegroundSpecified; \
|
||||
PUT_PIXEL##bpp(fg); \
|
||||
} \
|
||||
} else { \
|
||||
validFg = FALSE; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileSubrectsColoured; \
|
||||
} \
|
||||
\
|
||||
if (!subrectEncode##bpp(cl, clientPixelData, w, h, bg, fg, mono)) { \
|
||||
/* encoding was too large, use raw */ \
|
||||
validBg = FALSE; \
|
||||
validFg = FALSE; \
|
||||
cl->ublen = startUblen; \
|
||||
cl->updateBuf[cl->ublen++] = rfbHextileRaw; \
|
||||
(*cl->translateFn)(cl->translateLookupTable, \
|
||||
&(cl->screen->serverFormat), &cl->format, fbptr, \
|
||||
(char *)clientPixelData, \
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h); \
|
||||
\
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)clientPixelData, \
|
||||
w * h * (bpp/8)); \
|
||||
\
|
||||
cl->ublen += w * h * (bpp/8); \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, \
|
||||
w * h * (bpp/8)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
static rfbBool \
|
||||
subrectEncode##bpp(rfbClientPtr cl, uint##bpp##_t *data, int w, int h, \
|
||||
uint##bpp##_t bg, uint##bpp##_t fg, rfbBool mono) \
|
||||
{ \
|
||||
uint##bpp##_t cl2; \
|
||||
int x,y; \
|
||||
int i,j; \
|
||||
int hx=0,hy,vx=0,vy; \
|
||||
int hyflag; \
|
||||
uint##bpp##_t *seg; \
|
||||
uint##bpp##_t *line; \
|
||||
int hw,hh,vw,vh; \
|
||||
int thex,they,thew,theh; \
|
||||
int numsubs = 0; \
|
||||
int newLen; \
|
||||
int nSubrectsUblen; \
|
||||
\
|
||||
nSubrectsUblen = cl->ublen; \
|
||||
cl->ublen++; \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
for (y=0; y<h; y++) { \
|
||||
line = data+(y*w); \
|
||||
for (x=0; x<w; x++) { \
|
||||
if (line[x] != bg) { \
|
||||
cl2 = line[x]; \
|
||||
hy = y-1; \
|
||||
hyflag = 1; \
|
||||
for (j=y; j<h; j++) { \
|
||||
seg = data+(j*w); \
|
||||
if (seg[x] != cl2) {break;} \
|
||||
i = x; \
|
||||
while ((seg[i] == cl2) && (i < w)) i += 1; \
|
||||
i -= 1; \
|
||||
if (j == y) vx = hx = i; \
|
||||
if (i < vx) vx = i; \
|
||||
if ((hyflag > 0) && (i >= hx)) { \
|
||||
hy += 1; \
|
||||
} else { \
|
||||
hyflag = 0; \
|
||||
} \
|
||||
} \
|
||||
vy = j-1; \
|
||||
\
|
||||
/* We now have two possible subrects: (x,y,hx,hy) and \
|
||||
* (x,y,vx,vy). We'll choose the bigger of the two. \
|
||||
*/ \
|
||||
hw = hx-x+1; \
|
||||
hh = hy-y+1; \
|
||||
vw = vx-x+1; \
|
||||
vh = vy-y+1; \
|
||||
\
|
||||
thex = x; \
|
||||
they = y; \
|
||||
\
|
||||
if ((hw*hh) > (vw*vh)) { \
|
||||
thew = hw; \
|
||||
theh = hh; \
|
||||
} else { \
|
||||
thew = vw; \
|
||||
theh = vh; \
|
||||
} \
|
||||
\
|
||||
if (mono) { \
|
||||
newLen = cl->ublen - nSubrectsUblen + 2; \
|
||||
} else { \
|
||||
newLen = cl->ublen - nSubrectsUblen + bpp/8 + 2; \
|
||||
} \
|
||||
\
|
||||
if (newLen > (w * h * (bpp/8))) \
|
||||
return FALSE; \
|
||||
\
|
||||
numsubs += 1; \
|
||||
\
|
||||
if (!mono) PUT_PIXEL##bpp(cl2); \
|
||||
\
|
||||
cl->updateBuf[cl->ublen++] = rfbHextilePackXY(thex,they); \
|
||||
cl->updateBuf[cl->ublen++] = rfbHextilePackWH(thew,theh); \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
/* \
|
||||
* Now mark the subrect as done. \
|
||||
*/ \
|
||||
for (j=they; j < (they+theh); j++) { \
|
||||
for (i=thex; i < (thex+thew); i++) { \
|
||||
data[j*w+i] = bg; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
cl->updateBuf[nSubrectsUblen] = numsubs; \
|
||||
\
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
/* \
|
||||
* testColours() tests if there are one (solid), two (mono) or more \
|
||||
* colours in a tile and gets a reasonable guess at the best background \
|
||||
* pixel, and the foreground pixel for mono. \
|
||||
*/ \
|
||||
\
|
||||
static void \
|
||||
testColours##bpp(uint##bpp##_t *data, int size, rfbBool *mono, rfbBool *solid, \
|
||||
uint##bpp##_t *bg, uint##bpp##_t *fg) { \
|
||||
uint##bpp##_t colour1 = 0, colour2 = 0; \
|
||||
int n1 = 0, n2 = 0; \
|
||||
*mono = TRUE; \
|
||||
*solid = TRUE; \
|
||||
\
|
||||
for (; size > 0; size--, data++) { \
|
||||
\
|
||||
if (n1 == 0) \
|
||||
colour1 = *data; \
|
||||
\
|
||||
if (*data == colour1) { \
|
||||
n1++; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
if (n2 == 0) { \
|
||||
*solid = FALSE; \
|
||||
colour2 = *data; \
|
||||
} \
|
||||
\
|
||||
if (*data == colour2) { \
|
||||
n2++; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
*mono = FALSE; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
if (n1 > n2) { \
|
||||
*bg = colour1; \
|
||||
*fg = colour2; \
|
||||
} else { \
|
||||
*bg = colour2; \
|
||||
*fg = colour1; \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_SEND_HEXTILES(8)
|
||||
DEFINE_SEND_HEXTILES(16)
|
||||
DEFINE_SEND_HEXTILES(32)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user