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 |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 17 | |
Jan Kiszka | 8ac470c | 2010-06-16 00:38:39 +0200 | [diff] [blame] | 18 | /* flags for monitor commands */ |
| 19 | #define MONITOR_CMD_ASYNC 0x0001 |
Jan Kiszka | a6c4d36 | 2010-06-28 18:27:47 +0200 | [diff] [blame] | 20 | #define MONITOR_CMD_USER_ONLY 0x0002 |
Jan Kiszka | 8ac470c | 2010-06-16 00:38:39 +0200 | [diff] [blame] | 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, |
Blue Swirl | 242cd00 | 2009-12-04 18:05:45 +0000 | [diff] [blame] | 35 | QEVENT_MAX, |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 36 | } MonitorEvent; |
| 37 | |
Markus Armbruster | 6620d3c | 2010-02-11 17:05:43 +0100 | [diff] [blame] | 38 | int monitor_cur_is_qmp(void); |
| 39 | |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 40 | void monitor_protocol_event(MonitorEvent event, QObject *data); |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 41 | void monitor_init(CharDriverState *chr, int flags); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 42 | |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 43 | int monitor_suspend(Monitor *mon); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 44 | void monitor_resume(Monitor *mon); |
| 45 | |
Luiz Capitulino | 0bbc47b | 2010-02-10 23:50:01 -0200 | [diff] [blame] | 46 | int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, |
| 47 | BlockDriverCompletionFunc *completion_cb, |
| 48 | void *opaque); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 49 | |
Mark McLoughlin | 7768e04 | 2009-07-22 09:11:41 +0100 | [diff] [blame] | 50 | int monitor_get_fd(Monitor *mon, const char *fdname); |
| 51 | |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 52 | void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap); |
| 53 | void monitor_printf(Monitor *mon, const char *fmt, ...) |
| 54 | __attribute__ ((__format__ (__printf__, 2, 3))); |
| 55 | void monitor_print_filename(Monitor *mon, const char *filename); |
| 56 | void monitor_flush(Monitor *mon); |
| 57 | |
Adam Litke | 940cc30 | 2010-01-25 12:18:44 -0600 | [diff] [blame] | 58 | typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); |
| 59 | |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 60 | void monitor_set_error(Monitor *mon, QError *qerror); |
| 61 | |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 62 | #endif /* !MONITOR_H */ |