Wireshark  4.3.0
The Wireshark network protocol analyzer
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
25 extern "C" {
26 #endif
27 
31 WS_DLL_PUBLIC bool json_validate(const uint8_t *buf, const size_t len);
32 
33 WS_DLL_PUBLIC int json_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens);
34 
39 WS_DLL_PUBLIC jsmntok_t *json_get_object(const char *buf, jsmntok_t *parent, const char *name);
40 
45 WS_DLL_PUBLIC jsmntok_t *json_get_array(const char *buf, jsmntok_t *parent, const char *name);
46 
51 WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array);
52 
57 WS_DLL_PUBLIC jsmntok_t *json_get_array_index(jsmntok_t *parent, int idx);
58 
63 WS_DLL_PUBLIC char *json_get_string(char *buf, jsmntok_t *parent, const char *name);
64 
70 WS_DLL_PUBLIC bool json_get_double(char *buf, jsmntok_t *parent, const char *name, double *val);
71 
76 WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val);
77 
82 WS_DLL_PUBLIC bool json_decode_string_inplace(char *text);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif
89 
90 /*
91  * Editor modelines - https://www.wireshark.org/tools/modelines.html
92  *
93  * Local variables:
94  * c-basic-offset: 4
95  * tab-width: 8
96  * indent-tabs-mode: nil
97  * End:
98  *
99  * vi: set shiftwidth=4 tabstop=8 expandtab:
100  * :indentSize=4:tabSize=8:noTabs=true:
101  */
Definition: jsmn.h:63
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:176
WS_DLL_PUBLIC bool json_decode_string_inplace(char *text)
Definition: wsjson.c:235
WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array)
Definition: wsjson.c:136
WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val)
Definition: wsjson.c:197
WS_DLL_PUBLIC jsmntok_t * json_get_array_index(jsmntok_t *parent, int idx)
Definition: wsjson.c:143
WS_DLL_PUBLIC jsmntok_t * json_get_object(const char *buf, jsmntok_t *parent, const char *name)
Definition: wsjson.c:102
WS_DLL_PUBLIC jsmntok_t * json_get_array(const char *buf, jsmntok_t *parent, const char *name)
Definition: wsjson.c:119
WS_DLL_PUBLIC char * json_get_string(char *buf, jsmntok_t *parent, const char *name)
Definition: wsjson.c:156