From ea84df2228573d450fa6f1831df5dab55abd7b50 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Thu, 20 Oct 2022 23:45:58 -0400 Subject: [PATCH] remove grant rsp/req from normal network path (this is being rearchitected); add new plumbing for determining if a DVM is authoritative for repeating traffic and auto-granting; --- config.example.yml | 2 +- dmr/Control.cpp | 6 ++- dmr/Control.h | 4 +- dmr/Slot.cpp | 7 +++- dmr/Slot.h | 4 +- dmr/packet/ControlSignaling.cpp | 7 ---- host/Host.cpp | 14 ++++--- host/Host.h | 2 + network/BaseNetwork.cpp | 71 +-------------------------------- network/BaseNetwork.h | 14 +------ network/Network.cpp | 15 +------ network/Network.h | 2 +- nxdn/Control.cpp | 4 +- nxdn/Control.h | 4 +- nxdn/packet/Trunk.cpp | 21 ---------- p25/Control.cpp | 4 +- p25/Control.h | 4 +- p25/packet/Trunk.cpp | 21 ---------- 18 files changed, 44 insertions(+), 162 deletions(-) diff --git a/config.example.yml b/config.example.yml index dd91c045..3e2175bc 100644 --- a/config.example.yml +++ b/config.example.yml @@ -17,7 +17,6 @@ network: updateLookups: false allowActivityTransfer: true allowDiagnosticTransfer: true - handleChGrants: false debug: false rconEnable: false rconAddress: 127.0.0.1 @@ -119,6 +118,7 @@ system: power: 10 location: "Repeater Site, Antarctica" config: + authoritative: true channelId: 2 channelNo: 1 dmrNetId: 1 diff --git a/dmr/Control.cpp b/dmr/Control.cpp index e80cc90e..daf869c2 100644 --- a/dmr/Control.cpp +++ b/dmr/Control.cpp @@ -43,6 +43,7 @@ using namespace dmr; /// /// Initializes a new instance of the Control class. /// +/// Flag indicating whether or not the DVM is grant authoritative. /// DMR access color code. /// Amount of hangtime for a DMR call. /// Size of DMR data frame ring buffer. @@ -63,10 +64,11 @@ using namespace dmr; /// /// Flag indicating whether DMR debug is enabled. /// Flag indicating whether DMR verbose logging is enabled. -Control::Control(uint32_t colorCode, uint32_t callHang, uint32_t queueSize, bool embeddedLCOnly, +Control::Control(bool authoritative, uint32_t colorCode, uint32_t callHang, uint32_t queueSize, bool embeddedLCOnly, bool dumpTAData, uint32_t timeout, uint32_t tgHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, uint32_t jitter, bool dumpDataPacket, bool repeatDataPacket, bool dumpCSBKData, bool debug, bool verbose) : + m_authoritative(authoritative), m_colorCode(colorCode), m_modem(modem), m_network(network), @@ -89,7 +91,7 @@ Control::Control(uint32_t colorCode, uint32_t callHang, uint32_t queueSize, bool assert(rssiMapper != nullptr); acl::AccessControl::init(m_ridLookup, m_tidLookup); - Slot::init(this, colorCode, SiteData(), embeddedLCOnly, dumpTAData, callHang, modem, network, duplex, m_ridLookup, m_tidLookup, m_idenTable, rssiMapper, jitter, verbose); + Slot::init(this, authoritative, colorCode, SiteData(), embeddedLCOnly, dumpTAData, callHang, modem, network, duplex, m_ridLookup, m_tidLookup, m_idenTable, rssiMapper, jitter, verbose); m_slot1 = new Slot(1U, timeout, tgHang, queueSize, dumpDataPacket, repeatDataPacket, dumpCSBKData, debug, verbose); m_slot2 = new Slot(2U, timeout, tgHang, queueSize, dumpDataPacket, repeatDataPacket, dumpCSBKData, debug, verbose); diff --git a/dmr/Control.h b/dmr/Control.h index 102654f4..3e57ffea 100644 --- a/dmr/Control.h +++ b/dmr/Control.h @@ -60,7 +60,7 @@ namespace dmr class HOST_SW_API Control { public: /// Initializes a new instance of the Control class. - Control(uint32_t colorCode, uint32_t callHang, uint32_t queueSize, bool embeddedLCOnly, + Control(bool authoritative, uint32_t colorCode, uint32_t callHang, uint32_t queueSize, bool embeddedLCOnly, bool dumpTAData, uint32_t timeout, uint32_t tgHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssi, uint32_t jitter, bool dumpDataPacket, bool repeatDataPacket, bool dumpCSBKData, bool debug, bool verbose); @@ -115,6 +115,8 @@ namespace dmr private: friend class Slot; + bool m_authoritative; + uint32_t m_colorCode; modem::Modem* m_modem; diff --git a/dmr/Slot.cpp b/dmr/Slot.cpp index 19c2e4a8..5af66d1e 100644 --- a/dmr/Slot.cpp +++ b/dmr/Slot.cpp @@ -56,6 +56,8 @@ const uint16_t TSCC_MAX_CNT = 511U; Control* Slot::m_dmr = nullptr; +bool Slot::m_authoritative = true; + uint32_t Slot::m_colorCode = 0U; SiteData Slot::m_siteData = SiteData(); @@ -574,6 +576,7 @@ void Slot::setSilenceThreshold(uint32_t threshold) /// Helper to initialize the DMR slot processor. /// /// Instance of the Control class. +/// Flag indicating whether or not the DVM is grant authoritative. /// DMR access color code. /// DMR site data. /// @@ -588,7 +591,7 @@ void Slot::setSilenceThreshold(uint32_t threshold) /// Instance of the RSSIInterpolator class. /// /// -void Slot::init(Control* dmr, uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool dumpTAData, uint32_t callHang, modem::Modem* modem, +void Slot::init(Control* dmr, bool authoritative, uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool dumpTAData, uint32_t callHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, uint32_t jitter, bool verbose) { @@ -601,6 +604,8 @@ void Slot::init(Control* dmr, uint32_t colorCode, SiteData siteData, bool embedd m_dmr = dmr; + m_authoritative = authoritative; + m_colorCode = colorCode; m_siteData = siteData; diff --git a/dmr/Slot.h b/dmr/Slot.h index 5e3a65b4..7cd6a696 100644 --- a/dmr/Slot.h +++ b/dmr/Slot.h @@ -106,7 +106,7 @@ namespace dmr void setSilenceThreshold(uint32_t threshold); /// Helper to initialize the slot processor. - static void init(Control* dmr, uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool dumpTAData, uint32_t callHang, modem::Modem* modem, + static void init(Control* dmr, bool authoritative, uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool dumpTAData, uint32_t callHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, uint32_t jitter, bool verbose); /// Sets local configured site data. @@ -187,6 +187,8 @@ namespace dmr static Control* m_dmr; + static bool m_authoritative; + static uint32_t m_colorCode; static SiteData m_siteData; diff --git a/dmr/packet/ControlSignaling.cpp b/dmr/packet/ControlSignaling.cpp index ad44dcd5..32ecee4f 100644 --- a/dmr/packet/ControlSignaling.cpp +++ b/dmr/packet/ControlSignaling.cpp @@ -738,13 +738,6 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_ return true; // do not generate grant packets for $FFFF (All Call) TGID } - // do we have a network connection and are we handling grants at the network? - if (m_tscc->m_network != nullptr) { - if (m_tscc->m_network->isHandlingChGrants() && m_tscc->m_siteData.netActive() && !skipNetCheck) { - return m_tscc->m_network->writeGrantReq(grp, srcId, dstId); - } - } - // are we skipping checking? if (!skip) { if (m_slot->m_rfState != RS_RF_LISTENING && m_slot->m_rfState != RS_RF_DATA) { diff --git a/host/Host.cpp b/host/Host.cpp index e5707fdd..a7d499bd 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -134,6 +134,7 @@ Host::Host(const std::string& confFile) : m_p25SysId(1U), m_p25RfssId(1U), m_nxdnRAN(1U), + m_authoritative(true), m_activeTickDelay(5U), m_idleTickDelay(5U), m_remoteControl(nullptr) @@ -441,7 +442,7 @@ int Host::run() g_fireDMRBeacon = true; } - dmr = std::unique_ptr(new dmr::Control(m_dmrColorCode, callHang, queueSizeBytes, embeddedLCOnly, dumpTAData, m_timeout, m_rfTalkgroupHang, + dmr = std::unique_ptr(new dmr::Control(m_authoritative, m_dmrColorCode, callHang, queueSizeBytes, embeddedLCOnly, dumpTAData, m_timeout, m_rfTalkgroupHang, m_modem, m_network, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, jitter, dmrDumpDataPacket, dmrRepeatDataPacket, dmrDumpCsbkData, dmrDebug, dmrVerbose)); dmr->setOptions(m_conf, m_dmrNetId, m_siteId, m_channelId, m_channelNo, true); @@ -531,7 +532,7 @@ int Host::run() } } - p25 = std::unique_ptr(new p25::Control(m_p25NAC, callHang, queueSizeBytes, m_modem, m_network, m_timeout, m_rfTalkgroupHang, + p25 = std::unique_ptr(new p25::Control(m_authoritative, m_p25NAC, callHang, queueSizeBytes, m_modem, m_network, m_timeout, m_rfTalkgroupHang, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, p25DumpDataPacket, p25RepeatDataPacket, p25DumpTsbkData, p25Debug, p25Verbose)); p25->setOptions(m_conf, m_cwCallsign, m_voiceChNo, m_p25PatchSuperGroup, m_p25NetId, m_p25SysId, m_p25RfssId, @@ -613,7 +614,7 @@ int Host::run() } } - nxdn = std::unique_ptr(new nxdn::Control(m_nxdnRAN, callHang, queueSizeBytes, m_timeout, m_rfTalkgroupHang, + nxdn = std::unique_ptr(new nxdn::Control(m_authoritative, m_nxdnRAN, callHang, queueSizeBytes, m_timeout, m_rfTalkgroupHang, m_modem, m_network, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, nxdnDumpRcchData, nxdnDebug, nxdnVerbose)); nxdn->setOptions(m_conf, m_cwCallsign, m_voiceChNo, m_siteId, m_channelId, m_channelNo, true); @@ -1920,7 +1921,10 @@ bool Host::readParams() m_nxdnRAN = rfssConfig["ran"].as(1U); + m_authoritative = rfssConfig["authoritative"].as(true); + LogInfo("System Config Parameters"); + LogInfo(" Authoritative: %s", m_authoritative ? "yes" : "no"); LogInfo(" RX Frequency: %uHz", m_rxFrequency); LogInfo(" TX Frequency: %uHz", m_txFrequency); LogInfo(" Base Frequency: %uHz", entry.baseFrequency()); @@ -2242,7 +2246,6 @@ bool Host::createNetwork() bool allowActivityTransfer = networkConf["allowActivityTransfer"].as(false); bool allowDiagnosticTransfer = networkConf["allowDiagnosticTransfer"].as(false); bool updateLookup = networkConf["updateLookups"].as(false); - bool handleChGrants = networkConf["handleChGrants"].as(false); bool debug = networkConf["debug"].as(false); if (rconPassword.length() > 64) { @@ -2270,7 +2273,6 @@ bool Host::createNetwork() LogInfo(" Allow Activity Log Transfer: %s", allowActivityTransfer ? "yes" : "no"); LogInfo(" Allow Diagnostic Log Transfer: %s", allowDiagnosticTransfer ? "yes" : "no"); LogInfo(" Update Lookups: %s", updateLookup ? "yes" : "no"); - LogInfo(" Handle Channel Grants: %s", handleChGrants ? "yes" : "no"); if (debug) { LogInfo(" Debug: yes"); @@ -2288,7 +2290,7 @@ bool Host::createNetwork() // initialize networking if (netEnable) { - m_network = new Network(address, port, local, id, password, m_duplex, debug, m_dmrEnabled, m_p25Enabled, m_nxdnEnabled, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer, updateLookup, handleChGrants); + m_network = new Network(address, port, local, id, password, m_duplex, debug, m_dmrEnabled, m_p25Enabled, m_nxdnEnabled, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer, updateLookup); m_network->setLookups(m_ridLookup, m_tidLookup); m_network->setMetadata(m_identity, m_rxFrequency, m_txFrequency, entry.txOffsetMhz(), entry.chBandwidthKhz(), m_channelId, m_channelNo, diff --git a/host/Host.h b/host/Host.h index 850ff6c7..53911c91 100644 --- a/host/Host.h +++ b/host/Host.h @@ -133,6 +133,8 @@ private: uint8_t m_p25RfssId; uint32_t m_nxdnRAN; + bool m_authoritative; + uint8_t m_activeTickDelay; uint8_t m_idleTickDelay; diff --git a/network/BaseNetwork.cpp b/network/BaseNetwork.cpp index 03597ea5..e373e40f 100644 --- a/network/BaseNetwork.cpp +++ b/network/BaseNetwork.cpp @@ -55,14 +55,12 @@ using namespace network; /// Flag indicating whether DMR slot 2 is enabled for network traffic. /// Flag indicating that the system activity logs will be sent to the network. /// Flag indicating that the system diagnostic logs will be sent to the network. -/// Flag indicating that the system will handle channel grants from the network. -BaseNetwork::BaseNetwork(uint16_t localPort, uint32_t id, bool duplex, bool debug, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool handleChGrants) : +BaseNetwork::BaseNetwork(uint16_t localPort, uint32_t id, bool duplex, bool debug, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer) : m_id(id), m_slot1(slot1), m_slot2(slot2), m_allowActivityTransfer(allowActivityTransfer), m_allowDiagnosticTransfer(allowDiagnosticTransfer), - m_handleChGrants(handleChGrants), m_duplex(duplex), m_debug(debug), m_addr(), @@ -307,39 +305,6 @@ uint8_t* BaseNetwork::readNXDN(bool& ret, nxdn::lc::RTCH& lc, uint32_t& len) return data; } -/// -/// Reads a channel grant request from the network. -/// -/// -/// -/// -/// -/// -bool BaseNetwork::readGrantRsp(bool& grp, uint32_t& srcId, uint32_t& dstId, uint32_t& grpVchNo) -{ - if (!m_handleChGrants) - return false; - - if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING) - return false; - - if (m_rxGrantData.isEmpty()) - return false; - - uint8_t length = 0U; - m_rxGrantData.getData(&length, 1U); - m_rxGrantData.getData(m_buffer, length); - - srcId = (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0); - dstId = (m_buffer[8U] << 16) | (m_buffer[9U] << 8) | (m_buffer[10U] << 0); - - grp = m_buffer[11U] == 1U; - - grpVchNo = (m_buffer[12U] << 16) | (m_buffer[13U] << 8) | (m_buffer[14U] << 0); - - return true; -} - /// /// Writes DMR frame data to the network. /// @@ -501,40 +466,6 @@ bool BaseNetwork::writeNXDN(const nxdn::lc::RTCH& lc, const uint8_t* data, const return writeNXDN(m_id, m_nxdnStreamId, lc, data, len); } -/// -/// Writes a channel grant request to the network. -/// -/// -/// -/// -/// -bool BaseNetwork::writeGrantReq(const bool grp, const uint32_t srcId, const uint32_t dstId) -{ - if (!m_handleChGrants) - return false; - - if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING) - return false; - - uint8_t buffer[DATA_PACKET_LENGTH]; - ::memset(buffer, 0x00U, DATA_PACKET_LENGTH); - - ::memcpy(buffer + 0U, TAG_REPEATER_GRANT, 7U); - - __SET_UINT16(srcId, buffer, 5U); // Source Address - __SET_UINT16(dstId, buffer, 8U); // Target Address - - buffer[11U] = (grp) ? 1U : 0U; // Group/Individual Grant - - __SET_UINT32(m_id, buffer, 12U); // Peer ID - - - if (m_debug) - Utils::dump(1U, "Network Transmitted, DMR", buffer, (32U + PACKET_PAD)); - - return write(buffer, (32U + PACKET_PAD)); -} - /// /// Writes the local activity log to the network. /// diff --git a/network/BaseNetwork.h b/network/BaseNetwork.h index 8e10d8eb..a2905969 100644 --- a/network/BaseNetwork.h +++ b/network/BaseNetwork.h @@ -83,8 +83,6 @@ #define TAG_REPEATER_CLOSING "RPTCL" #define TAG_REPEATER_PING "RPTPING" -#define TAG_REPEATER_GRANT "RPTGRNT" - #define TAG_TRANSFER_ACT_LOG "TRNSLOG" #define TAG_TRANSFER_DIAG_LOG "TRNSDIAG" @@ -127,16 +125,13 @@ namespace network class HOST_SW_API BaseNetwork { public: /// Initializes a new instance of the BaseNetwork class. - BaseNetwork(uint16_t localPort, uint32_t id, bool duplex, bool debug, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool handleChGrants); + BaseNetwork(uint16_t localPort, uint32_t id, bool duplex, bool debug, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer); /// Finalizes a instance of the BaseNetwork class. virtual ~BaseNetwork(); /// Gets the current status of the network. NET_CONN_STATUS getStatus() { return m_status; } - /// Gets the flag indicating if the network is handling channel grants. - bool isHandlingChGrants() { return m_handleChGrants; } - /// Reads DMR frame data from the DMR ring buffer. virtual bool readDMR(dmr::data::Data& data); /// Reads P25 frame data from the P25 ring buffer. @@ -144,9 +139,6 @@ namespace network /// Reads NXDN frame data from the NXDN ring buffer. virtual uint8_t* readNXDN(bool& ret, nxdn::lc::RTCH& lc, uint32_t& len); - /// Reads a channel grant request from the network. - virtual bool readGrantRsp(bool& grp, uint32_t& srcId, uint32_t& dstId, uint32_t& grpVchNo); - /// Writes DMR frame data to the network. virtual bool writeDMR(const dmr::data::Data& data); /// Writes P25 LDU1 frame data to the network. @@ -164,9 +156,6 @@ namespace network /// Writes NXDN frame data to the network. virtual bool writeNXDN(const nxdn::lc::RTCH& lc, const uint8_t* data, const uint32_t len); - /// Writes a channel grant request to the network. - virtual bool writeGrantReq(const bool grp, const uint32_t srcId, const uint32_t dstId); - /// Writes the local activity log to the network. virtual bool writeActLog(const char* message); @@ -197,7 +186,6 @@ namespace network bool m_allowActivityTransfer; bool m_allowDiagnosticTransfer; - bool m_handleChGrants; bool m_duplex; bool m_debug; diff --git a/network/Network.cpp b/network/Network.cpp index 5f02b30c..68c106e8 100644 --- a/network/Network.cpp +++ b/network/Network.cpp @@ -63,10 +63,9 @@ using namespace network; /// Flag indicating that the system activity logs will be sent to the network. /// Flag indicating that the system diagnostic logs will be sent to the network. /// Flag indicating that the system will accept radio ID and talkgroup ID lookups from the network. -/// Flag indicating that the system will handle channel grants from the network. Network::Network(const std::string& address, uint16_t port, uint16_t local, uint32_t id, const std::string& password, - bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup, bool handleChGrants) : - BaseNetwork(local, id, duplex, debug, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer, handleChGrants), + bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool allowActivityTransfer, bool allowDiagnosticTransfer, bool updateLookup) : + BaseNetwork(local, id, duplex, debug, slot1, slot2, allowActivityTransfer, allowDiagnosticTransfer), m_address(address), m_port(port), m_password(password), @@ -367,16 +366,6 @@ void Network::clock(uint32_t ms) else if (::memcmp(m_buffer, TAG_MASTER_PONG, 7U) == 0) { m_timeoutTimer.start(); } - else if (::memcmp(m_buffer, TAG_MASTER_GRANT, 7U) == 0) { - if (m_enabled && m_handleChGrants) { - if (m_debug) - Utils::dump(1U, "Network Received, Channel Grant", m_buffer, length); - - uint8_t len = length; - m_rxGrantData.addData(&len, 1U); - m_rxGrantData.addData(m_buffer, len); - } - } else { Utils::dump("Unknown packet from the master", m_buffer, length); } diff --git a/network/Network.h b/network/Network.h index d9d0d881..6608ce4c 100644 --- a/network/Network.h +++ b/network/Network.h @@ -50,7 +50,7 @@ namespace network public: /// Initializes a new instance of the Network class. Network(const std::string& address, uint16_t port, uint16_t local, uint32_t id, const std::string& password, - bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool transferActivityLog, bool transferDiagnosticLog, bool updateLookup, bool handleChGrants); + bool duplex, bool debug, bool dmr, bool p25, bool nxdn, bool slot1, bool slot2, bool transferActivityLog, bool transferDiagnosticLog, bool updateLookup); /// Finalizes a instance of the Network class. ~Network(); diff --git a/nxdn/Control.cpp b/nxdn/Control.cpp index ed3a9030..aaf75b5f 100644 --- a/nxdn/Control.cpp +++ b/nxdn/Control.cpp @@ -71,6 +71,7 @@ const uint8_t SCRAMBLER[] = { /// /// Initializes a new instance of the Control class. /// +/// Flag indicating whether or not the DVM is grant authoritative. /// NXDN Radio Access Number. /// Amount of hangtime for a NXDN call. /// Modem frame buffer queue size (bytes). @@ -86,12 +87,13 @@ const uint8_t SCRAMBLER[] = { /// Flag indicating whether RCCH data is dumped to the log. /// Flag indicating whether P25 debug is enabled. /// Flag indicating whether P25 verbose logging is enabled. -Control::Control(uint32_t ran, uint32_t callHang, uint32_t queueSize, uint32_t timeout, uint32_t tgHang, +Control::Control(bool authoritative, uint32_t ran, uint32_t callHang, uint32_t queueSize, uint32_t timeout, uint32_t tgHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, bool dumpRCCHData, bool debug, bool verbose) : m_voice(nullptr), m_data(nullptr), + m_authoritative(authoritative), m_ran(ran), m_timeout(timeout), m_modem(modem), diff --git a/nxdn/Control.h b/nxdn/Control.h index f06514fe..fc616b66 100644 --- a/nxdn/Control.h +++ b/nxdn/Control.h @@ -72,7 +72,7 @@ namespace nxdn class HOST_SW_API Control { public: /// Initializes a new instance of the Control class. - Control(uint32_t ran, uint32_t callHang, uint32_t queueSize, uint32_t timeout, uint32_t tgHang, + Control(bool authoritative, uint32_t ran, uint32_t callHang, uint32_t queueSize, uint32_t timeout, uint32_t tgHang, modem::Modem* modem, network::BaseNetwork* network, bool duplex, lookups::RadioIdLookup* ridLookup, lookups::TalkgroupIdLookup* tidLookup, lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, bool dumpRCCHData, bool debug, bool verbose); @@ -125,6 +125,8 @@ namespace nxdn friend class packet::Trunk; packet::Trunk* m_trunk; + bool m_authoritative; + uint32_t m_ran; uint32_t m_timeout; diff --git a/nxdn/packet/Trunk.cpp b/nxdn/packet/Trunk.cpp index 5efe5fd8..7c82bd16 100644 --- a/nxdn/packet/Trunk.cpp +++ b/nxdn/packet/Trunk.cpp @@ -244,20 +244,6 @@ bool Trunk::processNetwork(uint8_t fct, uint8_t option, lc::RTCH& netLC, uint8_t void Trunk::clock(uint32_t ms) { if (m_nxdn->m_control) { - if (m_nxdn->m_network != nullptr) { - if (m_nxdn->m_network->isHandlingChGrants() && m_nxdn->m_siteData.netActive()) { - bool grp = true; - uint32_t srcId = 0U; - uint32_t dstId = 0U; - uint32_t grpVchNo = 0U; - - // do we have a grant response? - if (m_nxdn->m_network->readGrantRsp(grp, srcId, dstId, grpVchNo)) { - writeRF_Message_Grant(srcId, dstId, 0U, grp, true, grpVchNo, true, true); - } - } - } - // clock all the grant timers m_nxdn->m_affiliations.clock(ms); } @@ -433,13 +419,6 @@ bool Trunk::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId, uint8_t servic bool encryption = ((serviceOptions & 0xFFU) & 0x40U) == 0x40U; // Encryption Flag uint8_t priority = ((serviceOptions & 0xFFU) & 0x07U); // Priority - // do we have a network connection and are we handling grants at the network? - if (m_nxdn->m_network != nullptr) { - if (m_nxdn->m_network->isHandlingChGrants() && m_nxdn->m_siteData.netActive() && !skipNetCheck) { - return m_nxdn->m_network->writeGrantReq(grp, srcId, dstId); - } - } - // are we skipping checking? if (!skip) { if (m_nxdn->m_rfState != RS_RF_LISTENING && m_nxdn->m_rfState != RS_RF_DATA) { diff --git a/p25/Control.cpp b/p25/Control.cpp index 13e28926..d2c4a845 100644 --- a/p25/Control.cpp +++ b/p25/Control.cpp @@ -64,6 +64,7 @@ const uint32_t MAX_PREAMBLE_TDU_CNT = 64U; /// /// Initializes a new instance of the Control class. /// +/// Flag indicating whether or not the DVM is grant authoritative. /// P25 Network Access Code. /// Amount of hangtime for a P25 call. /// Modem frame buffer queue size (bytes). @@ -81,13 +82,14 @@ const uint32_t MAX_PREAMBLE_TDU_CNT = 64U; /// Flag indicating whether TSBK data is dumped to the log. /// Flag indicating whether P25 debug is enabled. /// Flag indicating whether P25 verbose logging is enabled. -Control::Control(uint32_t nac, uint32_t callHang, uint32_t queueSize, modem::Modem* modem, network::BaseNetwork* network, +Control::Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t queueSize, modem::Modem* modem, network::BaseNetwork* network, uint32_t timeout, uint32_t tgHang, bool duplex, ::lookups::RadioIdLookup* ridLookup, ::lookups::TalkgroupIdLookup* tidLookup, ::lookups::IdenTableLookup* idenTable, ::lookups::RSSIInterpolator* rssiMapper, bool dumpPDUData, bool repeatPDU, bool dumpTSBKData, bool debug, bool verbose) : m_voice(nullptr), m_data(nullptr), m_trunk(nullptr), + m_authoritative(authoritative), m_nac(nac), m_txNAC(nac), m_timeout(timeout), diff --git a/p25/Control.h b/p25/Control.h index a5d4f8b3..bb0a955c 100644 --- a/p25/Control.h +++ b/p25/Control.h @@ -72,7 +72,7 @@ namespace p25 class HOST_SW_API Control { public: /// Initializes a new instance of the Control class. - Control(uint32_t nac, uint32_t callHang, uint32_t queueSize, modem::Modem* modem, network::BaseNetwork* network, + Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t queueSize, modem::Modem* modem, network::BaseNetwork* network, uint32_t timeout, uint32_t tgHang, bool duplex, ::lookups::RadioIdLookup* ridLookup, ::lookups::TalkgroupIdLookup* tidLookup, ::lookups::IdenTableLookup* idenTable, ::lookups::RSSIInterpolator* rssiMapper, bool dumpPDUData, bool repeatPDU, bool dumpTSBKData, bool debug, bool verbose); @@ -138,6 +138,8 @@ namespace p25 packet::Trunk* m_trunk; friend class lookups::P25AffiliationLookup; + bool m_authoritative; + uint32_t m_nac; uint32_t m_txNAC; uint32_t m_timeout; diff --git a/p25/packet/Trunk.cpp b/p25/packet/Trunk.cpp index 42812d63..d98cc8cd 100644 --- a/p25/packet/Trunk.cpp +++ b/p25/packet/Trunk.cpp @@ -943,20 +943,6 @@ void Trunk::writeAdjSSNetwork() void Trunk::clock(uint32_t ms) { if (m_p25->m_control) { - if (m_p25->m_network != nullptr) { - if (m_p25->m_network->isHandlingChGrants() && m_p25->m_siteData.netActive()) { - bool grp = true; - uint32_t srcId = 0U; - uint32_t dstId = 0U; - uint32_t grpVchNo = 0U; - - // do we have a grant response? - if (m_p25->m_network->readGrantRsp(grp, srcId, dstId, grpVchNo)) { - writeRF_TSDU_Grant(srcId, dstId, 4U, grp, true, grpVchNo, true, true); - } - } - } - // clock all the grant timers m_p25->m_affiliations.clock(ms); @@ -2123,13 +2109,6 @@ bool Trunk::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_t serviceOp return true; // do not generate grant packets for $FFFF (All Call) TGID } - // do we have a network connection and are we handling grants at the network? - if (m_p25->m_network != nullptr) { - if (m_p25->m_network->isHandlingChGrants() && m_p25->m_siteData.netActive() && !skipNetCheck) { - return m_p25->m_network->writeGrantReq(grp, srcId, dstId); - } - } - // are we skipping checking? if (!skip) { if (m_p25->m_rfState != RS_RF_LISTENING && m_p25->m_rfState != RS_RF_DATA) {