Add websockets bool to VncBasicInfo, report websocket server sockets,
flag websocket client connections.
Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
qapi-schema.json | 5 -
ui/vnc.c | 14 --
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index 677a762..a945693 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -672,12 +672,15 @@
#
# @family: address family
#
+# @websocket: #optional true in case the socket is a websocket (since 2.2).
+#
# Since: 2.1
##
{ 'type': 'VncBasicInfo',
'data': { 'host': 'str',
'service': 'str',
-'family': 'NetworkAddressFamily' } }
+'family': 'NetworkAddressFamily',
+'*websocket': 'bool' } }
##
# @VncServerInfo
diff --git a/ui/vnc.c b/ui/vnc.c
index 0574631..f3beb4b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -353,6 +353,10 @@ static VncClientInfo *qmp_query_vnc_client(const VncState
*client)
info-base-host = g_strdup(host);
info-base-service = g_strdup(serv);
info-base-family = inet_netfamily(sa.ss_family);
+if (client-websocket) {
+info-base-has_websocket = true;
+info-base-websocket = true;
+}
#ifdef CONFIG_VNC_TLS
if (client-tls.session client-tls.dname) {
@@ -457,6 +461,7 @@ out_error:
}
static VncBasicInfoList *qmp_query_server_entry(int socket,
+bool websocket,
VncBasicInfoList *prev)
{
VncBasicInfoList *list;
@@ -477,6 +482,10 @@ static VncBasicInfoList *qmp_query_server_entry(int socket,
info-host = g_strdup(host);
info-service = g_strdup(serv);
info-family = inet_netfamily(sa.ss_family);
+if (websocket) {
+info-has_websocket = true;
+info-websocket = true;
+}
list = g_new0(VncBasicInfoList, 1);
list-value = info;
@@ -503,12 +512,13 @@ VncInfo2List *qmp_query_vnc2(Error **errp)
info-display = g_strdup(dev-id);
}
if (vd-lsock != -1) {
-info-server = qmp_query_server_entry(vd-lsock,
+info-server = qmp_query_server_entry(vd-lsock, false,
info-server);
}
#ifdef CONFIG_VNC_WS
if (vd-lwebsock != -1) {
-/* TODO */
+info-server = qmp_query_server_entry(vd-lwebsock, true,
+ info-server);
}
#endif
--
1.8.3.1