aboutsummaryrefslogtreecommitdiff
path: root/qapi/char.json
blob: ae19dcd1ed11209cf355700a12c26d93a409fad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# -*- Mode: Python -*-
#

##
# = Character devices
##

{ 'include': 'sockets.json' }

##
# @ChardevInfo:
#
# Information about a character device.
#
# @label: the label of the character device
#
# @filename: the filename of the character device
#
# @frontend-open: shows whether the frontend device attached to this backend
#                 (eg. with the chardev=... option) is in open or closed state
#                 (since 2.1)
#
# Notes: @filename is encoded using the QEMU command line character device
#        encoding.  See the QEMU man page for details.
#
# Since: 0.14.0
##
{ 'struct': 'ChardevInfo', 'data': {'label': 'str',
                                  'filename': 'str',
                                  'frontend-open': 'bool'} }

##
# @query-chardev:
#
# Returns information about current character devices.
#
# Returns: a list of @ChardevInfo
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "query-chardev" }
# <- {
#       "return": [
#          {
#             "label": "charchannel0",
#             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
#             "frontend-open": false
#          },
#          {
#             "label": "charmonitor",
#             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
#             "frontend-open": true
#          },
#          {
#             "label": "charserial0",
#             "filename": "pty:/dev/pts/2",
#             "frontend-open": true
#          }
#       ]
#    }
#
##
{ 'command': 'query-chardev', 'returns': ['ChardevInfo'] }

##
# @ChardevBackendInfo:
#
# Information about a character device backend
#
# @name: The backend name
#
# Since: 2.0
##
{ 'struct': 'ChardevBackendInfo', 'data': {'name': 'str'} }

##
# @query-chardev-backends:
#
# Returns information about character device backends.
#
# Returns: a list of @ChardevBackendInfo
#
# Since: 2.0
#
# Example:
#
# -> { "execute": "query-chardev-backends" }
# <- {
#       "return":[
#          {
#             "name":"udp"
#          },
#          {
#             "name":"tcp"
#          },
#          {
#             "name":"unix"
#          },
#          {
#             "name":"spiceport"
#          }
#       ]
#    }
#
##
{ 'command': 'query-chardev-backends', 'returns': ['ChardevBackendInfo'] }

##
# @DataFormat:
#
# An enumeration of data format.
#
# @utf8: Data is a UTF-8 string (RFC 3629)
#
# @base64: Data is Base64 encoded binary (RFC 3548)
#
# Since: 1.4
##
{ 'enum': 'DataFormat',
  'data': [ 'utf8', 'base64' ] }

##
# @ringbuf-write:
#
# Write to a ring buffer character device.
#
# @device: the ring buffer character device name
#
# @data: data to write
#
# @format: data encoding (default 'utf8').
#          - base64: data must be base64 encoded text.  Its binary
#            decoding gets written.
#          - utf8: data's UTF-8 encoding is written
#          - data itself is always Unicode regardless of format, like
#            any other string.
#
# Returns: Nothing on success
#
# Since: 1.4
#
# Example:
#
# -> { "execute": "ringbuf-write",
#      "arguments": { "device": "foo",
#                     "data": "abcdefgh",
#                     "format": "utf8" } }
# <- { "return": {} }
#
##
{ 'command': 'ringbuf-write',
  'data': {'device': 'str', 'data': 'str',
           '*format': 'DataFormat'} }

##
# @ringbuf-read:
#
# Read from a ring buffer character device.
#
# @device: the ring buffer character device name
#
# @size: how many bytes to read at most
#
# @format: data encoding (default 'utf8').
#          - base64: the data read is returned in base64 encoding.
#          - utf8: the data read is interpreted as UTF-8.
#            Bug: can screw up when the buffer contains invalid UTF-8
#            sequences, NUL characters, after the ring buffer lost
#            data, and when reading stops because the size limit is
#            reached.
#          - The return value is always Unicode regardless of format,
#            like any other string.
#
# Returns: data read from the device
#
# Since: 1.4
#
# Example:
#
# -> { "execute": "ringbuf-read",
#      "arguments": { "device": "foo",
#                     "size": 1000,
#                     "format": "utf8" } }
# <- { "return": "abcdefgh" }
#
##
{ 'command': 'ringbuf-read',
  'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
  'returns': 'str' }

##
# @ChardevCommon:
#
# Configuration shared across all chardev backends
#
# @logfile: The name of a logfile to save output
# @logappend: true to append instead of truncate
#             (default to false to truncate)
#
# Since: 2.6
##
{ 'struct': 'ChardevCommon', 'data': { '*logfile': 'str',
                                       '*logappend': 'bool' } }

