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" |
Paolo Bonzini | 7b1b5d1 | 2012-12-17 18:19:43 +0100 | [diff] [blame] | 5 | #include "qapi/qmp/qerror.h" |
| 6 | #include "qapi/qmp/qdict.h" |
Paolo Bonzini | 737e150 | 2012-12-17 18:19:44 +0100 | [diff] [blame] | 7 | #include "block/block.h" |
Stefan Hajnoczi | 0150cd8 | 2013-11-14 11:54:15 +0100 | [diff] [blame] | 8 | #include "qemu/readline.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 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 | |
Markus Armbruster | 6620d3c | 2010-02-11 17:05:43 +0100 | [diff] [blame] | 22 | int monitor_cur_is_qmp(void); |
| 23 | |
aliguori | 731b036 | 2009-03-05 23:01:42 +0000 | [diff] [blame] | 24 | void monitor_init(CharDriverState *chr, int flags); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 25 | |
aliguori | cde76ee | 2009-03-05 23:01:51 +0000 | [diff] [blame] | 26 | int monitor_suspend(Monitor *mon); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 27 | void monitor_resume(Monitor *mon); |
| 28 | |
Luiz Capitulino | 0bbc47b | 2010-02-10 23:50:01 -0200 | [diff] [blame] | 29 | int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, |
| 30 | BlockDriverCompletionFunc *completion_cb, |
| 31 | void *opaque); |
Luiz Capitulino | e42e818 | 2011-11-22 17:58:31 -0200 | [diff] [blame] | 32 | int monitor_read_block_device_key(Monitor *mon, const char *device, |
| 33 | BlockDriverCompletionFunc *completion_cb, |
| 34 | void *opaque); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 35 | |
Paolo Bonzini | a9940fc | 2012-09-20 16:50:32 +0200 | [diff] [blame] | 36 | int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); |
Nicholas Bellinger | a96ed02 | 2012-08-21 20:52:07 +0000 | [diff] [blame] | 37 | int monitor_handle_fd_param(Monitor *mon, const char *fdname); |
Laszlo Ersek | 5906366 | 2014-04-10 10:24:31 +0200 | [diff] [blame] | 38 | int monitor_handle_fd_param2(Monitor *mon, const char *fdname, Error **errp); |
Mark McLoughlin | 7768e04 | 2009-07-22 09:11:41 +0100 | [diff] [blame] | 39 | |
Stefan Weil | 8b7968f | 2010-09-23 21:28:05 +0200 | [diff] [blame] | 40 | void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) |
| 41 | GCC_FMT_ATTR(2, 0); |
Stefan Weil | e5924d8 | 2010-09-23 21:28:03 +0200 | [diff] [blame] | 42 | void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 43 | void monitor_flush(Monitor *mon); |
Luiz Capitulino | b025c8b | 2011-10-06 14:02:57 -0300 | [diff] [blame] | 44 | int monitor_set_cpu(int cpu_index); |
Luiz Capitulino | 99b7796 | 2011-10-24 10:53:44 -0200 | [diff] [blame] | 45 | int monitor_get_cpu_index(void); |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 46 | |
Adam Litke | 940cc30 | 2010-01-25 12:18:44 -0600 | [diff] [blame] | 47 | typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); |
| 48 | |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 49 | void monitor_set_error(Monitor *mon, QError *qerror); |
Anthony Liguori | 7060b47 | 2011-09-02 12:34:50 -0500 | [diff] [blame] | 50 | void monitor_read_command(Monitor *mon, int show_prompt); |
| 51 | ReadLineState *monitor_get_rs(Monitor *mon); |
| 52 | int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, |
| 53 | void *opaque); |
Markus Armbruster | d6f4683 | 2010-02-17 10:52:26 +0100 | [diff] [blame] | 54 | |
Anthony Liguori | eb6e8ea | 2011-12-12 14:29:35 -0600 | [diff] [blame] | 55 | int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); |
| 56 | |
| 57 | int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); |
Paolo Bonzini | cff8b2c | 2013-12-20 23:21:10 +0100 | [diff] [blame] | 58 | int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret); |
| 59 | void object_add(const char *type, const char *id, const QDict *qdict, |
| 60 | Visitor *v, Error **errp); |
Anthony Liguori | eb6e8ea | 2011-12-12 14:29:35 -0600 | [diff] [blame] | 61 | |
Corey Bryant | e446f70 | 2012-10-18 15:19:32 -0400 | [diff] [blame] | 62 | AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id, |
| 63 | bool has_opaque, const char *opaque, |
| 64 | Error **errp); |
Corey Bryant | adb696f | 2012-08-14 16:43:47 -0400 | [diff] [blame] | 65 | int monitor_fdset_get_fd(int64_t fdset_id, int flags); |
| 66 | int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); |
Michael S. Tsirkin | b3dd1b8 | 2014-08-17 11:45:17 +0200 | [diff] [blame] | 67 | void monitor_fdset_dup_fd_remove(int dup_fd); |
Corey Bryant | adb696f | 2012-08-14 16:43:47 -0400 | [diff] [blame] | 68 | int monitor_fdset_dup_fd_find(int dup_fd); |
| 69 | |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 70 | #endif /* !MONITOR_H */ |