blob: 4f2d328db56808c677b8d1c690fa594c7075a2bc [file] [log] [blame]
aliguori376253e2009-03-05 23:01:23 +00001#ifndef MONITOR_H
2#define MONITOR_H
3
4#include "qemu-common.h"
5#include "qemu-char.h"
Markus Armbrusterd6f46832010-02-17 10:52:26 +01006#include "qerror.h"
Luiz Capitulinocdb0def2009-08-28 15:27:11 -03007#include "qdict.h"
aliguori376253e2009-03-05 23:01:23 +00008#include "block.h"
9
10extern Monitor *cur_mon;
Markus Armbruster8631b602010-02-18 11:41:55 +010011extern Monitor *default_mon;
aliguori376253e2009-03-05 23:01:23 +000012
aliguori731b0362009-03-05 23:01:42 +000013/* flags for monitor_init */
14#define MONITOR_IS_DEFAULT 0x01
aliguoricde76ee2009-03-05 23:01:51 +000015#define MONITOR_USE_READLINE 0x02
Luiz Capitulino418173c2009-11-26 22:58:51 -020016#define MONITOR_USE_CONTROL 0x04
Daniel P. Berrange39eaab92010-06-07 15:42:31 +010017#define MONITOR_USE_PRETTY 0x08
aliguori731b0362009-03-05 23:01:42 +000018
Jan Kiszka8ac470c2010-06-16 00:38:39 +020019/* flags for monitor commands */
20#define MONITOR_CMD_ASYNC 0x0001
21
Luiz Capitulino0d1ea872009-11-26 22:59:03 -020022/* QMP events */
23typedef enum MonitorEvent {
Blue Swirl242cd002009-12-04 18:05:45 +000024 QEVENT_SHUTDOWN,
25 QEVENT_RESET,
26 QEVENT_POWERDOWN,
27 QEVENT_STOP,
Luiz Capitulino6ed2c482010-04-27 20:35:59 -030028 QEVENT_RESUME,
Luiz Capitulino586153d2010-01-14 14:50:57 -020029 QEVENT_VNC_CONNECTED,
Luiz Capitulino0d2ed462010-01-14 14:50:59 -020030 QEVENT_VNC_INITIALIZED,
Luiz Capitulino0d72f3d2010-01-14 14:50:58 -020031 QEVENT_VNC_DISCONNECTED,
Luiz Capitulinoaa1db6e2010-02-03 12:41:00 -020032 QEVENT_BLOCK_IO_ERROR,
Luiz Capitulino80cd3472010-02-25 12:11:44 -030033 QEVENT_RTC_CHANGE,
Luiz Capitulino9eedeb32010-02-25 12:13:04 -030034 QEVENT_WATCHDOG,
Gerd Hoffmann6f8c63f2010-10-11 18:03:51 +020035 QEVENT_SPICE_CONNECTED,
36 QEVENT_SPICE_INITIALIZED,
37 QEVENT_SPICE_DISCONNECTED,
Blue Swirl242cd002009-12-04 18:05:45 +000038 QEVENT_MAX,
Luiz Capitulino0d1ea872009-11-26 22:59:03 -020039} MonitorEvent;
40
Markus Armbruster6620d3c2010-02-11 17:05:43 +010041int monitor_cur_is_qmp(void);
42
Luiz Capitulino0d1ea872009-11-26 22:59:03 -020043void monitor_protocol_event(MonitorEvent event, QObject *data);
aliguori731b0362009-03-05 23:01:42 +000044void monitor_init(CharDriverState *chr, int flags);
aliguori376253e2009-03-05 23:01:23 +000045
aliguoricde76ee2009-03-05 23:01:51 +000046int monitor_suspend(Monitor *mon);
aliguori376253e2009-03-05 23:01:23 +000047void monitor_resume(Monitor *mon);
48
Luiz Capitulino0bbc47b2010-02-10 23:50:01 -020049int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
50 BlockDriverCompletionFunc *completion_cb,
51 void *opaque);
aliguori376253e2009-03-05 23:01:23 +000052
Mark McLoughlin7768e042009-07-22 09:11:41 +010053int monitor_get_fd(Monitor *mon, const char *fdname);
54
Stefan Weil8b7968f2010-09-23 21:28:05 +020055void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
56 GCC_FMT_ATTR(2, 0);
Stefan Weile5924d82010-09-23 21:28:03 +020057void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
aliguori376253e2009-03-05 23:01:23 +000058void monitor_print_filename(Monitor *mon, const char *filename);
59void monitor_flush(Monitor *mon);
60
Adam Litke940cc302010-01-25 12:18:44 -060061typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);
62
Markus Armbrusterd6f46832010-02-17 10:52:26 +010063void monitor_set_error(Monitor *mon, QError *qerror);
64
aliguori376253e2009-03-05 23:01:23 +000065#endif /* !MONITOR_H */