10#ifndef MSGPACK_UNPACKER_H
11#define MSGPACK_UNPACKER_H
68#ifndef MSGPACK_UNPACKER_INIT_BUFFER_SIZE
69#define MSGPACK_UNPACKER_INIT_BUFFER_SIZE (64*1024)
100#ifndef MSGPACK_UNPACKER_RESERVE_SIZE
101#define MSGPACK_UNPACKER_RESERVE_SIZE (32*1024)
111static inline bool msgpack_unpacker_reserve_buffer(
msgpack_unpacker* mpac,
size_t size);
129static inline size_t msgpack_unpacker_buffer_capacity(
const msgpack_unpacker* mpac);
138static inline void msgpack_unpacker_buffer_consumed(
msgpack_unpacker* mpac,
size_t size);
196static inline size_t msgpack_unpacker_message_size(
const msgpack_unpacker* mpac);
211static inline size_t msgpack_unpacker_parsed_size(
const msgpack_unpacker* mpac);
219static inline bool msgpack_unpacker_reserve_buffer(
msgpack_unpacker* mpac,
size_t size)
221 if(mpac->
free >= size) {
return true; }
230static inline size_t msgpack_unpacker_buffer_capacity(
const msgpack_unpacker* mpac)
235static inline void msgpack_unpacker_buffer_consumed(
msgpack_unpacker* mpac,
size_t size)
241static inline size_t msgpack_unpacker_message_size(
const msgpack_unpacker* mpac)
246static inline size_t msgpack_unpacker_parsed_size(
const msgpack_unpacker* mpac)
259 if(result->
zone != NULL) {
268 if(result->
zone != NULL) {
msgpack_unpack_return
Definition unpack.h:33
MSGPACK_DLLEXPORT msgpack_unpack_return msgpack_unpack_next(msgpack_unpacked *result, const char *data, size_t len, size_t *off)
@ MSGPACK_UNPACK_PARSE_ERROR
Definition unpack.h:37
@ MSGPACK_UNPACK_CONTINUE
Definition unpack.h:36
@ MSGPACK_UNPACK_NOMEM_ERROR
Definition unpack.h:38
@ MSGPACK_UNPACK_EXTRA_BYTES
Definition unpack.h:35
@ MSGPACK_UNPACK_SUCCESS
Definition unpack.h:34
MSGPACK_DLLEXPORT msgpack_unpack_return msgpack_unpacker_next_with_size(msgpack_unpacker *mpac, msgpack_unpacked *result, size_t *p_bytes)
Deserializes one object and set the number of parsed bytes involved.
MSGPACK_DLLEXPORT void msgpack_unpacker_reset_zone(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT void msgpack_unpacker_destroy(msgpack_unpacker *mpac)
Destroys a streaming deserializer initialized by msgpack_unpacker_init(msgpack_unpacker*,...
MSGPACK_DLLEXPORT msgpack_unpack_return msgpack_unpacker_next(msgpack_unpacker *mpac, msgpack_unpacked *pac)
Deserializes one object.
MSGPACK_DLLEXPORT msgpack_zone * msgpack_unpacker_release_zone(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT msgpack_object msgpack_unpacker_data(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT void msgpack_unpacker_reset(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT int msgpack_unpacker_execute(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT bool msgpack_unpacker_init(msgpack_unpacker *mpac, size_t initial_buffer_size)
Initializes a streaming deserializer.
MSGPACK_DLLEXPORT msgpack_unpacker * msgpack_unpacker_new(size_t initial_buffer_size)
Creates a streaming deserializer.
MSGPACK_DLLEXPORT void msgpack_unpacker_free(msgpack_unpacker *mpac)
Frees a streaming deserializer created by msgpack_unpacker_new(size_t).
MSGPACK_DLLEXPORT void msgpack_zone_free(msgpack_zone *zone)
msgpack_object data
Definition unpack.h:30
msgpack_zone * zone
Definition unpack.h:29
size_t off
Definition unpack.h:60
size_t parsed
Definition unpack.h:61
char * buffer
Definition unpack.h:57
size_t used
Definition unpack.h:58
msgpack_zone * z
Definition unpack.h:62
void * ctx
Definition unpack.h:64
size_t initial_buffer_size
Definition unpack.h:63
size_t free
Definition unpack.h:59
MSGPACK_DLLEXPORT bool msgpack_unpacker_flush_zone(msgpack_unpacker *mpac)
MSGPACK_DLLEXPORT bool msgpack_unpacker_expand_buffer(msgpack_unpacker *mpac, size_t size)
MSGPACK_DLLEXPORT msgpack_unpack_return msgpack_unpack(const char *data, size_t len, size_t *off, msgpack_zone *result_zone, msgpack_object *result)
const char size_t size_t * off
Definition unpack_template.h:95
const char * data
Definition unpack_template.h:94
const char size_t len
Definition unpack_template.h:94