monitor.h 1.7 KB
Newer Older
A
aliguori 已提交
1 2 3 4 5
#ifndef MONITOR_H
#define MONITOR_H

#include "qemu-common.h"
#include "qemu-char.h"
6
#include "qerror.h"
L
Luiz Capitulino 已提交
7
#include "qdict.h"
A
aliguori 已提交
8 9 10
#include "block.h"

extern Monitor *cur_mon;
11
extern Monitor *default_mon;
A
aliguori 已提交
12

13 14
/* flags for monitor_init */
#define MONITOR_IS_DEFAULT    0x01
15
#define MONITOR_USE_READLINE  0x02
16
#define MONITOR_USE_CONTROL   0x04
17
#define MONITOR_USE_PRETTY    0x08
18

19 20 21
/* flags for monitor commands */
#define MONITOR_CMD_ASYNC       0x0001

22 23
/* QMP events */
typedef enum MonitorEvent {
24 25 26 27
    QEVENT_SHUTDOWN,
    QEVENT_RESET,
    QEVENT_POWERDOWN,
    QEVENT_STOP,
L
Luiz Capitulino 已提交
28
    QEVENT_RESUME,
29
    QEVENT_VNC_CONNECTED,
30
    QEVENT_VNC_INITIALIZED,
31
    QEVENT_VNC_DISCONNECTED,
32
    QEVENT_BLOCK_IO_ERROR,
33
    QEVENT_RTC_CHANGE,
L
Luiz Capitulino 已提交
34
    QEVENT_WATCHDOG,
G
Gerd Hoffmann 已提交
35 36 37
    QEVENT_SPICE_CONNECTED,
    QEVENT_SPICE_INITIALIZED,
    QEVENT_SPICE_DISCONNECTED,
38
    QEVENT_MAX,
39 40
} MonitorEvent;

41 42
int monitor_cur_is_qmp(void);

43
void monitor_protocol_event(MonitorEvent event, QObject *data);
44
void monitor_init(CharDriverState *chr, int flags);
A
aliguori 已提交
45

46
int monitor_suspend(Monitor *mon);
A
aliguori 已提交
47 48
void monitor_resume(Monitor *mon);

49 50 51
int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
                                BlockDriverCompletionFunc *completion_cb,
                                void *opaque);
A
aliguori 已提交
52

53 54
int monitor_get_fd(Monitor *mon, const char *fdname);

S
Stefan Weil 已提交
55 56
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
    GCC_FMT_ATTR(2, 0);
57
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
A
aliguori 已提交
58 59 60
void monitor_print_filename(Monitor *mon, const char *filename);
void monitor_flush(Monitor *mon);

61 62
typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);

63 64
void monitor_set_error(Monitor *mon, QError *qerror);

A
aliguori 已提交
65
#endif /* !MONITOR_H */