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" |
Anthony Liguori | 7060b47 | 2011-09-02 12:34:50 -0500 | [diff] [blame] | 9 | #include "readline.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 10 | |
| 11 | extern Monitor *cur_mon; |
Markus Armbruster | 8631b60 | 2010-02-18 11:41:55 +0100 | [diff] [blame] | 12 | extern Monitor *default_mon; |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 13 | |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 14 | /* flags for monitor_init */ |
| 15 | #define MONITOR_IS_DEFAULT 0x01 |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 16 | #define MONITOR_USE_READLINE 0x02 |
Luiz Capitulino | 418173c | 2009-11-26 22:58:51 -0200 | [diff] [blame] | 17 | #define MONITOR_USE_CONTROL 0x04 |
Daniel P. Berrange | 39eaab9 | 2010-06-07 15:42:31 +0100 | [diff] [blame] | 18 | #define MONITOR_USE_PRETTY 0x08 |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 19 | |
Jan Kiszka | 8ac470c | 2010-06-16 00:38:39 +0200 | [diff] [blame] | 20 | /* flags for monitor commands */ |
| 21 | #define MONITOR_CMD_ASYNC 0x0001 |
| 22 | |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 23 | /* QMP events */ |
| 24 | typedef enum MonitorEvent { |
Blue Swirl | 242cd00 | 2009-12-04 18:05:45 +0000 | [diff] [blame] | 25 | QEVENT_SHUTDOWN, |
| 26 | QEVENT_RESET, |
| 27 | QEVENT_POWERDOWN, |
| 28 | QEVENT_STOP, |
Luiz Capitulino | 6ed2c48 | 2010-04-27 20:35:59 -0300 | [diff] [blame] | 29 | QEVENT_RESUME, |
Luiz Capitulino | 586153d | 2010-01-14 14:50:57 -0200 | [diff] [blame] | 30 | QEVENT_VNC_CONNECTED, |
Luiz Capitulino | 0d2ed46 | 2010-01-14 14:50:59 -0200 | [diff] [blame] | 31 | QEVENT_VNC_INITIALIZED, |
Luiz Capitulino | 0d72f3d | 2010-01-14 14:50:58 -0200 | [diff] [blame] | 32 | QEVENT_VNC_DISCONNECTED, |
Luiz Capitulino | aa1db6e | 2010-02-03 12:41:00 -0200 | [diff] [blame] | 33 | QEVENT_BLOCK_IO_ERROR, |
Luiz Capitulino | 80cd347 | 2010-02-25 12:11:44 -0300 | [diff] [blame] | 34 | QEVENT_RTC_CHANGE, |
Luiz Capitulino | 9eedeb3 | 2010-02-25 12:13:04 -0300 | [diff] [blame] | 35 | QEVENT_WATCHDOG, |
Gerd Hoffmann | 6f8c63f | 2010-10-11 18:03:51 +0200 | [diff] [blame] | 36 | QEVENT_SPICE_CONNECTED, |
| 37 | QEVENT_SPICE_INITIALIZED, |
| 38 | QEVENT_SPICE_DISCONNECTED, |
Stefan Hajnoczi | 12bd451 | 2012-01-18 14:40:46 +0000 | [diff] [blame^] | 39 | QEVENT_BLOCK_JOB_COMPLETED, |
Blue Swirl | 242cd00 | 2009-12-04 18:05:45 +0000 | [diff] [blame] | 40 | QEVENT_MAX, |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 41 | } MonitorEvent; |
| 42 | |
Markus Armbruster | 6620d3c | 2010-02-11 17:05:43 +0100 | [diff] [blame] | 43 | int monitor_cur_is_qmp(void); |
| 44 | |
Luiz Capitulino | 0d1ea87 | 2009-11-26 22:59:03 -0200 | [diff] [blame] | 45 | void monitor_protocol_event(MonitorEvent event, QObject *data); |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 46 | void monitor_init(CharDriverState *chr, int flags); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 47 | |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 48 | int monitor_suspend(Monitor *mon); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 49 | void monitor_resume(Monitor *mon); |
| 50 | |
Luiz Capitulino | 0bbc47b | 2010-02-10 23:50:01 -0200 | [diff] [blame] | 51 | int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, |
| 52 | BlockDriverCompletionFunc *completion_cb, |
| 53 | void *opaque); |
Luiz Capitulino | e42e818 | 2011-11-22 17:58:31 -0200 | [diff] [blame] | 54 | int monitor_read_block_device_key(Monitor *mon, const char *device, |
| 55 | BlockDriverCompletionFunc *completion_cb, |
| 56 | void *opaque); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 57 | |
Mark McLoughlin | 7768e04 | 2009-07-22 09:11:41 +0100 | [diff] [blame] | 58 | int monitor_get_fd(Monitor *mon, const char *fdname); |
| 59 | |
Stefan Weil | 8b7968f | 2010-09-23 21:28:05 +0200 | [diff] [blame] | 60 | void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) |
| 61 | GCC_FMT_ATTR(2, 0); |
Stefan Weil | e5924d8 | 2010-09-23 21:28:03 +0200 | [diff] [blame] | 62 | void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 63 | void monitor_print_filename(Monitor *mon, const char *filename); |
| 64 | void monitor_flush(Monitor *mon); |
Luiz Capitulino | b025c8b | 2011-10-06 14:02:57 -0300 | [diff] [blame] | 65 | int monitor_set_cpu(int cpu_index); |
Luiz Capitulino | 99b7796 | 2011-10-24 10:53:44 -0200 | [diff] [blame] | 66 | int monitor_get_cpu_index(void); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 67 | |
Adam Litke | 940cc30 | 2010-01-25 12:18:44 -0600 | [diff] [blame] | 68 | typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); |
| 69 | |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 70 | void monitor_set_error(Monitor *mon, QError *qerror); |
Anthony Liguori | 7060b47 | 2011-09-02 12:34:50 -0500 | [diff] [blame] | 71 | void monitor_read_command(Monitor *mon, int show_prompt); |
| 72 | ReadLineState *monitor_get_rs(Monitor *mon); |
| 73 | int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, |
| 74 | void *opaque); |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 75 | |
Anthony Liguori | eb6e8ea | 2011-12-12 14:29:35 -0600 | [diff] [blame] | 76 | int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); |
| 77 | |
| 78 | int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); |
| 79 | |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 80 | #endif /* !MONITOR_H */ |