]> Git Repo - qemu.git/commitdiff
QMP: Introduce VNC_CONNECTED event
authorLuiz Capitulino <[email protected]>
Thu, 14 Jan 2010 16:50:57 +0000 (14:50 -0200)
committerAnthony Liguori <[email protected]>
Tue, 19 Jan 2010 22:31:03 +0000 (16:31 -0600)
It's emitted when a VNC client connects to QEMU, client's information
such as port and IP address are provided.

Note that this event is emitted right when the connection is
established. This means that it happens before authentication
procedure and session initialization.

Event example:

{ "event": "VNC_CONNECTED",
    "timestamp": { "seconds": 1262976601, "microseconds": 975795 },
    "data": {
        "server": { "auth": "sasl", "family": "ipv4",
                    "service": "5901", "host": "0.0.0.0" },
        "client": { "family": "ipv4", "service": "58425",
                    "host": "127.0.0.1" } } }

Signed-off-by: Luiz Capitulino <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
QMP/qmp-events.txt
monitor.c
monitor.h
vnc.c

index 682a5e53aca53d7a92f3c0dcc94835c87fec5c15..d36da468ad06710148eb14f837fb1f6366e32024 100644 (file)
@@ -24,3 +24,10 @@ Data: None.
 
 Description: Issued when the Virtual Machine enters debug mode.
 Data: None.
+
+4 VNC_CONNECTED
+---------------
+
+Description: Issued when a VNC client establishes a connection.
+Data: 'server' and 'client' keys with the same keys as 'query-vnc',
+except that authentication ID is not provided.
index b824e7c7cdf71fee3c66e1aefa06839e51be7750..c92668045a7f1e7872e32a92579ec7d6f940314f 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -357,6 +357,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_STOP:
             event_name = "STOP";
             break;
+        case QEVENT_VNC_CONNECTED:
+            event_name = "VNC_CONNECTED";
+            break;
         default:
             abort();
             break;
index 6ed117a920a2eefe7cf8b648117b7323da957da2..4d57679000c27df9fa193b37df89b7115ad602c5 100644 (file)
--- a/monitor.h
+++ b/monitor.h
@@ -20,6 +20,7 @@ typedef enum MonitorEvent {
     QEVENT_RESET,
     QEVENT_POWERDOWN,
     QEVENT_STOP,
+    QEVENT_VNC_CONNECTED,
     QEVENT_MAX,
 } MonitorEvent;
 
diff --git a/vnc.c b/vnc.c
index d37fa6021fd913a86a5ba38065ea8ddfda540f10..6d488e52ce5f16a24339576df0879b3f5058ac21 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -269,6 +269,30 @@ static void vnc_client_cache_addr(VncState *client)
     client->info = QOBJECT(qdict);
 }
 
+static void vnc_qmp_event(VncState *vs, MonitorEvent event)
+{
+    QDict *server;
+    QObject *data;
+
+    if (!vs->info) {
+        return;
+    }
+
+    server = qdict_new();
+    if (vnc_server_info_put(server) < 0) {
+        QDECREF(server);
+        return;
+    }
+
+    data = qobject_from_jsonf("{ 'client': %p, 'server': %p }",
+                              vs->info, QOBJECT(server));
+
+    monitor_protocol_event(event, data);
+
+    qobject_incref(vs->info);
+    qobject_decref(data);
+}
+
 static void info_vnc_iter(QObject *obj, void *opaque)
 {
     QDict *client;
@@ -2396,6 +2420,7 @@ static void vnc_connect(VncDisplay *vd, int csock)
     qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
 
     vnc_client_cache_addr(vs);
+    vnc_qmp_event(vs, QEVENT_VNC_CONNECTED);
 
     vs->vd = vd;
     vs->ds = vd->ds;
This page took 0.042055 seconds and 4 git commands to generate.