summaryrefslogtreecommitdiffstats
path: root/libvncclient/rfbproto.c
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2010-11-02 22:23:12 +0100
committerChristian Beier <dontmind@freeshell.org>2010-11-02 22:23:12 +0100
commite5523350a8fb5d6ccae4b4d9bc92897f3e5db18c (patch)
treea784f30fb06c79ec942613f7a3833a23f97e808c /libvncclient/rfbproto.c
parent5da7c7a71ac1db69902c3a2a80f8771713dde70f (diff)
downloadlibtdevnc-e5523350a8fb5d6ccae4b4d9bc92897f3e5db18c.tar.gz
libtdevnc-e5523350a8fb5d6ccae4b4d9bc92897f3e5db18c.zip
libvnc[server|client]: implement xvp VNC extension.
This implements the xvp VNC extension, which is described in the community version of the RFB protocol: http://tigervnc.sourceforge.net/cgi-bin/rfbproto It is also mentioned in the official RFB protocol.
Diffstat (limited to 'libvncclient/rfbproto.c')
-rw-r--r--libvncclient/rfbproto.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
index 098ae38..7d881c4 100644
--- a/libvncclient/rfbproto.c
+++ b/libvncclient/rfbproto.c
@@ -1230,6 +1230,9 @@ SetFormatAndEncodings(rfbClient* client)
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingServerIdentity);
+ /* xvp */
+ if (se->nEncodings < MAX_ENCODINGS)
+ encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingXvp);
/* client extensions */
for(e = rfbClientExtensions; e; e = e->next)
@@ -1395,6 +1398,37 @@ rfbBool PermitServerInput(rfbClient* client, int enabled)
/*
+ * send xvp client message
+ * A client supporting the xvp extension sends this to request that the server initiate
+ * a clean shutdown, clean reboot or abrupt reset of the system whose framebuffer the
+ * client is displaying.
+ *
+ * only version 1 is defined in the protocol specs
+ *
+ * possible values for code are:
+ * rfbXvp_Shutdown
+ * rfbXvp_Reboot
+ * rfbXvp_Reset
+ */
+
+rfbBool SendXvpMsg(rfbClient* client, uint8_t version, uint8_t code)
+{
+ rfbXvpMsg xvp;
+
+ if (!SupportsClient2Server(client, rfbXvp)) return TRUE;
+ xvp.type = rfbXvp;
+ xvp.pad = 0;
+ xvp.version = version;
+ xvp.code = code;
+
+ if (!WriteToRFBServer(client, (char *)&xvp, sz_rfbXvpMsg))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*
* SendPointerEvent.
*/
@@ -1984,6 +2018,24 @@ HandleRFBServerMessage(rfbClient* client)
break;
}
+ case rfbXvp:
+ {
+ if (!ReadFromRFBServer(client, ((char *)&msg) + 1,
+ sz_rfbXvpMsg -1))
+ return FALSE;
+
+ SetClient2Server(client, rfbXvp);
+ /* technically, we only care what we can *send* to the server
+ * but, we set Server2Client Just in case it ever becomes useful
+ */
+ SetServer2Client(client, rfbXvp);
+
+ if(client->HandleXvpMsg)
+ client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);
+
+ break;
+ }
+
case rfbResizeFrameBuffer:
{
if (!ReadFromRFBServer(client, ((char *)&msg) + 1,