]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/char.json
qapi: add 'not' condition operation
[mirror_qemu.git] / qapi / char.json
CommitLineData
dbeee392 1# -*- Mode: Python -*-
f7160f32 2# vim: filetype=python
dbeee392
MA
3#
4
5##
6# = Character devices
7##
8
9{ 'include': 'sockets.json' }
10
11##
12# @ChardevInfo:
13#
14# Information about a character device.
15#
16# @label: the label of the character device
17#
18# @filename: the filename of the character device
19#
20# @frontend-open: shows whether the frontend device attached to this backend
21# (eg. with the chardev=... option) is in open or closed state
22# (since 2.1)
23#
24# Notes: @filename is encoded using the QEMU command line character device
25# encoding. See the QEMU man page for details.
26#
9bc6e893 27# Since: 0.14
dbeee392 28##
b0ddeba2
MAL
29{ 'struct': 'ChardevInfo',
30 'data': { 'label': 'str',
31 'filename': 'str',
32 'frontend-open': 'bool' } }
dbeee392
MA
33
34##
35# @query-chardev:
36#
37# Returns information about current character devices.
38#
39# Returns: a list of @ChardevInfo
40#
9bc6e893 41# Since: 0.14
dbeee392
MA
42#
43# Example:
44#
45# -> { "execute": "query-chardev" }
46# <- {
47# "return": [
48# {
49# "label": "charchannel0",
9d902d51 50# "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server=on",
dbeee392
MA
51# "frontend-open": false
52# },
53# {
54# "label": "charmonitor",
9d902d51 55# "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server=on",
dbeee392
MA
56# "frontend-open": true
57# },
58# {
59# "label": "charserial0",
60# "filename": "pty:/dev/pts/2",
61# "frontend-open": true
62# }
63# ]
64# }
65#
66##
a87706c8
IM
67{ 'command': 'query-chardev', 'returns': ['ChardevInfo'],
68 'allow-preconfig': true }
dbeee392
MA
69
70##
71# @ChardevBackendInfo:
72#
73# Information about a character device backend
74#
75# @name: The backend name
76#
77# Since: 2.0
78##
79{ 'struct': 'ChardevBackendInfo', 'data': {'name': 'str'} }
80
81##
82# @query-chardev-backends:
83#
84# Returns information about character device backends.
85#
86# Returns: a list of @ChardevBackendInfo
87#
88# Since: 2.0
89#
90# Example:
91#
92# -> { "execute": "query-chardev-backends" }
93# <- {
94# "return":[
95# {
96# "name":"udp"
97# },
98# {
99# "name":"tcp"
100# },
101# {
102# "name":"unix"
103# },
104# {
105# "name":"spiceport"
106# }
107# ]
108# }
109#
110##
111{ 'command': 'query-chardev-backends', 'returns': ['ChardevBackendInfo'] }
112
113##
114# @DataFormat:
115#
116# An enumeration of data format.
117#
118# @utf8: Data is a UTF-8 string (RFC 3629)
119#
120# @base64: Data is Base64 encoded binary (RFC 3548)
121#
122# Since: 1.4
123##
124{ 'enum': 'DataFormat',
125 'data': [ 'utf8', 'base64' ] }
126
127##
128# @ringbuf-write:
129#
130# Write to a ring buffer character device.
131#
132# @device: the ring buffer character device name
133#
134# @data: data to write
135#
136# @format: data encoding (default 'utf8').
100cc4fe 137#
dbeee392
MA
138# - base64: data must be base64 encoded text. Its binary
139# decoding gets written.
140# - utf8: data's UTF-8 encoding is written
141# - data itself is always Unicode regardless of format, like
142# any other string.
143#
144# Returns: Nothing on success
145#
146# Since: 1.4
147#
148# Example:
149#
150# -> { "execute": "ringbuf-write",
151# "arguments": { "device": "foo",
152# "data": "abcdefgh",
153# "format": "utf8" } }
154# <- { "return": {} }
155#
156##
157{ 'command': 'ringbuf-write',
b0ddeba2
MAL
158 'data': { 'device': 'str',
159 'data': 'str',
dbeee392
MA
160 '*format': 'DataFormat'} }
161
162##
163# @ringbuf-read:
164#
165# Read from a ring buffer character device.
166#
167# @device: the ring buffer character device name
168#
169# @size: how many bytes to read at most
170#
171# @format: data encoding (default 'utf8').
100cc4fe 172#
dbeee392
MA
173# - base64: the data read is returned in base64 encoding.
174# - utf8: the data read is interpreted as UTF-8.
175# Bug: can screw up when the buffer contains invalid UTF-8
176# sequences, NUL characters, after the ring buffer lost
177# data, and when reading stops because the size limit is
178# reached.
179# - The return value is always Unicode regardless of format,
180# like any other string.
181#
182# Returns: data read from the device
183#
184# Since: 1.4
185#
186# Example:
187#
188# -> { "execute": "ringbuf-read",
189# "arguments": { "device": "foo",
190# "size": 1000,
191# "format": "utf8" } }
192# <- { "return": "abcdefgh" }
193#
194##
195{ 'command': 'ringbuf-read',
196 'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
197 'returns': 'str' }
198
199##
200# @ChardevCommon:
201#
202# Configuration shared across all chardev backends
203#
204# @logfile: The name of a logfile to save output
205# @logappend: true to append instead of truncate
206# (default to false to truncate)
207#
208# Since: 2.6
209##
b0ddeba2
MAL
210{ 'struct': 'ChardevCommon',
211 'data': { '*logfile': 'str',
212 '*logappend': 'bool' } }
dbeee392
MA
213
214##
215# @ChardevFile:
216#
217# Configuration info for file chardevs.
218#
219# @in: The name of the input file
220# @out: The name of the output file
221# @append: Open the file in append mode (default false to
222# truncate) (Since 2.6)
223#
224# Since: 1.4
225##
b0ddeba2
MAL
226{ 'struct': 'ChardevFile',
227 'data': { '*in': 'str',
228 'out': 'str',
229 '*append': 'bool' },
dbeee392
MA
230 'base': 'ChardevCommon' }
231
232##
233# @ChardevHostdev:
234#
235# Configuration info for device and pipe chardevs.
236#
237# @device: The name of the special file for the device,
238# i.e. /dev/ttyS0 on Unix or COM1: on Windows
239#
240# Since: 1.4
241##
b0ddeba2
MAL
242{ 'struct': 'ChardevHostdev',
243 'data': { 'device': 'str' },
dbeee392
MA
244 'base': 'ChardevCommon' }
245
246##
247# @ChardevSocket:
248#
249# Configuration info for (stream) socket chardevs.
250#
251# @addr: socket address to listen on (server=true)
252# or connect to (server=false)
253# @tls-creds: the ID of the TLS credentials object (since 2.6)
fd4a5fd4
DB
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
257# and recreated on the fly while the chardev server is active.
258# If missing, it will default to denying access (since 4.0)
dbeee392
MA
259# @server: create server socket (default: true)
260# @wait: wait for incoming connection on server
261# sockets (default: false).
0f365e33 262# Silently ignored with server: false. This use is deprecated.
dbeee392
MA
263# @nodelay: set TCP_NODELAY socket option (default: false)
264# @telnet: enable telnet protocol on server
265# sockets (default: false)
266# @tn3270: enable tn3270 protocol on server
267# sockets (default: false) (Since: 2.10)
981b06e7 268# @websocket: enable websocket protocol on server
26ec4e53 269# sockets (default: false) (Since: 3.1)
dbeee392 270# @reconnect: For a client socket, if a socket is disconnected,
26ec4e53
PM
271# then attempt a reconnect after the given number of seconds.
272# Setting this to zero disables this function. (default: 0)
273# (Since: 2.2)
dbeee392
MA
274#
275# Since: 1.4
276##
b0ddeba2
MAL
277{ 'struct': 'ChardevSocket',
278 'data': { 'addr': 'SocketAddressLegacy',
279 '*tls-creds': 'str',
fd4a5fd4 280 '*tls-authz' : 'str',
b0ddeba2
MAL
281 '*server': 'bool',
282 '*wait': 'bool',
283 '*nodelay': 'bool',
284 '*telnet': 'bool',
285 '*tn3270': 'bool',
286 '*websocket': 'bool',
287 '*reconnect': 'int' },
dbeee392
MA
288 'base': 'ChardevCommon' }
289
290##
291# @ChardevUdp:
292#
293# Configuration info for datagram socket chardevs.
294#
295# @remote: remote address
296# @local: local address
297#
298# Since: 1.5
299##
b0ddeba2
MAL
300{ 'struct': 'ChardevUdp',
301 'data': { 'remote': 'SocketAddressLegacy',
302 '*local': 'SocketAddressLegacy' },
dbeee392
MA
303 'base': 'ChardevCommon' }
304
305##
306# @ChardevMux:
307#
308# Configuration info for mux chardevs.
309#
310# @chardev: name of the base chardev.
311#
312# Since: 1.5
313##
b0ddeba2
MAL
314{ 'struct': 'ChardevMux',
315 'data': { 'chardev': 'str' },
dbeee392
MA
316 'base': 'ChardevCommon' }
317
318##
319# @ChardevStdio:
320#
321# Configuration info for stdio chardevs.
322#
323# @signal: Allow signals (such as SIGINT triggered by ^C)
6deb20f6 324# be delivered to qemu. Default: true.
dbeee392
MA
325#
326# Since: 1.5
327##
b0ddeba2
MAL
328{ 'struct': 'ChardevStdio',
329 'data': { '*signal': 'bool' },
dbeee392
MA
330 'base': 'ChardevCommon' }
331
332
333##
334# @ChardevSpiceChannel:
335#
336# Configuration info for spice vm channel chardevs.
337#
338# @type: kind of channel (for example vdagent).
339#
340# Since: 1.5
341##
b0ddeba2
MAL
342{ 'struct': 'ChardevSpiceChannel',
343 'data': { 'type': 'str' },
fd9dda3b
MAL
344 'base': 'ChardevCommon',
345 'if': 'defined(CONFIG_SPICE)' }
dbeee392
MA
346
347##
348# @ChardevSpicePort:
349#
350# Configuration info for spice port chardevs.
351#
352# @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
353#
354# Since: 1.5
355##
b0ddeba2
MAL
356{ 'struct': 'ChardevSpicePort',
357 'data': { 'fqdn': 'str' },
fd9dda3b
MAL
358 'base': 'ChardevCommon',
359 'if': 'defined(CONFIG_SPICE)' }
dbeee392
MA
360
361##
362# @ChardevVC:
363#
364# Configuration info for virtual console chardevs.
365#
366# @width: console width, in pixels
367# @height: console height, in pixels
368# @cols: console width, in chars
369# @rows: console height, in chars
370#
371# Since: 1.5
372##
b0ddeba2
MAL
373{ 'struct': 'ChardevVC',
374 'data': { '*width': 'int',
375 '*height': 'int',
376 '*cols': 'int',
377 '*rows': 'int' },
dbeee392
MA
378 'base': 'ChardevCommon' }
379
380##
381# @ChardevRingbuf:
382#
383# Configuration info for ring buffer chardevs.
384#
385# @size: ring buffer size, must be power of two, default is 65536
386#
387# Since: 1.5
388##
b0ddeba2
MAL
389{ 'struct': 'ChardevRingbuf',
390 'data': { '*size': 'int' },
dbeee392
MA
391 'base': 'ChardevCommon' }
392
de74a22c
GH
393##
394# @ChardevQemuVDAgent:
395#
396# Configuration info for qemu vdagent implementation.
397#
56081919 398# @mouse: enable/disable mouse, default is enabled.
f0349f4d 399# @clipboard: enable/disable clipboard, default is disabled.
56081919 400#
de74a22c
GH
401# Since: 6.1
402#
403##
404{ 'struct': 'ChardevQemuVDAgent',
f0349f4d
GH
405 'data': { '*mouse': 'bool',
406 '*clipboard': 'bool' },
de74a22c
GH
407 'base': 'ChardevCommon',
408 'if': 'defined(CONFIG_SPICE_PROTOCOL)' }
409
dbeee392
MA
410##
411# @ChardevBackend:
412#
413# Configuration info for the new chardev backend.
414#
de74a22c 415# Since: 1.4 (testdev since 2.2, wctablet since 2.9, vdagent since 6.1)
dbeee392 416##
b0ddeba2
MAL
417{ 'union': 'ChardevBackend',
418 'data': { 'file': 'ChardevFile',
419 'serial': 'ChardevHostdev',
420 'parallel': 'ChardevHostdev',
421 'pipe': 'ChardevHostdev',
422 'socket': 'ChardevSocket',
423 'udp': 'ChardevUdp',
424 'pty': 'ChardevCommon',
425 'null': 'ChardevCommon',
426 'mux': 'ChardevMux',
427 'msmouse': 'ChardevCommon',
428 'wctablet': 'ChardevCommon',
429 'braille': 'ChardevCommon',
430 'testdev': 'ChardevCommon',
431 'stdio': 'ChardevStdio',
432 'console': 'ChardevCommon',
fd9dda3b
MAL
433 'spicevmc': { 'type': 'ChardevSpiceChannel',
434 'if': 'defined(CONFIG_SPICE)' },
435 'spiceport': { 'type': 'ChardevSpicePort',
436 'if': 'defined(CONFIG_SPICE)' },
de74a22c
GH
437 'qemu-vdagent': { 'type': 'ChardevQemuVDAgent',
438 'if': 'defined(CONFIG_SPICE_PROTOCOL)' },
b0ddeba2
MAL
439 'vc': 'ChardevVC',
440 'ringbuf': 'ChardevRingbuf',
441 # next one is just for compatibility
442 'memory': 'ChardevRingbuf' } }
dbeee392
MA
443
444##
445# @ChardevReturn:
446#
447# Return info about the chardev backend just created.
448#
449# @pty: name of the slave pseudoterminal device, present if
450# and only if a chardev of type 'pty' was created
451#
452# Since: 1.4
453##
b0ddeba2
MAL
454{ 'struct' : 'ChardevReturn',
455 'data': { '*pty': 'str' } }
dbeee392
MA
456
457##
458# @chardev-add:
459#
460# Add a character device backend
461#
462# @id: the chardev's ID, must be unique
463# @backend: backend type and parameters
464#
465# Returns: ChardevReturn.
466#
467# Since: 1.4
468#
469# Example:
470#
471# -> { "execute" : "chardev-add",
472# "arguments" : { "id" : "foo",
473# "backend" : { "type" : "null", "data" : {} } } }
474# <- { "return": {} }
475#
476# -> { "execute" : "chardev-add",
477# "arguments" : { "id" : "bar",
478# "backend" : { "type" : "file",
479# "data" : { "out" : "/tmp/bar.log" } } } }
480# <- { "return": {} }
481#
482# -> { "execute" : "chardev-add",
483# "arguments" : { "id" : "baz",
484# "backend" : { "type" : "pty", "data" : {} } } }
485# <- { "return": { "pty" : "/dev/pty/42" } }
486#
487##
b0ddeba2
MAL
488{ 'command': 'chardev-add',
489 'data': { 'id': 'str',
490 'backend': 'ChardevBackend' },
dbeee392
MA
491 'returns': 'ChardevReturn' }
492
493##
494# @chardev-change:
495#
496# Change a character device backend
497#
498# @id: the chardev's ID, must exist
499# @backend: new backend type and parameters
500#
501# Returns: ChardevReturn.
502#
503# Since: 2.10
504#
505# Example:
506#
507# -> { "execute" : "chardev-change",
508# "arguments" : { "id" : "baz",
509# "backend" : { "type" : "pty", "data" : {} } } }
510# <- { "return": { "pty" : "/dev/pty/42" } }
511#
512# -> {"execute" : "chardev-change",
513# "arguments" : {
514# "id" : "charchannel2",
515# "backend" : {
516# "type" : "socket",
517# "data" : {
518# "addr" : {
519# "type" : "unix" ,
520# "data" : {
521# "path" : "/tmp/charchannel2.socket"
522# }
523# },
524# "server" : true,
525# "wait" : false }}}}
526# <- {"return": {}}
527#
528##
b0ddeba2
MAL
529{ 'command': 'chardev-change',
530 'data': { 'id': 'str',
531 'backend': 'ChardevBackend' },
dbeee392
MA
532 'returns': 'ChardevReturn' }
533
534##
535# @chardev-remove:
536#
537# Remove a character device backend
538#
539# @id: the chardev's ID, must exist and not be in use
540#
541# Returns: Nothing on success
542#
543# Since: 1.4
544#
545# Example:
546#
547# -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
548# <- { "return": {} }
549#
550##
b0ddeba2
MAL
551{ 'command': 'chardev-remove',
552 'data': { 'id': 'str' } }
dbeee392
MA
553
554##
555# @chardev-send-break:
556#
557# Send a break to a character device
558#
559# @id: the chardev's ID, must exist
560#
561# Returns: Nothing on success
562#
563# Since: 2.10
564#
565# Example:
566#
567# -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
568# <- { "return": {} }
569#
570##
b0ddeba2
MAL
571{ 'command': 'chardev-send-break',
572 'data': { 'id': 'str' } }
dbeee392
MA
573
574##
575# @VSERPORT_CHANGE:
576#
577# Emitted when the guest opens or closes a virtio-serial port.
578#
579# @id: device identifier of the virtio-serial port
580#
581# @open: true if the guest has opened the virtio-serial port
582#
382bd1cb
MA
583# Note: This event is rate-limited.
584#
dbeee392
MA
585# Since: 2.1
586#
587# Example:
588#
589# <- { "event": "VSERPORT_CHANGE",
590# "data": { "id": "channel0", "open": true },
591# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
592#
593##
594{ 'event': 'VSERPORT_CHANGE',
b0ddeba2
MAL
595 'data': { 'id': 'str',
596 'open': 'bool' } }