1/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
2
3/*
4 * Schema-defined QAPI/QMP commands
5 *
6 * Copyright IBM, Corp. 2011
7 * Copyright (C) 2014-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#include "qemu/osdep.h"
14#include "qapi/visitor.h"
15#include "qapi/qmp/qdict.h"
16#include "qapi/qobject-output-visitor.h"
17#include "qapi/qobject-input-visitor.h"
18#include "qapi/dealloc-visitor.h"
19#include "qapi/error.h"
20#include "qapi-visit-tpm.h"
21#include "qapi-commands-tpm.h"
22
23
24static void qmp_marshal_output_TpmModelList(TpmModelList *ret_in, QObject **ret_out, Error **errp)
25{
26 Error *err = NULL;
27 Visitor *v;
28
29 v = qobject_output_visitor_new(ret_out);
30 visit_type_TpmModelList(v, "unused", &ret_in, &err);
31 if (!err) {
32 visit_complete(v, ret_out);
33 }
34 error_propagate(errp, err);
35 visit_free(v);
36 v = qapi_dealloc_visitor_new();
37 visit_type_TpmModelList(v, "unused", &ret_in, NULL);
38 visit_free(v);
39}
40
41void qmp_marshal_query_tpm_models(QDict *args, QObject **ret, Error **errp)
42{
43 Error *err = NULL;
44 TpmModelList *retval;
45 Visitor *v = NULL;
46
47 if (args) {
48 v = qobject_input_visitor_new(QOBJECT(args));
49 visit_start_struct(v, NULL, NULL, 0, &err);
50 if (err) {
51 goto out;
52 }
53
54 if (!err) {
55 visit_check_struct(v, &err);
56 }
57 visit_end_struct(v, NULL);
58 if (err) {
59 goto out;
60 }
61 }
62
63 retval = qmp_query_tpm_models(&err);
64 if (err) {
65 goto out;
66 }
67
68 qmp_marshal_output_TpmModelList(retval, ret, &err);
69
70out:
71 error_propagate(errp, err);
72 visit_free(v);
73 if (args) {
74 v = qapi_dealloc_visitor_new();
75 visit_start_struct(v, NULL, NULL, 0, NULL);
76
77 visit_end_struct(v, NULL);
78 visit_free(v);
79 }
80}
81
82static void qmp_marshal_output_TpmTypeList(TpmTypeList *ret_in, QObject **ret_out, Error **errp)
83{
84 Error *err = NULL;
85 Visitor *v;
86
87 v = qobject_output_visitor_new(ret_out);
88 visit_type_TpmTypeList(v, "unused", &ret_in, &err);
89 if (!err) {
90 visit_complete(v, ret_out);
91 }
92 error_propagate(errp, err);
93 visit_free(v);
94 v = qapi_dealloc_visitor_new();
95 visit_type_TpmTypeList(v, "unused", &ret_in, NULL);
96 visit_free(v);
97}
98
99void qmp_marshal_query_tpm_types(QDict *args, QObject **ret, Error **errp)
100{
101 Error *err = NULL;
102 TpmTypeList *retval;
103 Visitor *v = NULL;
104
105 if (args) {
106 v = qobject_input_visitor_new(QOBJECT(args));
107 visit_start_struct(v, NULL, NULL, 0, &err);
108 if (err) {
109 goto out;
110 }
111
112 if (!err) {
113 visit_check_struct(v, &err);
114 }
115 visit_end_struct(v, NULL);
116 if (err) {
117 goto out;
118 }
119 }
120
121 retval = qmp_query_tpm_types(&err);
122 if (err) {
123 goto out;
124 }
125
126 qmp_marshal_output_TpmTypeList(retval, ret, &err);
127
128out:
129 error_propagate(errp, err);
130 visit_free(v);
131 if (args) {
132 v = qapi_dealloc_visitor_new();
133 visit_start_struct(v, NULL, NULL, 0, NULL);
134
135 visit_end_struct(v, NULL);
136 visit_free(v);
137 }
138}
139
140static void qmp_marshal_output_TPMInfoList(TPMInfoList *ret_in, QObject **ret_out, Error **errp)
141{
142 Error *err = NULL;
143 Visitor *v;
144
145 v = qobject_output_visitor_new(ret_out);
146 visit_type_TPMInfoList(v, "unused", &ret_in, &err);
147 if (!err) {
148 visit_complete(v, ret_out);
149 }
150 error_propagate(errp, err);
151 visit_free(v);
152 v = qapi_dealloc_visitor_new();
153 visit_type_TPMInfoList(v, "unused", &ret_in, NULL);
154 visit_free(v);
155}
156
157void qmp_marshal_query_tpm(QDict *args, QObject **ret, Error **errp)
158{
159 Error *err = NULL;
160 TPMInfoList *retval;
161 Visitor *v = NULL;
162
163 if (args) {
164 v = qobject_input_visitor_new(QOBJECT(args));
165 visit_start_struct(v, NULL, NULL, 0, &err);
166 if (err) {
167 goto out;
168 }
169
170 if (!err) {
171 visit_check_struct(v, &err);
172 }
173 visit_end_struct(v, NULL);
174 if (err) {
175 goto out;
176 }
177 }
178
179 retval = qmp_query_tpm(&err);
180 if (err) {
181 goto out;
182 }
183
184 qmp_marshal_output_TPMInfoList(retval, ret, &err);
185
186out:
187 error_propagate(errp, err);
188 visit_free(v);
189 if (args) {
190 v = qapi_dealloc_visitor_new();
191 visit_start_struct(v, NULL, NULL, 0, NULL);
192
193 visit_end_struct(v, NULL);
194 visit_free(v);
195 }
196}
197
198/* Dummy declaration to prevent empty .o file */
199char qapi_dummy_qapi_commands_tpm_c;
200