qjson: replace QString in JSONLexer with GString
[qemu.git] / include / qapi / qmp / json-streamer.h
blobe90114476a190993fb29978b523b7599a58a1a25
1 /*
2 * JSON streaming support
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 QEMU_JSON_STREAMER_H
15 #define QEMU_JSON_STREAMER_H
17 #include <stdint.h>
18 #include "qapi/qmp/qlist.h"
19 #include "qapi/qmp/json-lexer.h"
21 typedef struct JSONMessageParser
23 void (*emit)(struct JSONMessageParser *parser, QList *tokens);
24 JSONLexer lexer;
25 int brace_count;
26 int bracket_count;
27 QList *tokens;
28 uint64_t token_size;
29 } JSONMessageParser;
31 void json_message_parser_init(JSONMessageParser *parser,
32 void (*func)(JSONMessageParser *, QList *));
34 int json_message_parser_feed(JSONMessageParser *parser,
35 const char *buffer, size_t size);
37 int json_message_parser_flush(JSONMessageParser *parser);
39 void json_message_parser_destroy(JSONMessageParser *parser);
41 #endif