summaryrefslogtreecommitdiff
path: root/ui/vnc.h
diff options
context:
space:
mode:
authorTim Hardeck <thardeck@suse.de>2013-01-21 11:04:44 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-21 13:33:12 -0600
commit7536ee4bc3da7e9b7fdadba5ba6ade63eaace430 (patch)
treedd9818e015ffe360e5636066e987cdc8c91d9839 /ui/vnc.h
parent32ed26808d4e59efb4a03290a4a85f5f8335f268 (diff)
downloadqemu-7536ee4bc3da7e9b7fdadba5ba6ade63eaace430.tar.gz
vnc: added initial websocket protocol support
This patch adds basic Websocket Protocol version 13 - RFC 6455 - support to QEMU VNC. Binary encoding support on the client side is mandatory. Because of the GnuTLS requirement the Websockets implementation is optional (--enable-vnc-ws). To activate Websocket support the VNC option "websocket"is used, for example "-vnc :0,websocket". The listen port for Websocket connections is (5700 + display) so if QEMU VNC is started with :0 the Websocket port would be 5700. As an alternative the Websocket port could be manually specified by using ",websocket=<port>" instead. Parts of the implementation base on Anthony Liguori's QEMU Websocket patch from 2010 and on Joel Martin's LibVNC Websocket implementation. Signed-off-by: Tim Hardeck <thardeck@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/vnc.h')
-rw-r--r--ui/vnc.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/vnc.h b/ui/vnc.h
index 5059cbe3b8..f93c89a2f7 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -99,6 +99,9 @@ typedef struct VncDisplay VncDisplay;
#ifdef CONFIG_VNC_SASL
#include "vnc-auth-sasl.h"
#endif
+#ifdef CONFIG_VNC_WS
+#include "vnc-ws.h"
+#endif
struct VncRectStat
{
@@ -142,6 +145,11 @@ struct VncDisplay
QEMUTimer *timer;
int timer_interval;
int lsock;
+#ifdef CONFIG_VNC_WS
+ int lwebsock;
+ bool websocket;
+ char *ws_display;
+#endif
DisplayState *ds;
kbd_layout_t *kbd_layout;
int lock_key_sync;
@@ -269,11 +277,19 @@ struct VncState
#ifdef CONFIG_VNC_SASL
VncStateSASL sasl;
#endif
+#ifdef CONFIG_VNC_WS
+ bool encode_ws;
+ bool websocket;
+#endif
QObject *info;
Buffer output;
Buffer input;
+#ifdef CONFIG_VNC_WS
+ Buffer ws_input;
+ Buffer ws_output;
+#endif
/* current output mode information */
VncWritePixels *write_pixels;
PixelFormat client_pf;
@@ -493,6 +509,8 @@ void vnc_write_u16(VncState *vs, uint16_t value);
void vnc_write_u8(VncState *vs, uint8_t value);
void vnc_flush(VncState *vs);
void vnc_read_when(VncState *vs, VncReadEvent *func, size_t expecting);
+void vnc_disconnect_finish(VncState *vs);
+void vnc_init_state(VncState *vs);
/* Buffer I/O functions */
@@ -511,6 +529,7 @@ void buffer_reset(Buffer *buffer);
void buffer_free(Buffer *buffer);
void buffer_append(Buffer *buffer, const void *data, size_t len);
void buffer_advance(Buffer *buf, size_t len);
+uint8_t *buffer_end(Buffer *buffer);
/* Misc helpers */