Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NY4IE-0000k5-8b for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:10:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NY4I9-0000ck-5x for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:10:17 -0500 Received: from [199.232.76.173] (port=43482 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NY4I8-0000cD-SD for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:10:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NY4I8-0002zE-Be for qemu-devel@nongnu.org; Thu, 21 Jan 2010 16:10:12 -0500 From: Luiz Capitulino Date: Thu, 21 Jan 2010 19:09:34 -0200 Message-Id: <1264108180-3666-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1264108180-3666-1-git-send-email-lcapitulino@redhat.com> References: <1264108180-3666-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 05/11] QMP: advertise asynchronous messages List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, armbru@redhat.com, aliguori@us.ibm.com, avi@redhat.com 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 --- 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