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