Skip to main content

Module framing

Module framing 

Source
Expand description

Wire framing: a 4-byte big-endian length prefix and a UTF-8 JSON body.

The declared length is checked against the ceiling before any body is decoded, and the first violation poisons the decoder for good: resynchronising on an attacker-chosen offset is worse than dropping the connection.

Structs§

Frame
One decoded wire frame: the raw body plus its parsed value.
FrameDecoder
Streaming decoder for length-prefixed JSON frames.

Constants§

FRAME_HEADER_BYTES
Size of the length prefix that precedes every frame body.

Functions§

decode_body
Decode and check one frame body.
encode_frame
Serialise a value into one length-prefixed frame.
project_dto
Check an untrusted parsed value against the DTO rules.