Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / qapi / char.json
blob777dde55d977059fa21d372c20fc5afcb4c5a65f
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 # Since: 1.4
144 # Example:
146 #     -> { "execute": "ringbuf-write",
147 #          "arguments": { "device": "foo",
148 #                         "data": "abcdefgh",
149 #                         "format": "utf8" } }
150 #     <- { "return": {} }
152 { 'command': 'ringbuf-write',
153   'data': { 'device': 'str',
154             'data': 'str',
155            '*format': 'DataFormat'} }
158 # @ringbuf-read:
160 # Read from a ring buffer character device.
162 # @device: the ring buffer character device name
164 # @size: how many bytes to read at most
166 # @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 data,
172 #       and when reading stops because the size limit is reached.
173 #     - The return value is always Unicode regardless of format, like
174 #       any other string.
176 # Returns: data read from the device
178 # Since: 1.4
180 # Example:
182 #     -> { "execute": "ringbuf-read",
183 #          "arguments": { "device": "foo",
184 #                         "size": 1000,
185 #                         "format": "utf8" } }
186 #     <- { "return": "abcdefgh" }
188 { 'command': 'ringbuf-read',
189   'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
190   'returns': 'str' }
193 # @ChardevCommon:
195 # Configuration shared across all chardev backends
197 # @logfile: The name of a logfile to save output
199 # @logappend: true to append instead of truncate (default to false to
200 #     truncate)
202 # Since: 2.6
204 { 'struct': 'ChardevCommon',
205   'data': { '*logfile': 'str',
206             '*logappend': 'bool' } }
209 # @ChardevFile:
211 # Configuration info for file chardevs.
213 # @in: The name of the input file
215 # @out: The name of the output file
217 # @append: Open the file in append mode (default false to truncate)
218 #     (Since 2.6)
220 # Since: 1.4
222 { 'struct': 'ChardevFile',
223   'data': { '*in': 'str',
224             'out': 'str',
225             '*append': 'bool' },
226   'base': 'ChardevCommon' }
229 # @ChardevHostdev:
231 # Configuration info for device and pipe chardevs.
233 # @device: The name of the special file for the device, i.e.
234 #     /dev/ttyS0 on Unix or COM1: on Windows
236 # Since: 1.4
238 { 'struct': 'ChardevHostdev',
239   'data': { 'device': 'str' },
240   'base': 'ChardevCommon' }
243 # @ChardevSocket:
245 # Configuration info for (stream) socket chardevs.
247 # @addr: socket address to listen on (server=true) or connect to
248 #     (server=false)
250 # @tls-creds: the ID of the TLS credentials object (since 2.6)
252 # @tls-authz: the ID of the QAuthZ authorization object against which
253 #     the client's x509 distinguished name will be validated.  This
254 #     object is only resolved at time of use, so can be deleted and
255 #     recreated on the fly while the chardev server is active.  If
256 #     missing, it will default to denying access (since 4.0)
258 # @server: create server socket (default: true)
260 # @wait: wait for incoming connection on server sockets (default:
261 #     false). Silently ignored with server: false.  This use is
262 #     deprecated.
264 # @nodelay: set TCP_NODELAY socket option (default: false)
266 # @telnet: enable telnet protocol on server sockets (default: false)
268 # @tn3270: enable tn3270 protocol on server sockets (default: false)
269 #     (Since: 2.10)
271 # @websocket: enable websocket protocol on server sockets
272 #     (default: false) (Since: 3.1)
274 # @reconnect: For a client socket, if a socket is disconnected, then
275 #     attempt a reconnect after the given number of seconds.  Setting
276 #     this to zero disables this function.  (default: 0) (Since: 2.2)
278 # Since: 1.4
280 { 'struct': 'ChardevSocket',
281   'data': { 'addr': 'SocketAddressLegacy',
282             '*tls-creds': 'str',
283             '*tls-authz'  : 'str',
284             '*server': 'bool',
285             '*wait': 'bool',
286             '*nodelay': 'bool',
287             '*telnet': 'bool',
288             '*tn3270': 'bool',
289             '*websocket': 'bool',
290             '*reconnect': 'int' },
291   'base': 'ChardevCommon' }
294 # @ChardevUdp:
296 # Configuration info for datagram socket chardevs.
298 # @remote: remote address
300 # @local: local address
302 # Since: 1.5
304 { 'struct': 'ChardevUdp',
305   'data': { 'remote': 'SocketAddressLegacy',
306             '*local': 'SocketAddressLegacy' },
307   'base': 'ChardevCommon' }
310 # @ChardevMux:
312 # Configuration info for mux chardevs.
314 # @chardev: name of the base chardev.
316 # Since: 1.5
318 { 'struct': 'ChardevMux',
319   'data': { 'chardev': 'str' },
320   'base': 'ChardevCommon' }
323 # @ChardevStdio:
325 # Configuration info for stdio chardevs.
327 # @signal: Allow signals (such as SIGINT triggered by ^C) be delivered
328 #     to qemu.  Default: true.
330 # Since: 1.5
332 { 'struct': 'ChardevStdio',
333   'data': { '*signal': 'bool' },
334   'base': 'ChardevCommon' }
337 # @ChardevSpiceChannel:
339 # Configuration info for spice vm channel chardevs.
341 # @type: kind of channel (for example vdagent).
343 # Since: 1.5
345 { 'struct': 'ChardevSpiceChannel',
346   'data': { 'type': 'str' },
347   'base': 'ChardevCommon',
348   'if': 'CONFIG_SPICE' }
351 # @ChardevSpicePort:
353 # Configuration info for spice port chardevs.
355 # @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
357 # Since: 1.5
359 { 'struct': 'ChardevSpicePort',
360   'data': { 'fqdn': 'str' },
361   'base': 'ChardevCommon',
362   'if': 'CONFIG_SPICE' }
365 # @ChardevDBus:
367 # Configuration info for DBus chardevs.
369 # @name: name of the channel (following docs/spice-port-fqdn.txt)
371 # Since: 7.0
373 { 'struct': 'ChardevDBus',
374   'data': { 'name': 'str' },
375   'base': 'ChardevCommon',
376   'if': 'CONFIG_DBUS_DISPLAY' }
379 # @ChardevVC:
381 # Configuration info for virtual console chardevs.
383 # @width: console width, in pixels
385 # @height: console height, in pixels
387 # @cols: console width, in chars
389 # @rows: console height, in chars
391 # Note: the options are only effective when the VNC or SDL graphical
392 #     display backend is active.  They are ignored with the GTK,
393 #     Spice, VNC and D-Bus display backends.
395 # Since: 1.5
397 { 'struct': 'ChardevVC',
398   'data': { '*width': 'int',
399             '*height': 'int',
400             '*cols': 'int',
401             '*rows': 'int' },
402   'base': 'ChardevCommon' }
405 # @ChardevRingbuf:
407 # Configuration info for ring buffer chardevs.
409 # @size: ring buffer size, must be power of two, default is 65536
411 # Since: 1.5
413 { 'struct': 'ChardevRingbuf',
414   'data': { '*size': 'int' },
415   'base': 'ChardevCommon' }
418 # @ChardevQemuVDAgent:
420 # Configuration info for qemu vdagent implementation.
422 # @mouse: enable/disable mouse, default is enabled.
424 # @clipboard: enable/disable clipboard, default is disabled.
426 # Since: 6.1
428 { 'struct': 'ChardevQemuVDAgent',
429   'data': { '*mouse': 'bool',
430             '*clipboard': 'bool' },
431   'base': 'ChardevCommon',
432   'if': 'CONFIG_SPICE_PROTOCOL' }
435 # @ChardevBackendKind:
437 # @pipe: Since 1.5
439 # @udp: Since 1.5
441 # @mux: Since 1.5
443 # @msmouse: Since 1.5
445 # @wctablet: Since 2.9
447 # @braille: Since 1.5
449 # @testdev: Since 2.2
451 # @stdio: Since 1.5
453 # @console: Since 1.5
455 # @spicevmc: Since 1.5
457 # @spiceport: Since 1.5
459 # @qemu-vdagent: Since 6.1
461 # @dbus: Since 7.0
463 # @vc: v1.5
465 # @ringbuf: Since 1.6
467 # @memory: Since 1.5
469 # Features:
471 # @deprecated: Member @memory is deprecated.  Use @ringbuf instead.
473 # Since: 1.4
475 { 'enum': 'ChardevBackendKind',
476   'data': [ 'file',
477             { 'name': 'serial', 'if': 'HAVE_CHARDEV_SERIAL' },
478             { 'name': 'parallel', 'if': 'HAVE_CHARDEV_PARALLEL' },
479             'pipe',
480             'socket',
481             'udp',
482             'pty',
483             'null',
484             'mux',
485             'msmouse',
486             'wctablet',
487             { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
488             'testdev',
489             'stdio',
490             { 'name': 'console', 'if': 'CONFIG_WIN32' },
491             { 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
492             { 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
493             { 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
494             { 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' },
495             'vc',
496             'ringbuf',
497             { 'name': 'memory', 'features': [ 'deprecated' ] } ] }
500 # @ChardevFileWrapper:
502 # @data: Configuration info for file chardevs
504 # Since: 1.4
506 { 'struct': 'ChardevFileWrapper',
507   'data': { 'data': 'ChardevFile' } }
510 # @ChardevHostdevWrapper:
512 # @data: Configuration info for device and pipe chardevs
514 # Since: 1.4
516 { 'struct': 'ChardevHostdevWrapper',
517   'data': { 'data': 'ChardevHostdev' } }
520 # @ChardevSocketWrapper:
522 # @data: Configuration info for (stream) socket chardevs
524 # Since: 1.4
526 { 'struct': 'ChardevSocketWrapper',
527   'data': { 'data': 'ChardevSocket' } }
530 # @ChardevUdpWrapper:
532 # @data: Configuration info for datagram socket chardevs
534 # Since: 1.5
536 { 'struct': 'ChardevUdpWrapper',
537   'data': { 'data': 'ChardevUdp' } }
540 # @ChardevCommonWrapper:
542 # @data: Configuration shared across all chardev backends
544 # Since: 2.6
546 { 'struct': 'ChardevCommonWrapper',
547   'data': { 'data': 'ChardevCommon' } }
550 # @ChardevMuxWrapper:
552 # @data: Configuration info for mux chardevs
554 # Since: 1.5
556 { 'struct': 'ChardevMuxWrapper',
557   'data': { 'data': 'ChardevMux' } }
560 # @ChardevStdioWrapper:
562 # @data: Configuration info for stdio chardevs
564 # Since: 1.5
566 { 'struct': 'ChardevStdioWrapper',
567   'data': { 'data': 'ChardevStdio' } }
570 # @ChardevSpiceChannelWrapper:
572 # @data: Configuration info for spice vm channel chardevs
574 # Since: 1.5
576 { 'struct': 'ChardevSpiceChannelWrapper',
577   'data': { 'data': 'ChardevSpiceChannel' },
578   'if': 'CONFIG_SPICE' }
581 # @ChardevSpicePortWrapper:
583 # @data: Configuration info for spice port chardevs
585 # Since: 1.5
587 { 'struct': 'ChardevSpicePortWrapper',
588   'data': { 'data': 'ChardevSpicePort' },
589   'if': 'CONFIG_SPICE' }
592 # @ChardevQemuVDAgentWrapper:
594 # @data: Configuration info for qemu vdagent implementation
596 # Since: 6.1
598 { 'struct': 'ChardevQemuVDAgentWrapper',
599   'data': { 'data': 'ChardevQemuVDAgent' },
600   'if': 'CONFIG_SPICE_PROTOCOL' }
603 # @ChardevDBusWrapper:
605 # @data: Configuration info for DBus chardevs
607 # Since: 7.0
609 { 'struct': 'ChardevDBusWrapper',
610   'data': { 'data': 'ChardevDBus' },
611   'if': 'CONFIG_DBUS_DISPLAY' }
614 # @ChardevVCWrapper:
616 # @data: Configuration info for virtual console chardevs
618 # Since: 1.5
620 { 'struct': 'ChardevVCWrapper',
621   'data': { 'data': 'ChardevVC' } }
624 # @ChardevRingbufWrapper:
626 # @data: Configuration info for ring buffer chardevs
628 # Since: 1.5
630 { 'struct': 'ChardevRingbufWrapper',
631   'data': { 'data': 'ChardevRingbuf' } }
634 # @ChardevBackend:
636 # Configuration info for the new chardev backend.
638 # @type: backend type
640 # Since: 1.4
642 { 'union': 'ChardevBackend',
643   'base': { 'type': 'ChardevBackendKind' },
644   'discriminator': 'type',
645   'data': { 'file': 'ChardevFileWrapper',
646             'serial': { 'type': 'ChardevHostdevWrapper',
647                         'if': 'HAVE_CHARDEV_SERIAL' },
648             'parallel': { 'type': 'ChardevHostdevWrapper',
649                           'if': 'HAVE_CHARDEV_PARALLEL' },
650             'pipe': 'ChardevHostdevWrapper',
651             'socket': 'ChardevSocketWrapper',
652             'udp': 'ChardevUdpWrapper',
653             'pty': 'ChardevCommonWrapper',
654             'null': 'ChardevCommonWrapper',
655             'mux': 'ChardevMuxWrapper',
656             'msmouse': 'ChardevCommonWrapper',
657             'wctablet': 'ChardevCommonWrapper',
658             'braille': { 'type': 'ChardevCommonWrapper',
659                          'if': 'CONFIG_BRLAPI' },
660             'testdev': 'ChardevCommonWrapper',
661             'stdio': 'ChardevStdioWrapper',
662             'console': { 'type': 'ChardevCommonWrapper',
663                          'if': 'CONFIG_WIN32' },
664             'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
665                           'if': 'CONFIG_SPICE' },
666             'spiceport': { 'type': 'ChardevSpicePortWrapper',
667                            'if': 'CONFIG_SPICE' },
668             'qemu-vdagent': { 'type': 'ChardevQemuVDAgentWrapper',
669                               'if': 'CONFIG_SPICE_PROTOCOL' },
670             'dbus': { 'type': 'ChardevDBusWrapper',
671                       'if': 'CONFIG_DBUS_DISPLAY' },
672             'vc': 'ChardevVCWrapper',
673             'ringbuf': 'ChardevRingbufWrapper',
674             'memory': 'ChardevRingbufWrapper' } }
677 # @ChardevReturn:
679 # Return info about the chardev backend just created.
681 # @pty: name of the slave pseudoterminal device, present if and only
682 #     if a chardev of type 'pty' was created
684 # Since: 1.4
686 { 'struct' : 'ChardevReturn',
687   'data': { '*pty': 'str' } }
690 # @chardev-add:
692 # Add a character device backend
694 # @id: the chardev's ID, must be unique
696 # @backend: backend type and parameters
698 # Returns: ChardevReturn.
700 # Since: 1.4
702 # Examples:
704 #     -> { "execute" : "chardev-add",
705 #          "arguments" : { "id" : "foo",
706 #                          "backend" : { "type" : "null", "data" : {} } } }
707 #     <- { "return": {} }
709 #     -> { "execute" : "chardev-add",
710 #          "arguments" : { "id" : "bar",
711 #                          "backend" : { "type" : "file",
712 #                                        "data" : { "out" : "/tmp/bar.log" } } } }
713 #     <- { "return": {} }
715 #     -> { "execute" : "chardev-add",
716 #          "arguments" : { "id" : "baz",
717 #                          "backend" : { "type" : "pty", "data" : {} } } }
718 #     <- { "return": { "pty" : "/dev/pty/42" } }
720 { 'command': 'chardev-add',
721   'data': { 'id': 'str',
722             'backend': 'ChardevBackend' },
723   'returns': 'ChardevReturn' }
726 # @chardev-change:
728 # Change a character device backend
730 # @id: the chardev's ID, must exist
732 # @backend: new backend type and parameters
734 # Returns: ChardevReturn.
736 # Since: 2.10
738 # Examples:
740 #     -> { "execute" : "chardev-change",
741 #          "arguments" : { "id" : "baz",
742 #                          "backend" : { "type" : "pty", "data" : {} } } }
743 #     <- { "return": { "pty" : "/dev/pty/42" } }
745 #     -> {"execute" : "chardev-change",
746 #         "arguments" : {
747 #             "id" : "charchannel2",
748 #             "backend" : {
749 #                 "type" : "socket",
750 #                 "data" : {
751 #                     "addr" : {
752 #                         "type" : "unix" ,
753 #                         "data" : {
754 #                             "path" : "/tmp/charchannel2.socket"
755 #                         }
756 #                      },
757 #                      "server" : true,
758 #                      "wait" : false }}}}
759 #     <- {"return": {}}
761 { 'command': 'chardev-change',
762   'data': { 'id': 'str',
763             'backend': 'ChardevBackend' },
764   'returns': 'ChardevReturn' }
767 # @chardev-remove:
769 # Remove a character device backend
771 # @id: the chardev's ID, must exist and not be in use
773 # Since: 1.4
775 # Example:
777 #     -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
778 #     <- { "return": {} }
780 { 'command': 'chardev-remove',
781   'data': { 'id': 'str' } }
784 # @chardev-send-break:
786 # Send a break to a character device
788 # @id: the chardev's ID, must exist
790 # Since: 2.10
792 # Example:
794 #     -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
795 #     <- { "return": {} }
797 { 'command': 'chardev-send-break',
798   'data': { 'id': 'str' } }
801 # @VSERPORT_CHANGE:
803 # Emitted when the guest opens or closes a virtio-serial port.
805 # @id: device identifier of the virtio-serial port
807 # @open: true if the guest has opened the virtio-serial port
809 # Note: This event is rate-limited.
811 # Since: 2.1
813 # Example:
815 #     <- { "event": "VSERPORT_CHANGE",
816 #          "data": { "id": "channel0", "open": true },
817 #          "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
819 { 'event': 'VSERPORT_CHANGE',
820   'data': { 'id': 'str',
821             'open': 'bool' } }