diff options
Diffstat (limited to 'rfb')
-rw-r--r-- | rfb/keysym.h | 4 | ||||
-rw-r--r-- | rfb/rfb.h | 11 | ||||
-rw-r--r-- | rfb/rfbclient.h | 26 | ||||
-rw-r--r-- | rfb/rfbconfig.h.cmake | 21 | ||||
-rw-r--r-- | rfb/rfbproto.h | 36 |
5 files changed, 60 insertions, 38 deletions
diff --git a/rfb/keysym.h b/rfb/keysym.h index 219f95b..92d5158 100644 --- a/rfb/keysym.h +++ b/rfb/keysym.h @@ -162,7 +162,7 @@ SOFTWARE. #define XK_Zen_Koho 0xFF3D /* Multiple/All Candidate(s) */ #define XK_Mae_Koho 0xFF3E /* Previous Candidate */ -/* 0xFF31 thru 0xFF3F are under XK_KOREAN */ +/* 0xFF31 through 0xFF3F are under XK_KOREAN */ /* Cursor control & motion */ @@ -240,7 +240,7 @@ SOFTWARE. /* - * Auxilliary Functions; note the duplicate definitions for left and right + * Auxiliary Functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. @@ -486,7 +486,7 @@ typedef struct _rfbClientRec { authentication. If the right conditions are met this state will be set (see the auth.c file) when rfbProcessClientInitMessage is called. - If the state is RFB_INITIALISATION_SHARED we should not expect to recieve + If the state is RFB_INITIALISATION_SHARED we should not expect to receive any ClientInit message, but instead should proceed to the next stage of initialisation as though an implicit ClientInit message was received with a shared-flag of true. (There is currently no corresponding @@ -730,10 +730,10 @@ typedef struct _rfbClientRec { #define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \ (((l) & 0x00ff00))) -#define Swap32(l) (((l) >> 24) | \ +#define Swap32(l) ((((l) >> 24) & 0x000000ff)| \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ - ((l) << 24)) + (((l) & 0x000000ff) << 24)) extern char rfbEndianTest; @@ -775,6 +775,7 @@ extern rfbBool webSocketsCheck(rfbClientPtr cl); extern rfbBool webSocketCheckDisconnect(rfbClientPtr cl); extern int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst); extern int webSocketsDecode(rfbClientPtr cl, char *dst, int len); +extern rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl); #endif /* rfbserver.c */ @@ -1262,14 +1263,14 @@ rfbBool rfbUpdateClient(rfbClientPtr cl); Try example.c: it outputs on which port it listens (default: 5900), so it is display 0. To view, call @code vncviewer :0 @endcode You should see a sheet with a gradient and "Hello World!" written on it. Try - to paint something. Note that everytime you click, there is some bigger blot, + to paint something. Note that every time you click, there is some bigger blot, whereas when you drag the mouse while clicked you draw a line. The size of the blot depends on the mouse button you click. Open a second vncviewer with the same parameters and watch it as you paint in the other window. This also works over internet. You just have to know either the name or the IP of your machine. Then it is @code vncviewer machine.where.example.runs.com:0 @endcode or similar for the remote client. Now you are ready to type something. Be sure - that your mouse sits still, because everytime the mouse moves, the cursor is + that your mouse sits still, because every time the mouse moves, the cursor is reset to the position of the pointer! If you are done with that demo, press the down or up arrows. If your viewer supports it, then the dimensions of the sheet change. Just press Escape in the viewer. Note that the server still diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index f3700ae..17ddba6 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -47,13 +47,13 @@ (*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) #define rfbClientSwap32IfLE(l) \ - (*(char *)&client->endianTest ? ((((l) & 0xff000000) >> 24) | \ + (*(char *)&client->endianTest ? ((((l) >> 24) & 0x000000ff) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ (((l) & 0x000000ff) << 24)) : (l)) #define rfbClientSwap64IfLE(l) \ - (*(char *)&client->endianTest ? ((((l) & 0xff00000000000000ULL) >> 56) | \ + (*(char *)&client->endianTest ? ((((l) >> 56 ) & 0x00000000000000ffULL) | \ (((l) & 0x00ff000000000000ULL) >> 40) | \ (((l) & 0x0000ff0000000000ULL) >> 24) | \ (((l) & 0x000000ff00000000ULL) >> 8) | \ @@ -175,9 +175,17 @@ typedef rfbCredential* (*GetCredentialProc)(struct _rfbClient* client, int crede typedef rfbBool (*MallocFrameBufferProc)(struct _rfbClient* client); typedef void (*GotXCutTextProc)(struct _rfbClient* client, const char *text, int textlen); typedef void (*BellProc)(struct _rfbClient* client); - +/** + Called when a cursor shape update was received from the server. The decoded cursor shape + will be in client->rcSource. It's up to the application to do something with this, e.g. draw + into a viewer's window. If you want the server to draw the cursor into the framebuffer, be + careful not to announce remote cursor support, i.e. not include rfbEncodingXCursor or + rfbEncodingRichCursor in SetFormatAndEncodings(). +*/ typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel); typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y); +typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client); +typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client); typedef struct _rfbClient { uint8_t* frameBuffer; @@ -272,6 +280,7 @@ typedef struct _rfbClient { /* cursor.c */ + /** Holds cursor shape data when received from server. */ uint8_t *rcSource, *rcMask; /** private data pointer */ @@ -358,10 +367,19 @@ typedef struct _rfbClient { /* Output Window ID. When set, client application enables libvncclient to perform direct rendering in its window */ unsigned long outputWindow; + /** Hooks for optional protection WriteToTLS() by mutex */ + LockWriteToTLSProc LockWriteToTLS; + UnlockWriteToTLSProc UnlockWriteToTLS; + } rfbClient; /* cursor.c */ - +/** + * Handles XCursor and RichCursor shape updates from the server. + * We emulate cursor operating on the frame buffer (that is + * why we call it "software cursor"). This decodes the received cursor + * shape and hands it over to GotCursorShapeProc, if set. + */ extern rfbBool HandleCursorShape(rfbClient* client,int xhot, int yhot, int width, int height, uint32_t enc); /* listen.c */ diff --git a/rfb/rfbconfig.h.cmake b/rfb/rfbconfig.h.cmake index 3e3155b..5bd6569 100644 --- a/rfb/rfbconfig.h.cmake +++ b/rfb/rfbconfig.h.cmake @@ -54,6 +54,27 @@ /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1 +/* Define to 1 if you have the `vfork' function. */ +#cmakedefine LIBVNCSERVER_HAVE_VFORK 1 + +/* Define to 1 if you have the <vfork.h> header file. */ +#cmakedefine LIBVNCSERVER_HAVE_VFORK_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#cmakedefine LIBVNCSERVER_HAVE_VPRINTF 1 + +/* Define to 1 if `fork' works. */ +#cmakedefine LIBVNCSERVER_HAVE_WORKING_FORK 1 + +/* Define to 1 if `vfork' works. */ +#cmakedefine LIBVNCSERVER_HAVE_WORKING_VFORK 1 + +/* Define to 1 if you have the <ws2tcpip.h> header file. */ +#cmakedefine LIBVNCSERVER_HAVE_WS2TCPIP_H 1 + +/* Enable IPv6 support */ +#cmakedefine LIBVNCSERVER_IPv6 1 + /* Need a typedef for in_addr_t */ #cmakedefine LIBVNCSERVER_NEED_INADDR_T 1 diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h index 4d6a1e6..6c1a2fb 100644 --- a/rfb/rfbproto.h +++ b/rfb/rfbproto.h @@ -61,6 +61,7 @@ * messages have to be explained by comments. */ +#include <stdint.h> #if defined(WIN32) && !defined(__MINGW32__) #define LIBVNCSERVER_WORDS_BIGENDIAN @@ -71,7 +72,6 @@ #define SOCKET int #else #include <rfb/rfbconfig.h> -#include <rfb/rfbint.h> #endif #ifdef LIBVNCSERVER_HAVE_LIBZ @@ -82,10 +82,11 @@ #endif #endif -/* some autotool versions do not properly prefix - WORDS_BIGENDIAN, so do that manually */ -#ifdef WORDS_BIGENDIAN -#define LIBVNCSERVER_WORDS_BIGENDIAN +#if LIBVNCSERVER_HAVE_ENDIAN_H +# include <endian.h> +# if __BYTE_ORDER == __BIG_ENDIAN +# define LIBVNCSERVER_WORDS_BIGENDIAN 1 +# endif #endif /* MS compilers don't have strncasecmp */ @@ -93,8 +94,8 @@ #define strncasecmp _strnicmp #endif +#define rfbMax(a,b) (((a)>(b))?(a):(b)) #if !defined(WIN32) || defined(__MINGW32__) -#define max(a,b) (((a)>(b))?(a):(b)) #ifdef LIBVNCSERVER_HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -109,10 +110,6 @@ typedef int8_t rfbBool; #define TRUE -1 #endif -#ifdef _MSC_VER -#include <stdint.h> -#endif - typedef uint32_t rfbKeySym; typedef uint32_t rfbPixel; @@ -124,7 +121,7 @@ typedef uint32_t in_addr_t; #define INADDR_NONE ((in_addr_t) 0xffffffff) #endif -#define MAX_ENCODINGS 21 +#define MAX_ENCODINGS 64 #define rfbNetworkConnectionSuccess 0 #define rfbNetworkRFBConnectionSuccess 1 @@ -891,21 +888,6 @@ typedef struct { #endif /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * h264 - h264 encoding. We have an rfbH264Header structure - * giving the number of bytes following. Finally the data follows is - * h264 encoded frame. - */ - -typedef struct { - uint32_t nBytes; - uint32_t slice_type; - uint32_t width; - uint32_t height; -} rfbH264Header; - -#define sz_rfbH264Header 16 - -/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * XCursor encoding. This is a special encoding used to transmit X-style * cursor shapes from server to clients. Note that for this encoding, * coordinates in rfbFramebufferUpdateRectHeader structure hold hotspot @@ -1100,7 +1082,7 @@ typedef struct _rfbFileTransferMsg { #define rfbRErrorCmd 0xFFFFFFFF/* Error when a command fails on remote side (ret in "size" field) */ #define sz_rfbBlockSize 8192 /* Size of a File Transfer packet (before compression) */ -#define rfbZipDirectoryPrefix "!UVNCDIR-\0" /* Transfered directory are zipped in a file with this prefix. Must end with "-" */ +#define rfbZipDirectoryPrefix "!UVNCDIR-\0" /* Transferred directory are zipped in a file with this prefix. Must end with "-" */ #define sz_rfbZipDirectoryPrefix 9 #define rfbDirPrefix "[ " #define rfbDirSuffix " ]" |