Merge tag 'pull-sp-20240412' of https://gitlab.com/rth7680/qemu into staging
[qemu/armbru.git] / qapi / introspect.json
blobb041b02ba8c5036f90d94f08f4b7ac193b048a60
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 # Copyright (C) 2015 Red Hat, Inc.
6 # Authors:
7 #  Markus Armbruster <armbru@redhat.com>
9 # This work is licensed under the terms of the GNU GPL, version 2 or later.
10 # See the COPYING file in the top-level directory.
13 # = QMP introspection
17 # @query-qmp-schema:
19 # Command query-qmp-schema exposes the QMP wire ABI as an array of
20 # SchemaInfo.  This lets QMP clients figure out what commands and
21 # events are available in this QEMU, and their parameters and results.
23 # However, the SchemaInfo can't reflect all the rules and restrictions
24 # that apply to QMP.  It's interface introspection (figuring out
25 # what's there), not interface specification.  The specification is in
26 # the QAPI schema.
28 # Furthermore, while we strive to keep the QMP wire format
29 # backwards-compatible across qemu versions, the introspection output
30 # is not guaranteed to have the same stability.  For example, one
31 # version of qemu may list an object member as an optional
32 # non-variant, while another lists the same member only through the
33 # object's variants; or the type of a member may change from a generic
34 # string into a specific enum or from one specific type into an
35 # alternate that includes the original type alongside something else.
37 # Returns: array of @SchemaInfo, where each element describes an
38 #     entity in the ABI: command, event, type, ...
40 #     The order of the various SchemaInfo is unspecified; however, all
41 #     names are guaranteed to be unique (no name will be duplicated
42 #     with different meta-types).
44 # Note: the QAPI schema is also used to help define *internal*
45 #     interfaces, by defining QAPI types.  These are not part of the
46 #     QMP wire ABI, and therefore not returned by this command.
48 # Since: 2.5
50 { 'command': 'query-qmp-schema',
51   'returns': [ 'SchemaInfo' ],
52   'allow-preconfig': true }
55 # @SchemaMetaType:
57 # This is a @SchemaInfo's meta type, i.e. the kind of entity it
58 # describes.
60 # @builtin: a predefined type such as 'int' or 'bool'.
62 # @enum: an enumeration type
64 # @array: an array type
66 # @object: an object type (struct or union)
68 # @alternate: an alternate type
70 # @command: a QMP command
72 # @event: a QMP event
74 # Since: 2.5
76 { 'enum': 'SchemaMetaType',
77   'data': [ 'builtin', 'enum', 'array', 'object', 'alternate',
78             'command', 'event' ] }
81 # @SchemaInfo:
83 # @name: the entity's name, inherited from @base.  The SchemaInfo is
84 #     always referenced by this name.  Commands and events have the
85 #     name defined in the QAPI schema.  Unlike command and event
86 #     names, type names are not part of the wire ABI.  Consequently,
87 #     type names are meaningless strings here, although they are still
88 #     guaranteed unique regardless of @meta-type.
90 # @meta-type: the entity's meta type, inherited from @base.
92 # @features: names of features associated with the entity, in no
93 #     particular order.  (since 4.1 for object types, 4.2 for
94 #     commands, 5.0 for the rest)
96 # Since: 2.5
98 { 'union': 'SchemaInfo',
99   'base': { 'name': 'str', 'meta-type': 'SchemaMetaType',
100             '*features': [ 'str' ] },
101   'discriminator': 'meta-type',
102   'data': {
103       'builtin': 'SchemaInfoBuiltin',
104       'enum': 'SchemaInfoEnum',
105       'array': 'SchemaInfoArray',
106       'object': 'SchemaInfoObject',
107       'alternate': 'SchemaInfoAlternate',
108       'command': 'SchemaInfoCommand',
109       'event': 'SchemaInfoEvent' } }
112 # @SchemaInfoBuiltin:
114 # Additional SchemaInfo members for meta-type 'builtin'.
116 # @json-type: the JSON type used for this type on the wire.
118 # Since: 2.5
120 { 'struct': 'SchemaInfoBuiltin',
121   'data': { 'json-type': 'JSONType' } }
124 # @JSONType:
126 # The four primitive and two structured types according to RFC 8259
127 # section 1, plus 'int' (split off 'number'), plus the obvious top
128 # type 'value'.
130 # Since: 2.5
132 { 'enum': 'JSONType',
133   'data': [ 'string', 'number', 'int', 'boolean', 'null',
134             'object', 'array', 'value' ] }
137 # @SchemaInfoEnum:
139 # Additional SchemaInfo members for meta-type 'enum'.
141 # @members: the enum type's members, in no particular order (since
142 #     6.2).
144 # @values: the enumeration type's member names, in no particular
145 #     order.  Redundant with @members.  Just for backward
146 #     compatibility.
148 # Features:
150 # @deprecated: Member @values is deprecated.  Use @members instead.
152 # Values of this type are JSON string on the wire.
154 # Since: 2.5
156 { 'struct': 'SchemaInfoEnum',
157   'data': { 'members': [ 'SchemaInfoEnumMember' ],
158             'values': { 'type': [ 'str' ],
159                         'features': [ 'deprecated' ] } } }
162 # @SchemaInfoEnumMember:
164 # An object member.
166 # @name: the member's name, as defined in the QAPI schema.
168 # @features: names of features associated with the member, in no
169 #     particular order.
171 # Since: 6.2
173 { 'struct': 'SchemaInfoEnumMember',
174   'data': { 'name': 'str', '*features': [ 'str' ] } }
177 # @SchemaInfoArray:
179 # Additional SchemaInfo members for meta-type 'array'.
181 # @element-type: the array type's element type.
183 # Values of this type are JSON array on the wire.
185 # Since: 2.5
187 { 'struct': 'SchemaInfoArray',
188   'data': { 'element-type': 'str' } }
191 # @SchemaInfoObject:
193 # Additional SchemaInfo members for meta-type 'object'.
195 # @members: the object type's (non-variant) members, in no particular
196 #     order.
198 # @tag: the name of the member serving as type tag.  An element of
199 #     @members with this name must exist.
201 # @variants: variant members, i.e. additional members that depend on
202 #     the type tag's value.  Present exactly when @tag is present.
203 #     The variants are in no particular order, and may even differ
204 #     from the order of the values of the enum type of the @tag.
206 # Values of this type are JSON object on the wire.
208 # Since: 2.5
210 { 'struct': 'SchemaInfoObject',
211   'data': { 'members': [ 'SchemaInfoObjectMember' ],
212             '*tag': 'str',
213             '*variants': [ 'SchemaInfoObjectVariant' ] } }
216 # @SchemaInfoObjectMember:
218 # An object member.
220 # @name: the member's name, as defined in the QAPI schema.
222 # @type: the name of the member's type.
224 # @default: default when used as command parameter.  If absent, the
225 #     parameter is mandatory.  If present, the value must be null.
226 #     The parameter is optional, and behavior when it's missing is not
227 #     specified here.  Future extension: if present and non-null, the
228 #     parameter is optional, and defaults to this value.
230 # @features: names of features associated with the member, in no
231 #     particular order.  (since 5.0)
233 # Since: 2.5
235 { 'struct': 'SchemaInfoObjectMember',
236   'data': { 'name': 'str', 'type': 'str', '*default': 'any',
237 # @default's type must be null or match @type
238             '*features': [ 'str' ] } }
241 # @SchemaInfoObjectVariant:
243 # The variant members for a value of the type tag.
245 # @case: a value of the type tag.
247 # @type: the name of the object type that provides the variant members
248 #     when the type tag has value @case.
250 # Since: 2.5
252 { 'struct': 'SchemaInfoObjectVariant',
253   'data': { 'case': 'str', 'type': 'str' } }
256 # @SchemaInfoAlternate:
258 # Additional SchemaInfo members for meta-type 'alternate'.
260 # @members: the alternate type's members, in no particular order.  The
261 #     members' wire encoding is distinct, see
262 #     :doc:`/devel/qapi-code-gen` section Alternate types.
264 # On the wire, this can be any of the members.
266 # Since: 2.5
268 { 'struct': 'SchemaInfoAlternate',
269   'data': { 'members': [ 'SchemaInfoAlternateMember' ] } }
272 # @SchemaInfoAlternateMember:
274 # An alternate member.
276 # @type: the name of the member's type.
278 # Since: 2.5
280 { 'struct': 'SchemaInfoAlternateMember',
281   'data': { 'type': 'str' } }
284 # @SchemaInfoCommand:
286 # Additional SchemaInfo members for meta-type 'command'.
288 # @arg-type: the name of the object type that provides the command's
289 #     parameters.
291 # @ret-type: the name of the command's result type.
293 # @allow-oob: whether the command allows out-of-band execution,
294 #     defaults to false (Since: 2.12)
296 # TODO: @success-response (currently irrelevant, because it's QGA, not
297 #     QMP)
299 # Since: 2.5
301 { 'struct': 'SchemaInfoCommand',
302   'data': { 'arg-type': 'str', 'ret-type': 'str',
303             '*allow-oob': 'bool' } }
306 # @SchemaInfoEvent:
308 # Additional SchemaInfo members for meta-type 'event'.
310 # @arg-type: the name of the object type that provides the event's
311 #     parameters.
313 # Since: 2.5
315 { 'struct': 'SchemaInfoEvent',
316   'data': { 'arg-type': 'str' } }