pub fn parse_frame_len(src: &[u8], max_frame_len: usize) -> Result<usize, Error>Expand description
Parses a frame length header, rejecting frames larger than max_frame_len.
The ceiling is the caller’s rather than a single global one, because the paths that parse frame lengths have requirements that differ by orders of magnitude: a startup frame is well under 10 KB, a pre-authentication credential exchange needs a few kilobytes, and only post-authentication query traffic needs room for bulk data. Stating it per call site keeps a buffer from ever being sized against a bound that belongs to a different path.
max_frame_len counts the frame including its own four-byte length field,
matching the number the client declares. netio::MAX_FRAME_SIZE is the
protocol ceiling; callers pass that or less.