Skip to main content

Module codec

Module codec 

Source
Expand description

Length-prefixed frame codec for reading and writing protocol messages.

Wire format: [len: u32 BE][id: u32 BE][flags: u8][CBOR(v, t, p)]

The correlation ID and flags sit in a fixed-position binary header so that relay intermediaries can route frames without CBOR parsing.

Constants§

MAX_FRAME_SIZE
Maximum allowed frame size (4 MiB).

Functions§

encode_to_buf
Encodes a message to a byte buffer using the length-prefixed frame format.
read_message
Reads a length-prefixed message from the given reader.
try_decode_from_buf
Tries to decode a complete message from a byte buffer.
write_message
Writes a length-prefixed message to the given writer.