[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/7] QMP: Introduce QMP connect event
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 7/7] QMP: Introduce QMP connect event |
Date: |
Fri, 8 Jan 2010 19:47:16 -0200 |
It's emitted everytime a VNC client connects to QEMU,
client's information such as port and IP address is provided.
Note that if any kind of authentication is enabled, this
event is only emitted when the client successfully
authenticates.
For example:
{ "event": "VNC_CONNECT",
"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 <address@hidden>
---
monitor.c | 3 +++
monitor.h | 1 +
vnc.c | 7 ++++++-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/monitor.c b/monitor.c
index 78fd33a..632a620 100644
--- 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_CONNECT:
+ event_name = "VNC_CONNECT";
+ break;
case QEVENT_VNC_DISCONNECT:
event_name = "VNC_DISCONNECT";
break;
diff --git a/monitor.h b/monitor.h
index e836dd6..50067f6 100644
--- a/monitor.h
+++ b/monitor.h
@@ -20,6 +20,7 @@ typedef enum MonitorEvent {
QEVENT_RESET,
QEVENT_POWERDOWN,
QEVENT_STOP,
+ QEVENT_VNC_CONNECT,
QEVENT_VNC_DISCONNECT,
QEVENT_MAX,
} MonitorEvent;
diff --git a/vnc.c b/vnc.c
index f2f0ef3..aaba75d 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1088,7 +1088,11 @@ static void vnc_qmp_event(VncState *vs, MonitorEvent
event)
monitor_protocol_event(event, data);
- qobject_decref(data); /* will also free 'vs->info' */
+ if (event == QEVENT_VNC_CONNECT) {
+ qobject_incref(vs->info);
+ }
+
+ qobject_decref(data); /* will also free 'vs->info' on disconnect */
}
static void vnc_disconnect_finish(VncState *vs)
@@ -2081,6 +2085,7 @@ static int protocol_client_init(VncState *vs, uint8_t
*data, size_t len)
int size;
vnc_client_cache_info(vs);
+ vnc_qmp_event(vs, QEVENT_VNC_CONNECT);
vnc_write_u16(vs, ds_get_width(vs->ds));
vnc_write_u16(vs, ds_get_height(vs->ds));
--
1.6.6
- [Qemu-devel] [RFC 0/7]: Add VNC connect/disconnect events, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 1/7] VNC: Use 'enabled' key instead of 'status', Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 2/7] VNC: Make 'auth' key mandatory, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 3/7] VNC: Rename client's 'username' key, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 4/7] VNC: Add 'family' key, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 5/7] VNC: Cache client info at connection time, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 6/7] QMP: Introduce QMP disconnect event, Luiz Capitulino, 2010/01/08
- [Qemu-devel] [PATCH 7/7] QMP: Introduce QMP connect event,
Luiz Capitulino <=
- [Qemu-devel] Re: [RFC 0/7]: Add VNC connect/disconnect events, Daniel P. Berrange, 2010/01/11