QMP: Output support
commit25b422eb4051b9b7473feea1ae848f1e3b4f799f
authorLuiz Capitulino <lcapitulino@redhat.com>
Fri, 27 Nov 2009 00:58:59 +0000 (26 22:58 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 3 Dec 2009 15:41:23 +0000 (3 09:41 -0600)
tree10e47c3466337291d39521b4996586ad12563fdb
parent9b57c02e3e14163b576ada77ddd1d7b346a6e421
QMP: Output support

In the new Monitor output is always performed by only two
functions: do_info() and monitor_call_handler().

To support QMP output, we modify those functions to check if we
are in control mode. If so, we call monitor_protocol_emitter()
to emit QMP output, otherwise we do regular output.

QMP has two types of responses to issued commands: success and
error. The outputed data is always a JSON object.

Success responses have the following format:

{ "return": json-value, "id": json-value }

Error responses have the following format:

{ "error": { "class": json-string,
             "desc": json-string,
             "data": json-value } "id": json-value }

Please, note that the "id" key is part of the input code, and
thus is not added in this commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor.c