1
2
3
4
5
6
7
8
9
10
11
12#ifndef QAPI_VISITOR_IMPL_H
13#define QAPI_VISITOR_IMPL_H
14
15#include "qapi/visitor.h"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37typedef enum VisitorType {
38 VISITOR_INPUT = 1,
39 VISITOR_OUTPUT = 2,
40 VISITOR_CLONE = 3,
41 VISITOR_DEALLOC = 4,
42} VisitorType;
43
44struct Visitor
45{
46
47
48
49
50
51 bool (*start_struct)(Visitor *v, const char *name, void **obj,
52 size_t size, Error **errp);
53
54
55 bool (*check_struct)(Visitor *v, Error **errp);
56
57
58 void (*end_struct)(Visitor *v, void **obj);
59
60
61
62 bool (*start_list)(Visitor *v, const char *name, GenericList **list,
63 size_t size, Error **errp);
64
65
66 GenericList *(*next_list)(Visitor *v, GenericList *tail, size_t size);
67
68
69 bool (*check_list)(Visitor *v, Error **errp);
70
71
72 void (*end_list)(Visitor *v, void **list);
73
74
75 bool (*start_alternate)(Visitor *v, const char *name,
76 GenericAlternate **obj, size_t size,
77 Error **errp);
78
79
80 void (*end_alternate)(Visitor *v, void **obj);
81
82
83 bool (*type_int64)(Visitor *v, const char *name, int64_t *obj,
84 Error **errp);
85
86
87 bool (*type_uint64)(Visitor *v, const char *name, uint64_t *obj,
88 Error **errp);
89
90
91 bool (*type_size)(Visitor *v, const char *name, uint64_t *obj,
92 Error **errp);
93
94
95 bool (*type_bool)(Visitor *v, const char *name, bool *obj, Error **errp);
96
97
98 bool (*type_str)(Visitor *v, const char *name, char **obj, Error **errp);
99
100
101 bool (*type_number)(Visitor *v, const char *name, double *obj,
102 Error **errp);
103
104
105 bool (*type_any)(Visitor *v, const char *name, QObject **obj,
106 Error **errp);
107
108
109 bool (*type_null)(Visitor *v, const char *name, QNull **obj,
110 Error **errp);
111
112
113
114 void (*optional)(Visitor *v, const char *name, bool *present);
115
116
117 bool (*policy_reject)(Visitor *v, const char *name,
118 unsigned special_features, Error **errp);
119
120
121 bool (*policy_skip)(Visitor *v, const char *name,
122 unsigned special_features);
123
124
125 VisitorType type;
126
127
128 struct CompatPolicy compat_policy;
129
130
131 void (*complete)(Visitor *v, void *opaque);
132
133
134 void (*free)(Visitor *v);
135};
136
137#endif
138