]> git.proxmox.com Git - mirror_qemu.git/blame - include/qapi/visitor.h
qapi: Make input visitors detect unvisited list tails
[mirror_qemu.git] / include / qapi / visitor.h
CommitLineData
2345c77c
MR
1/*
2 * Core Definitions for QAPI Visitor Classes
3 *
08f9541d 4 * Copyright (C) 2012-2016 Red Hat, Inc.
2345c77c
MR
5 * Copyright IBM, Corp. 2011
6 *
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 *
10 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
11 * See the COPYING.LIB file in the top-level directory.
12 *
13 */
121d0712
MA
14
15#ifndef QAPI_VISITOR_H
16#define QAPI_VISITOR_H
2345c77c 17
69dd62df 18#include "qapi/qmp/qobject.h"
2345c77c 19
adfb264c
EB
20/*
21 * The QAPI schema defines both a set of C data types, and a QMP wire
22 * format. QAPI objects can contain references to other QAPI objects,
23 * resulting in a directed acyclic graph. QAPI also generates visitor
24 * functions to walk these graphs. This file represents the interface
25 * for doing work at each node of a QAPI graph; it can also be used
26 * for a virtual walk, where there is no actual QAPI C struct.
27 *
b3db211f 28 * There are four kinds of visitor classes: input visitors (QObject,
adfb264c 29 * string, and QemuOpts) parse an external representation and build
b3db211f 30 * the corresponding QAPI graph, output visitors (QObject and string) take
a15fcc3c
EB
31 * a completed QAPI graph and generate an external representation, the
32 * dealloc visitor can take a QAPI graph (possibly partially
33 * constructed) and recursively free its resources, and the clone
34 * visitor performs a deep clone of one QAPI object to another. While
b3db211f 35 * the dealloc and QObject input/output visitors are general, the string,
a15fcc3c
EB
36 * QemuOpts, and clone visitors have some implementation limitations;
37 * see the documentation for each visitor for more details on what it
adfb264c
EB
38 * supports. Also, see visitor-impl.h for the callback contracts
39 * implemented by each visitor, and docs/qapi-code-gen.txt for more
40 * about the QAPI code generator.
41 *
2c0ef9f4
EB
42 * All of the visitors are created via:
43 *
3b098d56 44 * Visitor *subtype_visitor_new(parameters...);
2c0ef9f4
EB
45 *
46 * A visitor should be used for exactly one top-level visit_type_FOO()
3b098d56
EB
47 * or virtual walk; if that is successful, the caller can optionally
48 * call visit_complete() (for now, useful only for output visits, but
49 * safe to call on all visits). Then, regardless of success or
50 * failure, the user should call visit_free() to clean up resources.
2c0ef9f4 51 * It is okay to free the visitor without completing the visit, if
3b098d56 52 * some other error is detected in the meantime.
2c0ef9f4 53 *
adfb264c
EB
54 * All QAPI types have a corresponding function with a signature
55 * roughly compatible with this:
56 *
57 * void visit_type_FOO(Visitor *v, const char *name, T obj, Error **errp);
58 *
59 * where T is FOO for scalar types, and FOO * otherwise. The scalar
60 * visitors are declared here; the remaining visitors are generated in
61 * qapi-visit.h.
62 *
63 * The @name parameter of visit_type_FOO() describes the relation
64 * between this QAPI value and its parent container. When visiting
65 * the root of a tree, @name is ignored; when visiting a member of an
66 * object, @name is the key associated with the value; and when
67 * visiting a member of a list, @name is NULL.
68 *
adfb264c
EB
69 * The visit_type_FOO() functions expect a non-null @obj argument;
70 * they allocate *@obj during input visits, leave it unchanged on
71 * output visits, and recursively free any resources during a dealloc
72 * visit. Each function also takes the customary @errp argument (see
73 * qapi/error.h for details), for reporting any errors (such as if a
74 * member @name is not present, or is present but not the specified
75 * type).
76 *
68ab47e4
EB
77 * If an error is detected during visit_type_FOO() with an input
78 * visitor, then *@obj will be NULL for pointer types, and left
a15fcc3c
EB
79 * unchanged for scalar types. Using an output or clone visitor with
80 * an incomplete object has undefined behavior (other than a special
81 * case for visit_type_str() treating NULL like ""), while the dealloc
68ab47e4
EB
82 * visitor safely handles incomplete objects. Since input visitors
83 * never produce an incomplete object, such an object is possible only
84 * by manual construction.
adfb264c
EB
85 *
86 * For the QAPI object types (structs, unions, and alternates), there
87 * is an additional generated function in qapi-visit.h compatible
88 * with:
89 *
90 * void visit_type_FOO_members(Visitor *v, FOO *obj, Error **errp);
91 *
92 * for visiting the members of a type without also allocating the QAPI
93 * struct.
94 *
95 * Additionally, in qapi-types.h, all QAPI pointer types (structs,
96 * unions, alternates, and lists) have a generated function compatible
97 * with:
98 *
99 * void qapi_free_FOO(FOO *obj);
100 *
a15fcc3c
EB
101 * where behaves like free() in that @obj may be NULL. Such objects
102 * may also be used with the following macro, provided alongside the
103 * clone visitor:
104 *
105 * Type *QAPI_CLONE(Type, src);
106 *
107 * in order to perform a deep clone of @src. Because of the generated
108 * qapi_free functions and the QAPI_CLONE() macro, the clone and
109 * dealloc visitor should not be used directly outside of QAPI code.
110 *
111 * QAPI types can also inherit from a base class; when this happens, a
112 * function is generated for easily going from the derived type to the
113 * base type:
adfb264c
EB
114 *
115 * BASE *qapi_CHILD_base(CHILD *obj);
116 *
117 * For a real QAPI struct, typical input usage involves:
118 *
119 * <example>
120 * Foo *f;
121 * Error *err = NULL;
122 * Visitor *v;
123 *
3b098d56 124 * v = FOO_visitor_new(...);
adfb264c
EB
125 * visit_type_Foo(v, NULL, &f, &err);
126 * if (err) {
adfb264c
EB
127 * ...handle error...
128 * } else {
129 * ...use f...
130 * }
3b098d56 131 * visit_free(v);
adfb264c
EB
132 * qapi_free_Foo(f);
133 * </example>
134 *
135 * For a list, it is:
136 * <example>
137 * FooList *l;
138 * Error *err = NULL;
139 * Visitor *v;
140 *
3b098d56 141 * v = FOO_visitor_new(...);
adfb264c
EB
142 * visit_type_FooList(v, NULL, &l, &err);
143 * if (err) {
adfb264c
EB
144 * ...handle error...
145 * } else {
146 * for ( ; l; l = l->next) {
147 * ...use l->value...
148 * }
149 * }
3b098d56 150 * visit_free(v);
adfb264c
EB
151 * qapi_free_FooList(l);
152 * </example>
153 *
154 * Similarly, typical output usage is:
155 *
156 * <example>
157 * Foo *f = ...obtain populated object...
158 * Error *err = NULL;
159 * Visitor *v;
3b098d56 160 * Type *result;
adfb264c 161 *
3b098d56 162 * v = FOO_visitor_new(..., &result);
adfb264c
EB
163 * visit_type_Foo(v, NULL, &f, &err);
164 * if (err) {
165 * ...handle error...
3b098d56
EB
166 * } else {
167 * visit_complete(v, &result);
168 * ...use result...
adfb264c 169 * }
3b098d56 170 * visit_free(v);
adfb264c
EB
171 * </example>
172 *
173 * When visiting a real QAPI struct, this file provides several
174 * helpers that rely on in-tree information to control the walk:
175 * visit_optional() for the 'has_member' field associated with
176 * optional 'member' in the C struct; and visit_next_list() for
68ab47e4
EB
177 * advancing through a FooList linked list. Similarly, the
178 * visit_is_input() helper makes it possible to write code that is
179 * visitor-agnostic everywhere except for cleanup. Only the generated
adfb264c
EB
180 * visit_type functions need to use these helpers.
181 *
182 * It is also possible to use the visitors to do a virtual walk, where
183 * no actual QAPI struct is present. In this situation, decisions
184 * about what needs to be walked are made by the calling code, and
185 * structured visits are split between pairs of start and end methods
186 * (where the end method must be called if the start function
187 * succeeded, even if an intermediate visit encounters an error).
188 * Thus, a virtual walk corresponding to '{ "list": [1, 2] }' looks
189 * like:
190 *
191 * <example>
192 * Visitor *v;
193 * Error *err = NULL;
194 * int value;
195 *
3b098d56 196 * v = FOO_visitor_new(...);
adfb264c
EB
197 * visit_start_struct(v, NULL, NULL, 0, &err);
198 * if (err) {
199 * goto out;
200 * }
d9f62dde 201 * visit_start_list(v, "list", NULL, 0, &err);
adfb264c
EB
202 * if (err) {
203 * goto outobj;
204 * }
205 * value = 1;
206 * visit_type_int(v, NULL, &value, &err);
207 * if (err) {
208 * goto outlist;
209 * }
210 * value = 2;
211 * visit_type_int(v, NULL, &value, &err);
212 * if (err) {
213 * goto outlist;
214 * }
215 * outlist:
1158bb2a 216 * visit_end_list(v, NULL);
15c2f669
EB
217 * if (!err) {
218 * visit_check_struct(v, &err);
219 * }
adfb264c 220 * outobj:
1158bb2a 221 * visit_end_struct(v, NULL);
adfb264c
EB
222 * out:
223 * error_propagate(errp, err);
3b098d56 224 * visit_free(v);
adfb264c
EB
225 * </example>
226 */
227
228/*** Useful types ***/
229
e65d89bf 230/* This struct is layout-compatible with all other *List structs
adfb264c 231 * created by the QAPI generator. It is used as a typical
e65d89bf
EB
232 * singly-linked list. */
233typedef struct GenericList {
2345c77c 234 struct GenericList *next;
e65d89bf 235 char padding[];
2345c77c
MR
236} GenericList;
237
dbf11922 238/* This struct is layout-compatible with all Alternate types
adfb264c 239 * created by the QAPI generator. */
dbf11922
EB
240typedef struct GenericAlternate {
241 QType type;
242 char padding[];
243} GenericAlternate;
244
2c0ef9f4
EB
245/*** Visitor cleanup ***/
246
3b098d56
EB
247/*
248 * Complete the visit, collecting any output.
249 *
250 * May only be called only once after a successful top-level
251 * visit_type_FOO() or visit_end_ITEM(), and marks the end of the
252 * visit. The @opaque pointer should match the output parameter
253 * passed to the subtype_visitor_new() used to create an output
254 * visitor, or NULL for any other visitor. Needed for output
255 * visitors, but may also be called with other visitors.
256 */
257void visit_complete(Visitor *v, void *opaque);
258
2c0ef9f4
EB
259/*
260 * Free @v and any resources it has tied up.
261 *
262 * May be called whether or not the visit has been successfully
263 * completed, but should not be called until a top-level
264 * visit_type_FOO() or visit_start_ITEM() has been performed on the
265 * visitor. Safe if @v is NULL.
266 */
267void visit_free(Visitor *v);
268
269
adfb264c
EB
270/*** Visiting structures ***/
271
272/*
273 * Start visiting an object @obj (struct or union).
274 *
275 * @name expresses the relationship of this object to its parent
276 * container; see the general description of @name above.
277 *
278 * @obj must be non-NULL for a real walk, in which case @size
a15fcc3c
EB
279 * determines how much memory an input or clone visitor will allocate
280 * into *@obj. @obj may also be NULL for a virtual walk, in which
281 * case @size is ignored.
adfb264c
EB
282 *
283 * @errp obeys typical error usage, and reports failures such as a
284 * member @name is not present, or present but not an object. On
285 * error, input visitors set *@obj to NULL.
286 *
287 * After visit_start_struct() succeeds, the caller may visit its
288 * members one after the other, passing the member's name and address
289 * within the struct. Finally, visit_end_struct() needs to be called
1158bb2a
EB
290 * with the same @obj to clean up, even if intermediate visits fail.
291 * See the examples above.
adfb264c
EB
292 *
293 * FIXME Should this be named visit_start_object, since it is also
294 * used for QAPI unions, and maps to JSON objects?
295 */
51e72bc1 296void visit_start_struct(Visitor *v, const char *name, void **obj,
337283df 297 size_t size, Error **errp);
adfb264c
EB
298
299/*
15c2f669 300 * Prepare for completing an object visit.
adfb264c
EB
301 *
302 * @errp obeys typical error usage, and reports failures such as
303 * unparsed keys remaining in the input stream.
304 *
15c2f669
EB
305 * Should be called prior to visit_end_struct() if all other
306 * intermediate visit steps were successful, to allow the visitor one
307 * last chance to report errors. May be skipped on a cleanup path,
308 * where there is no need to check for further errors.
309 */
310void visit_check_struct(Visitor *v, Error **errp);
311
312/*
313 * Complete an object visit started earlier.
314 *
1158bb2a
EB
315 * @obj must match what was passed to the paired visit_start_struct().
316 *
adfb264c
EB
317 * Must be called after any successful use of visit_start_struct(),
318 * even if intermediate processing was skipped due to errors, to allow
319 * the backend to release any resources. Destroying the visitor early
2c0ef9f4 320 * with visit_free() behaves as if this was implicitly called.
adfb264c 321 */
1158bb2a 322void visit_end_struct(Visitor *v, void **obj);
08f9541d 323
adfb264c
EB
324
325/*** Visiting lists ***/
326
327/*
328 * Start visiting a list.
329 *
330 * @name expresses the relationship of this list to its parent
331 * container; see the general description of @name above.
332 *
d9f62dde 333 * @list must be non-NULL for a real walk, in which case @size
a15fcc3c
EB
334 * determines how much memory an input or clone visitor will allocate
335 * into *@list (at least sizeof(GenericList)). Some visitors also
336 * allow @list to be NULL for a virtual walk, in which case @size is
d9f62dde
EB
337 * ignored.
338 *
adfb264c 339 * @errp obeys typical error usage, and reports failures such as a
d9f62dde
EB
340 * member @name is not present, or present but not a list. On error,
341 * input visitors set *@list to NULL.
adfb264c
EB
342 *
343 * After visit_start_list() succeeds, the caller may visit its members
d9f62dde
EB
344 * one after the other. A real visit (where @obj is non-NULL) uses
345 * visit_next_list() for traversing the linked list, while a virtual
346 * visit (where @obj is NULL) uses other means. For each list
347 * element, call the appropriate visit_type_FOO() with name set to
348 * NULL and obj set to the address of the value member of the list
1158bb2a
EB
349 * element. Finally, visit_end_list() needs to be called with the
350 * same @list to clean up, even if intermediate visits fail. See the
351 * examples above.
adfb264c 352 */
d9f62dde
EB
353void visit_start_list(Visitor *v, const char *name, GenericList **list,
354 size_t size, Error **errp);
adfb264c
EB
355
356/*
357 * Iterate over a GenericList during a non-virtual list visit.
358 *
359 * @size represents the size of a linked list node (at least
360 * sizeof(GenericList)).
361 *
d9f62dde
EB
362 * @tail must not be NULL; on the first call, @tail is the value of
363 * *list after visit_start_list(), and on subsequent calls @tail must
364 * be the previously returned value. Should be called in a loop until
365 * a NULL return or error occurs; for each non-NULL return, the caller
366 * then calls the appropriate visit_type_*() for the element type of
367 * the list, with that function's name parameter set to NULL and obj
368 * set to the address of @tail->value.
adfb264c 369 */
d9f62dde 370GenericList *visit_next_list(Visitor *v, GenericList *tail, size_t size);
adfb264c 371
a4a1c70d
MA
372/*
373 * Prepare for completing a list visit.
374 *
375 * @errp obeys typical error usage, and reports failures such as
376 * unvisited list tail remaining in the input stream.
377 *
378 * Should be called prior to visit_end_list() if all other
379 * intermediate visit steps were successful, to allow the visitor one
380 * last chance to report errors. May be skipped on a cleanup path,
381 * where there is no need to check for further errors.
382 */
383void visit_check_list(Visitor *v, Error **errp);
384
adfb264c
EB
385/*
386 * Complete a list visit started earlier.
387 *
1158bb2a
EB
388 * @list must match what was passed to the paired visit_start_list().
389 *
adfb264c
EB
390 * Must be called after any successful use of visit_start_list(), even
391 * if intermediate processing was skipped due to errors, to allow the
392 * backend to release any resources. Destroying the visitor early
2c0ef9f4 393 * with visit_free() behaves as if this was implicitly called.
adfb264c 394 */
1158bb2a 395void visit_end_list(Visitor *v, void **list);
5cdc8831 396
adfb264c
EB
397
398/*** Visiting alternates ***/
399
dbf11922 400/*
adfb264c 401 * Start the visit of an alternate @obj.
dbf11922 402 *
adfb264c
EB
403 * @name expresses the relationship of this alternate to its parent
404 * container; see the general description of @name above.
dbf11922 405 *
a15fcc3c
EB
406 * @obj must not be NULL. Input and clone visitors use @size to
407 * determine how much memory to allocate into *@obj, then determine
408 * the qtype of the next thing to be visited, stored in (*@obj)->type.
409 * Other visitors will leave @obj unchanged.
dbf11922
EB
410 *
411 * If @promote_int, treat integers as QTYPE_FLOAT.
412 *
1158bb2a
EB
413 * If successful, this must be paired with visit_end_alternate() with
414 * the same @obj to clean up, even if visiting the contents of the
415 * alternate fails.
dbf11922
EB
416 */
417void visit_start_alternate(Visitor *v, const char *name,
418 GenericAlternate **obj, size_t size,
419 bool promote_int, Error **errp);
420
421/*
422 * Finish visiting an alternate type.
423 *
1158bb2a
EB
424 * @obj must match what was passed to the paired visit_start_alternate().
425 *
adfb264c
EB
426 * Must be called after any successful use of visit_start_alternate(),
427 * even if intermediate processing was skipped due to errors, to allow
428 * the backend to release any resources. Destroying the visitor early
2c0ef9f4 429 * with visit_free() behaves as if this was implicitly called.
dbf11922 430 *
dbf11922 431 */
1158bb2a 432void visit_end_alternate(Visitor *v, void **obj);
dbf11922 433
adfb264c
EB
434
435/*** Other helpers ***/
436
437/*
438 * Does optional struct member @name need visiting?
439 *
440 * @name must not be NULL. This function is only useful between
441 * visit_start_struct() and visit_end_struct(), since only objects
442 * have optional keys.
443 *
444 * @present points to the address of the optional member's has_ flag.
445 *
446 * Input visitors set *@present according to input; other visitors
447 * leave it unchanged. In either case, return *@present for
448 * convenience.
5cdc8831 449 */
51e72bc1 450bool visit_optional(Visitor *v, const char *name, bool *present);
0426d53c 451
983f52d4
EB
452/*
453 * Visit an enum value.
454 *
adfb264c
EB
455 * @name expresses the relationship of this enum to its parent
456 * container; see the general description of @name above.
457 *
458 * @obj must be non-NULL. Input visitors parse input and set *@obj to
459 * the enumeration value, leaving @obj unchanged on error; other
460 * visitors use *@obj but leave it unchanged.
461 *
462 * Currently, all input visitors parse text input, and all output
463 * visitors produce text output. The mapping between enumeration
464 * values and strings is done by the visitor core, using @strings; it
465 * should be the ENUM_lookup array from visit-types.h.
983f52d4
EB
466 *
467 * May call visit_type_str() under the hood, and the enum visit may
468 * fail even if the corresponding string visit succeeded; this implies
469 * that visit_type_str() must have no unwelcome side effects.
470 */
51e72bc1 471void visit_type_enum(Visitor *v, const char *name, int *obj,
337283df 472 const char *const strings[], Error **errp);
983f52d4 473
68ab47e4
EB
474/*
475 * Check if visitor is an input visitor.
476 */
477bool visit_is_input(Visitor *v);
478
adfb264c
EB
479/*** Visiting built-in types ***/
480
481/*
482 * Visit an integer value.
483 *
484 * @name expresses the relationship of this integer to its parent
485 * container; see the general description of @name above.
486 *
487 * @obj must be non-NULL. Input visitors set *@obj to the value;
488 * other visitors will leave *@obj unchanged.
489 */
51e72bc1 490void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
adfb264c
EB
491
492/*
493 * Visit a uint8_t value.
494 * Like visit_type_int(), except clamps the value to uint8_t range.
495 */
51e72bc1
EB
496void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
497 Error **errp);
adfb264c
EB
498
499/*
500 * Visit a uint16_t value.
501 * Like visit_type_int(), except clamps the value to uint16_t range.
502 */
51e72bc1
EB
503void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
504 Error **errp);
adfb264c
EB
505
506/*
507 * Visit a uint32_t value.
508 * Like visit_type_int(), except clamps the value to uint32_t range.
509 */
51e72bc1
EB
510void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,
511 Error **errp);
adfb264c
EB
512
513/*
514 * Visit a uint64_t value.
515 * Like visit_type_int(), except clamps the value to uint64_t range,
516 * that is, ensures it is unsigned.
517 */
51e72bc1
EB
518void visit_type_uint64(Visitor *v, const char *name, uint64_t *obj,
519 Error **errp);
adfb264c
EB
520
521/*
522 * Visit an int8_t value.
523 * Like visit_type_int(), except clamps the value to int8_t range.
524 */
51e72bc1 525void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp);
adfb264c
EB
526
527/*
528 * Visit an int16_t value.
529 * Like visit_type_int(), except clamps the value to int16_t range.
530 */
51e72bc1
EB
531void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
532 Error **errp);
adfb264c
EB
533
534/*
535 * Visit an int32_t value.
536 * Like visit_type_int(), except clamps the value to int32_t range.
537 */
51e72bc1
EB
538void visit_type_int32(Visitor *v, const char *name, int32_t *obj,
539 Error **errp);
adfb264c
EB
540
541/*
542 * Visit an int64_t value.
543 * Identical to visit_type_int().
544 */
51e72bc1
EB
545void visit_type_int64(Visitor *v, const char *name, int64_t *obj,
546 Error **errp);
adfb264c
EB
547
548/*
549 * Visit a uint64_t value.
550 * Like visit_type_uint64(), except that some visitors may choose to
551 * recognize additional syntax, such as suffixes for easily scaling
552 * values.
553 */
51e72bc1
EB
554void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
555 Error **errp);
adfb264c
EB
556
557/*
558 * Visit a boolean value.
559 *
560 * @name expresses the relationship of this boolean to its parent
561 * container; see the general description of @name above.
562 *
563 * @obj must be non-NULL. Input visitors set *@obj to the value;
564 * other visitors will leave *@obj unchanged.
565 */
51e72bc1 566void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
adfb264c
EB
567
568/*
569 * Visit a string value.
570 *
571 * @name expresses the relationship of this string to its parent
572 * container; see the general description of @name above.
573 *
a15fcc3c
EB
574 * @obj must be non-NULL. Input and clone visitors set *@obj to the
575 * value (always using "" rather than NULL for an empty string).
576 * Other visitors leave *@obj unchanged, and commonly treat NULL like
577 * "".
adfb264c
EB
578 *
579 * It is safe to cast away const when preparing a (const char *) value
580 * into @obj for use by an output visitor.
581 *
582 * FIXME: Callers that try to output NULL *obj should not be allowed.
583 */
51e72bc1 584void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
adfb264c
EB
585
586/*
587 * Visit a number (i.e. double) value.
588 *
589 * @name expresses the relationship of this number to its parent
590 * container; see the general description of @name above.
591 *
592 * @obj must be non-NULL. Input visitors set *@obj to the value;
593 * other visitors will leave *@obj unchanged. Visitors should
594 * document if infinity or NaN are not permitted.
595 */
51e72bc1
EB
596void visit_type_number(Visitor *v, const char *name, double *obj,
597 Error **errp);
adfb264c
EB
598
599/*
600 * Visit an arbitrary value.
601 *
602 * @name expresses the relationship of this value to its parent
603 * container; see the general description of @name above.
604 *
605 * @obj must be non-NULL. Input visitors set *@obj to the value;
606 * other visitors will leave *@obj unchanged. *@obj must be non-NULL
607 * for output visitors.
608 */
51e72bc1 609void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
2345c77c 610
3bc97fd5
EB
611/*
612 * Visit a JSON null value.
613 *
614 * @name expresses the relationship of the null value to its parent
615 * container; see the general description of @name above.
616 *
617 * Unlike all other visit_type_* functions, no obj parameter is
618 * needed; rather, this is a witness that an explicit null value is
619 * expected rather than any other type.
620 */
621void visit_type_null(Visitor *v, const char *name, Error **errp);
622
2345c77c 623#endif