#include "chardev/char-fe.h"
#include "monitor/monitor.h"
-#include "qapi/qapi-types-misc.h"
#include "qapi/qmp/dispatch.h"
#include "qapi/qmp/json-parser.h"
#include "qemu/readline.h"
+#include "sysemu/iothread.h"
/*
* Supported types:
struct Monitor {
CharBackend chr;
int reset_seen;
- int flags;
int suspend_cnt; /* Needs to be accessed atomically */
+ bool is_qmp;
bool skip_flush;
bool use_io_thread;
struct MonitorHMP {
Monitor common;
+ bool use_readline;
/*
* State used only in the thread "owning" the monitor.
* If @use_io_thread, this is @mon_iothread. (This does not actually happen
typedef struct {
Monitor common;
JSONMessageParser parser;
+ bool pretty;
/*
* When a client connects, we're in capabilities negotiation mode.
* @commands is &qmp_cap_negotiation_commands then. When command
GQueue *qmp_requests;
} MonitorQMP;
+/**
+ * Is @mon a QMP monitor?
+ */
+static inline bool monitor_is_qmp(const Monitor *mon)
+{
+ return mon->is_qmp;
+}
+
+typedef QTAILQ_HEAD(MonitorList, Monitor) MonitorList;
+extern IOThread *mon_iothread;
+extern QEMUBH *qmp_dispatcher_bh;
+extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands;
+extern QemuMutex monitor_lock;
+extern MonitorList mon_list;
+extern int mon_refcount;
+
+extern HMPCommand hmp_cmds[];
+
+int monitor_puts(Monitor *mon, const char *str);
+void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,
+ bool use_io_thread);
+void monitor_data_destroy(Monitor *mon);
+int monitor_can_read(void *opaque);
+void monitor_list_append(Monitor *mon);
+void monitor_fdsets_cleanup(void);
+
+void qmp_send_response(MonitorQMP *mon, const QDict *rsp);
+void monitor_data_destroy_qmp(MonitorQMP *mon);
+void monitor_qmp_bh_dispatcher(void *data);
+
+int get_monitor_def(int64_t *pval, const char *name);
+void help_cmd(Monitor *mon, const char *name);
+void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
+int hmp_compare_cmd(const char *name, const char *list);
+
#endif