Skip to main content

Module wire

Module wire 

Source
Expand description

Wire format.

Two channels. A bidirectional control stream carries the manifest, resume state, and completion signalling. N unidirectional data streams carry chunk frames. Every frame is self-describing — file id, chunk index, and lengths — so frames may arrive on any stream in any order, which is what lets the receiver write with positional I/O and never buffer a whole file.

All integers are little-endian. Every length read off the wire is checked against a caller-supplied limit before it is used to size an allocation.

Modules§

flags

Structs§

FileEntry
One file in a transfer.
FrameHeader
LocalFileIndex
Chunks the receiver already holds, so the sender can skip them. Per-chunk hashes of a file the receiver already has on disk.
ResumeEntry

Enums§

Control
ControlKind
EntryKind

Constants§

FRAME_HEADER_LEN
Fixed-size data frame header. Authenticated as AEAD associated data, so a peer cannot re-point a sealed chunk at a different file or offset.
WIRE_VERSION

Functions§

read_control
Read one control message, refusing bodies larger than max_body.
write_control
Write one control message: kind, u32 length, body.