Skip to main content

Module frame

Module frame 

Expand description

Framing for Fusee’s binary protocols (replication and server mode).

frame = "FSE1"  kind:u8  len:u32le  crc:u32le  body[len]
crc   = crc32c(kind ++ body)

Frames are bounded (MAX_FRAME) and checksummed, so a damaged or hostile stream fails fast instead of allocating without limit. The decoder is incremental: feed it whatever the socket returned and take complete frames out.

Structs§

Decoder
Incremental frame decoder.

Constants§

HEADER
MAGIC
MAX_FRAME

Functions§

encode
Appends one frame. body is at most MAX_FRAME bytes: the peer’s decoder refuses a longer one (and its length would not fit the header past 4 GiB), so whoever builds bodies from a backlog bounds them.