LibVNCServer/LibVNCClient
rfb.h
Go to the documentation of this file.
1#ifndef RFB_H
2#define RFB_H
12/*
13 * Copyright (C) 2005 Rohit Kumar <rokumar@novell.com>,
14 * Johannes E. Schindelin <johannes.schindelin@gmx.de>
15 * Copyright (C) 2002 RealVNC Ltd.
16 * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
17 * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
18 * All Rights Reserved.
19 *
20 * This is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This software is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this software; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
33 * USA.
34 */
35
36#if(defined __cplusplus)
37extern "C"
38{
39#endif
40
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
44#include <rfb/rfbproto.h>
45
46#if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
47#include <arpa/inet.h>
48#include <sys/select.h>
49#endif
50
51#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
52#include <sys/types.h>
53#endif
54
55#ifdef WIN32
56typedef UINT32 in_addr_t;
57#include <winsock2.h>
58#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
59#undef socklen_t
60#include <ws2tcpip.h>
61#endif
62#ifdef _MSC_VER
63#pragma warning(disable:4996)
64#endif
65#endif
66
67#include <rfb/threading.h>
68
69/* if you use pthreads, but don't define LIBVNCSERVER_HAVE_LIBPTHREAD, the structs
70 get all mixed up. So this gives a linker error reminding you to compile
71 the library and your application (at least the parts including rfb.h)
72 with the same support for pthreads. */
73#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
74#ifdef LIBVNCSERVER_HAVE_LIBZ
75#define rfbInitServer rfbInitServerWithPthreadsAndZRLE
76#else
77#define rfbInitServer rfbInitServerWithPthreadsButWithoutZRLE
78#endif
79#else
80#ifdef LIBVNCSERVER_HAVE_LIBZ
81#define rfbInitServer rfbInitServerWithoutPthreadsButWithZRLE
82#else
83#define rfbInitServer rfbInitServerWithoutPthreadsAndZRLE
84#endif
85#endif
86
87struct _rfbClientRec;
88struct _rfbScreenInfo;
89struct rfbCursor;
90
95};
96
102
103typedef void (*rfbKbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl);
104typedef void (*rfbKbdReleaseAllKeysProcPtr) (struct _rfbClientRec* cl);
105typedef void (*rfbPtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl);
106typedef void (*rfbSetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
107#ifdef LIBVNCSERVER_HAVE_LIBZ
108typedef void (*rfbSetXCutTextUTF8ProcPtr) (char* str,int len, struct _rfbClientRec* cl);
109#endif
110typedef struct rfbCursor* (*rfbGetCursorProcPtr) (struct _rfbClientRec* pScreen);
111typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
112typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
113typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
114typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
115typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result);
117typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
118typedef rfbBool (*rfbXvpHookPtr)(struct _rfbClientRec* cl, uint8_t, uint8_t);
119typedef int (*rfbSetDesktopSizeHookPtr)(int width, int height, int numScreens, struct rfbExtDesktopScreen* extDesktopScreens, struct _rfbClientRec* cl);
120typedef int (*rfbNumberOfExtDesktopScreensPtr)(struct _rfbClientRec* cl);
121typedef rfbBool (*rfbGetExtDesktopScreenPtr)(int seqnumber, struct rfbExtDesktopScreen *extDesktopScreen, struct _rfbClientRec* cl);
127typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y);
132typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status);
137typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl);
139typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string);
140
141typedef struct {
142 uint32_t count;
144 union {
145 uint8_t* bytes;
146 uint16_t* shorts;
147 } data;
149
154typedef struct _rfbSecurity {
155 uint8_t type;
156 void (*handler)(struct _rfbClientRec* cl);
157 struct _rfbSecurity* next;
159
164typedef struct _rfbProtocolExtension {
167 rfbBool (*newClient)(struct _rfbClientRec* client, void** data);
170 rfbBool (*init)(struct _rfbClientRec* client, void* data);
176 rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
177 void** data, int encodingNumber);
179 rfbBool (*handleMessage)(struct _rfbClientRec* client,
180 void* data,
181 const rfbClientToServerMsg* message);
182 void (*close)(struct _rfbClientRec* client, void* data);
183 void (*usage)(void);
185 int (*processArgument)(int argc, char *argv[]);
186 struct _rfbProtocolExtension* next;
188
189typedef struct _rfbExtensionData {
191 void* data;
192 struct _rfbExtensionData* next;
194
201typedef struct _rfbScreenInfo
202{
204 struct _rfbScreenInfo *scaledScreenNext;
206
207 int width;
210 int depth;
213
216
223
224 /* additions by libvncserver */
225
228 const char* desktopName;
229 char thisHost[255];
230
232 int port;
235 int maxFd;
236#ifdef WIN32
237 struct fd_set allFds;
238#else
239 fd_set allFds;
240#endif
241
245
248 struct _rfbClientRec* udpClient;
250 struct sockaddr_in udpRemoteAddr;
251
253
254 /* http stuff */
258 char* httpDir;
261
267
273#ifdef TODELETE
274 char* screen;
275#endif
279 struct _rfbClientRec* clientHead;
280 struct _rfbClientRec* pointerClient;
283 /* cursor */
284 int cursorX, cursorY,underCursorBufferLen;
288
298 rfbGetCursorProcPtr getCursorPtr;
304
309
312
313#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
314 MUTEX(cursorMutex);
315 rfbBool backgroundLoop;
316#endif
317
320
325
328
331
334
338
341
350 /* We have an additional IPv6 listen socket since there are systems that
351 don't support dual binding sockets under *any* circumstances, for
352 instance OpenBSD */
365 float fdQuota;
366#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
367 pthread_t listener_thread;
368 int pipe_notify_listener_thread[2];
369#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS)
370 uintptr_t listener_thread;
371#endif
372#ifdef LIBVNCSERVER_HAVE_LIBZ
375 rfbSetXCutTextUTF8ProcPtr setXCutTextUTF8;
376#endif
377 /* Timeout value for select() calls, mainly used for multithreaded servers. */
379} rfbScreenInfo, *rfbScreenInfoPtr;
380
381
386typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in,
387 rfbPixelFormat *out,
388 char *iptr, char *optr,
389 int bytesBetweenInputLines,
390 int width, int height);
391
392
393/* region stuff */
394
395struct sraRegion;
396typedef struct sraRegion* sraRegionPtr;
397
398/*
399 * Per-client structure.
400 */
401
402typedef void (*ClientGoneHookPtr)(struct _rfbClientRec* cl);
403typedef void (*ClientFramebufferUpdateRequestHookPtr)(struct _rfbClientRec* cl, rfbFramebufferUpdateRequestMsg* furMsg);
404
405typedef struct _rfbFileTransferData {
406 int fd;
413
414
415typedef struct _rfbStatList {
416 uint32_t type;
417 uint32_t sentCount;
418 uint32_t bytesSent;
420 uint32_t rcvdCount;
421 uint32_t bytesRcvd;
423 struct _rfbStatList *Next;
425
426typedef struct _rfbSslCtx rfbSslCtx;
427typedef struct _wsCtx wsCtx;
428
429typedef struct _rfbClientRec {
430
432 rfbScreenInfoPtr screen;
433
435 rfbScreenInfoPtr scaledScreen;
438
439
448
450 char *host;
451
452 /* RFB protocol minor version number */
455
456#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
457 pthread_t client_thread;
458#elif defined(LIBVNCSERVER_HAVE_WIN32THREADS)
459 uintptr_t client_thread;
460#endif
461
462 /* Note that the RFB_INITIALISATION_SHARED state is provided to support
463 clients that under some circumstances do not send a ClientInit message.
464 In particular the Mac OS X built-in VNC client (with protocolMinorVersion
465 == 889) is one of those. However, it only requires this support under
466 special circumstances that can only be determined during the initial
467 authentication. If the right conditions are met this state will be
468 set (see the auth.c file) when rfbProcessClientInitMessage is called.
469
470 If the state is RFB_INITIALISATION_SHARED we should not expect to receive
471 any ClientInit message, but instead should proceed to the next stage
472 of initialisation as though an implicit ClientInit message was received
473 with a shared-flag of true. (There is currently no corresponding
474 RFB_INITIALISATION_NOTSHARED state to represent an implicit ClientInit
475 message with a shared-flag of false because no known existing client
476 requires such support at this time.)
477
478 Note that software using LibVNCServer to provide a VNC server will only
479 ever have a chance to see the state field set to
480 RFB_INITIALISATION_SHARED if the software is multi-threaded and manages
481 to examine the state field during the extremely brief window after the
482 'None' authentication type selection has been received from the built-in
483 OS X VNC client and before the rfbProcessClientInitMessage function is
484 called -- control cannot return to the caller during this brief window
485 while the state field is set to RFB_INITIALISATION_SHARED. */
486
488 enum {
495 /* Ephemeral internal-use states that will never be seen by software
496 * using LibVNCServer to provide services: */
497
499 RFB_SHUTDOWN
500 } state;
501
507 int correMaxWidth, correMaxHeight;
508
510
511 /* The following member is only used during VNC authentication */
512 uint8_t authChallenge[CHALLENGESIZE];
513
514 /* The following members represent the update needed to get the client's
515 framebuffer from its present state to the current state of our
516 framebuffer.
517
518 If the client does not accept CopyRect encoding then the update is
519 simply represented as the region of the screen which has been modified
520 (modifiedRegion).
521
522 If the client does accept CopyRect encoding, then the update consists of
523 two parts. First we have a single copy from one region of the screen to
524 another (the destination of the copy is copyRegion), and second we have
525 the region of the screen which has been modified in some other way
526 (modifiedRegion).
527
528 Although the copy is of a single region, this region may have many
529 rectangles. When sending an update, the copyRegion is always sent
530 before the modifiedRegion. This is because the modifiedRegion may
531 overlap parts of the screen which are in the source of the copy.
532
533 In fact during normal processing, the modifiedRegion may even overlap
534 the destination copyRegion. Just before an update is sent we remove
535 from the copyRegion anything in the modifiedRegion. */
536
538 int copyDX, copyDY;
541
548
555 struct timeval startDeferring;
556 struct timeval startPtrDeferring;
560
567
574#define UPDATE_BUF_SIZE 32768
575
576 char updateBuf[UPDATE_BUF_SIZE];
577 int ublen;
578
579 /* statistics */
580 struct _rfbStatList *statEncList;
581 struct _rfbStatList *statMsgList;
584
585#ifdef LIBVNCSERVER_HAVE_LIBZ
586 /* zlib encoding -- necessary compression state info per client */
587
588 struct z_stream_s compStream;
589 rfbBool compStreamInited;
590 uint32_t zlibCompressLevel;
591#endif
592#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
594 int tightQualityLevel;
595
596#ifdef LIBVNCSERVER_HAVE_LIBJPEG
597 /* tight encoding -- preserve zlib streams' state for each client */
598 z_stream zsStruct[4];
599 rfbBool zsActive[4];
600 int zsLevel[4];
601 int tightCompressLevel;
602#endif
603#endif
604
605 /* Ultra Encoding support */
608
610
622 int cursorX,cursorY;
628 struct _rfbClientRec *prev;
629 struct _rfbClientRec *next;
630
631#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
637 int refCount;
638 MUTEX(refCountMutex);
639 COND(deleteCond);
640
641 MUTEX(outputMutex);
642 MUTEX(updateMutex);
643 COND(updateCond);
644#endif
645
646#ifdef LIBVNCSERVER_HAVE_LIBZ
647 void* zrleData;
648 int zywrleLevel;
649 int zywrleBuf[rfbZRLETileWidth * rfbZRLETileHeight];
650#endif
651
655
657
661
663#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)
664#define LIBVNCSERVER_SEND_MUTEX
665 MUTEX(sendMutex);
666#endif
667
668 /* buffers to hold pixel data before and after encoding.
669 per-client for thread safety */
675#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
676 uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */
677#ifdef LIBVNCSERVER_HAVE_LIBJPEG
678 /* TurboVNC Encoding support (extends TightVNC) */
679 int turboSubsampLevel;
680 int turboQualityLevel; /* 1-100 scale */
681#endif
682#endif
685 char *wspath; /* Requests path component */
686#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
687 int pipe_notify_client_thread[2];
688#endif
689
695
699
700#ifdef LIBVNCSERVER_HAVE_LIBZ
701 rfbBool enableExtendedClipboard;
702 uint32_t extClipboardUserCap;
703 uint32_t extClipboardMaxUnsolicitedSize;
704 char *extClipboardData;
705 int extClipboardDataSize;
706
707#ifdef LIBVNCSERVER_HAVE_LIBJPEG
708 /* Tight encoding internal variables, stored per-client for thread safety */
709 rfbBool tightUsePixelFormat24;
710 void *tightTJ;
711 int tightPngDstDataLen;
712#endif
713#endif
714} rfbClientRec, *rfbClientPtr;
715
721#define FB_UPDATE_PENDING(cl) \
722 (((cl)->enableCursorShapeUpdates && (cl)->cursorWasChanged) || \
723 (((cl)->enableCursorShapeUpdates == FALSE && \
724 ((cl)->cursorX != (cl)->screen->cursorX || \
725 (cl)->cursorY != (cl)->screen->cursorY))) || \
726 ((cl)->useNewFBSize && (cl)->newFBSizePending) || \
727 ((cl)->enableCursorPosUpdates && (cl)->cursorWasMoved) || \
728 !sraRgnEmpty((cl)->copyRegion) || !sraRgnEmpty((cl)->modifiedRegion))
729
730/*
731 * Macros for endian swapping.
732 */
733
734#define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff))
735
736#define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \
737 (((l) & 0x00ff00)))
738
739#define Swap32(l) ((((l) >> 24) & 0x000000ff)| \
740 (((l) & 0x00ff0000) >> 8) | \
741 (((l) & 0x0000ff00) << 8) | \
742 (((l) & 0x000000ff) << 24))
743
744
745extern char rfbEndianTest;
746
747#define Swap16IfLE(s) (rfbEndianTest ? Swap16(s) : (s))
748#define Swap24IfLE(l) (rfbEndianTest ? Swap24(l) : (l))
749#define Swap32IfLE(l) (rfbEndianTest ? Swap32(l) : (l))
750
751/* UltraVNC uses some windows structures unmodified, so the viewer expects LittleEndian Data */
752#define Swap16IfBE(s) (rfbEndianTest ? (s) : Swap16(s))
753#define Swap24IfBE(l) (rfbEndianTest ? (l) : Swap24(l))
754#define Swap32IfBE(l) (rfbEndianTest ? (l) : Swap32(l))
755
756/* sockets.c */
757
758extern int rfbMaxClientWait;
759
760extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
761extern void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen);
762extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
763extern void rfbCloseClient(rfbClientPtr cl);
764extern int rfbReadExact(rfbClientPtr cl, char *buf, int len);
765extern int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
766extern int rfbPeekExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
767extern int rfbWriteExact(rfbClientPtr cl, const char *buf, int len);
768extern int rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
769extern rfbSocket rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
770extern rfbSocket rfbConnectToTcpAddr(char* host, int port);
771extern rfbSocket rfbListenOnTCPPort(int port, in_addr_t iface);
772extern rfbSocket rfbListenOnTCP6Port(int port, const char* iface);
773extern rfbSocket rfbListenOnUDPPort(int port, in_addr_t iface);
774extern int rfbStringToAddr(char* string,in_addr_t* addr);
776
777#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
778/* websockets.c */
779
780extern rfbBool webSocketsCheck(rfbClientPtr cl);
781extern rfbBool webSocketCheckDisconnect(rfbClientPtr cl);
782extern int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst);
783extern int webSocketsDecode(rfbClientPtr cl, char *dst, int len);
784extern rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl);
785#endif
786
787/* rfbserver.c */
788
789/* Routines to iterate over the client list in a thread-safe way.
790 Only a single iterator can be in use at a time process-wide. */
791typedef struct rfbClientIterator *rfbClientIteratorPtr;
792
793extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
794extern rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen);
795extern rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator);
797extern void rfbIncrClientRef(rfbClientPtr cl);
798extern void rfbDecrClientRef(rfbClientPtr cl);
799
800extern void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
801extern rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
802extern rfbClientPtr rfbNewUDPClient(rfbScreenInfoPtr rfbScreen);
803extern rfbClientPtr rfbReverseConnection(rfbScreenInfoPtr rfbScreen,char *host, int port);
804extern void rfbClientConnectionGone(rfbClientPtr cl);
805extern void rfbProcessClientMessage(rfbClientPtr cl);
806extern void rfbClientConnFailed(rfbClientPtr cl, const char *reason);
807extern void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
808extern void rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen);
809extern rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion);
810extern rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h);
811extern rfbBool rfbSendUpdateBuf(rfbClientPtr cl);
812extern void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len);
813#ifdef LIBVNCSERVER_HAVE_LIBZ
814extern void rfbSendServerCutTextUTF8(rfbScreenInfoPtr rfbScreen,char *str, int len, char *fallbackLatin1Str, int latin1Len);
815#endif
816extern rfbBool rfbSendCopyRegion(rfbClientPtr cl,sraRegionPtr reg,int dx,int dy);
817extern rfbBool rfbSendLastRectMarker(rfbClientPtr cl);
818extern rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h);
819extern rfbBool rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h);
820extern rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours);
821extern void rfbSendBell(rfbScreenInfoPtr rfbScreen);
822
823extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
824extern rfbBool rfbSendFileTransferChunk(rfbClientPtr cl);
825extern rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer);
826extern rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, const char *buffer);
827extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
828extern rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length);
829
830void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len);
831
832/* translate.c */
833
835
836extern void rfbTranslateNone(char *table, rfbPixelFormat *in,
837 rfbPixelFormat *out,
838 char *iptr, char *optr,
839 int bytesBetweenInputLines,
840 int width, int height);
841extern rfbBool rfbSetTranslateFunction(rfbClientPtr cl);
842extern rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours);
843extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours);
844
845/* httpd.c */
846
847extern void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen);
848extern void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen);
849extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
850
851
852
853/* auth.c */
854
855extern void rfbAuthNewClient(rfbClientPtr cl);
856extern void rfbProcessClientSecurityType(rfbClientPtr cl);
857extern void rfbAuthProcessClientMessage(rfbClientPtr cl);
860
861/* rre.c */
862
863extern rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h);
864
865
866/* corre.c */
867
868extern rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h);
869
870
871/* hextile.c */
872
873extern rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
874 int h);
875
876/* ultra.c */
877
878/* Set maximum ultra rectangle size in pixels. Always allow at least
879 * two scan lines.
880 */
881#define ULTRA_MAX_RECT_SIZE (128*256)
882#define ULTRA_MAX_SIZE(min) ((( min * 2 ) > ULTRA_MAX_RECT_SIZE ) ? \
883 ( min * 2 ) : ULTRA_MAX_RECT_SIZE )
884
885extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h);
886
887
888#ifdef LIBVNCSERVER_HAVE_LIBZ
889/* zlib.c */
890
894#define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17)
895
896/* Set maximum zlib rectangle size in pixels. Always allow at least
897 * two scan lines.
898 */
899#define ZLIB_MAX_RECT_SIZE (128*256)
900#define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \
901 ( min * 2 ) : ZLIB_MAX_RECT_SIZE )
902
903extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
904 int h);
905
906#ifdef LIBVNCSERVER_HAVE_LIBJPEG
907/* tight.c */
908
909#define TIGHT_DEFAULT_COMPRESSION 6
910#define TURBO_DEFAULT_SUBSAMP 0
911
912extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
913
914extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
915extern rfbBool rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, int h);
916extern rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, int compressedLen);
917
918#if defined(LIBVNCSERVER_HAVE_LIBPNG)
919extern rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x,int y,int w,int h);
920#endif
921
922#endif
923#endif
924
925
926/* cursor.c */
927
928typedef struct rfbCursor {
931 unsigned char *source;
932 unsigned char *mask;
933 unsigned short width, height, xhot, yhot;
934 unsigned short foreRed, foreGreen, foreBlue;
935 unsigned short backRed, backGreen, backBlue;
936 unsigned char *richSource;
937 unsigned char *alphaSource;
939} rfbCursor, *rfbCursorPtr;
940extern unsigned char rfbReverseByte[0x100];
941
942extern rfbBool rfbSendCursorShape(rfbClientPtr cl/*, rfbScreenInfoPtr pScreen*/);
943extern rfbBool rfbSendCursorPos(rfbClientPtr cl);
944extern void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap);
945extern rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString);
946extern char* rfbMakeMaskForXCursor(int width,int height,char* cursorString);
947extern char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource);
948extern void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
949extern void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
950extern void rfbFreeCursor(rfbCursorPtr cursor);
951extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c);
952
954extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
955
956/* zrle.c */
957#ifdef LIBVNCSERVER_HAVE_LIBZ
958extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h);
959#endif
960
961/* stats.c */
962
963extern void rfbResetStats(rfbClientPtr cl);
964extern void rfbPrintStats(rfbClientPtr cl);
965
966/* font.c */
967
968typedef struct rfbFontData {
969 unsigned char* data;
976} rfbFontData,* rfbFontDataPtr;
977
978int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,rfbPixel colour);
979void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,rfbPixel colour);
981int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
982void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
983int rfbWidthOfString(rfbFontDataPtr font,const char* string);
984int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
985void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
987void rfbWholeFontBBox(rfbFontDataPtr font,int *x1, int *y1, int *x2, int *y2);
988
990rfbFontDataPtr rfbLoadConsoleFont(char *filename);
992void rfbFreeFont(rfbFontDataPtr font);
993
994/* draw.c */
995
996void rfbFillRect(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
997void rfbDrawPixel(rfbScreenInfoPtr s,int x,int y,rfbPixel col);
998void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
999
1000/* selbox.c */
1001
1006typedef void (*SelectionChangedHookPtr)(int _index);
1007extern int rfbSelectBox(rfbScreenInfoPtr rfbScreen,
1008 rfbFontDataPtr font, char** list,
1009 int x1, int y1, int x2, int y2,
1010 rfbPixel foreColour, rfbPixel backColour,
1011 int border,SelectionChangedHookPtr selChangedHook);
1012
1013/* cargs.c */
1014
1015extern void rfbUsage(void);
1016extern void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]);
1017extern rfbBool rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]);
1018extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]);
1019
1020/* main.c */
1021
1022extern void rfbLogEnable(int enabled);
1023typedef void (*rfbLogProc)(const char *format, ...);
1025extern void rfbLogPerror(const char *str);
1026
1027void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
1028void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
1029
1030void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
1031void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
1032
1033void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2);
1034void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
1035void rfbDoNothingWithClient(rfbClientPtr cl);
1039struct _rfbProtocolExtension* rfbGetExtensionIterator(void);
1042 void* data);
1044void* rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension* extension);
1045
1047rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
1048
1049/* functions to make a vnc server */
1050extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
1051 int width,int height,int bitsPerSample,int samplesPerPixel,
1052 int bytesPerPixel);
1053extern void rfbInitServer(rfbScreenInfoPtr rfbScreen);
1054extern void rfbShutdownServer(rfbScreenInfoPtr rfbScreen,rfbBool disconnectClients);
1055extern void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen,char *framebuffer,
1056 int width,int height, int bitsPerSample,int samplesPerPixel,
1057 int bytesPerPixel);
1058
1059extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);
1060extern void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt, ...);
1061
1062/* functions to accept/refuse a client that has been put on hold
1063 by a NewClientHookPtr function. Must not be called in other
1064 situations. */
1065extern void rfbStartOnHoldClient(rfbClientPtr cl);
1066extern void rfbRefuseOnHoldClient(rfbClientPtr cl);
1067
1068/* call one of these two functions to service the vnc clients.
1069 usec are the microseconds the select on the fds waits.
1070 if you are using the event loop, set this to some value > 0, so the
1071 server doesn't get a high load just by listening.
1072 rfbProcessEvents() returns TRUE if an update was pending. */
1073
1074extern void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground);
1075extern rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec);
1076extern rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo);
1077
1088
1089/* Statistics */
1090extern char *messageNameServer2Client(uint32_t type, char *buf, int len);
1091extern char *messageNameClient2Server(uint32_t type, char *buf, int len);
1092extern char *encodingName(uint32_t enc, char *buf, int len);
1093
1094extern rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type);
1095extern rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type);
1096
1097/* Each call to rfbStatRecord* adds one to the rect count for that type */
1098extern void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1099extern void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount); /* Specifically for tight encoding */
1100extern void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1101extern void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1102extern void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1103extern void rfbResetStats(rfbClientPtr cl);
1104extern void rfbPrintStats(rfbClientPtr cl);
1105
1106extern int rfbStatGetSentBytes(rfbClientPtr cl);
1107extern int rfbStatGetSentBytesIfRaw(rfbClientPtr cl);
1108extern int rfbStatGetRcvdBytes(rfbClientPtr cl);
1109extern int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl);
1110extern int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type);
1111extern int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type);
1112extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type);
1113extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type);
1114
1116extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_);
1117
1119extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer);
1120
1121
1122/*
1123 * Additions for Qt event loop integration
1124 * Original idea taken from vino.
1125 */
1126rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen);
1127rfbBool rfbUpdateClient(rfbClientPtr cl);
1128
1129
1130#if(defined __cplusplus)
1131}
1132#endif
1133
1308#endif
int y
Definition: SDLvncviewer.c:34
int x
Definition: SDLvncviewer.c:34
rfbLogProc rfbErr
Definition: rfb.h:1024
void rfbSetCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr c)
void rfbPurgeArguments(int *argc, int *position, int count, char *argv[])
rfbBool(* rfbGetExtDesktopScreenPtr)(int seqnumber, struct rfbExtDesktopScreen *extDesktopScreen, struct _rfbClientRec *cl)
Definition: rfb.h:121
struct rfbClientIterator * rfbClientIteratorPtr
Definition: rfb.h:791
void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2, int dx, int dy)
void rfbFreeFont(rfbFontDataPtr font)
free a dynamically loaded font
void(* rfbSetXCutTextProcPtr)(char *str, int len, struct _rfbClientRec *cl)
Definition: rfb.h:106
rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen)
int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type)
void rfbFreeCursor(rfbCursorPtr cursor)
void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x, int y, int w, int h)
rfbBool rfbSetTranslateFunction(rfbClientPtr cl)
rfbBool(* rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:111
int rfbStatGetSentBytesIfRaw(rfbClientPtr cl)
void rfbStartOnHoldClient(rfbClientPtr cl)
void * rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension *extension)
void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground)
enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl)
rfbClientPtr rfbNewUDPClient(rfbScreenInfoPtr rfbScreen)
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, unsigned char c, int x1, int y1, int x2, int y2, rfbPixel colour, rfbPixel backColour)
if colour==backColour, background is transparent
rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length)
struct _wsCtx wsCtx
Definition: rfb.h:427
rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension *extension)
void rfbCloseClient(rfbClientPtr cl)
void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen, sraRegionPtr modRegion)
void rfbUnregisterProtocolExtension(rfbProtocolExtension *extension)
void rfbRegisterTightVNCFileTransferExtension(void)
Register the TightVNC-1.3.x file transfer extension.
rfbBool rfbSendFileTransferChunk(rfbClientPtr cl)
rfbBool rfbSendUpdateBuf(rfbClientPtr cl)
rfbSocket rfbListenOnTCPPort(int port, in_addr_t iface)
int rfbCheckFds(rfbScreenInfoPtr rfbScreen, long usec)
int rfbReadExact(rfbClientPtr cl, char *buf, int len)
#define rfbInitServer
Definition: rfb.h:83
int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type)
rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h)
char * rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)
int rfbDrawChar(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, unsigned char c, rfbPixel colour)
void rfbRefuseOnHoldClient(rfbClientPtr cl)
void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2)
void rfbResetStats(rfbClientPtr cl)
rfbStatList * rfbStatLookupMessage(rfbClientPtr cl, uint32_t type)
int(* rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo *screen)
support the capability to view the caps/num/scroll states of the X server
Definition: rfb.h:117
rfbBool rfbSetNonBlocking(rfbSocket sock)
void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen, sraRegionPtr copyRegion, int dx, int dy)
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer)
send a TextChat message to a client
rfbFontDataPtr rfbLoadConsoleFont(char *filename)
dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16
void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_)
Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported.
int rfbSelectBox(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, char **list, int x1, int y1, int x2, int y2, rfbPixel foreColour, rfbPixel backColour, int border, SelectionChangedHookPtr selChangedHook)
char * rfbMakeMaskFromAlphaSource(int width, int height, unsigned char *alphaSource)
void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr cursor)
void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
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)
char rfbEndianTest
rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion)
void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2, int dx, int dy)
void rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
void rfbDoNothingWithClient(rfbClientPtr cl)
int rfbWidthOfString(rfbFontDataPtr font, const char *string)
rfbStatList * rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type)
void(* SelectionChangedHookPtr)(int _index)
this opens a modal select box.
Definition: rfb.h:1006
void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen)
void rfbWholeFontBBox(rfbFontDataPtr font, int *x1, int *y1, int *x2, int *y2)
this returns the smallest box enclosing any character of font.
rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours)
void(* ClientGoneHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:402
void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height)
rfbSocketState
Definition: rfb.h:97
void rfbClientConnectionGone(rfbClientPtr cl)
rfbBool rfbProcessArguments(rfbScreenInfoPtr rfbScreen, int *argc, char *argv[])
char * encodingName(uint32_t enc, char *buf, int len)
rfbBool rfbSendLastRectMarker(rfbClientPtr cl)
rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours)
void rfbUnregisterSecurityHandler(rfbSecurityHandler *handler)
struct sraRegion * sraRegionPtr
Definition: rfb.h:396
void rfbClientConnFailed(rfbClientPtr cl, const char *reason)
void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x, int y, int w, int h)
rfbBool rfbProcessSizeArguments(int *width, int *height, int *bpp, int *argc, char *argv[])
rfbClientPtr rfbReverseConnection(rfbScreenInfoPtr rfbScreen, char *host, int port)
void rfbProcessClientMessage(rfbClientPtr cl)
int rfbStatGetRcvdBytes(rfbClientPtr cl)
void rfbConvertLSBCursorBitmapOrMask(int width, int height, unsigned char *bitmap)
void rfbShutdownServer(rfbScreenInfoPtr rfbScreen, rfbBool disconnectClients)
void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount)
void rfbDrawLine(rfbScreenInfoPtr s, int x1, int y1, int x2, int y2, rfbPixel col)
void rfbAuthProcessClientMessage(rfbClientPtr cl)
void rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
cursor handling for the pointer
void rfbFillRect(rfbScreenInfoPtr s, int x1, int y1, int x2, int y2, rfbPixel col)
void(* ClientFramebufferUpdateRequestHookPtr)(struct _rfbClientRec *cl, rfbFramebufferUpdateRequestMsg *furMsg)
Definition: rfb.h:403
void rfbLogPerror(const char *str)
int rfbStringToAddr(char *string, in_addr_t *addr)
rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension *extension, void *data)
void rfbScreenCleanup(rfbScreenInfoPtr screenInfo)
rfbBool rfbSendCursorPos(rfbClientPtr cl)
void(* rfbDisplayHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:114
void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt,...)
rfbBool rfbUpdateClient(rfbClientPtr cl)
int rfbWidthOfChar(rfbFontDataPtr font, unsigned char c)
rfbScreenInfoPtr rfbGetScreen(int *argc, char **argv, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x, int y, int w, int h)
rfbBool rfbSendCursorShape(rfbClientPtr cl)
rfbLogProc rfbLog
unsigned char rfbReverseByte[0x100]
void rfbRegisterProtocolExtension(rfbProtocolExtension *extension)
void rfbIncrClientRef(rfbClientPtr cl)
rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, const char *buffer)
void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
void(* rfbSetSingleWindowProcPtr)(struct _rfbClientRec *cl, int x, int y)
If x==1 and y==1 then set the whole display else find the window underneath x and y and set the frame...
Definition: rfb.h:127
rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo)
void rfbUnregisterTightVNCFileTransferExtension(void)
Unregister the TightVNC-1.3.x file transfer extension.
rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer)
int(* rfbNumberOfExtDesktopScreensPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:120
rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo, long usec)
rfbSocket rfbListenOnTCP6Port(int port, const char *iface)
rfbBool(* rfbPasswordCheckProcPtr)(struct _rfbClientRec *cl, const char *encryptedPassWord, int len)
Definition: rfb.h:112
rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, int h)
void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen, sraRegionPtr copyRegion, int dx, int dy)
rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator)
void rfbReleaseExtensionIterator(void)
void rfbAuthNewClient(rfbClientPtr cl)
void(* rfbSetServerInputProcPtr)(struct _rfbClientRec *cl, int status)
Status determines if the X11 server permits input from the local user status==0 or 1.
Definition: rfb.h:132
void(* rfbPtrAddEventProcPtr)(int buttonMask, int x, int y, struct _rfbClientRec *cl)
Definition: rfb.h:105
int rfbMaxClientWait
enum rfbNewClientAction(* rfbNewClientHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:113
int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type)
char * rfbMakeMaskForXCursor(int width, int height, char *cursorString)
void rfbDecrClientRef(rfbClientPtr cl)
rfbSocket rfbConnect(rfbScreenInfoPtr rfbScreen, char *host, int port)
void rfbDrawPixel(rfbScreenInfoPtr s, int x, int y, rfbPixel col)
rfbSocket rfbConnectToTcpAddr(char *host, int port)
rfbBool rfbEconomicTranslate
struct _rfbSslCtx rfbSslCtx
Definition: rfb.h:426
void rfbDrawString(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, const char *string, rfbPixel colour)
int rfbWriteExact(rfbClientPtr cl, const char *buf, int len)
void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours)
rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
int rfbStatGetSentBytes(rfbClientPtr cl)
void(* rfbTranslateFnType)(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height)
rfbTranslateFnType is the type of translation functions.
Definition: rfb.h:386
void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen, char *framebuffer, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen)
void(* rfbKbdReleaseAllKeysProcPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:104
void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr cursor)
void rfbClientListInit(rfbScreenInfoPtr rfbScreen)
void rfbLogEnable(int enabled)
rfbBool(* rfbXvpHookPtr)(struct _rfbClientRec *cl, uint8_t, uint8_t)
Definition: rfb.h:118
void rfbPrintStats(rfbClientPtr cl)
rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
rfbBool rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h)
void(* rfbKbdAddEventProcPtr)(rfbBool down, rfbKeySym keySym, struct _rfbClientRec *cl)
Definition: rfb.h:103
void rfbProcessClientSecurityType(rfbClientPtr cl)
rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h)
int(* rfbSetDesktopSizeHookPtr)(int width, int height, int numScreens, struct rfbExtDesktopScreen *extDesktopScreens, struct _rfbClientRec *cl)
Definition: rfb.h:119
int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len, int timeout)
int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type)
int rfbPeekExactTimeout(rfbClientPtr cl, char *buf, int len, int timeout)
rfbCursorPtr rfbMakeXCursor(int width, int height, char *cursorString, char *maskString)
void(* rfbSetTextChat)(struct _rfbClientRec *cl, int length, char *string)
Handle the textchat messages.
Definition: rfb.h:139
char * messageNameServer2Client(uint32_t type, char *buf, int len)
void rfbUsage(void)
void(* rfbDisplayFinishedHookPtr)(struct _rfbClientRec *cl, int result)
Definition: rfb.h:115
void(* rfbLogProc)(const char *format,...)
Definition: rfb.h:1023
rfbBool rfbCheckPasswordByList(rfbClientPtr cl, const char *response, int len)
to check against plain passwords
void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
rfbSocket rfbListenOnUDPPort(int port, in_addr_t iface)
void rfbFontBBox(rfbFontDataPtr font, unsigned char c, int *x1, int *y1, int *x2, int *y2)
rfbNewClientAction
Definition: rfb.h:91
struct _rfbProtocolExtension * rfbGetExtensionIterator(void)
void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
void rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
void rfbRegisterSecurityHandler(rfbSecurityHandler *handler)
void rfbSendBell(rfbScreenInfoPtr rfbScreen)
void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen)
rfbBool rfbSendCopyRegion(rfbClientPtr cl, sraRegionPtr reg, int dx, int dy)
void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
char * messageNameClient2Server(uint32_t type, char *buf, int len)
int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl)
int(* rfbFileTransferPermitted)(struct _rfbClientRec *cl)
Permit the server to allow or deny filetransfers.
Definition: rfb.h:137
void rfbInitSockets(rfbScreenInfoPtr rfbScreen)
@ RFB_SOCKET_READY
Definition: rfb.h:99
@ RFB_SOCKET_INIT
Definition: rfb.h:98
@ RFB_SOCKET_SHUTDOWN
Definition: rfb.h:100
@ RFB_CLIENT_ACCEPT
Definition: rfb.h:92
@ RFB_CLIENT_REFUSE
Definition: rfb.h:94
@ RFB_CLIENT_ON_HOLD
Definition: rfb.h:93
#define UPDATE_BUF_SIZE
UPDATE_BUF_SIZE must be big enough to send at least one whole line of the framebuffer.
Definition: rfb.h:574
int8_t rfbBool
Definition: rfbproto.h:108
uint32_t rfbKeySym
Definition: rfbproto.h:122
uint32_t rfbPixel
Definition: rfbproto.h:123
#define rfbZRLETileHeight
Definition: rfbproto.h:951
#define rfbZRLETileWidth
Definition: rfbproto.h:950
#define CHALLENGESIZE
Definition: rfbproto.h:1555
#define rfbSocket
Definition: rfbproto.h:104
struct sraRegion sraRegion
Definition: rfbregion.h:18
rfbBool compStreamInitedLZO
Definition: rfb.h:606
struct _rfbClientRec * prev
Definition: rfb.h:628
rfbBool enableServerIdentity
client supports ServerIdentity encoding
Definition: rfb.h:614
char * translateLookupTable
Definition: rfb.h:565
rfbBool readyForSetColourMapEntries
Definition: rfb.h:504
struct _rfbClientRec * next
Definition: rfb.h:629
char * zrleBeforeBuf
for threaded zrle
Definition: rfb.h:659
char * host
Definition: rfb.h:450
ClientFramebufferUpdateRequestHookPtr clientFramebufferUpdateRequestHook
clientFramebufferUpdateRequestHook is called when a client requests a frame buffer update.
Definition: rfb.h:694
rfbSslCtx * sslctx
Definition: rfb.h:683
rfbBool enableCursorShapeUpdates
client supports cursor shape updates
Definition: rfb.h:617
rfbBool PalmVNC
how did the client tell us it wanted the screen changed? Ultra style or palm style?
Definition: rfb.h:437
void * clientData
private data.
Definition: rfb.h:446
rfbBool cursorWasChanged
cursor shape update should be sent
Definition: rfb.h:620
rfbBool onHold
Definition: rfb.h:503
sraRegionPtr requestedRegion
As part of the FramebufferUpdateRequest, a client can express interest in a subrectangle of the whole...
Definition: rfb.h:547
int afterEncBufLen
Definition: rfb.h:674
int ublen
Definition: rfb.h:577
char * beforeEncBuf
for thread safety for rfbSendFBUpdate()
Definition: rfb.h:670
char * wspath
Definition: rfb.h:685
int afterEncBufSize
Definition: rfb.h:673
int progressiveSliceY
if progressive updating is on, this variable holds the current y coordinate of the progressive slice.
Definition: rfb.h:654
rfbBool enableCursorPosUpdates
client supports cursor position updates
Definition: rfb.h:618
int protocolMajorVersion
Definition: rfb.h:453
rfbBool enableSupportedEncodings
client supports SupportedEncodings encoding
Definition: rfb.h:613
rfbExtensionData * extensions
Definition: rfb.h:656
int rawBytesEquivalent
Definition: rfb.h:582
rfbBool useExtDesktopSize
Definition: rfb.h:696
rfbTranslateFnType translateFn
translateFn points to the translation function which is used to copy and translate a rectangle from t...
Definition: rfb.h:564
int lastPtrButtons
Definition: rfb.h:559
rfbBool useRichCursorEncoding
rfbEncodingRichCursor is preferred
Definition: rfb.h:619
int preferredEncoding
Definition: rfb.h:506
rfbBool cursorWasMoved
cursor position update should be sent
Definition: rfb.h:621
rfbBool newFBSizePending
framebuffer size was changed
Definition: rfb.h:626
char * lzoWrkMem
Definition: rfb.h:607
rfbBool useNewFBSize
client supports NewFBSize encoding
Definition: rfb.h:625
ClientGoneHookPtr clientGoneHook
Definition: rfb.h:447
struct _rfbStatList * statEncList
Definition: rfb.h:580
int copyDX
Definition: rfb.h:538
sraRegionPtr modifiedRegion
Definition: rfb.h:540
rfbScreenInfoPtr scaledScreen
points to a scaled version of the screen buffer in cl->scaledScreenList
Definition: rfb.h:435
struct _rfbStatList * statMsgList
Definition: rfb.h:581
int lastPtrX
Definition: rfb.h:557
wsCtx * wsctx
Definition: rfb.h:684
int lastPtrY
Definition: rfb.h:558
rfbSocket sock
Definition: rfb.h:449
rfbBool useCopyRect
Definition: rfb.h:505
sraRegionPtr copyRegion
the destination region of the copy
Definition: rfb.h:537
rfbBool enableLastRectEncoding
client supports LastRect encoding
Definition: rfb.h:616
int cursorX
Definition: rfb.h:622
rfbFileTransferData fileTransfer
Definition: rfb.h:609
rfbBool enableKeyboardLedState
client supports KeyboardState encoding
Definition: rfb.h:615
void * paletteHelper
Definition: rfb.h:660
int lastKeyboardLedState
keep track of last value so we can send change events
Definition: rfb.h:611
int bytesSent
Definition: rfb.h:583
char * afterEncBuf
Definition: rfb.h:672
int correMaxHeight
Definition: rfb.h:507
int requestedDesktopSizeChange
Definition: rfb.h:697
int lastDesktopSizeChangeError
Definition: rfb.h:698
@ RFB_AUTHENTICATION
authenticating
Definition: rfb.h:491
@ RFB_SECURITY_TYPE
negotiating security (RFB v.3.7)
Definition: rfb.h:490
@ RFB_INITIALISATION
sending initialisation messages
Definition: rfb.h:492
@ RFB_PROTOCOL_VERSION
establishing protocol version
Definition: rfb.h:489
@ RFB_INITIALISATION_SHARED
sending initialisation messages with implicit shared-flag already true
Definition: rfb.h:498
@ RFB_NORMAL
normal protocol messages
Definition: rfb.h:493
rfbBool reverseConnection
Definition: rfb.h:502
rfbBool enableSupportedMessages
client supports SupportedMessages encoding
Definition: rfb.h:612
int beforeEncBufSize
Definition: rfb.h:671
int protocolMinorVersion
Definition: rfb.h:454
rfbScreenInfoPtr screen
back pointer to the screen
Definition: rfb.h:432
rfbBool viewOnly
Definition: rfb.h:509
rfbPixelFormat format
Definition: rfb.h:566
uint8_t * bytes
Definition: rfb.h:145
uint16_t * shorts
Definition: rfb.h:146
uint32_t count
Definition: rfb.h:142
rfbBool is16
is the data format short?
Definition: rfb.h:143
Definition: rfb.h:928
unsigned short yhot
metrics
Definition: rfb.h:933
rfbBool cleanupSource
Definition: rfb.h:930
rfbBool cleanupMask
Definition: rfb.h:930
unsigned char * mask
points to bits
Definition: rfb.h:932
unsigned short backRed
Definition: rfb.h:935
unsigned short backBlue
device-independent colour
Definition: rfb.h:935
unsigned short width
Definition: rfb.h:933
unsigned short foreRed
Definition: rfb.h:934
unsigned short height
Definition: rfb.h:933
unsigned short foreGreen
Definition: rfb.h:934
unsigned short backGreen
Definition: rfb.h:935
unsigned short foreBlue
device-independent colour
Definition: rfb.h:934
unsigned char * source
points to bits
Definition: rfb.h:931
rfbBool cleanupRichSource
Definition: rfb.h:930
rfbBool cleanup
set this to true if LibVNCServer has to free this cursor
Definition: rfb.h:930
unsigned short xhot
Definition: rfb.h:933
unsigned char * richSource
source bytes for a rich cursor
Definition: rfb.h:936
rfbBool alphaPreMultiplied
if richSource already has alpha applied
Definition: rfb.h:938
unsigned char * alphaSource
source for alpha blending info
Definition: rfb.h:937
rfbProtocolExtension * extension
Definition: rfb.h:190
struct _rfbExtensionData * next
Definition: rfb.h:192
void * data
Definition: rfb.h:191
int compressionEnabled
Definition: rfb.h:407
int * metaData
metaData is a 256*5 array: for each character (offset,width,height,x,y)
Definition: rfb.h:975
unsigned char * data
Definition: rfb.h:969
Protocol extension handling.
Definition: rfb.h:164
struct _rfbProtocolExtension * next
Definition: rfb.h:186
int * pseudoEncodings
if pseudoEncodings is not NULL, it contains a 0 terminated list of the pseudo encodings handled by th...
Definition: rfb.h:173
Per-screen (framebuffer) structure.
Definition: rfb.h:202
rfbBool udpSockConnected
Definition: rfb.h:249
rfbBool httpInitDone
Definition: rfb.h:255
void * authPasswdData
Definition: rfb.h:263
char * httpDir
Definition: rfb.h:258
rfbKbdReleaseAllKeysProcPtr kbdReleaseAllKeys
Definition: rfb.h:295
rfbSocket httpListen6Sock
Definition: rfb.h:355
rfbBool httpEnableProxyConnect
Definition: rfb.h:256
rfbPtrAddEventProcPtr ptrAddEvent
Definition: rfb.h:296
int maxFd
Definition: rfb.h:235
rfbSocket listenSock
Definition: rfb.h:233
int width
Definition: rfb.h:207
rfbGetCursorProcPtr getCursorPtr
Definition: rfb.h:298
in_addr_t listenInterface
Definition: rfb.h:326
int deferUpdateTime
this is the amount of milliseconds to wait at least before sending an update.
Definition: rfb.h:272
rfbBool ignoreSIGPIPE
if TRUE, an ignoring signal handler is installed for SIGPIPE
Definition: rfb.h:319
rfbSetSingleWindowProcPtr setSingleWindow
Definition: rfb.h:300
char * sslcertfile
Definition: rfb.h:347
int maxRectsPerUpdate
send only this many rectangles in one update
Definition: rfb.h:269
char * listen6Interface
Definition: rfb.h:349
rfbKbdAddEventProcPtr kbdAddEvent
Definition: rfb.h:294
rfbSocket udpSock
Definition: rfb.h:247
int select_timeout_usec
Definition: rfb.h:378
rfbXvpHookPtr xvpHook
xvpHook is called to handle an xvp client message
Definition: rfb.h:345
int protocolMajorVersion
What does the server tell the new clients which version it supports.
Definition: rfb.h:336
rfbNumberOfExtDesktopScreensPtr numberOfExtDesktopScreensHook
Optional hooks to query ExtendedDesktopSize screen information.
Definition: rfb.h:360
int scaledScreenRefCount
Definition: rfb.h:205
int port
Definition: rfb.h:232
rfbPixel whitePixel
Definition: rfb.h:215
rfbGetKeyboardLedStateHookPtr getKeyboardLedStateHook
These hooks are called to pass keyboard state back to the client.
Definition: rfb.h:311
rfbDisplayFinishedHookPtr displayFinishedHook
displayFinishedHook is called just after a frame buffer update
Definition: rfb.h:343
int maxSock
Definition: rfb.h:234
char * sslkeyfile
Definition: rfb.h:346
rfbSetServerInputProcPtr setServerInput
Definition: rfb.h:301
rfbDisplayHookPtr displayHook
displayHook is called just before a frame buffer update
Definition: rfb.h:308
rfbBool dontConvertRichCursorToXCursor
Definition: rfb.h:286
struct _rfbClientRec * clientHead
Definition: rfb.h:279
rfbSocket inetdSock
Definition: rfb.h:243
struct rfbCursor * cursor
Definition: rfb.h:287
int sizeInBytes
Definition: rfb.h:212
rfbGetExtDesktopScreenPtr getExtDesktopScreenHook
Definition: rfb.h:361
rfbSetTranslateFunctionProcPtr setTranslateFunction
Definition: rfb.h:299
struct _rfbScreenInfo * scaledScreenNext
this structure has children that are scaled versions of this screen
Definition: rfb.h:204
int progressiveSliceHeight
if not zero, only a slice of this height is processed every time an update should be sent.
Definition: rfb.h:324
rfbSetXCutTextProcPtr setXCutText
Definition: rfb.h:297
rfbSetDesktopSizeHookPtr setDesktopSizeHook
hook to let client set resolution
Definition: rfb.h:357
int maxClientWait
Definition: rfb.h:252
int paddedWidthInBytes
Definition: rfb.h:208
rfbBool dontDisconnect
Definition: rfb.h:278
rfbPixelFormat serverFormat
Definition: rfb.h:226
char * frameBuffer
the frameBuffer has to be supplied by the serving process.
Definition: rfb.h:293
enum rfbSocketState socketState
Definition: rfb.h:242
rfbPasswordCheckProcPtr passwordCheck
Definition: rfb.h:262
rfbSetTextChat setTextChat
Definition: rfb.h:303
int cursorX
Definition: rfb.h:284
struct _rfbClientRec * pointerClient
"Mutex" for pointer events
Definition: rfb.h:280
int udpPort
Definition: rfb.h:246
float fdQuota
This value between 0 and 1.0 defines which fraction of the maximum number of file descriptors LibVNCS...
Definition: rfb.h:365
int deferPtrUpdateTime
Definition: rfb.h:327
char * versionString
rfbEncodingServerIdentity
Definition: rfb.h:333
const char * desktopName
Definition: rfb.h:228
rfbBool permitFileTransfer
command line authorization of file transfers
Definition: rfb.h:340
rfbPixel blackPixel
Definition: rfb.h:214
rfbBool autoPort
Definition: rfb.h:231
int httpPort
Definition: rfb.h:257
rfbColourMap colourMap
set this if rfbServerFormat.trueColour==FALSE
Definition: rfb.h:227
int depth
Definition: rfb.h:210
char * underCursorBuffer
Definition: rfb.h:285
int height
Definition: rfb.h:209
rfbBool handleEventsEagerly
handle as many input events as possible (default off)
Definition: rfb.h:330
rfbSocket httpListenSock
Definition: rfb.h:259
rfbBool inetdInitDone
Definition: rfb.h:244
rfbSocket httpSock
Definition: rfb.h:260
int ipv6port
The port to listen on when using IPv6.
Definition: rfb.h:348
void * screenData
some screen specific data can be put into a struct where screenData points to.
Definition: rfb.h:222
fd_set allFds
Definition: rfb.h:239
int authPasswdFirstViewOnly
If rfbAuthPasswdData is given a list, this is the first view only password.
Definition: rfb.h:266
int protocolMinorVersion
Definition: rfb.h:337
rfbNewClientHookPtr newClientHook
newClientHook is called just after a new client is created
Definition: rfb.h:306
int http6Port
Definition: rfb.h:354
rfbBool alwaysShared
Definition: rfb.h:276
rfbFileTransferPermitted getFileTransferPermission
Definition: rfb.h:302
int bitsPerPixel
Definition: rfb.h:211
rfbSocket listen6Sock
Definition: rfb.h:353
rfbBool neverShared
Definition: rfb.h:277
struct _rfbClientRec * udpClient
Definition: rfb.h:248
Security handling (RFB protocol version 3.7)
Definition: rfb.h:154
uint8_t type
Definition: rfb.h:155
struct _rfbSecurity * next
Definition: rfb.h:157
uint32_t bytesSent
Definition: rfb.h:418
uint32_t bytesSentIfRaw
Definition: rfb.h:419
uint32_t sentCount
Definition: rfb.h:417
uint32_t bytesRcvd
Definition: rfb.h:421
uint32_t rcvdCount
Definition: rfb.h:420
struct _rfbStatList * Next
Definition: rfb.h:423
uint32_t type
Definition: rfb.h:416
uint32_t bytesRcvdIfRaw
Definition: rfb.h:422
#define MUTEX(mutex)
Definition: threading.h:86
#define COND(cond)
Definition: threading.h:91
rfbClient * client
Definition: vnc2mpg.c:358
char * filename
Definition: vnc2mpg.c:360
#define height
Definition: vncev.c:19
#define width
Definition: vncev.c:18