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