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
/* flags for monitor commands */
#define MONITOR_CMD_ASYNC       0x0001
21
#define MONITOR_CMD_USER_ONLY   0x0002
22

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

39 40
int monitor_cur_is_qmp(void);

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

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

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

51 52
int monitor_get_fd(Monitor *mon, const char *fdname);

A
aliguori 已提交
53 54 55 56 57 58
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap);
void monitor_printf(Monitor *mon, const char *fmt, ...)
    __attribute__ ((__format__ (__printf__, 2, 3)));
void monitor_print_filename(Monitor *mon, const char *filename);
void monitor_flush(Monitor *mon);

59 60
typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);

61 62
void monitor_set_error(Monitor *mon, QError *qerror);

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