rng: add request queue support to rng-random
[qemu/kevin.git] / include / qapi / visitor-impl.h
blob2bd8f292b2d53d48c9183e8514e8a50add2f3855
1 /*
2 * Core Definitions for QAPI Visitor implementations
4 * Copyright (C) 2012-2016 Red Hat, Inc.
6 * Author: Paolo Bonizni <pbonzini@redhat.com>
8 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
9 * See the COPYING.LIB file in the top-level directory.
12 #ifndef QAPI_VISITOR_IMPL_H
13 #define QAPI_VISITOR_IMPL_H
15 #include "qapi/visitor.h"
17 struct Visitor
19 /* Must be set */
20 void (*start_struct)(Visitor *v, const char *name, void **obj,
21 size_t size, Error **errp);
22 void (*end_struct)(Visitor *v, Error **errp);
24 void (*start_list)(Visitor *v, const char *name, Error **errp);
25 /* Must be set */
26 GenericList *(*next_list)(Visitor *v, GenericList **list, size_t size);
27 /* Must be set */
28 void (*end_list)(Visitor *v);
30 /* Optional, needed for input and dealloc visitors. */
31 void (*start_alternate)(Visitor *v, const char *name,
32 GenericAlternate **obj, size_t size,
33 bool promote_int, Error **errp);
35 /* Optional, needed for dealloc visitor. */
36 void (*end_alternate)(Visitor *v);
38 /* Must be set. */
39 void (*type_enum)(Visitor *v, const char *name, int *obj,
40 const char *const strings[], Error **errp);
42 /* Must be set. */
43 void (*type_int64)(Visitor *v, const char *name, int64_t *obj,
44 Error **errp);
45 /* Must be set. */
46 void (*type_uint64)(Visitor *v, const char *name, uint64_t *obj,
47 Error **errp);
48 /* Optional; fallback is type_uint64(). */
49 void (*type_size)(Visitor *v, const char *name, uint64_t *obj,
50 Error **errp);
51 /* Must be set. */
52 void (*type_bool)(Visitor *v, const char *name, bool *obj, Error **errp);
53 void (*type_str)(Visitor *v, const char *name, char **obj, Error **errp);
54 void (*type_number)(Visitor *v, const char *name, double *obj,
55 Error **errp);
56 void (*type_any)(Visitor *v, const char *name, QObject **obj,
57 Error **errp);
59 /* May be NULL; most useful for input visitors. */
60 void (*optional)(Visitor *v, const char *name, bool *present);
63 void input_type_enum(Visitor *v, const char *name, int *obj,
64 const char *const strings[], Error **errp);
65 void output_type_enum(Visitor *v, const char *name, int *obj,
66 const char *const strings[], Error **errp);
68 #endif