QMP: Introduce VNC_DISCONNECTED event
authorLuiz Capitulino <lcapitulino@redhat.com>
Thu, 14 Jan 2010 16:50:58 +0000 (14:50 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 19 Jan 2010 22:31:03 +0000 (16:31 -0600)
It's emitted when a VNC client disconnects from QEMU, client's
information such as port and IP address are provided.

Event example:

{ "event": "VNC_DISCONNECTED",
    "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", "sasl_username": "foo" } } }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP/qmp-events.txt
monitor.c
monitor.h
vnc.c

index d36da468ad06710148eb14f837fb1f6366e32024..1e87eb16c6ecace8dfa16a52b91f79bb191836a4 100644 (file)
@@ -31,3 +31,9 @@ Data: None.
 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.
+
+5 VNC_DISCONNECTED
+------------------
+
+Description: Issued when the conection is closed.
+Data: 'server' and 'client' keys with the same keys as 'query-vnc'.
index c92668045a7f1e7872e32a92579ec7d6f940314f..2540d9467df590907a11ffcc1feb5f080e6261af 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -360,6 +360,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_VNC_CONNECTED:
             event_name = "VNC_CONNECTED";
             break;
+        case QEVENT_VNC_DISCONNECTED:
+            event_name = "VNC_DISCONNECTED";
+            break;
         default:
             abort();
             break;
index 4d57679000c27df9fa193b37df89b7115ad602c5..42386de222ce6b9554e260d3b9c601cdd3fc82fe 100644 (file)
--- a/monitor.h
+++ b/monitor.h
@@ -21,6 +21,7 @@ typedef enum MonitorEvent {
     QEVENT_POWERDOWN,
     QEVENT_STOP,
     QEVENT_VNC_CONNECTED,
+    QEVENT_VNC_DISCONNECTED,
     QEVENT_MAX,
 } MonitorEvent;
 
diff --git a/vnc.c b/vnc.c
index 6d488e52ce5f16a24339576df0879b3f5058ac21..a590bb9c81eb428606e1a84d459969b64b9199a5 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -1108,6 +1108,8 @@ static void vnc_disconnect_start(VncState *vs)
 
 static void vnc_disconnect_finish(VncState *vs)
 {
+    vnc_qmp_event(vs, QEVENT_VNC_DISCONNECTED);
+
     if (vs->input.buffer) {
         qemu_free(vs->input.buffer);
         vs->input.buffer = NULL;