]>
Commit | Line | Data |
---|---|---|
376253ec AL |
1 | #ifndef MONITOR_H |
2 | #define MONITOR_H | |
3 | ||
4 | #include "qemu-common.h" | |
5 | #include "qemu-char.h" | |
d6f46833 | 6 | #include "qerror.h" |
cdb0def3 | 7 | #include "qdict.h" |
376253ec | 8 | #include "block.h" |
7060b478 | 9 | #include "readline.h" |
376253ec AL |
10 | |
11 | extern Monitor *cur_mon; | |
8631b608 | 12 | extern Monitor *default_mon; |
376253ec | 13 | |
731b0364 AL |
14 | /* flags for monitor_init */ |
15 | #define MONITOR_IS_DEFAULT 0x01 | |
cde76ee1 | 16 | #define MONITOR_USE_READLINE 0x02 |
418173c7 | 17 | #define MONITOR_USE_CONTROL 0x04 |
39eaab9a | 18 | #define MONITOR_USE_PRETTY 0x08 |
731b0364 | 19 | |
8ac470c1 JK |
20 | /* flags for monitor commands */ |
21 | #define MONITOR_CMD_ASYNC 0x0001 | |
22 | ||
0d1ea871 LC |
23 | /* QMP events */ |
24 | typedef enum MonitorEvent { | |
242cd003 BS |
25 | QEVENT_SHUTDOWN, |
26 | QEVENT_RESET, | |
27 | QEVENT_POWERDOWN, | |
28 | QEVENT_STOP, | |
6ed2c484 | 29 | QEVENT_RESUME, |
586153d9 | 30 | QEVENT_VNC_CONNECTED, |
0d2ed46a | 31 | QEVENT_VNC_INITIALIZED, |
0d72f3d3 | 32 | QEVENT_VNC_DISCONNECTED, |
aa1db6ed | 33 | QEVENT_BLOCK_IO_ERROR, |
80cd3478 | 34 | QEVENT_RTC_CHANGE, |
9eedeb3b | 35 | QEVENT_WATCHDOG, |
6f8c63fb GH |
36 | QEVENT_SPICE_CONNECTED, |
37 | QEVENT_SPICE_INITIALIZED, | |
38 | QEVENT_SPICE_DISCONNECTED, | |
12bd451f | 39 | QEVENT_BLOCK_JOB_COMPLETED, |
370521a1 | 40 | QEVENT_BLOCK_JOB_CANCELLED, |
32c81a4a | 41 | QEVENT_BLOCK_JOB_ERROR, |
a66a2a36 | 42 | QEVENT_BLOCK_JOB_READY, |
6f382ed2 | 43 | QEVENT_DEVICE_TRAY_MOVED, |
53370b78 | 44 | QEVENT_SUSPEND, |
25df49f6 | 45 | QEVENT_SUSPEND_DISK, |
53370b78 | 46 | QEVENT_WAKEUP, |
973603a8 | 47 | QEVENT_BALLOON_CHANGE, |
2fdd16e2 | 48 | QEVENT_SPICE_MIGRATE_COMPLETED, |
4860853d DB |
49 | |
50 | /* Add to 'monitor_event_names' array in monitor.c when | |
51 | * defining new events here */ | |
52 | ||
242cd003 | 53 | QEVENT_MAX, |
0d1ea871 LC |
54 | } MonitorEvent; |
55 | ||
6620d3ce MA |
56 | int monitor_cur_is_qmp(void); |
57 | ||
0d1ea871 | 58 | void monitor_protocol_event(MonitorEvent event, QObject *data); |
731b0364 | 59 | void monitor_init(CharDriverState *chr, int flags); |
376253ec | 60 | |
cde76ee1 | 61 | int monitor_suspend(Monitor *mon); |
376253ec AL |
62 | void monitor_resume(Monitor *mon); |
63 | ||
0bbc47bb LC |
64 | int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, |
65 | BlockDriverCompletionFunc *completion_cb, | |
66 | void *opaque); | |
e42e818b LC |
67 | int monitor_read_block_device_key(Monitor *mon, const char *device, |
68 | BlockDriverCompletionFunc *completion_cb, | |
69 | void *opaque); | |
376253ec | 70 | |
a9940fc4 | 71 | int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); |
a96ed02f | 72 | int monitor_handle_fd_param(Monitor *mon, const char *fdname); |
7768e04c | 73 | |
8b7968f7 SW |
74 | void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) |
75 | GCC_FMT_ATTR(2, 0); | |
e5924d89 | 76 | void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); |
376253ec AL |
77 | void monitor_print_filename(Monitor *mon, const char *filename); |
78 | void monitor_flush(Monitor *mon); | |
b025c8b4 | 79 | int monitor_set_cpu(int cpu_index); |
99b7796f | 80 | int monitor_get_cpu_index(void); |
376253ec | 81 | |
940cc30d AL |
82 | typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); |
83 | ||
d6f46833 | 84 | void monitor_set_error(Monitor *mon, QError *qerror); |
7060b478 AL |
85 | void monitor_read_command(Monitor *mon, int show_prompt); |
86 | ReadLineState *monitor_get_rs(Monitor *mon); | |
87 | int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, | |
88 | void *opaque); | |
d6f46833 | 89 | |
eb6e8ea5 AL |
90 | int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); |
91 | ||
92 | int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); | |
93 | ||
e446f70d CB |
94 | AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id, |
95 | bool has_opaque, const char *opaque, | |
96 | Error **errp); | |
adb696f3 CB |
97 | int monitor_fdset_get_fd(int64_t fdset_id, int flags); |
98 | int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); | |
99 | int monitor_fdset_dup_fd_remove(int dup_fd); | |
100 | int monitor_fdset_dup_fd_find(int dup_fd); | |
101 | ||
376253ec | 102 | #endif /* !MONITOR_H */ |