root / json-streamer.h @ 44e4c0ba
History | View | Annotate | Download (959 Bytes)
1 | d7ff3acb | Anthony Liguori | /*
|
---|---|---|---|
2 | d7ff3acb | Anthony Liguori | * JSON streaming support
|
3 | d7ff3acb | Anthony Liguori | *
|
4 | d7ff3acb | Anthony Liguori | * Copyright IBM, Corp. 2009
|
5 | d7ff3acb | Anthony Liguori | *
|
6 | d7ff3acb | Anthony Liguori | * Authors:
|
7 | d7ff3acb | Anthony Liguori | * Anthony Liguori <aliguori@us.ibm.com>
|
8 | d7ff3acb | Anthony Liguori | *
|
9 | d7ff3acb | Anthony Liguori | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
10 | d7ff3acb | Anthony Liguori | * See the COPYING.LIB file in the top-level directory.
|
11 | d7ff3acb | Anthony Liguori | *
|
12 | d7ff3acb | Anthony Liguori | */
|
13 | d7ff3acb | Anthony Liguori | |
14 | d7ff3acb | Anthony Liguori | #ifndef QEMU_JSON_STREAMER_H
|
15 | d7ff3acb | Anthony Liguori | #define QEMU_JSON_STREAMER_H
|
16 | d7ff3acb | Anthony Liguori | |
17 | d7ff3acb | Anthony Liguori | #include "qlist.h" |
18 | d7ff3acb | Anthony Liguori | #include "json-lexer.h" |
19 | d7ff3acb | Anthony Liguori | |
20 | d7ff3acb | Anthony Liguori | typedef struct JSONMessageParser |
21 | d7ff3acb | Anthony Liguori | { |
22 | d7ff3acb | Anthony Liguori | void (*emit)(struct JSONMessageParser *parser, QList *tokens); |
23 | d7ff3acb | Anthony Liguori | JSONLexer lexer; |
24 | d7ff3acb | Anthony Liguori | int brace_count;
|
25 | d7ff3acb | Anthony Liguori | int bracket_count;
|
26 | d7ff3acb | Anthony Liguori | QList *tokens; |
27 | d7ff3acb | Anthony Liguori | } JSONMessageParser; |
28 | d7ff3acb | Anthony Liguori | |
29 | d7ff3acb | Anthony Liguori | void json_message_parser_init(JSONMessageParser *parser,
|
30 | d7ff3acb | Anthony Liguori | void (*func)(JSONMessageParser *, QList *));
|
31 | d7ff3acb | Anthony Liguori | |
32 | d7ff3acb | Anthony Liguori | int json_message_parser_feed(JSONMessageParser *parser,
|
33 | d7ff3acb | Anthony Liguori | const char *buffer, size_t size); |
34 | d7ff3acb | Anthony Liguori | |
35 | d7ff3acb | Anthony Liguori | int json_message_parser_flush(JSONMessageParser *parser);
|
36 | d7ff3acb | Anthony Liguori | |
37 | d7ff3acb | Anthony Liguori | void json_message_parser_destroy(JSONMessageParser *parser);
|
38 | d7ff3acb | Anthony Liguori | |
39 | d7ff3acb | Anthony Liguori | #endif |