virtio: fix error message for number of queues
[qemu.git] / include / qapi / qmp / json-streamer.h
blob09b3d3ec15e89d1eafefb00ecea9c61feb91c471
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 "glib-compat.h"
19 #include "qapi/qmp/json-lexer.h"
21 typedef struct JSONToken {
22 int type;
23 int x;
24 int y;
25 char str[];
26 } JSONToken;
28 typedef struct JSONMessageParser
30 void (*emit)(struct JSONMessageParser *parser, GQueue *tokens);
31 JSONLexer lexer;
32 int brace_count;
33 int bracket_count;
34 GQueue *tokens;
35 uint64_t token_size;
36 } JSONMessageParser;
38 void json_message_parser_init(JSONMessageParser *parser,
39 void (*func)(JSONMessageParser *, GQueue *));
41 int json_message_parser_feed(JSONMessageParser *parser,
42 const char *buffer, size_t size);
44 int json_message_parser_flush(JSONMessageParser *parser);
46 void json_message_parser_destroy(JSONMessageParser *parser);
48 #endif