31 #ifndef HAVE_UBJS_PARSER 32 #define HAVE_UBJS_PARSER 95 unsigned int *plength);
Library handle, allocation callbacks, glues.
ubjs_parser_context_error error
Definition: ubjs_parser.h:164
Definitions of common types, ubjson markers and some utilities.
struct ubjs_prmtv ubjs_prmtv
Definition: ubjs_primitives.h:166
UBJS_EXPORT ubjs_result ubjs_parser_new(ubjs_library *lib, ubjs_parser_settings *settings, ubjs_parser_context *context, ubjs_parser **pthis)
Creates new parser.
Definition: ubjs_parser.c:115
void(* ubjs_parser_context_error)(ubjs_parser_context *context, ubjs_parser_error *error)
Callback when encountered a parsing error.
Definition: ubjs_parser.h:81
void * userdata
Definition: ubjs_parser.h:158
struct ubjs_parser_error ubjs_parser_error
Holder for parser errors.
Definition: ubjs_parser.h:65
UBJS_EXPORT ubjs_result ubjs_parser_get_settings(ubjs_parser *this, ubjs_parser_settings **psettings)
Gets settings from the parser.
Definition: ubjs_parser.c:397
UBJS_EXPORT ubjs_result ubjs_parser_get_context(ubjs_parser *this, ubjs_parser_context **pcontext)
Gets user context from the parser.
Definition: ubjs_parser.c:386
Library handle.
Definition: ubjs_library.h:827
unsigned int limit_bytes_since_last_callback
Max number of bytes to process since last callback. If this is 0, limit is effectively off...
Definition: ubjs_parser.h:119
ubjs_bool debug
Debugging mode. If this is UTRUE, parser will fprintf(stderr) lots of internal messages about how and...
Definition: ubjs_parser.h:151
ubjs_bool
Wrapper around regular C-like booleans.
Definition: ubjs_common.h:59
Wrappers over ubjson primitive types.
UBJS_EXPORT ubjs_result ubjs_parser_free(ubjs_parser **pthis)
Frees the parser.
Definition: ubjs_parser.c:340
UBJS_EXPORT ubjs_result ubjs_parser_parse(ubjs_parser *this, uint8_t *data, unsigned int len)
Parses the incoming data.
Definition: ubjs_parser.c:408
struct ubjs_parser ubjs_parser
Parser itself.
Definition: ubjs_parser.h:56
void(* ubjs_parser_context_free)(ubjs_parser_context *)
Callback when parser is about to be free-d.
Definition: ubjs_parser.h:87
unsigned int limit_string_length
Max number of characters in string or HPN. If this is 0, limit is effectively off. Else parser errors when expected length exceeds the limit. This setting is global to whole parser.
Definition: ubjs_parser.h:136
ubjs_result
Enum that defines the result of a method.
Definition: ubjs_common.h:73
void(* ubjs_parser_context_parsed)(ubjs_parser_context *context, ubjs_prmtv *primitive)
Callback to be executed just when parser parsed a first-citizen primitive.
Definition: ubjs_parser.h:73
ubjs_parser_context_parsed parsed
Definition: ubjs_parser.h:161
unsigned int limit_container_length
Max number of items in container. This applies to arrays and objects. If this is 0, limit is effectively off. Else parser errors when:
Definition: ubjs_parser.h:129
UBJS_EXPORT ubjs_result ubjs_parser_error_get_message_text(ubjs_parser_error *this, char *text)
Copies the error message's content to provided array.
Definition: ubjs_parser.c:71
ubjs_parser_context_free free
Definition: ubjs_parser.h:167
User-provided context - callbacks and userdata.
Definition: ubjs_parser.h:155
UBJS_EXPORT ubjs_result ubjs_parser_error_get_message_length(ubjs_parser_error *this, unsigned int *plength)
Gets the error message's length.
Definition: ubjs_parser.c:60
unsigned int limit_recursion_level
Max recursion level for containers. If this is 0, limit is effectively off. Else parser errors when r...
Definition: ubjs_parser.h:143
Settings for parser.
Definition: ubjs_parser.h:112