]> git.sur5r.net Git - i3/i3/blob - i3bar/include/parse_json_header.h
i3bar: Rename determine_json_version to parse_json_header
[i3/i3] / i3bar / include / parse_json_header.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3bar - an xcb-based status- and ws-bar for i3
5  * © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
6  *
7  * determine_json_version.c: Determines the JSON protocol version based on the
8  *                           first line of input from a child program.
9  *
10  */
11 #ifndef DETERMINE_JSON_VERSION_H_
12 #define DETERMINE_JSON_VERSION_H_
13
14 #include <stdint.h>
15
16 /*
17  * Determines the JSON i3bar protocol version from the given buffer. In case
18  * the buffer does not contain valid JSON, or no version field is found, this
19  * function returns -1. The amount of bytes consumed by parsing the header is
20  * returned in *consumed (if non-NULL).
21  *
22  * The return type is an int32_t to avoid machines with different sizes of
23  * 'int' to allow different values here. It’s highly unlikely we ever exceed
24  * even an int8_t, but still…
25  *
26  */
27 int32_t determine_json_version(const unsigned char *buffer, int length, unsigned int *consumed);
28
29 #endif