Merge branch 'master' of ssh://libvncserver.git.sourceforge.net/gitroot/libvncserver/libvncserver

pull/1/head
Christian Beier 14 years ago
commit 471baea920

@ -18,10 +18,12 @@ find_package(JPEG)
find_package(SDL)
find_package(GnuTLS)
find_package(Threads)
find_package(X11)
find_library(LIBGCRYPT_LIBRARIES gcrypt)
if(SDL_FOUND) # == pthread.h available
if(Threads_FOUND)
option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON)
endif(SDL_FOUND)
endif(Threads_FOUND)
if(ZLIB_FOUND)
set(LIBVNCSERVER_HAVE_LIBZ 1)
endif(ZLIB_FOUND)
@ -32,6 +34,11 @@ option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON)
if(GNUTLS_FOUND)
set(LIBVNCSERVER_WITH_CLIENT_TLS 1)
endif(GNUTLS_FOUND)
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)
@ -187,12 +194,12 @@ set(LIBVNCSERVER_TESTS
vncev
)
if(SDL_FOUND)
if(Threads_FOUND)
set(LIBVNCSERVER_TESTS
${LIBVNCSERVER_TESTS}
blooptest
)
endif(SDL_FOUND)
endif(Threads_FOUND)
if(TIGHTVNC_FILETRANSFER)
set(LIBVNCSERVER_TESTS
@ -219,6 +226,7 @@ if(SDL_FOUND)
${LIBVNCCLIENT_TESTS}
SDLvncviewer
)
set(SDLvncviewer_EXTRA_SOURCES scrap.c)
endif(SDL_FOUND)
if(HAVE_FFMPEG)
@ -237,8 +245,8 @@ 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)
target_link_libraries(client_examples/${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${GNUTLS_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES})
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)

@ -4,7 +4,7 @@ endif
SUBDIRS=libvncserver examples libvncclient vncterm classes client_examples test $(X11VNC)
DIST_SUBDIRS=libvncserver examples libvncclient vncterm classes client_examples test
EXTRA_DIST = CMakeLists.txt
EXTRA_DIST = CMakeLists.txt rfb/rfbint.h.cmake rfb/rfbconfig.h.cmake
bin_SCRIPTS = libvncserver-config

50
NEWS

@ -1,3 +1,53 @@
0.9.8
- Overall changes:
* Automagically generated API documentation using doxygen.
* 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:

@ -121,6 +121,8 @@ static rfbBool malloc_frame_buffer(rfbClient* cl)
res->client->frameBuffer=malloc(w*4*h);
res->server=rfbGetScreen(NULL,NULL,w,h,8,3,4);
if(!res->server)
return FALSE;
res->server->screenData=res;
res->server->port=res->listen_port;
res->server->frameBuffer=res->client->frameBuffer;

@ -107,6 +107,8 @@ int main(int argc,char** argv)
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);

@ -133,6 +133,8 @@ 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);

@ -7,7 +7,8 @@ int main(int argc,char** argv)
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;

@ -279,8 +279,9 @@ static void MakeRichCursor(rfbScreenInfoPtr rfbScreen)
int main(int argc,char** argv)
{
rfbScreenInfoPtr rfbScreen =
rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp);
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;

@ -7,6 +7,8 @@
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);

@ -41,6 +41,9 @@ int main(int argc,char** argv)
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);

@ -455,6 +455,8 @@ ScreenInit(int argc, char**argv)
CGDisplayPixelsHigh(kCGDirectMainDisplay),
bitsPerSample,
CGDisplaySamplesPerPixel(kCGDirectMainDisplay),4);
if(!rfbScreen)
exit(0);
rfbScreen->serverFormat.redShift = bitsPerSample*2;
rfbScreen->serverFormat.greenShift = bitsPerSample*1;
rfbScreen->serverFormat.blueShift = 0;

