Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
35WS_DLL_PUBLIC bool json_validate(const uint8_t *buf, const size_t len);
36
49WS_DLL_PUBLIC int json_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens);
50
65WS_DLL_PUBLIC int json_parse_len(const char *buf, size_t len, jsmntok_t *tokens, unsigned int max_tokens);
66
71WS_DLL_PUBLIC jsmntok_t *json_get_object(const char *buf, jsmntok_t *parent, const char *name);
72
77WS_DLL_PUBLIC jsmntok_t *json_get_array(const char *buf, jsmntok_t *parent, const char *name);
78
83WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array);
84
89WS_DLL_PUBLIC jsmntok_t *json_get_array_index(jsmntok_t *parent, int idx);
90
95WS_DLL_PUBLIC char *json_get_string(char *buf, jsmntok_t *parent, const char *name);
96
102WS_DLL_PUBLIC bool json_get_double(char *buf, jsmntok_t *parent, const char *name, double *val);
103
108WS_DLL_PUBLIC bool json_get_boolean(char *buf, jsmntok_t *parent, const char *name, bool *val);
109
114WS_DLL_PUBLIC bool json_decode_string_inplace(char *text);
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif
121
122/*
123 * Editor modelines - https://www.wireshark.org/tools/modelines.html
124 *
125 * Local variables:
126 * c-basic-offset: 4
127 * tab-width: 8
128 * indent-tabs-mode: nil
129 * End:
130 *
131 * vi: set shiftwidth=4 tabstop=8 expandtab:
132 * :indentSize=4:tabSize=8:noTabs=true:
133 */
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:249
WS_DLL_PUBLIC int json_get_array_len(jsmntok_t *array)
Definition wsjson.c:150
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:211
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