Skip to main content

Module message_names

Module message_names 

Source
Expand description

The name a draft gives a control message type ID.

A recorded trace stores a control message as a wire type ID and the draft it was read under — mt and the header’s protocol: moq-transport-NN in a .moqtrace file. Both halves are needed to name it, because the ids are reused rather than retired: 0x07 is ANNOUNCE_OK through draft-13, PUBLISH_NAMESPACE_OK on draft-14 and REQUEST_OK from draft-15 on, and 0x0E moves TRACK_STATUS → TRACK_STATUS_OK → NAMESPACE_DONE across the same range. A table keyed on the id alone can only hedge — SUBSCRIBE_DONE/PUBLISH_DONE — and the hedge holds exactly while a rename keeps the number, which is not what happened to 0x07, 0x08, 0x0E or 0x11.

So the lookup is per draft, and the per-draft half of it lives on each draft’s own MessageType::name. Nothing here derives one draft’s names from another’s. message_type_name is re-exported at the crate root.

§The names are the corpus’s

Each name() answers with the message_type field of that draft’s transport/draftNN/codec/messages/*.json vectors — subscribe, publish_namespace, goaway — which is the same string the JavaScript codec’s MESSAGE_TYPE_MAP answers with for the same id. That shared spelling is the point: a trace named by either implementation reads the same way, and tests/message_type_names.rs compares all fourteen drafts against the corpus in both directions so the two tables cannot drift apart quietly.

The corpus is test-only — Cargo.toml excludes it from the package — so nothing here reads it at runtime. The names are transcribed into the draft modules and the test is what holds the transcription honest.

Functions§

message_type_name
The name draft draft gives control message type id, or None if that draft assigns the id nothing.