summaryrefslogtreecommitdiffstats
path: root/rfb
diff options
context:
space:
mode:
authorsteven_carr <steven_carr>2006-05-15 05:37:39 +0000
committersteven_carr <steven_carr>2006-05-15 05:37:39 +0000
commitccdbe8f3256c3c776a1cc1a0517a38437b9e2c65 (patch)
tree9853559d1c965946b196cccd03ce0f466d524950 /rfb
parent347c4a98475d1dba8030efe33aa0b35856c4d17f (diff)
downloadlibvncserver-ccdbe8f3256c3c776a1cc1a0517a38437b9e2c65.zip
libvncserver-ccdbe8f3256c3c776a1cc1a0517a38437b9e2c65.tar.gz
The great UltraVNC Compatibility Commit
Diffstat (limited to 'rfb')
-rw-r--r--rfb/rfb.h111
-rw-r--r--rfb/rfbclient.h21
-rw-r--r--rfb/rfbproto.h22
3 files changed, 126 insertions, 28 deletions
diff --git a/rfb/rfb.h b/rfb/rfb.h
index 39abe77..0f098a5 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -136,8 +136,22 @@ typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char*
typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
/* support the capability to view the caps/num/scroll states of the X server */
-typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
-
+typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
+/* If x==1 and y==1 then set the whole display
+ * else find the window underneath x and y and set the framebuffer to the dimensions
+ * of that window
+ */
+typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y);
+/* Status determines if the X11 server permits input from the local user
+ * status==0 or 1
+ */
+typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status);
+/* Permit the server to allow or deny filetransfers. This is defaulted to deny
+ * It is called when a client initiates a connection to determine if it is permitted.
+ */
+typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl);
+/* Handle the textchat messages */
+typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string);
typedef struct {
uint32_t count;
@@ -296,7 +310,11 @@ typedef struct _rfbScreenInfo
rfbSetXCutTextProcPtr setXCutText;
rfbGetCursorProcPtr getCursorPtr;
rfbSetTranslateFunctionProcPtr setTranslateFunction;
-
+ rfbSetSingleWindowProcPtr setSingleWindow;
+ rfbSetServerInputProcPtr setServerInput;
+ rfbFileTransferPermitted getFileTransferPermission;
+ rfbSetTextChat setTextChat;
+
/* newClientHook is called just after a new client is created */
rfbNewClientHookPtr newClientHook;
/* displayHook is called just before a frame buffer update */
@@ -326,6 +344,10 @@ typedef struct _rfbScreenInfo
/* rfbEncodingServerIdentity */
char *versionString;
+
+ /* What does the server tell the new clients which version it supports */
+ int protocolMajorVersion;
+ int protocolMinorVersion;
} rfbScreenInfo, *rfbScreenInfoPtr;
@@ -351,6 +373,27 @@ typedef struct sraRegion* sraRegionPtr;
typedef void (*ClientGoneHookPtr)(struct _rfbClientRec* cl);
+typedef struct _rfbFileTransferData {
+ int fd;
+ int compressionEnabled;
+ int fileSize;
+ int numPackets;
+ int receiving;
+ int sending;
+} rfbFileTransferData;
+
+
+typedef struct _rfbStatList {
+ uint32_t type;
+ uint32_t sentCount;
+ uint32_t bytesSent;
+ uint32_t bytesSentIfRaw;
+ uint32_t rcvdCount;
+ uint32_t bytesRcvd;
+ uint32_t bytesRcvdIfRaw;
+ struct _rfbStatList *Next;
+} rfbStatList;
+
typedef struct _rfbClientRec {
/* back pointer to the screen */
@@ -467,20 +510,11 @@ typedef struct _rfbClientRec {
int ublen;
/* statistics */
-
- int bytesSent[MAX_ENCODINGS];
- int rectanglesSent[MAX_ENCODINGS];
- int lastRectMarkersSent;
- int lastRectBytesSent;
- int cursorShapeBytesSent;
- int cursorShapeUpdatesSent;
- int cursorPosBytesSent;
- int cursorPosUpdatesSent;
- int framebufferUpdateMessagesSent;
+ struct _rfbStatList *statEncList;
+ struct _rfbStatList *statMsgList;
int rawBytesEquivalent;
- int keyEventsRcvd;
- int pointerEventsRcvd;
-
+ int bytesSent;
+
#ifdef LIBVNCSERVER_HAVE_LIBZ
/* zlib encoding -- necessary compression state info per client */
@@ -502,6 +536,7 @@ typedef struct _rfbClientRec {
rfbBool compStreamInitedLZO;
char *lzoWrkMem;
+ rfbFileTransferData fileTransfer;
int lastKeyboardLedState; /* keep track of last value so we can send *change* events */
rfbBool enableSupportedMessages; /* client supports SupportedMessages encoding */
@@ -584,6 +619,11 @@ extern char rfbEndianTest;
#define Swap24IfLE(l) (rfbEndianTest ? Swap24(l) : (l))
#define Swap32IfLE(l) (rfbEndianTest ? Swap32(l) : (l))
+/* UltraVNC uses some windows structures unmodified, so the viewer expects LittleEndian Data */
+#define Swap16IfBE(s) (rfbEndianTest ? (s) : Swap16(s))
+#define Swap24IfBE(l) (rfbEndianTest ? (l) : Swap24(l))
+#define Swap32IfBE(l) (rfbEndianTest ? (l) : Swap32(l))
+
/* sockets.c */
extern int rfbMaxClientWait;
@@ -634,6 +674,13 @@ extern rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h);
extern rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours);
extern void rfbSendBell(rfbScreenInfoPtr rfbScreen);
+extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
+extern rfbBool rfbSendFileTransferChunk(rfbClientPtr cl);
+extern rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer);
+extern rfbBool rfbSendFileTransferMessage(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length, char *buffer);
+extern char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length);
+extern rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t contentParam, uint32_t size, uint32_t length);
+
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len);
/* translate.c */
@@ -880,6 +927,38 @@ extern rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo);
void rfbRegisterTightVNCFileTransferExtension();
void rfbUnregisterTightVNCFileTransferExtension();
+/* Statistics */
+extern char *messageNameServer2Client(uint32_t type, char *buf, int len);
+extern char *messageNameClient2Server(uint32_t type, char *buf, int len);
+extern char *encodingName(uint32_t enc, char *buf, int len);
+
+extern rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type);
+extern rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type);
+
+/* Each call to rfbStatRecord* adds one to the rect count for that type */
+extern void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
+extern void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount); /* Specifically for tight encoding */
+extern void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
+extern void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
+extern void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
+extern void rfbResetStats(rfbClientPtr cl);
+extern void rfbPrintStats(rfbClientPtr cl);
+
+extern int rfbStatGetSentBytes(rfbClientPtr cl);
+extern int rfbStatGetSentBytesIfRaw(rfbClientPtr cl);
+extern int rfbStatGetRcvdBytes(rfbClientPtr cl);
+extern int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl);
+extern int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type);
+extern int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type);
+extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type);
+extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type);
+
+/* Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported*/
+extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_);
+
+
+
+
#endif
#if(defined __cplusplus)
diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h
index 3454af4..d8e3fdc 100644
--- a/rfb/rfbclient.h
+++ b/rfb/rfbclient.h
@@ -96,6 +96,7 @@ typedef struct {
struct _rfbClient;
+typedef void (*HandleTextChatProc)(struct _rfbClient* client, int value, char *text);
typedef void (*HandleKeyboardLedStateProc)(struct _rfbClient* client, int value, int pad);
typedef rfbBool (*HandleCursorPosProc)(struct _rfbClient* client, int x, int y);
typedef void (*SoftCursorLockAreaProc)(struct _rfbClient* client, int x, int y, int w, int h);
@@ -210,6 +211,7 @@ typedef struct _rfbClient {
int canHandleNewFBSize;
/* hooks */
+ HandleTextChatProc HandleTextChat;
HandleKeyboardLedStateProc HandleKeyboardLedState;
HandleCursorPosProc HandleCursorPos;
SoftCursorLockAreaProc SoftCursorLockArea;
@@ -219,6 +221,19 @@ typedef struct _rfbClient {
GetPasswordProc GetPassword;
MallocFrameBufferProc MallocFrameBuffer;
BellProc Bell;
+
+ /* Which messages are supported by the server
+ * This is a *guess* for most servers.
+ * (If we can even detect the type of server)
+ *
+ * If the server supports the "rfbEncodingSupportedMessages"
+ * then this will be updated when the encoding is received to
+ * accurately reflect the servers capabilities.
+ */
+ rfbSupportedMessages supportedMessages;
+
+ /* negotiated protocol version */
+ int major, minor;
} rfbClient;
/* cursor.c */
@@ -247,6 +262,12 @@ extern rfbBool SendKeyEvent(rfbClient* client,uint32_t key, rfbBool down);
extern rfbBool SendClientCutText(rfbClient* client,char *str, int len);
extern rfbBool HandleRFBServerMessage(rfbClient* client);
+extern rfbBool TextChatSend(rfbClient* client, char *text);
+extern rfbBool TextChatOpen(rfbClient* client);
+extern rfbBool TextChatClose(rfbClient* client);
+extern rfbBool TextChatFinish(rfbClient* client);
+extern rfbBool PermitServerInput(rfbClient* client, int enabled);
+
extern void PrintPixelFormat(rfbPixelFormat *format);
/* client data */
diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h
index c642f61..672d0d7 100644
--- a/rfb/rfbproto.h
+++ b/rfb/rfbproto.h
@@ -218,8 +218,10 @@ typedef struct {
#define rfbProtocolVersionFormat "RFB %03d.%03d\n"
#define rfbProtocolMajorVersion 3
-#define rfbProtocolMinorVersion 7
-#define rfbProtocolFallbackMinorVersion 3
+#define rfbProtocolMinorVersion 6
+/* UltraVNC Viewer examines rfbProtocolMinorVersion number (4, and 6)
+ * to identify if the server supports File Transfer
+ */
typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
@@ -397,24 +399,18 @@ typedef struct {
#define rfbEncodingRRE 2
#define rfbEncodingCoRRE 4
#define rfbEncodingHextile 5
-#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingZlib 6
#define rfbEncodingTight 7
#define rfbEncodingZlibHex 8
-#endif
#define rfbEncodingUltra 9
-#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingZRLE 16
-#endif
/* Cache & XOR-Zlib - rdv@2002 */
#define rfbEncodingCache 0xFFFF0000
#define rfbEncodingCacheEnable 0xFFFF0001
-#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingXOR_Zlib 0xFFFF0002
#define rfbEncodingXORMonoColor_Zlib 0xFFFF0003
#define rfbEncodingXORMultiColor_Zlib 0xFFFF0004
-#endif
#define rfbEncodingSolidColor 0xFFFF0005
#define rfbEncodingXOREnable 0xFFFF0006
#define rfbEncodingCacheZip 0xFFFF0007
@@ -649,11 +645,11 @@ typedef struct {
#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
-#ifdef LIBVNCSERVER_HAVE_LIBZ
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* zlib - zlib compressed Encoding. We have an rfbZlibHeader structure
* giving the number of bytes following. Finally the data follows is
* zlib compressed version of the raw pixel data as negotiated.
+ * (NOTE: also used by Ultra Encoding)
*/
typedef struct {
@@ -662,6 +658,7 @@ typedef struct {
#define sz_rfbZlibHeader 4
+#ifdef LIBVNCSERVER_HAVE_LIBZ
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Tight Encoding.
@@ -935,9 +932,10 @@ typedef struct {
typedef struct _rfbFileTransferMsg {
uint8_t type; /* always rfbFileTransfer */
uint8_t contentType; /* See defines below */
- uint16_t contentParam;/* Other possible content classification (Dir or File name, etc..) */
- uint32_t size; /* FileSize or packet index or error or other */
- /* uint32_t sizeH; Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions) */
+ uint8_t contentParam;/* Other possible content classification (Dir or File name, etc..) */
+ uint8_t pad; /* It appears that UltraVNC *forgot* to Swap16IfLE(contentParam) */
+ uint32_t size; /* FileSize or packet index or error or other */
+/* uint32_t sizeH; Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions) */
uint32_t length;
/* followed by data char text[length] */
} rfbFileTransferMsg;
OpenPOWER on IntegriCloud