Go to the documentation of this file.
1 #ifndef RFB_H
2 #define RFB_H
12 /*
13  * Copyright (C) 2005 Rohit Kumar <>,
14  * Johannes E. Schindelin <>
15  * Copyright (C) 2002 RealVNC Ltd.
16  * OSXvnc Copyright (C) 2001 Dan McGuirk <>.
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
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  */
36 #if(defined __cplusplus)
37 extern "C"
38 {
39 #endif
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <string.h>
44 #include <rfb/rfbproto.h>
46 #if defined(ANDROID) || defined(LIBVNCSERVER_HAVE_ANDROID)
47 #include <arpa/inet.h>
48 #include <sys/select.h>
49 #endif
52 #include <sys/types.h>
53 #endif
55 #ifdef WIN32
56 typedef UINT32 in_addr_t;
57 #include <winsock2.h>
59 #undef socklen_t
60 #include <ws2tcpip.h>
61 #endif
62 #ifdef _MSC_VER
63 #pragma warning(disable:4996)
64 #endif
65 #endif
67 #include <rfb/threading.h>
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. */
75 #define rfbInitServer rfbInitServerWithPthreadsAndZRLE
76 #else
77 #define rfbInitServer rfbInitServerWithPthreadsButWithoutZRLE
78 #endif
79 #else
81 #define rfbInitServer rfbInitServerWithoutPthreadsButWithZRLE
82 #else
83 #define rfbInitServer rfbInitServerWithoutPthreadsAndZRLE
84 #endif
85 #endif
87 struct _rfbClientRec;
88 struct _rfbScreenInfo;
89 struct rfbCursor;
95 };
101 };
103 typedef void (*rfbKbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl);
104 typedef void (*rfbKbdReleaseAllKeysProcPtr) (struct _rfbClientRec* cl);
105 typedef void (*rfbPtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl);
106 typedef void (*rfbSetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
107 typedef struct rfbCursor* (*rfbGetCursorProcPtr) (struct _rfbClientRec* pScreen);
108 typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
109 typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
110 typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
111 typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
112 typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result);
114 typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
115 typedef rfbBool (*rfbXvpHookPtr)(struct _rfbClientRec* cl, uint8_t, uint8_t);
116 typedef int (*rfbSetDesktopSizeHookPtr)(int width, int height, int numScreens, struct rfbExtDesktopScreen* extDesktopScreens, struct _rfbClientRec* cl);
117 typedef int (*rfbNumberOfExtDesktopScreensPtr)(struct _rfbClientRec* cl);
118 typedef rfbBool (*rfbGetExtDesktopScreenPtr)(int seqnumber, struct rfbExtDesktopScreen *extDesktopScreen, struct _rfbClientRec* cl);
124 typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y);
129 typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status);
134 typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl);
136 typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string);
138 typedef struct {
139  uint32_t count;
141  union {
142  uint8_t* bytes;
143  uint16_t* shorts;
144  } data;
145 } rfbColourMap;
151 typedef struct _rfbSecurity {
152  uint8_t type;
153  void (*handler)(struct _rfbClientRec* cl);
154  struct _rfbSecurity* next;
161 typedef struct _rfbProtocolExtension {
164  rfbBool (*newClient)(struct _rfbClientRec* client, void** data);
167  rfbBool (*init)(struct _rfbClientRec* client, void* data);
173  rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
174  void** data, int encodingNumber);
176  rfbBool (*handleMessage)(struct _rfbClientRec* client,
177  void* data,
178  const rfbClientToServerMsg* message);
179  void (*close)(struct _rfbClientRec* client, void* data);
180  void (*usage)(void);
182  int (*processArgument)(int argc, char *argv[]);
183  struct _rfbProtocolExtension* next;
186 typedef struct _rfbExtensionData {
188  void* data;
189  struct _rfbExtensionData* next;
198 typedef struct _rfbScreenInfo
199 {
201  struct _rfbScreenInfo *scaledScreenNext;
204  int width;
206  int height;
207  int depth;
219  void* screenData;
221  /* additions by libvncserver */
225  const char* desktopName;
226  char thisHost[255];
229  int port;
231  int maxSock;
232  int maxFd;
233 #ifdef WIN32
234  struct fd_set allFds;
235 #else
236  fd_set allFds;
237 #endif
239  enum rfbSocketState socketState;
243  int udpPort;
245  struct _rfbClientRec* udpClient;
247  struct sockaddr_in udpRemoteAddr;
251  /* http stuff */
254  int httpPort;
255  char* httpDir;
270 #ifdef TODELETE
271  char* screen;
272 #endif
276  struct _rfbClientRec* clientHead;
277  struct _rfbClientRec* pointerClient;
280  /* cursor */
281  int cursorX, cursorY,underCursorBufferLen;
284  struct rfbCursor* cursor;
290  char* frameBuffer;
295  rfbGetCursorProcPtr getCursorPtr;
311  MUTEX(cursorMutex);
312  rfbBool backgroundLoop;
313 #endif
323  in_addr_t listenInterface;
343  char *sslkeyfile;
344  char *sslcertfile;
345  int ipv6port;
347  /* We have an additional IPv6 listen socket since there are systems that
348  don't support dual binding sockets under *any* circumstances, for
349  instance OpenBSD */
362  float fdQuota;
364 } rfbScreenInfo, *rfbScreenInfoPtr;
371 typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in,
372  rfbPixelFormat *out,
373  char *iptr, char *optr,
374  int bytesBetweenInputLines,
375  int width, int height);
378 /* region stuff */
380 struct sraRegion;
381 typedef struct sraRegion* sraRegionPtr;
383 /*
384  * Per-client structure.
385  */
387 typedef void (*ClientGoneHookPtr)(struct _rfbClientRec* cl);
388 typedef void (*ClientFramebufferUpdateRequestHookPtr)(struct _rfbClientRec* cl, rfbFramebufferUpdateRequestMsg* furMsg);
390 typedef struct _rfbFileTransferData {
391  int fd;
393  int fileSize;
396  int sending;
400 typedef struct _rfbStatList {
401  uint32_t type;
402  uint32_t sentCount;
403  uint32_t bytesSent;
404  uint32_t bytesSentIfRaw;
405  uint32_t rcvdCount;
406  uint32_t bytesRcvd;
407  uint32_t bytesRcvdIfRaw;
408  struct _rfbStatList *Next;
409 } rfbStatList;
411 typedef struct _rfbSslCtx rfbSslCtx;
412 typedef struct _wsCtx wsCtx;
414 typedef struct _rfbClientRec {
417  rfbScreenInfoPtr screen;
420  rfbScreenInfoPtr scaledScreen;
431  void* clientData;
435  char *host;
437  /* RFB protocol minor version number */
442  pthread_t client_thread;
444  uintptr_t client_thread;
445 #endif
447  /* Note that the RFB_INITIALISATION_SHARED state is provided to support
448  clients that under some circumstances do not send a ClientInit message.
449  In particular the Mac OS X built-in VNC client (with protocolMinorVersion
450  == 889) is one of those. However, it only requires this support under
451  special circumstances that can only be determined during the initial
452  authentication. If the right conditions are met this state will be
453  set (see the auth.c file) when rfbProcessClientInitMessage is called.
455  If the state is RFB_INITIALISATION_SHARED we should not expect to receive
456  any ClientInit message, but instead should proceed to the next stage
457  of initialisation as though an implicit ClientInit message was received
458  with a shared-flag of true. (There is currently no corresponding
459  RFB_INITIALISATION_NOTSHARED state to represent an implicit ClientInit
460  message with a shared-flag of false because no known existing client
461  requires such support at this time.)
463  Note that software using LibVNCServer to provide a VNC server will only
464  ever have a chance to see the state field set to
465  RFB_INITIALISATION_SHARED if the software is multi-threaded and manages
466  to examine the state field during the extremely brief window after the
467  'None' authentication type selection has been received from the built-in
468  OS X VNC client and before the rfbProcessClientInitMessage function is
469  called -- control cannot return to the caller during this brief window
470  while the state field is set to RFB_INITIALISATION_SHARED. */
473  enum {
480  /* Ephemeral internal-use states that will never be seen by software
481  * using LibVNCServer to provide services: */
484  } state;
491  int correMaxWidth, correMaxHeight;
495  /* The following member is only used during VNC authentication */
496  uint8_t authChallenge[CHALLENGESIZE];
498  /* The following members represent the update needed to get the client's
499  framebuffer from its present state to the current state of our
500  framebuffer.
502  If the client does not accept CopyRect encoding then the update is
503  simply represented as the region of the screen which has been modified
504  (modifiedRegion).
506  If the client does accept CopyRect encoding, then the update consists of
507  two parts. First we have a single copy from one region of the screen to
508  another (the destination of the copy is copyRegion), and second we have
509  the region of the screen which has been modified in some other way
510  (modifiedRegion).
512  Although the copy is of a single region, this region may have many
513  rectangles. When sending an update, the copyRegion is always sent
514  before the modifiedRegion. This is because the modifiedRegion may
515  overlap parts of the screen which are in the source of the copy.
517  In fact during normal processing, the modifiedRegion may even overlap
518  the destination copyRegion. Just before an update is sent we remove
519  from the copyRegion anything in the modifiedRegion. */
521  sraRegionPtr copyRegion;
522  int copyDX, copyDY;
524  sraRegionPtr modifiedRegion;
531  sraRegionPtr requestedRegion;
539  struct timeval startDeferring;
540  struct timeval startPtrDeferring;
541  int lastPtrX;
542  int lastPtrY;
558 #define UPDATE_BUF_SIZE 30000
560  char updateBuf[UPDATE_BUF_SIZE];
561  int ublen;
563  /* statistics */
564  struct _rfbStatList *statEncList;
565  struct _rfbStatList *statMsgList;
570  /* zlib encoding -- necessary compression state info per client */
572  struct z_stream_s compStream;
573  rfbBool compStreamInited;
574  uint32_t zlibCompressLevel;
575 #endif
578  int tightQualityLevel;
581  /* tight encoding -- preserve zlib streams' state for each client */
582  z_stream zsStruct[4];
583  rfbBool zsActive[4];
584  int zsLevel[4];
585  int tightCompressLevel;
586 #endif
587 #endif
589  /* Ultra Encoding support */
591  char *lzoWrkMem;
606  int cursorX,cursorY;
612  struct _rfbClientRec *prev;
613  struct _rfbClientRec *next;
621  int refCount;
622  MUTEX(refCountMutex);
623  COND(deleteCond);
625  MUTEX(outputMutex);
626  MUTEX(updateMutex);
627  COND(updateCond);
628 #endif
631  void* zrleData;
632  int zywrleLevel;
633  int zywrleBuf[rfbZRLETileWidth * rfbZRLETileHeight];
634 #endif
649  MUTEX(sendMutex);
650 #endif
652  /* buffers to hold pixel data before and after encoding.
653  per-client for thread safety */
656  char *afterEncBuf;
660  uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */
662  /* TurboVNC Encoding support (extends TightVNC) */
663  int turboSubsampLevel;
664  int turboQualityLevel; /* 1-100 scale */
665 #endif
666 #endif
669  char *wspath; /* Requests path component */
671  int pipe_notify_client_thread[2];
672 #endif
683 } rfbClientRec, *rfbClientPtr;
690 #define FB_UPDATE_PENDING(cl) \
691  (((cl)->enableCursorShapeUpdates && (cl)->cursorWasChanged) || \
692  (((cl)->enableCursorShapeUpdates == FALSE && \
693  ((cl)->cursorX != (cl)->screen->cursorX || \
694  (cl)->cursorY != (cl)->screen->cursorY))) || \
695  ((cl)->useNewFBSize && (cl)->newFBSizePending) || \
696  ((cl)->enableCursorPosUpdates && (cl)->cursorWasMoved) || \
697  !sraRgnEmpty((cl)->copyRegion) || !sraRgnEmpty((cl)->modifiedRegion))
699 /*
700  * Macros for endian swapping.
701  */
703 #define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff))
705 #define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \
706  (((l) & 0x00ff00)))
708 #define Swap32(l) ((((l) >> 24) & 0x000000ff)| \
709  (((l) & 0x00ff0000) >> 8) | \
710  (((l) & 0x0000ff00) << 8) | \
711  (((l) & 0x000000ff) << 24))
714 extern char rfbEndianTest;
716 #define Swap16IfLE(s) (rfbEndianTest ? Swap16(s) : (s))
717 #define Swap24IfLE(l) (rfbEndianTest ? Swap24(l) : (l))
718 #define Swap32IfLE(l) (rfbEndianTest ? Swap32(l) : (l))
720 /* UltraVNC uses some windows structures unmodified, so the viewer expects LittleEndian Data */
721 #define Swap16IfBE(s) (rfbEndianTest ? (s) : Swap16(s))
722 #define Swap24IfBE(l) (rfbEndianTest ? (l) : Swap24(l))
723 #define Swap32IfBE(l) (rfbEndianTest ? (l) : Swap32(l))
725 /* sockets.c */
727 extern int rfbMaxClientWait;
729 extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
730 extern void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen);
731 extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
732 extern void rfbCloseClient(rfbClientPtr cl);
733 extern int rfbReadExact(rfbClientPtr cl, char *buf, int len);
734 extern int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
735 extern int rfbPeekExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
736 extern int rfbWriteExact(rfbClientPtr cl, const char *buf, int len);
737 extern int rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
738 extern rfbSocket rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
739 extern rfbSocket rfbConnectToTcpAddr(char* host, int port);
740 extern rfbSocket rfbListenOnTCPPort(int port, in_addr_t iface);
741 extern rfbSocket rfbListenOnTCP6Port(int port, const char* iface);
742 extern rfbSocket rfbListenOnUDPPort(int port, in_addr_t iface);
743 extern int rfbStringToAddr(char* string,in_addr_t* addr);
744 extern rfbBool rfbSetNonBlocking(rfbSocket sock);
747 /* websockets.c */
749 extern rfbBool webSocketsCheck(rfbClientPtr cl);
750 extern rfbBool webSocketCheckDisconnect(rfbClientPtr cl);
751 extern int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst);
752 extern int webSocketsDecode(rfbClientPtr cl, char *dst, int len);
753 extern rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl);
754 #endif
756 /* rfbserver.c */
758 /* Routines to iterate over the client list in a thread-safe way.
759  Only a single iterator can be in use at a time process-wide. */
760 typedef struct rfbClientIterator *rfbClientIteratorPtr;
762 extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
763 extern rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen);
764 extern rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator);
765 extern void rfbReleaseClientIterator(rfbClientIteratorPtr iterator);
766 extern void rfbIncrClientRef(rfbClientPtr cl);
767 extern void rfbDecrClientRef(rfbClientPtr cl);
769 extern void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
770 extern rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
771 extern rfbClientPtr rfbNewUDPClient(rfbScreenInfoPtr rfbScreen);
772 extern rfbClientPtr rfbReverseConnection(rfbScreenInfoPtr rfbScreen,char *host, int port);
773 extern void rfbClientConnectionGone(rfbClientPtr cl);
774 extern void rfbProcessClientMessage(rfbClientPtr cl);
775 extern void rfbClientConnFailed(rfbClientPtr cl, const char *reason);
776 extern void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen,rfbSocket sock);
777 extern void rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen);
778 extern rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion);
779 extern rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h);
780 extern rfbBool rfbSendUpdateBuf(rfbClientPtr cl);
781 extern void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len);
782 extern rfbBool rfbSendCopyRegion(rfbClientPtr cl,sraRegionPtr reg,int dx,int dy);
783 extern rfbBool rfbSendLastRectMarker(rfbClientPtr cl);
784 extern rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h);
785 extern rfbBool rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h);
786 extern rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours);
787 extern void rfbSendBell(rfbScreenInfoPtr rfbScreen);
789 extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
790 extern rfbBool rfbSendFileTransferChunk(rfbClientPtr cl);
791 extern rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer);
792 extern rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, const char *buffer);
793 extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
794 extern rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length);
796 void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len);
798 /* translate.c */
802 extern void rfbTranslateNone(char *table, rfbPixelFormat *in,
803  rfbPixelFormat *out,
804  char *iptr, char *optr,
805  int bytesBetweenInputLines,
806  int width, int height);
807 extern rfbBool rfbSetTranslateFunction(rfbClientPtr cl);
808 extern rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours);
809 extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours);
811 /* httpd.c */
813 extern void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen);
814 extern void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen);
815 extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
819 /* auth.c */
821 extern void rfbAuthNewClient(rfbClientPtr cl);
822 extern void rfbProcessClientSecurityType(rfbClientPtr cl);
823 extern void rfbAuthProcessClientMessage(rfbClientPtr cl);
824 extern void rfbRegisterSecurityHandler(rfbSecurityHandler* handler);
827 /* rre.c */
829 extern rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h);
832 /* corre.c */
834 extern rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h);
837 /* hextile.c */
839 extern rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w,
840  int h);
842 /* ultra.c */
844 /* Set maximum ultra rectangle size in pixels. Always allow at least
845  * two scan lines.
846  */
847 #define ULTRA_MAX_RECT_SIZE (128*256)
848 #define ULTRA_MAX_SIZE(min) ((( min * 2 ) > ULTRA_MAX_RECT_SIZE ) ? \
849  ( min * 2 ) : ULTRA_MAX_RECT_SIZE )
851 extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h);
855 /* zlib.c */
862 /* Set maximum zlib rectangle size in pixels. Always allow at least
863  * two scan lines.
864  */
865 #define ZLIB_MAX_RECT_SIZE (128*256)
866 #define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \
867  ( min * 2 ) : ZLIB_MAX_RECT_SIZE )
869 extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
870  int h);
873 /* tight.c */
878 extern rfbBool rfbTightDisableGradient;
880 extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
882 extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h);
883 extern rfbBool rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, int h);
884 extern rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, int compressedLen);
887 extern rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x,int y,int w,int h);
888 #endif
890 #endif
891 #endif
894 /* cursor.c */
896 typedef struct rfbCursor {
898  rfbBool cleanup, cleanupSource, cleanupMask, cleanupRichSource;
899  unsigned char *source;
900  unsigned char *mask;
901  unsigned short width, height, xhot, yhot;
902  unsigned short foreRed, foreGreen, foreBlue;
903  unsigned short backRed, backGreen, backBlue;
904  unsigned char *richSource;
905  unsigned char *alphaSource;
907 } rfbCursor, *rfbCursorPtr;
908 extern unsigned char rfbReverseByte[0x100];
910 extern rfbBool rfbSendCursorShape(rfbClientPtr cl/*, rfbScreenInfoPtr pScreen*/);
911 extern rfbBool rfbSendCursorPos(rfbClientPtr cl);
912 extern void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap);
913 extern rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString);
914 extern char* rfbMakeMaskForXCursor(int width,int height,char* cursorString);
915 extern char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource);
916 extern void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
917 extern void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
918 extern void rfbFreeCursor(rfbCursorPtr cursor);
919 extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c);
922 extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
924 /* zrle.c */
926 extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h);
927 #endif
929 /* stats.c */
931 extern void rfbResetStats(rfbClientPtr cl);
932 extern void rfbPrintStats(rfbClientPtr cl);
934 /* font.c */
936 typedef struct rfbFontData {
937  unsigned char* data;
943  int* metaData;
944 } rfbFontData,* rfbFontDataPtr;
946 int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,rfbPixel colour);
947 void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,rfbPixel colour);
949 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);
950 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);
951 int rfbWidthOfString(rfbFontDataPtr font,const char* string);
952 int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
953 void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
955 void rfbWholeFontBBox(rfbFontDataPtr font,int *x1, int *y1, int *x2, int *y2);
958 rfbFontDataPtr rfbLoadConsoleFont(char *filename);
960 void rfbFreeFont(rfbFontDataPtr font);
962 /* draw.c */
964 void rfbFillRect(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
965 void rfbDrawPixel(rfbScreenInfoPtr s,int x,int y,rfbPixel col);
966 void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
968 /* selbox.c */
974 typedef void (*SelectionChangedHookPtr)(int _index);
975 extern int rfbSelectBox(rfbScreenInfoPtr rfbScreen,
976  rfbFontDataPtr font, char** list,
977  int x1, int y1, int x2, int y2,
978  rfbPixel foreColour, rfbPixel backColour,
979  int border,SelectionChangedHookPtr selChangedHook);
981 /* cargs.c */
983 extern void rfbUsage(void);
984 extern void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]);
985 extern rfbBool rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]);
986 extern rfbBool rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]);
988 /* main.c */
990 extern void rfbLogEnable(int enabled);
991 typedef void (*rfbLogProc)(const char *format, ...);
992 extern rfbLogProc rfbLog, rfbErr;
993 extern void rfbLogPerror(const char *str);
995 void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
996 void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
998 void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy);
999 void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy);
1001 void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2);
1002 void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
1003 void rfbDoNothingWithClient(rfbClientPtr cl);
1004 enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl);
1007 struct _rfbProtocolExtension* rfbGetExtensionIterator();
1009 rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension* extension,
1010  void* data);
1011 rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension);
1012 void* rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension* extension);
1015 rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
1017 /* functions to make a vnc server */
1018 extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
1019  int width,int height,int bitsPerSample,int samplesPerPixel,
1020  int bytesPerPixel);
1021 extern void rfbInitServer(rfbScreenInfoPtr rfbScreen);
1022 extern void rfbShutdownServer(rfbScreenInfoPtr rfbScreen,rfbBool disconnectClients);
1023 extern void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen,char *framebuffer,
1024  int width,int height, int bitsPerSample,int samplesPerPixel,
1025  int bytesPerPixel);
1027 extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);
1028 extern void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt, ...);
1030 /* functions to accept/refuse a client that has been put on hold
1031  by a NewClientHookPtr function. Must not be called in other
1032  situations. */
1033 extern void rfbStartOnHoldClient(rfbClientPtr cl);
1034 extern void rfbRefuseOnHoldClient(rfbClientPtr cl);
1036 /* call one of these two functions to service the vnc clients.
1037  usec are the microseconds the select on the fds waits.
1038  if you are using the event loop, set this to some value > 0, so the
1039  server doesn't get a high load just by listening.
1040  rfbProcessEvents() returns TRUE if an update was pending. */
1042 extern void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground);
1043 extern rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec);
1044 extern rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo);
1046 /* TightVNC file transfer extension */
1050 /* Statistics */
1051 extern char *messageNameServer2Client(uint32_t type, char *buf, int len);
1052 extern char *messageNameClient2Server(uint32_t type, char *buf, int len);
1053 extern char *encodingName(uint32_t enc, char *buf, int len);
1055 extern rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type);
1056 extern rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type);
1058 /* Each call to rfbStatRecord* adds one to the rect count for that type */
1059 extern void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1060 extern void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount); /* Specifically for tight encoding */
1061 extern void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1062 extern void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1063 extern void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
1064 extern void rfbResetStats(rfbClientPtr cl);
1065 extern void rfbPrintStats(rfbClientPtr cl);
1067 extern int rfbStatGetSentBytes(rfbClientPtr cl);
1068 extern int rfbStatGetSentBytesIfRaw(rfbClientPtr cl);
1069 extern int rfbStatGetRcvdBytes(rfbClientPtr cl);
1070 extern int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl);
1071 extern int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type);
1072 extern int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type);
1073 extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type);
1074 extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type);
1077 extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_);
1080 extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer);
1083 /*
1084  * Additions for Qt event loop integration
1085  * Original idea taken from vino.
1086  */
1087 rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen);
1088 rfbBool rfbUpdateClient(rfbClientPtr cl);
1091 #if(defined __cplusplus)
1092 }
1093 #endif
1265 #endif
void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen, sraRegionPtr copyRegion, int dx, int dy)
Definition: main.c:280
void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
Definition: stats.c:233
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:129
int lastPtrX
Definition: rfb.h:541
int port
Definition: rfb.h:229
struct _rfbSslCtx rfbSslCtx
Definition: rfb.h:411
int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len, int timeout)
Definition: sockets.c:624
unsigned char * alphaSource
source for alpha blending info
Definition: rfb.h:905
rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension *extension, void *data)
Definition: main.c:164
rfbClientPtr rfbNewUDPClient(rfbScreenInfoPtr rfbScreen)
Definition: rfbserver.c:527
void rfbPrintStats(rfbClientPtr cl)
Definition: stats.c:377
rfbFileTransferData fileTransfer
Definition: rfb.h:593
Definition: rfbproto.h:1522
void rfbSendBell(rfbScreenInfoPtr rfbScreen)
Definition: rfbserver.c:3698
rfbBool PalmVNC
how did the client tell us it wanted the screen changed? Ultra style or palm style?
Definition: rfb.h:422
rfbBool useCopyRect
Definition: rfb.h:489
rfbBool rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, int h)
Definition: tight.c:788
char * rfbMakeMaskFromAlphaSource(int width, int height, unsigned char *alphaSource)
Definition: cursor.c:325
rfbSocket rfbListenOnUDPPort(int port, in_addr_t iface)
Definition: sockets.c:1091
struct _rfbStatList * Next
Definition: rfb.h:408
rfbBool handleEventsEagerly
handle as many input events as possible (default off)
Definition: rfb.h:327
int x
Definition: SDLvncviewer.c:34
rfbCursorPtr rfbMakeXCursor(int width, int height, char *cursorString, char *maskString)
Definition: cursor.c:254
int rfbCheckFds(rfbScreenInfoPtr rfbScreen, long usec)
Definition: sockets.c:344
rfbBool enableServerIdentity
client supports ServerIdentity encoding
Definition: rfb.h:598
rfbBool useRichCursorEncoding
rfbEncodingRichCursor is preferred
Definition: rfb.h:603
void rfbUnregisterTightVNCFileTransferExtension()
void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount)
Definition: stats.c:210
void(* rfbSetTextChat)(struct _rfbClientRec *cl, int length, char *string)
Handle the textchat messages.
Definition: rfb.h:136
rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen)
Definition: rfbserver.c:167
char * afterEncBuf
Definition: rfb.h:656
rfbBool rfbEconomicTranslate
Definition: translate.c:32
rfbSocket udpSock
Definition: rfb.h:244
rfbBool webSocketsCheck(rfbClientPtr cl)
Definition: websockets.c:123
void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
Definition: rfbserver.c:3765
void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2)
Definition: main.c:429
rfbPixel blackPixel
Definition: rfb.h:211
char * lzoWrkMem
Definition: rfb.h:591
int(* rfbNumberOfExtDesktopScreensPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:117
rfbPixel whitePixel
Definition: rfb.h:212
char * listen6Interface
Definition: rfb.h:346
rfbLogProc rfbErr
Definition: main.c:264
void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours)
Definition: translate.c:451
void(* rfbSetXCutTextProcPtr)(char *str, int len, struct _rfbClientRec *cl)
Definition: rfb.h:106
int paddedWidthInBytes
Definition: rfb.h:205
rfbBool useNewFBSize
client supports NewFBSize encoding
Definition: rfb.h:609
void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
Definition: stats.c:259
int lastKeyboardLedState
keep track of last value so we can send change events
Definition: rfb.h:595
void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
Definition: rfbserver.c:247
int rfbDrawChar(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, unsigned char c, rfbPixel colour)
Definition: font.c:3
uint32_t bytesSentIfRaw
Definition: rfb.h:404
void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen, sraRegionPtr copyRegion, int dx, int dy)
Definition: main.c:369
int rfbWidthOfChar(rfbFontDataPtr font, unsigned char c)
Definition: font.c:126
char * frameBuffer
the frameBuffer has to be supplied by the serving process.
Definition: rfb.h:290
void(* rfbKbdAddEventProcPtr)(rfbBool down, rfbKeySym keySym, struct _rfbClientRec *cl)
Definition: rfb.h:103
void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
Definition: rfbserver.c:3724
int rfbPeekExactTimeout(rfbClientPtr cl, char *buf, int len, int timeout)
Definition: sockets.c:716
rfbClient * client
Definition: vnc2mpg.c:357
int udpPort
Definition: rfb.h:243
rfbGetKeyboardLedStateHookPtr getKeyboardLedStateHook
These hooks are called to pass keyboard state back to the client.
Definition: rfb.h:308
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:124
rfbBool enableLastRectEncoding
client supports LastRect encoding
Definition: rfb.h:600
rfbBool permitFileTransfer
command line authorization of file transfers
Definition: rfb.h:337
rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours)
Definition: rfbserver.c:3636
void(* SelectionChangedHookPtr)(int _index)
this opens a modal select box.
Definition: rfb.h:974
uint32_t rcvdCount
Definition: rfb.h:405
struct _rfbProtocolExtension * next
Definition: rfb.h:183
char * rfbMakeMaskForXCursor(int width, int height, char *cursorString)
Definition: cursor.c:297
negotiating security (RFB v.3.7)
Definition: rfb.h:475
rfbNumberOfExtDesktopScreensPtr numberOfExtDesktopScreensHook
Optional hooks to query ExtendedDesktopSize screen information.
Definition: rfb.h:357
struct sraRegion * sraRegionPtr
Definition: rfb.h:381
rfbBool dontDisconnect
Definition: rfb.h:275
rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x, int y, int w, int h)
Definition: rfbserver.c:3373
void rfbDrawLine(rfbScreenInfoPtr s, int x1, int y1, int x2, int y2, rfbPixel col)
Definition: draw.c:31
int rfbNumCodedRectsTight(rfbClientPtr cl, int x, int y, int w, int h)
Definition: tight.c:242
rfbSetTextChat setTextChat
Definition: rfb.h:300
rfbPasswordCheckProcPtr passwordCheck
Definition: rfb.h:259
rfbXvpHookPtr xvpHook
xvpHook is called to handle an xvp client message
Definition: rfb.h:342
int maxRectsPerUpdate
send only this many rectangles in one update
Definition: rfb.h:266
int deferUpdateTime
this is the amount of milliseconds to wait at least before sending an update.
Definition: rfb.h:269
void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen)
Definition: httpd.c:130
uint32_t sentCount
Definition: rfb.h:402
rfbGetCursorProcPtr getCursorPtr
Definition: rfb.h:295
int8_t rfbBool
Definition: rfbproto.h:108
int deferPtrUpdateTime
Definition: rfb.h:324
rfbClientPtr rfbReverseConnection(rfbScreenInfoPtr rfbScreen, char *host, int port)
Definition: rfbserver.c:260
int protocolMajorVersion
Definition: rfb.h:438
rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, int compressedLen)
Definition: tight.c:1107
int compressionEnabled
Definition: rfb.h:392
void(* rfbKbdReleaseAllKeysProcPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:104
int ublen
Definition: rfb.h:561
char * messageNameServer2Client(uint32_t type, char *buf, int len)
Definition: stats.c:46
uint32_t bytesRcvdIfRaw
Definition: rfb.h:407
unsigned char * source
points to bits
Definition: rfb.h:899
void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
Definition: sockets.c:538
char * encodingName(uint32_t enc, char *buf, int len)
Definition: stats.c:93
const char * desktopName
Definition: rfb.h:225
rfbBool useExtDesktopSize
Definition: rfb.h:680
establishing protocol version
Definition: rfb.h:474
rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer)
Definition: rfbserver.c:1333
sraRegionPtr copyRegion
the destination region of the copy
Definition: rfb.h:521
unsigned char rfbReverseByte[0x100]
Definition: cursor.c:209
rfbBool(* rfbGetExtDesktopScreenPtr)(int seqnumber, struct rfbExtDesktopScreen *extDesktopScreen, struct _rfbClientRec *cl)
Definition: rfb.h:118
char * wspath
Definition: rfb.h:669
enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl)
int rfbStatGetSentBytes(rfbClientPtr cl)
Definition: stats.c:273
rfbBool webSocketCheckDisconnect(rfbClientPtr cl)
This is a stub function that was once used for Hixie-encoding.
Definition: websockets.c:441
rfbBool rfbProcessSizeArguments(int *width, int *height, int *bpp, int *argc, char *argv[])
Definition: cargs.c:244
#define height
Definition: vncev.c:19
rfbSocket sock
Definition: rfb.h:434
rfbSetDesktopSizeHookPtr setDesktopSizeHook
hook to let client set resolution
Definition: rfb.h:354
rfbSetServerInputProcPtr setServerInput
Definition: rfb.h:298
rfbBool enableKeyboardLedState
client supports KeyboardState encoding
Definition: rfb.h:599
int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type)
Definition: stats.c:338
int beforeEncBufSize
Definition: rfb.h:655
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)
Definition: font.c:104
int lastPtrButtons
Definition: rfb.h:543
Protocol extension handling.
Definition: rfb.h:161
rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x, int y, int w, int h)
Definition: ultra.c:179
UPDATE_BUF_SIZE must be big enough to send at least one whole line of the framebuffer.
Definition: rfb.h:558
struct _rfbScreenInfo * scaledScreenNext
this structure has children that are scaled versions of this screen
Definition: rfb.h:201
int depth
Definition: rfb.h:207
int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst)
Definition: websockets.c:423
rfbSslCtx * sslctx
Definition: rfb.h:667
char * sslcertfile
Definition: rfb.h:344
rfbScreenInfoPtr screen
back pointer to the screen
Definition: rfb.h:417
rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length)
Definition: rfbserver.c:1615
void rfbIncrClientRef(rfbClientPtr cl)
Definition: rfbserver.c:139
rfbBool onHold
Definition: rfb.h:487
uint32_t rfbKeySym
Definition: rfbproto.h:115
void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen, sraRegionPtr modRegion)
Definition: main.c:412
rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x, int y, int w, int h)
Definition: rre.c:49
uint32_t rfbPixel
Definition: rfbproto.h:116
rfbBool viewOnly
Definition: rfb.h:493
uint32_t bytesRcvd
Definition: rfb.h:406
rfbSetTranslateFunctionProcPtr setTranslateFunction
Definition: rfb.h:296
#define rfbSocket
Definition: rfbproto.h:104
void rfbClientConnFailed(rfbClientPtr cl, const char *reason)
Definition: rfbserver.c:749
int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type)
Definition: stats.c:329
#define rfbInitServer
Definition: rfb.h:83
sending initialisation messages
Definition: rfb.h:477
#define rfbZRLETileHeight
Definition: rfbproto.h:939
rfbGetExtDesktopScreenPtr getExtDesktopScreenHook
Definition: rfb.h:358
int rfbWriteExact(rfbClientPtr cl, const char *buf, int len)
Definition: sockets.c:792
int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type)
Definition: stats.c:346
unsigned short yhot
Definition: rfb.h:901
int http6Port
Definition: rfb.h:351
rfbBool rfbSendUpdateBuf(rfbClientPtr cl)
Definition: rfbserver.c:3615
Per-screen (framebuffer) structure.
Definition: rfb.h:198
void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen)
Definition: sockets.c:297
void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt,...)
Definition: rfbserver.c:1076
void rfbAuthProcessClientMessage(rfbClientPtr cl)
Definition: auth.c:368
int underCursorBufferLen
Definition: rfb.h:281
rfbBool is16
is the data format short?
Definition: rfb.h:140
rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h)
Definition: rfbserver.c:3482
void rfbWholeFontBBox(rfbFontDataPtr font, int *x1, int *y1, int *x2, int *y2)
this returns the smallest box enclosing any character of font.
Definition: font.c:143
char * underCursorBuffer
Definition: rfb.h:282
void(* rfbLogProc)(const char *format,...)
Definition: rfb.h:991
int rfbStringToAddr(char *string, in_addr_t *addr)
Definition: sockets.c:891
struct _wsCtx wsCtx
Definition: rfb.h:412
rfbBool rfbProcessArguments(rfbScreenInfoPtr rfbScreen, int *argc, char *argv[])
Definition: cargs.c:81
rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h)
Definition: corre.c:53
void rfbClientListInit(rfbScreenInfoPtr rfbScreen)
Definition: rfbserver.c:154
ClientGoneHookPtr clientGoneHook
Definition: rfb.h:432
void rfbSetCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr c)
Definition: cursor.c:757
rfbBool enableCursorPosUpdates
client supports cursor position updates
Definition: rfb.h:602
unsigned short backRed
Definition: rfb.h:903
struct _rfbClientRec * clientHead
Definition: rfb.h:276
sraRegionPtr requestedRegion
As part of the FramebufferUpdateRequest, a client can express interest in a subrectangle of the whole...
Definition: rfb.h:531
rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo)
Definition: main.c:1281
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
Definition: cutpaste.c:35
rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion)
Definition: rfbserver.c:2828
rfbBool rfbSetNonBlocking(rfbSocket sock)
Definition: sockets.c:1121
int rfbReadExact(rfbClientPtr cl, char *buf, int len)
Definition: sockets.c:700
struct _rfbClientRec * udpClient
Definition: rfb.h:245
void(* ClientGoneHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:387
int cursorY
the coordinates of the cursor, if enableCursorShapeUpdates = FALSE
Definition: rfb.h:606
void(* ClientFramebufferUpdateRequestHookPtr)(struct _rfbClientRec *cl, rfbFramebufferUpdateRequestMsg *furMsg)
Definition: rfb.h:388
char * host
Definition: rfb.h:435
void rfbProcessClientSecurityType(rfbClientPtr cl)
Definition: auth.c:330
void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2, int dx, int dy)
Definition: main.c:398
void rfbFillRect(rfbScreenInfoPtr s, int x1, int y1, int x2, int y2, rfbPixel col)
Definition: draw.c:3
rfbBool rfbSendLastRectMarker(rfbClientPtr cl)
Definition: rfbserver.c:3451
struct rfbCursor * cursor
Definition: rfb.h:284
rfbSocket httpSock
Definition: rfb.h:257
rfbScreenInfoPtr scaledScreen
points to a scaled version of the screen buffer in cl->scaledScreenList
Definition: rfb.h:420
rfbSocket listen6Sock
Definition: rfb.h:350
rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator)
Definition: rfbserver.c:208
void rfbReleaseExtensionIterator()
Definition: main.c:159
int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl)
Definition: stats.c:309
int ipv6port
The port to listen on when using IPv6.
Definition: rfb.h:345
void * paletteHelper
Definition: rfb.h:644
void rfbFontBBox(rfbFontDataPtr font, unsigned char c, int *x1, int *y1, int *x2, int *y2)
Definition: font.c:131
rfbBool enableSupportedEncodings
client supports SupportedEncodings encoding
Definition: rfb.h:597
int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type)
Definition: stats.c:321
int rawBytesEquivalent
Definition: rfb.h:566
void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
Definition: stats.c:220
int maxClientWait
Definition: rfb.h:249
rfbSetXCutTextProcPtr setXCutText
Definition: rfb.h:294
rfbProtocolExtension * extension
Definition: rfb.h:187
int rfbSelectBox(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, char **list, int x1, int y1, int x2, int y2, rfbPixel foreColour, rfbPixel backColour, int border, SelectionChangedHookPtr selChangedHook)
Definition: selbox.c:203
void rfbRegisterProtocolExtension(rfbProtocolExtension *extension)
Definition: main.c:71
uint8_t * bytes
Definition: rfb.h:142
int authPasswdFirstViewOnly
If rfbAuthPasswdData is given a list, this is the first view only password.
Definition: rfb.h:263
rfbBool cursorWasMoved
cursor position update should be sent
Definition: rfb.h:605
rfbBool neverShared
Definition: rfb.h:274
void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr cursor)
Definition: cursor.c:469
void rfbScreenCleanup(rfbScreenInfoPtr screenInfo)
Definition: main.c:1097
void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen, int x1, int y1, int x2, int y2, int dx, int dy)
Definition: main.c:405
int preferredEncoding
Definition: rfb.h:490
int y
Definition: SDLvncviewer.c:34
rfbBool dontConvertRichCursorToXCursor
Definition: rfb.h:283
int correMaxWidth
Definition: rfb.h:491
int protocolMinorVersion
Definition: rfb.h:334
rfbExtensionData * extensions
Definition: rfb.h:640
void(* rfbDisplayHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:111
rfbKbdAddEventProcPtr kbdAddEvent
Definition: rfb.h:291
void rfbDrawPixel(rfbScreenInfoPtr s, int x, int y, rfbPixel col)
Definition: draw.c:20
struct _rfbStatList * statMsgList
Definition: rfb.h:565
void rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
Definition: rfbserver.c:3781
void rfbStartOnHoldClient(rfbClientPtr cl)
Definition: main.c:655
rfbBool readyForSetColourMapEntries
Definition: rfb.h:488
rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, const char *buffer)
Definition: rfbserver.c:1212
void(* rfbPtrAddEventProcPtr)(int buttonMask, int x, int y, struct _rfbClientRec *cl)
Definition: rfb.h:105
wsCtx * wsctx
Definition: rfb.h:668
rfbBool(* rfbPasswordCheckProcPtr)(struct _rfbClientRec *cl, const char *encryptedPassWord, int len)
Definition: rfb.h:109
char rfbEndianTest
Definition: main.c:55
void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height)
Definition: translate.c:225
rfbBool enableCursorShapeUpdates
client supports cursor shape updates
Definition: rfb.h:601
int webSocketsDecode(rfbClientPtr cl, char *dst, int len)
Definition: websockets.c:429
unsigned char * data
Definition: rfb.h:937
int afterEncBufSize
Definition: rfb.h:657
rfbBool rfbSendRectEncodingTightPng(rfbClientPtr cl, int x, int y, int w, int h)
Definition: tight.c:281
void rfbLogPerror(const char *str)
Definition: main.c:266
void rfbShutdownServer(rfbScreenInfoPtr rfbScreen, rfbBool disconnectClients)
Definition: main.c:1145
rfbSocket rfbConnectToTcpAddr(char *host, int port)
Definition: sockets.c:1020
int width
Definition: rfb.h:204
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.
Definition: rfbserver.c:281
struct _rfbSecurity * next
Definition: rfb.h:154
#define rfbZRLETileWidth
Definition: rfbproto.h:938
#define MUTEX(mutex)
Definition: threading.h:84
void * screenData
some screen specific data can be put into a struct where screenData points to.
Definition: rfb.h:219
rfbBool alphaPreMultiplied
if richSource already has alpha applied
Definition: rfb.h:906
struct _rfbClientRec * next
Definition: rfb.h:613
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:371
void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen)
Definition: httpd.c:93
rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension *extension)
Definition: main.c:185
Security handling (RFB protocol version 3.7)
Definition: rfb.h:151
rfbBool reverseConnection
Definition: rfb.h:486
void rfbUsage(void)
Definition: cargs.c:20
int rfbStatGetSentBytesIfRaw(rfbClientPtr cl)
Definition: stats.c:285
int maxSock
Definition: rfb.h:231
void rfbConvertLSBCursorBitmapOrMask(int width, int height, unsigned char *bitmap)
Definition: cursor.c:245
struct sraRegion sraRegion
Definition: rfbregion.h:18
void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen, char *framebuffer, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
Definition: main.c:1029
rfbBool rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h)
Definition: rfbserver.c:3521
int scaledScreenRefCount
Definition: rfb.h:202
rfbBool rfbSendCursorPos(rfbClientPtr cl)
Definition: cursor.c:181
uint32_t count
Definition: rfb.h:139
int sizeInBytes
Definition: rfb.h:209
void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground)
Definition: main.c:1285
void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
Definition: httpd.c:156
int bytesSent
Definition: rfb.h:567
rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
Definition: sockets.c:474
int httpPort
Definition: rfb.h:254
char * messageNameClient2Server(uint32_t type, char *buf, int len)
Definition: stats.c:64
void rfbRefuseOnHoldClient(rfbClientPtr cl)
Definition: main.c:678
void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
Definition: stats.c:246
void * clientData
private data.
Definition: rfb.h:431
rfbColourMap colourMap
set this if rfbServerFormat.trueColour==FALSE
Definition: rfb.h:224
rfbTranslateFnType translateFn
translateFn points to the translation function which is used to copy and translate a rectangle from t...
Definition: rfb.h:548
rfbStatList * rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type)
Definition: stats.c:167
rfbPixelFormat serverFormat
Definition: rfb.h:223
uint8_t type
Definition: rfb.h:152
void rfbDoNothingWithClient(rfbClientPtr cl)
Definition: main.c:808
rfbBool rfbCheckPasswordByList(rfbClientPtr cl, const char *response, int len)
to check against plain passwords
Definition: main.c:786
void rfbRegisterTightVNCFileTransferExtension()
uint32_t type
Definition: rfb.h:401
sraRegionPtr modifiedRegion
Definition: rfb.h:524
void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen, rfbCursorPtr cursor)
Definition: cursor.c:391
rfbFileTransferPermitted getFileTransferPermission
Definition: rfb.h:299
char * beforeEncBuf
for thread safety for rfbSendFBUpdate()
Definition: rfb.h:654
rfbBool(* rfbXvpHookPtr)(struct _rfbClientRec *cl, uint8_t, uint8_t)
Definition: rfb.h:115
rfbLogProc rfbLog
Definition: main.c:263
unsigned char * mask
points to bits
Definition: rfb.h:900
rfbDisplayFinishedHookPtr displayFinishedHook
displayFinishedHook is called just after a frame buffer update
Definition: rfb.h:340
void rfbLogEnable(int enabled)
Definition: main.c:226
rfbBool inetdInitDone
Definition: rfb.h:241
char * httpDir
Definition: rfb.h:255
void rfbFreeCursor(rfbCursorPtr cursor)
Definition: cursor.c:367
rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h)
Definition: zrle.c:104
Definition: rfb.h:896
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
Definition: font.c:48
int protocolMinorVersion
Definition: rfb.h:439
ClientFramebufferUpdateRequestHookPtr clientFramebufferUpdateRequestHook
clientFramebufferUpdateRequestHook is called when a client requests a frame buffer update...
Definition: rfb.h:678
char * filename
Definition: vnc2mpg.c:359
char * translateLookupTable
Definition: rfb.h:549
rfbBool(* rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:108
void rfbRegisterSecurityHandler(rfbSecurityHandler *handler)
Definition: auth.c:49
uint16_t * shorts
Definition: rfb.h:143
char * versionString
Definition: rfb.h:330
rfbBool httpInitDone
Definition: rfb.h:252
void(* rfbDisplayFinishedHookPtr)(struct _rfbClientRec *cl, int result)
Definition: rfb.h:112
struct _rfbProtocolExtension * rfbGetExtensionIterator()
Definition: main.c:148
rfbBool rfbSendCursorShape(rfbClientPtr cl)
Definition: cursor.c:36
int requestedDesktopSizeChange
Definition: rfb.h:681
void rfbDrawString(rfbScreenInfoPtr rfbScreen, rfbFontDataPtr font, int x, int y, const char *string, rfbPixel colour)
Definition: font.c:37
rfbBool rfbSetTranslateFunction(rfbClientPtr cl)
Definition: translate.c:245
rfbSocket rfbListenOnTCPPort(int port, in_addr_t iface)
Definition: sockets.c:909
void rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
Definition: rfbserver.c:234
rfbDisplayHookPtr displayHook
displayHook is called just before a frame buffer update
Definition: rfb.h:305
struct _rfbExtensionData * next
Definition: rfb.h:189
void rfbProcessClientMessage(rfbClientPtr cl)
Definition: rfbserver.c:645
struct _rfbClientRec * pointerClient
"Mutex" for pointer events
Definition: rfb.h:277
int * metaData
metaData is a 256*5 array: for each character (offset,width,height,x,y)
Definition: rfb.h:943
rfbBool rfbProcessEvents(rfbScreenInfoPtr screenInfo, long usec)
Definition: main.c:1199
int rfbMaxClientWait
Definition: sockets.c:101
rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, int h)
Definition: hextile.c:40
rfbBool rfbSendFileTransferChunk(rfbClientPtr cl)
Definition: rfbserver.c:1516
int(* rfbFileTransferPermitted)(struct _rfbClientRec *cl)
Permit the server to allow or deny filetransfers.
Definition: rfb.h:134
rfbBool udpSockConnected
Definition: rfb.h:246
rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl)
Definition: websockets.c:451
rfbBool rfbUpdateClient(rfbClientPtr cl)
Definition: main.c:1230
char * zrleBeforeBuf
for threaded zrle
Definition: rfb.h:643
in_addr_t listenInterface
Definition: rfb.h:323
rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours)
Definition: translate.c:418
int lastPtrY
Definition: rfb.h:542
int(* rfbSetDesktopSizeHookPtr)(int width, int height, int numScreens, struct rfbExtDesktopScreen *extDesktopScreens, struct _rfbClientRec *cl)
Definition: rfb.h:116
int protocolMajorVersion
What does the server tell the new clients which version it supports.
Definition: rfb.h:333
rfbBool cursorWasChanged
cursor shape update should be sent
Definition: rfb.h:604
Definition: rfb.h:91
rfbScreenInfoPtr rfbGetScreen(int *argc, char **argv, int width, int height, int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
Definition: main.c:889
char * sslkeyfile
Definition: rfb.h:343
rfbSocket inetdSock
Definition: rfb.h:240
rfbFontDataPtr rfbLoadConsoleFont(char *filename)
dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16
Definition: font.c:164
rfbBool newFBSizePending
framebuffer size was changed
Definition: rfb.h:610
rfbSetSingleWindowProcPtr setSingleWindow
Definition: rfb.h:297
char * rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)
Definition: rfbserver.c:1475
void * rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension *extension)
Definition: main.c:206
rfbBool httpEnableProxyConnect
Definition: rfb.h:253
#define width
Definition: vncev.c:18
rfbBool rfbSendCopyRegion(rfbClientPtr cl, sraRegionPtr reg, int dx, int dy)
Definition: rfbserver.c:3317
float fdQuota
This value between 0 and 1.0 defines which fraction of the maximum number of file descriptors LibVNCS...
Definition: rfb.h:362
rfbSocket httpListenSock
Definition: rfb.h:256
rfbSocket rfbListenOnTCP6Port(int port, const char *iface)
Definition: sockets.c:943
void rfbResetStats(rfbClientPtr cl)
Definition: stats.c:358
rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x, int y, int w, int h)
Definition: tight.c:270
rfbPtrAddEventProcPtr ptrAddEvent
Definition: rfb.h:293
int rfbWidthOfString(rfbFontDataPtr font, const char *string)
Definition: font.c:116
rfbBool alwaysShared
Definition: rfb.h:273
struct _rfbClientRec * prev
Definition: rfb.h:612
void rfbFreeFont(rfbFontDataPtr font)
free a dynamically loaded font
Definition: font.c:198
int progressiveSliceY
if progressive updating is on, this variable holds the current y coordinate of the progressive slice...
Definition: rfb.h:638
rfbBool enableSupportedMessages
client supports SupportedMessages encoding
Definition: rfb.h:596
rfbBool ignoreSIGPIPE
if TRUE, an ignoring signal handler is installed for SIGPIPE
Definition: rfb.h:316
rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, int h)
Definition: zlib.c:274
unsigned char * richSource
source bytes for a rich cursor
Definition: rfb.h:904
int(* rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo *screen)
support the capability to view the caps/num/scroll states of the X server
Definition: rfb.h:114
int maxFd
Definition: rfb.h:232
struct _rfbStatList * statEncList
Definition: rfb.h:564
void rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
cursor handling for the pointer
Definition: main.c:690
int copyDY
the translation by which the copy happens
Definition: rfb.h:522
void rfbUnregisterProtocolExtension(rfbProtocolExtension *extension)
Definition: main.c:110
rfbSocket listenSock
Definition: rfb.h:230
fd_set allFds
Definition: rfb.h:236
rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer)
send a TextChat message to a client
Definition: rfbserver.c:1161
normal protocol messages
Definition: rfb.h:478
int bitsPerPixel
Definition: rfb.h:208
void * authPasswdData
Definition: rfb.h:260
#define COND(cond)
Definition: threading.h:89
void rfbInitSockets(rfbScreenInfoPtr rfbScreen)
Definition: sockets.c:159
int lastDesktopSizeChangeError
Definition: rfb.h:682
unsigned short foreRed
Definition: rfb.h:902
rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen, rfbSocket sock)
Definition: rfbserver.c:520
rfbSocket httpListen6Sock
Definition: rfb.h:352
int afterEncBufLen
Definition: rfb.h:658
rfbBool autoPort
Definition: rfb.h:228
int progressiveSliceHeight
if not zero, only a slice of this height is processed every time an update should be sent...
Definition: rfb.h:321
int rfbStatGetRcvdBytes(rfbClientPtr cl)
Definition: stats.c:297
rfbNewClientHookPtr newClientHook
newClientHook is called just after a new client is created
Definition: rfb.h:303
void rfbPurgeArguments(int *argc, int *position, int count, char *argv[])
Definition: cargs.c:72
rfbKbdReleaseAllKeysProcPtr kbdReleaseAllKeys
Definition: rfb.h:292
Definition: rfb.h:97
int height
Definition: rfb.h:206
enum rfbNewClientAction(* rfbNewClientHookPtr)(struct _rfbClientRec *cl)
Definition: rfb.h:110
void rfbAuthNewClient(rfbClientPtr cl)
Definition: auth.c:298
rfbSocket rfbConnect(rfbScreenInfoPtr rfbScreen, char *host, int port)
Definition: sockets.c:585
void rfbClientConnectionGone(rfbClientPtr cl)
Definition: rfbserver.c:539
void rfbUnregisterSecurityHandler(rfbSecurityHandler *handler)
Definition: auth.c:79
rfbStatList * rfbStatLookupMessage(rfbClientPtr cl, uint32_t type)
Definition: stats.c:189
void rfbDecrClientRef(rfbClientPtr cl)
Definition: rfbserver.c:140
void rfbCloseClient(rfbClientPtr cl)
Definition: sockets.c:546
void * data
Definition: rfb.h:188
rfbPixelFormat format
Definition: rfb.h:550
uint32_t bytesSent
Definition: rfb.h:403
int * pseudoEncodings
if pseudoEncodings is not NULL, it contains a 0 terminated list of the pseudo encodings handled by th...
Definition: rfb.h:170
rfbBool compStreamInitedLZO
Definition: rfb.h:590