more cleanup
This commit is contained in:
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* QMP Event related
|
||||
*
|
||||
* Copyright (c) 2014 Wenchao Xia
|
||||
*
|
||||
* Authors:
|
||||
* Wenchao Xia <wenchaoqemu@gmail.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QMP_EVENT_H
|
||||
#define QMP_EVENT_H
|
||||
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
|
||||
typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp);
|
||||
|
||||
void qmp_event_set_func_emit(QMPEventFuncEmit emit);
|
||||
|
||||
QMPEventFuncEmit qmp_event_get_func_emit(void);
|
||||
|
||||
QDict *qmp_event_build_dict(const char *event_name);
|
||||
#endif
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Core Definitions for QAPI/QMP Dispatch
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QMP_CORE_H
|
||||
#define QMP_CORE_H
|
||||
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
|
||||
|
||||
typedef enum QmpCommandType
|
||||
{
|
||||
QCT_NORMAL,
|
||||
} QmpCommandType;
|
||||
|
||||
typedef enum QmpCommandOptions
|
||||
{
|
||||
QCO_NO_OPTIONS = 0x0,
|
||||
QCO_NO_SUCCESS_RESP = 0x1,
|
||||
} QmpCommandOptions;
|
||||
|
||||
typedef struct QmpCommand
|
||||
{
|
||||
const char *name;
|
||||
QmpCommandType type;
|
||||
QmpCommandFunc *fn;
|
||||
QmpCommandOptions options;
|
||||
QTAILQ_ENTRY(QmpCommand) node;
|
||||
bool enabled;
|
||||
} QmpCommand;
|
||||
|
||||
void qmp_register_command(const char *name, QmpCommandFunc *fn,
|
||||
QmpCommandOptions options);
|
||||
QmpCommand *qmp_find_command(const char *name);
|
||||
QObject *qmp_dispatch(QObject *request);
|
||||
void qmp_disable_command(const char *name);
|
||||
void qmp_enable_command(const char *name);
|
||||
bool qmp_command_is_enabled(const QmpCommand *cmd);
|
||||
const char *qmp_command_name(const QmpCommand *cmd);
|
||||
bool qmp_has_success_response(const QmpCommand *cmd);
|
||||
QObject *qmp_build_error_object(Error *err);
|
||||
typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque);
|
||||
void qmp_for_each_command(qmp_cmd_callback_fn fn, void *opaque);
|
||||
|
||||
#endif
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* JSON lexer
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_JSON_LEXER_H
|
||||
#define QEMU_JSON_LEXER_H
|
||||
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
|
||||
typedef enum json_token_type {
|
||||
JSON_OPERATOR = 100,
|
||||
JSON_INTEGER,
|
||||
JSON_FLOAT,
|
||||
JSON_KEYWORD,
|
||||
JSON_STRING,
|
||||
JSON_ESCAPE,
|
||||
JSON_SKIP,
|
||||
JSON_ERROR,
|
||||
} JSONTokenType;
|
||||
|
||||
typedef struct JSONLexer JSONLexer;
|
||||
|
||||
typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y);
|
||||
|
||||
struct JSONLexer
|
||||
{
|
||||
JSONLexerEmitter *emit;
|
||||
int state;
|
||||
QString *token;
|
||||
int x, y;
|
||||
};
|
||||
|
||||
void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func);
|
||||
|
||||
int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size);
|
||||
|
||||
int json_lexer_flush(JSONLexer *lexer);
|
||||
|
||||
void json_lexer_destroy(JSONLexer *lexer);
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* JSON Parser
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_JSON_PARSER_H
|
||||
#define QEMU_JSON_PARSER_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
QObject *json_parser_parse(QList *tokens, va_list *ap);
|
||||
QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp);
|
||||
|
||||
#endif
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* JSON streaming support
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_JSON_STREAMER_H
|
||||
#define QEMU_JSON_STREAMER_H
|
||||
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/json-lexer.h"
|
||||
|
||||
typedef struct JSONMessageParser
|
||||
{
|
||||
void (*emit)(struct JSONMessageParser *parser, QList *tokens);
|
||||
JSONLexer lexer;
|
||||
int brace_count;
|
||||
int bracket_count;
|
||||
QList *tokens;
|
||||
uint64_t token_size;
|
||||
} JSONMessageParser;
|
||||
|
||||
void json_message_parser_init(JSONMessageParser *parser,
|
||||
void (*func)(JSONMessageParser *, QList *));
|
||||
|
||||
int json_message_parser_feed(JSONMessageParser *parser,
|
||||
const char *buffer, size_t size);
|
||||
|
||||
int json_message_parser_flush(JSONMessageParser *parser);
|
||||
|
||||
void json_message_parser_destroy(JSONMessageParser *parser);
|
||||
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* QAPI util functions
|
||||
*
|
||||
* Copyright Fujitsu, Inc. 2014
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QAPI_UTIL_H
|
||||
#define QAPI_UTIL_H
|
||||
|
||||
int qapi_enum_parse(const char *lookup[], const char *buf,
|
||||
int max, int def, Error **errp);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user