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_decode_string_inplace(char *text);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
83 
84 /*
85  * Editor modelines - https://www.wireshark.org/tools/modelines.html
86  *
87  * Local variables:
88  * c-basic-offset: 4
89  * tab-width: 8
90  * indent-tabs-mode: nil
91  * End:
92  *
93  * vi: set shiftwidth=4 tabstop=8 expandtab:
94  * :indentSize=4:tabSize=8:noTabs=true:
95  */
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:198
WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array)
Definition: wsjson.c:136
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