Return path: socket_writev_buffer: Block even on non-blocking fd's
[qemu/ar7.git] / include / qapi / qmp / json-streamer.h
blob823f7d7fa42b32e057560564a0436c9f0ed3d2e3
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 "qapi/qmp/qlist.h"
18 #include "qapi/qmp/json-lexer.h"
20 typedef struct JSONMessageParser
22 void (*emit)(struct JSONMessageParser *parser, QList *tokens);
23 JSONLexer lexer;
24 int brace_count;
25 int bracket_count;
26 QList *tokens;
27 uint64_t token_size;
28 } JSONMessageParser;
30 void json_message_parser_init(JSONMessageParser *parser,
31 void (*func)(JSONMessageParser *, QList *));
33 int json_message_parser_feed(JSONMessageParser *parser,
34 const char *buffer, size_t size);
36 int json_message_parser_flush(JSONMessageParser *parser);
38 void json_message_parser_destroy(JSONMessageParser *parser);
40 #endif