Commit 0d734ad8 authored by steven_carr's avatar steven_carr

Server Capability Encodings

rfbEncodingSupportedEncodings - What encodings are supported?
rfbEncodingSupportedMessages  - What message types are supported?
rfbEncodingServerIdentity     - What is the servers version string?
ie: "x11vnc: 0.8.1 lastmod: 2006-04-25 (LibVNCServer 0.9pre)"
parent 2eded94f
2006-05-04 Steven Carr <scarr@jsa-usa.com>
* rfbEncodingSupportedEncodings - What encodings are supported?
* rfbEncodingSupportedMessages - What message types are supported?
This way a client can identify if a particular server supports a
specific message types.
* rfbEncodingServerIdentity - What is the servers version string?
ie: "x11vnc: 0.8.1 lastmod: 2006-04-25 (LibVNCServer 0.9pre)"
2006-05-03 Steven Carr <scarr@jsa-usa.com>
* Server Side Scaling is now supported in libvncserver
Both PalmVNC and UltraVNC SetScale messages are supported
......
......@@ -532,25 +532,6 @@ SetFormatAndEncodings(rfbClient* client)
encs[se->nEncodings++] = rfbClientSwap32IfLE(client->appData.qualityLevel +
rfbEncodingQualityLevel0);
}
if (client->appData.useRemoteCursor) {
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingXCursor);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingRichCursor);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingPointerPos);
}
/* Let's receive keyboard state encoding if available */
if (se->nEncodings < MAX_ENCODINGS) {
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingKeyboardLedState);
}
if (se->nEncodings < MAX_ENCODINGS && requestLastRectEncoding) {
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingLastRect);
}
}
else {
if (SameMachine(client->sock)) {
......@@ -570,6 +551,7 @@ SetFormatAndEncodings(rfbClient* client)
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingTight);
requestLastRectEncoding = TRUE;
#endif
#endif
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingHextile);
......@@ -599,24 +581,42 @@ SetFormatAndEncodings(rfbClient* client)
encs[se->nEncodings++] = rfbClientSwap32IfLE(client->appData.qualityLevel +
rfbEncodingQualityLevel0);
}
}
if (client->appData.useRemoteCursor) {
/* Remote Cursor Support (local to viewer) */
if (client->appData.useRemoteCursor) {
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingXCursor);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingRichCursor);
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingPointerPos);
}
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingLastRect);
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingPointerPos);
}
/* Keyboard State Encodings */
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingKeyboardLedState);
/* New Frame Buffer Size */
if (se->nEncodings < MAX_ENCODINGS && client->canHandleNewFBSize)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingNewFBSize);
/* Last Rect */
if (se->nEncodings < MAX_ENCODINGS && requestLastRectEncoding)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingLastRect);
/* Server Capabilities */
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingSupportedMessages);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingSupportedEncodings);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingServerIdentity);
/* client extensions */
for(e = rfbClientExtensions; e; e = e->next)
if(e->encodings) {
int* enc;
......@@ -856,6 +856,65 @@ HandleRFBServerMessage(rfbClient* client)
continue;
}
/* rect.r.w=byte count */
if (rect.encoding == rfbEncodingSupportedMessages) {
rfbSupportedMessages msgs;
int loop;
if (!ReadFromRFBServer(client, (char *)&msgs, sz_rfbSupportedMessages))
return FALSE;
/* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */
/* currently ignored by this library */
rfbClientLog("client2server supported messages (bit flags)\n");
for (loop=0;loop<32;loop+=8)
rfbClientLog("%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\n", loop,
msgs.client2server[loop], msgs.client2server[loop+1],
msgs.client2server[loop+2], msgs.client2server[loop+3],
msgs.client2server[loop+4], msgs.client2server[loop+5],
msgs.client2server[loop+6], msgs.client2server[loop+7]);
rfbClientLog("server2client supported messages (bit flags)\n");
for (loop=0;loop<32;loop+=8)
rfbClientLog("%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\n", loop,
msgs.server2client[loop], msgs.server2client[loop+1],
msgs.server2client[loop+2], msgs.server2client[loop+3],
msgs.server2client[loop+4], msgs.server2client[loop+5],
msgs.server2client[loop+6], msgs.server2client[loop+7]);
continue;
}
/* rect.r.w=byte count, rect.r.h=# of encodings */
if (rect.encoding == rfbEncodingSupportedEncodings) {
char *buffer;
buffer = malloc(rect.r.w);
if (!ReadFromRFBServer(client, buffer, rect.r.w))
{
free(buffer);
return FALSE;
}
/* buffer now contains rect.r.h # of uint32_t encodings that the server supports */
/* currently ignored by this library */
free(buffer);
continue;
}
/* rect.r.w=byte count */
if (rect.encoding == rfbEncodingServerIdentity) {
char *buffer;
buffer = malloc(rect.r.w+1);
if (!ReadFromRFBServer(client, buffer, rect.r.w))
{
free(buffer);
return FALSE;
}
buffer[rect.r.w]=0; /* null terminate, just in case */
rfbClientLog("Connected to Server \"%s\"\n", buffer);
free(buffer);
continue;
}
/* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */
if (rect.encoding != rfbEncodingUltraZip)
{
......
This diff is collapsed.
......@@ -323,6 +323,9 @@ typedef struct _rfbScreenInfo
/* handle as many input events as possible (default off) */
rfbBool handleEventsEagerly;
/* rfbEncodingServerIdentity */
char *versionString;
} rfbScreenInfo, *rfbScreenInfoPtr;
......@@ -501,6 +504,9 @@ typedef struct _rfbClientRec {
int lastKeyboardLedState; /* keep track of last value so we can send *change* events */
rfbBool enableSupportedMessages; /* client supports SupportedMessages encoding */
rfbBool enableSupportedEncodings; /* client supports SupportedEncodings encoding */
rfbBool enableServerIdentity; /* client supports ServerIdentity encoding */
rfbBool enableKeyboardLedState; /* client supports KeyboardState encoding */
rfbBool enableLastRectEncoding; /* client supports LastRect encoding */
rfbBool enableCursorShapeUpdates; /* client supports cursor shape updates */
......@@ -852,6 +858,7 @@ extern void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen,char *framebuffer,
int bytesPerPixel);
extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo);
extern void rfbSetServerVersionIdentity(rfbScreenInfoPtr screen, char *fmt, ...);
/* functions to accept/refuse a client that has been put on hold
by a NewClientHookPtr function. Must not be called in other
......
......@@ -401,8 +401,8 @@ typedef struct {
#define rfbEncodingZlib 6
#define rfbEncodingTight 7
#define rfbEncodingZlibHex 8
#define rfbEncodingUltra 9
#endif
#define rfbEncodingUltra 9
#ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingZRLE 16
#endif
......@@ -446,9 +446,12 @@ typedef struct {
#define rfbEncodingRichCursor 0xFFFFFF11
#define rfbEncodingPointerPos 0xFFFFFF18
#define rfbEncodingLastRect 0xFFFFFF20
#define rfbEncodingNewFBSize 0xFFFFFF21
#define rfbEncodingKeyboardLedState 0xFFFFFF22
#define rfbEncodingLastRect 0xFFFFFF20
#define rfbEncodingNewFBSize 0xFFFFFF21
#define rfbEncodingKeyboardLedState 0xFFFFFF22
#define rfbEncodingSupportedMessages 0xFFFFFF23
#define rfbEncodingSupportedEncodings 0xFFFFFF24
#define rfbEncodingServerIdentity 0xFFFFFF25
#define rfbEncodingQualityLevel0 0xFFFFFFE0
#define rfbEncodingQualityLevel1 0xFFFFFFE1
......@@ -514,6 +517,34 @@ typedef struct {
#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Supported Messages Encoding. This encoding does not contain any pixel data.
* Instead, it contains 2 sets of bitflags. These bitflags indicate what messages
* are supported by the server.
* rect->w contains byte count
*/
typedef struct {
uint8_t client2server[32]; /* maximum of 256 message types (256/8)=32 */
uint8_t server2client[32]; /* maximum of 256 message types (256/8)=32 */
} rfbSupportedMessages;
#define sz_rfbSupportedMessages 64
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Supported Encodings Encoding. This encoding does not contain any pixel data.
* Instead, it contains a list of (uint32_t) Encodings supported by this server.
* rect->w contains byte count
* rect->h contains encoding count
*/
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Server Identity Encoding. This encoding does not contain any pixel data.
* Instead, it contains a text string containing information about the server.
* ie: "x11vnc: 0.8.1 lastmod: 2006-04-25 (libvncserver 0.9pre)\0"
* rect->w contains byte count
*/
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Raw Encoding. Pixels are sent in top-to-bottom scanline order,
......@@ -1244,7 +1275,7 @@ typedef struct _rfbSetScaleMsg {
* client buffer.
*/
typedef struct {
uint8_t type; /* always rfbSetScaleFactor */
uint8_t type; /* always rfbPalmVNCSetScaleFactor */
uint8_t scale; /* Scale factor (positive non-zero integer) */
uint16_t pad2;
......
......@@ -1966,6 +1966,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
screen->deferUpdateTime = defer_update;
}
rfbSetServerVersionIdentity(screen, "x11vnc: %s", lastmod);
rfbInitServer(screen);
if (use_openssl) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment