From ca9567e23454ca94e3911710da4e953ad049b40f Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Thu, 4 Feb 2010 18:10:04 -0200 Subject: QMP: Add QEMU's version to the greeting message With capability negotiation support clients will only have a chance to check QEMU's version (ie. issue 'query-version') after the negotiation procedure is done. It might be useful to clients to check QEMU's version before negotiating features, though. To allow that, this commit adds the QEMU's version object to the greeting message. Not really sure this is needed, but doesn't hurt anyway. Signed-off-by: Luiz Capitulino Signed-off-by: Anthony Liguori --- monitor.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'monitor.c') diff --git a/monitor.c b/monitor.c index 19876adbc2..02829a4398 100644 --- a/monitor.c +++ b/monitor.c @@ -4368,6 +4368,14 @@ void monitor_resume(Monitor *mon) readline_show_prompt(mon->rs); } +static QObject *get_qmp_greeting(void) +{ + QObject *ver; + + do_info_version(NULL, &ver); + return qobject_from_jsonf("{'QMP':{'version': %p,'capabilities': []}}",ver); +} + /** * monitor_control_event(): Print QMP gretting */ @@ -4379,7 +4387,7 @@ 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 = get_qmp_greeting(); assert(data != NULL); monitor_json_emitter(mon, data); -- cgit v1.2.3