31 #ifndef HAVE_UBJS_PARSER 32 #define HAVE_UBJS_PARSER 94 unsigned int *plength);
ubjs_parser_context_error error
Definition: ubjs_parser.h:163
Definitions of common types, ubjson markers and some utilities.
struct ubjs_prmtv ubjs_prmtv
Definition: ubjs_primitives.h:165
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:108
void(* ubjs_parser_context_error)(ubjs_parser_context *context, ubjs_parser_error *error)
Callback when encountered a parsing error.
Definition: ubjs_parser.h:80
void * userdata
Definition: ubjs_parser.h:157
struct ubjs_parser_error ubjs_parser_error
Holder for parser errors.
Definition: ubjs_parser.h:64
UBJS_EXPORT ubjs_result ubjs_parser_get_settings(ubjs_parser *this, ubjs_parser_settings **psettings)
Gets settings from the parser.
Definition: ubjs_parser.c:320
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:309
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:118
ubjs_bool debug
Debugging mode. If this is UTRUE, parser will fprintf(stderr) lots of internal messages about how and...
Definition: ubjs_parser.h:150
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:267
UBJS_EXPORT ubjs_result ubjs_parser_parse(ubjs_parser *this, uint8_t *data, unsigned int len)
Parses the incoming data.
Definition: ubjs_parser.c:331
struct ubjs_parser ubjs_parser
Parser itself.
Definition: ubjs_parser.h:55
void(* ubjs_parser_context_free)(ubjs_parser_context *)
Callback when parser is about to be free-d.
Definition: ubjs_parser.h:86
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:135
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:72
ubjs_parser_context_parsed parsed
Definition: ubjs_parser.h:160
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:128
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:68
ubjs_parser_context_free free
Definition: ubjs_parser.h:166
User-provided context - callbacks and userdata.
Definition: ubjs_parser.h:154
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:57
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:142
struct ubjs_library ubjs_library
Library handle.
Definition: ubjs_common.h:203
Settings for parser.
Definition: ubjs_parser.h:111