Wireshark 4.5.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
106WS_DLL_PUBLIC jsmntok_t *json_get_array_index(jsmntok_t *parent, int idx);
107
118WS_DLL_PUBLIC char *json_get_string(char *buf, jsmntok_t *parent, const char *name);
119
131WS_DLL_PUBLIC bool json_get_double(char *buf, jsmntok_t *parent, const char *name, double *val);
132
144WS_DLL_PUBLIC bool json_get_int(char *buf, jsmntok_t *parent, const char *name, int64_t *val);
145
157WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val);
158
165WS_DLL_PUBLIC bool json_decode_string_inplace(char *text);
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif
172
173/*
174 * Editor modelines - https://www.wireshark.org/tools/modelines.html
175 *
176 * Local variables:
177 * c-basic-offset: 4
178 * tab-width: 8
179 * indent-tabs-mode: nil
180 * End:
181 *
182 * vi: set shiftwidth=4 tabstop=8 expandtab:
183 * :indentSize=4:tabSize=8:noTabs=true:
184 */
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:190
WS_DLL_PUBLIC char * json_get_string(char *buf, jsmntok_t *parent, const char *name)
Definition wsjson.c:170
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:270
WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array)
Definition wsjson.c:150
WS_DLL_PUBLIC bool json_get_int(char *buf, jsmntok_t *parent, const char *name, int64_t *val)
Definition wsjson.c:211
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:116
WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val)
Definition wsjson.c:232
WS_DLL_PUBLIC jsmntok_t * json_get_array(const char *buf, jsmntok_t *parent, const char *name)
Definition wsjson.c:133
WS_DLL_PUBLIC jsmntok_t * json_get_array_index(jsmntok_t *parent, int idx)
Definition wsjson.c:157