1/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
2
3/*
4 * Schema-defined QAPI/QMP events
5 *
6 * Copyright (c) 2014 Wenchao Xia
7 * Copyright (c) 2015-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-emit-events.h"
15#include "qapi-events-run-state.h"
16#include "qapi-visit-run-state.h"
17#include "qapi/error.h"
18#include "qapi/qmp/qdict.h"
19#include "qapi/qobject-output-visitor.h"
20#include "qapi/qmp-event.h"
21
22
23void qapi_event_send_shutdown(bool guest, ShutdownCause reason)
24{
25 QDict *qmp;
26 QObject *obj;
27 Visitor *v;
28 q_obj_SHUTDOWN_arg param = {
29 guest, reason
30 };
31
32 qmp = qmp_event_build_dict("SHUTDOWN");
33
34 v = qobject_output_visitor_new(&obj);
35
36 visit_start_struct(v, "SHUTDOWN", NULL, 0, &error_abort);
37 visit_type_q_obj_SHUTDOWN_arg_members(v, &param, &error_abort);
38 visit_check_struct(v, &error_abort);
39 visit_end_struct(v, NULL);
40
41 visit_complete(v, &obj);
42 qdict_put_obj(qmp, "data", obj);
43 qapi_event_emit(QAPI_EVENT_SHUTDOWN, qmp);
44
45 visit_free(v);
46 qobject_unref(qmp);
47}
48
49void qapi_event_send_powerdown(void)
50{
51 QDict *qmp;
52
53 qmp = qmp_event_build_dict("POWERDOWN");
54
55 qapi_event_emit(QAPI_EVENT_POWERDOWN, qmp);
56
57 qobject_unref(qmp);
58}
59
60void qapi_event_send_reset(bool guest, ShutdownCause reason)
61{
62 QDict *qmp;
63 QObject *obj;
64 Visitor *v;
65 q_obj_RESET_arg param = {
66 guest, reason
67 };
68
69 qmp = qmp_event_build_dict("RESET");
70
71 v = qobject_output_visitor_new(&obj);
72
73 visit_start_struct(v, "RESET", NULL, 0, &error_abort);
74 visit_type_q_obj_RESET_arg_members(v, &param, &error_abort);
75 visit_check_struct(v, &error_abort);
76 visit_end_struct(v, NULL);
77
78 visit_complete(v, &obj);
79 qdict_put_obj(qmp, "data", obj);
80 qapi_event_emit(QAPI_EVENT_RESET, qmp);
81
82 visit_free(v);
83 qobject_unref(qmp);
84}
85
86void qapi_event_send_stop(void)
87{
88 QDict *qmp;
89
90 qmp = qmp_event_build_dict("STOP");
91
92 qapi_event_emit(QAPI_EVENT_STOP, qmp);
93
94 qobject_unref(qmp);
95}
96
97void qapi_event_send_resume(void)
98{
99 QDict *qmp;
100
101 qmp = qmp_event_build_dict("RESUME");
102
103 qapi_event_emit(QAPI_EVENT_RESUME, qmp);
104
105 qobject_unref(qmp);
106}
107
108void qapi_event_send_suspend(void)
109{
110 QDict *qmp;
111
112 qmp = qmp_event_build_dict("SUSPEND");
113
114 qapi_event_emit(QAPI_EVENT_SUSPEND, qmp);
115
116 qobject_unref(qmp);
117}
118
119void qapi_event_send_suspend_disk(void)
120{
121 QDict *qmp;
122
123 qmp = qmp_event_build_dict("SUSPEND_DISK");
124
125 qapi_event_emit(QAPI_EVENT_SUSPEND_DISK, qmp);
126
127 qobject_unref(qmp);
128}
129
130void qapi_event_send_wakeup(void)
131{
132 QDict *qmp;
133
134 qmp = qmp_event_build_dict("WAKEUP");
135
136 qapi_event_emit(QAPI_EVENT_WAKEUP, qmp);
137
138 qobject_unref(qmp);
139}
140
141void qapi_event_send_watchdog(WatchdogAction action)
142{
143 QDict *qmp;
144 QObject *obj;
145 Visitor *v;
146 q_obj_WATCHDOG_arg param = {
147 action
148 };
149
150 qmp = qmp_event_build_dict("WATCHDOG");
151
152 v = qobject_output_visitor_new(&obj);
153
154 visit_start_struct(v, "WATCHDOG", NULL, 0, &error_abort);
155 visit_type_q_obj_WATCHDOG_arg_members(v, &param, &error_abort);
156 visit_check_struct(v, &error_abort);
157 visit_end_struct(v, NULL);
158
159 visit_complete(v, &obj);
160 qdict_put_obj(qmp, "data", obj);
161 qapi_event_emit(QAPI_EVENT_WATCHDOG, qmp);
162
163 visit_free(v);
164 qobject_unref(qmp);
165}
166
167void qapi_event_send_guest_panicked(GuestPanicAction action, bool has_info, GuestPanicInformation *info)
168{
169 QDict *qmp;
170 QObject *obj;
171 Visitor *v;
172 q_obj_GUEST_PANICKED_arg param = {
173 action, has_info, info
174 };
175
176 qmp = qmp_event_build_dict("GUEST_PANICKED");
177
178 v = qobject_output_visitor_new(&obj);
179
180 visit_start_struct(v, "GUEST_PANICKED", NULL, 0, &error_abort);
181 visit_type_q_obj_GUEST_PANICKED_arg_members(v, &param, &error_abort);
182 visit_check_struct(v, &error_abort);
183 visit_end_struct(v, NULL);
184
185 visit_complete(v, &obj);
186 qdict_put_obj(qmp, "data", obj);
187 qapi_event_emit(QAPI_EVENT_GUEST_PANICKED, qmp);
188
189 visit_free(v);
190 qobject_unref(qmp);
191}
192
193/* Dummy declaration to prevent empty .o file */
194char qapi_dummy_qapi_events_run_state_c;
195