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