Skip to main content

Crate weida_protocol

Crate weida_protocol 

Source
Expand description

weida wire protocol v0: framing, CBOR headers, negotiation and QUIC application error codes.

The crate performs no I/O. It parses and encodes byte slices, which makes it directly fuzzable and keeps hostile-input handling in one place. Every decoder treats its input as hostile: lengths are checked before allocation, duplicate map keys are rejected and nesting depth is bounded.

docs/PROTOCOL.md is the normative specification; this crate is its implementation, and the golden vectors in §8 are asserted byte-for-byte by the unit tests.

Re-exports§

pub use frame::FrameKind;
pub use frame::MAGIC;
pub use frame::MAX_PREAMBLE_LEN;
pub use frame::Preamble;
pub use frame::PreambleError;
pub use frame::encode_frame;
pub use frame::encode_preamble;
pub use frame::parse_preamble;
pub use frame::preamble_bytes;
pub use header::CreditHeader;
pub use header::CursorHeader;
pub use header::CursorLevel;
pub use header::DataHeader;
pub use header::ErrorHeader;
pub use header::HeaderError;
pub use header::Hello;
pub use header::ReportMode;
pub use header::SubscriptionHeader;
pub use header::decode_cursor_record;
pub use header::encode_cursor_record;
pub use header::filter;
pub use header::limits as header_limits;
pub use negotiate::Agreed;
pub use negotiate::NegotiateError;
pub use negotiate::negotiate;
pub use varint::VarintError;
pub use varint::decode_varint;
pub use varint::encode_varint;
pub use varint::varint_len;

Modules§

codes
QUIC application error codes used in CONNECTION_CLOSE, RESET_STREAM and STOP_SENDING (docs/PROTOCOL.md §7).
frame
Stream preamble: [0x57][kind][header_len varint][CBOR header].
header
CBOR frame headers.
negotiate
Version and capability negotiation.
varint
QUIC variable-length integers (RFC 9000 §16).

Constants§

ALPN
TLS ALPN token identifying the weida native QUIC protocol.
VERSION
Wire protocol version implemented by this crate (experimental).