|
Greenbone Vulnerability Management Libraries 22.32.0
|


Go to the source code of this file.
Data Structures | |
| struct | gvm_json_path_elem |
| Path element types for the JSON pull parser. More... | |
| struct | gvm_json_pull_event_t |
| Event generated by the JSON pull parser. More... | |
| struct | gvm_json_pull_parser_t |
| A json pull parser. More... | |
Macros | |
| #define | _GNU_SOURCE |
| #define | GVM_JSON_PULL_PARSE_BUFFER_LIMIT 10485760 |
| #define | GVM_JSON_PULL_READ_BUFFER_SIZE 4096 |
Typedefs | |
| typedef struct gvm_json_path_elem | gvm_json_path_elem_t |
| Path element types for the JSON pull parser. | |
Enumerations | |
| enum | gvm_json_pull_container_type_t { GVM_JSON_PULL_CONTAINER_NONE = 0 , GVM_JSON_PULL_CONTAINER_ARRAY , GVM_JSON_PULL_CONTAINER_OBJECT } |
| Type of container the parser is currently in. More... | |
| enum | gvm_json_pull_event_type_t { GVM_JSON_PULL_EVENT_UNDEFINED = 0 , GVM_JSON_PULL_EVENT_ARRAY_START , GVM_JSON_PULL_EVENT_ARRAY_END , GVM_JSON_PULL_EVENT_OBJECT_START , GVM_JSON_PULL_EVENT_OBJECT_END , GVM_JSON_PULL_EVENT_STRING , GVM_JSON_PULL_EVENT_NUMBER , GVM_JSON_PULL_EVENT_BOOLEAN , GVM_JSON_PULL_EVENT_NULL , GVM_JSON_PULL_EVENT_EOF , GVM_JSON_PULL_EVENT_ERROR } |
| Event types for the JSON pull parser. More... | |
| enum | gvm_json_pull_expect_t { GVM_JSON_PULL_EXPECT_UNDEFINED = 0 , GVM_JSON_PULL_EXPECT_VALUE , GVM_JSON_PULL_EXPECT_KEY , GVM_JSON_PULL_EXPECT_COMMA , GVM_JSON_PULL_EXPECT_EOF } |
| Expected token state for the JSON pull parser. More... | |
Functions | |
| gvm_json_path_elem_t * | gvm_json_pull_path_elem_new (gvm_json_pull_container_type_t, int) |
| Creates a new JSON path element. | |
| void | gvm_json_pull_path_elem_free (gvm_json_path_elem_t *) |
| Frees a JSON path element. | |
| void | gvm_json_pull_event_init (gvm_json_pull_event_t *) |
| Initializes a JSON pull event data structure. | |
| void | gvm_json_pull_event_cleanup (gvm_json_pull_event_t *) |
| Frees all data of JSON pull event data structure. | |
| void | gvm_json_pull_parser_init_full (gvm_json_pull_parser_t *, FILE *, size_t, size_t) |
| Initializes a JSON pull parser. | |
| void | gvm_json_pull_parser_init (gvm_json_pull_parser_t *, FILE *) |
| Initializes a JSON pull parser with default buffer sizes. | |
| void | gvm_json_pull_parser_cleanup (gvm_json_pull_parser_t *) |
| Frees the data of a JSON pull parser. | |
| 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. | |
| cJSON * | gvm_json_pull_expand_container (gvm_json_pull_parser_t *, gchar **) |
| Expands the current array or object of a JSON pull parser. | |
| gchar * | gvm_json_path_to_string (GQueue *path) |
| Converts a path as used by a JSON pull parser to a JSONPath string. | |
| #define _GNU_SOURCE |
Definition at line 9 of file jsonpull.h.
| #define GVM_JSON_PULL_PARSE_BUFFER_LIMIT 10485760 |
Definition at line 78 of file jsonpull.h.
Referenced by Ensure(), and gvm_json_pull_parser_init_full().
| #define GVM_JSON_PULL_READ_BUFFER_SIZE 4096 |
Definition at line 80 of file jsonpull.h.
Referenced by Ensure(), and gvm_json_pull_parser_init_full().
| typedef struct gvm_json_path_elem gvm_json_path_elem_t |
Path element types for the JSON pull parser.
Type of container the parser is currently in.
| Enumerator | |
|---|---|
| GVM_JSON_PULL_CONTAINER_NONE | No container / document root. |
| GVM_JSON_PULL_CONTAINER_ARRAY | Array. |
| GVM_JSON_PULL_CONTAINER_OBJECT | Object. |
Definition at line 19 of file jsonpull.h.
Event types for the JSON pull parser.
Definition at line 40 of file jsonpull.h.
Expected token state for the JSON pull parser.
Definition at line 69 of file jsonpull.h.
| gchar * gvm_json_path_to_string | ( | GQueue * | path | ) |
Converts a path as used by a JSON pull parser to a JSONPath string.
| [in] | path | The path to convert |
Definition at line 910 of file jsonpull.c.
References gvm_json_path_string_add_elem().
Referenced by parse_vt_json().


| void gvm_json_pull_event_cleanup | ( | gvm_json_pull_event_t * | event | ) |
Frees all data of JSON pull event data structure.
| [in] | event | The event structure to clean up |
Definition at line 61 of file jsonpull.c.
References gvm_json_pull_event_t::error_message, and gvm_json_pull_event_t::value.
Referenced by Ensure(), Ensure(), and gvm_json_pull_parser_next().

| void gvm_json_pull_event_init | ( | gvm_json_pull_event_t * | event | ) |
Initializes a JSON pull event data structure.
| [in] | event | The event structure to initialize |
Definition at line 50 of file jsonpull.c.
Referenced by Ensure().

