Expand description
Length-prefixed wire framing for deCDN ALPNs (ADR 013).
Every message on every QUIC stream is varint(len) || postcard_bytes[0..len].
The varint uses postcard’s native continuation-bit encoding (7 data bits per
byte, MSB = continuation, little-endian, 1–5 bytes for u32).
Receivers read the varint length, reject anything above MAX_MESSAGE_SIZE
before allocation, allocate exactly that many bytes, then deserialize the
frame with decode_message (a thin wrapper over
postcard::take_from_bytes that preserves the trailing remainder for
future Tier-1 extension fields).
Enums§
- Frame
Error - Errors produced by the framing helpers. The handler-layer mapping to QUIC application error codes lives in the node crate.
Constants§
- MAX_
MESSAGE_ SIZE - Maximum framed message size. Pinned at exactly 16 MiB by ADR 013 §Wire Framing, uniformly across all ALPNs in v1.
Traits§
- TopLevel
Enum - A top-level ALPN protocol enum (one per ALPN —
crate::ProbeMessage,crate::ClientMessage,crate::DhtMessage). Serialized as the outermost postcard value in a frame, so its variant discriminant is the frame’s leading varint.
Functions§
- decode_
message - Decode a frame into a message and the unconsumed remainder. The remainder is reserved for Tier-1 extension fields (ADR 013 §Tier 1).
- encode_
message - Serialize
msgto a postcard buffer suitable for passing towrite_frame. - is_
unknown_ variant - Classify a failed top-level-enum decode per ADR 013: return
trueiff the frame’s leading discriminant names a variant at or beyondM::VARIANT_COUNT— i.e. an unknown/unsupported variant the receiver must answer withUNSUPPORTED_MESSAGE(0x01) rather thanMALFORMED_MESSAGE(0x03). - parse_
frame - Try to locate one complete length-prefixed frame at the front of
bufwithout consuming it, returning(header_len, payload_len)— the byte counts of the varint prefix and the payload it announces. ReturnsOk(None)whenbufdoes not yet hold a complete frame (the varint is truncated, or fewer thanpayload_lenpayload bytes have arrived). - read_
frame - Read one length-prefixed frame from an async reader.
- write_
frame - Write one length-prefixed frame to an async writer.