Statistics
| Branch: | Revision:

root / qapi / qmp-core.h @ 0056c093

History | View | Annotate | Download (966 Bytes)

1 43c20a43 Michael Roth
/*
2 43c20a43 Michael Roth
 * Core Definitions for QAPI/QMP Dispatch
3 43c20a43 Michael Roth
 *
4 43c20a43 Michael Roth
 * Copyright IBM, Corp. 2011
5 43c20a43 Michael Roth
 *
6 43c20a43 Michael Roth
 * Authors:
7 43c20a43 Michael Roth
 *  Anthony Liguori   <aliguori@us.ibm.com>
8 43c20a43 Michael Roth
 *
9 43c20a43 Michael Roth
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 43c20a43 Michael Roth
 * See the COPYING.LIB file in the top-level directory.
11 43c20a43 Michael Roth
 *
12 43c20a43 Michael Roth
 */
13 43c20a43 Michael Roth
14 43c20a43 Michael Roth
#ifndef QMP_CORE_H
15 43c20a43 Michael Roth
#define QMP_CORE_H
16 43c20a43 Michael Roth
17 43c20a43 Michael Roth
#include "qobject.h"
18 43c20a43 Michael Roth
#include "qdict.h"
19 43c20a43 Michael Roth
#include "error.h"
20 43c20a43 Michael Roth
21 43c20a43 Michael Roth
typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
22 43c20a43 Michael Roth
23 43c20a43 Michael Roth
typedef enum QmpCommandType
24 43c20a43 Michael Roth
{
25 43c20a43 Michael Roth
    QCT_NORMAL,
26 43c20a43 Michael Roth
} QmpCommandType;
27 43c20a43 Michael Roth
28 43c20a43 Michael Roth
typedef struct QmpCommand
29 43c20a43 Michael Roth
{
30 43c20a43 Michael Roth
    const char *name;
31 43c20a43 Michael Roth
    QmpCommandType type;
32 43c20a43 Michael Roth
    QmpCommandFunc *fn;
33 43c20a43 Michael Roth
    QTAILQ_ENTRY(QmpCommand) node;
34 abd6cf6d Michael Roth
    bool enabled;
35 43c20a43 Michael Roth
} QmpCommand;
36 43c20a43 Michael Roth
37 43c20a43 Michael Roth
void qmp_register_command(const char *name, QmpCommandFunc *fn);
38 43c20a43 Michael Roth
QmpCommand *qmp_find_command(const char *name);
39 ab02ab2a Michael Roth
QObject *qmp_dispatch(QObject *request);
40 abd6cf6d Michael Roth
void qmp_disable_command(const char *name);
41 bf95c0d5 Michael Roth
bool qmp_command_is_enabled(const char *name);
42 abd6cf6d Michael Roth
char **qmp_get_command_list(void);
43 43c20a43 Michael Roth
44 43c20a43 Michael Roth
#endif