aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 1 | #ifndef MONITOR_H |
| 2 | #define MONITOR_H |
| 3 | |
| 4 | #include "qemu-common.h" |
| 5 | #include "qemu-char.h" |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 6 | #include "qerror.h" |
Luiz Capitulino | cdb0def | 2009-08-28 15:27:11 -0300 | [diff] [blame] | 7 | #include "qdict.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 8 | #include "block.h" |
| 9 | |
| 10 | extern Monitor *cur_mon; |
Markus Armbruster | 8631b60 | 2010-02-18 11:41:55 +0100 | [diff] [blame] | 11 | extern Monitor *default_mon; |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 12 | |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 13 | /* flags for monitor_init */ |
| 14 | #define MONITOR_IS_DEFAULT 0x01 |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 15 | #define MONITOR_USE_READLINE 0x02 |
Luiz Capitulino | 418173c | 2009-11-26 22:58:51 -0200 | [diff] [blame] | 16 | #define MONITOR_USE_CONTROL 0x04 |
Daniel P. Berrange | 39eaab9 | 2010-06-07 15:42:31 +0100 | [diff] [blame] | 17 | #define MONITOR_USE_PRETTY 0x08 |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 18 | |
Jan Kiszka | 8ac470c | 2010-06-16 00:38:39 +0200 | [diff] [blame] | 19 | /* flags for monitor commands */ |
| 20 | #define MONITOR_CMD_ASYNC 0x0001 |
| 21 | |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 22 | /* QMP events */ |
| 23 | typedef enum MonitorEvent { |
Blue Swirl | 242cd00 | 2009-12-04 18:05:45 +0000 | [diff] [blame] | 24 | QEVENT_SHUTDOWN, |
| 25 | QEVENT_RESET, |
| 26 | QEVENT_POWERDOWN, |
| 27 | QEVENT_STOP, |
Luiz Capitulino | 6ed2c48 | 2010-04-27 20:35:59 -0300 | [diff] [blame] | 28 | QEVENT_RESUME, |
Luiz Capitulino | 586153d | 2010-01-14 14:50:57 -0200 | [diff] [blame] | 29 | QEVENT_VNC_CONNECTED, |
Luiz Capitulino | 0d2ed46 | 2010-01-14 14:50:59 -0200 | [diff] [blame] | 30 | QEVENT_VNC_INITIALIZED, |
Luiz Capitulino | 0d72f3d | 2010-01-14 14:50:58 -0200 | [diff] [blame] | 31 | QEVENT_VNC_DISCONNECTED, |
Luiz Capitulino | aa1db6e | 2010-02-03 12:41:00 -0200 | [diff] [blame] | 32 | QEVENT_BLOCK_IO_ERROR, |
Luiz Capitulino | 80cd347 | 2010-02-25 12:11:44 -0300 | [diff] [blame] | 33 | QEVENT_RTC_CHANGE, |
Luiz Capitulino | 9eedeb3 | 2010-02-25 12:13:04 -0300 | [diff] [blame] | 34 | QEVENT_WATCHDOG, |
Gerd Hoffmann | 6f8c63f | 2010-10-11 18:03:51 +0200 | [diff] [blame] | 35 | QEVENT_SPICE_CONNECTED, |
| 36 | QEVENT_SPICE_INITIALIZED, |
| 37 | QEVENT_SPICE_DISCONNECTED, |
Blue Swirl | 242cd00 | 2009-12-04 18:05:45 +0000 | [diff] [blame] | 38 | QEVENT_MAX, |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 39 | } MonitorEvent; |
| 40 | |
Markus Armbruster | 6620d3c | 2010-02-11 17:05:43 +0100 | [diff] [blame] | 41 | int monitor_cur_is_qmp(void); |
| 42 | |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 43 | void monitor_protocol_event(MonitorEvent event, QObject *data); |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 44 | void monitor_init(CharDriverState *chr, int flags); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 45 | |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 46 | int monitor_suspend(Monitor *mon); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 47 | void monitor_resume(Monitor *mon); |
| 48 | |
Luiz Capitulino | 0bbc47b | 2010-02-10 23:50:01 -0200 | [diff] [blame] | 49 | int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, |
| 50 | BlockDriverCompletionFunc *completion_cb, |
| 51 | void *opaque); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 52 | |
Mark McLoughlin | 7768e04 | 2009-07-22 09:11:41 +0100 | [diff] [blame] | 53 | int monitor_get_fd(Monitor *mon, const char *fdname); |
| 54 | |
Stefan Weil | 8b7968f | 2010-09-23 21:28:05 +0200 | [diff] [blame] | 55 | void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) |
| 56 | GCC_FMT_ATTR(2, 0); |
Stefan Weil | e5924d8 | 2010-09-23 21:28:03 +0200 | [diff] [blame] | 57 | void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 58 | void monitor_print_filename(Monitor *mon, const char *filename); |
| 59 | void monitor_flush(Monitor *mon); |
| 60 | |
Adam Litke | 940cc30 | 2010-01-25 12:18:44 -0600 | [diff] [blame] | 61 | typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); |
| 62 | |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 63 | void monitor_set_error(Monitor *mon, QError *qerror); |
| 64 | |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 65 | #endif /* !MONITOR_H */ |