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>
1 file changed
tree: 10e47c3466337291d39521b4996586ad12563fdb
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. fpu/
  7. gdb-xml/
  8. hw/
  9. linux-user/
  10. net/
  11. pc-bios/
  12. roms/
  13. slirp/
  14. target-alpha/
  15. target-arm/
  16. target-cris/
  17. target-i386/
  18. target-m68k/
  19. target-microblaze/
  20. target-mips/
  21. target-ppc/
  22. target-sh4/
  23. target-sparc/
  24. tcg/
  25. tests/
  26. .gitignore
  27. .gitmodules
  28. a.out.h
  29. acl.c
  30. acl.h
  31. aes.c
  32. aes.h
  33. aio.c
  34. alpha-dis.c
  35. alpha.ld
  36. arm-dis.c
  37. arm-semi.c
  38. arm.ld
  39. async.c
  40. balloon.h
  41. block-migration.c
  42. block-migration.h
  43. block.c
  44. block.h
  45. block_int.h
  46. bswap.h
  47. bt-host.c
  48. bt-host.h
  49. bt-vhci.c
  50. buffered_file.c
  51. buffered_file.h
  52. cache-utils.c
  53. cache-utils.h
  54. Changelog
  55. check-qdict.c
  56. check-qfloat.c
  57. check-qint.c
  58. check-qjson.c
  59. check-qlist.c
  60. check-qstring.c
  61. cmd.c
  62. cmd.h
  63. cocoa.m
  64. CODING_STYLE
  65. config.h
  66. configure
  67. console.c
  68. console.h
  69. COPYING
  70. COPYING.LIB
  71. cpu-all.h
  72. cpu-common.h
  73. cpu-defs.h
  74. cpu-exec.c
  75. create_config
  76. cris-dis.c
  77. curses.c
  78. curses_keys.h
  79. cutils.c
  80. d3des.c
  81. d3des.h
  82. def-helper.h
  83. device_tree.c
  84. device_tree.h
  85. dis-asm.h
  86. disas.c
  87. disas.h
  88. dma-helpers.c
  89. dma.h
  90. dyngen-exec.h
  91. elf.h
  92. envlist.c
  93. envlist.h
  94. exec-all.h
  95. exec.c
  96. feature_to_c.sh
  97. gdbstub.c
  98. gdbstub.h
  99. gen-icount.h
  100. host-utils.c
  101. host-utils.h
  102. hostregs_helper.h
  103. hpet.h
  104. hppa-dis.c
  105. hppa.ld
  106. hxtool
  107. i386-dis.c
  108. i386.ld
  109. ia64.ld
  110. ioport-user.c
  111. ioport.c
  112. ioport.h
  113. json-lexer.c
  114. json-lexer.h
  115. json-parser.c
  116. json-parser.h
  117. json-streamer.c
  118. json-streamer.h
  119. keymaps.c
  120. keymaps.h
  121. kvm-all.c
  122. kvm.h
  123. libfdt_env.h
  124. LICENSE
  125. linux-aio.c
  126. m68k-dis.c
  127. m68k-semi.c
  128. m68k.ld
  129. MAINTAINERS
  130. Makefile
  131. Makefile.hw
  132. Makefile.target
  133. Makefile.user
  134. microblaze-dis.c
  135. migration-exec.c
  136. migration-fd.c
  137. migration-tcp.c
  138. migration-unix.c
  139. migration.c
  140. migration.h
  141. mips-dis.c
  142. mips.ld
  143. module.c
  144. module.h
  145. monitor.c
  146. monitor.h
  147. nbd.c
  148. nbd.h
  149. net-checksum.c
  150. net.c
  151. net.h
  152. osdep.c
  153. osdep.h
  154. path.c
  155. pci-ids.txt
  156. posix-aio-compat.c
  157. ppc-dis.c
  158. ppc.ld
  159. ppc64.ld
  160. qbool.c
  161. qbool.h
  162. qdict-test-data.txt
  163. qdict.c
  164. qdict.h
  165. qemu-aio.h
  166. qemu-binfmt-conf.sh
  167. qemu-char.c
  168. qemu-char.h
  169. qemu-common.h
  170. qemu-config.c
  171. qemu-config.h
  172. qemu-doc.texi
  173. qemu-img-cmds.hx
  174. qemu-img.c
  175. qemu-img.texi
  176. qemu-io.c
  177. qemu-lock.h
  178. qemu-log.h
  179. qemu-malloc.c
  180. qemu-monitor.hx
  181. qemu-nbd.c
  182. qemu-nbd.texi
  183. qemu-option.c
  184. qemu-option.h
  185. qemu-options.hx
  186. qemu-queue.h
  187. qemu-sockets.c
  188. qemu-tech.texi
  189. qemu-thread.c
  190. qemu-thread.h
  191. qemu-timer.h
  192. qemu-tool.c
  193. qemu.sasl
  194. qemu_socket.h
  195. qerror.c
  196. qerror.h
  197. qfloat.c
  198. qfloat.h
  199. qint.c
  200. qint.h
  201. qjson.c
  202. qjson.h
  203. qlist.c
  204. qlist.h
  205. qobject.h
  206. qstring.c
  207. qstring.h
  208. readline.c
  209. readline.h
  210. README
  211. rules.mak
  212. s390-dis.c
  213. s390.ld
  214. savevm.c
  215. sdl.c
  216. sdl_keysym.h
  217. sdl_zoom.c
  218. sdl_zoom.h
  219. sdl_zoom_template.h
  220. sh4-dis.c
  221. softmmu-semi.h
  222. softmmu_defs.h
  223. softmmu_exec.h
  224. softmmu_header.h
  225. softmmu_template.h
  226. sparc-dis.c
  227. sparc.ld
  228. sparc64.ld
  229. sysemu.h
  230. targphys.h
  231. tcg-runtime.c
  232. texi2pod.pl
  233. thunk.c
  234. thunk.h
  235. TODO
  236. translate-all.c
  237. uboot_image.h
  238. usb-bsd.c
  239. usb-linux.c
  240. usb-stub.c
  241. VERSION
  242. vgafont.h
  243. vl.c
  244. vnc-auth-sasl.c
  245. vnc-auth-sasl.h
  246. vnc-auth-vencrypt.c
  247. vnc-auth-vencrypt.h
  248. vnc-tls.c
  249. vnc-tls.h
  250. vnc.c
  251. vnc.h
  252. vnc_keysym.h
  253. vnchextile.h
  254. x86_64.ld
  255. x_keymap.c
  256. x_keymap.h