1 | /* AUTOMATICALLY GENERATED, DO NOT MODIFY */ |
2 | |
3 | /* |
4 | * Schema-defined QAPI types |
5 | * |
6 | * Copyright IBM, Corp. 2011 |
7 | * Copyright (c) 2013-2018 Red Hat Inc. |
8 | * |
9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
10 | * See the COPYING.LIB file in the top-level directory. |
11 | */ |
12 | |
13 | #ifndef QAPI_TYPES_INTROSPECT_H |
14 | #define QAPI_TYPES_INTROSPECT_H |
15 | |
16 | #include "qapi/qapi-builtin-types.h" |
17 | |
18 | typedef struct SchemaInfoList SchemaInfoList; |
19 | |
20 | typedef enum SchemaMetaType { |
21 | SCHEMA_META_TYPE_BUILTIN, |
22 | SCHEMA_META_TYPE_ENUM, |
23 | SCHEMA_META_TYPE_ARRAY, |
24 | SCHEMA_META_TYPE_OBJECT, |
25 | SCHEMA_META_TYPE_ALTERNATE, |
26 | SCHEMA_META_TYPE_COMMAND, |
27 | SCHEMA_META_TYPE_EVENT, |
28 | SCHEMA_META_TYPE__MAX, |
29 | } SchemaMetaType; |
30 | |
31 | #define SchemaMetaType_str(val) \ |
32 | qapi_enum_lookup(&SchemaMetaType_lookup, (val)) |
33 | |
34 | extern const QEnumLookup SchemaMetaType_lookup; |
35 | |
36 | typedef struct q_obj_SchemaInfo_base q_obj_SchemaInfo_base; |
37 | |
38 | typedef struct SchemaInfo SchemaInfo; |
39 | |
40 | typedef struct SchemaInfoBuiltin SchemaInfoBuiltin; |
41 | |
42 | typedef enum JSONType { |
43 | JSON_TYPE_STRING, |
44 | JSON_TYPE_NUMBER, |
45 | JSON_TYPE_INT, |
46 | JSON_TYPE_BOOLEAN, |
47 | JSON_TYPE_NULL, |
48 | JSON_TYPE_OBJECT, |
49 | JSON_TYPE_ARRAY, |
50 | JSON_TYPE_VALUE, |
51 | JSON_TYPE__MAX, |
52 | } JSONType; |
53 | |
54 | #define JSONType_str(val) \ |
55 | qapi_enum_lookup(&JSONType_lookup, (val)) |
56 | |
57 | extern const QEnumLookup JSONType_lookup; |
58 | |
59 | typedef struct SchemaInfoEnum SchemaInfoEnum; |
60 | |
61 | typedef struct SchemaInfoArray SchemaInfoArray; |
62 | |
63 | typedef struct SchemaInfoObjectMemberList SchemaInfoObjectMemberList; |
64 | |
65 | typedef struct SchemaInfoObjectVariantList SchemaInfoObjectVariantList; |
66 | |
67 | typedef struct SchemaInfoObject SchemaInfoObject; |
68 | |
69 | typedef struct SchemaInfoObjectMember SchemaInfoObjectMember; |
70 | |
71 | typedef struct SchemaInfoObjectVariant SchemaInfoObjectVariant; |
72 | |
73 | typedef struct SchemaInfoAlternateMemberList SchemaInfoAlternateMemberList; |
74 | |
75 | typedef struct SchemaInfoAlternate SchemaInfoAlternate; |
76 | |
77 | typedef struct SchemaInfoAlternateMember SchemaInfoAlternateMember; |
78 | |
79 | typedef struct SchemaInfoCommand SchemaInfoCommand; |
80 | |
81 | typedef struct SchemaInfoEvent SchemaInfoEvent; |
82 | |
83 | struct SchemaInfoList { |
84 | SchemaInfoList *next; |
85 | SchemaInfo *value; |
86 | }; |
87 | |
88 | void qapi_free_SchemaInfoList(SchemaInfoList *obj); |
89 | |
90 | struct q_obj_SchemaInfo_base { |
91 | char *name; |
92 | SchemaMetaType meta_type; |
93 | }; |
94 | |
95 | struct SchemaInfoBuiltin { |
96 | JSONType json_type; |
97 | }; |
98 | |
99 | struct SchemaInfoEnum { |
100 | strList *values; |
101 | }; |
102 | |
103 | struct SchemaInfoArray { |
104 | char *element_type; |
105 | }; |
106 | |
107 | struct SchemaInfoObject { |
108 | SchemaInfoObjectMemberList *members; |
109 | bool has_tag; |
110 | char *tag; |
111 | bool has_variants; |
112 | SchemaInfoObjectVariantList *variants; |
113 | bool has_features; |
114 | strList *features; |
115 | }; |
116 | |
117 | struct SchemaInfoAlternate { |
118 | SchemaInfoAlternateMemberList *members; |
119 | }; |
120 | |
121 | struct SchemaInfoCommand { |
122 | char *arg_type; |
123 | char *ret_type; |
124 | bool has_allow_oob; |
125 | bool allow_oob; |
126 | }; |
127 | |
128 | struct SchemaInfoEvent { |
129 | char *arg_type; |
130 | }; |
131 | |
132 | struct SchemaInfo { |
133 | char *name; |
134 | SchemaMetaType meta_type; |
135 | union { /* union tag is @meta_type */ |
136 | SchemaInfoBuiltin builtin; |
137 | SchemaInfoEnum q_enum; |
138 | SchemaInfoArray array; |
139 | SchemaInfoObject object; |
140 | SchemaInfoAlternate alternate; |
141 | SchemaInfoCommand command; |
142 | SchemaInfoEvent event; |
143 | } u; |
144 | }; |
145 | |
146 | void qapi_free_SchemaInfo(SchemaInfo *obj); |
147 | |
148 | void qapi_free_SchemaInfoBuiltin(SchemaInfoBuiltin *obj); |
149 | |
150 | void qapi_free_SchemaInfoEnum(SchemaInfoEnum *obj); |
151 | |
152 | void qapi_free_SchemaInfoArray(SchemaInfoArray *obj); |
153 | |
154 | struct SchemaInfoObjectMemberList { |
155 | SchemaInfoObjectMemberList *next; |
156 | SchemaInfoObjectMember *value; |
157 | }; |
158 | |
159 | void qapi_free_SchemaInfoObjectMemberList(SchemaInfoObjectMemberList *obj); |
160 | |
161 | struct SchemaInfoObjectVariantList { |
162 | SchemaInfoObjectVariantList *next; |
163 | SchemaInfoObjectVariant *value; |
164 | }; |
165 | |
166 | void qapi_free_SchemaInfoObjectVariantList(SchemaInfoObjectVariantList *obj); |
167 | |
168 | void qapi_free_SchemaInfoObject(SchemaInfoObject *obj); |
169 | |
170 | struct SchemaInfoObjectMember { |
171 | char *name; |
172 | char *type; |
173 | bool has_q_default; |
174 | QObject *q_default; |
175 | }; |
176 | |
177 | void qapi_free_SchemaInfoObjectMember(SchemaInfoObjectMember *obj); |
178 | |
179 | struct SchemaInfoObjectVariant { |
180 | char *q_case; |
181 | char *type; |
182 | }; |
183 | |
184 | void qapi_free_SchemaInfoObjectVariant(SchemaInfoObjectVariant *obj); |
185 | |
186 | struct SchemaInfoAlternateMemberList { |
187 | SchemaInfoAlternateMemberList *next; |
188 | SchemaInfoAlternateMember *value; |
189 | }; |
190 | |
191 | void qapi_free_SchemaInfoAlternateMemberList(SchemaInfoAlternateMemberList *obj); |
192 | |
193 | void qapi_free_SchemaInfoAlternate(SchemaInfoAlternate *obj); |
194 | |
195 | struct SchemaInfoAlternateMember { |
196 | char *type; |
197 | }; |
198 | |
199 | void qapi_free_SchemaInfoAlternateMember(SchemaInfoAlternateMember *obj); |
200 | |
201 | void qapi_free_SchemaInfoCommand(SchemaInfoCommand *obj); |
202 | |
203 | void qapi_free_SchemaInfoEvent(SchemaInfoEvent *obj); |
204 | |
205 | #endif /* QAPI_TYPES_INTROSPECT_H */ |
206 | |