From 4860853d60ecea44b65e9cdefce980de3a641dce Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Mon, 21 May 2012 17:59:51 +0100 Subject: Add 'query-events' command to QMP to query async events Sometimes it is neccessary for an application to determine whether a particular QMP event is available, so they can decide whether to use compatibility code instead. This introduces a new 'query-events' command to QMP to do just that { "execute": "query-events" } {"return": [{"name": "WAKEUP"}, {"name": "SUSPEND"}, {"name": "DEVICE_TRAY_MOVED"}, {"name": "BLOCK_JOB_CANCELLED"}, {"name": "BLOCK_JOB_COMPLETED"}, ...snip... {"name": "SHUTDOWN"}]} * monitor.c: Turn MonitorEvent -> string conversion into a lookup from a static table of constant strings. Add impl of qmp_query_events monitor command handler * qapi-schema.json, qmp-commands.hx: Define contract of query-events command Signed-off-by: Daniel P. Berrange Signed-off-by: Luiz Capitulino --- monitor.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'monitor.h') diff --git a/monitor.h b/monitor.h index 0d498006f8..cd1d8786d1 100644 --- a/monitor.h +++ b/monitor.h @@ -41,6 +41,10 @@ typedef enum MonitorEvent { QEVENT_DEVICE_TRAY_MOVED, QEVENT_SUSPEND, QEVENT_WAKEUP, + + /* Add to 'monitor_event_names' array in monitor.c when + * defining new events here */ + QEVENT_MAX, } MonitorEvent; -- cgit 1.4.1