File:  [Qemu by Fabrice Bellard] / qemu / json-streamer.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:34:08 2018 UTC (3 years, 3 months ago) by root
Branches: qemu, MAIN
CVS tags: qemu0150, qemu0141, qemu0140, qemu0130, qemu0125, qemu0124, qemu0123, qemu0122, qemu0121, qemu0120, HEAD
qemu 0.12.0

    1: /*
    2:  * JSON streaming support
    3:  *
    4:  * Copyright IBM, Corp. 2009
    5:  *
    6:  * Authors:
    7:  *  Anthony Liguori   <aliguori@us.ibm.com>
    8:  *
    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.
   11:  *
   12:  */
   13: 
   14: #ifndef QEMU_JSON_STREAMER_H
   15: #define QEMU_JSON_STREAMER_H
   16: 
   17: #include "qlist.h"
   18: #include "json-lexer.h"
   19: 
   20: typedef struct JSONMessageParser
   21: {
   22:     void (*emit)(struct JSONMessageParser *parser, QList *tokens);
   23:     JSONLexer lexer;
   24:     int brace_count;
   25:     int bracket_count;
   26:     QList *tokens;
   27: } JSONMessageParser;
   28: 
   29: void json_message_parser_init(JSONMessageParser *parser,
   30:                               void (*func)(JSONMessageParser *, QList *));
   31: 
   32: int json_message_parser_feed(JSONMessageParser *parser,
   33:                              const char *buffer, size_t size);
   34: 
   35: int json_message_parser_flush(JSONMessageParser *parser);
   36: 
   37: void json_message_parser_destroy(JSONMessageParser *parser);
   38: 
   39: #endif

unix.superglobalmegacorp.com