OSDN Git Service

qapi: fix example of query-spice command
[qmiga/qemu.git] / qapi / ui.json
1 # -*- Mode: Python -*-
2 # vim: filetype=python
3 #
4
5 ##
6 # = Remote desktop
7 ##
8
9 { 'include': 'common.json' }
10 { 'include': 'sockets.json' }
11
12 ##
13 # @DisplayProtocol:
14 #
15 # Display protocols which support changing password options.
16 #
17 # Since: 7.0
18 #
19 ##
20 { 'enum': 'DisplayProtocol',
21   'data': [ 'vnc', 'spice' ] }
22
23 ##
24 # @SetPasswordAction:
25 #
26 # An action to take on changing a password on a connection with active clients.
27 #
28 # @keep: maintain existing clients
29 #
30 # @fail: fail the command if clients are connected
31 #
32 # @disconnect: disconnect existing clients
33 #
34 # Since: 7.0
35 #
36 ##
37 { 'enum': 'SetPasswordAction',
38   'data': [ 'keep', 'fail', 'disconnect' ] }
39
40 ##
41 # @SetPasswordOptions:
42 #
43 # Options for set_password.
44 #
45 # @protocol: - 'vnc' to modify the VNC server password
46 #            - 'spice' to modify the Spice server password
47 #
48 # @password: the new password
49 #
50 # @connected: How to handle existing clients when changing the
51 #             password. If nothing is specified, defaults to 'keep'.
52 #             For VNC, only 'keep' is currently implemented.
53 #
54 # Since: 7.0
55 #
56 ##
57 { 'union': 'SetPasswordOptions',
58   'base': { 'protocol': 'DisplayProtocol',
59             'password': 'str',
60             '*connected': 'SetPasswordAction' },
61   'discriminator': 'protocol',
62   'data': { 'vnc': 'SetPasswordOptionsVnc' } }
63
64 ##
65 # @SetPasswordOptionsVnc:
66 #
67 # Options for set_password specific to the VNC procotol.
68 #
69 # @display: The id of the display where the password should be changed.
70 #           Defaults to the first.
71 #
72 # Since: 7.0
73 #
74 ##
75 { 'struct': 'SetPasswordOptionsVnc',
76   'data': { '*display': 'str' } }
77
78 ##
79 # @set_password:
80 #
81 # Set the password of a remote display server.
82 #
83 # Returns: - Nothing on success
84 #          - If Spice is not enabled, DeviceNotFound
85 #
86 # Since: 0.14
87 #
88 # Example:
89 #
90 # -> { "execute": "set_password", "arguments": { "protocol": "vnc",
91 #                                                "password": "secret" } }
92 # <- { "return": {} }
93 #
94 ##
95 { 'command': 'set_password', 'boxed': true, 'data': 'SetPasswordOptions' }
96
97 ##
98 # @ExpirePasswordOptions:
99 #
100 # General options for expire_password.
101 #
102 # @protocol: - 'vnc' to modify the VNC server expiration
103 #            - 'spice' to modify the Spice server expiration
104 #
105 # @time: when to expire the password.
106 #
107 #        - 'now' to expire the password immediately
108 #        - 'never' to cancel password expiration
109 #        - '+INT' where INT is the number of seconds from now (integer)
110 #        - 'INT' where INT is the absolute time in seconds
111 #
112 # Notes: Time is relative to the server and currently there is no way to
113 #        coordinate server time with client time.  It is not recommended to
114 #        use the absolute time version of the @time parameter unless you're
115 #        sure you are on the same machine as the QEMU instance.
116 #
117 # Since: 7.0
118 #
119 ##
120 { 'union': 'ExpirePasswordOptions',
121   'base': { 'protocol': 'DisplayProtocol',
122             'time': 'str' },
123   'discriminator': 'protocol',
124   'data': { 'vnc': 'ExpirePasswordOptionsVnc' } }
125
126 ##
127 # @ExpirePasswordOptionsVnc:
128 #
129 # Options for expire_password specific to the VNC procotol.
130 #
131 # @display: The id of the display where the expiration should be changed.
132 #           Defaults to the first.
133 #
134 # Since: 7.0
135 #
136 ##
137
138 { 'struct': 'ExpirePasswordOptionsVnc',
139   'data': { '*display': 'str' } }
140
141 ##
142 # @expire_password:
143 #
144 # Expire the password of a remote display server.
145 #
146 # Returns: - Nothing on success
147 #          - If @protocol is 'spice' and Spice is not active, DeviceNotFound
148 #
149 # Since: 0.14
150 #
151 # Example:
152 #
153 # -> { "execute": "expire_password", "arguments": { "protocol": "vnc",
154 #                                                   "time": "+60" } }
155 # <- { "return": {} }
156 #
157 ##
158 { 'command': 'expire_password', 'boxed': true, 'data': 'ExpirePasswordOptions' }
159
160 ##
161 # @screendump:
162 #
163 # Write a PPM of the VGA screen to a file.
164 #
165 # @filename: the path of a new PPM file to store the image
166 #
167 # @device: ID of the display device that should be dumped. If this parameter
168 #          is missing, the primary display will be used. (Since 2.12)
169 #
170 # @head: head to use in case the device supports multiple heads. If this
171 #        parameter is missing, head #0 will be used. Also note that the head
172 #        can only be specified in conjunction with the device ID. (Since 2.12)
173 #
174 # Returns: Nothing on success
175 #
176 # Since: 0.14
177 #
178 # Example:
179 #
180 # -> { "execute": "screendump",
181 #      "arguments": { "filename": "/tmp/image" } }
182 # <- { "return": {} }
183 #
184 ##
185 { 'command': 'screendump',
186   'data': {'filename': 'str', '*device': 'str', '*head': 'int'},
187   'coroutine': true }
188
189 ##
190 # == Spice
191 ##
192
193 ##
194 # @SpiceBasicInfo:
195 #
196 # The basic information for SPICE network connection
197 #
198 # @host: IP address
199 #
200 # @port: port number
201 #
202 # @family: address family
203 #
204 # Since: 2.1
205 ##
206 { 'struct': 'SpiceBasicInfo',
207   'data': { 'host': 'str',
208             'port': 'str',
209             'family': 'NetworkAddressFamily' },
210   'if': 'CONFIG_SPICE' }
211
212 ##
213 # @SpiceServerInfo:
214 #
215 # Information about a SPICE server
216 #
217 # @auth: authentication method
218 #
219 # Since: 2.1
220 ##
221 { 'struct': 'SpiceServerInfo',
222   'base': 'SpiceBasicInfo',
223   'data': { '*auth': 'str' },
224   'if': 'CONFIG_SPICE' }
225
226 ##
227 # @SpiceChannel:
228 #
229 # Information about a SPICE client channel.
230 #
231 # @connection-id: SPICE connection id number.  All channels with the same id
232 #                 belong to the same SPICE session.
233 #
234 # @channel-type: SPICE channel type number.  "1" is the main control
235 #                channel, filter for this one if you want to track spice
236 #                sessions only
237 #
238 # @channel-id: SPICE channel ID number.  Usually "0", might be different when
239 #              multiple channels of the same type exist, such as multiple
240 #              display channels in a multihead setup
241 #
242 # @tls: true if the channel is encrypted, false otherwise.
243 #
244 # Since: 0.14
245 ##
246 { 'struct': 'SpiceChannel',
247   'base': 'SpiceBasicInfo',
248   'data': {'connection-id': 'int', 'channel-type': 'int', 'channel-id': 'int',
249            'tls': 'bool'},
250   'if': 'CONFIG_SPICE' }
251
252 ##
253 # @SpiceQueryMouseMode:
254 #
255 # An enumeration of Spice mouse states.
256 #
257 # @client: Mouse cursor position is determined by the client.
258 #
259 # @server: Mouse cursor position is determined by the server.
260 #
261 # @unknown: No information is available about mouse mode used by
262 #           the spice server.
263 #
264 # Note: spice/enums.h has a SpiceMouseMode already, hence the name.
265 #
266 # Since: 1.1
267 ##
268 { 'enum': 'SpiceQueryMouseMode',
269   'data': [ 'client', 'server', 'unknown' ],
270   'if': 'CONFIG_SPICE' }
271
272 ##
273 # @SpiceInfo:
274 #
275 # Information about the SPICE session.
276 #
277 # @enabled: true if the SPICE server is enabled, false otherwise
278 #
279 # @migrated: true if the last guest migration completed and spice
280 #            migration had completed as well. false otherwise. (since 1.4)
281 #
282 # @host: The hostname the SPICE server is bound to.  This depends on
283 #        the name resolution on the host and may be an IP address.
284 #
285 # @port: The SPICE server's port number.
286 #
287 # @compiled-version: SPICE server version.
288 #
289 # @tls-port: The SPICE server's TLS port number.
290 #
291 # @auth: the current authentication type used by the server
292 #
293 #        - 'none'  if no authentication is being used
294 #        - 'spice' uses SASL or direct TLS authentication, depending on command
295 #          line options
296 #
297 # @mouse-mode: The mode in which the mouse cursor is displayed currently. Can
298 #              be determined by the client or the server, or unknown if spice
299 #              server doesn't provide this information. (since: 1.1)
300 #
301 # @channels: a list of @SpiceChannel for each active spice channel
302 #
303 # Since: 0.14
304 ##
305 { 'struct': 'SpiceInfo',
306   'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',
307            '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
308            'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},
309   'if': 'CONFIG_SPICE' }
310
311 ##
312 # @query-spice:
313 #
314 # Returns information about the current SPICE server
315 #
316 # Returns: @SpiceInfo
317 #
318 # Since: 0.14
319 #
320 # Example:
321 #
322 # -> { "execute": "query-spice" }
323 # <- { "return": {
324 #          "enabled": true,
325 #          "auth": "spice",
326 #          "port": 5920,
327 #          "migrated":false,
328 #          "tls-port": 5921,
329 #          "host": "0.0.0.0",
330 #          "mouse-mode":"client",
331 #          "channels": [
332 #             {
333 #                "port": "54924",
334 #                "family": "ipv4",
335 #                "channel-type": 1,
336 #                "connection-id": 1804289383,
337 #                "host": "127.0.0.1",
338 #                "channel-id": 0,
339 #                "tls": true
340 #             },
341 #             {
342 #                "port": "36710",
343 #                "family": "ipv4",
344 #                "channel-type": 4,
345 #                "connection-id": 1804289383,
346 #                "host": "127.0.0.1",
347 #                "channel-id": 0,
348 #                "tls": false
349 #             },
350 #             [ ... more channels follow ... ]
351 #          ]
352 #       }
353 #    }
354 #
355 ##
356 { 'command': 'query-spice', 'returns': 'SpiceInfo',
357   'if': 'CONFIG_SPICE' }
358
359 ##
360 # @SPICE_CONNECTED:
361 #
362 # Emitted when a SPICE client establishes a connection
363 #
364 # @server: server information
365 #
366 # @client: client information
367 #
368 # Since: 0.14
369 #
370 # Example:
371 #
372 # <- { "timestamp": {"seconds": 1290688046, "microseconds": 388707},
373 #      "event": "SPICE_CONNECTED",
374 #      "data": {
375 #        "server": { "port": "5920", "family": "ipv4", "host": "127.0.0.1"},
376 #        "client": {"port": "52873", "family": "ipv4", "host": "127.0.0.1"}
377 #    }}
378 #
379 ##
380 { 'event': 'SPICE_CONNECTED',
381   'data': { 'server': 'SpiceBasicInfo',
382             'client': 'SpiceBasicInfo' },
383   'if': 'CONFIG_SPICE' }
384
385 ##
386 # @SPICE_INITIALIZED:
387 #
388 # Emitted after initial handshake and authentication takes place (if any)
389 # and the SPICE channel is up and running
390 #
391 # @server: server information
392 #
393 # @client: client information
394 #
395 # Since: 0.14
396 #
397 # Example:
398 #
399 # <- { "timestamp": {"seconds": 1290688046, "microseconds": 417172},
400 #      "event": "SPICE_INITIALIZED",
401 #      "data": {"server": {"auth": "spice", "port": "5921",
402 #                          "family": "ipv4", "host": "127.0.0.1"},
403 #               "client": {"port": "49004", "family": "ipv4", "channel-type": 3,
404 #                          "connection-id": 1804289383, "host": "127.0.0.1",
405 #                          "channel-id": 0, "tls": true}
406 #    }}
407 #
408 ##
409 { 'event': 'SPICE_INITIALIZED',
410   'data': { 'server': 'SpiceServerInfo',
411             'client': 'SpiceChannel' },
412   'if': 'CONFIG_SPICE' }
413
414 ##
415 # @SPICE_DISCONNECTED:
416 #
417 # Emitted when the SPICE connection is closed
418 #
419 # @server: server information
420 #
421 # @client: client information
422 #
423 # Since: 0.14
424 #
425 # Example:
426 #
427 # <- { "timestamp": {"seconds": 1290688046, "microseconds": 388707},
428 #      "event": "SPICE_DISCONNECTED",
429 #      "data": {
430 #        "server": { "port": "5920", "family": "ipv4", "host": "127.0.0.1"},
431 #        "client": {"port": "52873", "family": "ipv4", "host": "127.0.0.1"}
432 #    }}
433 #
434 ##
435 { 'event': 'SPICE_DISCONNECTED',
436   'data': { 'server': 'SpiceBasicInfo',
437             'client': 'SpiceBasicInfo' },
438   'if': 'CONFIG_SPICE' }
439
440 ##
441 # @SPICE_MIGRATE_COMPLETED:
442 #
443 # Emitted when SPICE migration has completed
444 #
445 # Since: 1.3
446 #
447 # Example:
448 #
449 # <- { "timestamp": {"seconds": 1290688046, "microseconds": 417172},
450 #      "event": "SPICE_MIGRATE_COMPLETED" }
451 #
452 ##
453 { 'event': 'SPICE_MIGRATE_COMPLETED',
454   'if': 'CONFIG_SPICE' }
455
456 ##
457 # == VNC
458 ##
459
460 ##
461 # @VncBasicInfo:
462 #
463 # The basic information for vnc network connection
464 #
465 # @host: IP address
466 #
467 # @service: The service name of the vnc port. This may depend on the host
468 #           system's service database so symbolic names should not be relied
469 #           on.
470 #
471 # @family: address family
472 #
473 # @websocket: true in case the socket is a websocket (since 2.3).
474 #
475 # Since: 2.1
476 ##
477 { 'struct': 'VncBasicInfo',
478   'data': { 'host': 'str',
479             'service': 'str',
480             'family': 'NetworkAddressFamily',
481             'websocket': 'bool' },
482   'if': 'CONFIG_VNC' }
483
484 ##
485 # @VncServerInfo:
486 #
487 # The network connection information for server
488 #
489 # @auth: authentication method used for
490 #        the plain (non-websocket) VNC server
491 #
492 # Since: 2.1
493 ##
494 { 'struct': 'VncServerInfo',
495   'base': 'VncBasicInfo',
496   'data': { '*auth': 'str' },
497   'if': 'CONFIG_VNC' }
498
499 ##
500 # @VncClientInfo:
501 #
502 # Information about a connected VNC client.
503 #
504 # @x509_dname: If x509 authentication is in use, the Distinguished
505 #              Name of the client.
506 #
507 # @sasl_username: If SASL authentication is in use, the SASL username
508 #                 used for authentication.
509 #
510 # Since: 0.14
511 ##
512 { 'struct': 'VncClientInfo',
513   'base': 'VncBasicInfo',
514   'data': { '*x509_dname': 'str', '*sasl_username': 'str' },
515   'if': 'CONFIG_VNC' }
516
517 ##
518 # @VncInfo:
519 #
520 # Information about the VNC session.
521 #
522 # @enabled: true if the VNC server is enabled, false otherwise
523 #
524 # @host: The hostname the VNC server is bound to.  This depends on
525 #        the name resolution on the host and may be an IP address.
526 #
527 # @family: - 'ipv6' if the host is listening for IPv6 connections
528 #          - 'ipv4' if the host is listening for IPv4 connections
529 #          - 'unix' if the host is listening on a unix domain socket
530 #          - 'unknown' otherwise
531 #
532 # @service: The service name of the server's port.  This may depends
533 #           on the host system's service database so symbolic names should not
534 #           be relied on.
535 #
536 # @auth: the current authentication type used by the server
537 #
538 #        - 'none' if no authentication is being used
539 #        - 'vnc' if VNC authentication is being used
540 #        - 'vencrypt+plain' if VEncrypt is used with plain text authentication
541 #        - 'vencrypt+tls+none' if VEncrypt is used with TLS and no authentication
542 #        - 'vencrypt+tls+vnc' if VEncrypt is used with TLS and VNC authentication
543 #        - 'vencrypt+tls+plain' if VEncrypt is used with TLS and plain text auth
544 #        - 'vencrypt+x509+none' if VEncrypt is used with x509 and no auth
545 #        - 'vencrypt+x509+vnc' if VEncrypt is used with x509 and VNC auth
546 #        - 'vencrypt+x509+plain' if VEncrypt is used with x509 and plain text auth
547 #        - 'vencrypt+tls+sasl' if VEncrypt is used with TLS and SASL auth
548 #        - 'vencrypt+x509+sasl' if VEncrypt is used with x509 and SASL auth
549 #
550 # @clients: a list of @VncClientInfo of all currently connected clients
551 #
552 # Since: 0.14
553 ##
554 { 'struct': 'VncInfo',
555   'data': {'enabled': 'bool', '*host': 'str',
556            '*family': 'NetworkAddressFamily',
557            '*service': 'str', '*auth': 'str', '*clients': ['VncClientInfo']},
558   'if': 'CONFIG_VNC' }
559
560 ##
561 # @VncPrimaryAuth:
562 #
563 # vnc primary authentication method.
564 #
565 # Since: 2.3
566 ##
567 { 'enum': 'VncPrimaryAuth',
568   'data': [ 'none', 'vnc', 'ra2', 'ra2ne', 'tight', 'ultra',
569             'tls', 'vencrypt', 'sasl' ],
570   'if': 'CONFIG_VNC' }
571
572 ##
573 # @VncVencryptSubAuth:
574 #
575 # vnc sub authentication method with vencrypt.
576 #
577 # Since: 2.3
578 ##
579 { 'enum': 'VncVencryptSubAuth',
580   'data': [ 'plain',
581             'tls-none',  'x509-none',
582             'tls-vnc',   'x509-vnc',
583             'tls-plain', 'x509-plain',
584             'tls-sasl',  'x509-sasl' ],
585   'if': 'CONFIG_VNC' }
586
587 ##
588 # @VncServerInfo2:
589 #
590 # The network connection information for server
591 #
592 # @auth: The current authentication type used by the servers
593 #
594 # @vencrypt: The vencrypt sub authentication type used by the
595 #            servers, only specified in case auth == vencrypt.
596 #
597 # Since: 2.9
598 ##
599 { 'struct': 'VncServerInfo2',
600   'base': 'VncBasicInfo',
601   'data': { 'auth'      : 'VncPrimaryAuth',
602             '*vencrypt' : 'VncVencryptSubAuth' },
603   'if': 'CONFIG_VNC' }
604
605 ##
606 # @VncInfo2:
607 #
608 # Information about a vnc server
609 #
610 # @id: vnc server name.
611 #
612 # @server: A list of @VncBasincInfo describing all listening sockets.
613 #          The list can be empty (in case the vnc server is disabled).
614 #          It also may have multiple entries: normal + websocket,
615 #          possibly also ipv4 + ipv6 in the future.
616 #
617 # @clients: A list of @VncClientInfo of all currently connected clients.
618 #           The list can be empty, for obvious reasons.
619 #
620 # @auth: The current authentication type used by the non-websockets servers
621 #
622 # @vencrypt: The vencrypt authentication type used by the servers,
623 #            only specified in case auth == vencrypt.
624 #
625 # @display: The display device the vnc server is linked to.
626 #
627 # Since: 2.3
628 ##
629 { 'struct': 'VncInfo2',
630   'data': { 'id'        : 'str',
631             'server'    : ['VncServerInfo2'],
632             'clients'   : ['VncClientInfo'],
633             'auth'      : 'VncPrimaryAuth',
634             '*vencrypt' : 'VncVencryptSubAuth',
635             '*display'  : 'str' },
636   'if': 'CONFIG_VNC' }
637
638 ##
639 # @query-vnc:
640 #
641 # Returns information about the current VNC server
642 #
643 # Returns: @VncInfo
644 #
645 # Since: 0.14
646 #
647 # Example:
648 #
649 # -> { "execute": "query-vnc" }
650 # <- { "return": {
651 #          "enabled":true,
652 #          "host":"0.0.0.0",
653 #          "service":"50402",
654 #          "auth":"vnc",
655 #          "family":"ipv4",
656 #          "clients":[
657 #             {
658 #                "host":"127.0.0.1",
659 #                "service":"50401",
660 #                "family":"ipv4"
661 #             }
662 #          ]
663 #       }
664 #    }
665 #
666 ##
667 { 'command': 'query-vnc', 'returns': 'VncInfo',
668   'if': 'CONFIG_VNC' }
669 ##
670 # @query-vnc-servers:
671 #
672 # Returns a list of vnc servers.  The list can be empty.
673 #
674 # Returns: a list of @VncInfo2
675 #
676 # Since: 2.3
677 ##
678 { 'command': 'query-vnc-servers', 'returns': ['VncInfo2'],
679   'if': 'CONFIG_VNC' }
680
681 ##
682 # @change-vnc-password:
683 #
684 # Change the VNC server password.
685 #
686 # @password: the new password to use with VNC authentication
687 #
688 # Since: 1.1
689 #
690 # Notes: An empty password in this command will set the password to the empty
691 #        string.  Existing clients are unaffected by executing this command.
692 ##
693 { 'command': 'change-vnc-password',
694   'data': { 'password': 'str' },
695   'if': 'CONFIG_VNC' }
696
697 ##
698 # @VNC_CONNECTED:
699 #
700 # Emitted when a VNC client establishes a connection
701 #
702 # @server: server information
703 #
704 # @client: client information
705 #
706 # Note: This event is emitted before any authentication takes place, thus
707 #       the authentication ID is not provided
708 #
709 # Since: 0.13
710 #
711 # Example:
712 #
713 # <- { "event": "VNC_CONNECTED",
714 #      "data": {
715 #            "server": { "auth": "sasl", "family": "ipv4", "websocket": false,
716 #                        "service": "5901", "host": "0.0.0.0" },
717 #            "client": { "family": "ipv4", "service": "58425",
718 #                        "host": "127.0.0.1", "websocket": false } },
719 #      "timestamp": { "seconds": 1262976601, "microseconds": 975795 } }
720 #
721 ##
722 { 'event': 'VNC_CONNECTED',
723   'data': { 'server': 'VncServerInfo',
724             'client': 'VncBasicInfo' },
725   'if': 'CONFIG_VNC' }
726
727 ##
728 # @VNC_INITIALIZED:
729 #
730 # Emitted after authentication takes place (if any) and the VNC session is
731 # made active
732 #
733 # @server: server information
734 #
735 # @client: client information
736 #
737 # Since: 0.13
738 #
739 # Example:
740 #
741 # <-  { "event": "VNC_INITIALIZED",
742 #       "data": {
743 #            "server": { "auth": "sasl", "family": "ipv4", "websocket": false,
744 #                        "service": "5901", "host": "0.0.0.0"},
745 #            "client": { "family": "ipv4", "service": "46089", "websocket": false,
746 #                        "host": "127.0.0.1", "sasl_username": "luiz" } },
747 #       "timestamp": { "seconds": 1263475302, "microseconds": 150772 } }
748 #
749 ##
750 { 'event': 'VNC_INITIALIZED',
751   'data': { 'server': 'VncServerInfo',
752             'client': 'VncClientInfo' },
753   'if': 'CONFIG_VNC' }
754
755 ##
756 # @VNC_DISCONNECTED:
757 #
758 # Emitted when the connection is closed
759 #
760 # @server: server information
761 #
762 # @client: client information
763 #
764 # Since: 0.13
765 #
766 # Example:
767 #
768 # <- { "event": "VNC_DISCONNECTED",
769 #      "data": {
770 #            "server": { "auth": "sasl", "family": "ipv4", "websocket": false,
771 #                        "service": "5901", "host": "0.0.0.0" },
772 #            "client": { "family": "ipv4", "service": "58425", "websocket": false,
773 #                        "host": "127.0.0.1", "sasl_username": "luiz" } },
774 #      "timestamp": { "seconds": 1262976601, "microseconds": 975795 } }
775 #
776 ##
777 { 'event': 'VNC_DISCONNECTED',
778   'data': { 'server': 'VncServerInfo',
779             'client': 'VncClientInfo' },
780   'if': 'CONFIG_VNC' }
781
782 ##
783 # = Input
784 ##
785
786 ##
787 # @MouseInfo:
788 #
789 # Information about a mouse device.
790 #
791 # @name: the name of the mouse device
792 #
793 # @index: the index of the mouse device
794 #
795 # @current: true if this device is currently receiving mouse events
796 #
797 # @absolute: true if this device supports absolute coordinates as input
798 #
799 # Since: 0.14
800 ##
801 { 'struct': 'MouseInfo',
802   'data': {'name': 'str', 'index': 'int', 'current': 'bool',
803            'absolute': 'bool'} }
804
805 ##
806 # @query-mice:
807 #
808 # Returns information about each active mouse device
809 #
810 # Returns: a list of @MouseInfo for each device
811 #
812 # Since: 0.14
813 #
814 # Example:
815 #
816 # -> { "execute": "query-mice" }
817 # <- { "return": [
818 #          {
819 #             "name":"QEMU Microsoft Mouse",
820 #             "index":0,
821 #             "current":false,
822 #             "absolute":false
823 #          },
824 #          {
825 #             "name":"QEMU PS/2 Mouse",
826 #             "index":1,
827 #             "current":true,
828 #             "absolute":true
829 #          }
830 #       ]
831 #    }
832 #
833 ##
834 { 'command': 'query-mice', 'returns': ['MouseInfo'] }
835
836 ##
837 # @QKeyCode:
838 #
839 # An enumeration of key name.
840 #
841 # This is used by the @send-key command.
842 #
843 # @unmapped: since 2.0
844 # @pause: since 2.0
845 # @ro: since 2.4
846 # @kp_comma: since 2.4
847 # @kp_equals: since 2.6
848 # @power: since 2.6
849 # @hiragana: since 2.9
850 # @henkan: since 2.9
851 # @yen: since 2.9
852 #
853 # @sleep: since 2.10
854 # @wake: since 2.10
855 # @audionext: since 2.10
856 # @audioprev: since 2.10
857 # @audiostop: since 2.10
858 # @audioplay: since 2.10
859 # @audiomute: since 2.10
860 # @volumeup: since 2.10
861 # @volumedown: since 2.10
862 # @mediaselect: since 2.10
863 # @mail: since 2.10
864 # @calculator: since 2.10
865 # @computer: since 2.10
866 # @ac_home: since 2.10
867 # @ac_back: since 2.10
868 # @ac_forward: since 2.10
869 # @ac_refresh: since 2.10
870 # @ac_bookmarks: since 2.10
871 #
872 # @muhenkan: since 2.12
873 # @katakanahiragana: since 2.12
874 #
875 # @lang1: since 6.1
876 # @lang2: since 6.1
877 #
878 # 'sysrq' was mistakenly added to hack around the fact that
879 # the ps2 driver was not generating correct scancodes sequences
880 # when 'alt+print' was pressed. This flaw is now fixed and the
881 # 'sysrq' key serves no further purpose. Any further use of
882 # 'sysrq' will be transparently changed to 'print', so they
883 # are effectively synonyms.
884 #
885 # Since: 1.3
886 #
887 ##
888 { 'enum': 'QKeyCode',
889   'data': [ 'unmapped',
890             'shift', 'shift_r', 'alt', 'alt_r', 'ctrl',
891             'ctrl_r', 'menu', 'esc', '1', '2', '3', '4', '5', '6', '7', '8',
892             '9', '0', 'minus', 'equal', 'backspace', 'tab', 'q', 'w', 'e',
893             'r', 't', 'y', 'u', 'i', 'o', 'p', 'bracket_left', 'bracket_right',
894             'ret', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'semicolon',
895             'apostrophe', 'grave_accent', 'backslash', 'z', 'x', 'c', 'v', 'b',
896             'n', 'm', 'comma', 'dot', 'slash', 'asterisk', 'spc', 'caps_lock',
897             'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10',
898             'num_lock', 'scroll_lock', 'kp_divide', 'kp_multiply',
899             'kp_subtract', 'kp_add', 'kp_enter', 'kp_decimal', 'sysrq', 'kp_0',
900             'kp_1', 'kp_2', 'kp_3', 'kp_4', 'kp_5', 'kp_6', 'kp_7', 'kp_8',
901             'kp_9', 'less', 'f11', 'f12', 'print', 'home', 'pgup', 'pgdn', 'end',
902             'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
903             'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
904             'lf', 'help', 'meta_l', 'meta_r', 'compose', 'pause',
905             'ro', 'hiragana', 'henkan', 'yen', 'muhenkan', 'katakanahiragana',
906             'kp_comma', 'kp_equals', 'power', 'sleep', 'wake',
907             'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute',
908             'volumeup', 'volumedown', 'mediaselect',
909             'mail', 'calculator', 'computer',
910             'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks',
911             'lang1', 'lang2' ] }
912
913 ##
914 # @KeyValueKind:
915 #
916 # Since: 1.3
917 ##
918 { 'enum': 'KeyValueKind',
919   'data': [ 'number', 'qcode' ] }
920
921 ##
922 # @IntWrapper:
923 #
924 # Since: 1.3
925 ##
926 { 'struct': 'IntWrapper',
927   'data': { 'data': 'int' } }
928
929 ##
930 # @QKeyCodeWrapper:
931 #
932 # Since: 1.3
933 ##
934 { 'struct': 'QKeyCodeWrapper',
935   'data': { 'data': 'QKeyCode' } }
936
937 ##
938 # @KeyValue:
939 #
940 # Represents a keyboard key.
941 #
942 # Since: 1.3
943 ##
944 { 'union': 'KeyValue',
945   'base': { 'type': 'KeyValueKind' },
946   'discriminator': 'type',
947   'data': {
948     'number': 'IntWrapper',
949     'qcode': 'QKeyCodeWrapper' } }
950
951 ##
952 # @send-key:
953 #
954 # Send keys to guest.
955 #
956 # @keys: An array of @KeyValue elements. All @KeyValues in this array are
957 #        simultaneously sent to the guest. A @KeyValue.number value is sent
958 #        directly to the guest, while @KeyValue.qcode must be a valid
959 #        @QKeyCode value
960 #
961 # @hold-time: time to delay key up events, milliseconds. Defaults
962 #             to 100
963 #
964 # Returns: - Nothing on success
965 #          - If key is unknown or redundant, InvalidParameter
966 #
967 # Since: 1.3
968 #
969 # Example:
970 #
971 # -> { "execute": "send-key",
972 #      "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
973 #                               { "type": "qcode", "data": "alt" },
974 #                               { "type": "qcode", "data": "delete" } ] } }
975 # <- { "return": {} }
976 #
977 ##
978 { 'command': 'send-key',
979   'data': { 'keys': ['KeyValue'], '*hold-time': 'int' } }
980
981 ##
982 # @InputButton:
983 #
984 # Button of a pointer input device (mouse, tablet).
985 #
986 # @side: front side button of a 5-button mouse (since 2.9)
987 #
988 # @extra: rear side button of a 5-button mouse (since 2.9)
989 #
990 # Since: 2.0
991 ##
992 { 'enum'  : 'InputButton',
993   'data'  : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side',
994   'extra', 'wheel-left', 'wheel-right' ] }
995
996 ##
997 # @InputAxis:
998 #
999 # Position axis of a pointer input device (mouse, tablet).
1000 #
1001 # Since: 2.0
1002 ##
1003 { 'enum'  : 'InputAxis',
1004   'data'  : [ 'x', 'y' ] }
1005
1006 ##
1007 # @InputKeyEvent:
1008 #
1009 # Keyboard input event.
1010 #
1011 # @key:    Which key this event is for.
1012 # @down:   True for key-down and false for key-up events.
1013 #
1014 # Since: 2.0
1015 ##
1016 { 'struct'  : 'InputKeyEvent',
1017   'data'  : { 'key'     : 'KeyValue',
1018               'down'    : 'bool' } }
1019
1020 ##
1021 # @InputBtnEvent:
1022 #
1023 # Pointer button input event.
1024 #
1025 # @button: Which button this event is for.
1026 # @down:   True for key-down and false for key-up events.
1027 #
1028 # Since: 2.0
1029 ##
1030 { 'struct'  : 'InputBtnEvent',
1031   'data'  : { 'button'  : 'InputButton',
1032               'down'    : 'bool' } }
1033
1034 ##
1035 # @InputMoveEvent:
1036 #
1037 # Pointer motion input event.
1038 #
1039 # @axis: Which axis is referenced by @value.
1040 # @value: Pointer position.  For absolute coordinates the
1041 #         valid range is 0 -> 0x7ffff
1042 #
1043 # Since: 2.0
1044 ##
1045 { 'struct'  : 'InputMoveEvent',
1046   'data'  : { 'axis'    : 'InputAxis',
1047               'value'   : 'int' } }
1048
1049 ##
1050 # @InputEventKind:
1051 #
1052 # Since: 2.0
1053 ##
1054 { 'enum': 'InputEventKind',
1055   'data': [ 'key', 'btn', 'rel', 'abs' ] }
1056
1057 ##
1058 # @InputKeyEventWrapper:
1059 #
1060 # Since: 2.0
1061 ##
1062 { 'struct': 'InputKeyEventWrapper',
1063   'data': { 'data': 'InputKeyEvent' } }
1064
1065 ##
1066 # @InputBtnEventWrapper:
1067 #
1068 # Since: 2.0
1069 ##
1070 { 'struct': 'InputBtnEventWrapper',
1071   'data': { 'data': 'InputBtnEvent' } }
1072
1073 ##
1074 # @InputMoveEventWrapper:
1075 #
1076 # Since: 2.0
1077 ##
1078 { 'struct': 'InputMoveEventWrapper',
1079   'data': { 'data': 'InputMoveEvent' } }
1080
1081 ##
1082 # @InputEvent:
1083 #
1084 # Input event union.
1085 #
1086 # @type: the input type, one of:
1087 #
1088 #        - 'key': Input event of Keyboard
1089 #        - 'btn': Input event of pointer buttons
1090 #        - 'rel': Input event of relative pointer motion
1091 #        - 'abs': Input event of absolute pointer motion
1092 #
1093 # Since: 2.0
1094 ##
1095 { 'union' : 'InputEvent',
1096   'base': { 'type': 'InputEventKind' },
1097   'discriminator': 'type',
1098   'data'  : { 'key'     : 'InputKeyEventWrapper',
1099               'btn'     : 'InputBtnEventWrapper',
1100               'rel'     : 'InputMoveEventWrapper',
1101               'abs'     : 'InputMoveEventWrapper' } }
1102
1103 ##
1104 # @input-send-event:
1105 #
1106 # Send input event(s) to guest.
1107 #
1108 # The @device and @head parameters can be used to send the input event
1109 # to specific input devices in case (a) multiple input devices of the
1110 # same kind are added to the virtual machine and (b) you have
1111 # configured input routing (see docs/multiseat.txt) for those input
1112 # devices.  The parameters work exactly like the device and head
1113 # properties of input devices.  If @device is missing, only devices
1114 # that have no input routing config are admissible.  If @device is
1115 # specified, both input devices with and without input routing config
1116 # are admissible, but devices with input routing config take
1117 # precedence.
1118 #
1119 # @device: display device to send event(s) to.
1120 # @head: head to send event(s) to, in case the
1121 #        display device supports multiple scanouts.
1122 # @events: List of InputEvent union.
1123 #
1124 # Returns: Nothing on success.
1125 #
1126 # Since: 2.6
1127 #
1128 # Note: The consoles are visible in the qom tree, under
1129 #       /backend/console[$index]. They have a device link and head property,
1130 #       so it is possible to map which console belongs to which device and
1131 #       display.
1132 #
1133 # Example:
1134 #
1135 # 1. Press left mouse button.
1136 #
1137 # -> { "execute": "input-send-event",
1138 #     "arguments": { "device": "video0",
1139 #                    "events": [ { "type": "btn",
1140 #                    "data" : { "down": true, "button": "left" } } ] } }
1141 # <- { "return": {} }
1142 #
1143 # -> { "execute": "input-send-event",
1144 #     "arguments": { "device": "video0",
1145 #                    "events": [ { "type": "btn",
1146 #                    "data" : { "down": false, "button": "left" } } ] } }
1147 # <- { "return": {} }
1148 #
1149 # 2. Press ctrl-alt-del.
1150 #
1151 # -> { "execute": "input-send-event",
1152 #      "arguments": { "events": [
1153 #         { "type": "key", "data" : { "down": true,
1154 #           "key": {"type": "qcode", "data": "ctrl" } } },
1155 #         { "type": "key", "data" : { "down": true,
1156 #           "key": {"type": "qcode", "data": "alt" } } },
1157 #         { "type": "key", "data" : { "down": true,
1158 #           "key": {"type": "qcode", "data": "delete" } } } ] } }
1159 # <- { "return": {} }
1160 #
1161 # 3. Move mouse pointer to absolute coordinates (20000, 400).
1162 #
1163 # -> { "execute": "input-send-event" ,
1164 #   "arguments": { "events": [
1165 #                { "type": "abs", "data" : { "axis": "x", "value" : 20000 } },
1166 #                { "type": "abs", "data" : { "axis": "y", "value" : 400 } } ] } }
1167 # <- { "return": {} }
1168 #
1169 ##
1170 { 'command': 'input-send-event',
1171   'data': { '*device': 'str',
1172             '*head'  : 'int',
1173             'events' : [ 'InputEvent' ] } }
1174
1175 ##
1176 # @DisplayGTK:
1177 #
1178 # GTK display options.
1179 #
1180 # @grab-on-hover: Grab keyboard input on mouse hover.
1181 # @zoom-to-fit: Zoom guest display to fit into the host window.  When
1182 #               turned off the host window will be resized instead.
1183 #               In case the display device can notify the guest on
1184 #               window resizes (virtio-gpu) this will default to "on",
1185 #               assuming the guest will resize the display to match
1186 #               the window size then.  Otherwise it defaults to "off".
1187 #               Since 3.1
1188 #
1189 # Since: 2.12
1190 #
1191 ##
1192 { 'struct'  : 'DisplayGTK',
1193   'data'    : { '*grab-on-hover' : 'bool',
1194                 '*zoom-to-fit'   : 'bool'  } }
1195
1196 ##
1197 # @DisplayEGLHeadless:
1198 #
1199 # EGL headless display options.
1200 #
1201 # @rendernode: Which DRM render node should be used. Default is the first
1202 #              available node on the host.
1203 #
1204 # Since: 3.1
1205 #
1206 ##
1207 { 'struct'  : 'DisplayEGLHeadless',
1208   'data'    : { '*rendernode' : 'str' } }
1209
1210 ##
1211 # @DisplayDBus:
1212 #
1213 # DBus display options.
1214 #
1215 # @addr: The D-Bus bus address (default to the session bus).
1216 #
1217 # @rendernode: Which DRM render node should be used. Default is the first
1218 #              available node on the host.
1219 #
1220 # @p2p: Whether to use peer-to-peer connections (accepted through
1221 #       ``add_client``).
1222 #
1223 # @audiodev: Use the specified DBus audiodev to export audio.
1224 #
1225 # Since: 7.0
1226 #
1227 ##
1228 { 'struct'  : 'DisplayDBus',
1229   'data'    : { '*rendernode' : 'str',
1230                 '*addr': 'str',
1231                 '*p2p': 'bool',
1232                 '*audiodev': 'str' } }
1233
1234  ##
1235  # @DisplayGLMode:
1236  #
1237  # Display OpenGL mode.
1238  #
1239  # @off: Disable OpenGL (default).
1240  # @on: Use OpenGL, pick context type automatically.
1241  #      Would better be named 'auto' but is called 'on' for backward
1242  #      compatibility with bool type.
1243  # @core: Use OpenGL with Core (desktop) Context.
1244  # @es: Use OpenGL with ES (embedded systems) Context.
1245  #
1246  # Since: 3.0
1247  #
1248  ##
1249 { 'enum'    : 'DisplayGLMode',
1250   'data'    : [ 'off', 'on', 'core', 'es' ] }
1251
1252 ##
1253 # @DisplayCurses:
1254 #
1255 # Curses display options.
1256 #
1257 # @charset:       Font charset used by guest (default: CP437).
1258 #
1259 # Since: 4.0
1260 #
1261 ##
1262 { 'struct'  : 'DisplayCurses',
1263   'data'    : { '*charset'       : 'str' } }
1264
1265 ##
1266 # @DisplayCocoa:
1267 #
1268 # Cocoa display options.
1269 #
1270 # @left-command-key: Enable/disable forwarding of left command key to
1271 #                    guest. Allows command-tab window switching on the
1272 #                    host without sending this key to the guest when
1273 #                    "off". Defaults to "on"
1274 #
1275 # @full-grab: Capture all key presses, including system combos. This
1276 #             requires accessibility permissions, since it performs
1277 #             a global grab on key events. (default: off)
1278 #             See https://support.apple.com/en-in/guide/mac-help/mh32356/mac
1279 #
1280 # @swap-opt-cmd: Swap the Option and Command keys so that their key codes match
1281 #                their position on non-Mac keyboards and you can use Meta/Super
1282 #                and Alt where you expect them. (default: off)
1283 #
1284 # Since: 7.0
1285 ##
1286 { 'struct': 'DisplayCocoa',
1287   'data': {
1288       '*left-command-key': 'bool',
1289       '*full-grab': 'bool',
1290       '*swap-opt-cmd': 'bool'
1291   } }
1292
1293 ##
1294 # @DisplayType:
1295 #
1296 # Display (user interface) type.
1297 #
1298 # @default: The default user interface, selecting from the first available
1299 #           of gtk, sdl, cocoa, and vnc.
1300 #
1301 # @none: No user interface or video output display. The guest will
1302 #        still see an emulated graphics card, but its output will not
1303 #        be displayed to the QEMU user.
1304 #
1305 # @gtk: The GTK user interface.
1306 #
1307 # @sdl: The SDL user interface.
1308 #
1309 # @egl-headless: No user interface, offload GL operations to a local
1310 #                DRI device. Graphical display need to be paired with
1311 #                VNC or Spice. (Since 3.1)
1312 #
1313 # @curses: Display video output via curses.  For graphics device
1314 #          models which support a text mode, QEMU can display this
1315 #          output using a curses/ncurses interface. Nothing is
1316 #          displayed when the graphics device is in graphical mode or
1317 #          if the graphics device does not support a text
1318 #          mode. Generally only the VGA device models support text
1319 #          mode.
1320 #
1321 # @cocoa: The Cocoa user interface.
1322 #
1323 # @spice-app: Set up a Spice server and run the default associated
1324 #             application to connect to it. The server will redirect
1325 #             the serial console and QEMU monitors. (Since 4.0)
1326 #
1327 # @dbus: Start a D-Bus service for the display. (Since 7.0)
1328 #
1329 # Since: 2.12
1330 #
1331 ##
1332 { 'enum'    : 'DisplayType',
1333   'data'    : [
1334     { 'name': 'default' },
1335     { 'name': 'none' },
1336     { 'name': 'gtk', 'if': 'CONFIG_GTK' },
1337     { 'name': 'sdl', 'if': 'CONFIG_SDL' },
1338     { 'name': 'egl-headless',
1339               'if': { 'all': ['CONFIG_OPENGL', 'CONFIG_GBM'] } },
1340     { 'name': 'curses', 'if': 'CONFIG_CURSES' },
1341     { 'name': 'cocoa', 'if': 'CONFIG_COCOA' },
1342     { 'name': 'spice-app', 'if': 'CONFIG_SPICE' },
1343     { 'name': 'dbus', 'if': 'CONFIG_DBUS_DISPLAY' }
1344   ]
1345 }
1346
1347 ##
1348 # @DisplayOptions:
1349 #
1350 # Display (user interface) options.
1351 #
1352 # @type:          Which DisplayType qemu should use.
1353 # @full-screen:   Start user interface in fullscreen mode (default: off).
1354 # @window-close:  Allow to quit qemu with window close button (default: on).
1355 # @show-cursor:   Force showing the mouse cursor (default: off).
1356 #                 (since: 5.0)
1357 # @gl:            Enable OpenGL support (default: off).
1358 #
1359 # Since: 2.12
1360 #
1361 ##
1362 { 'union'   : 'DisplayOptions',
1363   'base'    : { 'type'           : 'DisplayType',
1364                 '*full-screen'   : 'bool',
1365                 '*window-close'  : 'bool',
1366                 '*show-cursor'   : 'bool',
1367                 '*gl'            : 'DisplayGLMode' },
1368   'discriminator' : 'type',
1369   'data'    : {
1370       'gtk': { 'type': 'DisplayGTK', 'if': 'CONFIG_GTK' },
1371       'cocoa': { 'type': 'DisplayCocoa', 'if': 'CONFIG_COCOA' },
1372       'curses': { 'type': 'DisplayCurses', 'if': 'CONFIG_CURSES' },
1373       'egl-headless': { 'type': 'DisplayEGLHeadless',
1374                         'if': { 'all': ['CONFIG_OPENGL', 'CONFIG_GBM'] } },
1375       'dbus': { 'type': 'DisplayDBus', 'if': 'CONFIG_DBUS_DISPLAY' }
1376   }
1377 }
1378
1379 ##
1380 # @query-display-options:
1381 #
1382 # Returns information about display configuration
1383 #
1384 # Returns: @DisplayOptions
1385 #
1386 # Since: 3.1
1387 #
1388 ##
1389 { 'command': 'query-display-options',
1390   'returns': 'DisplayOptions' }
1391
1392 ##
1393 # @DisplayReloadType:
1394 #
1395 # Available DisplayReload types.
1396 #
1397 # @vnc: VNC display
1398 #
1399 # Since: 6.0
1400 #
1401 ##
1402 { 'enum': 'DisplayReloadType',
1403   'data': ['vnc'] }
1404
1405 ##
1406 # @DisplayReloadOptionsVNC:
1407 #
1408 # Specify the VNC reload options.
1409 #
1410 # @tls-certs: reload tls certs or not.
1411 #
1412 # Since: 6.0
1413 #
1414 ##
1415 { 'struct': 'DisplayReloadOptionsVNC',
1416   'data': { '*tls-certs': 'bool' } }
1417
1418 ##
1419 # @DisplayReloadOptions:
1420 #
1421 # Options of the display configuration reload.
1422 #
1423 # @type: Specify the display type.
1424 #
1425 # Since: 6.0
1426 #
1427 ##
1428 { 'union': 'DisplayReloadOptions',
1429   'base': {'type': 'DisplayReloadType'},
1430   'discriminator': 'type',
1431   'data': { 'vnc': 'DisplayReloadOptionsVNC' } }
1432
1433 ##
1434 # @display-reload:
1435 #
1436 # Reload display configuration.
1437 #
1438 # Returns: Nothing on success.
1439 #
1440 # Since: 6.0
1441 #
1442 # Example:
1443 #
1444 # -> { "execute": "display-reload",
1445 #      "arguments": { "type": "vnc", "tls-certs": true  } }
1446 # <- { "return": {} }
1447 #
1448 ##
1449 { 'command': 'display-reload',
1450   'data': 'DisplayReloadOptions',
1451   'boxed' : true }