| cJSON * gvm_json_pull_expand_container | ( | gvm_json_pull_parser_t * | parser, |
| gchar ** | error_message ) |
Expands the current array or object of a JSON pull parser.
This should be called after an array or object start event.
| [in] | parser | Parser to get the current container element from |
| [out] | error_message | Error message output |
Definition at line 746 of file jsonpull.c.
References gvm_json_path_elem::depth, GVM_JSON_CHAR_EOF, GVM_JSON_CHAR_ERROR, GVM_JSON_PULL_CONTAINER_ARRAY, GVM_JSON_PULL_CONTAINER_OBJECT, gvm_json_pull_parser_next_char(), gvm_json_pull_path_elem_free(), gvm_json_pull_path_elem_new(), gvm_json_read_stream_error_str(), gvm_json_pull_parser_t::last_read_char, gvm_json_path_elem::parent_type, gvm_json_pull_parser_t::parse_buffer, gvm_json_pull_parser_t::parse_buffer_limit, parse_value_next_expect(), gvm_json_pull_parser_t::path, and gvm_json_pull_parser_t::path_add.
Referenced by Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), and parse_vt_json().


| void gvm_json_pull_parser_cleanup | ( | gvm_json_pull_parser_t * | parser | ) |
Frees the data of a JSON pull parser.
| [in] | parser | The parser data structure to free the data of |
Definition at line 120 of file jsonpull.c.
References gvm_json_pull_path_elem_free(), gvm_json_pull_parser_t::parse_buffer, gvm_json_pull_parser_t::path, and gvm_json_pull_parser_t::read_buffer.
Referenced by Ensure(), Ensure(), and Ensure().


| void gvm_json_pull_parser_init | ( | gvm_json_pull_parser_t * | parser, |
| FILE * | input_stream ) |
Initializes a JSON pull parser with default buffer sizes.
| [in] | parser | The parser data structure to initialize |
| [in] | input_stream | The JSON input stream |
Definition at line 109 of file jsonpull.c.
References gvm_json_pull_parser_init_full().
Referenced by Ensure(), and Ensure().


| void gvm_json_pull_parser_init_full | ( | gvm_json_pull_parser_t * | parser, |
| FILE * | input_stream, | ||
| size_t | parse_buffer_limit, | ||
| size_t | read_buffer_size ) |
Initializes a JSON pull parser.
| [in] | parser | The parser data structure to initialize |
| [in] | input_stream | The JSON input stream |
| [in] | parse_buffer_limit | Maximum buffer size for parsing values |
| [in] | read_buffer_size | Buffer size for reading from the stream |
Definition at line 78 of file jsonpull.c.
References gvm_json_pull_parser_t::expect, GVM_JSON_CHAR_UNDEFINED, GVM_JSON_PULL_EXPECT_VALUE, GVM_JSON_PULL_PARSE_BUFFER_LIMIT, GVM_JSON_PULL_READ_BUFFER_SIZE, gvm_json_pull_parser_t::input_stream, gvm_json_pull_parser_t::last_read_char, gvm_json_pull_parser_t::parse_buffer, gvm_json_pull_parser_t::parse_buffer_limit, gvm_json_pull_parser_t::path, gvm_json_pull_parser_t::read_buffer, and gvm_json_pull_parser_t::read_buffer_size.
Referenced by gvm_json_pull_parser_init().

| void gvm_json_pull_parser_next | ( | gvm_json_pull_parser_t * | parser, |
| gvm_json_pull_event_t * | event ) |
Get the next event from a JSON pull parser.
Note: This invalidates previous event data like the cJSON value.
| [in] | parser | The JSON pull parser to process until the next event |
| [in] | event | Structure to store event data in. |
Definition at line 669 of file jsonpull.c.
References gvm_json_pull_parser_t::expect, GVM_JSON_CHAR_EOF, GVM_JSON_CHAR_UNDEFINED, gvm_json_pull_event_cleanup(), GVM_JSON_PULL_EVENT_ERROR, GVM_JSON_PULL_EXPECT_COMMA, GVM_JSON_PULL_EXPECT_EOF, GVM_JSON_PULL_EXPECT_KEY, GVM_JSON_PULL_EXPECT_VALUE, gvm_json_pull_handle_read_end(), gvm_json_pull_parse_comma(), gvm_json_pull_parse_key(), gvm_json_pull_parse_value(), gvm_json_pull_parser_next_char(), gvm_json_pull_skip_space(), gvm_json_pull_parser_t::last_read_char, gvm_json_pull_parser_t::path, and gvm_json_pull_parser_t::path_add.
Referenced by Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), Ensure(), and parse_vt_json().

| void gvm_json_pull_path_elem_free | ( | gvm_json_path_elem_t * | elem | ) |
Frees a JSON path element.
| [in] | elem | The element to free |
Definition at line 38 of file jsonpull.c.
References gvm_json_path_elem::key.
Referenced by gvm_json_pull_expand_container(), gvm_json_pull_parse_comma(), gvm_json_pull_parse_key(), gvm_json_pull_parse_value(), and gvm_json_pull_parser_cleanup().

| gvm_json_path_elem_t * gvm_json_pull_path_elem_new | ( | gvm_json_pull_container_type_t | parent_type, |
| int | depth ) |
Creates a new JSON path element.
| [in] | parent_type | Type of the parent (array, object, none/root) |
| [in] | depth | The depth in the document tree |
Definition at line 23 of file jsonpull.c.
References gvm_json_path_elem::depth, and gvm_json_path_elem::parent_type.
Referenced by gvm_json_pull_expand_container(), and gvm_json_pull_parse_value().
