root / include / qapi / visitor.h @ 69dd62df
History | View | Annotate | Download (2.7 kB)
1 | 2345c77c | Michael Roth | /*
|
---|---|---|---|
2 | 2345c77c | Michael Roth | * Core Definitions for QAPI Visitor Classes
|
3 | 2345c77c | Michael Roth | *
|
4 | 2345c77c | Michael Roth | * Copyright IBM, Corp. 2011
|
5 | 2345c77c | Michael Roth | *
|
6 | 2345c77c | Michael Roth | * Authors:
|
7 | 2345c77c | Michael Roth | * Anthony Liguori <aliguori@us.ibm.com>
|
8 | 2345c77c | Michael Roth | *
|
9 | 2345c77c | Michael Roth | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
10 | 2345c77c | Michael Roth | * See the COPYING.LIB file in the top-level directory.
|
11 | 2345c77c | Michael Roth | *
|
12 | 2345c77c | Michael Roth | */
|
13 | 2345c77c | Michael Roth | #ifndef QAPI_VISITOR_CORE_H
|
14 | 2345c77c | Michael Roth | #define QAPI_VISITOR_CORE_H
|
15 | 2345c77c | Michael Roth | |
16 | 69dd62df | Kevin Wolf | #include "qapi/qmp/qobject.h" |
17 | 7b1b5d19 | Paolo Bonzini | #include "qapi/error.h" |
18 | 2345c77c | Michael Roth | #include <stdlib.h> |
19 | 2345c77c | Michael Roth | |
20 | 2345c77c | Michael Roth | typedef struct GenericList |
21 | 2345c77c | Michael Roth | { |
22 | a678e26c | Michael Roth | union {
|
23 | a678e26c | Michael Roth | void *value;
|
24 | a678e26c | Michael Roth | uint64_t padding; |
25 | a678e26c | Michael Roth | }; |
26 | 2345c77c | Michael Roth | struct GenericList *next;
|
27 | 2345c77c | Michael Roth | } GenericList; |
28 | 2345c77c | Michael Roth | |
29 | 2345c77c | Michael Roth | typedef struct Visitor Visitor; |
30 | 2345c77c | Michael Roth | |
31 | 2345c77c | Michael Roth | void visit_start_handle(Visitor *v, void **obj, const char *kind, |
32 | 2345c77c | Michael Roth | const char *name, Error **errp); |
33 | 2345c77c | Michael Roth | void visit_end_handle(Visitor *v, Error **errp);
|
34 | 2345c77c | Michael Roth | void visit_start_struct(Visitor *v, void **obj, const char *kind, |
35 | 2345c77c | Michael Roth | const char *name, size_t size, Error **errp); |
36 | 2345c77c | Michael Roth | void visit_end_struct(Visitor *v, Error **errp);
|
37 | 761d524d | Kevin Wolf | void visit_start_implicit_struct(Visitor *v, void **obj, size_t size, |
38 | 761d524d | Kevin Wolf | Error **errp); |
39 | 761d524d | Kevin Wolf | void visit_end_implicit_struct(Visitor *v, Error **errp);
|
40 | 2345c77c | Michael Roth | void visit_start_list(Visitor *v, const char *name, Error **errp); |
41 | 2345c77c | Michael Roth | GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp); |
42 | 2345c77c | Michael Roth | void visit_end_list(Visitor *v, Error **errp);
|
43 | 2345c77c | Michael Roth | void visit_start_optional(Visitor *v, bool *present, const char *name, |
44 | 2345c77c | Michael Roth | Error **errp); |
45 | 2345c77c | Michael Roth | void visit_end_optional(Visitor *v, Error **errp);
|
46 | 69dd62df | Kevin Wolf | void visit_get_next_type(Visitor *v, int *obj, const int *qtypes, |
47 | 69dd62df | Kevin Wolf | const char *name, Error **errp); |
48 | 2345c77c | Michael Roth | void visit_type_enum(Visitor *v, int *obj, const char *strings[], |
49 | 2345c77c | Michael Roth | const char *kind, const char *name, Error **errp); |
50 | 2345c77c | Michael Roth | void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp); |
51 | 4e27e819 | Michael Roth | void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp); |
52 | 4e27e819 | Michael Roth | void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp); |
53 | 4e27e819 | Michael Roth | void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp); |
54 | 4e27e819 | Michael Roth | void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp); |
55 | 4e27e819 | Michael Roth | void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp); |
56 | 4e27e819 | Michael Roth | void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp); |
57 | 4e27e819 | Michael Roth | void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp); |
58 | 4e27e819 | Michael Roth | void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp); |
59 | 092705d4 | Laszlo Ersek | void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); |
60 | 2345c77c | Michael Roth | void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); |
61 | 2345c77c | Michael Roth | void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); |
62 | 2345c77c | Michael Roth | void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); |
63 | 2345c77c | Michael Roth | |
64 | 2345c77c | Michael Roth | #endif |