4#ifndef PROTOCORE_DEFLATE_H
5#define PROTOCORE_DEFLATE_H
54#define DEFLATE_SCRATCH_SIZE 4096
59 DEFLATE_ERR_OVERFLOW = -2,
60 DEFLATE_ERR_SCRATCH = -3
66 DeflateResult (*
raw)(uint8_t *,
const uint8_t *, size_t, uint8_t *, size_t,
size_t *,
void *, size_t);
82DeflateResult
protocore_deflate_raw(uint8_t *work,
const uint8_t *src,
size_t src_len, uint8_t *dst,
size_t dst_cap,
83 size_t *out_len,
void *scratch,
size_t scratch_len);
EMBED_ENUM_BYTE(DeflateResult, DEFLATE_OK=0, DEFLATE_ERR_OVERFLOW=-2, DEFLATE_ERR_SCRATCH=-3)
deflate_raw() return codes (mirror InflateResult).
DeflateResult protocore_deflate_raw(uint8_t *work, const uint8_t *src, size_t src_len, uint8_t *dst, size_t dst_cap, size_t *out_len, void *scratch, size_t scratch_len)
Compress src into a raw permessage-deflate payload (RFC 7692): a .
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#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.
Dispatch table. Addressed by offset, so the layout is asserted below.
DeflateResult(* raw)(uint8_t *, const uint8_t *, size_t, uint8_t *, size_t, size_t *, void *, size_t)