qmp-core.h 822 B

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