Message ID | 1418979866-1615-11-git-send-email-kraxel@redhat.com |
---|---|
State | New |
Headers | show |
Copying Eric again, even though the QAPI schema change here is pretty trivial. Gerd Hoffmann <kraxel@redhat.com> writes: > Add websockets bool to VncBasicInfo, report websocket server sockets, > flag websocket client connections. > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > qapi-schema.json | 5 ++++- > ui/vnc.c | 15 ++++++++++++--- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/qapi-schema.json b/qapi-schema.json > index 2d45d4c..07deb71 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -672,12 +672,15 @@ > # > # @family: address family > # > +# @websocket: true in case the socket is a websocket (since 2.3). > +# > # 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 e730059..fb8068f 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -353,6 +353,9 @@ 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); > +#ifdef CONFIG_VNC_WS > + info->base->websocket = client->websocket; > +#endif > > #ifdef CONFIG_VNC_TLS > if (client->tls.session && client->tls.dname) { > @@ -457,6 +460,7 @@ out_error: > } > > static VncBasicInfoList *qmp_query_server_entry(int socket, > + bool websocket, > VncBasicInfoList *prev) > { > VncBasicInfoList *list; > @@ -477,6 +481,7 @@ 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); > + info->websocket = websocket; > > list = g_new0(VncBasicInfoList, 1); > list->value = info; > @@ -572,12 +577,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 > > @@ -3304,10 +3310,13 @@ void vnc_display_open(const char *id, Error **errp) > { > VncDisplay *vs = vnc_display_find(id); > QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id); > - const char *display, *websocket, *share, *device_id; > + const char *display, *share, *device_id; > QemuConsole *con; > int password = 0; > int reverse = 0; > +#ifdef CONFIG_VNC_WS > + const char *websocket; > +#endif > #ifdef CONFIG_VNC_TLS > int tls = 0, x509 = 0; > const char *path; Reviewed-by: Markus Armbruster <armbru@redhat.com>
On 12/19/2014 02:04 AM, Gerd Hoffmann wrote: > Add websockets bool to VncBasicInfo, report websocket server sockets, > flag websocket client connections. > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > qapi-schema.json | 5 ++++- > ui/vnc.c | 15 ++++++++++++--- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/qapi-schema.json b/qapi-schema.json > index 2d45d4c..07deb71 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -672,12 +672,15 @@ > # > # @family: address family > # > +# @websocket: true in case the socket is a websocket (since 2.3). > +# > # Since: 2.1 > ## > { 'type': 'VncBasicInfo', > 'data': { 'host': 'str', > 'service': 'str', > - 'family': 'NetworkAddressFamily' } } > + 'family': 'NetworkAddressFamily', > + 'websocket': 'bool' } } This says the field is mandatory; > +++ b/ui/vnc.c > @@ -353,6 +353,9 @@ 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); > +#ifdef CONFIG_VNC_WS > + info->base->websocket = client->websocket; > +#endif while this only conditionally assigns it. Fortunately, in the context not shown here, you use g_malloc0 for initializing info->base, so it works out. Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/qapi-schema.json b/qapi-schema.json index 2d45d4c..07deb71 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -672,12 +672,15 @@ # # @family: address family # +# @websocket: true in case the socket is a websocket (since 2.3). +# # 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 e730059..fb8068f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -353,6 +353,9 @@ 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); +#ifdef CONFIG_VNC_WS + info->base->websocket = client->websocket; +#endif #ifdef CONFIG_VNC_TLS if (client->tls.session && client->tls.dname) { @@ -457,6 +460,7 @@ out_error: } static VncBasicInfoList *qmp_query_server_entry(int socket, + bool websocket, VncBasicInfoList *prev) { VncBasicInfoList *list; @@ -477,6 +481,7 @@ 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); + info->websocket = websocket; list = g_new0(VncBasicInfoList, 1); list->value = info; @@ -572,12 +577,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 @@ -3304,10 +3310,13 @@ void vnc_display_open(const char *id, Error **errp) { VncDisplay *vs = vnc_display_find(id); QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id); - const char *display, *websocket, *share, *device_id; + const char *display, *share, *device_id; QemuConsole *con; int password = 0; int reverse = 0; +#ifdef CONFIG_VNC_WS + const char *websocket; +#endif #ifdef CONFIG_VNC_TLS int tls = 0, x509 = 0; const char *path;
Add websockets bool to VncBasicInfo, report websocket server sockets, flag websocket client connections. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- qapi-schema.json | 5 ++++- ui/vnc.c | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-)