Skip to main content

Module frame

Module frame 

Source
Expand description

Stream preamble: [0x57][kind][header_len varint][CBOR header].

Every unidirectional stream in both directions starts with this preamble. Parsing it is the first thing that touches hostile bytes, so it is the place where the header size cap is enforced — before any allocation.

Structs§

Preamble
A parsed stream preamble.

Enums§

FrameKind
What a stream carries.
PreambleError
Why a preamble was rejected.

Constants§

MAGIC
First byte of every weida stream: ASCII W.
MAX_PREAMBLE_LEN
Longest possible preamble: magic, kind and an 8-byte varint.

Functions§

encode_frame
Builds a complete header-only frame: preamble followed by header.
encode_preamble
Appends a preamble for header_len bytes of header to out.
parse_preamble
Parses a preamble from the front of input.
preamble_bytes
A preamble for header_len bytes of header, and how many of the returned bytes are it.