Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
jsmn.h
Go to the documentation of this file.
1
24#ifndef __JSMN_H_
25#define __JSMN_H_
26
27#include "ws_symbol_export.h"
28
29#include <stddef.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
42typedef enum {
43 JSMN_UNDEFINED = 0,
44 JSMN_OBJECT = 1,
45 JSMN_ARRAY = 2,
46 JSMN_STRING = 3,
47 JSMN_PRIMITIVE = 4
49
50enum jsmnerr {
51 /* Not enough tokens were provided */
52 JSMN_ERROR_NOMEM = -1,
53 /* Invalid character inside JSON string */
54 JSMN_ERROR_INVAL = -2,
55 /* The string is not a full JSON packet, more bytes expected */
56 JSMN_ERROR_PART = -3
57};
58
65typedef struct {
66 jsmntype_t type;
67 int start;
68 int end;
69 int size;
70#ifdef JSMN_PARENT_LINKS
71 int parent;
72#endif
73} jsmntok_t;
74
79typedef struct {
80 unsigned int pos; /* offset in the JSON string */
81 unsigned int toknext; /* next token to allocate */
82 int toksuper; /* superior token node, e.g parent object or array */
84
88WS_DLL_PUBLIC void jsmn_init(jsmn_parser *parser);
89
94WS_DLL_PUBLIC int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
95 jsmntok_t *tokens, unsigned int num_tokens);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif /* __JSMN_H_ */
jsmntype_t
Definition jsmn.h:42
WS_DLL_PUBLIC void jsmn_init(jsmn_parser *parser)
Definition jsmn.c:328
WS_DLL_PUBLIC int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens)
Definition jsmn.c:173
Definition jsmn.h:79
Definition jsmn.h:65