Skip to main content

control_plane_is_unidirectional

Function control_plane_is_unidirectional 

Source
const fn control_plane_is_unidirectional(draft: DraftVersion) -> bool
Expand description

Whether this draft carries control messages on a pair of unidirectional streams, making a bidirectional stream a request stream rather than the control stream.

True on drafts 17 through 20; false on 07 through 16.

§What the drafts say

Draft-16 Section 3.3 (Session initialization): “The first stream opened is a client-initiated bidirectional control stream where the endpoints exchange Setup messages (Section 9.3), followed by other messages defined in Section 9.” One stream, opened by the client, carrying both directions.

Draft-17 Section 3.3, and identically draft-18 and draft-19 Section 3.3: “MOQT uses a pair of unidirectional streams for creating the session and exchanging control messages. Each peer opens one control stream beginning with a SETUP message. Using a pair of unidirectional streams rather than a single bidirectional stream allows either peer to send data as soon as it is able.” The same section then says what the bidirectional streams are for: “In addition to the control streams, this specification uses bidirectional streams to carry requests. A request stream begins with one of these six message types: TRACK_STATUS, SUBSCRIBE, PUBLISH, FETCH, PUBLISH_NAMESPACE, and SUBSCRIBE_NAMESPACE” — seven from draft-18, which adds SUBSCRIBE_TRACKS.

So on 17-19 each direction of the control plane is a separate stream, opened by the peer that writes on it: the client’s control stream carries client-to-relay control messages and the relay’s carries the other direction. Neither is closed for the session’s lifetime.

§How a control stream is told apart from a data stream

By its first varint. Draft-17 Section 3.4 (Unidirectional Stream Types): “All unidirectional MOQT streams start with a variable-length integer indicating the type of the stream”, and the table gives 0x05 for FETCH_HEADER, 0x10-0x1D for SUBGROUP_HEADER and 0x2F00 for SETUP. Drafts 18, 19 and 20 keep the same table and add PADDING (0x132B3E28). That 0x2F00 is also the SETUP message type (draft-17 Section 9.4), so the control stream’s type varint is the first field of its first message and nothing has to be stripped before forwarding: see CONTROL_STREAM_TYPE.

§Why the match is exhaustive

Because false is a whole session topology, not a conservative default. A draft that answered false by not being listed would have this proxy look for its control plane on the first bidirectional stream, treat every SETUP stream as a data stream, and show the control site nothing — a session that forwards bytes and reports almost none of them. The topology has already moved once, at draft-17; nothing says it cannot move back.