From patchwork Thu Jan 21 21:09:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 43457 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 767FBB7CF8 for ; Fri, 22 Jan 2010 08:28:55 +1100 (EST) Received: from localhost ([127.0.0.1]:47259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NY4T1-0001CY-Hm for incoming@patchwork.ozlabs.org; Thu, 21 Jan 2010 16:21:27 -0500 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 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0LLABL6017505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Jan 2010 16:10:11 -0500 Received: from localhost (vpn-9-176.rdu.redhat.com [10.11.9.176]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0LLA9AK000551; Thu, 21 Jan 2010 16:10:10 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org, armbru@redhat.com, aliguori@us.ibm.com, avi@redhat.com 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH 05/11] QMP: advertise asynchronous messages X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);