qapi: Require descriptions and tagged sections to be indented
[qemu/kevin.git] / qapi / char.json
blob4873bc635a33117332a30937e2862fc53744cb2e
1 # -*- Mode: Python -*-
2 # vim: filetype=python
5 ##
6 # = Character devices
7 ##
9 { 'include': 'sockets.json' }
12 # @ChardevInfo:
14 # Information about a character device.
16 # @label: the label of the character device
18 # @filename: the filename of the character device
20 # @frontend-open: shows whether the frontend device attached to this
21 #     backend (e.g. with the chardev=... option) is in open or closed
22 #     state (since 2.1)
24 # Notes: @filename is encoded using the QEMU command line character
25 #     device encoding.  See the QEMU man page for details.
27 # Since: 0.14
29 { 'struct': 'ChardevInfo',
30   'data': { 'label': 'str',
31             'filename': 'str',
32             'frontend-open': 'bool' } }
35 # @query-chardev:
37 # Returns information about current character devices.
39 # Returns: a list of @ChardevInfo
41 # Since: 0.14
43 # Example:
45 #     -> { "execute": "query-chardev" }
46 #     <- {
47 #           "return": [
48 #              {
49 #                 "label": "charchannel0",
50 #                 "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server=on",
51 #                 "frontend-open": false
52 #              },
53 #              {
54 #                 "label": "charmonitor",
55 #                 "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server=on",
56 #                 "frontend-open": true
57 #              },
58 #              {
59 #                 "label": "charserial0",
60 #                 "filename": "pty:/dev/pts/2",
61 #                 "frontend-open": true
62 #              }
63 #           ]
64 #        }
66 { 'command': 'query-chardev', 'returns': ['ChardevInfo'],
67   'allow-preconfig': true }
70 # @ChardevBackendInfo:
72 # Information about a character device backend
74 # @name: The backend name
76 # Since: 2.0
78 { 'struct': 'ChardevBackendInfo', 'data': {'name': 'str'} }
81 # @query-chardev-backends:
83 # Returns information about character device backends.
85 # Returns: a list of @ChardevBackendInfo
87 # Since: 2.0
89 # Example:
91 #     -> { "execute": "query-chardev-backends" }
92 #     <- {
93 #           "return":[
94 #              {
95 #                 "name":"udp"
96 #              },
97 #              {
98 #                 "name":"tcp"
99 #              },
100 #              {
101 #                 "name":"unix"
102 #              },
103 #              {
104 #                 "name":"spiceport"
105 #              }
106 #           ]
107 #        }
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').
136 #     - base64: data must be base64 encoded text.  Its binary decoding
137 #       gets written.
138 #     - utf8: data's UTF-8 encoding is written
139 #     - data itself is always Unicode regardless of format, like any
140 #       other string.
142 # Returns: Nothing on success
144 # Since: 1.4
146 # Example:
148 #     -> { "execute": "ringbuf-write",
149 #          "arguments": { "device": "foo",
150 #                         "data": "abcdefgh",
151 #                         "format": "utf8" } }
152 #     <- { "return": {} }
154 { 'command': 'ringbuf-write',
155   'data': { 'device': 'str',
156             'data': 'str',
157            '*format': 'DataFormat'} }
160 # @ringbuf-read:
162 # Read from a ring buffer character device.
164 # @device: the ring buffer character device name
166 # @size: how many bytes to read at most
168 # @format: data encoding (default 'utf8').
170 #     - base64: the data read is returned in base64 encoding.
171 #     - utf8: the data read is interpreted as UTF-8.
172 #       Bug: can screw up when the buffer contains invalid UTF-8
173 #       sequences, NUL characters, after the ring buffer lost data,
174 #       and when reading stops because the size limit is reached.
175 #     - The return value is always Unicode regardless of format, like
176 #       any other string.
178 # Returns: data read from the device
180 # Since: 1.4
182 # Example:
184 #     -> { "execute": "ringbuf-read",
185 #          "arguments": { "device": "foo",
186 #                         "size": 1000,
187 #                         "format": "utf8" } }
188 #     <- { "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
201 # @logappend: true to append instead of truncate (default to false to
202 #     truncate)
204 # Since: 2.6
206 { 'struct': 'ChardevCommon',
207   'data': { '*logfile': 'str',
208             '*logappend': 'bool' } }
211 # @ChardevFile:
213 # Configuration info for file chardevs.
215 # @in: The name of the input file
217 # @out: The name of the output file
219 # @append: Open the file in append mode (default false to truncate)
220 #     (Since 2.6)
222 # Since: 1.4
224 { 'struct': 'ChardevFile',
225   'data': { '*in': 'str',
226             'out': 'str',
227             '*append': 'bool' },
228   'base': 'ChardevCommon' }
231 # @ChardevHostdev:
233 # Configuration info for device and pipe chardevs.
235 # @device: The name of the special file for the device, i.e.
236 #     /dev/ttyS0 on Unix or COM1: on Windows
238 # Since: 1.4
240 { 'struct': 'ChardevHostdev',
241   'data': { 'device': 'str' },
242   'base': 'ChardevCommon' }
245 # @ChardevSocket:
247 # Configuration info for (stream) socket chardevs.
249 # @addr: socket address to listen on (server=true) or connect to
250 #     (server=false)
252 # @tls-creds: the ID of the TLS credentials object (since 2.6)
254 # @tls-authz: the ID of the QAuthZ authorization object against which
255 #     the client's x509 distinguished name will be validated.  This
256 #     object is only resolved at time of use, so can be deleted and
257 #     recreated on the fly while the chardev server is active.  If
258 #     missing, it will default to denying access (since 4.0)
260 # @server: create server socket (default: true)
262 # @wait: wait for incoming connection on server sockets (default:
263 #     false). Silently ignored with server: false.  This use is
264 #     deprecated.
266 # @nodelay: set TCP_NODELAY socket option (default: false)
268 # @telnet: enable telnet protocol on server sockets (default: false)
270 # @tn3270: enable tn3270 protocol on server sockets (default: false)
271 #     (Since: 2.10)
273 # @websocket: enable websocket protocol on server sockets
274 #     (default: false) (Since: 3.1)
276 # @reconnect: For a client socket, if a socket is disconnected, then
277 #     attempt a reconnect after the given number of seconds.  Setting
278 #     this to zero disables this function.  (default: 0) (Since: 2.2)
280 # Since: 1.4
282 { 'struct': 'ChardevSocket',
283   'data': { 'addr': 'SocketAddressLegacy',
284             '*tls-creds': 'str',
285             '*tls-authz'  : 'str',
286             '*server': 'bool',
287             '*wait': 'bool',
288             '*nodelay': 'bool',
289             '*telnet': 'bool',
290             '*tn3270': 'bool',
291             '*websocket': 'bool',
292             '*reconnect': 'int' },
293   'base': 'ChardevCommon' }
296 # @ChardevUdp:
298 # Configuration info for datagram socket chardevs.
300 # @remote: remote address
302 # @local: local address
304 # Since: 1.5
306 { 'struct': 'ChardevUdp',
307   'data': { 'remote': 'SocketAddressLegacy',
308             '*local': 'SocketAddressLegacy' },
309   'base': 'ChardevCommon' }
312 # @ChardevMux:
314 # Configuration info for mux chardevs.
316 # @chardev: name of the base chardev.
318 # Since: 1.5
320 { 'struct': 'ChardevMux',
321   'data': { 'chardev': 'str' },
322   'base': 'ChardevCommon' }
325 # @ChardevStdio:
327 # Configuration info for stdio chardevs.
329 # @signal: Allow signals (such as SIGINT triggered by ^C) be delivered
330 #     to qemu.  Default: true.
332 # Since: 1.5
334 { 'struct': 'ChardevStdio',
335   'data': { '*signal': 'bool' },
336   'base': 'ChardevCommon' }
339 # @ChardevSpiceChannel:
341 # Configuration info for spice vm channel chardevs.
343 # @type: kind of channel (for example vdagent).
345 # Since: 1.5
347 { 'struct': 'ChardevSpiceChannel',
348   'data': { 'type': 'str' },
349   'base': 'ChardevCommon',
350   'if': 'CONFIG_SPICE' }
353 # @ChardevSpicePort:
355 # Configuration info for spice port chardevs.
357 # @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
359 # Since: 1.5
361 { 'struct': 'ChardevSpicePort',
362   'data': { 'fqdn': 'str' },
363   'base': 'ChardevCommon',
364   'if': 'CONFIG_SPICE' }
367 # @ChardevDBus:
369 # Configuration info for DBus chardevs.
371 # @name: name of the channel (following docs/spice-port-fqdn.txt)
373 # Since: 7.0
375 { 'struct': 'ChardevDBus',
376   'data': { 'name': 'str' },
377   'base': 'ChardevCommon',
378   'if': 'CONFIG_DBUS_DISPLAY' }
381 # @ChardevVC:
383 # Configuration info for virtual console chardevs.
385 # @width: console width, in pixels
387 # @height: console height, in pixels
389 # @cols: console width, in chars
391 # @rows: console height, in chars
393 # Note: the options are only effective when the VNC or SDL graphical
394 #     display backend is active.  They are ignored with the GTK,
395 #     Spice, VNC and D-Bus display backends.
397 # Since: 1.5
399 { 'struct': 'ChardevVC',
400   'data': { '*width': 'int',
401             '*height': 'int',
402             '*cols': 'int',
403             '*rows': 'int' },
404   'base': 'ChardevCommon' }
407 # @ChardevRingbuf:
409 # Configuration info for ring buffer chardevs.
411 # @size: ring buffer size, must be power of two, default is 65536
413 # Since: 1.5
415 { 'struct': 'ChardevRingbuf',
416   'data': { '*size': 'int' },
417   'base': 'ChardevCommon' }
420 # @ChardevQemuVDAgent:
422 # Configuration info for qemu vdagent implementation.
424 # @mouse: enable/disable mouse, default is enabled.
426 # @clipboard: enable/disable clipboard, default is disabled.
428 # Since: 6.1
430 { 'struct': 'ChardevQemuVDAgent',
431   'data': { '*mouse': 'bool',
432             '*clipboard': 'bool' },
433   'base': 'ChardevCommon',
434   'if': 'CONFIG_SPICE_PROTOCOL' }
437 # @ChardevBackendKind:
439 # @pipe: Since 1.5
441 # @udp: Since 1.5
443 # @mux: Since 1.5
445 # @msmouse: Since 1.5
447 # @wctablet: Since 2.9
449 # @braille: Since 1.5
451 # @testdev: Since 2.2
453 # @stdio: Since 1.5
455 # @console: Since 1.5
457 # @spicevmc: Since 1.5
459 # @spiceport: Since 1.5
461 # @qemu-vdagent: Since 6.1
463 # @dbus: Since 7.0
465 # @vc: v1.5
467 # @ringbuf: Since 1.6
469 # @memory: Since 1.5
471 # Features:
473 # @deprecated: Member @memory is deprecated.  Use @ringbuf instead.
475 # Since: 1.4
477 { 'enum': 'ChardevBackendKind',
478   'data': [ 'file',
479             { 'name': 'serial', 'if': 'HAVE_CHARDEV_SERIAL' },
480             { 'name': 'parallel', 'if': 'HAVE_CHARDEV_PARALLEL' },
481             'pipe',
482             'socket',
483             'udp',
484             'pty',
485             'null',
486             'mux',
487             'msmouse',
488             'wctablet',
489             { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
490             'testdev',
491             'stdio',
492             { 'name': 'console', 'if': 'CONFIG_WIN32' },
493             { 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
494             { 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
495             { 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
496             { 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
497             'vc',
498             'ringbuf',
499             { 'name': 'memory', 'features': [ 'deprecated' ] } ] }
502 # @ChardevFileWrapper:
504 # @data: Configuration info for file chardevs
506 # Since: 1.4
508 { 'struct': 'ChardevFileWrapper',
509   'data': { 'data': 'ChardevFile' } }
512 # @ChardevHostdevWrapper:
514 # @data: Configuration info for device and pipe chardevs
516 # Since: 1.4
518 { 'struct': 'ChardevHostdevWrapper',
519   'data': { 'data': 'ChardevHostdev' } }
522 # @ChardevSocketWrapper:
524 # @data: Configuration info for (stream) socket chardevs
526 # Since: 1.4
528 { 'struct': 'ChardevSocketWrapper',
529   'data': { 'data': 'ChardevSocket' } }
532 # @ChardevUdpWrapper:
534 # @data: Configuration info for datagram socket chardevs
536 # Since: 1.5
538 { 'struct': 'ChardevUdpWrapper',
539   'data': { 'data': 'ChardevUdp' } }
542 # @ChardevCommonWrapper:
544 # @data: Configuration shared across all chardev backends
546 # Since: 2.6
548 { 'struct': 'ChardevCommonWrapper',
549   'data': { 'data': 'ChardevCommon' } }
552 # @ChardevMuxWrapper:
554 # @data: Configuration info for mux chardevs
556 # Since: 1.5
558 { 'struct': 'ChardevMuxWrapper',
559   'data': { 'data': 'ChardevMux' } }
562 # @ChardevStdioWrapper:
564 # @data: Configuration info for stdio chardevs
566 # Since: 1.5
568 { 'struct': 'ChardevStdioWrapper',
569   'data': { 'data': 'ChardevStdio' } }
572 # @ChardevSpiceChannelWrapper:
574 # @data: Configuration info for spice vm channel chardevs
576 # Since: 1.5
578 { 'struct': 'ChardevSpiceChannelWrapper',
579   'data': { 'data': 'ChardevSpiceChannel' },
580   'if': 'CONFIG_SPICE' }
583 # @ChardevSpicePortWrapper:
585 # @data: Configuration info for spice port chardevs
587 # Since: 1.5
589 { 'struct': 'ChardevSpicePortWrapper',
590   'data': { 'data': 'ChardevSpicePort' },
591   'if': 'CONFIG_SPICE' }
594 # @ChardevQemuVDAgentWrapper:
596 # @data: Configuration info for qemu vdagent implementation
598 # Since: 6.1
600 { 'struct': 'ChardevQemuVDAgentWrapper',
601   'data': { 'data': 'ChardevQemuVDAgent' },
602   'if': 'CONFIG_SPICE_PROTOCOL' }
605 # @ChardevDBusWrapper:
607 # @data: Configuration info for DBus chardevs
609 # Since: 7.0
611 { 'struct': 'ChardevDBusWrapper',
612   'data': { 'data': 'ChardevDBus' },
613   'if': 'CONFIG_DBUS_DISPLAY' }
616 # @ChardevVCWrapper:
618 # @data: Configuration info for virtual console chardevs
620 # Since: 1.5
622 { 'struct': 'ChardevVCWrapper',
623   'data': { 'data': 'ChardevVC' } }
626 # @ChardevRingbufWrapper:
628 # @data: Configuration info for ring buffer chardevs
630 # Since: 1.5
632 { 'struct': 'ChardevRingbufWrapper',
633   'data': { 'data': 'ChardevRingbuf' } }
636 # @ChardevBackend:
638 # Configuration info for the new chardev backend.
640 # @type: backend type
642 # Since: 1.4
644 { 'union': 'ChardevBackend',
645   'base': { 'type': 'ChardevBackendKind' },
646   'discriminator': 'type',
647   'data': { 'file': 'ChardevFileWrapper',
648             'serial': { 'type': 'ChardevHostdevWrapper',
649                         'if': 'HAVE_CHARDEV_SERIAL' },
650             'parallel': { 'type': 'ChardevHostdevWrapper',
651                           'if': 'HAVE_CHARDEV_PARALLEL' },
652             'pipe': 'ChardevHostdevWrapper',
653             'socket': 'ChardevSocketWrapper',
654             'udp': 'ChardevUdpWrapper',
655             'pty': 'ChardevCommonWrapper',
656             'null': 'ChardevCommonWrapper',
657             'mux': 'ChardevMuxWrapper',
658             'msmouse': 'ChardevCommonWrapper',
659             'wctablet': 'ChardevCommonWrapper',
660             'braille': { 'type': 'ChardevCommonWrapper',
661                          'if': 'CONFIG_BRLAPI' },
662             'testdev': 'ChardevCommonWrapper',
663             'stdio': 'ChardevStdioWrapper',
664             'console': { 'type': 'ChardevCommonWrapper',
665                          'if': 'CONFIG_WIN32' },
666             'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
667                           'if': 'CONFIG_SPICE' },
668             'spiceport': { 'type': 'ChardevSpicePortWrapper',
669                            'if': 'CONFIG_SPICE' },
670             'qemu-vdagent': { 'type': 'ChardevQemuVDAgentWrapper',
671                               'if': 'CONFIG_SPICE_PROTOCOL' },
672             'dbus': { 'type': 'ChardevDBusWrapper',
673                       'if': 'CONFIG_DBUS_DISPLAY' },
674             'vc': 'ChardevVCWrapper',
675             'ringbuf': 'ChardevRingbufWrapper',
676             'memory': 'ChardevRingbufWrapper' } }
679 # @ChardevReturn:
681 # Return info about the chardev backend just created.
683 # @pty: name of the slave pseudoterminal device, present if and only
684 #     if a chardev of type 'pty' was created
686 # Since: 1.4
688 { 'struct' : 'ChardevReturn',
689   'data': { '*pty': 'str' } }
692 # @chardev-add:
694 # Add a character device backend
696 # @id: the chardev's ID, must be unique
698 # @backend: backend type and parameters
700 # Returns: ChardevReturn.
702 # Since: 1.4
704 # Examples:
706 #     -> { "execute" : "chardev-add",
707 #          "arguments" : { "id" : "foo",
708 #                          "backend" : { "type" : "null", "data" : {} } } }
709 #     <- { "return": {} }
711 #     -> { "execute" : "chardev-add",
712 #          "arguments" : { "id" : "bar",
713 #                          "backend" : { "type" : "file",
714 #                                        "data" : { "out" : "/tmp/bar.log" } } } }
715 #     <- { "return": {} }
717 #     -> { "execute" : "chardev-add",
718 #          "arguments" : { "id" : "baz",
719 #                          "backend" : { "type" : "pty", "data" : {} } } }
720 #     <- { "return": { "pty" : "/dev/pty/42" } }
722 { 'command': 'chardev-add',
723   'data': { 'id': 'str',
724             'backend': 'ChardevBackend' },
725   'returns': 'ChardevReturn' }
728 # @chardev-change:
730 # Change a character device backend
732 # @id: the chardev's ID, must exist
734 # @backend: new backend type and parameters
736 # Returns: ChardevReturn.
738 # Since: 2.10
740 # Examples:
742 #     -> { "execute" : "chardev-change",
743 #          "arguments" : { "id" : "baz",
744 #                          "backend" : { "type" : "pty", "data" : {} } } }
745 #     <- { "return": { "pty" : "/dev/pty/42" } }
747 #     -> {"execute" : "chardev-change",
748 #         "arguments" : {
749 #             "id" : "charchannel2",
750 #             "backend" : {
751 #                 "type" : "socket",
752 #                 "data" : {
753 #                     "addr" : {
754 #                         "type" : "unix" ,
755 #                         "data" : {
756 #                             "path" : "/tmp/charchannel2.socket"
757 #                         }
758 #                      },
759 #                      "server" : true,
760 #                      "wait" : false }}}}
761 #     <- {"return": {}}
763 { 'command': 'chardev-change',
764   'data': { 'id': 'str',
765             'backend': 'ChardevBackend' },
766   'returns': 'ChardevReturn' }
769 # @chardev-remove:
771 # Remove a character device backend
773 # @id: the chardev's ID, must exist and not be in use
775 # Returns: Nothing on success
777 # Since: 1.4
779 # Example:
781 #     -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
782 #     <- { "return": {} }
784 { 'command': 'chardev-remove',
785   'data': { 'id': 'str' } }
788 # @chardev-send-break:
790 # Send a break to a character device
792 # @id: the chardev's ID, must exist
794 # Returns: Nothing on success
796 # Since: 2.10
798 # Example:
800 #     -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
801 #     <- { "return": {} }
803 { 'command': 'chardev-send-break',
804   'data': { 'id': 'str' } }
807 # @VSERPORT_CHANGE:
809 # Emitted when the guest opens or closes a virtio-serial port.
811 # @id: device identifier of the virtio-serial port
813 # @open: true if the guest has opened the virtio-serial port
815 # Note: This event is rate-limited.
817 # Since: 2.1
819 # Example:
821 #     <- { "event": "VSERPORT_CHANGE",
822 #          "data": { "id": "channel0", "open": true },
823 #          "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
825 { 'event': 'VSERPORT_CHANGE',
826   'data': { 'id': 'str',
827             'open': 'bool' } }