|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
QPACK field-section compression for HTTP/3 (RFC 9204). More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | QpackNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Typedefs | |
| typedef proto_bool(* | QpackEmitFn) (void *ctx, const char *name, size_t name_len, const char *value, size_t value_len) |
| Callback invoked for each decoded header; return false to abort the decode. | |
Functions | |
| PROTOCORE_NS_LAYOUT (QpackNs, encode_prefix, encode_header, decode) | |
| size_t | protocore_qpack_encode_prefix (uint8_t *work, uint8_t *out, size_t cap) |
| Write the encoded field-section prefix for a static-only section. . | |
| size_t | protocore_qpack_encode_header (uint8_t *work, uint8_t *out, size_t cap, const char *name, size_t name_len, const char *value, size_t value_len) |
| Encode one header field (server side): a full static match -> . | |
| proto_bool | protocore_qpack_decode (uint8_t *work, const uint8_t *block, size_t len, char *scratch, size_t scratch_cap, QpackEmitFn emit, void *ctx) |
| Decode a whole QPACK field section (prefix + representations), . | |
Variables | |
| PROTOCORE_NS QpackNs Qpack | PROTOCORE_UNUSED |
| Module namespace. | |
QPACK field-section compression for HTTP/3 (RFC 9204).
QPACK is HTTP/3's header compression. It reuses RFC 7541's prefix-integer coding and Huffman code (shared here via protocore_hpack_prim.h) and adds a 99-entry static table, an encoded field-section prefix, and its own field-line representations.
This codec is static-table-only and needs no per-connection state: the encoder emits indexed / literal representations against the static table (never inserting into a dynamic table), and it advertises SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0, so a conformant peer's encoder never sends a dynamic-table reference. The decoder therefore rejects (returns false) any representation that references the dynamic table or a non-zero Required Insert Count. Pure, zero heap, host-tested against the RFC 9204 Appendix B.1 worked example.
work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.
Definition in file qpack.h.
| typedef proto_bool(* QpackEmitFn)(void *ctx, const char *name, size_t name_len, const char *value, size_t value_len) |
| PROTOCORE_NS_LAYOUT | ( | QpackNs | , |
| encode_prefix | , | ||
| encode_header | , | ||
| decode | |||
| ) |
| size_t protocore_qpack_encode_prefix | ( | uint8_t * | work, |
| uint8_t * | out, | ||
| size_t | cap | ||
| ) |
Write the encoded field-section prefix for a static-only section. .
| work | PROTOCORE_QPACK_BORROW bytes the caller took. Not held past the call. |
| out | Out |
| cap | Cap |
| size_t protocore_qpack_encode_header | ( | uint8_t * | work, |
| uint8_t * | out, | ||
| size_t | cap, | ||
| const char * | name, | ||
| size_t | name_len, | ||
| const char * | value, | ||
| size_t | value_len | ||
| ) |
Encode one header field (server side): a full static match -> .
| work | PROTOCORE_QPACK_BORROW bytes the caller took. Not held past the call. |
| out | Out |
| cap | Cap |
| name | Name |
| name_len | Name len |
| value | Value |
| value_len | Value len |
| proto_bool protocore_qpack_decode | ( | uint8_t * | work, |
| const uint8_t * | block, | ||
| size_t | len, | ||
| char * | scratch, | ||
| size_t | scratch_cap, | ||
| QpackEmitFn | emit, | ||
| void * | ctx | ||
| ) |
Decode a whole QPACK field section (prefix + representations), .
| work | PROTOCORE_QPACK_BORROW bytes the caller took. Not held past the call. |
| block | Block |
| len | Len |
| scratch | caller buffer holding one header's name+value during each emit call |
| scratch_cap | Scratch cap |
| emit | Emit |
| ctx | Ctx |
| PROTOCORE_NS QpackNs Qpack PROTOCORE_UNUSED |
Module namespace.