qapi/error: Check format string argument in error_*prepend()
[qemu/armbru.git] / include / qapi / qmp / json-parser.h
blob7345a9bd5cb5bc08a88c31931e46977dbcba7cae
1 /*
2 * JSON Parser
4 * Copyright IBM, Corp. 2009
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
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.
14 #ifndef QAPI_QMP_JSON_PARSER_H
15 #define QAPI_QMP_JSON_PARSER_H
17 typedef struct JSONLexer {
18 int start_state, state;
19 GString *token;
20 int x, y;
21 } JSONLexer;
23 typedef struct JSONMessageParser {
24 void (*emit)(void *opaque, QObject *json, Error *err);
25 void *opaque;
26 va_list *ap;
27 JSONLexer lexer;
28 int brace_count;
29 int bracket_count;
30 GQueue tokens;
31 uint64_t token_size;
32 } JSONMessageParser;
34 void json_message_parser_init(JSONMessageParser *parser,
35 void (*emit)(void *opaque, QObject *json,
36 Error *err),
37 void *opaque, va_list *ap);
39 void json_message_parser_feed(JSONMessageParser *parser,
40 const char *buffer, size_t size);
42 void json_message_parser_flush(JSONMessageParser *parser);
44 void json_message_parser_destroy(JSONMessageParser *parser);
46 #endif