aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-01-14 14:50:58 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-19 16:31:03 -0600
commit0d72f3d31b4bc320ac498f011129a646a12f9389 (patch)
tree8cfbe626b2b9d35ec57fb265bc4cd9c41516dcd5
parent586153d9520c4ec3e4352cffa683b92ef5f23925 (diff)
QMP: Introduce VNC_DISCONNECTED event
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>
-rw-r--r--QMP/qmp-events.txt6
-rw-r--r--monitor.c3
-rw-r--r--monitor.h1
-rw-r--r--vnc.c2
4 files changed, 12 insertions, 0 deletions
diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index d36da468a..1e87eb16c 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -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'.
diff --git a/monitor.c b/monitor.c
index c92668045..2540d9467 100644
--- 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;
diff --git a/monitor.h b/monitor.h
index 4d5767900..42386de22 100644
--- 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 6d488e52c..a590bb9c8 100644
--- 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;