##
# @ChardevFile:
#
# Configuration info for file chardevs.
#
# @in:  The name of the input file
# @out: The name of the output file
# @append: Open the file in append mode (default false to
#          truncate) (Since 2.6)
#
# Since: 1.4
##
{ 'struct': 'ChardevFile', 'data': { '*in' : 'str',
                                   'out' : 'str',
                                   '*append': 'bool' },
  'base': 'ChardevCommon' }

##
# @ChardevHostdev:
#
# Configuration info for device and pipe chardevs.
#
# @device: The name of the special file for the device,
#          i.e. /dev/ttyS0 on Unix or COM1: on Windows
#
# Since: 1.4
##
{ 'struct': 'ChardevHostdev', 'data': { 'device' : 'str' },
  'base': 'ChardevCommon' }

##
# @ChardevSocket:
#
# Configuration info for (stream) socket chardevs.
#
# @addr: socket address to listen on (server=true)
#        or connect to (server=false)
# @tls-creds: the ID of the TLS credentials object (since 2.6)
# @server: create server socket (default: true)
# @wait: wait for incoming connection on server
#        sockets (default: false).
# @nodelay: set TCP_NODELAY socket option (default: false)
# @telnet: enable telnet protocol on server
#          sockets (default: false)
# @tn3270: enable tn3270 protocol on server
#          sockets (default: false) (Since: 2.10)
# @reconnect: For a client socket, if a socket is disconnected,
#          then attempt a reconnect after the given number of seconds.
#          Setting this to zero disables this function. (default: 0)
#          (Since: 2.2)
#
# Since: 1.4
##
{ 'struct': 'ChardevSocket', 'data': { 'addr'       : 'SocketAddressLegacy',
                                     '*tls-creds'  : 'str',
                                     '*server'    : 'bool',
                                     '*wait'      : 'bool',
                                     '*nodelay'   : 'bool',
                                     '*telnet'    : 'bool',
                                     '*tn3270'    : 'bool',
                                     '*reconnect' : 'int' },
  'base': 'ChardevCommon' }

##
# @ChardevUdp:
#
# Configuration info for datagram socket chardevs.
#
# @remote: remote address
# @local: local address
#
# Since: 1.5
##
{ 'struct': 'ChardevUdp', 'data': { 'remote' : 'SocketAddressLegacy',
                                  '*local' : 'SocketAddressLegacy' },
  'base': 'ChardevCommon' }

##
# @ChardevMux:
#
# Configuration info for mux chardevs.
#
# @chardev: name of the base chardev.
#
# Since: 1.5
##
{ 'struct': 'ChardevMux', 'data': { 'chardev' : 'str' },
  'base': 'ChardevCommon' }

##
# @ChardevStdio:
#
# Configuration info for stdio chardevs.
#
# @signal: Allow signals (such as SIGINT triggered by ^C)
#          be delivered to qemu.  Default: true in -nographic mode,
#          false otherwise.
#
# Since: 1.5
##
{ 'struct': 'ChardevStdio', 'data': { '*signal' : 'bool' },
  'base': 'ChardevCommon' }


##
# @ChardevSpiceChannel:
#
# Configuration info for spice vm channel chardevs.
#
# @type: kind of channel (for example vdagent).
#
# Since: 1.5
##
{ 'struct': 'ChardevSpiceChannel', 'data': { 'type'  : 'str' },
  'base': 'ChardevCommon' }

##
# @ChardevSpicePort:
#
# Configuration info for spice port chardevs.
#
# @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
#
# Since: 1.5
##
{ 'struct': 'ChardevSpicePort', 'data': { 'fqdn'  : 'str' },
  'base': 'ChardevCommon' }

##
# @ChardevVC:
#
# Configuration info for virtual console chardevs.
#
# @width:  console width,  in pixels
# @height: console height, in pixels
# @cols:   console width,  in chars
# @rows:   console height, in chars
#
# Since: 1.5
##
{ 'struct': 'ChardevVC', 'data': { '*width'  : 'int',
                                 '*height' : 'int',
                                 '*cols'   : 'int',
                                 '*rows'   : 'int' },
  'base': 'ChardevCommon' }

##
# @ChardevRingbuf:
#
# Configuration info for ring buffer chardevs.
#
# @size: ring buffer size, must be power of two, default is 65536
#
# Since: 1.5
##
{ 'struct': 'ChardevRingbuf', 'data': { '*size'  : 'int' },
  'base': 'ChardevCommon' }

