Skip to main content

Module setup_option_names

Module setup_option_names 

Source
Expand description

The name a draft gives a setup parameter.

The sibling of crate::message_names, and per draft for the same reason: the codepoints are reused and retired rather than reserved. 0x02 is max_subscribe_id through draft-10, max_request_id from draft-11 to draft-16, and nothing at all from draft-17, which removed it and left the number unassigned. A table keyed on the number alone cannot say that.

§Why this takes a whole parameter and not a key

Drafts 11 through 13 name a setup parameter from its key and the shape of its value: 0x01 carrying bytes is path, and 0x01 carrying a varint is nothing those drafts define. A fn(u64) -> Option<&str> would have to guess, so the whole KeyValuePair goes in and the draft’s own renderer answers.

That renderer is the same one crate::dispatch::AnyControlMessage::fields uses, which is the property worth having: a parameter this reports as named is a parameter that draft would have named in a decoded message, because it is the same code answering.

§What it is for

Asking a second draft about a parameter that arrived under a first. A relay that sends a setup parameter the draft it negotiated does not define is sending something — an extension, or code left over from the draft it used to speak — and which of those it is depends on whether some other draft names it. That is an upgrade-hygiene signal: it is a fingerprint and also a line an operator can act on.

Receivers must ignore setup parameters they do not recognise, so a leftover is never a protocol violation. It is still a fact about the sender.

§The dispatch is shared; the answer is not

The fourteen-armed, catch-all-free match this dispatch needs is crate::draft_table::by_draft — private, so not a link — and crate::message_names spells the same one. Only the dispatch is shared: this table takes a whole parameter, answers a String out of the draft’s own renderer, and has its own reasons for both. See draft_table for the argument the two share.

Functions§

name_in 🔒
The name of the single entry a one-parameter render produced.
setup_option_name
The name draft draft gives param in a setup message, or None if that draft defines nothing for it.