78#define GVM_JSON_PULL_PARSE_BUFFER_LIMIT 10485760
80#define GVM_JSON_PULL_READ_BUFFER_SIZE 4096
cJSON * gvm_json_pull_expand_container(gvm_json_pull_parser_t *, gchar **)
Expands the current array or object of a JSON pull parser.
Definition jsonpull.c:744
void gvm_json_pull_parser_next(gvm_json_pull_parser_t *, gvm_json_pull_event_t *)
Get the next event from a JSON pull parser.
Definition jsonpull.c:669
void gvm_json_pull_path_elem_free(gvm_json_path_elem_t *)
Frees a JSON path element.
Definition jsonpull.c:38
void gvm_json_pull_parser_init_full(gvm_json_pull_parser_t *, FILE *, size_t, size_t)
Initializes a JSON pull parser.
Definition jsonpull.c:78
gvm_json_path_elem_t * gvm_json_pull_path_elem_new(gvm_json_pull_container_type_t, int)
Creates a new JSON path element.
Definition jsonpull.c:23
gvm_json_pull_container_type_t
Type of container the parser is currently in.
Definition jsonpull.h:20
@ GVM_JSON_PULL_CONTAINER_NONE
No container / document root.
Definition jsonpull.h:21
@ GVM_JSON_PULL_CONTAINER_OBJECT
Object.
Definition jsonpull.h:23
@ GVM_JSON_PULL_CONTAINER_ARRAY
Array.
Definition jsonpull.h:22
gchar * gvm_json_path_to_string(GQueue *path)
Converts a path as used by a JSON pull parser to a JSONPath string.
Definition jsonpull.c:902
void gvm_json_pull_parser_cleanup(gvm_json_pull_parser_t *)
Frees the data of a JSON pull parser.
Definition jsonpull.c:120
void gvm_json_pull_parser_init(gvm_json_pull_parser_t *, FILE *)
Initializes a JSON pull parser with default buffer sizes.
Definition jsonpull.c:109
gvm_json_pull_expect_t
Expected token state for the JSON pull parser.
Definition jsonpull.h:70
@ GVM_JSON_PULL_EXPECT_UNDEFINED
Undefined state.
Definition jsonpull.h:71
@ GVM_JSON_PULL_EXPECT_VALUE
Expect start of a value.
Definition jsonpull.h:72
@ GVM_JSON_PULL_EXPECT_KEY
Expect start of a key.
Definition jsonpull.h:73
@ GVM_JSON_PULL_EXPECT_EOF
Expect end of file.
Definition jsonpull.h:75
@ GVM_JSON_PULL_EXPECT_COMMA
Expect comma or container end brace.
Definition jsonpull.h:74
void gvm_json_pull_event_init(gvm_json_pull_event_t *)
Initializes a JSON pull event data structure.
Definition jsonpull.c:50
void gvm_json_pull_event_cleanup(gvm_json_pull_event_t *)
Frees all data of JSON pull event data structure.
Definition jsonpull.c:61
gvm_json_pull_event_type_t
Event types for the JSON pull parser.
Definition jsonpull.h:41
@ GVM_JSON_PULL_EVENT_STRING
Definition jsonpull.h:47
@ GVM_JSON_PULL_EVENT_OBJECT_START
Definition jsonpull.h:45
@ GVM_JSON_PULL_EVENT_ERROR
Definition jsonpull.h:52
@ GVM_JSON_PULL_EVENT_NULL
Definition jsonpull.h:50
@ GVM_JSON_PULL_EVENT_EOF
Definition jsonpull.h:51
@ GVM_JSON_PULL_EVENT_NUMBER
Definition jsonpull.h:48
@ GVM_JSON_PULL_EVENT_ARRAY_END
Definition jsonpull.h:44
@ GVM_JSON_PULL_EVENT_OBJECT_END
Definition jsonpull.h:46
@ GVM_JSON_PULL_EVENT_ARRAY_START
Definition jsonpull.h:43
@ GVM_JSON_PULL_EVENT_BOOLEAN
Definition jsonpull.h:49
@ GVM_JSON_PULL_EVENT_UNDEFINED
Definition jsonpull.h:42
struct gvm_json_path_elem gvm_json_path_elem_t
Path element types for the JSON pull parser.
Path element types for the JSON pull parser.
Definition jsonpull.h:30
int depth
Number of ancestor elements.
Definition jsonpull.h:34
int index
Index of the element within the parent.
Definition jsonpull.h:32
char * key
Key if element is in an object.
Definition jsonpull.h:33
gvm_json_pull_container_type_t parent_type
parent container type
Definition jsonpull.h:31
Event generated by the JSON pull parser.
Definition jsonpull.h:59
gchar * error_message
Error message, NULL on success.
Definition jsonpull.h:63
cJSON * value
Value for non-container value events.
Definition jsonpull.h:62
GQueue * path
Path to the event value.
Definition jsonpull.h:61
gvm_json_pull_event_type_t type
Type of event.
Definition jsonpull.h:60
A json pull parser.
Definition jsonpull.h:86
char * read_buffer
Stream reading buffer.
Definition jsonpull.h:92
size_t read_buffer_size
Size of the stream reading buffer.
Definition jsonpull.h:93
gvm_json_pull_expect_t expect
Current expected token.
Definition jsonpull.h:89
size_t last_read_size
Size of last stream read.
Definition jsonpull.h:94
int keyword_pos
Position in a keyword like "true" or "null".
Definition jsonpull.h:90
GString * parse_buffer
Buffer for parsing values and object keys.
Definition jsonpull.h:97
size_t parse_buffer_limit
Maximum parse buffer size.
Definition jsonpull.h:98
gvm_json_path_elem_t * path_add
Path elem to add in next step.
Definition jsonpull.h:88
size_t read_pos
Position in current read.
Definition jsonpull.h:96
GQueue * path
Path to the current value.
Definition jsonpull.h:87
int last_read_char
Character last read from stream.
Definition jsonpull.h:95
FILE * input_stream
Input stream.
Definition jsonpull.h:91