diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2010-01-14 14:50:57 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-19 16:31:03 -0600 |
commit | 586153d9520c4ec3e4352cffa683b92ef5f23925 (patch) | |
tree | 5d4c31fc0bd80abde6b177e09fe993966a8794f2 /vnc.c | |
parent | 4a80dba3920cf8e0829b9ce4769842ce94748bf4 (diff) |
QMP: Introduce VNC_CONNECTED event
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 <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vnc.c')
-rw-r--r-- | vnc.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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; |