Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
wsjson.h
Go to the documentation of this file.
1
14#ifndef __WSJSON_H__
15#define __WSJSON_H__
16
17#include "ws_symbol_export.h"
18
19#include <inttypes.h>
20#include <stdbool.h>
21
22#include "jsmn.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
39WS_DLL_PUBLIC bool json_validate(const uint8_t *buf, const size_t len);
40
53WS_DLL_PUBLIC int json_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens);
54
69WS_DLL_PUBLIC int json_parse_len(const char *buf, size_t len, jsmntok_t *tokens, unsigned int max_tokens);
70
79WS_DLL_PUBLIC jsmntok_t *json_get_object(const char *buf, jsmntok_t *parent, const char *name);
80
89WS_DLL_PUBLIC jsmntok_t *json_get_array(const char *buf, jsmntok_t *parent, const char *name);
90
97WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array);
98
110WS_DLL_PUBLIC jsmntok_t *json_get_array_index(jsmntok_t *parent, int idx);
111
131WS_DLL_PUBLIC jsmntok_t *json_get_next_object(jsmntok_t *cur);
132
143WS_DLL_PUBLIC char *json_get_string(char *buf, jsmntok_t *parent, const char *name);
144
156WS_DLL_PUBLIC bool json_get_double(char *buf, jsmntok_t *parent, const char *name, double *val);
157
169WS_DLL_PUBLIC bool json_get_int(char *buf, jsmntok_t *parent, const char *name, int64_t *val);
170
182WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val);
183
190WS_DLL_PUBLIC bool json_decode_string_inplace(char *text);
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif
197
198/*
199 * Editor modelines - https://www.wireshark.org/tools/modelines.html
200 *
201 * Local variables:
202 * c-basic-offset: 4
203 * tab-width: 8
204 * indent-tabs-mode: nil
205 * End:
206 *
207 * vi: set shiftwidth=4 tabstop=8 expandtab:
208 * :indentSize=4:tabSize=8:noTabs=true:
209 */
Definition jsmn.h:65
WS_DLL_PUBLIC bool json_validate(const uint8_t *buf, const size_t len)
Definition wsjson.c:26
WS_DLL_PUBLIC bool json_get_double(char *buf, jsmntok_t *parent, const char *name, double *val)
Definition wsjson.c:189
WS_DLL_PUBLIC char * json_get_string(char *buf, jsmntok_t *parent, const char *name)
Definition wsjson.c:169
WS_DLL_PUBLIC int json_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens)
Definition wsjson.c:87
WS_DLL_PUBLIC bool json_decode_string_inplace(char *text)
Definition wsjson.c:269
WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array)
Definition wsjson.c:149
WS_DLL_PUBLIC bool json_get_int(char *buf, jsmntok_t *parent, const char *name, int64_t *val)
Definition wsjson.c:210
WS_DLL_PUBLIC int json_parse_len(const char *buf, size_t len, jsmntok_t *tokens, unsigned int max_tokens)
Definition wsjson.c:96
WS_DLL_PUBLIC jsmntok_t * json_get_object(const char *buf, jsmntok_t *parent, const char *name)
Definition wsjson.c:115
WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val)
Definition wsjson.c:231
WS_DLL_PUBLIC jsmntok_t * json_get_next_object(jsmntok_t *cur)
Definition wsjson.c:104
WS_DLL_PUBLIC jsmntok_t * json_get_array(const char *buf, jsmntok_t *parent, const char *name)
Definition wsjson.c:132
WS_DLL_PUBLIC jsmntok_t * json_get_array_index(jsmntok_t *parent, int idx)
Definition wsjson.c:156