Change discovery function field to u16 bitfield

A node can declare multiple roles simultaneously (e.g. relay + sink).
Replaces the function string with a fixed-size flags field; keeps the
payload layout simple and fixed-width up to the name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 22:30:56 +00:00
parent 5dc28890f0
commit 03fe0ba806

View File

@@ -321,10 +321,20 @@ Payload fields:
|---|---|---| |---|---|---|
| `protocol_version` | u8 | Wire format version | | `protocol_version` | u8 | Wire format version |
| `tcp_port` | u16 | Port where this node accepts transport connections | | `tcp_port` | u16 | Port where this node accepts transport connections |
| `function_flags` | u16 | Bitfield declaring node capabilities (see below) |
| `name_len` | u8 | Length of name string | | `name_len` | u8 | Length of name string |
| `name` | bytes | Node name (`namespace:instance`, e.g. `v4l2:microscope`) | | `name` | bytes | Node name (`namespace:instance`, e.g. `v4l2:microscope`) |
| `function_len` | u8 | Length of function string |
| `function` | bytes | Node function identifier (`source`, `relay`, `sink`, ...) | `function_flags` bits:
| Bit | Mask | Meaning |
|---|---|---|
| 0 | `0x0001` | Source — produces video |
| 1 | `0x0002` | Relay — receives and distributes streams |
| 2 | `0x0004` | Sink — consumes video (display, archiver, etc.) |
| 3 | `0x0008` | Controller — participates in control plane coordination |
A node may set multiple bits — a relay that also archives sets both `RELAY` and `SINK`.
### Behaviour ### Behaviour