##
# @ChardevBackend:
#
# Configuration info for the new chardev backend.
#
# Since: 1.4 (testdev since 2.2, wctablet since 2.9)
##
{ 'union': 'ChardevBackend', 'data': { 'file'   : 'ChardevFile',
                                       'serial' : 'ChardevHostdev',
                                       'parallel': 'ChardevHostdev',
                                       'pipe'   : 'ChardevHostdev',
                                       'socket' : 'ChardevSocket',
                                       'udp'    : 'ChardevUdp',
                                       'pty'    : 'ChardevCommon',
                                       'null'   : 'ChardevCommon',
                                       'mux'    : 'ChardevMux',
                                       'msmouse': 'ChardevCommon',
                                       'wctablet' : 'ChardevCommon',
                                       'braille': 'ChardevCommon',
                                       'testdev': 'ChardevCommon',
                                       'stdio'  : 'ChardevStdio',
                                       'console': 'ChardevCommon',
                                       'spicevmc' : 'ChardevSpiceChannel',
                                       'spiceport' : 'ChardevSpicePort',
                                       'vc'     : 'ChardevVC',
                                       'ringbuf': 'ChardevRingbuf',
                                       # next one is just for compatibility
                                       'memory' : 'ChardevRingbuf' } }

##
# @ChardevReturn:
#
# Return info about the chardev backend just created.
#
# @pty: name of the slave pseudoterminal device, present if
#       and only if a chardev of type 'pty' was created
#
# Since: 1.4
##
{ 'struct' : 'ChardevReturn', 'data': { '*pty' : 'str' } }

##
# @chardev-add:
#
# Add a character device backend
#
# @id: the chardev's ID, must be unique
# @backend: backend type and parameters
#
# Returns: ChardevReturn.
#
# Since: 1.4
#
# Example:
#
# -> { "execute" : "chardev-add",
#      "arguments" : { "id" : "foo",
#                      "backend" : { "type" : "null", "data" : {} } } }
# <- { "return": {} }
#
# -> { "execute" : "chardev-add",
#      "arguments" : { "id" : "bar",
#                      "backend" : { "type" : "file",
#                                    "data" : { "out" : "/tmp/bar.log" } } } }
# <- { "return": {} }
#
# -> { "execute" : "chardev-add",
#      "arguments" : { "id" : "baz",
#                      "backend" : { "type" : "pty", "data" : {} } } }
# <- { "return": { "pty" : "/dev/pty/42" } }
#
##
{ 'command': 'chardev-add', 'data': {'id'      : 'str',
                                     'backend' : 'ChardevBackend' },
  'returns': 'ChardevReturn' }

##
# @chardev-change:
#
# Change a character device backend
#
# @id: the chardev's ID, must exist
# @backend: new backend type and parameters
#
# Returns: ChardevReturn.
#
# Since: 2.10
#
# Example:
#
# -> { "execute" : "chardev-change",
#      "arguments" : { "id" : "baz",
#                      "backend" : { "type" : "pty", "data" : {} } } }
# <- { "return": { "pty" : "/dev/pty/42" } }
#
# -> {"execute" : "chardev-change",
#     "arguments" : {
#         "id" : "charchannel2",
#         "backend" : {
#             "type" : "socket",
#             "data" : {
#                 "addr" : {
#                     "type" : "unix" ,
#                     "data" : {
#                         "path" : "/tmp/charchannel2.socket"
#                     }
#                  },
#                  "server" : true,
#                  "wait" : false }}}}
# <- {"return": {}}
#
##
{ 'command': 'chardev-change', 'data': {'id'      : 'str',
                                        'backend' : 'ChardevBackend' },
  'returns': 'ChardevReturn' }

##
# @chardev-remove:
#
# Remove a character device backend
#
# @id: the chardev's ID, must exist and not be in use
#
# Returns: Nothing on success
#
# Since: 1.4
#
# Example:
#
# -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
# <- { "return": {} }
#
##
{ 'command': 'chardev-remove', 'data': {'id': 'str'} }

##
# @chardev-send-break:
#
# Send a break to a character device
#
# @id: the chardev's ID, must exist
#
# Returns: Nothing on success
#
# Since: 2.10
#
# Example:
#
# -> { "execute": "chardev-send-break", "arguments": { "id" : "foo" } }
# <- { "return": {} }
#
##
{ 'command': 'chardev-send-break', 'data': {'id': 'str'} }

##
# @VSERPORT_CHANGE:
#
# Emitted when the guest opens or closes a virtio-serial port.
#
# @id: device identifier of the virtio-serial port
#
# @open: true if the guest has opened the virtio-serial port
#
# Since: 2.1
#
# Example:
#
# <- { "event": "VSERPORT_CHANGE",
#      "data": { "id": "channel0", "open": true },
#      "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
#
##
{ 'event': 'VSERPORT_CHANGE',
  'data': { 'id': 'str', 'open': 'bool' } }