diff --git a/configs/bridge-config.example.yml b/configs/bridge-config.example.yml index 210cd01b..3403c217 100644 --- a/configs/bridge-config.example.yml +++ b/configs/bridge-config.example.yml @@ -66,6 +66,7 @@ network: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # AES-256 32-byte Preshared Key for peer-based key requests @@ -105,11 +106,14 @@ system: netId: BB800 # System ID. sysId: 001 + # Local time offset from GMT used in generated P25 site data. + localTimeOffset: 0 # Flag indicating whether a network grant demand packet will be sent before audio. grantDemand: false # Audio transmit mode (1 - DMR, 2 - P25, 3 - Analog, 4 - NXDN). + # Out-of-range values are clamped to the supported range. Analog mode disables duplicateToAnalog. txMode: 1 # Flag indicating whether or not audio should be duplicated to a analog TG when the bridge is encoding traffic. duplicateToAnalog: false @@ -147,7 +151,9 @@ system: enable: false # Traffic Encryption Key Algorithm # aes - AES-256 Encryption + # des - DES Encryption # arc4 - ARC4/ADP Encryption + # For NXDN, valid algorithms are aes, des, and ehr, and the KID range is 0-63. tekAlgo: "aes" # Traffic Encryption Key ID (Hex) tekKeyId: 1 @@ -162,6 +168,7 @@ system: # Relative sample level for VOX to activate. voxSampleLevel: 80.0 # Amount of time (ms) from loss of active call (loss of local VOX or end of UDP audio stream) before ending call. + # P25 UDP audio forces this value to 360ms (one P25 audio superframe). dropTimeMs: 180 # Enables detection of MDC1200 packets on the PCM side of the bridge. @@ -203,6 +210,7 @@ system: # # Flag indicating UDP audio should be RTP framed. + # RTP disables USRP framing and udpFrameTiming. udpRTPFrames: true # Flag indicating UDP audio RTP timing should be ignored. # (This allows the sending source to send audio as fast as it wants. This should not be used in combination @@ -218,6 +226,7 @@ system: udpUseULaw: false # Flag indicating UDP audio should follow the USRP format. + # USRP framing disables UDP metadata, RTP framing, and uLaw encoding. udpUsrp: false # Flag indicating UDP audio frame timing will be performed by the bridge. diff --git a/configs/config.example.yml b/configs/config.example.yml index f8e42352..d3532504 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -94,6 +94,7 @@ network: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # AES-256 32-byte Preshared Key for peer-based key requests @@ -101,7 +102,7 @@ network: # 0 - 9, A - F.) kmfPresharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" - # Maximum allowable DMR network jitter. + # Maximum allowable DMR network jitter/hang value used by DMR traffic processing. jitter: 360 # Flag indicating whether unit-to-unit calls will be discarded in both network directions. @@ -439,7 +440,7 @@ protocols: # System Configuration # system: - # Textual label of this host. + # Textual label of this host. Values longer than 8 characters are truncated. identity: ABCD123 # Total call transmit time maximum. (seconds) timeout: 180 @@ -449,6 +450,7 @@ system: # (instead of split frequency). simplexSameFrequency: false # Amount of time the host will "hang" on a digital mode in multi-mode operation. (seconds) + # When present, this compatibility option overrides both rfModeHang and netModeHang. modeHang: 10 # Amount of time the host will "hang" on a RF received digital mode in multi-mode operation. (seconds) # rfModeHang: 10 @@ -461,10 +463,12 @@ system: # traffic for the last TGID received. rfTalkgroupHang: 10 # Sets the amount of delay between "ticks" of the processing loop when the host is active (i.e. - # processing traffic). (ms) [Note: Default value is recommend, normally this should not be changed.] + # processing traffic). (ms) [Note: Default value is recommended, normally this should not be changed.] + # Values below 1 are clamped to 1. activeTickDelay: 5 # Sets the amount of delay between "ticks" of the processing loop when the host is idle (i.e. not - # processing traffic). (ms) [Note: Default value is recommend, normally this should not be changed.] + # processing traffic). (ms) [Note: Default value is recommended, normally this should not be changed.] + # Values below 1 are clamped to 1. idleTickDelay: 5 # Sets the local time offset from GMT. localTimeOffset: 0 diff --git a/configs/fne-config.example.yml b/configs/fne-config.example.yml index 08f1f9b6..e4faabde 100644 --- a/configs/fne-config.example.yml +++ b/configs/fne-config.example.yml @@ -66,7 +66,7 @@ log: # (This is the endpoint that downstream peers connect to for this FNE instance.) # master: - # Network Peer ID + # Network Peer ID (maximum 999999999). # NOTE: This ID is a uniquely identifying number. It *MUST* be a unique number across any networks this FNE # instance connects to. Failure to use a unique number *WILL* cause network issues. peerId: 9000100 @@ -96,7 +96,8 @@ master: # Flag indicating whether or not analog traffic will be passed. allowAnalogTraffic: false - # Maximum number of concurrent packet processing workers. + # Maximum number of concurrent packet processing workers. Values are clamped to 4-128; + # values above 64 may reduce performance. workers: 16 # Flag indicating whether or not master endpoint networking is encrypted. @@ -104,6 +105,7 @@ master: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # Flag indicating whether or not peer pinging will be reported. @@ -162,6 +164,7 @@ master: spanningTreeFastReconnect: true # Delay from when a call on a parrot TG ends to when the playback starts (in milliseconds). + # This cannot exceed pingTime; larger values are reduced to half the ping interval. parrotDelay: 2000 # Flag indicating whether or not a parrot TG call will generate a grant demand. parrotGrantDemand: true @@ -378,6 +381,7 @@ master: # # Upstream FNE Neighbor Peering # (This is the list of connections to upstream FNEs this FNE instance should be connected to.) +# More than 8 configured upstream peers is supported but may reduce performance. # peers: - name: MASTERFNE @@ -389,7 +393,7 @@ peers: masterPort: 32090 # FNE access password. password: RPT1234 - # Network Peer ID of this peer on the upstream FNE master. + # Network Peer ID of this peer on the upstream FNE master (maximum 999999999). peerId: 9000990 # Flag indicating whether or not peer endpoint networking is encrypted. @@ -397,6 +401,7 @@ peers: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # Latitude. @@ -427,17 +432,21 @@ system: # Textual identity of this FNE (this is used when peering with upstream FNEs). identity: MASTERFNE - # Time in seconds between pings to peers. + # Time in seconds between pings to peers. 0 defaults to 5; values above 59 are capped at 59. pingTime: 5 - # Maximum number of missable pings before a peer is considered disconnected. + # Maximum number of missable pings before a peer is considered disconnected. 0 defaults to 5. maxMissedPings: 10 - # Time in minutes between updates of the ACL rules. + # Time in minutes between updates of the ACL rules. 0 defaults to 10. aclRuleUpdateTime: 10 # Flag indicating the TGID information for this master will be sent to its peers. sendTalkgroups: true + # Flag indicating whether activity logs from peers are accepted by this FNE. + # Disabling this significantly limits normal activity logging and is not recommended. + allowActivityTransfer: true + # Flag indicating when this FNE instance receives peer link configuration updates, it will save those # peer link configurations. peerLinkSaveACL: false diff --git a/configs/fne-sysview.example.yml b/configs/fne-sysview.example.yml index 4879d0a8..e3b791a5 100644 --- a/configs/fne-sysview.example.yml +++ b/configs/fne-sysview.example.yml @@ -87,7 +87,7 @@ fne: password: RPT1234 # Textual identity of this peer. identity: SYSVIEW - # Network Peer ID + # Network Peer ID (maximum 999999999). peerId: 9000990 # Flag indicating whether or not peer endpoint networking is encrypted. @@ -95,6 +95,7 @@ fne: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # IP address of the FNE REST API. diff --git a/configs/patch-config.example.yml b/configs/patch-config.example.yml index 27678d2e..b790d8bd 100644 --- a/configs/patch-config.example.yml +++ b/configs/patch-config.example.yml @@ -66,6 +66,7 @@ network: # AES-256 32-byte Preshared Key # (This field *must* be 32 hex bytes in length or 64 characters # 0 - 9, A - F.) + # A 32-character value is doubled for legacy compatibility. Invalid values disable encryption. presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" # AES-256 32-byte Preshared Key for peer-based key requests @@ -81,7 +82,8 @@ network: # Flag indicating whether or not verbose debug logging is enabled. debug: false - # Source Talkgroup ID for transmitted/received audio frames. + # Source Talkgroup ID for transmitted/received audio frames. Must be nonzero and + # different from destinationTGID. Maximum: 16777215 for DMR, 65535 for P25. # In an MMDVM gateway mode, this is the DVM FNE-facing talkgroup. sourceTGID: 1 # Source Slot for received/transmitted audio frames. @@ -94,12 +96,14 @@ network: enable: false # Traffic Encryption Key Algorithm # aes - AES-256 Encryption + # des - DES Encryption # arc4 - ARC4/ADP Encryption tekAlgo: "aes" # Traffic Encryption Key ID (Hex) tekKeyId: 1 - # Destination Talkgroup ID for transmitted/received audio frames. + # Destination Talkgroup ID for transmitted/received audio frames. Must be nonzero and + # different from sourceTGID. Maximum: 16777215 for DMR, 65535 for P25. # In an MMDVM gateway mode, this is the gateway-facing talkgroup. destinationTGID: 1 # Destination Slot for received/transmitted audio frames. @@ -112,14 +116,12 @@ network: enable: false # Traffic Encryption Key Algorithm # aes - AES-256 Encryption + # des - DES Encryption # arc4 - ARC4/ADP Encryption tekAlgo: "aes" # Traffic Encryption Key ID (Hex) tekKeyId: 1 - # Amount of time (ms) from loss of active call before ending call. - dropTimeMs: 1000 - # Flag indicating whether or not the patch is two-way. # NOTE: If false (one-way patch from source to destination), and patching clear to # encrypted traffic, only the destination TEK will be used for encryption. The clear @@ -144,13 +146,18 @@ system: netId: BB800 # System ID. sysId: 001 + # Local time offset from GMT used in generated P25 site data. + localTimeOffset: 0 - # Digital mode (1 - DMR, 2 - P25). + # Digital mode (1 - DMR, 2 - P25). Out-of-range values are clamped. digiMode: 1 # Flag indicating whether a network grant demand packet will be sent before audio. grantDemand: false + # Amount of time (ms) from loss of active call before ending call. + dropTimeMs: 1000 + # Flag indicating whether or not the patch is from/to a MMDVM P25 reflector. mmdvmP25Reflector: false # Flag indicating whether or not the patch is from/to a MMDVM DMRGateway. diff --git a/configs/schema/talkgroup_rules.yaml_schema.json b/configs/schema/talkgroup_rules.yaml_schema.json index aad1fb72..c65f326c 100644 --- a/configs/schema/talkgroup_rules.yaml_schema.json +++ b/configs/schema/talkgroup_rules.yaml_schema.json @@ -1,115 +1,142 @@ { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Digital Voice Modem - Talkgroup Rules", + "description": "Schema for DVMHost and FNE group-voice admission, routing, rewrite, affiliation, encryption-strapping, and parrot rules.", + "type": "object", + "required": [ "groupVoice" ], + "additionalProperties": false, + "definitions": { + "peerId": { + "description": "Network peer ID. Peer IDs are positive integers and may not exceed the runtime network limit.", + "type": "integer", + "minimum": 1, + "maximum": 999999999 + }, + "radioId": { + "description": "Subscriber radio ID. Protocol-specific limits may be narrower than the common 32-bit representation.", + "type": "integer", + "minimum": 1, + "maximum": 4294967295 + }, + "talkgroupId": { + "description": "Talkgroup ID. Protocol-specific limits may be narrower than the common 32-bit representation.", + "type": "integer", + "minimum": 1, + "maximum": 4294967295 + }, + "slot": { + "description": "DMR slot number. FDMA protocols use slot 1 in the shared rule representation.", + "type": "integer", + "enum": [ 1, 2 ] + }, + "peerIdList": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/peerId" + } + } + }, "properties": { "groupVoice": { - "description": "List of talkgroups defined by this rules file.", + "description": "Nonempty list of canonical group-voice rules.", "type": "array", + "minItems": 1, "items": { "type": "object", "required": [ "name", "config", "source" ], + "additionalProperties": false, "properties": { "name": { - "description": "Textual name of the talkgroup.", - "type": "string" + "description": "Human-readable rule name used by logs and management interfaces.", + "type": "string", + "minLength": 1 }, "alias": { - "description": "Secondary name/group for the talkgroup.", + "description": "Optional secondary display name or grouping label; it has no routing effect.", "type": "string" }, "config": { - "description": "Talkgroup Configuration", + "description": "Admission and routing policy for the canonical talkgroup.", "type": "object", "required": [ "active" ], + "additionalProperties": false, "properties": { "active": { - "description": "Flag indicating whether this talkgroup is active or not.", + "description": "Whether the talkgroup is admitted and distributed as active.", "type": "boolean" }, "affiliated": { - "description": "Flag indicating whether this talkgroup will only repeat with affiliations.", + "description": "Whether normal recipient sites must have a current group affiliation before traffic is repeated to them.", + "type": "boolean" + }, + "strapping": { + "description": "Encryption-state policy: 0 selectable, 1 encrypted-only, 2 clear-only.", + "type": "integer", + "enum": [ 0, 1, 2 ] + }, + "parrot": { + "description": "Whether eligible calls on this talkgroup are recorded and replayed by the FNE parrot service.", "type": "boolean" }, "inclusion": { - "description": "List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).", - "type": "array", - "items": { - "description": "Network Peer ID.", - "type": "number", - "uniqueItems": true - } + "description": "Peer allow-list. When nonempty, only listed normal peers are eligible; this takes precedence over exclusion.", + "$ref": "#/definitions/peerIdList" }, "exclusion": { - "description": "List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).", - "type": "array", - "items": { - "description": "Network Peer ID.", - "type": "number", - "uniqueItems": true - } + "description": "Peer deny-list used only when inclusion is empty.", + "$ref": "#/definitions/peerIdList" }, "rewrite": { - "description": "List of peer talkgroup rewrites.", + "description": "Per-peer external TGID/slot representations for bidirectional translation at that FNE boundary.", "type": "array", + "uniqueItems": true, "items": { "type": "object", + "required": [ "peerid", "tgid", "slot" ], + "additionalProperties": false, "properties": { "peerid": { - "description": "Network Peer ID to rewrite this TGID for.", - "type": "number" + "$ref": "#/definitions/peerId" }, "tgid": { - "description": "Numerical talkgroup ID number to rewrite to.", - "type": "number" + "$ref": "#/definitions/talkgroupId" }, "slot": { - "description": "DMR slot number.", - "type": "number" + "$ref": "#/definitions/slot" } } } }, "always": { - "description": "List of peer IDs that always receive traffic for this talkgroup regardless of affiliation rules.", - "type": "array", - "items": { - "description": "Network Peer ID.", - "type": "number", - "uniqueItems": true - } + "description": "Peers that bypass affiliation and applicable unknown-RID gating after inclusion/exclusion filtering.", + "$ref": "#/definitions/peerIdList" }, "preferred": { - "description": "List of site CC peer IDs defining talkgroup access preference (peers listed here will be preferred for access, sites not listed here will be non-preferred and will cause a AFF_GRP_RSP DENY, typically triggering roaming). If this list is empty *all* peers are preferred. (Trunking Only)", - "type": "array", - "items": { - "description": "Network Peer ID.", - "type": "number", - "uniqueItems": true - } + "description": "Preferred trunking-site peer IDs. With a nonempty list, other visible peers are marked non-preferred to encourage subscriber roaming.", + "$ref": "#/definitions/peerIdList" }, "rid_permitted": { - "description": "List of radio IDs admitted to affiliate with and originate traffic on the talkgroup. An empty list admits all radio IDs when talkgroup ACL enforcement is enabled.", + "description": "Subscriber RIDs admitted to affiliate with and originate on the talkgroup. An empty list admits all otherwise-authorized RIDs.", "type": "array", + "uniqueItems": true, "items": { - "description": "Radio ID.", - "type": "number", - "uniqueItems": true + "$ref": "#/definitions/radioId" } } } }, "source": { - "description": "Source Configuration", + "description": "Canonical talkgroup identity used internally by the FNE and host.", "type": "object", "required": [ "tgid", "slot" ], + "additionalProperties": false, "properties": { "tgid": { - "description": "Numerical talkgroup ID number.", - "type": "number" + "$ref": "#/definitions/talkgroupId" }, "slot": { - "description": "DMR slot number.", - "type": "number" + "$ref": "#/definitions/slot" } } } diff --git a/configs/talkgroup_rules.example.yml b/configs/talkgroup_rules.example.yml index 61375ca7..241fff64 100644 --- a/configs/talkgroup_rules.example.yml +++ b/configs/talkgroup_rules.example.yml @@ -26,6 +26,9 @@ # # Talkgroup Rules # +# Peer routing lists should use either inclusion or exclusion, not both. If both +# lists are nonempty, inclusion takes precedence and exclusion is ignored. +# groupVoice: # Textual name of the talkgroup. - name: Talkgroup 1 diff --git a/docs/TN.1000 - Network Stack Technical Documentation.md b/docs/TN.1000 - Network Stack Technical Documentation.md index 52da9acd..a90b81b1 100644 --- a/docs/TN.1000 - Network Stack Technical Documentation.md +++ b/docs/TN.1000 - Network Stack Technical Documentation.md @@ -1,7 +1,7 @@ # DVM Network Stack Technical Documentation -**Version:** 1.2 -**Date:** July 8, 2026 +**Version:** 1.3 +**Date:** November 22, 2026 **Author:** AI Assistant (updated based on current source code analysis) AI WARNING: This document was mainly generated using AI assistance. As such, there is the possibility of some error or inconsistency. @@ -270,8 +270,9 @@ Representative current layout: ```cpp class TrafficNetwork : public BaseNetwork { private: - concurrent::shared_unordered_map m_peers; - concurrent::unordered_map m_peerAffiliations; + std::unordered_map m_peers; + concurrent::unordered_map> m_peerAffiliations; concurrent::shared_unordered_map> m_ccPeerMap; lookups::RadioIdLookup* m_ridLookup; @@ -283,7 +284,7 @@ private: Timer m_maintainenceTimer; bool m_enableSpanningTree; - bool m_disallowU2U; + bool m_privateCallRoutingEnabled; }; class MetadataNetwork : public BaseNetwork { @@ -312,7 +313,7 @@ The DVM network stack implements a layered protocol architecture: - **Socket Operations**: Standard UDP datagram socket (IPv4/IPv6) - **Buffer Sizes**: Configurable send/receive buffers (default 512KB) - **Non-Blocking**: Asynchronous I/O for high-throughput scenarios -- **Encryption**: Optional AES-256-ECB UDP payload wrapping with preshared key and `0xC0FE` packet leader +- **Encryption**: Optional AES-256-CBC UDP payload wrapping with a preshared key, per-datagram IV, and `0xC0FE` packet leader ### Layer 2: RTP (Real-time Transport Protocol) @@ -1863,6 +1864,8 @@ m_mux->setSequence(streamId, sequence); Incoming packets are validated and routed by stream ID: +On an FNE, accepted DMR, P25 Phase 1, P25 Phase 2, and NXDN traffic is dispatched through the shared inbound worker pool with a per-stream ordering key. Frames for one peer/SSRC, stream, direction, and protocol lane execute FIFO, while unrelated calls can execute concurrently. Dispatch does not wait for a missing sequence number or call header; RTP validation and the protocol late-entry rules continue to handle those cases. + ```cpp MULTIPLEX_RET_CODE Network::verifyStream(uint16_t* lastRxSeq) { uint16_t rtpSeq = rtpHeader.getSequence(); @@ -1951,7 +1954,7 @@ sha256.buffer(in, (uint32_t)(size + sizeof(uint32_t)), out + 8U); ### Encryption -Optional AES-256-ECB encryption is implemented as UDP payload wrapping at the socket layer: +Optional AES-256-CBC encryption is implemented as UDP payload wrapping at the socket layer: ```cpp void Network::setPresharedKey(const uint8_t* presharedKey) { @@ -1967,17 +1970,17 @@ void Network::setPresharedKey(const uint8_t* presharedKey) { **Encryption Algorithm:** -The implementation uses AES-256-ECB (Electronic Codebook mode): -- **Algorithm**: AES-256-ECB +The implementation uses AES-256-CBC (Cipher Block Chaining mode): +- **Algorithm**: AES-256-CBC - **Key Size**: 256 bits (32 bytes) - **Block Size**: 128 bits (16 bytes) -- **Mode**: ECB - each 16-byte block encrypted independently +- **IV**: A fresh 16-byte initialization vector is generated for each datagram and appended after the ciphertext - **Padding**: Zero-padding to the AES block boundary -- **Packet Leader**: `0xC0FE` (`AES_WRAPPED_PCKT_MAGIC`) is prepended before encrypted payloads +- **Wire Layout**: Two-byte `0xC0FE` leader, block-aligned ciphertext, then the 16-byte IV **Runtime Behavior:** When preshared-key wrapping is enabled, receive logic drops datagrams that do not carry the `0xC0FE` leader. This is transport wrapping around the existing RTP/FNE payload, not SRTP. -**Note**: ECB mode is used for simplicity and performance in this implementation. While ECB has known cryptographic weaknesses (identical plaintext blocks produce identical ciphertext), the primary goal is to provide basic confidentiality for network traffic between trusted peers rather than military-grade security. For high-security deployments, additional network-layer security (IPsec, VPN) should be used. +This wrapper provides transport confidentiality but does not authenticate the ciphertext. Deployments requiring authenticated transport should use an additional protected network layer such as a VPN or IPsec. ### Access Control @@ -2005,12 +2008,14 @@ NET_FUNC::MASTER + NET_SUBFUNC::MASTER_SUBFUNC_DEACTIVE_TGS - IP address restrictions - Certificate-based authentication (with SSL/TLS) -**Configuration Flags:** +**Configuration and Policy Controls:** -- `m_rejectUnknownRID`: Reject calls from unknown RIDs -- `m_restrictGrantToAffOnly`: Require affiliation for grants -- `m_restrictPVCallToRegOnly`: Require registration for private calls -- `m_disallowU2U`: Disable unit-to-unit calls globally +- RID and talkgroup lookup policy controls whether unknown or unauthorized sources are admitted. +- Talkgroup rules control affiliation requirements and peer inclusion/exclusion. +- `privateCallRouting.enable` controls whether private/unit-to-unit setup, grants, media, and signaling may be routed. +- `privateCallRouting.unknownDestination` selects `reject` or `flood` behavior when no unit route is known. +- `privateCallRouting.learnFromTraffic`, `routeLifetime`, and `queryTimeout` control dynamic unit-location learning and expiry. +- Per-peer `allowUnitToUnit` policy can further restrict private-call ingress and egress. --- @@ -2675,7 +2680,7 @@ Offset | Length | Field | Description **Important Notes:** - KEY_REQ/KEY_RSP are for **call data encryption** (voice/data payload), not network transport encryption -- Network transport uses the optional AES-256-ECB UDP wrapper described in Section 9 +- Network transport uses the optional AES-256-CBC UDP wrapper described in Section 9 - Keys are transmitted encrypted over the already-secured network connection - Only authorized peers (verified during RPTK) can request keys - Key material format is algorithm-specific (AES keys, DES keys, etc.) @@ -2785,32 +2790,31 @@ master: password: "SecurePassword123" # Scaling - workers: 8 + workers: 16 connectionLimit: 100 # Transport security encrypted: false presharedKey: "000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F" - # Network Features - spanningTree: true - spanningTreeFastReconnect: true - disallowU2U: false - - # Access Control - rejectUnknownRID: true - restrictGrantToAffOnly: true - restrictPVCallToRegOnly: false - - # Timers - pingTime: 5 - updateLookupTime: 30 - callCollisionTimeout: 5 - - # Logging - reportPeerPing: false - logDenials: true - logUpstreamCallStartEnd: true + # Access control and routing + rejectUnknownRID: true + restrictGrantToAffiliatedOnly: true + privateCallRouting: + enable: false + unknownDestination: reject + learnFromTraffic: true + routeLifetime: 300 + queryTimeout: 1000 + + # Timers + pingTime: 5 + callCollisionTimeout: 5 + + # Logging + reportPeerPing: false + logDenials: true + logUpstreamCallStartEnd: true ``` --- @@ -2921,6 +2925,7 @@ tail -f /var/log/dvm/dvmhost.log | grep "NET" | 1.0 | Dec 3, 2025 | Initial documentation based on source code analysis | | 1.1 | May 8, 2026 | Update to match current state of the codebase | | 1.2 | Jul 8, 2026 | Corrected connection/auth flow, opcode tables, RPTC schema, ping payload, bitfields, and buffer/stream details to match current implementation | +| 1.3 | Nov 22, 2026 | Updated UDP encryption to AES-256-CBC and replaced removed private-call policy flags | --- diff --git a/docs/TN.1001 - Modem Protocol.adoc b/docs/TN.1001 - Modem Protocol.adoc deleted file mode 100644 index a4aad360..00000000 --- a/docs/TN.1001 - Modem Protocol.adoc +++ /dev/null @@ -1,1493 +0,0 @@ -= Digital Voice Modem - -== Technical Note -=== Modem Protocol - -Document Identifier: TN.1001 - -Author: Bryan Biedenkapp, N2PLL - -Editors: Bryan Biedenkapp, N2PLL - -Contributors: N/A - -Abstract: Describes high-level concepts and procedures for the Modem Protocol. - -Status: Draft - -== 1. Introduction -This document describes, in high-level, the general concepts and procedures for the Modem Protocol used by DVM projects. - -== 2. Technical Note - -=== 2.1 Definitions -* DVM: Digital Voice Modem - -=== 2.2 General Concept -The DVM Modem Protocol defines a common and standard communications protocol between a host application and a dedicated modem hardware device (usually based around a STM32F446 or similar). - -The core purpose of the protocol is to provide a common serial communications between the host application and the dedicated modem hardware. - -=== 2.3 Modem Packet Framing -The modem protocol implements a very simplistic framing mechanism for transmitting data between the host and modem (and vice versa). - -[cols="2,1,3"] -|=== -|Frame Type |Opcode |Description - -|Short -|$FE -|This frame type is used for transporting packets of 254 bytes or less in length. - -|Long -|$FD -|This frame type is used for transporting packets greater than 254 bytes in length. -|=== - -[discrete] -==== Modem Packet - Short Frame -[listing] - Byte 0 1 2 3 - Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Frame Type | Length | Opcode | ... | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 2 bytes (not including data length) - -[discrete] -==== Modem Packet - Long Frame -[listing] - Byte 0 1 2 3 - Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Frame Type | Length | Opcode | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 3 bytes (not including data length) - -It is important to note the Length parameter of the packet buffer should be the length of the *entire* packet not just the payload. - -==== 2.3.1 Modem Opcodes -The opcode defines which operation/command being transmitted. - -[cols="2,1,3"] -|=== -|Function Name |Opcode |Description - -|Get Version -|$00 -|This function is used for retrieving the firmware version from the modem. - -|Get Status -|$01 -|This function is used for retrieving the current status from the modem. - -|Set Configuration -|$02 -|This function is used for setting configuration parameters to the modem. - -|Set Mode -|$03 -|This function is used for setting the operational mode parameter to the modem. - -|Set Symbol Level Adjustment -|$04 -|This function is used for setting the symbol level adjustment parameters to the modem. - -|Set Rx Level Adjustment -|$05 -|This function is used for setting the receive level adjustment parameter to the modem. - -|Set RF Parameters -|$06 -|This function is used for setting the RF parameters to the modem. (Hotspot Only) - -|Calibration Data -|$08 -|This function is used for setting calibration data to the modem when operating in a calibration mode. - -|RSSI Data -|$08 -|This function is used for receiving RSSI data from the modem. - -|Send CW ID -|$0A -|This function is used to cause the modem to emit a CWID burst of morse code. - -|Set FIFO Buffers -|$0F -|This function is used for setting the internal FIFO ringbuffer sizes on the modem. - -|DMR Slot 1 Data -|$18 -|This function is used for sending/receiving DMR Slot 1 protocol data to/from the modem. - -|DMR Slot 1 Lost -|$19 -|This function is used for signalling loss of synchronization for DMR Slot 1 protocol data. - -|DMR Slot 2 Data -|$1A -|This function is used for sending/receiving DMR Slot 2 protocol data to/from the modem. - -|DMR Slot 2 Lost -|$1B -|This function is used for signalling loss of synchronization for DMR Slot 2 protocol data. - -|DMR Short LC -|$1C -|This function is used for sending/receiving DMR Short LC protocol data to/from the modem. - -|DMR Start -|$1D -|This function is used for providing transmitter control and starting the DMR data stream. - -|DMR Abort -|$1E -| - -|DMR CACH AT Control -|$1F -|This function is used for setting the DMR CACH AT bit on or off. - -|DMR Slot 1 Clear -|$20 -|This function is used for commanding the modem to clear the DMR Slot 1 FIFO buffers. - -|DMR Slot 2 Clear -|$21 -|This function is used for commanding the modem to clear the DMR Slot 2 FIFO buffers. - -|Project 25 Data -|$31 -|This function is used for sending/receiving Project 25 protocol data to/from the modem. - -|Project 25 Lost -|$32 -|This function is used for signalling loss of synchronization for Project 25 protocol data. - -|Project 25 Clear -|$33 -|This function is used for commanding the modem to clear the Project 25 FIFO buffers. - -|NXDN Data -|$41 -|This function is used for sending/receiving NXDN protocol data to/from the modem. - -|NXDN Lost -|$42 -|This function is used for signalling loss of synchronization for NXDN protocol data. - -|NXDN Clear -|$43 -|This function is used for commanding the modem to clear the NXDN FIFO buffers. - -|Ack -|$70 -|This function is used for acknowledging a command. - -|Nack -|$7F -|This function is used for negative acknowledgment of a command. - -|Flash Read -|$E0 -|This function is used for reading 256 bytes of data from the flash storage partition of the modem. (Only on supported hardware.) - -|Flash Write -|$E1 -|This function is used for writing 256 bytes of data to the flash storage partition of the modem. (Only on supported hardware.) - -|Reboot MCU -|$EA -|This function is used for triggering a reboot of the modem MCU. - -|Debug 1 -|$F1 -|This function is used for receiving debug data from the modem. (1 byte) - -|Debug 2 -|$F2 -|This function is used for receiving debug data from the modem. (2 byte) - -|Debug 3 -|$F3 -|This function is used for receiving debug data from the modem. (3 byte) - -|Debug 4 -|$F4 -|This function is used for receiving debug data from the modem. (4 byte) - -|Debug 5 -|$F5 -|This function is used for receiving debug data from the modem. (5 byte) - -|=== - -==== 2.3.2 Modem Operational States -The operational state defines which mode/state the modem is currently in. - -[cols="2,1,3"] -|=== -|State Name |State |Description - -|IDLE -|0 -|This is the default state for a modem, the modem is not in any active mode in this state. - -|DMR -|1 -|When in this mode the modem is actively Rx/Tx DMR protocol data. - -|Project 25 -|2 -|When in this mode the modem is actively Rx/Tx Project 25 protocol data. - -|NXDN -|3 -|When in this mode the modem is actively Rx/Tx NXDN protocol data. - -|CW -|10 -|When in this mode the modem is actively Tx CWID morse data. - -|Project 25 Calibration 1K -|92 -| - -|DMR DMO Calibration 1K -|93 -| - -|DMR Calibration 1K -|94 -| - -|DMR Low Frequency Calibration -|95 -| - -|RSSI Calibration -|96 -| - -|Project 25 Calibration -|97 -| - -|DMR Calibration -|98 -| - -|NXDN Calibration -|99 -| -|=== - -==== 2.3.3 Negative Acknowledgement Reasons -This table defines the reasons a negative acknowledgement may be sent. - -[cols="2,1,3"] -|=== -|Reason Name |Reason Code |Description - -|OK -|0 -| - -|NAK -|1 -|General Failure. - -|Illegal Length -|2 -|Packet received was of an illegal length, and was discarded by the modem. - -|Invalid Request -|4 -|Packet received was an invalid request, and was discarded by the modem. - -|Ringbuffer Full -|8 -|Sent when a command attempts to write to a FIFO buffer that is full. - -|Invalid FDMA Preamble -|10 -|Sent by the Set Configuration command typically, to indicate the FDMA preamble value was out of range. - -|Invalid Mode -|11 -|Sent by either Set Configuration or Set Mode command to indicate a mode was specified that is invalid. - -|Invalid DMR Color Code -|12 -|Sent by the Set Configuration command typically, if the DMR color code is out of range. - -|Invalid DMR Slot -|13 -|Sent by the modem to indicate the DMR slot value was out of range. - -|Invalid DMR Start -|14 -| - -|Invalid DMR Rx Delay -|15 -|Sent by the modem to indicate the DMR Rx Delay value was out of range. - -|Invalid P25 Correlation Count -|16 -|Sent by the modem to indicate the P25 Correlation Count value was out of range. - -|No Internal Flash -|20 -|Sent by the modem when the hardware does not support the Flash Read or Flash Write operations. - -|Flash Erase Failed -|21 -|Sent by the modem when the configuration partition of the flash was unable to be erased. - -|Flash Write Failed -|22 -|Sent by the modem when the configuration partition of the flash was unable to be written. - -|Flash Write Too Big -|23 -|Sent by the modem when the data sent to be written to the configuration partition of the flash was too large to be written. - -|DMR Disabled -|63 -|Sent by the modem to indicate DMR operations are disabled. - -|P25 Disabled -|64 -|Sent by the modem to indicate P25 operations are disabled. - -|NXDN Disabled -|65 -|Sent by the modem to indicate NXDN operations are disabled. - -|=== - -=== 2.4 General Opcode Specifications - -==== 2.4.1 Get Version -This opcode is utilized to retreive the hardcoded (at compile time) version string from the firmware. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Get Version Opcode -|1 -| -|=== - -Upon reception, the modem shall transmit in response: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Get Version Opcode -|1 -|$00 - -|Protocol Version -|1 -| - -|CPU Type -|1 -| - -|CPU UDID -|16 -|Universal Device Identifier - -|Baked Firmware Version String -|83 -| -|=== - -==== 2.4.2 Get Status -This opcode is utilized to retreive the various interesting operational runtime values from the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Get Status Opcode -|1 -|$01 -|=== - -Upon reception, the modem shall transmit in response: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Get Status Opcode -|1 -|$01 - -|Protocol Enablement Flags -|1 -|This byte contains flags that indicate which digital protocol is enabled on the modem. - -|Modem State -|1 -|Current operational state. - -|Operation Flags -|1 -|This byte contains various operation flags. - -|Reserved -|1 -| - -|DMR Slot 1 FIFO Space -|1 -|This byte contains the FIFO space available in DMR frames. - -|DMR Slot 2 FIFO Space -|1 -|This byte contains the FIFO space available in DMR frames. - -|Reserved -|1 -| - -|Project 25 FIFO Space -|1 -|This byte contains the FIFO space available in P25 LDU frames. - -|NXDN FIFO Space -|1 -|This byte contains the FIFO space available in NXDN frames. - -|=== - -==== 2.4.3 Set Configuration -This opcode is utilized to set the general configuration of the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|24 -|Length - -|Set Configuration Opcode -|1 -|$02 - -|Flags 1 Byte -|1 -|This flags byte represents various states (see below). - -|Flags 2 Byte -|1 -|This flags byte represents various states (see below). - -|FDMA Preamble Length -|1 -| - -|Initial Mode -|1 -|This sets the initial mode of the modem, the mode can be changed with Set Mode at any time. - -|Rx Level -|1 -| - -|CW ID Tx Level -|1 -| - -|DMR Color Code -|1 -| - -|DMR Rx Delay -|1 -| - -|P25 NAC -|2 -| - -|DMR Tx Level -|1 -| - -|P25 Correlation Count -|1 -| - -|P25 Tx Level -|1 -| - -|Tx DC Offset -|1 -| - -|Rx DC Offset -|1 -| - -|NXDN Tx Level -|1 -| - -|Rx Coarse Softpot Setting -|1 -|This currently only applies to DVMV1 modems. - -|Rx Fine Softpot Setting -|1 -|This currently only applies to DVMV1 modems. - -|Tx Coarse Softpot Setting -|1 -|This currently only applies to DVMV1 modems. - -|Tx Fine Softpot Setting -|1 -|This currently only applies to DVMV1 modems. - -|RSSI Coarse Softpot Setting -|1 -|This currently only applies to DVMV1 modems. - -|RSSI Fine Softpot Setting -|1 -|This currently only applies to DVMV1 modems. -|=== - -[discrete] -==== Flags 1 Byte -[cols="2,1,2"] -|=== -|Name |Flag Bit |Description - -|Rx Invert -|$01 -| - -|Tx Invert -|$02 -| - -|PTT Invert -|$04 -| - -|Modem Debug -|$10 -| - -|Simplex Operation -|$80 -| -|=== - -[discrete] -==== Flags 2 Byte -[cols="2,1,2"] -|=== -|Name |Flag Bit |Description - -|DC Blocker -|$01 -| - -|COS Lockout -|$04 -| - -|DMR Enabled -|$02 -| - -|P25 Enabled -|$08 -| - -|NXDN Enabled -|$10 -| -|=== - -Upon reception, the modem shall perform whatever operations necessary to transition to the requested mode and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. -* Respond with a NACK and the "Invalid FDMA Preamble" if the FDMA preamble parameter is out of range. -* Respond with a NACK and the "Invalid DMR Color Code" if the DMR color code is out of range. -* Respond with a NACK and the "Invalid DMR Rx Delay" if the DMR receive delay is out of range. -* Respond with a NACK and the "Invalid P25 Correlation Count" if the P25 correlation count is out of range. - -==== 2.4.4 Set Mode -This opcode is utilized to set the operational mode of the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|4 -|Length - -|Set Mode Opcode -|1 -|$03 - -|Operational Mode -|1 -|$00 -|=== - -Upon reception, the modem shall perform whatever operations necessary to transition to the requested mode and transmit a ACK or NACK in response. - -==== 2.4.5 Set Symbol Level Adjustment -This opcode is utilized to set the symbol level adjustments on the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|9 -|Length - -|Set Symbol Level Adjustment Opcode -|1 -|$04 - -|DMR +3/-3 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|DMR +1/-1 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|P25 +3/-3 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|P25 +1/-1 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|NXDN +3/-3 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|NXDN +1/-1 Symbol Level Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. -|=== - -Upon reception, the modem shall perform whatever operations necessary to set the Rx level and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. -* Respond with a NACK and the "Invalid Request" if parameters are out of range. - -==== 2.4.6 Set Rx Level Adjustment -This opcode is utilized to set the Rx level on the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|4 -|Length - -|Set Rx Level Opcode -|1 -|$05 - -|Rx Level -|1 -| -|=== - -Upon reception, the modem shall perform whatever operations necessary to set the Rx level and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. - -==== 2.4.7 Set RF Parameters (Hotspot Only) -This opcode is utilized to set the RF parameters for a hotspot modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|18 or 22 -|Length of 18 does not set AFC parameters, length of 22 sets AFC parameters. - -|Set RF Parameters Opcode -|1 -|$06 - -|Rx Frequency (in Hz) -|4 -| - -|Tx Frequency (in Hz) -|4 -| - -|Tx Power (value from 0 to 255) -|1 -| - -|DMR Discriminator Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|P25 Discriminator Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|DMR Post Demodulation Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|P25 Post Demodulation Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|AFC Gain Mode -|1 -|This represents the AFC gain mode: 0 = Auto, 1 = Auto (Linear), 2 = Low, 3 = High. - -|NXDN Discriminator Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|NXDN Post Demodulation Bandwidth Adjustment -|1 -|This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. - -|AFC Enable, KI and KP -|1 -|This value represents whether or not AFC is enabled ($80 bit), the AFC KI (lower 4 bits), the AFC KP (upper 4 bits). - -|AFC Range -|1 -| - -|=== - -Upon reception, the modem shall perform whatever operations necessary to set the RF parameters and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. -* Respond with a NACK and the "Invalid Request" if parameters are out of range. - -==== 2.4.8 Calibration Data -*TODO TODO TODO* - -==== 2.4.9 RSSI Data -*TODO TODO TODO* - -==== 2.4.10 Send CWID -This opcode is utilized to transmit a CW ID morse message from the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|4 or More -|Length, the length is typically 3 + the length of the CWID to send. - -|Send CWID Opcode -|1 -|$0A - -|... -|... -|... - -|CWID Letters -|1 -| - -|... -|... -|... -|=== - -Upon reception, the modem shall perform whatever operations necessary to transmit a CWID with the given letters and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. - -==== 2.4.11 Set FIFO Buffers -This opcode is utilized to set the size of the FIFO buffers on the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|6 -|Length - -|Set FIFO Buffers Opcode -|1 -|$0F - -|DMR Buffer Size -|2 -|This is a unsigned 16-bit value representing the FIFO buffer size. - -|P25 Buffer Size -|2 -|This is a unsigned 16-bit value representing the FIFO buffer size. - -|NXDN Buffer Size -|2 -|This is a unsigned 16-bit value representing the FIFO buffer size. -|=== - -Upon reception, the modem shall perform whatever operations necessary to resize the FIFO buffers and transmit a ACK or NACK in response. - -If the operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. -* Respond with a NACK and the "Invalid Mode" if buffers are attempted to be resized while not in an IDLE state. - -==== 2.4.12 Acknowledgement -This opcode is utilized by the modem to notify the host of a positive acknowledgement of a command. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|4 -|Length - -|Ack Opcode -|1 -|$70 - -|Opcode Being Acknowledged -|1 -|$00 -|=== - -==== 2.4.13 Negative Acknowledgement -This opcode is utilized by the modem to notify the host of a negative acknowledgement of a command. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|5 -|Length - -|Nack Opcode -|1 -|$7F - -|Opcode Being Acknowledged -|1 -|$00 - -|NACK Reason Code -|1 -|$00 -|=== - -==== 2.4.14 Flash Read -This opcode is utilized to read data from the modem's configuration partition on the flash. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Flash Read Opcode -|1 -|$E0 -|=== - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|249 -|Length - -|Flash Read Opcode -|1 -|$E0 - -|Variable Length Data -|249 -|... -|=== - -==== 2.4.15 Flash Write -This opcode is utilized to write data from the modem's configuration partition on the flash. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|254 -|Length - -|Flash Write Opcode -|1 -|$E1 - -|Flash Data -| -|... -|=== - -Upon reception, the modem shall perform whatever operations necessary to write data to the flash and transmit a ACK or NACK in response. - -If the flash operation fails the modem shall: - -* Respond with a NACK and the "Flash Write Too Big" if more then 254 bytes are attempted to be written. -* Respond with a NACK and the "Flash Write Failed" if a write error occurs. - -==== 2.4.16 Reset MCU -This opcode is utilized to reboot the MCU of the modem. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|Reset MCU Opcode -|1 -|$EA -|=== - -Upon reception of this opcode the modem should immediately issue a MCU restart. No response back from the modem shall be expected. - -=== 2.5 DMR Opcode Specifications - -==== 2.5.1 Slot 1 Data -This opcode is utilized by both the host and modem to transmit DMR Slot 1 frame data. - -The host or modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|36 -|Length - -|DMR Slot 1 Data Opcode -|1 -|$18 - -|... -|... -|... - -|Frame Data -| -| - -|... -|... -|... -|=== - -Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. - -If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. - -If the write data operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if the frame data is not the standard DMR frame length 33 bytes. -* Respond with a NACK and the "Ringbuffer Full" if the DMR FIFO buffer is full. - -==== 2.5.2 Slot 1 Lost -This opcode is utilized to notify the host the current transmission synchronization was lost. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|DMR Sot 1 Lost Opcode -|1 -|$19 -|=== - -Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. - -==== 2.5.3 Slot 2 Data -This opcode is utilized by both the host and modem to transmit DMR Slot 2 or DMR DMO frame data. - -The host or modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|36 -|Length - -|DMR Slot 2 Data Opcode -|1 -|$1A - -|... -|... -|... - -|Frame Data -| -| - -|... -|... -|... -|=== - -Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. - -If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. - -If the write data operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if the frame data is not the standard DMR frame length 33 bytes. -* Respond with a NACK and the "Ringbuffer Full" if the DMR FIFO buffer is full. - -==== 2.5.4 Slot 2 Lost -This opcode is utilized to notify the host the current transmission synchronization was lost. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|DMR Sot 1 Lost Opcode -|1 -|$1B -|=== - -Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. - -==== 2.5.5 Short LC -*TODO TODO TODO* - -==== 2.5.6 Start -*TODO TODO TODO* - -==== 2.5.7 Abort -*TODO TODO TODO* - -==== 2.5.8 CACH AT Control -This opcode is utilized to set the CACH AT bit for the specified slot. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|4 -|Length - -|DMR CACH AT Control Opcode -|1 -|$1F - -|DMR Slot -|1 -|DMR Slot to set the CACH AT bit for. -|=== - -Upon reception, the modem shall perform whatever operations necessary to set the CACH AT bit for the specified slot. - -==== 2.5.9 Slot 1 Clear -This opcode is utilized to clear the FIFO buffer for DMR Slot 1. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|DMR Slot 2 Clear Opcode -|1 -|$20 -|=== - -Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. - -==== 2.5.10 Slot 2 Clear -This opcode is utilized to clear the FIFO buffer for DMR Slot 2. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|DMR Slot 2 Clear Opcode -|1 -|$21 -|=== - -Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. - -=== 2.6 P25 Opcode Specifications - -==== 2.6.1 Data -This opcode is utilized by both the host and modem to transmit P25 frame data. - -The host or modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|21 or greater -|Length, P25 data frames are variable length, the minimum data frame is a TDU data frame which has a modem packet length of 21 bytes. - -|P25 Data Opcode -|1 -|$31 - -|... -|... -|... - -|Frame Data -| -| - -|... -|... -|... -|=== - -Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. - -If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. - -If the write data operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if the frame data is less then a standard P25 TDU frame length 18 bytes. -* Respond with a NACK and the "Ringbuffer Full" if the P25 FIFO buffer is full. - -==== 2.6.2 Lost -This opcode is utilized to notify the host the current transmission synchronization was lost. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|P25 Lost Opcode -|1 -|$32 -|=== - -Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. - -==== 2.6.3 Clear -This opcode is utilized to clear the FIFO buffer for P25. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|P25 Clear Opcode -|1 -|$33 -|=== - -Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. - -=== 2.7 NXDN Opcode Specifications - -==== 2.7.1 Data -This opcode is utilized by both the host and modem to transmit NXDN frame data. - -The host or modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|51 -|Length - -|NXDN Data Opcode -|1 -|$41 - -|... -|... -|... - -|Frame Data -| -| - -|... -|... -|... -|=== - -Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. - -If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. - -If the write data operation fails the modem shall: - -* Respond with a NACK and the "Illegal Length" if the frame data is not the standard NXDN frame length 48 bytes. -* Respond with a NACK and the "Ringbuffer Full" if the NXDN FIFO buffer is full. - -==== 2.7.2 Lost -This opcode is utilized to notify the host the current transmission synchronization was lost. - -The modem shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|NXDN Lost Opcode -|1 -|$42 -|=== - -Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. - -==== 2.7.3 Clear -This opcode is utilized to clear the FIFO buffer for NXDN. - -The host shall transmit: -[cols="2,1,2"] -|=== -|Name |Length (bytes) |Description - -|Short Frame Start -|1 -|Short Frame Start - -|Length -|3 -|Length - -|NXDN Clear Opcode -|1 -|$43 -|=== - -Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. diff --git a/docs/TN.1001 - Modem Protocol.md b/docs/TN.1001 - Modem Protocol.md new file mode 100644 index 00000000..9d448c66 --- /dev/null +++ b/docs/TN.1001 - Modem Protocol.md @@ -0,0 +1,753 @@ +# Digital Voice Modem + +## Technical Note +### Modem Protocol + +Document Identifier: TN.1001 + +Author: Bryan Biedenkapp, N2PLL + +Editors: Bryan Biedenkapp, N2PLL + +Contributors: N/A + +Abstract: Describes high-level concepts and procedures for the Modem Protocol. + +Status: Draft + +## 1. Introduction +This document describes, in high-level, the general concepts and procedures for the Modem Protocol used by DVM projects. + +## 2. Technical Note + +### 2.1 Definitions +- DVM: Digital Voice Modem + +### 2.2 General Concept +The DVM Modem Protocol defines a common and standard communications protocol between a host application and a dedicated modem hardware device (usually based around a STM32F446 or similar). + +The core purpose of the protocol is to provide a common serial communications between the host application and the dedicated modem hardware. + +### 2.3 Modem Packet Framing +The modem protocol implements a very simplistic framing mechanism for transmitting data between the host and modem (and vice versa). + +| Frame Type | Opcode | Description | +| --- | --- | --- | +| Short | $FE | This frame type uses a one-byte total-length field and therefore carries frames up to 255 bytes, including the three-byte frame header. | +| Long | $FD | This frame type uses a two-byte big-endian total-length field for frames that do not fit the short form. | + +#### Modem Packet - Short Frame +```text + Byte 0 1 2 3 + Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Frame Type | Length | Opcode | ... | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 3-byte header (frame type, total length, and opcode) +``` + +#### Modem Packet - Long Frame +```text + Byte 0 1 2 3 + Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Frame Type | Length | Opcode | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 4-byte header (frame type, two-byte total length, and opcode) +``` + +It is important to note the Length parameter of the packet buffer should be the length of the **entire** packet not just the payload. + +#### 2.3.1 Modem Opcodes +The opcode defines which operation/command being transmitted. + +| Function Name | Opcode | Description | +| --- | --- | --- | +| Get Version | $00 | This function is used for retrieving the firmware version from the modem. | +| Get Status | $01 | This function is used for retrieving the current status from the modem. | +| Set Configuration | $02 | This function is used for setting configuration parameters to the modem. | +| Set Mode | $03 | This function is used for setting the operational mode parameter to the modem. | +| Set Symbol Level Adjustment | $04 | This function is used for setting the symbol level adjustment parameters to the modem. | +| Set Rx Level Adjustment | $05 | This function is used for setting the receive level adjustment parameter to the modem. | +| Set RF Parameters | $06 | This function is used for setting the RF parameters to the modem. (Hotspot Only) | +| Calibration Data | $08 | This function is used for setting calibration data to the modem when operating in a calibration mode. | +| RSSI Data | $09 | This function is used for receiving RSSI data from the modem. | +| Send CW ID | $0A | This function is used to cause the modem to emit a CWID burst of morse code. | +| Set FIFO Buffers | $0F | This function is used for setting the internal FIFO ringbuffer sizes on the modem. | +| DMR Slot 1 Data | $18 | This function is used for sending/receiving DMR Slot 1 protocol data to/from the modem. | +| DMR Slot 1 Lost | $19 | This function is used for signalling loss of synchronization for DMR Slot 1 protocol data. | +| DMR Slot 2 Data | $1A | This function is used for sending/receiving DMR Slot 2 protocol data to/from the modem. | +| DMR Slot 2 Lost | $1B | This function is used for signalling loss of synchronization for DMR Slot 2 protocol data. | +| DMR Short LC | $1C | This function is used for sending/receiving DMR Short LC protocol data to/from the modem. | +| DMR Start | $1D | This function is used for providing transmitter control and starting the DMR data stream. | +| DMR Abort | $1E | | +| DMR CACH AT Control | $1F | This function is used for setting the DMR CACH AT bit on or off. | +| DMR Slot 1 Clear | $20 | This function is used for commanding the modem to clear the DMR Slot 1 FIFO buffers. | +| DMR Slot 2 Clear | $21 | This function is used for commanding the modem to clear the DMR Slot 2 FIFO buffers. | +| Project 25 Data | $31 | This function is used for sending/receiving Project 25 protocol data to/from the modem. | +| Project 25 Lost | $32 | This function is used for signalling loss of synchronization for Project 25 protocol data. | +| Project 25 Clear | $33 | This function is used for commanding the modem to clear the Project 25 FIFO buffers. | +| Project 25 Phase 2 Slot 1 Data | $34 | This host-side function is used for sending/receiving Project 25 Phase 2 Slot 1 protocol data. It is not implemented by the current air-interface modem firmware. | +| Project 25 Phase 2 Slot 1 Lost | $35 | This host-side function signals loss of synchronization for Project 25 Phase 2 Slot 1 data. | +| Project 25 Phase 2 Slot 2 Data | $36 | This host-side function is used for sending/receiving Project 25 Phase 2 Slot 2 protocol data. It is not implemented by the current air-interface modem firmware. | +| Project 25 Phase 2 Slot 2 Lost | $37 | This host-side function signals loss of synchronization for Project 25 Phase 2 Slot 2 data. | +| Project 25 Phase 2 Slot 1 Clear | $38 | This host-side function clears the Project 25 Phase 2 Slot 1 FIFO. | +| Project 25 Phase 2 Slot 2 Clear | $39 | This host-side function clears the Project 25 Phase 2 Slot 2 FIFO. | +| NXDN Data | $41 | This function is used for sending/receiving NXDN protocol data to/from the modem. | +| NXDN Lost | $42 | This function is used for signalling loss of synchronization for NXDN protocol data. | +| NXDN Clear | $43 | This function is used for commanding the modem to clear the NXDN FIFO buffers. | +| Ack | $70 | This function is used for acknowledging a command. | +| Nack | $7F | This function is used for negative acknowledgment of a command. | +| Flash Read | $E0 | This function is used for reading 256 bytes of data from the flash storage partition of the modem. (Only on supported hardware.) | +| Flash Write | $E1 | This function is used for writing 256 bytes of data to the flash storage partition of the modem. (Only on supported hardware.) | +| Reboot MCU | $EA | This function is used for triggering a reboot of the modem MCU. | +| Debug 1 | $F1 | This function is used for receiving debug data from the modem. (1 byte) | +| Debug 2 | $F2 | This function is used for receiving debug data from the modem. (2 byte) | +| Debug 3 | $F3 | This function is used for receiving debug data from the modem. (3 byte) | +| Debug 4 | $F4 | This function is used for receiving debug data from the modem. (4 byte) | +| Debug 5 | $F5 | This function is used for receiving debug data from the modem. (5 byte) | +| Debug Dump | $FA | This function is used for receiving a variable-length debug byte dump from the modem. | + +#### 2.3.2 Modem Operational States +The operational state defines which mode/state the modem is currently in. + +| State Name | State | Description | +| --- | --- | --- | +| IDLE | 0 | This is the default state for a modem, the modem is not in any active mode in this state. | +| DMR | 1 | When in this mode the modem is actively Rx/Tx DMR protocol data. | +| Project 25 | 2 | When in this mode the modem is actively Rx/Tx Project 25 protocol data. | +| NXDN | 3 | When in this mode the modem is actively Rx/Tx NXDN protocol data. | +| CW | 10 | When in this mode the modem is actively Tx CWID morse data. | +| Project 25 Calibration 1K | 92 | | +| DMR DMO Calibration 1K | 93 | | +| DMR Calibration 1K | 94 | | +| DMR Low Frequency Calibration | 95 | | +| RSSI Calibration | 96 | | +| Project 25 Calibration | 97 | | +| DMR Calibration | 98 | | +| NXDN Calibration | 99 | | + +#### 2.3.3 Negative Acknowledgement Reasons +This table defines the reasons a negative acknowledgement may be sent. + +| Reason Name | Reason Code | Description | +| --- | --- | --- | +| OK | 0 | | +| NAK | 1 | General Failure. | +| Illegal Length | 2 | Packet received was of an illegal length, and was discarded by the modem. | +| Invalid Request | 4 | Packet received was an invalid request, and was discarded by the modem. | +| Ringbuffer Full | 8 | Sent when a command attempts to write to a FIFO buffer that is full. | +| Invalid FDMA Preamble | 10 | Sent by the Set Configuration command typically, to indicate the FDMA preamble value was out of range. | +| Invalid Mode | 11 | Sent by either Set Configuration or Set Mode command to indicate a mode was specified that is invalid. | +| Invalid DMR Color Code | 12 | Sent by the Set Configuration command typically, if the DMR color code is out of range. | +| Invalid DMR Slot | 13 | Sent by the modem to indicate the DMR slot value was out of range. | +| Invalid DMR Start | 14 | | +| Invalid DMR Rx Delay | 15 | Sent by the modem to indicate the DMR Rx Delay value was out of range. | +| Invalid P25 Correlation Count | 16 | Sent by the modem to indicate the P25 Correlation Count value was out of range. | +| No Internal Flash | 20 | Sent by the modem when the hardware does not support the Flash Read or Flash Write operations. | +| Flash Erase Failed | 21 | Sent by the modem when the configuration partition of the flash was unable to be erased. | +| Flash Write Failed | 22 | Sent by the modem when the configuration partition of the flash was unable to be written. | +| Flash Write Too Big | 23 | Sent by the modem when the data sent to be written to the configuration partition of the flash was too large to be written. | +| DMR Disabled | 63 | Sent by the modem to indicate DMR operations are disabled. | +| P25 Disabled | 64 | Sent by the modem to indicate P25 operations are disabled. | +| NXDN Disabled | 65 | Sent by the modem to indicate NXDN operations are disabled. | + +### 2.4 General Opcode Specifications + +#### 2.4.1 Get Version +This opcode is utilized to retreive the hardcoded (at compile time) version string from the firmware. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Get Version Opcode | 1 | | + +Upon reception, the modem shall transmit in response: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Get Version Opcode | 1 | $00 | +| Protocol Version | 1 | | +| CPU Type | 1 | | +| CPU UDID | 16 | Universal Device Identifier | +| Baked Firmware Version String | 83 | | + +#### 2.4.2 Get Status +This opcode is utilized to retreive the various interesting operational runtime values from the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Get Status Opcode | 1 | $01 | + +Upon reception, the modem shall transmit in response: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Get Status Opcode | 1 | $01 | +| Protocol Enablement Flags | 1 | This byte contains flags that indicate which digital protocol is enabled on the modem. | +| Modem State | 1 | Current operational state. | +| Operation Flags | 1 | This byte contains various operation flags. | +| Reserved | 1 | | +| DMR Slot 1 FIFO Space | 1 | This byte contains the FIFO space available in DMR frames. | +| DMR Slot 2 FIFO Space | 1 | This byte contains the FIFO space available in DMR frames. | +| Reserved | 1 | | +| Project 25 FIFO Space | 1 | This byte contains the FIFO space available in P25 LDU frames. | +| NXDN FIFO Space | 1 | This byte contains the FIFO space available in NXDN frames. | + +#### 2.4.3 Set Configuration +This opcode is utilized to set the general configuration of the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 24 | Length | +| Set Configuration Opcode | 1 | $02 | +| Flags 1 Byte | 1 | This flags byte represents various states (see below). | +| Flags 2 Byte | 1 | This flags byte represents various states (see below). | +| FDMA Preamble Length | 1 | | +| Initial Mode | 1 | This sets the initial mode of the modem, the mode can be changed with Set Mode at any time. | +| Rx Level | 1 | | +| CW ID Tx Level | 1 | | +| DMR Color Code | 1 | | +| DMR Rx Delay | 1 | | +| P25 NAC | 2 | | +| DMR Tx Level | 1 | | +| P25 Correlation Count | 1 | | +| P25 Tx Level | 1 | | +| Tx DC Offset | 1 | | +| Rx DC Offset | 1 | | +| NXDN Tx Level | 1 | | +| Rx Coarse Softpot Setting | 1 | This currently only applies to DVMV1 modems. | +| Rx Fine Softpot Setting | 1 | This currently only applies to DVMV1 modems. | +| Tx Coarse Softpot Setting | 1 | This currently only applies to DVMV1 modems. | +| Tx Fine Softpot Setting | 1 | This currently only applies to DVMV1 modems. | +| RSSI Coarse Softpot Setting | 1 | This currently only applies to DVMV1 modems. | +| RSSI Fine Softpot Setting | 1 | This currently only applies to DVMV1 modems. | + +#### Flags 1 Byte +| Name | Flag Bit | Description | +| --- | --- | --- | +| Rx Invert | $01 | | +| Tx Invert | $02 | | +| PTT Invert | $04 | | +| Modem Debug | $10 | | +| Simplex Operation | $80 | | + +#### Flags 2 Byte +| Name | Flag Bit | Description | +| --- | --- | --- | +| DC Blocker | $01 | | +| COS Lockout | $04 | | +| DMR Enabled | $02 | | +| P25 Enabled | $08 | | +| NXDN Enabled | $10 | | + +Upon reception, the modem shall perform whatever operations necessary to transition to the requested mode and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. +- Respond with a NACK and the "Invalid FDMA Preamble" if the FDMA preamble parameter is out of range. +- Respond with a NACK and the "Invalid DMR Color Code" if the DMR color code is out of range. +- Respond with a NACK and the "Invalid DMR Rx Delay" if the DMR receive delay is out of range. +- Respond with a NACK and the "Invalid P25 Correlation Count" if the P25 correlation count is out of range. + +#### 2.4.4 Set Mode +This opcode is utilized to set the operational mode of the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 4 | Length | +| Set Mode Opcode | 1 | $03 | +| Operational Mode | 1 | $00 | + +Upon reception, the modem shall perform whatever operations necessary to transition to the requested mode and transmit a ACK or NACK in response. + +#### 2.4.5 Set Symbol Level Adjustment +This opcode is utilized to set the symbol level adjustments on the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 9 | Length | +| Set Symbol Level Adjustment Opcode | 1 | $04 | +| DMR +3/-3 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| DMR +1/-1 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| P25 +3/-3 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| P25 +1/-1 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| NXDN +3/-3 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| NXDN +1/-1 Symbol Level Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | + +Upon reception, the modem shall perform whatever operations necessary to set the Rx level and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. +- Respond with a NACK and the "Invalid Request" if parameters are out of range. + +#### 2.4.6 Set Rx Level Adjustment +This opcode is utilized to set the Rx level on the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 4 | Length | +| Set Rx Level Opcode | 1 | $05 | +| Rx Level | 1 | | + +Upon reception, the modem shall perform whatever operations necessary to set the Rx level and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. + +#### 2.4.7 Set RF Parameters (Hotspot Only) +This opcode is utilized to set the RF parameters for a hotspot modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 18 or 22 | Length of 18 does not set AFC parameters, length of 22 sets AFC parameters. | +| Set RF Parameters Opcode | 1 | $06 | +| Rx Frequency (in Hz) | 4 | | +| Tx Frequency (in Hz) | 4 | | +| Tx Power (value from 0 to 255) | 1 | | +| DMR Discriminator Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| P25 Discriminator Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| DMR Post Demodulation Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| P25 Post Demodulation Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| AFC Gain Mode | 1 | This represents the AFC gain mode: 0 = Auto, 1 = Auto (Linear), 2 = Low, 3 = High. | +| NXDN Discriminator Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| NXDN Post Demodulation Bandwidth Adjustment | 1 | This is a unsigned value of 0 to 255 representing an adjustment of -128 to 128. | +| AFC Enable, KI and KP | 1 | This value represents whether or not AFC is enabled ($80 bit), the AFC KI (lower 4 bits), the AFC KP (upper 4 bits). | +| AFC Range | 1 | | + +Upon reception, the modem shall perform whatever operations necessary to set the RF parameters and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. +- Respond with a NACK and the "Invalid Request" if parameters are out of range. + +#### 2.4.8 Calibration Data +This opcode is bidirectional. The host uses it to start or stop transmission of the test pattern selected by the modem's current calibration state. A modem may also use it to report sampled calibration levels to the host. + +The host shall transmit: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `4`, including the complete frame | +| Calibration Data Opcode | 1 | `$08` | +| Transmit | 1 | `1` starts the selected calibration transmission; any other value stops it | + +The command is valid only while the modem is in a DMR, P25, or NXDN calibration state. The selected calibration implementation requires exactly one payload byte. The modem responds with ACK when the command is accepted. It responds with NAK and `Illegal Length` when the payload length is not one byte or the command cannot be handled by the current calibration state. + +The standard level-report payload consumed by the setup host is: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `8`, including the complete frame | +| Calibration Data Opcode | 1 | `$08` | +| Inverted | 1 | `0x80` indicates an inverted signal; other values indicate non-inverted | +| Maximum Sample | 2 | Unsigned 16-bit maximum sample, most-significant byte first | +| Minimum Sample | 2 | Unsigned 16-bit minimum sample, most-significant byte first | + +The host derives the peak-to-peak difference as `maximum - minimum` and the center value as `(maximum + minimum) / 2`. Calibration telemetry is informational and is not acknowledged by the host. + +#### 2.4.9 RSSI Data +This modem-to-host opcode reports received signal-strength samples while the modem is in the RSSI calibration state (`STATE_RSSI_CAL`). It is telemetry rather than a request and is not acknowledged by the host. + +The modem shall transmit: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `9`, including the complete frame | +| RSSI Data Opcode | 1 | `$09` | +| Maximum RSSI Sample | 2 | Unsigned 16-bit maximum sample, most-significant byte first | +| Minimum RSSI Sample | 2 | Unsigned 16-bit minimum sample, most-significant byte first | +| Average RSSI Sample | 2 | Unsigned 16-bit arithmetic mean, most-significant byte first | + +The air-interface firmware accumulates 24,000 samples per report. Hotspot firmware samples the hardware RSSI value periodically and reports the maximum, minimum, and average after six readings. The values are raw modem samples; conversion to calibrated power units is hardware-specific. + +The firmware suppresses this frame outside RSSI calibration mode. Its serial helper rejects a payload that would exceed the implementation's short-frame buffer with NAK and `Illegal Length`; the standard payload is always six bytes. + +#### 2.4.10 Send CWID +This opcode is utilized to transmit a CW ID morse message from the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 4 or More | Length, the length is typically 3 + the length of the CWID to send. | +| Send CWID Opcode | 1 | $0A | +| ... | ... | ... | +| CWID Letters | 1 | | +| ... | ... | ... | + +Upon reception, the modem shall perform whatever operations necessary to transmit a CWID with the given letters and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. + +#### 2.4.11 Set FIFO Buffers +This opcode is utilized to set the size of the FIFO buffers on the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 6 | Length | +| Set FIFO Buffers Opcode | 1 | $0F | +| DMR Buffer Size | 2 | This is a unsigned 16-bit value representing the FIFO buffer size. | +| P25 Buffer Size | 2 | This is a unsigned 16-bit value representing the FIFO buffer size. | +| NXDN Buffer Size | 2 | This is a unsigned 16-bit value representing the FIFO buffer size. | + +Upon reception, the modem shall perform whatever operations necessary to resize the FIFO buffers and transmit a ACK or NACK in response. + +If the operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if packet from the host is improperly sized. +- Respond with a NACK and the "Invalid Mode" if buffers are attempted to be resized while not in an IDLE state. + +#### 2.4.12 Acknowledgement +This opcode is utilized by the modem to notify the host of a positive acknowledgement of a command. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 4 | Length | +| Ack Opcode | 1 | $70 | +| Opcode Being Acknowledged | 1 | $00 | + +#### 2.4.13 Negative Acknowledgement +This opcode is utilized by the modem to notify the host of a negative acknowledgement of a command. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 5 | Length | +| Nack Opcode | 1 | $7F | +| Opcode Being Acknowledged | 1 | $00 | +| NACK Reason Code | 1 | $00 | + +#### 2.4.14 Flash Read +This opcode is utilized to read data from the modem's configuration partition on the flash. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Flash Read Opcode | 1 | $E0 | + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 249 | Length | +| Flash Read Opcode | 1 | $E0 | +| Variable Length Data | 249 | ... | + +#### 2.4.15 Flash Write +This opcode is utilized to write data from the modem's configuration partition on the flash. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 254 | Length | +| Flash Write Opcode | 1 | $E1 | +| Flash Data | | ... | + +Upon reception, the modem shall perform whatever operations necessary to write data to the flash and transmit a ACK or NACK in response. + +If the flash operation fails the modem shall: + +- Respond with a NACK and the "Flash Write Too Big" if more then 254 bytes are attempted to be written. +- Respond with a NACK and the "Flash Write Failed" if a write error occurs. + +#### 2.4.16 Reset MCU +This opcode is utilized to reboot the MCU of the modem. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| Reset MCU Opcode | 1 | $EA | + +Upon reception of this opcode the modem should immediately issue a MCU restart. No response back from the modem shall be expected. + +### 2.5 DMR Opcode Specifications + +#### 2.5.1 Slot 1 Data +This opcode is utilized by both the host and modem to transmit DMR Slot 1 frame data. + +The host or modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 36 | Length | +| DMR Slot 1 Data Opcode | 1 | $18 | +| ... | ... | ... | +| Frame Data | | | +| ... | ... | ... | + +Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. + +If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. + +If the write data operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if the frame data is not the standard DMR frame length 33 bytes. +- Respond with a NACK and the "Ringbuffer Full" if the DMR FIFO buffer is full. + +#### 2.5.2 Slot 1 Lost +This opcode is utilized to notify the host the current transmission synchronization was lost. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| DMR Sot 1 Lost Opcode | 1 | $19 | + +Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. + +#### 2.5.3 Slot 2 Data +This opcode is utilized by both the host and modem to transmit DMR Slot 2 or DMR DMO frame data. + +The host or modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 36 | Length | +| DMR Slot 2 Data Opcode | 1 | $1A | +| ... | ... | ... | +| Frame Data | | | +| ... | ... | ... | + +Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. + +If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. + +If the write data operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if the frame data is not the standard DMR frame length 33 bytes. +- Respond with a NACK and the "Ringbuffer Full" if the DMR FIFO buffer is full. + +#### 2.5.4 Slot 2 Lost +This opcode is utilized to notify the host the current transmission synchronization was lost. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| DMR Sot 1 Lost Opcode | 1 | $1B | + +Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. + +#### 2.5.5 Short LC +This host-to-modem opcode installs the DMR Short Link Control data that the duplex transmitter inserts into the CACH. It is supported only by a duplex-capable DMR transmitter. + +The host shall transmit: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `12`, including the complete frame | +| DMR Short LC Opcode | 1 | `$1C` | +| Encoded Short LC | 9 | 68 significant bits of encoded Short LC data; the four unused bits in the final byte are ignored | + +The modem requires exactly nine payload bytes. It interleaves the first 68 bits into its internal 12-byte CACH Short LC buffer using the modem CACH interleave table. + +On success, the current firmware stores the new Short LC without sending an ACK. On failure it sends NAK with `Illegal Length`. Hotspot firmware built without duplex support sends NAK with `Invalid Request`. + +#### 2.5.6 Start +This host-to-modem opcode explicitly starts or stops duplex DMR transmission. It does not select DMR mode; the modem must already have DMR enabled and be in the DMR state. + +The host shall transmit: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `4`, including the complete frame | +| DMR Start Opcode | 1 | `$1D` | +| Transmit | 1 | `1` starts transmission; `0` stops transmission | + +Starting sets the duplex transmitter state to Slot 1. Starting or stopping also resets the frame and abort counters. The host implementation avoids sending redundant start or stop commands when its tracked transmit state already matches the request. + +On success, the current firmware changes state without sending an ACK. An invalid length, a value other than `0` or `1`, or use outside the DMR state produces NAK with `Invalid DMR Start`. Hotspot firmware built without duplex support produces NAK with `Invalid Request`. + +#### 2.5.7 Abort +This host-to-modem opcode requests that the duplex DMR transmitter abort queued transmission for one TDMA slot. + +The host shall transmit: + +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | `$FE` | +| Length | 1 | `4`, including the complete frame | +| DMR Abort Opcode | 1 | `$1E` | +| DMR Slot | 1 | `1` aborts Slot 1; `2` aborts Slot 2 | + +For a valid slot, the modem sets that slot's abort flag and resets its abort counter. The transmitter consumes the request as part of its normal slot-processing state machine. + +On success, the current firmware accepts the request without sending an ACK. A payload length other than one byte produces NAK with `Illegal Length`; a slot other than `1` or `2` produces NAK with `Invalid DMR Slot`. Hotspot firmware built without duplex support produces NAK with `Invalid Request`. + +#### 2.5.8 CACH AT Control +This opcode is utilized to set the CACH AT bit for the specified slot. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 4 | Length | +| DMR CACH AT Control Opcode | 1 | $1F | +| DMR Slot | 1 | DMR Slot to set the CACH AT bit for. | + +Upon reception, the modem shall perform whatever operations necessary to set the CACH AT bit for the specified slot. + +#### 2.5.9 Slot 1 Clear +This opcode is utilized to clear the FIFO buffer for DMR Slot 1. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| DMR Slot 2 Clear Opcode | 1 | $20 | + +Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. + +#### 2.5.10 Slot 2 Clear +This opcode is utilized to clear the FIFO buffer for DMR Slot 2. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| DMR Slot 2 Clear Opcode | 1 | $21 | + +Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. + +### 2.6 P25 Opcode Specifications + +#### 2.6.1 Data +This opcode is utilized by both the host and modem to transmit P25 frame data. + +The host or modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 21 or greater | Length, P25 data frames are variable length, the minimum data frame is a TDU data frame which has a modem packet length of 21 bytes. | +| P25 Data Opcode | 1 | $31 | +| ... | ... | ... | +| Frame Data | | | +| ... | ... | ... | + +Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. + +If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. + +If the write data operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if the frame data is less then a standard P25 TDU frame length 18 bytes. +- Respond with a NACK and the "Ringbuffer Full" if the P25 FIFO buffer is full. + +#### 2.6.2 Lost +This opcode is utilized to notify the host the current transmission synchronization was lost. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| P25 Lost Opcode | 1 | $32 | + +Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. + +#### 2.6.3 Clear +This opcode is utilized to clear the FIFO buffer for P25. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| P25 Clear Opcode | 1 | $33 | + +Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. + +### 2.7 NXDN Opcode Specifications + +#### 2.7.1 Data +This opcode is utilized by both the host and modem to transmit NXDN frame data. + +The host or modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 51 | Length | +| NXDN Data Opcode | 1 | $41 | +| ... | ... | ... | +| Frame Data | | | +| ... | ... | ... | + +Upon reception, the host or modem shall perform whatever operations necessary to handle frame data. + +If data is being transmitted to the modem, upon reception, the modem shall perform whatever operations necessary to handle the frame data for transmission and transmit a ACK or NACK in response. + +If the write data operation fails the modem shall: + +- Respond with a NACK and the "Illegal Length" if the frame data is not the standard NXDN frame length 48 bytes. +- Respond with a NACK and the "Ringbuffer Full" if the NXDN FIFO buffer is full. + +#### 2.7.2 Lost +This opcode is utilized to notify the host the current transmission synchronization was lost. + +The modem shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| NXDN Lost Opcode | 1 | $42 | + +Upon reception, the host shall perform whatever operations necessary to handle a transmission loss event. + +#### 2.7.3 Clear +This opcode is utilized to clear the FIFO buffer for NXDN. + +The host shall transmit: +| Name | Length (bytes) | Description | +| --- | --- | --- | +| Short Frame Start | 1 | Short Frame Start | +| Length | 3 | Length | +| NXDN Clear Opcode | 1 | $43 | + +Upon reception, the modem shall perform whatever operations necessary to clear the FIFO buffers. diff --git a/docs/TN.1100 - FNE REST API Documentation.md b/docs/TN.1100 - FNE REST API Documentation.md index 04fe15fa..e47186b3 100644 --- a/docs/TN.1100 - FNE REST API Documentation.md +++ b/docs/TN.1100 - FNE REST API Documentation.md @@ -1,7 +1,7 @@ # DVM FNE REST API Technical Documentation -**Version:** 1.2 -**Date:** May 8, 2026 +**Version:** 1.3 +**Date:** November 22, 2026 **Author:** AI Assistant (updated based on current source code analysis) AI WARNING: This document was mainly generated using AI assistance. As such, there is the possibility of some error or inconsistency. Examples in Section 14 and Appendix C are *strictly* examples only for how the API *could* be used. @@ -624,6 +624,27 @@ X-DVM-Auth-Token: {token} --- +### 5.5 Radio Alias Endpoints + +The radio-alias table is managed independently from the RID ACL table: + +| Method | Endpoint | Request | Response/Effect | +|--------|----------|---------|-----------------| +| GET | `/rid/alias/query` | None | Returns `rids`, an array of `{ "id": uint32, "alias": string }` objects | +| PUT | `/rid/alias/add` | `{ "rid": uint32, "alias": string }` | Adds or replaces the in-memory alias | +| PUT | `/rid/alias/delete` | `{ "rid": uint32 }` | Removes an existing alias; `SYSTEM` and `UNKNOWN` sentinel results are not removable | +| GET | `/rid/alias/commit` | None | Saves the current alias table | + +All four endpoints require `X-DVM-Auth-Token`. Add/delete changes are in memory until committed. + +### 5.6 Subscriber Operation Endpoints + +`GET /rid/operation/{operationId}` returns a stored subscriber operation. `GET /rid/operation/last/{count}` returns recent operations in `operations`; `count` is capped at 64. Each operation contains `operationId`, `protocol`, `operation`, `state`, `targetId`, `peerId`, `requestValue`, `resultValue`, `createdAt`, and `completedAt`. An unknown or zero operation ID returns HTTP 404. + +`GET /p25/rid/status/{subscriberId}` returns the latest stored P25 status with `protocol`, `subscriberId`, `peerId`, `statusValue`, `solicited`, and `observedAt`. An unknown or zero subscriber ID returns HTTP 404. These endpoints require authentication. + +--- + ## 6. Talkgroup (TGID) Management Talkgroup management endpoints control talkgroup rules, affiliations, and routing. @@ -1446,7 +1467,28 @@ X-DVM-Auth-Token: {token} --- -### 9.7 Endpoint: GET /stat-reset-total-calls +### 9.7 Endpoint: GET /health + +**Method:** `GET` + +**Description:** Return a passive health snapshot without resetting counters or changing network state. + +The authenticated response contains a `health` object with: + +- `overall`: `healthy`, `initializing`, `idle`, `degraded`, `partitioned`, or `failed`. +- `fneId` and `observedAtMs` (Unix epoch milliseconds). +- `process`: REST responsiveness. +- `dataPlane`: traffic and metadata loop status, epochs, last-tick ages, and the 5000 ms stall threshold. +- `queues`: submitted/completed/in-flight counts, progress age, enqueue failures, and queue progress state. +- `connectivity`: configured/connected upstream counts, connected peer/child counts, and per-link details. +- `traffic`: packet counters, last-packet ages, the 60000 ms idle threshold, and active calls. +- `reasonCodes` and `reasons`: machine-readable and human-readable explanations for non-healthy states. + +The endpoint may still return HTTP 200 when `health.overall` reports a degraded or failed operational state; monitoring clients must inspect the payload. + +--- + +### 9.8 Endpoint: GET /stat-reset-total-calls **Method:** `GET` @@ -1470,7 +1512,7 @@ X-DVM-Auth-Token: {token} --- -### 9.8 Endpoint: GET /stat-reset-active-calls +### 9.9 Endpoint: GET /stat-reset-active-calls **Method:** `GET` @@ -1493,7 +1535,7 @@ X-DVM-Auth-Token: {token} --- -### 9.9 Endpoint: GET /stat-reset-call-collisions +### 9.10 Endpoint: GET /stat-reset-call-collisions **Method:** `GET` @@ -1516,7 +1558,17 @@ X-DVM-Auth-Token: {token} --- -### 9.10 Endpoint: GET /report-unit-regs +### 9.11 Endpoint: GET /stat-reset-call-switches + +**Method:** `GET` + +**Description:** Reset the total call-switch counter exposed by `/stats`. + +Requires `X-DVM-Auth-Token` and returns the standard success response. + +--- + +### 9.12 Endpoint: GET /report-unit-regs **Method:** `GET` @@ -1545,7 +1597,7 @@ X-DVM-Auth-Token: {token} --- -### 9.11 Endpoint: GET /report-affiliations +### 9.13 Endpoint: GET /report-affiliations **Method:** `GET` @@ -1603,7 +1655,7 @@ X-DVM-Auth-Token: {token} --- -### 9.12 Endpoint: GET /report-grants +### 9.14 Endpoint: GET /report-grants **Method:** `GET` @@ -1646,7 +1698,7 @@ X-DVM-Auth-Token: {token} --- -### 9.13 Endpoint: GET /spanning-tree +### 9.15 Endpoint: GET /spanning-tree **Method:** `GET` @@ -2416,6 +2468,13 @@ if __name__ == "__main__": | PUT | /rid/add | Add radio ID | Yes | | PUT | /rid/delete | Delete radio ID | Yes | | GET | /rid/commit | Commit radio ID changes | Yes | +| GET | /rid/alias/query | Query radio aliases | Yes | +| PUT | /rid/alias/add | Add or replace a radio alias | Yes | +| PUT | /rid/alias/delete | Delete a radio alias | Yes | +| GET | /rid/alias/commit | Commit radio alias changes | Yes | +| GET | /rid/operation/{operationId} | Get a subscriber operation | Yes | +| GET | /rid/operation/last/{count} | Get recent subscriber operations (maximum 64) | Yes | +| GET | /p25/rid/status/{subscriberId} | Get latest stored P25 subscriber status | Yes | | GET | /tg/query | Query talkgroups | Yes | | PUT | /tg/add | Add talkgroup | Yes | | PUT | /tg/delete | Delete talkgroup | Yes | @@ -2434,9 +2493,11 @@ if __name__ == "__main__": | GET | /reload-peers | Reload peer list from disk | Yes | | GET | /reload-crypto | Reload crypto keys from disk | Yes | | GET | /stats | Get FNE statistics | Yes | +| GET | /health | Get passive FNE health snapshot | Yes | | GET | /stat-reset-total-calls | Reset total calls counter | Yes | | GET | /stat-reset-active-calls | Reset active calls counter | Yes | | GET | /stat-reset-call-collisions | Reset call collisions counter | Yes | +| GET | /stat-reset-call-switches | Reset call switches counter | Yes | | GET | /report-unit-regs | Get registered units | Yes | | GET | /report-affiliations | Get affiliations | Yes | | GET | /report-grants | Get active grants | Yes | @@ -2594,6 +2655,7 @@ monitor_affiliations("fne.example.com", 9990, "your_token", 1) | 1.0 | Dec 3, 2025 | Initial documentation based on source code analysis | | 1.1 | Dec 6, 2025 | Added missing endpoints: `/reload-peers`, `/reload-crypto`, `/stats` | | 1.2 | May 8, 2026 | Updated for current FNE REST implementation, added peer NAK endpoints, stats reset/report endpoints, and corrected REST config/auth details | +| 1.3 | Nov 22, 2026 | Added radio-alias, subscriber-operation, P25 status, health, and call-switch reset endpoints | --- diff --git a/docs/TN.1101 - DVMHost REST API Documentation.md b/docs/TN.1101 - DVMHost REST API Documentation.md index bd050bba..fdffae10 100644 --- a/docs/TN.1101 - DVMHost REST API Documentation.md +++ b/docs/TN.1101 - DVMHost REST API Documentation.md @@ -1,7 +1,7 @@ # DVM Host REST API Technical Documentation -**Version:** 1.0 -**Date:** December 3, 2025 +**Version:** 1.1 +**Date:** November 22, 2026 **Author:** AI Assistant (based on source code analysis) AI WARNING: This document was mainly generated using AI assistance. As such, there is the possibility of some error or inconsistency. Examples in Section 13 are *strictly* examples only for how the API *could* be used. @@ -32,9 +32,8 @@ The DVM (Digital Voice Modem) Host REST API provides a comprehensive interface f ### 1.1 Base Configuration -**Default Ports:** -- HTTP: User-configurable (typically 9990) -- HTTPS: User-configurable (typically 9443) +**Listener Port:** +- HTTP or HTTPS: `network.restPort` (default `9990`); enabling TLS changes the transport, not the configured port **Transport:** - Protocol: HTTP/1.1 or HTTPS @@ -43,7 +42,7 @@ The DVM (Digital Voice Modem) Host REST API provides a comprehensive interface f **SSL/TLS Support:** - Optional HTTPS with certificate-based security -- Configurable via `keyFile` and `certFile` parameters +- Configurable via `network.restSsl`, `network.restSslKey`, and `network.restSslCertificate` - Uses OpenSSL when `ENABLE_SSL` is defined ### 1.2 API Architecture @@ -1576,6 +1575,8 @@ X-DVM-Auth-Token: {token} **Method:** `GET` +The header also reserves `/p25/cc-fallback/{enable}`, but the current host REST dispatcher does not register that route; clients must not treat it as an available endpoint. + **Description:** Fire a P25 control channel transmission. **Request Headers:** @@ -3716,7 +3717,7 @@ if __name__ == "__main__": | GET | /dmr/beacon | Fire DMR beacon | Yes | DMR | | GET | /dmr/debug[/{debug}/{verbose}] | Get/Set DMR debug | Yes | DMR | | GET | /dmr/dump-csbk[/{enable}] | Get/Set CSBK dump | Yes | DMR | -| PUT | /dmr/rid | DMR RID operations (7 commands) | Yes | DMR | +| PUT | /dmr/rid | DMR RID operations (4 commands) | Yes | DMR | | GET | /dmr/cc-enable | Toggle DMR CC | Yes | DMR | | GET | /dmr/cc-broadcast | Toggle DMR CC broadcast | Yes | DMR | | GET | /dmr/report-affiliations | Get DMR affiliations | Yes | DMR | @@ -3736,12 +3737,11 @@ if __name__ == "__main__": ### Command Summaries -**DMR /rid Commands (7 total):** +**DMR /rid Commands (4 total):** - `page` - Page radio - `check` - Radio check - `inhibit` - Inhibit radio - `uninhibit` - Uninhibit radio -- `dmr-setmfid` - Set manufacturer ID **P25 /rid Commands (12 total):** - `p25-setmfid` - Set manufacturer ID @@ -3764,27 +3764,20 @@ if __name__ == "__main__": ### REST API Configuration (YAML) ```yaml -restApi: - # Enable REST API - enable: true - - # Bind address (0.0.0.0 = all interfaces) - address: 0.0.0.0 - - # Port number - port: 9990 - - # SHA-256 hashed password (plaintext - hashed internally) - password: "your_secure_password" - - # SSL/TLS Configuration (optional) - ssl: - enable: false - keyFile: /path/to/private.key - certFile: /path/to/certificate.crt - - # Enable debug logging - debug: false +network: + # Enable REST API. + restEnable: true + # Bind address (0.0.0.0 = all interfaces). + restAddress: 127.0.0.1 + # Port used for HTTP or HTTPS. + restPort: 9990 + # Enable HTTPS/TLS. + restSsl: false + restSslCertificate: web.crt + restSslKey: web.key + # Plain-text server password; clients send SHA-256(password) to /auth. + restPassword: "PASSWORD" + restDebug: false ``` --- @@ -3808,6 +3801,7 @@ restApi: | Version | Date | Changes | |---------|------|---------| | 1.0 | Dec 3, 2025 | Initial documentation based on source code analysis | +| 1.1 | Nov 22, 2026 | Corrected listener/TLS configuration and DMR RID command count | --- diff --git a/docs/TN.1101 - dvmhost Air Interface Tuning.adoc b/docs/TN.1101 - dvmhost Air Interface Tuning.adoc deleted file mode 100644 index eecbfe6d..00000000 --- a/docs/TN.1101 - dvmhost Air Interface Tuning.adoc +++ /dev/null @@ -1,95 +0,0 @@ -= Digital Voice Modem - -== Technical Note -=== dvmhost Air Interface Tuning - -Document Identifier: TN.1101 - -Author: Bryan Biedenkapp, N2PLL - -Editors: Bryan Biedenkapp, N2PLL - -Contributors: N/A - -Abstract: Describes the procedures required for appropriate alignment/calibration of an air interface. - -Status: Draft - -== 1. Introduction -This document describes, as simply as possible, the procedures required to align/calibrate an air interface. - -== 2. Alignment Procedures - -=== 2.1 Initial Setup Steps -The following setups assume the host is compiled with the setup TUI mode (if available) [NOTE: Steps 3 - 5 only apply to the air interface modem.]. It is possible to setup the modem without the setup TUI, and requires manually modifying `config.yml` and the `iden_table.dat` files. - -[start.1] -. Create/Edit `config.yml` and ensure the settings for the modem are correct, find the "modem" section in "system". Check that the uart settings have the appropriate UART port and port speed set (the config.yml defaults to /dev/ttyUSB0 and 115200). - .. If using the air modem interface, ensure the the modem protocol mode is set to "air". - .. If using the V.24 DFSI modem interface, ensure the modem protocol mode is set to "dfsi". - .... The V.24 DFSI modem has multiple firmware revisions, it is required to use firmware version 2.0 or greater for use with dvmhost. -. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. -. Using the TUI user interface, use the "Setup" menu to set default parameters. - .. The "Logging & Data Configuration" submenu allows you to alter the various logging file paths and levels, as well as paths to data files (such as the `iden_table.dat` file). - .. The "System Configuration" submenu allows you to alter various modem port and speed, system settings, and mode settings configuration. - .. The "Site Parameters" submenu allows you to alter various CW morse identification, and site parameters. - .. The "Channel Configuration" submenu allows you to alter the configured channel for the modem you are configuring. -. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. -. Quit setup mode (some settings changes require a restart of the software to be effective) using, "File" menu, "Quit". - -=== 2.2 (Air Interface) Transmit Calibration - -==== 2.2.1 Using setup TUI, if available -[start.1] -. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing). -. Depending on which protocol you are calibration with, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Tx] DMR BS 1031 Hz Test Pattern for DMR or [Tx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.) -. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard. -. Ensure the TX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50). -. If the hardware in use has a TX potentiometer, set it to the to minimum level. -. Start Tx (click "Transmit" or press F12 on the keyboard). -. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TX Level for some fine tuning with the spinbox in the "Level Adjustment" window. -. Stop Tx (click "Transmit" or press F12 on the keyboard). -. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. -. Quit setup mode, if done doing calibration, using, "File" menu, "Quit". - -==== 2.2.2 Using old calibration CLI -[start.1] -. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --cal`. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing). -. Depending on which protocol you are calibration with, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (NAC293 ID1 TG1) (P). -. Ensure the TXLevel is set to 50 (it should be by default, "\`" will display current values, use "T" [increase] and "t" [decrease] if necessary to set it to 50). -. If the hardware in use has a TX potentiometer, set it to the to minimum level. -. Start Tx (press spacebar to toggle Tx). -. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TXLevel for some fine tuning with the "T" (increase) and "t" (decrease). -. Stop Tx (press spacebar to toggle Tx). -. Save the configuration using "s" and quit calibration mode with "q". - -=== 2.3 (Air Interface) Receive Calibration - -==== 2.3.1 Using setup TUI, if available -[start.1] -. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing). -. Depending on which protocol you are calibration with, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Rx] DMR BS 1031 Hz Test Pattern for DMR or [Rx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.) -. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard. -. Ensure the RX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50). -. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.) -. While observing the BER via the setup TUI (Receive BER shows a large window in the top-right corner of the TUI when in a Rx BER test mode), adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RX Level for some fine tuning with the spinbox in the "Level Adjustment" window. -. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. -. Quit setup mode, if done doing calibration, using, "File" menu, "Quit". - -==== 2.3.2 Using old calibration CLI -[start.1] -. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --cal`. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing). -. Depending on which protocol you are calibration with, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (P). -. Ensure the RXLevel is set to 50 (it should be by default, "\`" will display current values, use "R" [increase] and "r" [decrease] if necessary to set it to 50). -. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.) -. Depending on which protocol you are calibration with, enter DMR MS 1031 Hz Test Pattern (J) or P25 1011 Hz Test Pattern (j). -. While observing the BER via the calibration console, adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RXLevel for some fine tuning with the "R" (increase) and "r" (decrease). -. Save the configuration using "s" and quit calibration mode with "q". - -== Appendix A (Air Interface) Calibration Notes - -* If you have access to appropriate RF test equipment (or equivilant equipment) that is capable of monitor the overall transmitted *analog* FM deviation; if is important to adjust both the modem and the connected radios so that the overall transmitted *analog* FM deviation be between 2.75khz and 2.83khz (a center average of 2.80khz *analog* FM deviation is best). -* When using a repeater/modem board attached to an appropriate FM repeater/radio, it *may* be necessary to "de-tune" the repeater/radio slightly, most commercial grade equipment operating within a 12.5khz channel may impose a strict 2.5khz (and no greater) maximum *analog* FM deviation, this is well below what is required for good digital operation. It may be necessary using whatever tuning/alignment tools to "de-tune" or adjust the equipments alignment to allow for a wider *analog* FM deviation, as close to 2.80khz as possible. -* In some situations, it may be necessary to adjust the symbol levels directly. Normally this isn't required as the DVM will just work, but some radios require some fine adjustment of the symbol levels, this is exposed in the calibration mode. It is however recommended, that these adjustments *not* be made unless appropriate RF test equipment is available. -* Unusually high BER >10% and other various receive problems may be due to the radio/hotspot being off frequency and requiring some adjustment. Even a slight frequency drift can be catastrophic for proper digital modulation. The recommendation is to ensure the interfaced radio does not have an overall reference frequency drift > +/- 150hz. An unusually high BER can also be explained by DC level offsets in the signal paths, or issues with the FM deviation levels on the interfaced radio being too high or too low. -* For hotspot operation, it may be necessary to enable/disable the AFC (automatic frequency correction) or change the gain mode. Both of these options can be altered using the setup TUI or directly in the `config.yml` file. In some cases when operating in trunking mode, for example, it may be necessary to change the orientation of the transmit antenna by using a 90 degree adapter as well as changing the gain mode to "Low" to prevent Rx desense. diff --git a/docs/TN.1101 - dvmhost Air Interface Tuning.md b/docs/TN.1101 - dvmhost Air Interface Tuning.md new file mode 100644 index 00000000..cf5c58dc --- /dev/null +++ b/docs/TN.1101 - dvmhost Air Interface Tuning.md @@ -0,0 +1,90 @@ +# Digital Voice Modem + +## Technical Note +### dvmhost Air Interface Tuning + +Document Identifier: TN.1101 + +Author: Bryan Biedenkapp, N2PLL + +Editors: Bryan Biedenkapp, N2PLL + +Contributors: N/A + +Abstract: Describes the procedures required for appropriate alignment/calibration of an air interface. + +Status: Draft + +## 1. Introduction +This document describes, as simply as possible, the procedures required to align/calibrate an air interface. + +## 2. Alignment Procedures + +### 2.1 Initial Setup Steps +The following setups assume the host is compiled with the setup TUI mode (if available) [NOTE: Steps 3 - 5 only apply to the air interface modem.]. It is possible to setup the modem without the setup TUI, and requires manually modifying `config.yml` and the `iden_table.dat` files. + +1. Create/Edit `config.yml` and ensure the settings for the modem are correct, find the "modem" section in "system". Check that the uart settings have the appropriate UART port and port speed set (the config.yml defaults to /dev/ttyUSB0 and 115200). + 1. If using the air modem interface, ensure the modem protocol mode is set to "air". + 1. If using the V.24 DFSI modem interface, ensure the modem protocol mode is set to "dfsi". + 1. The V.24 DFSI modem has multiple firmware revisions, it is required to use firmware version 2.0 or greater for use with dvmhost. +1. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. +1. Using the TUI user interface, use the "Setup" menu to set default parameters. + 1. The "Logging & Data Configuration" submenu allows you to alter the various logging file paths and levels, as well as paths to data files (such as the `iden_table.dat` file). + 1. The "System Configuration" submenu allows you to alter various modem port and speed, system settings, and mode settings configuration. + 1. The "Site Parameters" submenu allows you to alter various CW morse identification, and site parameters. + 1. The "Channel Configuration" submenu allows you to alter the configured channel for the modem you are configuring. +1. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. +1. Quit setup mode (some settings changes require a restart of the software to be effective) using, "File" menu, "Quit". + +### 2.2 (Air Interface) Transmit Calibration + +#### 2.2.1 Using setup TUI, if available +1. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing). +1. Depending on which protocol you are calibrating, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Tx] DMR BS 1031 Hz Test Pattern for DMR or [Tx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.) +1. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard. +1. Ensure the TX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50). +1. If the hardware in use has a TX potentiometer, set it to the to minimum level. +1. Start Tx (click "Transmit" or press F12 on the keyboard). +1. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TX Level for some fine tuning with the spinbox in the "Level Adjustment" window. +1. Stop Tx (click "Transmit" or press F12 on the keyboard). +1. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. +1. Quit setup mode, if done doing calibration, using, "File" menu, "Quit". + +#### 2.2.2 Using old calibration CLI +1. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --cal`. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Bit Error Rate" functions under Performance Testing). +1. Depending on which protocol you are calibrating, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (NAC293 ID1 TG1) (P). +1. Ensure the TXLevel is set to 50 (it should be by default, "\`" will display current values, use "T" [increase] and "t" [decrease] if necessary to set it to 50). +1. If the hardware in use has a TX potentiometer, set it to the to minimum level. +1. Start Tx (press spacebar to toggle Tx). +1. While observing the BER via whatever means available, adjust the TX potentiometer (if the modem hardware allows) for the lowest received BER. Adjust the software TXLevel for some fine tuning with the "T" (increase) and "t" (decrease). +1. Stop Tx (press spacebar to toggle Tx). +1. Save the configuration using "s" and quit calibration mode with "q". + +### 2.3 (Air Interface) Receive Calibration + +#### 2.3.1 Using setup TUI, if available +1. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --setup`. This will start the dvmhost setup TUI mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing). +1. Depending on which protocol you are calibrating, use the "Calibrate" menu, and select the appropriate mode using the "Operational Mode" submenu. (For example, select [Rx] DMR BS 1031 Hz Test Pattern for DMR or [Rx] P25 1011 Hz Test Pattern (NAC293 ID1 TG1) for P25.) +1. Open the "Level Adjustment" window by either, using the "Calibrate" menu and selecting "Level Adjustment" or if capable, pressing F5 on the keyboard. +1. Ensure the RX Level is set to 50 (it should be by default, you can use the spinbox in the "Level Adjustment" window to change the value, if necessary to set it to 50). +1. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.) +1. While observing the BER via the setup TUI (Receive BER shows a large window in the top-right corner of the TUI when in a Rx BER test mode), adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RX Level for some fine tuning with the spinbox in the "Level Adjustment" window. +1. After altering settings, use the "File" menu, "Save Settings" menu option to save the desired configuration. +1. Quit setup mode, if done doing calibration, using, "File" menu, "Quit". + +#### 2.3.2 Using old calibration CLI +1. Start `dvmhost` as follows: `/path/to/dvmhost -c /path/to/config.yml --cal`. This will start the dvmhost calibration mode. The best way to calibrate the DVM is to use a radio from which you can receive and transmit the appropriate test patterns (for example using ASTRO25 Tuner and an XTS radio to use the "Transmitter Test Pattern" functions under Performance Testing). +1. Depending on which protocol you are calibrating, enter DMR BS 1031 Hz Test Pattern (M) or P25 1011 Hz Test Pattern (P). +1. Ensure the RXLevel is set to 50 (it should be by default, "\`" will display current values, use "R" [increase] and "r" [decrease] if necessary to set it to 50). +1. If the hardware in use has a RX potentiometer, set it to the to minimum level. (If using something like the RepeaterBuilder STM32 board, decrease both the coarse and fine potentiometers to minimum level.) +1. Depending on which protocol you are calibrating, enter DMR MS 1031 Hz Test Pattern (J) or P25 1011 Hz Test Pattern (j). +1. While observing the BER via the calibration console, adjust the RX potentiometer(s) for the lowest received BER. If necessary also adjust the software RXLevel for some fine tuning with the "R" (increase) and "r" (decrease). +1. Save the configuration using "s" and quit calibration mode with "q". + +## Appendix A (Air Interface) Calibration Notes + +- If you have access to appropriate RF test equipment (or equivilant equipment) that is capable of monitor the overall transmitted **analog** FM deviation; if is important to adjust both the modem and the connected radios so that the overall transmitted **analog** FM deviation be between 2.75khz and 2.83khz (a center average of 2.80khz **analog** FM deviation is best). +- When using a repeater/modem board attached to an appropriate FM repeater/radio, it **may** be necessary to "de-tune" the repeater/radio slightly, most commercial grade equipment operating within a 12.5khz channel may impose a strict 2.5khz (and no greater) maximum **analog** FM deviation, this is well below what is required for good digital operation. It may be necessary using whatever tuning/alignment tools to "de-tune" or adjust the equipments alignment to allow for a wider **analog** FM deviation, as close to 2.80khz as possible. +- In some situations, it may be necessary to adjust the symbol levels directly. Normally this isn't required as the DVM will just work, but some radios require some fine adjustment of the symbol levels, this is exposed in the calibration mode. It is however recommended, that these adjustments **not** be made unless appropriate RF test equipment is available. +- Unusually high BER >10% and other various receive problems may be due to the radio/hotspot being off frequency and requiring some adjustment. Even a slight frequency drift can be catastrophic for proper digital modulation. The recommendation is to ensure the interfaced radio does not have an overall reference frequency drift > +/- 150hz. An unusually high BER can also be explained by DC level offsets in the signal paths, or issues with the FM deviation levels on the interfaced radio being too high or too low. +- For hotspot operation, it may be necessary to enable/disable the AFC (automatic frequency correction) or change the gain mode. Both of these options can be altered using the setup TUI or directly in the `config.yml` file. In some cases when operating in trunking mode, for example, it may be necessary to change the orientation of the transmit antenna by using a 90 degree adapter as well as changing the gain mode to "Low" to prevent Rx desense. diff --git a/docs/TN.Template.adoc b/docs/TN.Template.adoc deleted file mode 100644 index 8dd16430..00000000 --- a/docs/TN.Template.adoc +++ /dev/null @@ -1,28 +0,0 @@ -= Digital Voice Modem - -== Technical Note -=== ** - -Document Identifier: - -Author: - -Editors: - -Contributors: - -Abstract: - -Status: - -== 1. Introduction -_Place a general summary of the technical note here to serve as executive summary enticing the reader to read on._ - -== 2. Technical Note -_Place a general summary of the technical note here to serve as executive summary enticing the reader to read on._ - -=== 2.1 Definitions -_Use this section to list any technical definitions required by the reader in order to understand the proposed technical note below._ - -=== 2.2 __ -_Use this section and all following sections to describe the content of the technical note._ \ No newline at end of file diff --git a/docs/TN.Template.md b/docs/TN.Template.md new file mode 100644 index 00000000..3da0c435 --- /dev/null +++ b/docs/TN.Template.md @@ -0,0 +1,28 @@ +# Digital Voice Modem + +## Technical Note +### **** + +Document Identifier: + +Author: + +Editors: + +Contributors: + +Abstract: + +Status: + +## 1. Introduction +*Place a general summary of the technical note here to serve as executive summary enticing the reader to read on.* + +## 2. Technical Note +*Place a general summary of the technical note here to serve as executive summary enticing the reader to read on.* + +### 2.1 Definitions +*Use this section to list any technical definitions required by the reader in order to understand the proposed technical note below.* + +### 2.2 ** +*Use this section and all following sections to describe the content of the technical note.* diff --git a/docs/data-files/lookup-files.md b/docs/data-files/lookup-files.md new file mode 100644 index 00000000..a98b2923 --- /dev/null +++ b/docs/data-files/lookup-files.md @@ -0,0 +1,265 @@ +# Lookup and Data Files + +DVMHost and FNE use several reloadable lookup files in addition to their primary YAML. File paths and reload intervals are selected by the owning configuration. Relative paths are resolved from the process working directory. + +Blank lines and lines whose first character is `#` are ignored by the lookup readers. Indented comments are not comments. CSV parsing is intentionally simple: fields are split at every comma, with no CSV quoting, escaping, or automatic whitespace trimming. Consequently, aliases and passwords cannot contain commas, and leading/trailing spaces become part of string fields. Numeric conversion uses C-style decimal conversion unless stated otherwise; malformed numeric text normally becomes zero rather than producing a parse error. CSV fields are position-dependent, so keep empty placeholders when a later optional field is needed. Duplicate numeric IDs overwrite earlier entries. The supplied examples state that files should end with an empty line. + +## Ownership and enforcement overview + +| File | Primary consumer | Operational purpose | +| --- | --- | --- | +| `rid_acl.dat` | Host and FNE | Authorizes subscriber RIDs and carries packet-data/key-management permissions. | +| `rid_alias.dat` | Host and FNE | Adds display names without granting authorization. | +| `peer_list.dat` | FNE | Authorizes peer connections and assigns high-trust network capabilities. | +| `iden_table.dat` | Host and SysView | Converts compact channel ID/number pairs into RF frequencies and supplies advertised band-plan data. | +| `RSSI.dat` | Host | Converts modem-specific raw RSSI samples into approximate dBm. | +| `adj_site_map.yml` | FNE | Controls forwarding of received P25 adjacent-site status broadcasts by source peer. | + +The host may receive RID, alias, and talkgroup data distributed by an FNE when lookup updates are enabled. The FNE remains the normal policy authority in a networked deployment; the host copy is also used for local RF admission and site-trunking behavior. + +## Lookup processing model + +Most CSV lookup classes load by clearing the current in-memory table and then parsing the complete file. A syntactically readable file with no usable entries fails the load, but the old table has already been cleared. A periodic reload is therefore not transactional: validate a replacement before installing it and use an atomic rename rather than editing the live file in place. + +The configured `time` values are minutes. A value of zero performs the initial read but does not start the periodic reload thread. Lookup misses return type-specific defaults rather than throwing an error: an unknown RID is a disabled/default record, an unknown alias is `UNKNOWN`, an unknown peer is a default peer, and an unknown channel identity is an empty/zero identity record. Callers decide whether that default is permitted. + +FNE-to-host synchronization does not always transfer the complete source row. In particular, ordinary RID whitelist/blacklist updates carry only the RID and enabled/disabled state. RID aliases use a separate full-file transfer, while a replica FNE can receive complete RID, alias, peer, and talkgroup files. Do not assume a host receiving RID updates also receives static IP or key-management permissions. + +## Radio ID ACL (`rid_acl.dat`) + +Source example: [`configs/rid_acl.example.dat`](../../configs/rid_acl.example.dat). + +```text +RID,Enabled,Alias,IPAddress,CanRequestKeys,CanRekey,AllowedKIDs, +``` + +| Column | Required | Meaning | +| --- | --- | --- | +| 1 `RID` | Yes | Unsigned decimal radio ID used as the table key. Zero and protocol-reserved values should not be assigned to subscribers even though the text reader does not range-check them. | +| 2 `Enabled` | Yes | Exactly decimal `1` enables the RID; every other value is disabled. With RID ACL enforcement active, a disabled entry is denied. | +| 3 `Alias` | No | Display/logging alias stored with the ACL record. It is separate from `rid_alias.dat` and has no authorization effect. | +| 4 `IPAddress` | No | Textual IP address associated with packet-data registration/routing. The loader stores the text; this column does not allocate an address or validate the subnet. | +| 5 `CanRequestKeys` | No | `1` permits supported key requests. Default is false. | +| 6 `CanRekey` | No | `1` permits OTAR rekey delivery. Default is false. | +| 7 `AllowedKIDs` | No | Pipe-separated 16-bit hexadecimal KIDs such as `0064|0101|0A50`. Empty means no per-KID restriction when key requests are otherwise allowed. | + +At least two columns are required. A lookup miss produces a synthetic disabled/default record. When the owning `radio_id` configuration has ACL enforcement disabled, access-control callers allow unknown RIDs; enabling the ACL changes the table into an allow-list. P25 special system IDs `WUID_ALL` and `WUID_FNE` are treated as enabled independently of the file. + +The ACL-disabled behavior is permissive only for unknown RIDs. A known row with `Enabled` set to anything other than `1` is still rejected by the host access-control helpers. This permits an open deployment to maintain an explicit deny-list. The FNE constructs its RID lookup with ACL enforcement enabled, so its normal group-call validation treats undefined RIDs as unknown and applies the FNE `rejectUnknownRID` and call-handler policy on top of the table. + +`AllowedKIDs` is parsed token by token. Empty tokens and values above `FFFF` are ignored, duplicates are removed, and valid values preserve their input order. An empty resulting list means all KIDs are eligible—but only after `CanRequestKeys`, peer permission, KMF policy, and key availability also permit the request. `CanRekey` separately controls whether OTAR rekey payloads may be delivered to the RID. + +### RID ACL use cases and data flow + +- **RF and network admission:** DMR, P25, NXDN, and analog call handlers look up source and, for unit-to-unit service, destination RIDs. Disabled entries are rejected. Undefined entries are accepted or rejected according to the component's ACL and unknown-RID policy. +- **Unit registration and control service:** Host protocol access-control helpers use the table before accepting registrations, affiliations, voice/data requests, and other subscriber operations. The talkgroup-specific `rid_permitted` list is an additional check, not a replacement for this table. +- **Packet-data address provisioning:** DMR packet data maps RID to IPv4 address and performs the reverse address-to-RID lookup using `IPAddress`. P25 conventional and SNDCP registration use a nonempty address as static provisioning; an enabled RID with an empty address may be eligible for dynamic address assignment. Use canonical IPv4 text consistently because reverse DMR matching compares stored text. +- **Key service:** A key request must pass both the peer's `CanRequestKeys` capability and the subscriber RID policy. The requesting RID must exist, be enabled, have `CanRequestKeys: 1`, and—when `AllowedKIDs` is nonempty—request a listed KID. `CanRekey` is separately checked before rekey delivery. +- **Host synchronization:** The FNE sends enabled RIDs as whitelist records and disabled RIDs as blacklist records in chunks. A host with `network.updateLookups` adds or updates those states. The ordinary update does not convey alias, IP address, `CanRequestKeys`, `CanRekey`, or `AllowedKIDs`; an existing host row retains those values, while a newly announced RID receives empty/false defaults. `network.saveLookups` may persist the resulting rows. +- **Replica synchronization:** Replica FNE transfer sends the complete ACL file, preserving all columns when the receiving replica reloads it. + +Because the table is also security policy, avoid reusing a subscriber RID for infrastructure or testing. An alias or IP address does not enable a row; `Enabled` remains the admission decision. + +## Radio aliases (`rid_alias.dat`) + +Source example: [`configs/rid_alias.example.dat`](../../configs/rid_alias.example.dat). + +```text +RID,Alias, +``` + +RID is decimal. Although the format describes the alias as required, the implementation accepts an empty second field. Unknown RIDs display as `UNKNOWN`; the P25 system IDs display as `SYSTEM`. Aliases are informational and never authorize a radio, so keep admission policy in the RID ACL. This split lets operators update names without modifying security policy or key permissions. + +The host uses this table for P25 over-the-air user-alias conveyance when `protocols.p25.radioAlias.enable` is enabled. Standard/Harris-style aliases are inserted into eligible outbound voice link-control phases; Motorola mode emits talker-alias TDULCs after a completed duplex call. Empty and `UNKNOWN` aliases are not transmitted. This is an RF presentation feature and does not alter the source RID. + +The FNE can send the complete alias file in a fragmented radio-alias synchronization response. A host requests it after connection when both `network.updateLookups` and P25 radio aliases are enabled. Replica FNEs use the same full-file style of transfer. Treat synchronization as replacement of the alias dataset, not as an authorization update. + +## FNE peer list (`peer_list.dat`) + +Source example: [`configs/peer_list.example.dat`](../../configs/peer_list.example.dat). + +```text +PeerID,Password,Replication,Alias,CanRequestKeys,CanIssueInhibit,HasCallPriority,JitterEnabled,JitterMaxFrames,JitterMaxWaitUs,TelephoneInterconnect,AllowUnitToUnit, +``` + +| Column | Meaning/default | +| --- | --- | +| 1 `PeerID` | Required decimal ID, operationally valid from `1–999999999`. It is the authentication/routing identity, not a display number, and must be globally unique in the connected topology. | +| 2 `Password` | Per-peer password. Empty means the FNE master password is used; it does not mean passwordless authentication. | +| 3 `Replication` | `1` marks an FNE peer-link/replica eligible for full configuration and system traffic. Default false. | +| 4 `Alias` | Optional display name. | +| 5 `CanRequestKeys` | `1` permits encryption-key requests. Default false. | +| 6 `CanIssueInhibit` | `1` permits inhibit signaling. Default false. | +| 7 `HasCallPriority` | `1` allows priority over normal collision handling. Default false. | +| 8 `JitterEnabled` | `1` enables adaptive reordering for this peer. It trades added latency for tolerance of late/out-of-order network frames. | +| 9 `JitterMaxFrames` | Maximum buffered depth. Default `4`; use `2–8` frames. The CSV loader assigns this field directly and currently bypasses the clamping helper, so out-of-range file values can reach the live connection. Larger values tolerate more reordering but increase latency and memory use. | +| 10 `JitterMaxWaitUs` | Maximum age before delivery despite a sequence gap. Default `40000`; use `10000–200000` microseconds. As with frame depth, per-peer CSV loading currently bypasses the available clamping helper. | +| 11 `TelephoneInterconnect` | `1` identifies a P25 telephone-interconnect gateway. | +| 12 `AllowUnitToUnit` | `1` allows private-call origination/reception/transit. If omitted or blank, legacy behavior allows it. | + +The FNE first applies peer-list admission when peer ACL enforcement is enabled. A missing peer is rejected when the list contains entries; when enforcement is disabled, the list is not an allow-list. A configured-but-empty peer ACL currently fails open and logs a warning, allowing all peers. Treat that state as a deployment error rather than a safe deny-all configuration. Empty optional Boolean fields default false except `AllowUnitToUnit`, which defaults true for compatibility. + +Replication is a high-trust role: replica and SysView peers bypass ordinary talkgroup recipient filtering in call handlers, and replicas receive replicated lookup/configuration datasets and system traffic. `HasCallPriority` bypasses normal collision arbitration for that peer; it is not a general QoS weight. `CanIssueInhibit` controls acceptance of inhibit/uninhibit signaling, while `CanRequestKeys` is only one gate in the key-request path. `TelephoneInterconnect` marks the specialized gateway used for interconnect routing. Do not grant any of these capabilities merely to make a connection succeed. + +### Peer-list processing and use cases + +1. During login, the FNE checks the peer ID against the list when peer ACL enforcement is enabled. Authentication then uses the row's password, falling back to the master password only when the row password is empty. +2. After configuration exchange identifies the peer type, `Replication` can promote a neighbor FNE connection to replica status. The flag does not turn an ordinary host into an FNE; the connection metadata must also identify a neighbor FNE. +3. The FNE copies `HasCallPriority` into live connection state. Protocol call handlers use it during call-collision arbitration, allowing the peer's new source to preempt/bypass the ordinary collision decision. +4. If the global jitter buffer is enabled, its globally clamped settings override the row. Otherwise the row's jitter settings are applied directly to that connection and buffers are created per stream. Waiting for gaps adds latency, so use it for demonstrably reordered or bursty links rather than every low-latency LAN peer. +5. `AllowUnitToUnit` is checked for both ingress and egress unit-to-unit routing. A private call is allowed only when global unit-to-unit policy and the involved peer route permit it. +6. Key requests, inhibit operations, and telephone-interconnect routing consult their corresponding capabilities independently. Granting one does not grant the others. +7. Replica synchronization sends the complete peer-list file. REST additions and deletions change the in-memory table; a commit is required to make those changes durable. + +Passwords are written back in plaintext by the peer-list commit operation. Restrict file permissions and avoid exposing the file through diagnostics or version control. + +## Channel identity table (`iden_table.dat`) + +Source example: [`configs/iden_table.example.dat`](../../configs/iden_table.example.dat). `dvmcfggen` contains band-plan support in [`iden_table.py`](../../tools/dvmcfggen/iden_table.py). + +```text +ChannelID,BaseFrequencyHz,SpacingKHz,TransmitOffsetMHz,BandwidthKHz, +``` + +| Field | Meaning | +| --- | --- | +| `ChannelID` | Band-plan selector carried with a channel number. The host clamps configured channel IDs to `0–15`; use one unique row per ID. | +| `BaseFrequencyHz` | Frequency represented by channel number zero, in integer hertz. P25 identity updates encode the base in 5 Hz units, so choose a value divisible by 5. | +| `SpacingKHz` | Nominal separation between consecutive channel numbers. The loader accepts a decimal, substitutes half the bandwidth when it is zero, and quantizes operational calculations downward to 125 Hz units. | +| `TransmitOffsetMHz` | Signed offset from site transmit/output frequency to site receive/input frequency, in MHz. In host calculations, `RX = TX + offset`; therefore a `-45` MHz value maps an 851 MHz output to an 806 MHz input. Zero is rejected for the primary host channel. | +| `BandwidthKHz` | Occupied/channel bandwidth advertised in applicable control signaling. It describes the emission channel; it is not the same as channel-number spacing. | + +All five fields are required. The loader does not validate licensing, band allocation, overlaps, duplicate channel IDs, or whether bandwidth fits within spacing. A later duplicate `ChannelID` replaces the earlier row. Identity-table saving is not implemented, so treat the file as operator-managed input. + +### Identity-table processing and use cases + +- **Startup validation and modem frequencies:** The host selects `system.config.channelId`, looks up its row, combines it with hexadecimal `channelNo`, and derives the configured site TX/RX frequencies. A missing identity or invalid primary offset prevents a meaningful channel configuration. +- **Control-channel advertisement:** DMR, P25, and NXDN control implementations receive the table. P25 emits identifier-update messages from the configured entries and uses the selected identity in channel grants and adjacent/control-channel signaling. DMR and NXDN use the selected channel identity/number in their applicable site and grant messages. +- **Voice-channel pools:** Control-channel/voice-channel registration and grant logic use channel ID/number pairs to identify RF resources. Every voice channel advertised under an identity must use the same base, spacing, offset, and bandwidth interpretation as subscribers. +- **Network metadata:** The selected row's offset and bandwidth accompany peer metadata. These values describe the site to monitoring/network consumers; they do not retune a remote peer by themselves. +- **Setup and calibration tools:** Host setup and calibration load the same table to display and calculate channel frequencies. Keeping a single operator-managed table prevents the setup UI and runtime from deriving different values. + +Identity IDs are protocol signaling values, not arbitrary row numbers. A subscriber must receive the matching identity update before a channel ID/number grant can be interpreted correctly. + +### Exact frequency formulas + +At load time, a zero spacing is replaced with `BandwidthKHz / 2`. Values below `0.125` kHz are raised to `0.125` kHz. The current code tests an upper bound of `125000.0` in a value whose unit is kHz; this is much larger than a practical channel raster, so do not rely on that check as meaningful RF-plan validation. + +The implementation then converts the configured spacing into 125 Hz units: + +```text +spacing_units = floor(SpacingKHz / 0.125) +effective_spacing_hz = spacing_units * 125 +offset_hz = trunc(TransmitOffsetMHz * 1,000,000) +``` + +For channel number `N`: + +```text +site_tx_hz = BaseFrequencyHz + (effective_spacing_hz * N) +site_rx_hz = site_tx_hz + offset_hz +``` + +In DVMHost terminology, `site_tx_hz` is the repeater/base-station output (subscriber receive) frequency and `site_rx_hz` is the repeater input (subscriber transmit) frequency. The reverse calculation for a desired site output is: + +```text +N = (desired_site_tx_hz - BaseFrequencyHz) / effective_spacing_hz +``` + +`N` must be an integer. The host reads `channelNo` as hexadecimal and clamps it to `1–4095`; channel zero is changed to one. Thus a calculated decimal channel number of 800 must be written as hexadecimal `320`. Voice-channel entries use the same ID/number representation. + +### Constructing an entry manually + +1. Choose an unused channel ID from `0–15`. +2. Choose the real channel raster. It must be exactly representable in 125 Hz increments. For 6.25 kHz, `6.25 / 0.125 = 50`, so the effective step is `50 × 125 = 6250 Hz`. +3. Choose a base frequency at or below the lowest desired site output. It should be divisible by 5 Hz for P25 signaling and selected so every required output differs from it by an integer number of channel steps. +4. Calculate `N` for each output. Reject the plan if there is a remainder; rounding `N` moves the advertised frequency off-channel. +5. Calculate the signed input offset as `(site_rx_hz - site_tx_hz) / 1,000,000`. All channels represented by one row share this offset and spacing; use another channel ID when either changes. +6. Select the actual occupied bandwidth, independently of the raster. +7. Convert `N` to hexadecimal for `system.config.channelNo` and verify the forward formulas reproduce both frequencies exactly. + +Worked example using the supplied 800 MHz row and a desired site output of `851.012500 MHz`: + +```text +entry: 0,851006250,6.25,-45.000,12.5, + +effective_spacing_hz = floor(6.25 / 0.125) * 125 = 6250 Hz +N = (851012500 - 851006250) / 6250 = 1 +site_tx_hz = 851006250 + (6250 * 1) = 851012500 Hz +site_rx_hz = 851012500 + (-45 * 1,000,000) = 806012500 Hz +channelNo = 1 decimal = 001 hexadecimal +``` + +For a second example, with base `450000000`, 6.25 kHz spacing, `+5 MHz` input offset, and desired output `450500000`: + +```text +N = (450500000 - 450000000) / 6250 = 80 decimal = 050 hexadecimal +site_rx_hz = 450500000 + 5000000 = 455500000 Hz +``` + +For P25 control signaling, spacing is represented in 125 Hz units and base frequency in 5 Hz units. VHF/UHF offset signaling derives a magnitude in channel-spacing units; 700/800/900 MHz signaling uses 250 kHz offset units. Choose values exactly representable by the applicable protocol encoding, not merely values the text parser accepts. The generator should remain the normal path; the manual process is primarily for review and recovery. + +## RSSI map (`RSSI.dat`) + +Source example: [`configs/RSSI.dat`](../../configs/RSSI.dat). + +Each whitespace-separated line maps a raw modem sample to dBm: + +```text +1134 -90 +1123 -100 +1000 -109 +``` + +The first value is parsed as an unsigned 16-bit raw sample and the second as signed integer dBm. Duplicate raw samples keep the first inserted value. Points are stored in ascending raw-value order regardless of file order. Between two points `(x1,y1)` and `(x2,y2)`, the host performs linear interpolation and truncates the result to an integer: + +```text +p = (raw - x1) / (x2 - x1) +dBm = trunc((1 - p) * y1 + p * y2) +``` + +Values below the lowest calibration point use the lowest point's dBm; values above the highest use the highest point's dBm. Provide multiple measured points across the useful receiver range. Values are hardware-specific; copying another unit's table defeats calibration. + +The host loads this file once at startup when `system.modem.rssiMappingFile` is configured; unlike the `LookupTable`-derived files, it has no periodic reload thread or commit operation. DMR, P25, and NXDN RF paths convert raw modem RSSI samples through the same interpolator for logging, activity reporting, and protocol statistics. With no mapping points, interpolation returns `0`, which is a missing-calibration sentinel in practice—not a believable received signal level. + +Calibrate using measured pairs from the exact modem/radio chain. More points improve a nonlinear calibration curve, but duplicate raw values do not replace earlier ones. Arrange the file monotonically for human review even though the map sorts by raw value internally. + +## Adjacent-site map (`adj_site_map.yml`) + +Source example: [`configs/adj_site_map.example.yml`](../../configs/adj_site_map.example.yml). + +```yaml +peers: + - peerId: 1234567 + active: true + neighbors: [2345678, 3456789] +``` + +| Key | Meaning | +| --- | --- | +| `peers[].peerId` | FNE peer/site represented by this entry. | +| `peers[].active` | Whether the adjacency is active. Defaults false when omitted. An inactive record remains representable but should not drive active adjacent-site behavior. | +| `peers[].neighbors` | Stored list of peer IDs described as neighbors. The current forwarding path does not consult this list; it is retained for configuration/REST representation and future or external topology use. | + +The current runtime use is narrower than the file name suggests. When the FNE receives a P25 `ADJ_STS_BCAST`, it looks up only the sending `peerId`. If an entry exists and `active` is false, the broadcast is dropped. If an entry exists and is active, the FNE explicitly writes the broadcast to every other connected peer and stops the normal repeat path. If no entry exists, normal call-handler processing continues. The `neighbors` array is not used to select those recipients. + +This map therefore controls P25 adjacent-status-broadcast forwarding permission for a source peer; it is not the host's learned over-the-air adjacent-site table, does not create sockets, does not authenticate peers, and does not replace the FNE spanning tree. Global `disallowAdjStsBcast` policy is checked before this map and can prohibit forwarding entirely. + +Duplicate `peerId` entries can coexist when loaded, and lookup returns the first match. Programmatic updates replace the first matching entry. Avoid duplicates, and ensure every source peer ID matches the authenticated FNE topology. REST can list, add, delete, and commit these entries. + +## Encrypted key container + +The FNE `crypto_container` is not a CSV lookup. It is an encrypted managed container selected by `master.crypto_container.file` and protected by its configured password. Do not edit it as text, commit it with real keys, or confuse its password with the FNE network preshared key. + +## Reload and persistence + +- A positive `time` value controls periodic reload according to the owning lookup class. +- FNE REST provides explicit reload/commit endpoints for selected tables; see [TN.1100](../TN.1100%20-%20FNE%20REST%20API%20Documentation.md). +- Host `network.updateLookups` accepts distributed lookup updates; `saveLookups` controls persistence. +- Atomic replacement is safer than editing a live file in place. Preserve ownership and permissions. + +## Cross references + +- [Host example configuration](../../configs/config.example.yml) +- [FNE example configuration](../../configs/fne-config.example.yml) +- [Talkgroup rules](talkgroup-rules.md) diff --git a/docs/data-files/talkgroup-rules.md b/docs/data-files/talkgroup-rules.md new file mode 100644 index 00000000..9d3032eb --- /dev/null +++ b/docs/data-files/talkgroup-rules.md @@ -0,0 +1,228 @@ +# Talkgroup Rules Configuration + +Talkgroup rules define group-call admission and routing across DMR, P25, and NXDN peers. Use [`configs/talkgroup_rules.example.yml`](../../configs/talkgroup_rules.example.yml) and validate it against [`configs/schema/talkgroup_rules.yaml_schema.json`](../../configs/schema/talkgroup_rules.yaml_schema.json). + +The root key is `groupVoice`, a nonempty array. Each entry must contain `name`, `config`, and `source`; `source.tgid`, `source.slot`, and `config.active` are required by the schema. The runtime loader is less strict and supplies defaults for omitted fields, but relying on those defaults makes mistakes difficult to see. Treat schema validation as part of deployment. + +## Schema validation + +The schema uses JSON Schema draft 4 and deliberately rejects unknown keys at the root, rule, `config`, `source`, and rewrite-entry levels. This catches common misspellings such as `peerId` in place of the supported rewrite key `peerid`. It also enforces: + +- A nonempty `groupVoice` array. +- A nonempty string for each rule `name`. +- Boolean values for `active`, `affiliated`, and `parrot`. +- `strapping` values of exactly `0`, `1`, or `2`. +- Positive integer TGIDs and RIDs within the common unsigned 32-bit representation. +- Peer IDs from `1` through `999999999`. +- Slot values of exactly `1` or `2`. +- Unique scalar entries within all peer-ID and RID lists. +- Complete rewrite objects containing `peerid`, `tgid`, and `slot`. + +Schema validation cannot express all topology and protocol semantics. It does not prove that `(source.tgid, source.slot)` pairs are unique across rules, that two rewrites do not claim the same external identity, that inclusion and exclusion are not contradictory, or that a common 32-bit TGID fits the selected air protocol. Those checks remain part of deployment review. + +```yaml +groupVoice: + - name: Operations + alias: Ops + config: + active: true + affiliated: true + strapping: 0 + parrot: false + inclusion: [] + exclusion: [] + rewrite: [] + always: [] + preferred: [] + rid_permitted: [] + source: + tgid: 1001 + slot: 1 +``` + +## Identity fields + +| Key | Required | Meaning | +| --- | --- | --- | +| `name` | Yes | Human-readable rule name used in logs, REST output, and operator tools. It is not a routing key. | +| `alias` | No | Secondary display label/grouping. It does not change routing or create another TGID. | +| `source.tgid` | Yes | Canonical internal talkgroup ID. Traffic is normalized to this value before normal rule processing; zero makes the runtime entry invalid. | +| `source.slot` | Yes | Canonical DMR slot (`1` or `2`). For P25, NXDN, and analog paths, lookups frequently use slot zero as a wildcard and the configured value is normally `1`. | + +The `(tgid, slot)` pair identifies a DMR rule. A lookup with a nonzero slot requires an exact pair; a lookup with slot zero returns the first matching TGID regardless of configured slot. Because the table is a vector searched in file order, duplicate TGIDs or duplicate pairs are ambiguous rather than merged. Keep each canonical pair unique and do not rely on ordering to select a duplicate. + +## Where each field is used + +The FNE loads the authoritative table with talkgroup ACL enforcement enabled. A host independently loads the file named by `system.talkgroup_id.file`; its local enforcement is controlled by `system.talkgroup_id.acl`. The same YAML model is used by both components, but several fields are meaningful only at the FNE. + +| Field | FNE use | Host use | +| --- | --- | --- | +| `name`, `alias` | Operator-facing rule metadata, logging, REST output, and full-table replication. | Local metadata when loaded from disk; not needed for over-the-wire active-TG validation. | +| `source.tgid` | Canonical group identity used for admission, routing, and rewrites. | Group identity used by RF voice, data, control-signaling, grant, and affiliation validation. | +| `source.slot` | DMR identity and rewrite slot; normally ignored by FDMA protocols through slot-zero lookup. | Exact DMR slot validation and a preferred slot for group-channel selection. P25 and NXDN lookups are TGID based. | +| `active` | Rejects inactive group traffic and controls whether an active or deactivation record is sent to a host. | Required by local ACL validation. A deactivation received from the FNE removes the matching local runtime rule. | +| `affiliated` | Gates delivery to sites with a current group affiliation, subject to peer-class and topology exceptions. | Requires a current affiliation before trunking grant processing, unless that host operation explicitly ignores the affiliation check. | +| `strapping` | Enforces observable clear/encrypted state and sends the policy to hosts. Protocol limitations are described below. | Enforces supported RF-side encrypted-only checks. Host enforcement is not symmetrical for every protocol and value; see [Encryption strapping](#encryption-strapping). | +| `parrot` | Selects the FNE record-and-replay path. | No local host parrot service behavior. | +| `inclusion`, `exclusion` | Filters live recipients and the active/deactive/RID-admission datasets sent to each peer. | Not evaluated as a local RF routing list. A host normally receives only the subset selected for its peer ID. | +| `rewrite` | Bidirectionally maps a peer's external TGID/slot to the canonical identity. | Not applied by the host talkgroup lookup. | +| `always` | Bypasses affiliation gating for listed recipients and some originating-call unknown-RID/per-TG RID rejections. | Not evaluated by host access control. | +| `preferred` | Causes otherwise eligible, unlisted peers to receive the rule with the `nonPreferred` flag. | Uses the received `nonPreferred` state; it does not evaluate the complete `preferred` peer list locally. | +| `rid_permitted` | Restricts originating group traffic and grant/admission checks, and is distributed to eligible hosts. | Restricts the source RID wherever the protocol path invokes talkgroup-access validation, including group voice, data, control signaling, and grants. P25 also applies it to its validated affiliation paths. | + +### FNE processing path + +For an ordinary group call, the FNE applies the table in these stages: + +1. It resolves the sender's external TGID/slot through any matching per-peer rewrite and obtains the canonical rule. DMR and P25 Phase 2 include the slot in this translation; P25 Phase 1, NXDN, and analog translate the TGID. +2. It validates the canonical talkgroup, active state, originating RID admission, and any encryption state that is available at that point in the protocol. Promiscuous-hub mode intentionally relaxes normal TG/RID ACL validation. +3. It evaluates every candidate recipient. Replica and SysView peers are trusted recipient classes and bypass ordinary recipient filtering. For other peers, inclusion/exclusion is evaluated first, followed by `always` and affiliation policy. +4. It rewrites the canonical TGID/slot to the recipient's external identity before transmitting the protocol frames and applicable control messages. + +An `always` entry is broader than an affiliation exception. On the ingress/source side, an originating peer in `always` can also bypass some unknown-RID and `rid_permitted` rejection paths. It still does not make an inactive talkgroup active and does not override inclusion/exclusion filtering on delivery. + +Affiliation routing has deliberate topology exceptions. Traffic received from an upstream/neighbor FNE is repeated without requiring that link itself to hold the downstream site affiliation. Console peers bypass affiliation gating, and conventional peers can do so when the conventional-site affiliation override is enabled. For voice-channel peers, the FNE checks affiliation against the associated control-channel peer ID rather than assuming the voice-channel peer owns the affiliation database entry. + +### Host processing path + +With `system.talkgroup_id.acl: true`, the host rejects an unknown, inactive, or invalid talkgroup before accepting applicable RF voice, packet data, control-signaling, affiliation, or grant activity. DMR additionally requires the configured slot to match. P25 has a narrowly scoped `forceAllowTG0` compatibility path; it should not be treated as general permission for an undefined group. A nonempty `rid_permitted` list then requires an exact source-RID match. With the local talkgroup ACL disabled, unknown nonzero groups generally pass these table checks and `rid_permitted` is not enforced. + +For trunking operations, `affiliated: true` requires the source radio/site state to show an affiliation with that group before a grant is issued, except in code paths configured to ignore affiliation. The host also consumes `nonPreferred` state derived by the FNE from `preferred`; this can discourage use of a non-preferred site and influence subscriber roaming behavior. + +When both `network.updateLookups` and FNE `system.sendTalkgroups` are enabled, the host receives a reduced operational view rather than the complete YAML rule: + +- Active records carry TGID, slot, `affiliated`, derived `nonPreferred`, and `strapping` state. +- Deactivation records remove the matching runtime rule. +- A TG-admission update first clears the existing runtime `rid_permitted` lists, then installs the transmitted nonempty lists on matching rules. +- FNE peer routing lists determine which records are sent; fields such as `rewrite`, `always`, `parrot`, and the peer lists themselves are not sent as host policy. + +An active record creates a missing host rule. If a matching local rule already exists, the current receiver normally preserves that local entry rather than merging all transmitted attributes; a received non-preferred record is the exception and replaces the matching local entry with the FNE-derived state. Administrators should therefore avoid assuming that `updateLookups` overwrites every field of a pre-existing local rule. `network.saveLookups` can persist network-delivered lookup changes. + +A replica FNE is different: it receives the complete YAML file in fragments and reloads that file, rather than receiving only the reduced host dataset. + +## Core policy + +| Key | Meaning/default behavior | +| --- | --- | +| `config.active` | Enables admission and distribution of the rule. The FNE sends active rules to eligible peers and explicitly sends inactive rules as deactivations. This is preferable to deleting a temporarily disabled rule because identity and policy remain visible. Default false. | +| `config.affiliated` | Send traffic only to sites that currently have a group affiliation for the TGID. This reduces needless wide-area traffic. Neighbor FNE links repeat regardless; `always` peers bypass this check; consoles and optionally conventional peers also bypass it. Default false. | +| `config.strapping` | Encryption-state policy: `0` selectable, `1` encrypted-only, `2` clear-only. Enforcement depends on component, protocol, and when encryption state becomes observable; see [Encryption strapping](#encryption-strapping). Default 0. | +| `config.parrot` | Treat the TGID as record-and-replay. Eligible inbound call frames are retained and replayed after the FNE parrot delay instead of being handled as an ordinary live distribution path. Default false. | + +`strapping` and `parrot` are declared by the schema and validated according to their runtime types and accepted values. + +`active` determines whether the talkgroup itself is valid; it does not mean that every peer receives it. Peer visibility is filtered by `inclusion`/`exclusion`, and actual call delivery can additionally depend on affiliation, peer class, protocol enablement, slot policy, RID ACLs, call collisions, and topology. + +## Peer routing lists + +> **Important:** Use either a nonempty `inclusion` list or a nonempty `exclusion` list for a rule—never both. Keeping both keys with empty arrays is valid and is how the example expresses unrestricted peer routing. If both lists contain peer IDs, the FNE tests `inclusion` first and does not evaluate `exclusion`; the entire exclusion list is ignored. The verbose rule loader also logs a warning for this condition. + +Choose the list based on the intended policy: + +- Use `inclusion` when the talkgroup should reach only a known subset of peers. Every unlisted normal peer is denied. +- Use `exclusion` when the talkgroup should reach most peers except a small denied subset. Every unlisted normal peer remains eligible. +- Leave both lists empty when the talkgroup should have no peer-list restriction. Other rules such as affiliation and RID admission still apply. + +| Key | Meaning | +| --- | --- | +| `inclusion` | Allow-list for peer visibility and normal call delivery. When nonempty, an unlisted peer is filtered even if it is absent from `exclusion`. | +| `exclusion` | Deny-list used only when `inclusion` is empty. It is convenient when nearly every peer should carry the TGID. | +| `always` | Peers that bypass subsequent affiliation and some unknown-RID rejection decisions after they have passed inclusion/exclusion filtering. It does not override inclusion/exclusion. | +| `preferred` | Preferred site peer IDs. For each visible peer not in a nonempty list, the FNE marks the distributed rule non-preferred; host access-control logic can use that state to discourage or deny affiliation and drive subscriber roaming. Empty means no peer is marked non-preferred. | + +The effective recipient decision is approximately: + +```text +replica or SysView peer -> permitted by recipient filtering +inclusion nonempty and peer not listed -> deny +otherwise peer listed in exclusion -> deny +peer listed in always -> permit without affiliation check +affiliated=true and no site affiliation-> deny +otherwise -> permit +``` + +This precedence is used by ordinary live routing in the DMR, P25, P25 Phase 2, NXDN, and analog call handlers. The same inclusion-first branch is used when the FNE constructs peer-specific active/deactive talkgroup lists and distributed RID-admission datasets. Consequently, using both lists does not produce an allow-list with exceptions in those paths: it produces only an allow-list. + +Parrot playback is a notable implementation exception. Its protocol-specific playback loops test a nonempty inclusion list and then independently test exclusion, rather than using the normal `else if` precedence. If both lists are populated, parrot playback therefore behaves like `inclusion` minus `exclusion`, while live traffic and lookup distribution ignore exclusion. This inconsistency is another reason that a rule must use only one routing-list mode. + +Replica/SysView exceptions are high-trust peer-class behavior in the FNE call handlers. Inclusion/exclusion govern routing eligibility; they do not authenticate a connection. If `always` and `affiliated` are both set, the loader warns because listed peers deliberately override affiliation gating. + +## Per-peer rewrite + +`config.rewrite` maps the canonical TGID/slot to the identifiers used by one peer: + +```yaml +rewrite: + - peerid: 9000990 + tgid: 9999 + slot: 2 +``` + +| Key | Meaning | +| --- | --- | +| `peerid` | Peer for which this external representation applies. The spelling is lowercase `peerid`. Zero is syntactically loadable but should not be used. | +| `tgid` | TGID received from and transmitted to that peer. It is translated to/from the rule's canonical `source.tgid`. | +| `slot` | DMR slot received from and transmitted to that peer. Slot-zero lookups can act as a wildcard on FDMA paths. | + +On ingress, the FNE first tries the canonical source TGID and then searches rewrites for the sending peer; a matching rewritten identity resolves to the canonical rule. On egress to that peer, the canonical identity is replaced with its configured TGID/slot. This makes a single rewrite logically bidirectional for that FNE/peer boundary. It does not automatically create equivalent mappings on another FNE, host, or DVMPatch instance. + +Only one rewrite per peer and external `(tgid,slot)` should match. The lookup returns the first matching rule, so duplicate external identities are ambiguous. Avoid cycles where separate rules, FNEs, or patches translate a call back and forth. Rewriting changes group addressing only; it does not rewrite the source RID, authorize the peer, bypass RID admission, or transform encryption. + +## RID admission + +`config.rid_permitted` is a talkgroup-specific allow-list of subscriber RIDs permitted to originate or request applicable group service on the canonical `(tgid,slot)`. It is enforced only in protocol paths that call talkgroup-access validation; P25 affiliation processing does so, while affiliation handling is not identical across all protocols. With talkgroup ACL enforcement active: + +- An invalid/missing talkgroup denies the RID. +- An empty list admits every RID that passes the other ACL layers; it does not deny all. +- A nonempty list requires an exact RID match. +- When the FNE distributes admissions, zero entries are removed and the list is sorted and deduplicated. + +This is an additional layer, not a replacement for `rid_acl.dat`. A caller may need to pass global RID enablement, unknown-RID policy, peer permissions, and this talkgroup-specific list. The list controls source admission in the paths that consult it, not which sites receive an otherwise valid call. + +Private/unit-to-unit and telephone-interconnect calls are not group talkgroup traffic and use their dedicated routing policy. + +## Parrot rules + +A parrot rule normally has `parrot: true`, a unique TGID/slot, and carefully scoped peer routing. The FNE buffers the completed eligible call and starts playback after `master.parrotDelay`. `parrotGrantDemand` optionally generates a resource request, `parrotOnlyToOrginiatingPeer` limits replay scope, and `parrotOverrideSrcId` can replace the replay source RID. When replay is not restricted to the originating peer, current peer-list and affiliation eligibility is checked again. The routing-list exception described above applies to this playback loop. + +Source-RID override changes the replay envelope/source value. In the DMR implementation, embedded link-control portions of already recorded frames are not comprehensively regenerated, so consumers that inspect embedded LC can still observe the original source. Avoid enabling parrot on routine operational TGIDs: replay consumes airtime and can be mistaken for a new live transmission. + +## Encryption strapping + +The values are policy declarations, not key-management controls: + +- `0` (`selectable`) permits either clear or encrypted traffic. +- `1` (`strapped`) requires encrypted traffic where the implementation can determine encryption state. +- `2` (`clear-only`) rejects encrypted traffic where that state is checked. + +At the FNE, P25 and NXDN handlers enforce both encrypted-only and clear-only conflicts once the relevant header/link-control state is observable. DMR privacy indication can arrive too late for equivalent, reliable call-start enforcement, so DMR FNE handling is not symmetrical. Analog handling also has only the checks supported by its transported metadata. + +At the host RF boundary, DMR, P25, and NXDN voice paths contain encrypted-only (`strapping: 1`) checks. The host code does not provide an equivalent clear-only check in every corresponding path. NXDN grant requests cannot be rejected by strapping at request time because the VCALL request does not carry encryption state; enforcement occurs when voice information is available. Treat strapping as an admission guard, not proof of end-to-end encryption, and test the exact protocol, call type, and control-channel mode used by the deployment. + +## Protocol considerations + +- DMR rules distinguish Slot 1 and Slot 2. The same TGID can have separate rules per slot, but network and host slot enablement must also permit the selected slot. +- P25, NXDN, and analog normally use slot `1` in the file; their runtime lookups commonly pass slot zero and match by TGID. +- Protocol-wide IDs such as P25 `65535` or DMR `16777215` must be intentional; they can produce very broad behavior. +- Affiliation and preference are trunking concepts. Conventional and console peer exceptions exist in FNE routing, so conventional interoperability needs an explicit policy rather than blindly enabling `affiliated`. +- Encryption strapping cannot create or distribute keys. Configure key services and endpoint crypto separately. + +## Deployment checklist + +1. Ensure every `(tgid, slot)` pair is unique and active only where intended. +2. Resolve inclusion/exclusion/always contradictions. +3. Verify every peer ID against the peer list and actual topology. +4. Trace each rewrite in both directions and check for loops with DVMPatch mappings. +5. Confirm affiliation, preferred-site, and RID admission behavior in a lab topology. +6. Verify parrot and system-wide IDs cannot leak traffic to unintended peers. +7. Reload the FNE table and inspect loader warnings before live use. + +## Reload, replication, and editing behavior + +The loader parses a complete YAML document, then replaces the in-memory vector. A missing or empty `groupVoice` list fails the load. Periodic reload time is configured by the owning host/FNE configuration; a zero interval disables the reload thread. FNE REST operations can also modify and commit the in-memory table. + +When `system.sendTalkgroups` is enabled, the FNE sends each peer only rules visible through that rule's inclusion/exclusion policy. Active and inactive states are sent separately, and only nonempty RID-admission lists are encoded after zero removal, sorting, and deduplication. On receipt of an admission update, the host clears all current per-rule admission lists before applying the transmitted records, so an omitted rule becomes unrestricted rather than retaining a stale list. Replica peers can receive the full replicated table. Host-side network updates should therefore be understood as policy synchronization, not merely alias synchronization. + +Use atomic file replacement when editing a live deployment. A schema-valid but semantically conflicting file may still load successfully; verbose mode is valuable because it reports rule counts and warns about inclusion/exclusion and affiliation/always contradictions. + +See the [FNE example configuration](../../configs/fne-config.example.yml), [host example configuration](../../configs/config.example.yml), and [lookup/data-file reference](lookup-files.md). diff --git a/src/host/Host.Config.cpp b/src/host/Host.Config.cpp index faffe818..88243419 100644 --- a/src/host/Host.Config.cpp +++ b/src/host/Host.Config.cpp @@ -868,7 +868,7 @@ bool Host::createNetwork() std::string restApiSSLKey = networkConf["restSslKey"].as("web.key"); bool restApiDebug = networkConf["restDebug"].as(false); uint32_t id = networkConf["id"].as(1000U); - uint32_t jitter = networkConf["talkgroupHang"].as(360U); + uint32_t jitter = networkConf["jitter"].as(360U); std::string password = networkConf["password"].as(); bool slot1 = networkConf["slot1"].as(true); bool slot2 = networkConf["slot2"].as(true);