# Packet and Stream Model ## Packet Mutation Boundaries Raw DMR packet bytes should be treated as immutable input until an explicit rewrite operation. Transport simulation and protocol mutation must remain separate. Packet mutation must be named, explicit, and testable. FreeDMR should preserve packet bytes unless it intentionally rewrites them. Protocol-sensitive rewrite areas include: - Slot bit rewrite. - TG rewrite. - Stream ID preservation. - Source ID preservation. - Voice header LC rewrite. - Terminator LC rewrite. - Embedded LC rewrite. Voice header/terminator LC and embedded LC must be handled carefully. Embedded LC rewrite should apply only to voice bursts B-E, not data/control packets. Same-TG voice forwarding should preserve embedded LC payloads where possible. TG-mapped forwarding may regenerate embedded LC for routing correctness. Data/control packets are packet-oriented and not AMBE voice streams. Group-addressed data is valid and can be routed as data, not reported as voice. Data/control classification must remain separate from group-vs-unit addressing. Unit/private calls are control-plane only in FreeDMR. Do not introduce general private voice routing unless project policy changes. ## Sequence and Lifecycle Principles DMRD sequence numbers are one byte and modulo-256. - Delta `0`: duplicate. - Delta `1`: normal progress. - Delta `2..127`: forward progress with loss. - Delta `128..255`: stale or out-of-order. Explicit voice terminator is a strong end-of-stream signal. Timeout without terminator is softer and may remain recoverable on HBP to preserve audio continuity. HBP should be more tolerant because it is RF-facing and real deployments include imperfect terminals, repeaters, RF paths, cellular links, and RF IP links. FBP/OBP can be stricter because it is server-to-server, but should still preserve audio where possible on unreliable links. Loop-control safety must not be overridden by tolerance for delayed or out-of-order packets. ## LC and OVCM For DMR Group Voice Channel User LC, the first bytes are: - FLCO - FID - Service Options Normal synthetic group voice LC should use service options `0x00`. OVCM is `0x04` if explicitly required. HBLink legacy `0x20` should be documented as legacy/compatibility only. It is not standards-clean OVCM and should not be used as a new synthetic/system-generated traffic marker. Decoded real inbound LC must be preserved unchanged unless there is a deliberate reason to rewrite. Synthetic/fallback LC generation must be explicit and tested. FreeDMR routing metadata should be used for routing state, not magic bits in synthetic LC. ## Open Questions - Exact live RF behaviour after long HBP gaps still needs validation with real repeaters and terminals. - Some prompt/late-entry behaviour may need live testing because terminal interpretation of DMR standards can be loose or incomplete.