qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/11] QMP: advertise asynchronous messages


From: Luiz Capitulino
Subject: [Qemu-devel] [PATCH 05/11] QMP: advertise asynchronous messages
Date: Thu, 21 Jan 2010 19:09:34 -0200

With feature negotiation support asynchronous messages are
going to behave like any protocol capability, that is, it
is disabled by default, it can be negotiated and has to be
advertised.

TODO: update spec.

Signed-off-by: Luiz Capitulino <address@hidden>
---
 monitor.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index fc6a1ed..70a59c7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4251,6 +4251,21 @@ void monitor_resume(Monitor *mon)
         readline_show_prompt(mon->rs);
 }
 
+/* XXX: Do we need anything fancier here? */
+static QObject *qmp_capabilities(void)
+{
+    int i;
+    QList *qmp_caps;
+    const char *capabilities[] = { "async messages", NULL };
+
+    qmp_caps = qlist_new();
+    for (i = 0; capabilities[i]; i++) {
+        qlist_append(qmp_caps, qstring_from_str(capabilities[i]));
+    }
+
+    return QOBJECT(qmp_caps);
+}
+
 /**
  * monitor_control_event(): Print QMP gretting
  */
@@ -4262,7 +4277,8 @@ static void monitor_control_event(void *opaque, int event)
 
         json_message_parser_init(&mon->mc->parser, handle_qmp_command);
 
-        data = qobject_from_jsonf("{ 'QMP': { 'capabilities': [] } }");
+        data = qobject_from_jsonf("{ 'QMP': { 'capabilities': %p } }",
+                                  qmp_capabilities()); 
         assert(data != NULL);
 
         monitor_json_emitter(mon, data);
-- 
1.6.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]