Re: [Qemu-devel] [PATCH v2 10/10] monitor: add vnc websockets

2014-12-11 Thread Gerd Hoffmann
  +# @websocket: #optional true in case the socket is a websocket (since 2.2).
 
 s/2.2/2.3/

Fixed.

 Is it optional because you omit it when false?  Why not just always
 output the bool, so that clients know they are talking to a new-enough
 qemu that knows about websockets (and this is explicitly not one), vs.
 having to guess that the omission of the bool implies that it is not
 rather than being an older qemu.

Makes sense, dropped optional.  Also simplifies the code a bit ;)

cheers,
  Gerd







[Qemu-devel] [PATCH v2 10/10] monitor: add vnc websockets

2014-12-10 Thread Gerd Hoffmann
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




Re: [Qemu-devel] [PATCH v2 10/10] monitor: add vnc websockets

2014-12-10 Thread Eric Blake
On 12/10/2014 02:37 AM, Gerd Hoffmann wrote:
 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).

s/2.2/2.3/

 +#
  # Since: 2.1
  ##
  { 'type': 'VncBasicInfo',
'data': { 'host': 'str',
  'service': 'str',
 -'family': 'NetworkAddressFamily' } }
 +'family': 'NetworkAddressFamily',
 +'*websocket': 'bool' } }

Is it optional because you omit it when false?  Why not just always
output the bool, so that clients know they are talking to a new-enough
qemu that knows about websockets (and this is explicitly not one), vs.
having to guess that the omission of the bool implies that it is not
rather than being an older qemu.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature