8 { 'include': 'sockets.json' }
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
23 # Notes: @filename is encoded using the QEMU command line character device
24 # encoding. See the QEMU man page for details.
28 { 'struct': 'ChardevInfo',
29 'data': { 'label': 'str',
31 'frontend-open': 'bool' } }
36 # Returns information about current character devices.
38 # Returns: a list of @ChardevInfo
44 # -> { "execute": "query-chardev" }
48 # "label": "charchannel0",
49 # "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
50 # "frontend-open": false
53 # "label": "charmonitor",
54 # "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
55 # "frontend-open": true
58 # "label": "charserial0",
59 # "filename": "pty:/dev/pts/2",
60 # "frontend-open": true
66 { 'command': 'query-chardev', 'returns': ['ChardevInfo'],
67 'allow-preconfig': true }
70 # @ChardevBackendInfo:
72 # Information about a character device backend
74 # @name: The backend name
78 { 'struct': 'ChardevBackendInfo', 'data': {'name': 'str'} }
81 # @query-chardev-backends:
83 # Returns information about character device backends.
85 # Returns: a list of @ChardevBackendInfo
91 # -> { "execute": "query-chardev-backends" }
110 { 'command': 'query-chardev-backends', 'returns': ['ChardevBackendInfo'] }
115 # An enumeration of data format.
117 # @utf8: Data is a UTF-8 string (RFC 3629)
119 # @base64: Data is Base64 encoded binary (RFC 3548)
123 { 'enum': 'DataFormat',
124 'data': [ 'utf8', 'base64' ] }
129 # Write to a ring buffer character device.
131 # @device: the ring buffer character device name
133 # @data: data to write
135 # @format: data encoding (default 'utf8').
137 # - base64: data must be base64 encoded text. Its binary
138 # decoding gets written.
139 # - utf8: data's UTF-8 encoding is written
140 # - data itself is always Unicode regardless of format, like
143 # Returns: Nothing on success
149 # -> { "execute": "ringbuf-write",
150 # "arguments": { "device": "foo",
151 # "data": "abcdefgh",
152 # "format": "utf8" } }
153 # <- { "return": {} }
156 { 'command': 'ringbuf-write',
157 'data': { 'device': 'str',
159 '*format': 'DataFormat'} }
164 # Read from a ring buffer character device.
166 # @device: the ring buffer character device name
168 # @size: how many bytes to read at most
170 # @format: data encoding (default 'utf8').
172 # - base64: the data read is returned in base64 encoding.
173 # - utf8: the data read is interpreted as UTF-8.
174 # Bug: can screw up when the buffer contains invalid UTF-8
175 # sequences, NUL characters, after the ring buffer lost
176 # data, and when reading stops because the size limit is
178 # - The return value is always Unicode regardless of format,
179 # like any other string.
181 # Returns: data read from the device
187 # -> { "execute": "ringbuf-read",
188 # "arguments": { "device": "foo",
190 # "format": "utf8" } }
191 # <- { "return": "abcdefgh" }
194 { 'command': 'ringbuf-read',
195 'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
201 # Configuration shared across all chardev backends
203 # @logfile: The name of a logfile to save output
204 # @logappend: true to append instead of truncate
205 # (default to false to truncate)
209 { 'struct': 'ChardevCommon',
210 'data': { '*logfile': 'str',
211 '*logappend': 'bool' } }
216 # Configuration info for file chardevs.
218 # @in: The name of the input file
219 # @out: The name of the output file
220 # @append: Open the file in append mode (default false to
221 # truncate) (Since 2.6)
225 { 'struct': 'ChardevFile',
226 'data': { '*in': 'str',
229 'base': 'ChardevCommon' }
234 # Configuration info for device and pipe chardevs.
236 # @device: The name of the special file for the device,
237 # i.e. /dev/ttyS0 on Unix or COM1: on Windows
241 { 'struct': 'ChardevHostdev',
242 'data': { 'device': 'str' },
243 'base': 'ChardevCommon' }
248 # Configuration info for (stream) socket chardevs.
250 # @addr: socket address to listen on (server=true)
251 # or connect to (server=false)
252 # @tls-creds: the ID of the TLS credentials object (since 2.6)
253 # @tls-authz: the ID of the QAuthZ authorization object against which
254 # the client's x509 distinguished name will be validated. This
255 # object is only resolved at time of use, so can be deleted
256 # and recreated on the fly while the chardev server is active.
257 # If missing, it will default to denying access (since 4.0)
258 # @server: create server socket (default: true)
259 # @wait: wait for incoming connection on server
260 # sockets (default: false).
261 # @nodelay: set TCP_NODELAY socket option (default: false)
262 # @telnet: enable telnet protocol on server
263 # sockets (default: false)
264 # @tn3270: enable tn3270 protocol on server
265 # sockets (default: false) (Since: 2.10)
266 # @websocket: enable websocket protocol on server
267 # sockets (default: false) (Since: 3.1)
268 # @reconnect: For a client socket, if a socket is disconnected,
269 # then attempt a reconnect after the given number of seconds.
270 # Setting this to zero disables this function. (default: 0)
275 { 'struct': 'ChardevSocket',
276 'data': { 'addr': 'SocketAddressLegacy',
278 '*tls-authz' : 'str',
284 '*websocket': 'bool',
285 '*reconnect': 'int' },
286 'base': 'ChardevCommon' }
291 # Configuration info for datagram socket chardevs.
293 # @remote: remote address
294 # @local: local address
298 { 'struct': 'ChardevUdp',
299 'data': { 'remote': 'SocketAddressLegacy',
300 '*local': 'SocketAddressLegacy' },
301 'base': 'ChardevCommon' }
306 # Configuration info for mux chardevs.
308 # @chardev: name of the base chardev.
312 { 'struct': 'ChardevMux',
313 'data': { 'chardev': 'str' },
314 'base': 'ChardevCommon' }
319 # Configuration info for stdio chardevs.
321 # @signal: Allow signals (such as SIGINT triggered by ^C)
322 # be delivered to qemu. Default: true in -nographic mode,
327 { 'struct': 'ChardevStdio',
328 'data': { '*signal': 'bool' },
329 'base': 'ChardevCommon' }
333 # @ChardevSpiceChannel:
335 # Configuration info for spice vm channel chardevs.
337 # @type: kind of channel (for example vdagent).
341 { 'struct': 'ChardevSpiceChannel',
342 'data': { 'type': 'str' },
343 'base': 'ChardevCommon',
344 'if': 'defined(CONFIG_SPICE)' }
349 # Configuration info for spice port chardevs.
351 # @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
355 { 'struct': 'ChardevSpicePort',
356 'data': { 'fqdn': 'str' },
357 'base': 'ChardevCommon',
358 'if': 'defined(CONFIG_SPICE)' }
363 # Configuration info for virtual console chardevs.
365 # @width: console width, in pixels
366 # @height: console height, in pixels
367 # @cols: console width, in chars
368 # @rows: console height, in chars
372 { 'struct': 'ChardevVC',
373 'data': { '*width': 'int',
377 'base': 'ChardevCommon' }
382 # Configuration info for ring buffer chardevs.
384 # @size: ring buffer size, must be power of two, default is 65536
388 { 'struct': 'ChardevRingbuf',
389 'data': { '*size': 'int' },
390 'base': 'ChardevCommon' }
395 # Configuration info for the new chardev backend.
397 # Since: 1.4 (testdev since 2.2, wctablet since 2.9)
399 { 'union': 'ChardevBackend',
400 'data': { 'file': 'ChardevFile',
401 'serial': 'ChardevHostdev',
402 'parallel': 'ChardevHostdev',
403 'pipe': 'ChardevHostdev',
404 'socket': 'ChardevSocket',
406 'pty': 'ChardevCommon',
407 'null': 'ChardevCommon',
409 'msmouse': 'ChardevCommon',
410 'wctablet': 'ChardevCommon',
411 'braille': 'ChardevCommon',
412 'testdev': 'ChardevCommon',
413 'stdio': 'ChardevStdio',
414 'console': 'ChardevCommon',
415 'spicevmc': { 'type': 'ChardevSpiceChannel',
416 'if': 'defined(CONFIG_SPICE)' },
417 'spiceport': { 'type': 'ChardevSpicePort',
418 'if': 'defined(CONFIG_SPICE)' },
420 'ringbuf': 'ChardevRingbuf',
421 # next one is just for compatibility
422 'memory': 'ChardevRingbuf' } }
427 # Return info about the chardev backend just created.
429 # @pty: name of the slave pseudoterminal device, present if
430 # and only if a chardev of type 'pty' was created
434 { 'struct' : 'ChardevReturn',
435 'data': { '*pty': 'str' } }
440 # Add a character device backend
442 # @id: the chardev's ID, must be unique
443 # @backend: backend type and parameters
445 # Returns: ChardevReturn.
451 # -> { "execute" : "chardev-add",
452 # "arguments" : { "id" : "foo",
453 # "backend" : { "type" : "null", "data" : {} } } }
454 # <- { "return": {} }
456 # -> { "execute" : "chardev-add",
457 # "arguments" : { "id" : "bar",
458 # "backend" : { "type" : "file",
459 # "data" : { "out" : "/tmp/bar.log" } } } }
460 # <- { "return": {} }
462 # -> { "execute" : "chardev-add",
463 # "arguments" : { "id" : "baz",
464 # "backend" : { "type" : "pty", "data" : {} } } }
465 # <- { "return": { "pty" : "/dev/pty/42" } }
468 { 'command': 'chardev-add',
469 'data': { 'id': 'str',
470 'backend': 'ChardevBackend' },
471 'returns': 'ChardevReturn' }
476 # Change a character device backend
478 # @id: the chardev's ID, must exist
479 # @backend: new backend type and parameters
481 # Returns: ChardevReturn.
487 # -> { "execute" : "chardev-change",
488 # "arguments" : { "id" : "baz",
489 # "backend" : { "type" : "pty", "data" : {} } } }
490 # <- { "return": { "pty" : "/dev/pty/42" } }
492 # -> {"execute" : "chardev-change",
494 # "id" : "charchannel2",
501 # "path" : "/tmp/charchannel2.socket"
505 # "wait" : false }}}}
509 { 'command': 'chardev-change',
510 'data': { 'id': 'str',
511 'backend': 'ChardevBackend' },
512 'returns': 'ChardevReturn' }
517 # Remove a character device backend
519 # @id: the chardev's ID, must exist and not be in use
521 # Returns: Nothing on success
527 # -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
528 # <- { "return": {} }
531 { 'command': 'chardev-remove',
532 'data': { 'id': 'str' } }
535 # @chardev-send-break:
537 # Send a break to a character device
539 # @id: the chardev's ID, must exist
541 # Returns: Nothing on success
547 # -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
548 # <- { "return": {} }
551 { 'command': 'chardev-send-break',
552 'data': { 'id': 'str' } }
557 # Emitted when the guest opens or closes a virtio-serial port.
559 # @id: device identifier of the virtio-serial port
561 # @open: true if the guest has opened the virtio-serial port
567 # <- { "event": "VSERPORT_CHANGE",
568 # "data": { "id": "channel0", "open": true },
569 # "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
572 { 'event': 'VSERPORT_CHANGE',
573 'data': { 'id': 'str',