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 # Silently ignored with server: false. This use is deprecated.
262 # @nodelay: set TCP_NODELAY socket option (default: false)
263 # @telnet: enable telnet protocol on server
264 # sockets (default: false)
265 # @tn3270: enable tn3270 protocol on server
266 # sockets (default: false) (Since: 2.10)
267 # @websocket: enable websocket protocol on server
268 # sockets (default: false) (Since: 3.1)
269 # @reconnect: For a client socket, if a socket is disconnected,
270 # then attempt a reconnect after the given number of seconds.
271 # Setting this to zero disables this function. (default: 0)
276 { 'struct': 'ChardevSocket',
277 'data': { 'addr': 'SocketAddressLegacy',
279 '*tls-authz' : 'str',
285 '*websocket': 'bool',
286 '*reconnect': 'int' },
287 'base': 'ChardevCommon' }
292 # Configuration info for datagram socket chardevs.
294 # @remote: remote address
295 # @local: local address
299 { 'struct': 'ChardevUdp',
300 'data': { 'remote': 'SocketAddressLegacy',
301 '*local': 'SocketAddressLegacy' },
302 'base': 'ChardevCommon' }
307 # Configuration info for mux chardevs.
309 # @chardev: name of the base chardev.
313 { 'struct': 'ChardevMux',
314 'data': { 'chardev': 'str' },
315 'base': 'ChardevCommon' }
320 # Configuration info for stdio chardevs.
322 # @signal: Allow signals (such as SIGINT triggered by ^C)
323 # be delivered to qemu. Default: true in -nographic mode,
328 { 'struct': 'ChardevStdio',
329 'data': { '*signal': 'bool' },
330 'base': 'ChardevCommon' }
334 # @ChardevSpiceChannel:
336 # Configuration info for spice vm channel chardevs.
338 # @type: kind of channel (for example vdagent).
342 { 'struct': 'ChardevSpiceChannel',
343 'data': { 'type': 'str' },
344 'base': 'ChardevCommon',
345 'if': 'defined(CONFIG_SPICE)' }
350 # Configuration info for spice port chardevs.
352 # @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
356 { 'struct': 'ChardevSpicePort',
357 'data': { 'fqdn': 'str' },
358 'base': 'ChardevCommon',
359 'if': 'defined(CONFIG_SPICE)' }
364 # Configuration info for virtual console chardevs.
366 # @width: console width, in pixels
367 # @height: console height, in pixels
368 # @cols: console width, in chars
369 # @rows: console height, in chars
373 { 'struct': 'ChardevVC',
374 'data': { '*width': 'int',
378 'base': 'ChardevCommon' }
383 # Configuration info for ring buffer chardevs.
385 # @size: ring buffer size, must be power of two, default is 65536
389 { 'struct': 'ChardevRingbuf',
390 'data': { '*size': 'int' },
391 'base': 'ChardevCommon' }
396 # Configuration info for the new chardev backend.
398 # Since: 1.4 (testdev since 2.2, wctablet since 2.9)
400 { 'union': 'ChardevBackend',
401 'data': { 'file': 'ChardevFile',
402 'serial': 'ChardevHostdev',
403 'parallel': 'ChardevHostdev',
404 'pipe': 'ChardevHostdev',
405 'socket': 'ChardevSocket',
407 'pty': 'ChardevCommon',
408 'null': 'ChardevCommon',
410 'msmouse': 'ChardevCommon',
411 'wctablet': 'ChardevCommon',
412 'braille': 'ChardevCommon',
413 'testdev': 'ChardevCommon',
414 'stdio': 'ChardevStdio',
415 'console': 'ChardevCommon',
416 'spicevmc': { 'type': 'ChardevSpiceChannel',
417 'if': 'defined(CONFIG_SPICE)' },
418 'spiceport': { 'type': 'ChardevSpicePort',
419 'if': 'defined(CONFIG_SPICE)' },
421 'ringbuf': 'ChardevRingbuf',
422 # next one is just for compatibility
423 'memory': 'ChardevRingbuf' } }
428 # Return info about the chardev backend just created.
430 # @pty: name of the slave pseudoterminal device, present if
431 # and only if a chardev of type 'pty' was created
435 { 'struct' : 'ChardevReturn',
436 'data': { '*pty': 'str' } }
441 # Add a character device backend
443 # @id: the chardev's ID, must be unique
444 # @backend: backend type and parameters
446 # Returns: ChardevReturn.
452 # -> { "execute" : "chardev-add",
453 # "arguments" : { "id" : "foo",
454 # "backend" : { "type" : "null", "data" : {} } } }
455 # <- { "return": {} }
457 # -> { "execute" : "chardev-add",
458 # "arguments" : { "id" : "bar",
459 # "backend" : { "type" : "file",
460 # "data" : { "out" : "/tmp/bar.log" } } } }
461 # <- { "return": {} }
463 # -> { "execute" : "chardev-add",
464 # "arguments" : { "id" : "baz",
465 # "backend" : { "type" : "pty", "data" : {} } } }
466 # <- { "return": { "pty" : "/dev/pty/42" } }
469 { 'command': 'chardev-add',
470 'data': { 'id': 'str',
471 'backend': 'ChardevBackend' },
472 'returns': 'ChardevReturn' }
477 # Change a character device backend
479 # @id: the chardev's ID, must exist
480 # @backend: new backend type and parameters
482 # Returns: ChardevReturn.
488 # -> { "execute" : "chardev-change",
489 # "arguments" : { "id" : "baz",
490 # "backend" : { "type" : "pty", "data" : {} } } }
491 # <- { "return": { "pty" : "/dev/pty/42" } }
493 # -> {"execute" : "chardev-change",
495 # "id" : "charchannel2",
502 # "path" : "/tmp/charchannel2.socket"
506 # "wait" : false }}}}
510 { 'command': 'chardev-change',
511 'data': { 'id': 'str',
512 'backend': 'ChardevBackend' },
513 'returns': 'ChardevReturn' }
518 # Remove a character device backend
520 # @id: the chardev's ID, must exist and not be in use
522 # Returns: Nothing on success
528 # -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
529 # <- { "return": {} }
532 { 'command': 'chardev-remove',
533 'data': { 'id': 'str' } }
536 # @chardev-send-break:
538 # Send a break to a character device
540 # @id: the chardev's ID, must exist
542 # Returns: Nothing on success
548 # -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
549 # <- { "return": {} }
552 { 'command': 'chardev-send-break',
553 'data': { 'id': 'str' } }
558 # Emitted when the guest opens or closes a virtio-serial port.
560 # @id: device identifier of the virtio-serial port
562 # @open: true if the guest has opened the virtio-serial port
568 # <- { "event": "VSERPORT_CHANGE",
569 # "data": { "id": "channel0", "open": true },
570 # "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
573 { 'event': 'VSERPORT_CHANGE',
574 'data': { 'id': 'str',