docs/devel/testing.rst: add missing newlines after code block
[qemu/ar7.git] / qapi / char.json
blobb7b2a05766fe4c0056e9eca678ab83789be86319
1 # -*- Mode: Python -*-
4 ##
5 # = Character devices
6 ##
8 { 'include': 'sockets.json' }
11 # @ChardevInfo:
13 # Information about a character device.
15 # @label: the label of the character device
17 # @filename: the filename of the character device
19 # @frontend-open: shows whether the frontend device attached to this backend
20 #                 (eg. with the chardev=... option) is in open or closed state
21 #                 (since 2.1)
23 # Notes: @filename is encoded using the QEMU command line character device
24 #        encoding.  See the QEMU man page for details.
26 # Since: 0.14.0
28 { 'struct': 'ChardevInfo', 'data': {'label': 'str',
29                                   'filename': 'str',
30                                   'frontend-open': 'bool'} }
33 # @query-chardev:
35 # Returns information about current character devices.
37 # Returns: a list of @ChardevInfo
39 # Since: 0.14.0
41 # Example:
43 # -> { "execute": "query-chardev" }
44 # <- {
45 #       "return": [
46 #          {
47 #             "label": "charchannel0",
48 #             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
49 #             "frontend-open": false
50 #          },
51 #          {
52 #             "label": "charmonitor",
53 #             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
54 #             "frontend-open": true
55 #          },
56 #          {
57 #             "label": "charserial0",
58 #             "filename": "pty:/dev/pts/2",
59 #             "frontend-open": true
60 #          }
61 #       ]
62 #    }
65 { 'command': 'query-chardev', 'returns': ['ChardevInfo'],
66   'allow-preconfig': true }
69 # @ChardevBackendInfo:
71 # Information about a character device backend
73 # @name: The backend name
75 # Since: 2.0
77 { 'struct': 'ChardevBackendInfo', 'data': {'name': 'str'} }
80 # @query-chardev-backends:
82 # Returns information about character device backends.
84 # Returns: a list of @ChardevBackendInfo
86 # Since: 2.0
88 # Example:
90 # -> { "execute": "query-chardev-backends" }
91 # <- {
92 #       "return":[
93 #          {
94 #             "name":"udp"
95 #          },
96 #          {
97 #             "name":"tcp"
98 #          },
99 #          {
100 #             "name":"unix"
101 #          },
102 #          {
103 #             "name":"spiceport"
104 #          }
105 #       ]
106 #    }
109 { 'command': 'query-chardev-backends', 'returns': ['ChardevBackendInfo'] }
112 # @DataFormat:
114 # An enumeration of data format.
116 # @utf8: Data is a UTF-8 string (RFC 3629)
118 # @base64: Data is Base64 encoded binary (RFC 3548)
120 # Since: 1.4
122 { 'enum': 'DataFormat',
123   'data': [ 'utf8', 'base64' ] }
126 # @ringbuf-write:
128 # Write to a ring buffer character device.
130 # @device: the ring buffer character device name
132 # @data: data to write
134 # @format: data encoding (default 'utf8').
135 #          - base64: data must be base64 encoded text.  Its binary
136 #            decoding gets written.
137 #          - utf8: data's UTF-8 encoding is written
138 #          - data itself is always Unicode regardless of format, like
139 #            any other string.
141 # Returns: Nothing on success
143 # Since: 1.4
145 # Example:
147 # -> { "execute": "ringbuf-write",
148 #      "arguments": { "device": "foo",
149 #                     "data": "abcdefgh",
150 #                     "format": "utf8" } }
151 # <- { "return": {} }
154 { 'command': 'ringbuf-write',
155   'data': {'device': 'str', 'data': 'str',
156            '*format': 'DataFormat'} }
159 # @ringbuf-read:
161 # Read from a ring buffer character device.
163 # @device: the ring buffer character device name
165 # @size: how many bytes to read at most
167 # @format: data encoding (default 'utf8').
168 #          - base64: the data read is returned in base64 encoding.
169 #          - utf8: the data read is interpreted as UTF-8.
170 #            Bug: can screw up when the buffer contains invalid UTF-8
171 #            sequences, NUL characters, after the ring buffer lost
172 #            data, and when reading stops because the size limit is
173 #            reached.
174 #          - The return value is always Unicode regardless of format,
175 #            like any other string.
177 # Returns: data read from the device
179 # Since: 1.4
181 # Example:
183 # -> { "execute": "ringbuf-read",
184 #      "arguments": { "device": "foo",
185 #                     "size": 1000,
186 #                     "format": "utf8" } }
187 # <- { "return": "abcdefgh" }
190 { 'command': 'ringbuf-read',
191   'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
192   'returns': 'str' }
195 # @ChardevCommon:
197 # Configuration shared across all chardev backends
199 # @logfile: The name of a logfile to save output
200 # @logappend: true to append instead of truncate
201 #             (default to false to truncate)
203 # Since: 2.6
205 { 'struct': 'ChardevCommon', 'data': { '*logfile': 'str',
206                                        '*logappend': 'bool' } }
209 # @ChardevFile:
211 # Configuration info for file chardevs.
213 # @in:  The name of the input file
214 # @out: The name of the output file
215 # @append: Open the file in append mode (default false to
216 #          truncate) (Since 2.6)
218 # Since: 1.4
220 { 'struct': 'ChardevFile', 'data': { '*in' : 'str',
221                                    'out' : 'str',
222                                    '*append': 'bool' },
223   'base': 'ChardevCommon' }
226 # @ChardevHostdev:
228 # Configuration info for device and pipe chardevs.
230 # @device: The name of the special file for the device,
231 #          i.e. /dev/ttyS0 on Unix or COM1: on Windows
233 # Since: 1.4
235 { 'struct': 'ChardevHostdev', 'data': { 'device' : 'str' },
236   'base': 'ChardevCommon' }
239 # @ChardevSocket:
241 # Configuration info for (stream) socket chardevs.
243 # @addr: socket address to listen on (server=true)
244 #        or connect to (server=false)
245 # @tls-creds: the ID of the TLS credentials object (since 2.6)
246 # @server: create server socket (default: true)
247 # @wait: wait for incoming connection on server
248 #        sockets (default: false).
249 # @nodelay: set TCP_NODELAY socket option (default: false)
250 # @telnet: enable telnet protocol on server
251 #          sockets (default: false)
252 # @tn3270: enable tn3270 protocol on server
253 #          sockets (default: false) (Since: 2.10)
254 # @reconnect: For a client socket, if a socket is disconnected,
255 #          then attempt a reconnect after the given number of seconds.
256 #          Setting this to zero disables this function. (default: 0)
257 #          (Since: 2.2)
259 # Since: 1.4
261 { 'struct': 'ChardevSocket', 'data': { 'addr'       : 'SocketAddressLegacy',
262                                      '*tls-creds'  : 'str',
263                                      '*server'    : 'bool',
264                                      '*wait'      : 'bool',
265                                      '*nodelay'   : 'bool',
266                                      '*telnet'    : 'bool',
267                                      '*tn3270'    : 'bool',
268                                      '*reconnect' : 'int' },
269   'base': 'ChardevCommon' }
272 # @ChardevUdp:
274 # Configuration info for datagram socket chardevs.
276 # @remote: remote address
277 # @local: local address
279 # Since: 1.5
281 { 'struct': 'ChardevUdp', 'data': { 'remote' : 'SocketAddressLegacy',
282                                   '*local' : 'SocketAddressLegacy' },
283   'base': 'ChardevCommon' }
286 # @ChardevMux:
288 # Configuration info for mux chardevs.
290 # @chardev: name of the base chardev.
292 # Since: 1.5
294 { 'struct': 'ChardevMux', 'data': { 'chardev' : 'str' },
295   'base': 'ChardevCommon' }
298 # @ChardevStdio:
300 # Configuration info for stdio chardevs.
302 # @signal: Allow signals (such as SIGINT triggered by ^C)
303 #          be delivered to qemu.  Default: true in -nographic mode,
304 #          false otherwise.
306 # Since: 1.5
308 { 'struct': 'ChardevStdio', 'data': { '*signal' : 'bool' },
309   'base': 'ChardevCommon' }
313 # @ChardevSpiceChannel:
315 # Configuration info for spice vm channel chardevs.
317 # @type: kind of channel (for example vdagent).
319 # Since: 1.5
321 { 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },
322   'base': 'ChardevCommon' }
323 # TODO: 'if': 'defined(CONFIG_SPICE)'
326 # @ChardevSpicePort:
328 # Configuration info for spice port chardevs.
330 # @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
332 # Since: 1.5
334 { 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },
335   'base': 'ChardevCommon' }
336 # TODO: 'if': 'defined(CONFIG_SPICE)'
339 # @ChardevVC:
341 # Configuration info for virtual console chardevs.
343 # @width:  console width,  in pixels
344 # @height: console height, in pixels
345 # @cols:   console width,  in chars
346 # @rows:   console height, in chars
348 # Since: 1.5
350 { 'struct': 'ChardevVC', 'data': { '*width'  : 'int',
351                                  '*height' : 'int',
352                                  '*cols'   : 'int',
353                                  '*rows'   : 'int' },
354   'base': 'ChardevCommon' }
357 # @ChardevRingbuf:
359 # Configuration info for ring buffer chardevs.
361 # @size: ring buffer size, must be power of two, default is 65536
363 # Since: 1.5
365 { 'struct': 'ChardevRingbuf', 'data': { '*size'  : 'int' },
366   'base': 'ChardevCommon' }
369 # @ChardevBackend:
371 # Configuration info for the new chardev backend.
373 # Since: 1.4 (testdev since 2.2, wctablet since 2.9)
375 { 'union': 'ChardevBackend', 'data': { 'file'   : 'ChardevFile',
376                                        'serial' : 'ChardevHostdev',
377                                        'parallel': 'ChardevHostdev',
378                                        'pipe'   : 'ChardevHostdev',
379                                        'socket' : 'ChardevSocket',
380                                        'udp'    : 'ChardevUdp',
381                                        'pty'    : 'ChardevCommon',
382                                        'null'   : 'ChardevCommon',
383                                        'mux'    : 'ChardevMux',
384                                        'msmouse': 'ChardevCommon',
385                                        'wctablet' : 'ChardevCommon',
386                                        'braille': 'ChardevCommon',
387                                        'testdev': 'ChardevCommon',
388                                        'stdio'  : 'ChardevStdio',
389                                        'console': 'ChardevCommon',
390                                        'spicevmc': 'ChardevSpiceChannel',
391 # TODO: { 'type': 'ChardevSpiceChannel', 'if': 'defined(CONFIG_SPICE)' },
392                                        'spiceport': 'ChardevSpicePort',
393 # TODO: { 'type': 'ChardevSpicePort', 'if': 'defined(CONFIG_SPICE)' },
394                                        'vc'     : 'ChardevVC',
395                                        'ringbuf': 'ChardevRingbuf',
396                                        # next one is just for compatibility
397                                        'memory' : 'ChardevRingbuf' } }
400 # @ChardevReturn:
402 # Return info about the chardev backend just created.
404 # @pty: name of the slave pseudoterminal device, present if
405 #       and only if a chardev of type 'pty' was created
407 # Since: 1.4
409 { 'struct' : 'ChardevReturn', 'data': { '*pty' : 'str' } }
412 # @chardev-add:
414 # Add a character device backend
416 # @id: the chardev's ID, must be unique
417 # @backend: backend type and parameters
419 # Returns: ChardevReturn.
421 # Since: 1.4
423 # Example:
425 # -> { "execute" : "chardev-add",
426 #      "arguments" : { "id" : "foo",
427 #                      "backend" : { "type" : "null", "data" : {} } } }
428 # <- { "return": {} }
430 # -> { "execute" : "chardev-add",
431 #      "arguments" : { "id" : "bar",
432 #                      "backend" : { "type" : "file",
433 #                                    "data" : { "out" : "/tmp/bar.log" } } } }
434 # <- { "return": {} }
436 # -> { "execute" : "chardev-add",
437 #      "arguments" : { "id" : "baz",
438 #                      "backend" : { "type" : "pty", "data" : {} } } }
439 # <- { "return": { "pty" : "/dev/pty/42" } }
442 { 'command': 'chardev-add', 'data': {'id'      : 'str',
443                                      'backend' : 'ChardevBackend' },
444   'returns': 'ChardevReturn' }
447 # @chardev-change:
449 # Change a character device backend
451 # @id: the chardev's ID, must exist
452 # @backend: new backend type and parameters
454 # Returns: ChardevReturn.
456 # Since: 2.10
458 # Example:
460 # -> { "execute" : "chardev-change",
461 #      "arguments" : { "id" : "baz",
462 #                      "backend" : { "type" : "pty", "data" : {} } } }
463 # <- { "return": { "pty" : "/dev/pty/42" } }
465 # -> {"execute" : "chardev-change",
466 #     "arguments" : {
467 #         "id" : "charchannel2",
468 #         "backend" : {
469 #             "type" : "socket",
470 #             "data" : {
471 #                 "addr" : {
472 #                     "type" : "unix" ,
473 #                     "data" : {
474 #                         "path" : "/tmp/charchannel2.socket"
475 #                     }
476 #                  },
477 #                  "server" : true,
478 #                  "wait" : false }}}}
479 # <- {"return": {}}
482 { 'command': 'chardev-change', 'data': {'id'      : 'str',
483                                         'backend' : 'ChardevBackend' },
484   'returns': 'ChardevReturn' }
487 # @chardev-remove:
489 # Remove a character device backend
491 # @id: the chardev's ID, must exist and not be in use
493 # Returns: Nothing on success
495 # Since: 1.4
497 # Example:
499 # -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
500 # <- { "return": {} }
503 { 'command': 'chardev-remove', 'data': {'id': 'str'} }
506 # @chardev-send-break:
508 # Send a break to a character device
510 # @id: the chardev's ID, must exist
512 # Returns: Nothing on success
514 # Since: 2.10
516 # Example:
518 # -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
519 # <- { "return": {} }
522 { 'command': 'chardev-send-break', 'data': {'id': 'str'} }
525 # @VSERPORT_CHANGE:
527 # Emitted when the guest opens or closes a virtio-serial port.
529 # @id: device identifier of the virtio-serial port
531 # @open: true if the guest has opened the virtio-serial port
533 # Since: 2.1
535 # Example:
537 # <- { "event": "VSERPORT_CHANGE",
538 #      "data": { "id": "channel0", "open": true },
539 #      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
542 { 'event': 'VSERPORT_CHANGE',
543   'data': { 'id': 'str', 'open': 'bool' } }