Statistics
| Branch: | Revision:

root / qapi / qmp-core.h @ ab02ab2a

History | View | Annotate | Download (822 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 43c20a43 Michael Roth
} QmpCommand;
35 43c20a43 Michael Roth
36 43c20a43 Michael Roth
void qmp_register_command(const char *name, QmpCommandFunc *fn);
37 43c20a43 Michael Roth
QmpCommand *qmp_find_command(const char *name);
38 ab02ab2a Michael Roth
QObject *qmp_dispatch(QObject *request);
39 43c20a43 Michael Roth
40 43c20a43 Michael Roth
#endif