4#ifndef PROTOCORE_QUIC_VARINT_H
5#define PROTOCORE_QUIC_VARINT_H
35#define QUIC_VARINT_MAX 0x3FFFFFFFFFFFFFFFull
40 size_t (*len)(uint8_t *, uint64_t);
41 size_t (*encode)(uint8_t *, uint8_t *, size_t, uint64_t);
42 proto_bool (*decode)(uint8_t *,
const uint8_t *, size_t, uint64_t *,
size_t *);
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
size_t protocore_quic_varint_len(uint8_t *work, uint64_t value)
Bytes value encodes to (1 / 2 / 4 / 8), or 0 if it exceeds .
proto_bool protocore_quic_varint_decode(uint8_t *work, const uint8_t *in, size_t len, uint64_t *value, size_t *consumed)
Decode a varint at in. Sets value and consumed (1/2/4/8). false if .
PROTOCORE_NS QuicVarintNs QuicVarint PROTOCORE_UNUSED
Module namespace.
size_t protocore_quic_varint_encode(uint8_t *work, uint8_t *out, size_t cap, uint64_t value)
Encode value in its shortest form. bytes written, or 0 on overflow .
Dispatch table. Addressed by offset, so the layout is asserted below.
size_t(* len)(uint8_t *, uint64_t)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS