28#ifndef PROTOCORE_MSGPACK_H
29#define PROTOCORE_MSGPACK_H
47void pc_msgpack_init(MsgpackWriter *w, uint8_t *buf,
size_t cap);
50size_t pc_msgpack_len(
const MsgpackWriter *w);
53bool pc_msgpack_ok(
const MsgpackWriter *w);
55void pc_msgpack_uint(MsgpackWriter *w, uint64_t v);
56void pc_msgpack_int(MsgpackWriter *w, int64_t v);
57void pc_msgpack_bytes(MsgpackWriter *w,
const uint8_t *data,
size_t len);
58void pc_msgpack_str(MsgpackWriter *w,
const char *s);
59void pc_msgpack_str_n(MsgpackWriter *w,
const char *s,
size_t len);
60void pc_msgpack_bool(MsgpackWriter *w,
bool b);
61void pc_msgpack_nil(MsgpackWriter *w);
62void pc_msgpack_float(MsgpackWriter *w,
float f);
63void pc_msgpack_array(MsgpackWriter *w,
size_t count);
64void pc_msgpack_map(MsgpackWriter *w,
size_t count);
71enum class MsgpackType : uint8_t
73 MSGPACK_TYPE_UINT = 0,
95void pc_msgpack_reader_init(MsgpackReader *r,
const uint8_t *buf,
size_t len);
98MsgpackType pc_msgpack_peek(MsgpackReader *r);
101bool pc_msgpack_reader_ok(
const MsgpackReader *r);
103bool pc_msgpack_read_uint(MsgpackReader *r, uint64_t *out);
104bool pc_msgpack_read_int(MsgpackReader *r, int64_t *out);
105bool pc_msgpack_read_bool(MsgpackReader *r,
bool *out);
106bool pc_msgpack_read_nil(MsgpackReader *r);
107bool pc_msgpack_read_float(MsgpackReader *r,
float *out);
108bool pc_msgpack_read_str(MsgpackReader *r,
const char **out,
size_t *len);
109bool pc_msgpack_read_bytes(MsgpackReader *r,
const uint8_t **out,
111bool pc_msgpack_read_array(MsgpackReader *r,
size_t *count);
112bool pc_msgpack_read_map(MsgpackReader *r,
size_t *count);
User-facing configuration for ProtoCore.