Skip to main content

check_full_track_name

Function check_full_track_name 

Source
fn check_full_track_name(
    namespace: &TrackNamespace,
    track_name: &[u8],
) -> Result<(), CodecError>
Expand description

Hold a namespace-plus-name pair to the Full Track Name cap.

Draft-14 Section 2.4.1: β€œThe maximum total length of a Full Track Name is 4,096 bytes, computed as the sum of the lengths of each Track Namespace tuple field and the Track Name length field. If an endpoint receives a Full Track Name exceeding this length, it MUST close the session with a PROTOCOL_VIOLATION.”

The two lengths arrive as separate fields, so neither the namespace decoder nor the name decoder can settle this alone: a namespace at 4,000 bytes and a name at 500 are each legal by themselves. It has to live where a message decodes both.

Draft-14 states no separate cap on a Track Namespace on its own β€” that sentence arrives in draft-16 β€” so this pairwise sum is the only bound the draft gives. A control message may be 65,535 bytes, so without it a peer can hand the application a Full Track Name sixteen times the permitted size, and two relays that disagree about whether it was legal disagree about cache identity.