@ -65,6 +65,8 @@ int main(int argc,char** argv)
/* 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

@ -60,6 +60,8 @@ int main(int argc,char** argv)
/* 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

@ -2,13 +2,6 @@
#include <rfb/rfb.h>
#include <rfb/keysym.h>
static int gcd(int x, int y)
{
if (x == 0)
return y;
return gcd((y % x), x);
}
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
#define CONCAT3(a,b,c) a##b##c
@ -17,22 +10,22 @@ static int gcd(int x, int y)
#define FUNCNAME rfbRotate
#define FUNC(i, j) (h - 1 - j + i * h)
#define SWAPDIMENSIONS
#define OUT 8
#define OUTBITS 8
#include "rotatetemplate.c"
#define OUT 16
#define OUTBITS 16
#include "rotatetemplate.c"
#define OUT 32
#define OUTBITS 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#define FUNCNAME rfbRotateCounterClockwise
#define FUNC(i, j) (j + (w - 1 - i) * h)
#define OUT 8
#define OUTBITS 8
#include "rotatetemplate.c"
#define OUT 16
#define OUTBITS 16
#include "rotatetemplate.c"
#define OUT 32
#define OUTBITS 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
@ -40,33 +33,33 @@ static int gcd(int x, int y)
#define FUNCNAME rfbFlipHorizontally
#define FUNC(i, j) ((w - 1 - i) + j * w)
#define OUT 8
#define OUTBITS 8
#include "rotatetemplate.c"
#define OUT 16
#define OUTBITS 16
#include "rotatetemplate.c"
#define OUT 32
#define OUTBITS 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#define FUNCNAME rfbFlipVertically
#define FUNC(i, j) (i + (h - 1 - j) * w)
#define OUT 8
#define OUTBITS 8
#include "rotatetemplate.c"
#define OUT 16
#define OUTBITS 16
#include "rotatetemplate.c"
#define OUT 32
#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 OUT 8
#define OUTBITS 8
#include "rotatetemplate.c"
#define OUT 16
#define OUTBITS 16
#include "rotatetemplate.c"
#define OUT 32
#define OUTBITS 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC

@ -1,5 +1,5 @@
#define OUT_T CONCAT3E(uint,OUT,_t)
#define FUNCTION CONCAT2E(FUNCNAME,OUT)
#define OUT_T CONCAT3E(uint,OUTBITS,_t)
#define FUNCTION CONCAT2E(FUNCNAME,OUTBITS)
static void FUNCTION(rfbScreenInfoPtr screen)
{
@ -16,7 +16,7 @@ static void FUNCTION(rfbScreenInfoPtr screen)
#ifdef SWAPDIMENSIONS
screen->width = h;
screen->paddedWidthInBytes = h * OUT / 8;
screen->paddedWidthInBytes = h * OUTBITS / 8;
screen->height = w;
{
@ -31,7 +31,7 @@ static void FUNCTION(rfbScreenInfoPtr screen)
rfbMarkRectAsModified(screen, 0, 0, screen->width, screen->height);
}
#if OUT == 32
#if OUTBITS == 32
void FUNCNAME(rfbScreenInfoPtr screen) {
if (screen->serverFormat.bitsPerPixel == 32)
CONCAT2E(FUNCNAME,32)(screen);
@ -48,5 +48,5 @@ void FUNCNAME(rfbScreenInfoPtr screen) {
#endif
#undef FUNCTION
#undef OUT
#undef OUTBITS

@ -3,6 +3,8 @@
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);

@ -9,7 +9,8 @@ int main(int argc,char** argv)
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++)

@ -99,7 +99,8 @@ static enum rfbNewClientAction newclient(rfbClientPtr cl)
{
char buffer[1024];
struct sockaddr_in addr;
unsigned int len=sizeof(addr),ip;
socklen_t len=sizeof(addr);
unsigned int ip;
getpeername(cl->sock,(struct sockaddr*)&addr,&len);
ip=ntohl(addr.sin_addr.s_addr);
@ -112,6 +113,8 @@ static enum rfbNewClientAction newclient(rfbClientPtr cl)
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";

@ -13,6 +13,8 @@ static int maxx=400, maxy=400, bpp=4;
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);
@ -27,6 +29,8 @@ int main (int argc, char **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;
@ -74,7 +78,7 @@ void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2)
}
/* Dscho's versions (slower, but works for bpp != 3 or 4) */
static void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
{
rfbPixelFormat f=s->serverFormat;
int i,j;
@ -88,7 +92,7 @@ static void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2
rfbDrawPixel(s,i,j,f.blueMax<<f.blueShift);
}
static void draw_primary_colours_generic_fast(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)
{
rfbPixelFormat f=s->serverFormat;
int i,j,y3=(y1*2+y2)/3,y4=(y1+y2*2)/3;

@ -29,6 +29,7 @@
#ifdef __MINGW32__
#define close closesocket
#include <winsock2.h>
#undef max
#else
#include <sys/wait.h>
#include <sys/utsname.h>

@ -559,11 +559,6 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth)
ReadReason(client);
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;
@ -573,7 +568,7 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth)
if (!ReadFromRFBServer(client, (char *)&tAuth[loop], 1)) return FALSE;
rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]);
if (flag) continue;
if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || tAuth[loop]==rfbMSLogon ||
if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth ||
tAuth[loop]==rfbARD ||
(!subAuth && (tAuth[loop]==rfbTLS || tAuth[loop]==rfbVeNCrypt)))
{
@ -1045,7 +1040,9 @@ InitialiseRFBConnection(rfbClient* client)
rfbProtocolVersionMsg pv;
int major,minor;
uint32_t authScheme;
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS
uint32_t subAuthScheme;
#endif
rfbClientInitMsg ci;
/* if the connection is immediately closed, don't report anything, so

@ -37,7 +37,7 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh)
rfbZlibHeader hdr;
int toRead=0;
int inflateResult=0;
int uncompressedBytes = (( rw * rh ) * ( BPP / 8 ));
lzo_uint uncompressedBytes = (( rw * rh ) * ( BPP / 8 ));
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
return FALSE;
@ -57,7 +57,7 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh)
* buffer, this buffer allocation should only happen once, on the
* first update.
*/
if ( client->raw_buffer_size < uncompressedBytes) {
if ( client->raw_buffer_size < (int)uncompressedBytes) {
if ( client->raw_buffer != NULL ) {
free( client->raw_buffer );
}
@ -119,7 +119,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
int toRead=0;
int inflateResult=0;
unsigned char *ptr=NULL;
int uncompressedBytes = ry + (rw * 65535);
lzo_uint uncompressedBytes = ry + (rw * 65535);
unsigned int numCacheRects = rx;
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
@ -141,7 +141,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
* buffer, this buffer allocation should only happen once, on the
* first update.
*/
if ( client->raw_buffer_size < (uncompressedBytes + 500)) {
if ( client->raw_buffer_size < (int)(uncompressedBytes + 500)) {
if ( client->raw_buffer != NULL ) {
free( client->raw_buffer );
}
@ -170,7 +170,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh)
uncompressedBytes = client->raw_buffer_size;
inflateResult = lzo1x_decompress(
(lzo_byte *)client->ultra_buffer, toRead,
(lzo_byte *)client->raw_buffer, (lzo_uintp) &uncompressedBytes, NULL);
(lzo_byte *)client->raw_buffer, &uncompressedBytes, NULL);
if ( inflateResult != LZO_E_OK )
{
rfbClientLog("ultra decompress returned error: %d\n",

@ -363,7 +363,7 @@ static int HandleZRLETile(rfbClient* client,
{
return -8;
}
else if( (type >= 130)&&(type <= 255) ) /* palette RLE */
else if( type >= 130 ) /* palette RLE */
{
CARDBPP palette[128];
int i,j;

@ -1657,7 +1657,7 @@ rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t con
#ifdef LIBVNCSERVER_HAVE_LIBZ
/* compressed packet */
nRet = uncompress(compBuff,&nRawBytes,(const unsigned char*)buffer, length);
retval=write(cl->fileTransfer.fd, compBuff, nRawBytes);
retval=write(cl->fileTransfer.fd, (char*)compBuff, nRawBytes);
#else
/* Write the file out as received... */
retval=write(cl->fileTransfer.fd, buffer, length);
@ -3265,7 +3265,7 @@ void
rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen,
int sock)
{
if (write(sock, &ptrAcceleration, 1) < 0) {
if (write(sock, (char*) &ptrAcceleration, 1) < 0) {
rfbLogPerror("rfbNewUDPConnection: write");
}
}

@ -50,7 +50,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl,
+ (x * (cl->scaledScreen->bitsPerPixel / 8)));
int maxRawSize;
int maxCompSize;
lzo_uint maxCompSize;
maxRawSize = (w * h * (cl->format.bitsPerPixel / 8));
@ -68,7 +68,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl,
*/
maxCompSize = (maxRawSize + maxRawSize / 16 + 64 + 3);
if (cl->afterEncBufSize < maxCompSize) {
if (cl->afterEncBufSize < (int)maxCompSize) {
cl->afterEncBufSize = maxCompSize;
if (cl->afterEncBuf == NULL)
cl->afterEncBuf = (char *)malloc(cl->afterEncBufSize);
@ -92,7 +92,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl,
}
/* Perform the compression here. */
deflateResult = lzo1x_1_compress((unsigned char *)cl->beforeEncBuf, (lzo_uint)(w * h * (cl->format.bitsPerPixel / 8)), (unsigned char *)cl->afterEncBuf, (lzo_uint *)&maxCompSize, cl->lzoWrkMem);
deflateResult = lzo1x_1_compress((unsigned char *)cl->beforeEncBuf, (lzo_uint)(w * h * (cl->format.bitsPerPixel / 8)), (unsigned char *)cl->afterEncBuf, &maxCompSize, cl->lzoWrkMem);
/* maxCompSize now contains the compressed size */
/* Find the total size of the resulting compressed data. */

@ -96,9 +96,6 @@
* data.
*/
/* TODO: put into rfbClient struct */
static char zrleBeforeBuf[rfbZRLETileWidth * rfbZRLETileHeight * 4 + 4];
/*
* rfbSendRectEncodingZRLE - send a given rectangle using ZRLE encoding.

@ -84,8 +84,6 @@ static const int bitsPerPackedPixel[] = {
0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
static zrlePaletteHelper paletteHelper;
#endif /* ZRLE_ONCE */
void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, zrleOutStream* os,
@ -144,11 +142,7 @@ void ZRLE_ENCODE_TILE(PIXEL_T* data, int w, int h, zrleOutStream* os,
PIXEL_T* end = ptr + h * w;
*end = ~*(end-1); /* one past the end is different so the while loop ends */
#if 0
ph = &paletteHelper;
#else
ph = (zrlePaletteHelper *) paletteHelper;
#endif
zrlePaletteHelperInit(ph);
while (ptr < end) {

@ -54,6 +54,9 @@
/* Define to the version of this package. */
#define LIBVNCSERVER_PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Define to 1 if libgcrypt is present */
#cmakedefine LIBVNCSERVER_WITH_CLIENT_GCRYPT 1
/* Define to 1 if GnuTLS is present */
#cmakedefine LIBVNCSERVER_WITH_CLIENT_TLS 1

@ -1,191 +0,0 @@
/* rfb/rfbconfig.h.in. Generated automatically from configure.ac by autoheader. */
/* Enable 24 bit per pixel in native framebuffer */
#undef ALLOW24BPP
/* Enable BackChannel communication */
#undef BACKCHANNEL
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the `ftime' function. */
#undef HAVE_FTIME
/* Define if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
/* Define if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the `jpeg' library (-ljpeg). */
#undef HAVE_LIBJPEG
/* Define if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define if your system has a working `malloc' function. */
#undef HAVE_MALLOC
/* Define if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define if you have the `mkfifo' function. */
#undef HAVE_MKFIFO
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the `select' function. */
#undef HAVE_SELECT
/* Define if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define if `stat' has the bug that it succeeds when given the zero-length
file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define if you have the `strcspn' function. */
#undef HAVE_STRCSPN
/* Define if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define if you have the `strftime' function. */
#undef HAVE_STRFTIME
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/timeb.h> header file. */
#undef HAVE_SYS_TIMEB_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* Use zrle compression; needs a c++ compiler */
#undef HAVE_ZRLE
/* Define if `lstat' dereferences a symlink specified with a trailing slash.
*/
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Name of package */
#undef PACKAGE
/* The number of bytes in type char */
#undef SIZEOF_CHAR
/* The number of bytes in type int */
#undef SIZEOF_INT
/* The number of bytes in type long */
#undef SIZEOF_LONG
/* The number of bytes in type short */
#undef SIZEOF_SHORT
/* The number of bytes in type void* */
#undef SIZEOF_VOIDP
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define if your processor stores words with the most significant byte first
(like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
#undef inline
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* The type for socklen */
#undef socklen_t

@ -1 +0,0 @@
timestamp

@ -10,6 +10,9 @@ int main(int argc,char** argv)
rfbBool ret=0;
screen = rfbGetScreen(&fake_argc,fake_argv,1024,768,8,3,1);
if(!screen)
return 0;
#define CHECK(a,b) if(screen->a!=b) { fprintf(stderr,#a " is %d (should be " #b ")\n",screen->a); ret=1; }
CHECK(width,1024);
CHECK(height,768);

@ -22,6 +22,8 @@ int main(int argc,char** argv)
double r,phi=0;
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,width,height,8,3,4);
if(!server)
return 0;
server->frameBuffer=(char*)malloc(width*height*4);
initBackground(server);
server->deferUpdateTime=0;

@ -322,8 +322,10 @@ static void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
int main(int argc,char** argv)
{
rfbScreenInfoPtr rfbScreen =
rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp);
rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp);
if(!rfbScreen)
return 0;
rfbScreen->desktopName = "Cursor Test";
rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp);
rfbScreen->ptrAddEvent = doptr;

@ -17,15 +17,16 @@ static MUTEX(frameBufferMutex);
typedef struct { int id; char* str; } encoding_t;
static encoding_t testEncodings[]={
{ rfbEncodingRaw, "raw" },
{ rfbEncodingRaw, "raw" },
{ rfbEncodingRRE, "rre" },
/* TODO: fix corre */
/* { rfbEncodingCoRRE, "corre" }, */
{ rfbEncodingCoRRE, "corre" },
{ rfbEncodingHextile, "hextile" },
{ rfbEncodingUltra, "ultra" },
#ifdef LIBVNCSERVER_HAVE_LIBZ
{ rfbEncodingZlib, "zlib" },
{ rfbEncodingZlibHex, "zlibhex" },
{ rfbEncodingZRLE, "zrle" },
{ rfbEncodingZYWRLE, "zywrle" },
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
{ rfbEncodingTight, "tight" },
#endif
@ -39,7 +40,6 @@ static encoding_t testEncodings[]={
/* Here come the variables/functions to handle the test output */
static const int width=400,height=300;
static struct { int x1,y1,x2,y2; } lastUpdateRect;
static unsigned int statistics[2][NUMBER_OF_ENCODINGS_TO_TEST];
static unsigned int totalFailed,totalCount;
static unsigned int countGotUpdate;
@ -49,22 +49,9 @@ static void initStatistics(void) {
memset(statistics[0],0,sizeof(int)*NUMBER_OF_ENCODINGS_TO_TEST);
memset(statistics[1],0,sizeof(int)*NUMBER_OF_ENCODINGS_TO_TEST);
totalFailed=totalCount=0;
lastUpdateRect.x1=0;
lastUpdateRect.y1=0;
lastUpdateRect.x2=width;
lastUpdateRect.y2=height;
INIT_MUTEX(statisticsMutex);
}
static void updateServerStatistics(int x1,int y1,int x2,int y2) {
LOCK(statisticsMutex);
countGotUpdate=0;
lastUpdateRect.x1=x1;
lastUpdateRect.y1=y1;
lastUpdateRect.x2=x2;
lastUpdateRect.y2=y2;
UNLOCK(statisticsMutex);
}
static void updateStatistics(int encodingIndex,rfbBool failed) {
LOCK(statisticsMutex);
@ -115,7 +102,7 @@ static rfbBool doFramebuffersMatch(rfbScreenInfo* server,rfbClient* client,
static rfbBool resize(rfbClient* cl) {
if(cl->frameBuffer)
free(cl->frameBuffer);
cl->frameBuffer=(char*)malloc(cl->width*cl->height*cl->format.bitsPerPixel/8);
cl->frameBuffer=malloc(cl->width*cl->height*cl->format.bitsPerPixel/8);
if(!cl->frameBuffer)
return FALSE;
SendFramebufferUpdateRequest(cl,0,0,cl->width,cl->height,FALSE);
@ -129,44 +116,44 @@ typedef struct clientData {
} clientData;
static void update(rfbClient* client,int x,int y,int w,int h) {
clientData* cd=(clientData*)client->clientData;
int maxDelta=0;
#ifndef VERY_VERBOSE
static const char* progress="|/-\\";
static int counter=0;
if(++counter>sizeof(progress)) counter=0;
fprintf(stderr,"%c\r",progress[counter]);
#else
clientData* cd=(clientData*)client->clientData;
rfbClientLog("Got update (encoding=%s): (%d,%d)-(%d,%d)\n",
testEncodings[cd->encodingIndex].str,
x,y,x+w,y+h);
#endif
}
/* only check if this was the last update */
if(x+w!=lastUpdateRect.x2 || y+h!=lastUpdateRect.y2) {
#ifdef VERY_VERBOSE
rfbClientLog("Waiting (%d!=%d or %d!=%d)\n",
x+w,lastUpdateRect.x2,y+h,lastUpdateRect.y2);
#endif
return;
}
static void update_finished(rfbClient* client) {
clientData* cd=(clientData*)client->clientData;
int maxDelta=0;
#ifdef LIBVNCSERVER_HAVE_LIBZ
if(testEncodings[cd->encodingIndex].id==rfbEncodingZYWRLE)
maxDelta=5;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
if(testEncodings[cd->encodingIndex].id==rfbEncodingTight)
maxDelta=5;
#endif
#endif
updateStatistics(cd->encodingIndex,
!doFramebuffersMatch(cd->server,client,maxDelta));
}
static void* clientLoop(void* data) {
rfbClient* client=(rfbClient*)data;
clientData* cd=(clientData*)client->clientData;
client->appData.encodingsString=strdup(testEncodings[cd->encodingIndex].str);
client->appData.qualityLevel = 7; /* ZYWRLE fails the test with standard settings */
sleep(1);
rfbClientLog("Starting client (encoding %s, display %s)\n",
@ -201,6 +188,7 @@ static void startClient(int encodingIndex,rfbScreenInfo* server) {
client->clientData=malloc(sizeof(clientData));
client->MallocFrameBuffer=resize;
client->GotFrameBufferUpdate=update;
client->FinishedFrameBufferUpdate=update_finished;
cd=(clientData*)client->clientData;
cd->encodingIndex=encodingIndex;
@ -208,10 +196,6 @@ static void startClient(int encodingIndex,rfbScreenInfo* server) {
cd->display=(char*)malloc(6);
sprintf(cd->display,":%d",server->port-5900);
lastUpdateRect.x1=lastUpdateRect.y1=0;
lastUpdateRect.x2=server->width;
lastUpdateRect.y2=server->height;
pthread_create(&all_threads[thread_counter++],NULL,clientLoop,(void*)client);
}
@ -228,11 +212,10 @@ static void idle(rfbScreenInfo* server)
#else
goForward=(countGotUpdate==1);
#endif
/* if(lastUpdateRect.x2==354)
rfbLog("server checked: countGotUpdate=%d\n",countGotUpdate); */
UNLOCK(statisticsMutex);
if(!goForward)
return;
return;
countGotUpdate=0;
LOCK(frameBufferMutex);
@ -250,10 +233,6 @@ static void idle(rfbScreenInfo* server)
}
rfbMarkRectAsModified(server,x1,y1,x2,y2);
lastUpdateRect.x1=x1;
lastUpdateRect.y1=y1;
lastUpdateRect.x2=x2;
lastUpdateRect.y2=y2;
#ifdef VERY_VERBOSE
rfbLog("Sent update (%d,%d)-(%d,%d)\n",x1,y1,x2,y2);
#endif
@ -298,6 +277,8 @@ int main(int argc,char** argv)
/* Initialize server */
server=rfbGetScreen(&argc,argv,width,height,8,3,4);
if(!server)
return 0;
server->frameBuffer=malloc(400*300*4);
server->cursor=NULL;
@ -336,10 +317,14 @@ int main(int argc,char** argv)
}
#endif
rfbScreenCleanup(server);
/* shut down server, disconnecting all clients */
rfbShutdownServer(server, TRUE);
for(i=0;i<thread_counter;i++)
pthread_join(all_threads[i], NULL);
free(server->frameBuffer);
rfbScreenCleanup(server);
rfbLog("Statistics:\n");
for(i=0;i<NUMBER_OF_ENCODINGS_TO_TEST;i++)

Loading…
Cancel
Save