monitor.h 1.6 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

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

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,
35
    QEVENT_MAX,
36 37
} MonitorEvent;

38 39
int monitor_cur_is_qmp(void);

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

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

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

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

A
aliguori 已提交
52 53 54 55 56 57
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);

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

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

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