diff --git a/configs/fne-config.example.yml b/configs/fne-config.example.yml index eb44d760..c0773240 100644 --- a/configs/fne-config.example.yml +++ b/configs/fne-config.example.yml @@ -40,8 +40,8 @@ master: # Hostname/IP address to listen on (blank for all). address: 0.0.0.0 # Port number to listen on. - # NOTE: This port number includes itself for traffic, and master port + 1 for diagnostics and activity logging. (For - # example, a master port of 62031 will use 62032 for diagnostic and activity messages.) + # NOTE: This port number includes itself for traffic, and master port + 1 for metadata. (For + # example, a master port of 62031 will use 62032 for metadata messages.) port: 62031 # FNE access password. password: RPT1234 diff --git a/src/common/network/BaseNetwork.cpp b/src/common/network/BaseNetwork.cpp index ebedc487..f1426b56 100644 --- a/src/common/network/BaseNetwork.cpp +++ b/src/common/network/BaseNetwork.cpp @@ -45,7 +45,6 @@ BaseNetwork::BaseNetwork(uint32_t peerId, bool duplex, bool debug, bool slot1, b m_slot1(slot1), m_slot2(slot2), m_duplex(duplex), - m_useAlternatePortForDiagnostics(false), m_allowActivityTransfer(allowActivityTransfer), m_allowDiagnosticTransfer(allowDiagnosticTransfer), m_packetDump(false), @@ -179,7 +178,7 @@ bool BaseNetwork::writeActLog(const char* message) #endif return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_ACTIVITY }, (uint8_t*)buffer, (uint32_t)len + 11U, - RTP_END_OF_CALL_SEQ, 0U, m_useAlternatePortForDiagnostics); + RTP_END_OF_CALL_SEQ, 0U, true); } /* Writes the local diagnostics log to the network. */ @@ -207,7 +206,7 @@ bool BaseNetwork::writeDiagLog(const char* message) #endif return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_DIAG }, (uint8_t*)buffer, (uint32_t)len + 11U, - RTP_END_OF_CALL_SEQ, 0U, m_useAlternatePortForDiagnostics); + RTP_END_OF_CALL_SEQ, 0U, true); } /* Writes the local status to the network. */ @@ -219,9 +218,6 @@ bool BaseNetwork::writePeerStatus(json::object obj) if (!m_allowActivityTransfer) return false; - if (!m_useAlternatePortForDiagnostics) - return false; // this is intentional -- peer status is a noisy message and it shouldn't be done - // when the FNE is configured for main port transfers json::value v = json::value(obj); std::string json = std::string(v.serialize()); @@ -239,7 +235,7 @@ bool BaseNetwork::writePeerStatus(json::object obj) #endif return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_STATUS }, (uint8_t*)buffer, (uint32_t)len + 11U, - RTP_END_OF_CALL_SEQ, 0U, m_useAlternatePortForDiagnostics); + RTP_END_OF_CALL_SEQ, 0U, true); } /* Writes a group affiliation to the network. */ @@ -454,14 +450,14 @@ uint32_t BaseNetwork::getP25P2StreamId(uint32_t slotNo) const /* Helper to send a data message to the master. */ bool BaseNetwork::writeMaster(FrameQueue::OpcodePair opcode, const uint8_t* data, uint32_t length, uint16_t pktSeq, uint32_t streamId, - bool useAlternatePort, uint32_t peerId, uint32_t ssrc) + bool metadata, uint32_t peerId, uint32_t ssrc) { if (peerId == 0U) peerId = m_peerId; if (ssrc == 0U) ssrc = m_peerId; - if (useAlternatePort) { + if (metadata) { sockaddr_storage addr; uint32_t addrLen; diff --git a/src/common/network/BaseNetwork.h b/src/common/network/BaseNetwork.h index 32e12932..6c54fd69 100644 --- a/src/common/network/BaseNetwork.h +++ b/src/common/network/BaseNetwork.h @@ -757,13 +757,13 @@ namespace network * @param length Length of buffer to write. * @param pktSeq RTP packet sequence. * @param streamId Stream ID. - * @param useAlternatePort Flag indicating the message shuold be sent using the alternate port (mainly for activity and diagnostics). + * @param metadata Flag indicating the message should be sent to the metadata port. * @param peerId If non-zero, overrides the peer ID sent in the packet to the master. * @param ssrc If non-zero, overrides the RTP synchronization source ID sent in the packet to the master. * @returns bool True, if message was sent, otherwise false. */ bool writeMaster(FrameQueue::OpcodePair opcode, const uint8_t* data, uint32_t length, - uint16_t pktSeq, uint32_t streamId, bool useAlternatePort = false, uint32_t peerId = 0U, uint32_t ssrc = 0U); + uint16_t pktSeq, uint32_t streamId, bool metadata = false, uint32_t peerId = 0U, uint32_t ssrc = 0U); // Digital Mobile Radio /** @@ -969,8 +969,6 @@ namespace network DECLARE_PROTECTED_RO_PROPERTY(bool, duplex, Duplex); protected: - bool m_useAlternatePortForDiagnostics; - bool m_allowActivityTransfer; bool m_allowDiagnosticTransfer; diff --git a/src/common/network/Network.cpp b/src/common/network/Network.cpp index aee9bef0..b5327148 100644 --- a/src/common/network/Network.cpp +++ b/src/common/network/Network.cpp @@ -1206,14 +1206,13 @@ void Network::clock(uint32_t ms) m_retryTimer.start(); if (length > 6) { - m_useAlternatePortForDiagnostics = (buffer[6U] & 0x80U) == 0x80U; - if (m_useAlternatePortForDiagnostics) { - LogInfoEx(LOG_NET, "PEER %u RPTC ACK, master commanded alternate port for diagnostics and activity logging, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); - } else { - // disable diagnostic and activity logging automatically if the master doesn't utilize the alternate port + bool useAlternatePortForDiagnostics = (buffer[6U] & 0x80U) == 0x80U; + if (!useAlternatePortForDiagnostics) { + // disable diagnostic and activity logging automatically if the master doesn't utilize the secondary port m_allowDiagnosticTransfer = false; m_allowActivityTransfer = false; - LogWarning(LOG_NET, "PEER %u RPTC ACK, master does not enable alternate port for diagnostics and activity logging, diagnostic and activity logging are disabled, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); + LogError(LOG_NET, "PEER %u RPTC ACK, master does not enable secondary port for metadata, diagnostic and activity logging are disabled, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); + LogError(LOG_NET, "PEER %u RPTC ACK, **please update your FNE**, secondary port for metadata, is required for all services as of R05A04, remotePeerId = %u", m_peerId, rtpHeader.getSSRC()); } } break; diff --git a/src/fne/HostFNE.cpp b/src/fne/HostFNE.cpp index 77a8b40e..50514b3d 100644 --- a/src/fne/HostFNE.cpp +++ b/src/fne/HostFNE.cpp @@ -61,7 +61,7 @@ HostFNE::HostFNE(const std::string& confFile) : m_confFile(confFile), m_conf(), m_network(nullptr), - m_diagNetwork(nullptr), + m_mdNetwork(nullptr), m_vtunEnabled(false), m_packetDataMode(PacketDataMode::PROJECT25), #if !defined(_WIN32) @@ -80,7 +80,6 @@ HostFNE::HostFNE(const std::string& confFile) : m_maxMissedPings(5U), m_updateLookupTime(10U), m_peerReplicaSavesACL(false), - m_useAlternatePortForDiagnostics(false), m_allowActivityTransfer(false), m_allowDiagnosticTransfer(false), m_RESTAPI(nullptr) @@ -211,9 +210,9 @@ int HostFNE::run() ** Initialize Threads */ - if (!Thread::runAsThread(this, threadMasterNetwork)) + if (!Thread::runAsThread(this, threadTrafficNetwork)) return EXIT_FAILURE; - if (!Thread::runAsThread(this, threadDiagNetwork)) + if (!Thread::runAsThread(this, threadMetadataNetwork)) return EXIT_FAILURE; #if !defined(_WIN32) if (!Thread::runAsThread(this, threadVirtualNetworking)) @@ -244,8 +243,8 @@ int HostFNE::run() // clock master if (m_network != nullptr) m_network->clock(ms); - if (m_diagNetwork != nullptr) - m_diagNetwork->clock(ms); + if (m_mdNetwork != nullptr) + m_mdNetwork->clock(ms); // clock peers for (auto network : m_peerNetworks) { @@ -279,9 +278,9 @@ int HostFNE::run() delete m_network; } - if (m_diagNetwork != nullptr) { - m_diagNetwork->close(); - delete m_diagNetwork; + if (m_mdNetwork != nullptr) { + m_mdNetwork->close(); + delete m_mdNetwork; } for (auto network : m_peerNetworks) { @@ -359,15 +358,9 @@ bool HostFNE::readParams() m_updateLookupTime = 10U; } - m_useAlternatePortForDiagnostics = systemConf["useAlternatePortForDiagnostics"].as(true); m_allowActivityTransfer = systemConf["allowActivityTransfer"].as(true); m_allowDiagnosticTransfer = systemConf["allowDiagnosticTransfer"].as(true); - if (!m_useAlternatePortForDiagnostics) { - LogWarning(LOG_HOST, "Alternate port for diagnostics and activity logging is disabled, this severely limits functionality and will prevent peer connections from transmitting diagnostic and activity logging to this FNE!"); - LogWarning(LOG_HOST, "It is *not* recommended to disable the \"useAlternatePortForDiagnostics\" option."); - } - if (!m_allowActivityTransfer) { LogWarning(LOG_HOST, "Peer activity logging is disabled, this severely limits functionality and can prevent proper operations by prohibiting activity logging to this FNE!"); LogWarning(LOG_HOST, "It is *not* recommended to disable the \"allowActivityTransfer\" option."); @@ -388,10 +381,6 @@ bool HostFNE::readParams() LogInfo(" Send Talkgroups: %s", sendTalkgroups ? "yes" : "no"); LogInfo(" Peer Replication ACL is retained: %s", m_peerReplicaSavesACL ? "yes" : "no"); - if (m_useAlternatePortForDiagnostics) - LogInfo(" Use Alternate Port for Diagnostics: yes"); - else - LogInfo(" !! Use Alternate Port for Diagnostics: no"); if (m_allowActivityTransfer) LogInfo(" Allow Activity Log Transfer: yes"); else @@ -618,7 +607,8 @@ bool HostFNE::createMasterNetwork() LogInfo(" Identity: %s", identity.c_str()); LogInfo(" Peer ID: %u", id); LogInfo(" Address: %s", address.c_str()); - LogInfo(" Port: %u", port); + LogInfo(" Traffic Port: %u", port); + LogInfo(" Metadata Port: %u", port + 1U); LogInfo(" Allow DMR Traffic: %s", m_dmrEnabled ? "yes" : "no"); LogInfo(" Allow P25 Traffic: %s", m_p25Enabled ? "yes" : "no"); LogInfo(" Allow NXDN Traffic: %s", m_nxdnEnabled ? "yes" : "no"); @@ -648,8 +638,8 @@ bool HostFNE::createMasterNetwork() LogInfo(" P25 OTAR KMF Services Debug: yes"); } - // initialize networking - m_network = new FNENetwork(this, address, port, id, password, identity, debug, kmfDebug, verbose, reportPeerPing, + // initialize traffic networking + m_network = new TrafficNetwork(this, address, port, id, password, identity, debug, kmfDebug, verbose, reportPeerPing, m_dmrEnabled, m_p25Enabled, m_nxdnEnabled, m_analogEnabled, parrotDelay, parrotGrantDemand, m_allowActivityTransfer, m_allowDiagnosticTransfer, m_pingTime, m_updateLookupTime, workerCnt); @@ -674,31 +664,29 @@ bool HostFNE::createMasterNetwork() m_network->setPresharedKey(presharedKey); } - // setup alternate port for diagnostics/activity logging - if (m_useAlternatePortForDiagnostics) { - m_diagNetwork = new DiagNetwork(this, m_network, address, port + 1U, workerCnt); - m_diagNetwork->setPacketDump(packetDump); + // initialize metadata networking + m_mdNetwork = new MetadataNetwork(this, m_network, address, port + 1U, workerCnt); + m_mdNetwork->setPacketDump(packetDump); - bool ret = m_diagNetwork->open(); - if (!ret) { - delete m_diagNetwork; - m_diagNetwork = nullptr; - LogError(LOG_HOST, "failed to initialize diagnostic log networking!"); - m_useAlternatePortForDiagnostics = false; // this isn't fatal so just disable alternate port - } - else { - if (encrypted) { - m_diagNetwork->setPresharedKey(presharedKey); - } + ret = m_mdNetwork->open(); + if (!ret) { + delete m_mdNetwork; + m_mdNetwork = nullptr; + LogError(LOG_HOST, "failed to initialize metadata networking!"); + return false; + } + else { + if (encrypted) { + m_mdNetwork->setPresharedKey(presharedKey); } } return true; } -/* Entry point to master FNE network thread. */ +/* Entry point to master traffic network thread. */ -void* HostFNE::threadMasterNetwork(void* arg) +void* HostFNE::threadTrafficNetwork(void* arg) { thread_t* th = (thread_t*)arg; if (th != nullptr) { @@ -708,7 +696,7 @@ void* HostFNE::threadMasterNetwork(void* arg) ::pthread_detach(th->thread); #endif // defined(_WIN32) - std::string threadName("fne:net"); + std::string threadName("fne:traf-net"); HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; @@ -747,9 +735,9 @@ void* HostFNE::threadMasterNetwork(void* arg) return nullptr; } -/* Entry point to master FNE diagnostics network thread. */ +/* Entry point to master metadata network thread. */ -void* HostFNE::threadDiagNetwork(void* arg) +void* HostFNE::threadMetadataNetwork(void* arg) { thread_t* th = (thread_t*)arg; if (th != nullptr) { @@ -759,7 +747,7 @@ void* HostFNE::threadDiagNetwork(void* arg) ::pthread_detach(th->thread); #endif // defined(_WIN32) - std::string threadName("fne:diag-net"); + std::string threadName("fne:meta-net"); HostFNE* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; @@ -771,11 +759,6 @@ void* HostFNE::threadDiagNetwork(void* arg) return nullptr; } - if (!fne->m_useAlternatePortForDiagnostics) { - delete th; - return nullptr; - } - LogInfoEx(LOG_HOST, "[ OK ] %s", threadName.c_str()); #ifdef _GNU_SOURCE ::pthread_setname_np(th->thread, threadName.c_str()); @@ -784,12 +767,12 @@ void* HostFNE::threadDiagNetwork(void* arg) StopWatch stopWatch; stopWatch.start(); - if (fne->m_diagNetwork != nullptr) { + if (fne->m_mdNetwork != nullptr) { while (!g_killed) { uint32_t ms = stopWatch.elapsed(); stopWatch.start(); - fne->m_diagNetwork->processNetwork(); + fne->m_mdNetwork->processNetwork(); if (ms < THREAD_CYCLE_THRESHOLD) Thread::sleep(THREAD_CYCLE_THRESHOLD); diff --git a/src/fne/HostFNE.h b/src/fne/HostFNE.h index 9537ed0a..83d38a4e 100644 --- a/src/fne/HostFNE.h +++ b/src/fne/HostFNE.h @@ -24,8 +24,8 @@ #include "common/network/viface/VIFace.h" #include "common/yaml/Yaml.h" #include "common/Timer.h" -#include "network/FNENetwork.h" -#include "network/DiagNetwork.h" +#include "network/TrafficNetwork.h" +#include "network/MetadataNetwork.h" #include "network/PeerNetwork.h" #include "restapi/RESTAPI.h" #include "CryptoContainer.h" @@ -83,16 +83,16 @@ private: const std::string& m_confFile; yaml::Node m_conf; - friend class network::FNENetwork; - friend class network::DiagNetwork; + friend class network::TrafficNetwork; + friend class network::MetadataNetwork; friend class network::callhandler::TagDMRData; friend class network::callhandler::packetdata::DMRPacketData; friend class network::callhandler::TagP25Data; friend class network::callhandler::packetdata::P25PacketData; friend class network::callhandler::TagNXDNData; friend class network::callhandler::TagAnalogData; - network::FNENetwork* m_network; - network::DiagNetwork* m_diagNetwork; + network::TrafficNetwork* m_network; + network::MetadataNetwork* m_mdNetwork; bool m_vtunEnabled; PacketDataMode m_packetDataMode; @@ -120,8 +120,6 @@ private: bool m_peerReplicaSavesACL; - bool m_useAlternatePortForDiagnostics; - bool m_allowActivityTransfer; bool m_allowDiagnosticTransfer; @@ -144,17 +142,17 @@ private: */ bool createMasterNetwork(); /** - * @brief Entry point to master FNE network thread. + * @brief Entry point to master traffic network thread. * @param arg Instance of the thread_t structure. * @returns void* (Ignore) */ - static void* threadMasterNetwork(void* arg); + static void* threadTrafficNetwork(void* arg); /** - * @brief Entry point to master FNE diagnostics network thread. + * @brief Entry point to master metadata network thread. * @param arg Instance of the thread_t structure. * @returns void* (Ignore) */ - static void* threadDiagNetwork(void* arg); + static void* threadMetadataNetwork(void* arg); /** * @brief Initializes peer FNE network connectivity. * @returns bool True, if network connectivity was initialized, otherwise false. diff --git a/src/fne/network/DiagNetwork.cpp b/src/fne/network/MetadataNetwork.cpp similarity index 89% rename from src/fne/network/DiagNetwork.cpp rename to src/fne/network/MetadataNetwork.cpp index 73f0eb01..3b71ad7a 100644 --- a/src/fne/network/DiagNetwork.cpp +++ b/src/fne/network/MetadataNetwork.cpp @@ -11,7 +11,7 @@ #include "common/zlib/Compression.h" #include "common/Log.h" #include "common/Utils.h" -#include "network/DiagNetwork.h" +#include "network/MetadataNetwork.h" #include "fne/ActivityLog.h" #include "HostFNE.h" @@ -25,11 +25,11 @@ using namespace compress; // Public Class Members // --------------------------------------------------------------------------- -/* Initializes a new instance of the DiagNetwork class. */ +/* Initializes a new instance of the MetadataNetwork class. */ -DiagNetwork::DiagNetwork(HostFNE* host, FNENetwork* fneNetwork, const std::string& address, uint16_t port, uint16_t workerCnt) : - BaseNetwork(fneNetwork->m_peerId, true, fneNetwork->m_debug, true, true, fneNetwork->m_allowActivityTransfer, fneNetwork->m_allowDiagnosticTransfer), - m_fneNetwork(fneNetwork), +MetadataNetwork::MetadataNetwork(HostFNE* host, TrafficNetwork* trafficNetwork, const std::string& address, uint16_t port, uint16_t workerCnt) : + BaseNetwork(trafficNetwork->m_peerId, true, trafficNetwork->m_debug, true, true, trafficNetwork->m_allowActivityTransfer, trafficNetwork->m_allowDiagnosticTransfer), + m_trafficNetwork(trafficNetwork), m_host(host), m_address(address), m_port(port), @@ -38,26 +38,26 @@ DiagNetwork::DiagNetwork(HostFNE* host, FNENetwork* fneNetwork, const std::strin m_peerTreeListPkt(), m_threadPool(workerCnt, "diag") { - assert(fneNetwork != nullptr); + assert(trafficNetwork != nullptr); assert(host != nullptr); assert(!address.empty()); assert(port > 0U); } -/* Finalizes a instance of the DiagNetwork class. */ +/* Finalizes a instance of the MetadataNetwork class. */ -DiagNetwork::~DiagNetwork() = default; +MetadataNetwork::~MetadataNetwork() = default; /* Sets endpoint preshared encryption key. */ -void DiagNetwork::setPresharedKey(const uint8_t* presharedKey) +void MetadataNetwork::setPresharedKey(const uint8_t* presharedKey) { m_socket->setPresharedKey(presharedKey); } /* Process a data frames from the network. */ -void DiagNetwork::processNetwork() +void MetadataNetwork::processNetwork() { if (m_status != NET_STAT_MST_RUNNING) { return; @@ -73,13 +73,13 @@ void DiagNetwork::processNetwork() UInt8Array buffer = m_frameQueue->read(length, address, addrLen, &rtpHeader, &fneHeader); if (length > 0) { if (m_debug) - Utils::dump(1U, "DiagNetwork::processNetwork(), Network Message", buffer.get(), length); + Utils::dump(1U, "MetadataNetwork::processNetwork(), Network Message", buffer.get(), length); uint32_t peerId = fneHeader.getPeerId(); NetPacketRequest* req = new NetPacketRequest(); - req->obj = m_fneNetwork; - req->diagObj = this; + req->obj = m_trafficNetwork; + req->metadataObj = this; req->peerId = peerId; req->address = address; @@ -105,7 +105,7 @@ void DiagNetwork::processNetwork() /* Updates the timer by the passed number of milliseconds. */ -void DiagNetwork::clock(uint32_t ms) +void MetadataNetwork::clock(uint32_t ms) { if (m_status != NET_STAT_MST_RUNNING) { return; @@ -114,7 +114,7 @@ void DiagNetwork::clock(uint32_t ms) /* Opens connection to the network. */ -bool DiagNetwork::open() +bool MetadataNetwork::open() { if (m_debug) LogInfoEx(LOG_DIAG, "Opening Network"); @@ -143,7 +143,7 @@ bool DiagNetwork::open() /* Closes connection to the network. */ -void DiagNetwork::close() +void MetadataNetwork::close() { if (m_debug) LogInfoEx(LOG_DIAG, "Closing Network"); @@ -162,10 +162,10 @@ void DiagNetwork::close() /* Process a data frames from the network. */ -void DiagNetwork::taskNetworkRx(NetPacketRequest* req) +void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) { if (req != nullptr) { - FNENetwork* network = static_cast(req->obj); + TrafficNetwork* network = static_cast(req->obj); if (network == nullptr) { if (req != nullptr) { if (req->buffer != nullptr) @@ -176,8 +176,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) return; } - DiagNetwork* diagNetwork = static_cast(req->diagObj); - if (diagNetwork == nullptr) { + MetadataNetwork* mdNetwork = static_cast(req->metadataObj); + if (mdNetwork == nullptr) { if (req != nullptr) { if (req->buffer != nullptr) delete[] req->buffer; @@ -396,18 +396,18 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) DECLARE_UINT8_ARRAY(rawPayload, req->length); ::memcpy(rawPayload, req->buffer, req->length); - // Utils::dump(1U, "DiagNetwork::taskNetworkRx(), REPL_ACT_PEER_LIST, Raw Payload", rawPayload, req->length); + // Utils::dump(1U, "MetadataNetwork::taskNetworkRx(), REPL_ACT_PEER_LIST, Raw Payload", rawPayload, req->length); - if (diagNetwork->m_peerReplicaActPkt.find(peerId) == diagNetwork->m_peerReplicaActPkt.end()) { - diagNetwork->m_peerReplicaActPkt.insert(peerId, DiagNetwork::PacketBufferEntry()); + if (mdNetwork->m_peerReplicaActPkt.find(peerId) == mdNetwork->m_peerReplicaActPkt.end()) { + mdNetwork->m_peerReplicaActPkt.insert(peerId, MetadataNetwork::PacketBufferEntry()); - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerReplicaActPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerReplicaActPkt[peerId]; pkt.buffer = new PacketBuffer(true, "Peer Replication, Active Peer List"); pkt.streamId = streamId; pkt.locked = false; } else { - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerReplicaActPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerReplicaActPkt[peerId]; if (!pkt.locked && pkt.streamId != streamId) { LogError(LOG_REPL, "PEER %u (%s) Peer Replication, Active Peer List, stream ID mismatch, expected %u, got %u", peerId, connection->identWithQualifier().c_str(), pkt.streamId, streamId); @@ -421,7 +421,7 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) } } - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerReplicaActPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerReplicaActPkt[peerId]; if (pkt.locked) { while (pkt.locked) Thread::sleep(1U); @@ -433,7 +433,7 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) uint8_t* decompressed = nullptr; if (pkt.buffer->decode(rawPayload, &decompressed, &decompressedLen)) { - diagNetwork->m_peerReplicaActPkt.lock(); + mdNetwork->m_peerReplicaActPkt.lock(); std::string payload(decompressed + 8U, decompressed + decompressedLen); // parse JSON body @@ -446,8 +446,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerReplicaActPkt.unlock(); - diagNetwork->m_peerReplicaActPkt.erase(peerId); + mdNetwork->m_peerReplicaActPkt.unlock(); + mdNetwork->m_peerReplicaActPkt.erase(peerId); break; } else { @@ -460,8 +460,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerReplicaActPkt.unlock(); - diagNetwork->m_peerReplicaActPkt.erase(peerId); + mdNetwork->m_peerReplicaActPkt.unlock(); + mdNetwork->m_peerReplicaActPkt.erase(peerId); break; } else { @@ -477,8 +477,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerReplicaActPkt.unlock(); - diagNetwork->m_peerReplicaActPkt.erase(peerId); + mdNetwork->m_peerReplicaActPkt.unlock(); + mdNetwork->m_peerReplicaActPkt.erase(peerId); } else { pkt.locked = false; } @@ -535,7 +535,7 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (network->m_debug) { std::string address = __IP_FROM_UINT(rxEntry.masterIP); - LogDebugEx(LOG_REPL, "DiagNetwork::taskNetworkRx", "PEER %u (%s) Peer Replication, HA Parameters, %s:%u", peerId, connection->identWithQualifier().c_str(), + LogDebugEx(LOG_REPL, "MetadataNetwork::taskNetworkRx", "PEER %u (%s) Peer Replication, HA Parameters, %s:%u", peerId, connection->identWithQualifier().c_str(), address.c_str(), rxEntry.masterPort); } } @@ -585,18 +585,18 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) DECLARE_UINT8_ARRAY(rawPayload, req->length); ::memcpy(rawPayload, req->buffer, req->length); - // Utils::dump(1U, "DiagNetwork::taskNetworkRx(), NET_TREE_LIST, Raw Payload", rawPayload, req->length); + // Utils::dump(1U, "MetadataNetwork::taskNetworkRx(), NET_TREE_LIST, Raw Payload", rawPayload, req->length); - if (diagNetwork->m_peerTreeListPkt.find(peerId) == diagNetwork->m_peerTreeListPkt.end()) { - diagNetwork->m_peerTreeListPkt.insert(peerId, DiagNetwork::PacketBufferEntry()); + if (mdNetwork->m_peerTreeListPkt.find(peerId) == mdNetwork->m_peerTreeListPkt.end()) { + mdNetwork->m_peerTreeListPkt.insert(peerId, MetadataNetwork::PacketBufferEntry()); - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerTreeListPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerTreeListPkt[peerId]; pkt.buffer = new PacketBuffer(true, "Network Tree, Tree List"); pkt.streamId = streamId; pkt.locked = false; } else { - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerTreeListPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerTreeListPkt[peerId]; if (!pkt.locked && pkt.streamId != streamId) { LogError(LOG_STP, "PEER %u (%s) Network Tree, Tree List, stream ID mismatch, expected %u, got %u", peerId, connection->identWithQualifier().c_str(), pkt.streamId, streamId); @@ -610,7 +610,7 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) } } - DiagNetwork::PacketBufferEntry& pkt = diagNetwork->m_peerTreeListPkt[peerId]; + MetadataNetwork::PacketBufferEntry& pkt = mdNetwork->m_peerTreeListPkt[peerId]; if (pkt.locked) { while (pkt.locked) Thread::sleep(1U); @@ -622,7 +622,7 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) uint8_t* decompressed = nullptr; if (pkt.buffer->decode(rawPayload, &decompressed, &decompressedLen)) { - diagNetwork->m_peerTreeListPkt.lock(); + mdNetwork->m_peerTreeListPkt.lock(); std::string payload(decompressed + 8U, decompressed + decompressedLen); // parse JSON body @@ -635,8 +635,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerTreeListPkt.unlock(); - diagNetwork->m_peerTreeListPkt.erase(peerId); + mdNetwork->m_peerTreeListPkt.unlock(); + mdNetwork->m_peerTreeListPkt.erase(peerId); break; } else { @@ -649,8 +649,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerTreeListPkt.unlock(); - diagNetwork->m_peerTreeListPkt.erase(peerId); + mdNetwork->m_peerTreeListPkt.unlock(); + mdNetwork->m_peerTreeListPkt.erase(peerId); break; } else { @@ -680,8 +680,8 @@ void DiagNetwork::taskNetworkRx(NetPacketRequest* req) if (decompressed != nullptr) { delete[] decompressed; } - diagNetwork->m_peerTreeListPkt.unlock(); - diagNetwork->m_peerTreeListPkt.erase(peerId); + mdNetwork->m_peerTreeListPkt.unlock(); + mdNetwork->m_peerTreeListPkt.erase(peerId); } else { pkt.locked = false; } diff --git a/src/fne/network/DiagNetwork.h b/src/fne/network/MetadataNetwork.h similarity index 81% rename from src/fne/network/DiagNetwork.h rename to src/fne/network/MetadataNetwork.h index 0faff118..62629a2e 100644 --- a/src/fne/network/DiagNetwork.h +++ b/src/fne/network/MetadataNetwork.h @@ -8,18 +8,18 @@ * */ /** - * @file DiagNetwork.h + * @file MetadataNetwork.h * @ingroup fne_network - * @file DiagNetwork.cpp + * @file MetadataNetwork.cpp * @ingroup fne_network */ -#if !defined(__DIAG_NETWORK_H__) -#define __DIAG_NETWORK_H__ +#if !defined(__METADATA_NETWORK_H__) +#define __METADATA_NETWORK_H__ #include "fne/Defines.h" #include "common/network/BaseNetwork.h" #include "common/ThreadPool.h" -#include "fne/network/FNENetwork.h" +#include "fne/network/TrafficNetwork.h" #include @@ -39,21 +39,21 @@ namespace network * @brief Implements the diagnostic/activity log networking logic. * @ingroup fne_network */ - class HOST_SW_API DiagNetwork : public BaseNetwork { + class HOST_SW_API MetadataNetwork : public BaseNetwork { public: /** - * @brief Initializes a new instance of the DiagNetwork class. + * @brief Initializes a new instance of the MetadataNetwork class. * @param host Instance of the HostFNE class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param address Network Hostname/IP address to listen on. * @param port Network port number. * @param workerCnt Number of worker threads. */ - DiagNetwork(HostFNE* host, FNENetwork* fneNetwork, const std::string& address, uint16_t port, uint16_t workerCnt); + MetadataNetwork(HostFNE* host, TrafficNetwork* trafficNetwork, const std::string& address, uint16_t port, uint16_t workerCnt); /** - * @brief Finalizes a instance of the DiagNetwork class. + * @brief Finalizes a instance of the MetadataNetwork class. */ - ~DiagNetwork() override; + ~MetadataNetwork() override; /** * @brief Gets the current status of the network. @@ -90,8 +90,8 @@ namespace network void close() override; private: - friend class FNENetwork; - FNENetwork* m_fneNetwork; + friend class TrafficNetwork; + TrafficNetwork* m_trafficNetwork; HostFNE* m_host; std::string m_address; @@ -129,4 +129,4 @@ namespace network }; } // namespace network -#endif // __FNE_NETWORK_H__ +#endif // __METADATA_NETWORK_H__ diff --git a/src/fne/network/P25OTARService.cpp b/src/fne/network/P25OTARService.cpp index d3dda086..3937f5af 100644 --- a/src/fne/network/P25OTARService.cpp +++ b/src/fne/network/P25OTARService.cpp @@ -12,7 +12,7 @@ #include "common/Log.h" #include "common/Thread.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/P25OTARService.h" #include "HostFNE.h" @@ -51,7 +51,7 @@ using namespace p25::kmm; /* Initializes a new instance of the P25OTARService class. */ -P25OTARService::P25OTARService(FNENetwork* network, P25PacketData* packetData, bool debug, bool verbose) : +P25OTARService::P25OTARService(TrafficNetwork* network, P25PacketData* packetData, bool debug, bool verbose) : m_socket(nullptr), m_frameQueue(nullptr), m_threadPool(MAX_THREAD_CNT, "otar"), diff --git a/src/fne/network/P25OTARService.h b/src/fne/network/P25OTARService.h index 2d8c53e6..6a6bf5fe 100644 --- a/src/fne/network/P25OTARService.h +++ b/src/fne/network/P25OTARService.h @@ -22,7 +22,7 @@ #include "common/p25/Crypto.h" #include "common/network/udp/Socket.h" #include "common/network/RawFrameQueue.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/packetdata/P25PacketData.h" namespace network @@ -54,12 +54,12 @@ namespace network public: /** * @brief Initializes a new instance of the P25OTARService class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param packetData Instance of the P25PacketData class. * @param debug Flag indicating whether debug is enabled. * @param verbose Flag indicating whether verbose logging is enabled. */ - P25OTARService(FNENetwork* network, network::callhandler::packetdata::P25PacketData* packetData, bool debug, bool verbose); + P25OTARService(TrafficNetwork* network, network::callhandler::packetdata::P25PacketData* packetData, bool debug, bool verbose); /** * @brief Finalizes a instance of the P25OTARService class. */ @@ -102,7 +102,7 @@ namespace network ThreadPool m_threadPool; - FNENetwork* m_network; + TrafficNetwork* m_network; network::callhandler::packetdata::P25PacketData* m_packetData; concurrent::unordered_map m_rsiMessageNumber; diff --git a/src/fne/network/PeerNetwork.h b/src/fne/network/PeerNetwork.h index 48e74525..10101fc8 100644 --- a/src/fne/network/PeerNetwork.h +++ b/src/fne/network/PeerNetwork.h @@ -57,7 +57,7 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the FNE peer networking logic. + * @brief Implements the FNE upstream peer networking logic. * @ingroup fne_network */ class HOST_SW_API PeerNetwork : public Network { diff --git a/src/fne/network/FNENetwork.cpp b/src/fne/network/TrafficNetwork.cpp similarity index 96% rename from src/fne/network/FNENetwork.cpp rename to src/fne/network/TrafficNetwork.cpp index 05096c40..72904d04 100644 --- a/src/fne/network/FNENetwork.cpp +++ b/src/fne/network/TrafficNetwork.cpp @@ -15,7 +15,7 @@ #include "common/Log.h" #include "common/StopWatch.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/TagDMRData.h" #include "network/callhandler/TagP25Data.h" #include "network/callhandler/TagNXDNData.h" @@ -54,15 +54,15 @@ const uint32_t FIXED_HA_UPDATE_INTERVAL = 30U; // 30s // Static Class Members // --------------------------------------------------------------------------- -std::timed_mutex FNENetwork::s_keyQueueMutex; +std::timed_mutex TrafficNetwork::s_keyQueueMutex; // --------------------------------------------------------------------------- // Public Class Members // --------------------------------------------------------------------------- -/* Initializes a new instance of the FNENetwork class. */ +/* Initializes a new instance of the TrafficNetwork class. */ -FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port, uint32_t peerId, const std::string& password, +TrafficNetwork::TrafficNetwork(HostFNE* host, const std::string& address, uint16_t port, uint32_t peerId, const std::string& password, std::string identity, bool debug, bool kmfDebug, bool verbose, bool reportPeerPing, bool dmr, bool p25, bool nxdn, bool analog, uint32_t parrotDelay, bool parrotGrantDemand, bool allowActivityTransfer, bool allowDiagnosticTransfer, @@ -180,9 +180,9 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port, Thread::runAsThread(this, threadParrotHandler); } -/* Finalizes a instance of the FNENetwork class. */ +/* Finalizes a instance of the TrafficNetwork class. */ -FNENetwork::~FNENetwork() +TrafficNetwork::~TrafficNetwork() { if (m_kmfServicesEnabled) { m_p25OTARService->close(); @@ -198,7 +198,7 @@ FNENetwork::~FNENetwork() /* Helper to set configuration options. */ -void FNENetwork::setOptions(yaml::Node& conf, bool printOptions) +void TrafficNetwork::setOptions(yaml::Node& conf, bool printOptions) { m_disallowAdjStsBcast = conf["disallowAdjStsBcast"].as(false); m_disallowExtAdjStsBcast = conf["disallowExtAdjStsBcast"].as(true); @@ -401,7 +401,7 @@ void FNENetwork::setOptions(yaml::Node& conf, bool printOptions) /* Sets the instances of the Radio ID, Talkgroup ID Peer List, and Crypto lookup tables. */ -void FNENetwork::setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRulesLookup* tidLookup, lookups::PeerListLookup* peerListLookup, +void TrafficNetwork::setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRulesLookup* tidLookup, lookups::PeerListLookup* peerListLookup, CryptoContainer* cryptoLookup, lookups::AdjSiteMapLookup* adjSiteMapLookup) { m_ridLookup = ridLookup; @@ -413,14 +413,14 @@ void FNENetwork::setLookups(lookups::RadioIdLookup* ridLookup, lookups::Talkgrou /* Sets endpoint preshared encryption key. */ -void FNENetwork::setPresharedKey(const uint8_t* presharedKey) +void TrafficNetwork::setPresharedKey(const uint8_t* presharedKey) { m_socket->setPresharedKey(presharedKey); } /* Process a data frames from the network. */ -void FNENetwork::processNetwork() +void TrafficNetwork::processNetwork() { if (m_status != NET_STAT_MST_RUNNING) { return; @@ -436,13 +436,13 @@ void FNENetwork::processNetwork() UInt8Array buffer = m_frameQueue->read(length, address, addrLen, &rtpHeader, &fneHeader); if (length > 0) { if (m_debug) - Utils::dump(1U, "FNENetwork::processNetwork(), Network Message", buffer.get(), length); + Utils::dump(1U, "TrafficNetwork::processNetwork(), Network Message", buffer.get(), length); uint32_t peerId = fneHeader.getPeerId(); NetPacketRequest* req = new NetPacketRequest(); req->obj = this; - req->diagObj = m_host->m_diagNetwork; + req->metadataObj = m_host->m_mdNetwork; req->peerId = peerId; req->address = address; @@ -471,14 +471,14 @@ void FNENetwork::processNetwork() /* Process network tree disconnect notification. */ -void FNENetwork::processNetworkTreeDisconnect(uint32_t peerId, uint32_t offendingPeerId) +void TrafficNetwork::processNetworkTreeDisconnect(uint32_t peerId, uint32_t offendingPeerId) { if (m_status != NET_STAT_MST_RUNNING) { return; } if (!m_enableSpanningTree) { - LogWarning(LOG_STP, "FNENetwork::processNetworkTreeDisconnect(), ignoring disconnect request for PEER %u, spanning tree is disabled", offendingPeerId); + LogWarning(LOG_STP, "TrafficNetwork::processNetworkTreeDisconnect(), ignoring disconnect request for PEER %u, spanning tree is disabled", offendingPeerId); return; } @@ -513,7 +513,7 @@ void FNENetwork::processNetworkTreeDisconnect(uint32_t peerId, uint32_t offendin /* Helper to process an downstream peer In-Call Control message. */ -void FNENetwork::processDownstreamInCallCtrl(network::NET_ICC::ENUM command, network::NET_SUBFUNC::ENUM subFunc, uint32_t dstId, +void TrafficNetwork::processDownstreamInCallCtrl(network::NET_ICC::ENUM command, network::NET_SUBFUNC::ENUM subFunc, uint32_t dstId, uint8_t slotNo, uint32_t peerId, uint32_t ssrc, uint32_t streamId) { if (m_disallowInCallCtrl) @@ -524,7 +524,7 @@ void FNENetwork::processDownstreamInCallCtrl(network::NET_ICC::ENUM command, net /* Updates the timer by the passed number of milliseconds. */ -void FNENetwork::clock(uint32_t ms) +void TrafficNetwork::clock(uint32_t ms) { if (m_status != NET_STAT_MST_RUNNING) { return; @@ -706,7 +706,7 @@ void FNENetwork::clock(uint32_t ms) /* Opens connection to the network. */ -bool FNENetwork::open() +bool TrafficNetwork::open() { if (m_debug) LogInfoEx(LOG_MASTER, "Opening Network"); @@ -747,7 +747,7 @@ bool FNENetwork::open() /* Closes connection to the network. */ -void FNENetwork::close() +void TrafficNetwork::close() { if (m_debug) LogInfoEx(LOG_MASTER, "Closing Network"); @@ -787,7 +787,7 @@ void FNENetwork::close() /* Entry point to parrot handler thread. */ -void* FNENetwork::threadParrotHandler(void* arg) +void* TrafficNetwork::threadParrotHandler(void* arg) { thread_t* th = (thread_t*)arg; if (th != nullptr) { @@ -798,7 +798,7 @@ void* FNENetwork::threadParrotHandler(void* arg) #endif // defined(_WIN32) std::string threadName("fne:parrot"); - FNENetwork* fne = static_cast(th->obj); + TrafficNetwork* fne = static_cast(th->obj); if (fne == nullptr) { g_killed = true; LogError(LOG_HOST, "[FAIL] %s", threadName.c_str()); @@ -897,12 +897,12 @@ void* FNENetwork::threadParrotHandler(void* arg) /* Process a data frames from the network. */ -void FNENetwork::taskNetworkRx(NetPacketRequest* req) +void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) { if (req != nullptr) { uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); - FNENetwork* network = static_cast(req->obj); + TrafficNetwork* network = static_cast(req->obj); if (network == nullptr) { if (req != nullptr) { if (req->buffer != nullptr) @@ -1387,10 +1387,9 @@ void FNENetwork::taskNetworkRx(NetPacketRequest* req) // attach extra notification data to the RPTC ACK to notify the peer of // the use of the alternate diagnostic port uint8_t buffer[1U]; - buffer[0U] = 0x00U; - if (network->m_host->m_useAlternatePortForDiagnostics) { - buffer[0U] = 0x80U; - } + buffer[0U] = 0x80U; // this should really be a defined constant -- but + // because this is the only option and its *always* sent now + // we can just hardcode this for now json::object peerConfig = connection->config(); @@ -1442,14 +1441,9 @@ void FNENetwork::taskNetworkRx(NetPacketRequest* req) lookups::PeerId peerEntry = network->m_peerListLookup->find(req->peerId); if (!peerEntry.peerDefault()) { if (peerEntry.peerReplica()) { - if (network->m_host->m_useAlternatePortForDiagnostics) { - connection->isReplica(true); - if (neighbor) - LogInfoEx(LOG_MASTER, "PEER %u >> Participates in Peer Replication", peerId); - } else { - LogError(LOG_MASTER, "PEER %u, Peer replication operations *require* the alternate diagnostics port option to be enabled.", peerId); - LogError(LOG_MASTER, "PEER %u, will not receive peer replication ACL updates.", peerId); - } + connection->isReplica(true); + if (neighbor) + LogInfoEx(LOG_MASTER, "PEER %u >> Participates in Peer Replication", peerId); } } @@ -1741,8 +1735,8 @@ void FNENetwork::taskNetworkRx(NetPacketRequest* req) uint8_t keyLength = keyItem.getKey(key); if (network->m_debug) { - LogDebugEx(LOG_HOST, "FNENetwork::threadedNetworkRx()", "keyLength = %u", keyLength); - Utils::dump(1U, "FNENetwork::taskNetworkRx(), Key", key, P25DEF::MAX_ENC_KEY_LENGTH_BYTES); + LogDebugEx(LOG_HOST, "TrafficNetwork::threadedNetworkRx()", "keyLength = %u", keyLength); + Utils::dump(1U, "TrafficNetwork::taskNetworkRx(), Key", key, P25DEF::MAX_ENC_KEY_LENGTH_BYTES); } LogInfoEx(LOG_MASTER, "PEER %u (%s) local enc. key, algId = $%02X, kID = $%04X", peerId, connection->identWithQualifier().c_str(), @@ -2089,7 +2083,7 @@ void FNENetwork::taskNetworkRx(NetPacketRequest* req) /* Checks if the passed peer ID is blocked from unit-to-unit traffic. */ -bool FNENetwork::checkU2UDroppedPeer(uint32_t peerId) +bool TrafficNetwork::checkU2UDroppedPeer(uint32_t peerId) { if (m_dropU2UPeerTable.empty()) return false; @@ -2103,7 +2097,7 @@ bool FNENetwork::checkU2UDroppedPeer(uint32_t peerId) /* Helper to dump the current spanning tree configuration to the log. */ -void FNENetwork::logSpanningTree(FNEPeerConnection* connection) +void TrafficNetwork::logSpanningTree(FNEPeerConnection* connection) { if (!m_enableSpanningTree) return; @@ -2119,7 +2113,7 @@ void FNENetwork::logSpanningTree(FNEPeerConnection* connection) /* Applies jitter buffer configuration to a peer connection. */ -void FNENetwork::applyJitterBufferConfig(uint32_t peerId, FNEPeerConnection* connection) +void TrafficNetwork::applyJitterBufferConfig(uint32_t peerId, FNEPeerConnection* connection) { if (connection == nullptr) { return; @@ -2147,7 +2141,7 @@ void FNENetwork::applyJitterBufferConfig(uint32_t peerId, FNEPeerConnection* con /* Erases a stream ID from the given peer ID connection. */ -void FNENetwork::eraseStreamPktSeq(uint32_t peerId, uint32_t streamId) +void TrafficNetwork::eraseStreamPktSeq(uint32_t peerId, uint32_t streamId) { if (peerId > 0 && (m_peers.find(peerId) != m_peers.end())) { FNEPeerConnection* connection = m_peers[peerId]; @@ -2159,7 +2153,7 @@ void FNENetwork::eraseStreamPktSeq(uint32_t peerId, uint32_t streamId) /* Helper to create a peer on the peers affiliations list. */ -void FNENetwork::createPeerAffiliations(uint32_t peerId, std::string peerName) +void TrafficNetwork::createPeerAffiliations(uint32_t peerId, std::string peerName) { erasePeerAffiliations(peerId); @@ -2170,7 +2164,7 @@ void FNENetwork::createPeerAffiliations(uint32_t peerId, std::string peerName) /* Helper to erase the peer from the peers affiliations list. */ -bool FNENetwork::erasePeerAffiliations(uint32_t peerId) +bool TrafficNetwork::erasePeerAffiliations(uint32_t peerId) { auto it = std::find_if(m_peerAffiliations.begin(), m_peerAffiliations.end(), [&](PeerAffiliationMapPair x) { return x.first == peerId; }); if (it != m_peerAffiliations.end()) { @@ -2191,7 +2185,7 @@ bool FNENetwork::erasePeerAffiliations(uint32_t peerId) /* Helper to disconnect a downstream peer. */ -void FNENetwork::disconnectPeer(uint32_t peerId, FNEPeerConnection* connection) +void TrafficNetwork::disconnectPeer(uint32_t peerId, FNEPeerConnection* connection) { if (peerId == 0U) return; @@ -2211,7 +2205,7 @@ void FNENetwork::disconnectPeer(uint32_t peerId, FNEPeerConnection* connection) /* Helper to erase the peer from the peers list. */ -void FNENetwork::erasePeer(uint32_t peerId) +void TrafficNetwork::erasePeer(uint32_t peerId) { bool neighborFNE = false; { @@ -2273,7 +2267,7 @@ void FNENetwork::erasePeer(uint32_t peerId) /* Helper to determine if the peer is local to this master. */ -bool FNENetwork::isPeerLocal(uint32_t peerId) +bool TrafficNetwork::isPeerLocal(uint32_t peerId) { m_peers.shared_lock(); auto it = std::find_if(m_peers.begin(), m_peers.end(), [&](PeerMapPair x) { return x.first == peerId; }); @@ -2288,7 +2282,7 @@ bool FNENetwork::isPeerLocal(uint32_t peerId) /* Helper to find the unit registration for the given source ID. */ -uint32_t FNENetwork::findPeerUnitReg(uint32_t srcId) +uint32_t TrafficNetwork::findPeerUnitReg(uint32_t srcId) { for (auto it = m_peerAffiliations.begin(); it != m_peerAffiliations.end(); ++it) { fne_lookups::AffiliationLookup* aff = it->second; @@ -2304,7 +2298,7 @@ uint32_t FNENetwork::findPeerUnitReg(uint32_t srcId) /* Helper to create a JSON representation of a FNE peer connection. */ -json::object FNENetwork::fneConnObject(uint32_t peerId, FNEPeerConnection *conn) +json::object TrafficNetwork::fneConnObject(uint32_t peerId, FNEPeerConnection *conn) { json::object peerObj = json::object(); peerObj["peerId"].set(peerId); @@ -2344,7 +2338,7 @@ json::object FNENetwork::fneConnObject(uint32_t peerId, FNEPeerConnection *conn) /* Helper to reset a peer connection. */ -bool FNENetwork::resetPeer(uint32_t peerId) +bool TrafficNetwork::resetPeer(uint32_t peerId) { if (peerId > 0 && (m_peers.find(peerId) != m_peers.end())) { FNEPeerConnection* connection = m_peers[peerId]; @@ -2370,7 +2364,7 @@ bool FNENetwork::resetPeer(uint32_t peerId) /* Helper to set the master is upstream peer replica flag. */ -void FNENetwork::setPeerReplica(bool replica) +void TrafficNetwork::setPeerReplica(bool replica) { if (!m_isReplica && replica) { LogInfoEx(LOG_MASTER, "Set as upstream peer replica, receiving ACL updates from upstream master"); @@ -2388,7 +2382,7 @@ void FNENetwork::setPeerReplica(bool replica) /* Helper to resolve the peer ID to its identity string. */ -std::string FNENetwork::resolvePeerIdentity(uint32_t peerId) +std::string TrafficNetwork::resolvePeerIdentity(uint32_t peerId) { auto it = std::find_if(m_peers.begin(), m_peers.end(), [&](PeerMapPair x) { return x.first == peerId; }); if (it != m_peers.end()) { @@ -2403,7 +2397,7 @@ std::string FNENetwork::resolvePeerIdentity(uint32_t peerId) /* Helper to complete setting up a repeater login request. */ -void FNENetwork::setupRepeaterLogin(uint32_t peerId, uint32_t streamId, FNEPeerConnection* connection) +void TrafficNetwork::setupRepeaterLogin(uint32_t peerId, uint32_t streamId, FNEPeerConnection* connection) { std::uniform_int_distribution dist(DVM_RAND_MIN, DVM_RAND_MAX); connection->salt(dist(m_random)); @@ -2424,11 +2418,11 @@ void FNENetwork::setupRepeaterLogin(uint32_t peerId, uint32_t streamId, FNEPeerC /* Helper to process an In-Call Control message. */ -void FNENetwork::processInCallCtrl(network::NET_ICC::ENUM command, network::NET_SUBFUNC::ENUM subFunc, uint32_t dstId, +void TrafficNetwork::processInCallCtrl(network::NET_ICC::ENUM command, network::NET_SUBFUNC::ENUM subFunc, uint32_t dstId, uint8_t slotNo, uint32_t peerId, uint32_t ssrc, uint32_t streamId) { if (m_debug) - LogDebugEx(LOG_HOST, "FNENetwork::processInCallCtrl()", "peerId = %u, command = $%02X, subFunc = $%02X, dstId = %u, slot = %u, ssrc = %u, streamId = %u", + LogDebugEx(LOG_HOST, "TrafficNetwork::processInCallCtrl()", "peerId = %u, command = $%02X, subFunc = $%02X, dstId = %u, slot = %u, ssrc = %u, streamId = %u", peerId, command, subFunc, dstId, slotNo, ssrc, streamId); if (m_disallowInCallCtrl) { @@ -2534,7 +2528,7 @@ void FNENetwork::processInCallCtrl(network::NET_ICC::ENUM command, network::NET_ /* Helper to send the network metadata to the specified peer in a separate thread. */ -void FNENetwork::peerMetadataUpdate(uint32_t peerId) +void TrafficNetwork::peerMetadataUpdate(uint32_t peerId) { MetadataUpdateRequest* req = new MetadataUpdateRequest(); req->obj = this; @@ -2550,10 +2544,10 @@ void FNENetwork::peerMetadataUpdate(uint32_t peerId) /* Helper to send the network metadata to the specified peer in a separate thread. */ -void FNENetwork::taskMetadataUpdate(MetadataUpdateRequest* req) +void TrafficNetwork::taskMetadataUpdate(MetadataUpdateRequest* req) { if (req != nullptr) { - FNENetwork* network = static_cast(req->obj); + TrafficNetwork* network = static_cast(req->obj); if (network == nullptr) { if (req != nullptr) delete req; @@ -2607,7 +2601,7 @@ void FNENetwork::taskMetadataUpdate(MetadataUpdateRequest* req) /* Helper to send the list of whitelisted RIDs to the specified peer. */ -void FNENetwork::writeWhitelistRIDs(uint32_t peerId, uint32_t streamId, bool sendReplica) +void TrafficNetwork::writeWhitelistRIDs(uint32_t peerId, uint32_t streamId, bool sendReplica) { uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); @@ -2737,7 +2731,7 @@ void FNENetwork::writeWhitelistRIDs(uint32_t peerId, uint32_t streamId, bool sen /* Helper to send the list of whitelisted RIDs to the specified peer. */ -void FNENetwork::writeBlacklistRIDs(uint32_t peerId, uint32_t streamId) +void TrafficNetwork::writeBlacklistRIDs(uint32_t peerId, uint32_t streamId) { uint64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); @@ -2807,7 +2801,7 @@ void FNENetwork::writeBlacklistRIDs(uint32_t peerId, uint32_t streamId) /* Helper to send the list of active TGIDs to the specified peer. */ -void FNENetwork::writeTGIDs(uint32_t peerId, uint32_t streamId, bool sendReplica) +void TrafficNetwork::writeTGIDs(uint32_t peerId, uint32_t streamId, bool sendReplica) { if (!m_tidLookup->sendTalkgroups()) { return; @@ -2946,7 +2940,7 @@ void FNENetwork::writeTGIDs(uint32_t peerId, uint32_t streamId, bool sendReplica /* Helper to send the list of deactivated TGIDs to the specified peer. */ -void FNENetwork::writeDeactiveTGIDs(uint32_t peerId, uint32_t streamId) +void TrafficNetwork::writeDeactiveTGIDs(uint32_t peerId, uint32_t streamId) { if (!m_tidLookup->sendTalkgroups()) { return; @@ -3004,7 +2998,7 @@ void FNENetwork::writeDeactiveTGIDs(uint32_t peerId, uint32_t streamId) /* Helper to send the list of peers to the specified peer. */ -void FNENetwork::writePeerList(uint32_t peerId, uint32_t streamId) +void TrafficNetwork::writePeerList(uint32_t peerId, uint32_t streamId) { // sending REPL style PID list to replica neighbor FNE peers FNEPeerConnection* connection = m_peers[peerId]; @@ -3066,7 +3060,7 @@ void FNENetwork::writePeerList(uint32_t peerId, uint32_t streamId) /* Helper to send the HA parameters to the specified peer. */ -void FNENetwork::writeHAParameters(uint32_t peerId, uint32_t streamId, bool sendReplica) +void TrafficNetwork::writeHAParameters(uint32_t peerId, uint32_t streamId, bool sendReplica) { if (!m_haEnabled) { return; @@ -3108,7 +3102,7 @@ void FNENetwork::writeHAParameters(uint32_t peerId, uint32_t streamId, bool send /* Helper to send a network tree disconnect to the specified peer. */ -void FNENetwork::writeTreeDisconnect(uint32_t peerId, uint32_t offendingPeerId) +void TrafficNetwork::writeTreeDisconnect(uint32_t peerId, uint32_t offendingPeerId) { if (!m_enableSpanningTree) return; @@ -3128,7 +3122,7 @@ void FNENetwork::writeTreeDisconnect(uint32_t peerId, uint32_t offendingPeerId) /* Helper to send a In-Call Control command to the specified peer. */ -bool FNENetwork::writePeerICC(uint32_t peerId, uint32_t streamId, NET_SUBFUNC::ENUM subFunc, NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo, +bool TrafficNetwork::writePeerICC(uint32_t peerId, uint32_t streamId, NET_SUBFUNC::ENUM subFunc, NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo, bool systemReq, bool toUpstream, uint32_t ssrc) { if (peerId == 0) @@ -3142,7 +3136,7 @@ bool FNENetwork::writePeerICC(uint32_t peerId, uint32_t streamId, NET_SUBFUNC::E ssrc = peerId; if (m_debug) - LogDebugEx(LOG_HOST, "FNENetwork::writePeerICC()", "peerId = %u, command = $%02X, subFunc = $%02X, dstId = %u, slot = %u, ssrc = %u, streamId = %u", + LogDebugEx(LOG_HOST, "TrafficNetwork::writePeerICC()", "peerId = %u, command = $%02X, subFunc = $%02X, dstId = %u, slot = %u, ssrc = %u, streamId = %u", peerId, command, subFunc, dstId, slotNo, ssrc, streamId); uint8_t buffer[DATA_PACKET_LENGTH]; @@ -3187,7 +3181,7 @@ bool FNENetwork::writePeerICC(uint32_t peerId, uint32_t streamId, NET_SUBFUNC::E /* Helper to send a data message to the specified peer with a explicit packet sequence. */ -bool FNENetwork::writePeer(uint32_t peerId, uint32_t ssrc, FrameQueue::OpcodePair opcode, const uint8_t* data, +bool TrafficNetwork::writePeer(uint32_t peerId, uint32_t ssrc, FrameQueue::OpcodePair opcode, const uint8_t* data, uint32_t length, uint16_t pktSeq, uint32_t streamId, bool incPktSeq) const { return writePeerQueue(nullptr, peerId, ssrc, opcode, data, length, pktSeq, streamId, incPktSeq); @@ -3195,7 +3189,7 @@ bool FNENetwork::writePeer(uint32_t peerId, uint32_t ssrc, FrameQueue::OpcodePai /* Helper to queue a data message to the specified peer with a explicit packet sequence. */ -bool FNENetwork::writePeerQueue(udp::BufferQueue* buffers, uint32_t peerId, uint32_t ssrc, FrameQueue::OpcodePair opcode, +bool TrafficNetwork::writePeerQueue(udp::BufferQueue* buffers, uint32_t peerId, uint32_t ssrc, FrameQueue::OpcodePair opcode, const uint8_t* data, uint32_t length, uint16_t pktSeq, uint32_t streamId, bool incPktSeq) const { if (streamId == 0U) { @@ -3214,7 +3208,7 @@ bool FNENetwork::writePeerQueue(udp::BufferQueue* buffers, uint32_t peerId, uint } #if DEBUG_RTP_MUX if (m_debug) - LogDebugEx(LOG_NET, "FNENetwork::writePeerQueue()", "PEER %u, streamId = %u, pktSeq = %u", peerId, streamId, pktSeq); + LogDebugEx(LOG_NET, "TrafficNetwork::writePeerQueue()", "PEER %u, streamId = %u, pktSeq = %u", peerId, streamId, pktSeq); #endif if (m_maskOutboundPeerID) ssrc = m_peerId; // mask the source SSRC to our own peer ID @@ -3246,7 +3240,7 @@ bool FNENetwork::writePeerQueue(udp::BufferQueue* buffers, uint32_t peerId, uint /* Helper to send a command message to the specified peer. */ -bool FNENetwork::writePeerCommand(uint32_t peerId, FrameQueue::OpcodePair opcode, +bool TrafficNetwork::writePeerCommand(uint32_t peerId, FrameQueue::OpcodePair opcode, const uint8_t* data, uint32_t length, uint32_t streamId, bool incPktSeq) const { if (peerId == 0) @@ -3265,7 +3259,7 @@ bool FNENetwork::writePeerCommand(uint32_t peerId, FrameQueue::OpcodePair opcode /* Helper to send a ACK response to the specified peer. */ -bool FNENetwork::writePeerACK(uint32_t peerId, uint32_t streamId, const uint8_t* data, uint32_t length) +bool TrafficNetwork::writePeerACK(uint32_t peerId, uint32_t streamId, const uint8_t* data, uint32_t length) { uint8_t buffer[DATA_PACKET_LENGTH]; ::memset(buffer, 0x00U, DATA_PACKET_LENGTH); @@ -3282,7 +3276,7 @@ bool FNENetwork::writePeerACK(uint32_t peerId, uint32_t streamId, const uint8_t* /* Helper to log a warning specifying which NAK reason is being sent a peer. */ -void FNENetwork::logPeerNAKReason(uint32_t peerId, const char* tag, NET_CONN_NAK_REASON reason) +void TrafficNetwork::logPeerNAKReason(uint32_t peerId, const char* tag, NET_CONN_NAK_REASON reason) { switch (reason) { case NET_CONN_NAK_MODE_NOT_ENABLED: @@ -3323,7 +3317,7 @@ void FNENetwork::logPeerNAKReason(uint32_t peerId, const char* tag, NET_CONN_NAK /* Helper to send a NAK response to the specified peer. */ -bool FNENetwork::writePeerNAK(uint32_t peerId, uint32_t streamId, const char* tag, NET_CONN_NAK_REASON reason) +bool TrafficNetwork::writePeerNAK(uint32_t peerId, uint32_t streamId, const char* tag, NET_CONN_NAK_REASON reason) { if (peerId == 0) return false; @@ -3342,7 +3336,7 @@ bool FNENetwork::writePeerNAK(uint32_t peerId, uint32_t streamId, const char* ta /* Helper to send a NAK response to the specified peer. */ -bool FNENetwork::writePeerNAK(uint32_t peerId, const char* tag, NET_CONN_NAK_REASON reason, sockaddr_storage& addr, uint32_t addrLen) +bool TrafficNetwork::writePeerNAK(uint32_t peerId, const char* tag, NET_CONN_NAK_REASON reason, sockaddr_storage& addr, uint32_t addrLen) { if (peerId == 0) return false; @@ -3367,7 +3361,7 @@ bool FNENetwork::writePeerNAK(uint32_t peerId, const char* tag, NET_CONN_NAK_REA /* Helper to process a FNE KMM TEK response. */ -void FNENetwork::processTEKResponse(p25::kmm::KeyItem* rspKi, uint8_t algId, uint8_t keyLength) +void TrafficNetwork::processTEKResponse(p25::kmm::KeyItem* rspKi, uint8_t algId, uint8_t keyLength) { using namespace p25::defines; using namespace p25::kmm; @@ -3390,8 +3384,8 @@ void FNENetwork::processTEKResponse(p25::kmm::KeyItem* rspKi, uint8_t algId, uin rspKi->getKey(key); if (m_debug) { - LogDebugEx(LOG_HOST, "FNENetwork::processTEKResponse()", "keyLength = %u", keyLength); - Utils::dump(1U, "FNENetwork::processTEKResponse(), Key", key, P25DEF::MAX_ENC_KEY_LENGTH_BYTES); + LogDebugEx(LOG_HOST, "TrafficNetwork::processTEKResponse()", "keyLength = %u", keyLength); + Utils::dump(1U, "TrafficNetwork::processTEKResponse(), Key", key, P25DEF::MAX_ENC_KEY_LENGTH_BYTES); } // build response buffer diff --git a/src/fne/network/FNENetwork.h b/src/fne/network/TrafficNetwork.h similarity index 97% rename from src/fne/network/FNENetwork.h rename to src/fne/network/TrafficNetwork.h index a5a916fa..653ff74b 100644 --- a/src/fne/network/FNENetwork.h +++ b/src/fne/network/TrafficNetwork.h @@ -16,13 +16,13 @@ * @brief Implementation for the FNE call handlers. * @ingroup fne_network * - * @file FNENetwork.h + * @file TrafficNetwork.h * @ingroup fne_network - * @file FNENetwork.cpp + * @file TrafficNetwork.cpp * @ingroup fne_network */ -#if !defined(__FNE_NETWORK_H__) -#define __FNE_NETWORK_H__ +#if !defined(__TRAFFIC_NETWORK_H__) +#define __TRAFFIC_NETWORK_H__ #include "fne/Defines.h" #include "common/concurrent/unordered_map.h" @@ -95,8 +95,8 @@ namespace network // Class Prototypes // --------------------------------------------------------------------------- - class HOST_SW_API DiagNetwork; - class HOST_SW_API FNENetwork; + class HOST_SW_API MetadataNetwork; + class HOST_SW_API TrafficNetwork; // --------------------------------------------------------------------------- // Structure Declaration @@ -120,7 +120,7 @@ namespace network */ struct NetPacketRequest : thread_t { uint32_t peerId; //!< Peer ID for this request. - void* diagObj; //!< Network diagnostics network object. + void* metadataObj; //!< Network metadata network object. sockaddr_storage address; //!< IP Address and Port. uint32_t addrLen; //!< @@ -137,13 +137,13 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the core FNE networking logic. + * @brief Implements the core traffic networking logic. * @ingroup fne_network */ - class HOST_SW_API FNENetwork : public BaseNetwork { + class HOST_SW_API TrafficNetwork : public BaseNetwork { public: /** - * @brief Initializes a new instance of the FNENetwork class. + * @brief Initializes a new instance of the TrafficNetwork class. * @param host Instance of the HostFNE class. * @param address Network Hostname/IP address to listen on. * @param port Network port number. @@ -166,15 +166,15 @@ namespace network * @param updateLookupTime * @param workerCnt Number of worker threads. */ - FNENetwork(HostFNE* host, const std::string& address, uint16_t port, uint32_t peerId, const std::string& password, + TrafficNetwork(HostFNE* host, const std::string& address, uint16_t port, uint32_t peerId, const std::string& password, std::string identity, bool debug, bool kmfDebug, bool verbose, bool reportPeerPing, bool dmr, bool p25, bool nxdn, bool analog, uint32_t parrotDelay, bool parrotGrantDemand, bool allowActivityTransfer, bool allowDiagnosticTransfer, uint32_t pingTime, uint32_t updateLookupTime, uint16_t workerCnt); /** - * @brief Finalizes a instance of the FNENetwork class. + * @brief Finalizes a instance of the TrafficNetwork class. */ - ~FNENetwork() override; + ~TrafficNetwork() override; /** * @brief Helper to set configuration options. @@ -289,7 +289,7 @@ namespace network void setPeerReplica(bool replica); private: - friend class DiagNetwork; + friend class MetadataNetwork; friend class callhandler::TagDMRData; friend class callhandler::packetdata::DMRPacketData; callhandler::TagDMRData* m_tagDMR; @@ -804,4 +804,4 @@ namespace network }; } // namespace network -#endif // __FNE_NETWORK_H__ +#endif // __TRAFFIC_NETWORK_H__ diff --git a/src/fne/network/callhandler/TagAnalogData.cpp b/src/fne/network/callhandler/TagAnalogData.cpp index bb405ccc..427e6e87 100644 --- a/src/fne/network/callhandler/TagAnalogData.cpp +++ b/src/fne/network/callhandler/TagAnalogData.cpp @@ -13,7 +13,7 @@ #include "common/Clock.h" #include "common/Log.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/TagAnalogData.h" #include "HostFNE.h" @@ -33,7 +33,7 @@ using namespace analog::defines; /* Initializes a new instance of the TagAnalogData class. */ -TagAnalogData::TagAnalogData(FNENetwork* network, bool debug) : +TagAnalogData::TagAnalogData(TrafficNetwork* network, bool debug) : m_network(network), m_parrotFrames(), m_parrotFramesReady(false), diff --git a/src/fne/network/callhandler/TagAnalogData.h b/src/fne/network/callhandler/TagAnalogData.h index f01a841b..3b3efaae 100644 --- a/src/fne/network/callhandler/TagAnalogData.h +++ b/src/fne/network/callhandler/TagAnalogData.h @@ -23,7 +23,7 @@ #include "common/dmr/data/NetData.h" #include "common/dmr/lc/CSBK.h" #include "common/Clock.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/packetdata/DMRPacketData.h" namespace network @@ -35,17 +35,17 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the analog call handler and data FNE networking logic. + * @brief Implements the analog call handler and data networking logic. * @ingroup fne_callhandler */ class HOST_SW_API TagAnalogData { public: /** * @brief Initializes a new instance of the TagAnalogData class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param debug Flag indicating whether network debug is enabled. */ - TagAnalogData(FNENetwork* network, bool debug); + TagAnalogData(TrafficNetwork* network, bool debug); /** * @brief Finalizes a instance of the TagAnalogData class. */ @@ -112,7 +112,7 @@ namespace network uint32_t lastParrotDstId() const { return m_lastParrotDstId; } private: - FNENetwork* m_network; + TrafficNetwork* m_network; /** * @brief Represents a stored parrot frame. diff --git a/src/fne/network/callhandler/TagDMRData.cpp b/src/fne/network/callhandler/TagDMRData.cpp index f99a8f54..33fb4b34 100644 --- a/src/fne/network/callhandler/TagDMRData.cpp +++ b/src/fne/network/callhandler/TagDMRData.cpp @@ -16,7 +16,7 @@ #include "common/Clock.h" #include "common/Log.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/TagDMRData.h" #include "HostFNE.h" #include "FNEMain.h" @@ -37,7 +37,7 @@ using namespace dmr::defines; /* Initializes a new instance of the TagDMRData class. */ -TagDMRData::TagDMRData(FNENetwork* network, bool debug) : +TagDMRData::TagDMRData(TrafficNetwork* network, bool debug) : m_network(network), m_parrotFrames(), m_parrotFramesReady(false), diff --git a/src/fne/network/callhandler/TagDMRData.h b/src/fne/network/callhandler/TagDMRData.h index 1786531a..4890a6cb 100644 --- a/src/fne/network/callhandler/TagDMRData.h +++ b/src/fne/network/callhandler/TagDMRData.h @@ -23,7 +23,7 @@ #include "common/dmr/data/NetData.h" #include "common/dmr/lc/CSBK.h" #include "common/Clock.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/packetdata/DMRPacketData.h" namespace network @@ -35,17 +35,17 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the DMR call handler and data FNE networking logic. + * @brief Implements the DMR call handler and data networking logic. * @ingroup fne_callhandler */ class HOST_SW_API TagDMRData { public: /** * @brief Initializes a new instance of the TagDMRData class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param debug Flag indicating whether network debug is enabled. */ - TagDMRData(FNENetwork* network, bool debug); + TagDMRData(TrafficNetwork* network, bool debug); /** * @brief Finalizes a instance of the TagDMRData class. */ @@ -148,7 +148,7 @@ namespace network packetdata::DMRPacketData* packetData() { return m_packetData; } private: - FNENetwork* m_network; + TrafficNetwork* m_network; /** * @brief Represents a stored parrot frame. diff --git a/src/fne/network/callhandler/TagNXDNData.cpp b/src/fne/network/callhandler/TagNXDNData.cpp index 1cec13df..25aaf790 100644 --- a/src/fne/network/callhandler/TagNXDNData.cpp +++ b/src/fne/network/callhandler/TagNXDNData.cpp @@ -20,7 +20,7 @@ #include "common/Clock.h" #include "common/Log.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/TagNXDNData.h" #include "HostFNE.h" #include "FNEMain.h" @@ -40,7 +40,7 @@ using namespace nxdn::defines; /* Initializes a new instance of the TagNXDNData class. */ -TagNXDNData::TagNXDNData(FNENetwork* network, bool debug) : +TagNXDNData::TagNXDNData(TrafficNetwork* network, bool debug) : m_network(network), m_parrotFrames(), m_parrotFramesReady(false), diff --git a/src/fne/network/callhandler/TagNXDNData.h b/src/fne/network/callhandler/TagNXDNData.h index 427cf5ba..4056901b 100644 --- a/src/fne/network/callhandler/TagNXDNData.h +++ b/src/fne/network/callhandler/TagNXDNData.h @@ -23,7 +23,7 @@ #include "common/nxdn/NXDNDefines.h" #include "common/nxdn/lc/RTCH.h" #include "common/nxdn/lc/RCCH.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" namespace network { @@ -34,17 +34,17 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the NXDN call handler and data FNE networking logic. + * @brief Implements the NXDN call handler and data networking logic. * @ingroup fne_callhandler */ class HOST_SW_API TagNXDNData { public: /** * @brief Initializes a new instance of the TagNXDNData class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param debug Flag indicating whether network debug is enabled. */ - TagNXDNData(FNENetwork* network, bool debug); + TagNXDNData(TrafficNetwork* network, bool debug); /** * @brief Finalizes a instance of the TagNXDNData class. */ @@ -122,7 +122,7 @@ namespace network uint32_t lastParrotDstId() const { return m_lastParrotDstId; } private: - FNENetwork* m_network; + TrafficNetwork* m_network; /** * @brief Represents a stored parrot frame. diff --git a/src/fne/network/callhandler/TagP25Data.cpp b/src/fne/network/callhandler/TagP25Data.cpp index 1d103752..3b0ffe5a 100644 --- a/src/fne/network/callhandler/TagP25Data.cpp +++ b/src/fne/network/callhandler/TagP25Data.cpp @@ -15,7 +15,7 @@ #include "common/Log.h" #include "common/Thread.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/TagP25Data.h" #include "HostFNE.h" #include "FNEMain.h" @@ -42,7 +42,7 @@ const uint32_t GRANT_TIMER_TIMEOUT = 15U; /* Initializes a new instance of the TagP25Data class. */ -TagP25Data::TagP25Data(FNENetwork* network, bool debug) : +TagP25Data::TagP25Data(TrafficNetwork* network, bool debug) : m_network(network), m_parrotFrames(), m_parrotFramesReady(false), diff --git a/src/fne/network/callhandler/TagP25Data.h b/src/fne/network/callhandler/TagP25Data.h index 53fa700e..c98b3247 100644 --- a/src/fne/network/callhandler/TagP25Data.h +++ b/src/fne/network/callhandler/TagP25Data.h @@ -28,7 +28,7 @@ #include "common/p25/lc/LC.h" #include "common/p25/lc/TSBK.h" #include "common/p25/lc/TDULC.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/packetdata/P25PacketData.h" namespace network @@ -40,17 +40,17 @@ namespace network // --------------------------------------------------------------------------- /** - * @brief Implements the P25 call handler and data FNE networking logic. + * @brief Implements the P25 call handler and data networking logic. * @ingroup fne_callhandler */ class HOST_SW_API TagP25Data { public: /** * @brief Initializes a new instance of the TagP25Data class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param debug Flag indicating whether network debug is enabled. */ - TagP25Data(FNENetwork* network, bool debug); + TagP25Data(TrafficNetwork* network, bool debug); /** * @brief Finalizes a instance of the TagP25Data class. */ @@ -170,7 +170,7 @@ namespace network packetdata::P25PacketData* packetData() { return m_packetData; } private: - FNENetwork* m_network; + TrafficNetwork* m_network; /** * @brief Represents a stored parrot frame. diff --git a/src/fne/network/callhandler/packetdata/DMRPacketData.cpp b/src/fne/network/callhandler/packetdata/DMRPacketData.cpp index 2cc7686b..9114020c 100644 --- a/src/fne/network/callhandler/packetdata/DMRPacketData.cpp +++ b/src/fne/network/callhandler/packetdata/DMRPacketData.cpp @@ -17,7 +17,7 @@ #include "common/Log.h" #include "common/Thread.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/callhandler/packetdata/DMRPacketData.h" #include "HostFNE.h" @@ -51,7 +51,7 @@ const uint32_t ARP_RETRY_MS = 5000U; // milliseconds /* Initializes a new instance of the DMRPacketData class. */ -DMRPacketData::DMRPacketData(FNENetwork* network, TagDMRData* tag, bool debug) : +DMRPacketData::DMRPacketData(TrafficNetwork* network, TagDMRData* tag, bool debug) : m_network(network), m_tag(tag), m_queuedFrames(), diff --git a/src/fne/network/callhandler/packetdata/DMRPacketData.h b/src/fne/network/callhandler/packetdata/DMRPacketData.h index 73f6951d..7d15195d 100644 --- a/src/fne/network/callhandler/packetdata/DMRPacketData.h +++ b/src/fne/network/callhandler/packetdata/DMRPacketData.h @@ -22,7 +22,7 @@ #include "common/concurrent/unordered_map.h" #include "common/dmr/DMRDefines.h" #include "common/dmr/data/DataHeader.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/PeerNetwork.h" #include "network/callhandler/TagDMRData.h" @@ -46,11 +46,11 @@ namespace network public: /** * @brief Initializes a new instance of the DMRPacketData class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param tag Instance of the TagDMRData class. * @param debug Flag indicating whether network debug is enabled. */ - DMRPacketData(FNENetwork* network, TagDMRData* tag, bool debug); + DMRPacketData(TrafficNetwork* network, TagDMRData* tag, bool debug); /** * @brief Finalizes a instance of the P25PacketData class. */ @@ -98,7 +98,7 @@ namespace network void cleanupStale(); private: - FNENetwork* m_network; + TrafficNetwork* m_network; TagDMRData *m_tag; /** diff --git a/src/fne/network/callhandler/packetdata/P25PacketData.cpp b/src/fne/network/callhandler/packetdata/P25PacketData.cpp index 3c4343fb..f1a714e5 100644 --- a/src/fne/network/callhandler/packetdata/P25PacketData.cpp +++ b/src/fne/network/callhandler/packetdata/P25PacketData.cpp @@ -16,7 +16,7 @@ #include "common/Log.h" #include "common/Thread.h" #include "common/Utils.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/P25OTARService.h" #include "network/callhandler/packetdata/P25PacketData.h" #include "HostFNE.h" @@ -55,7 +55,7 @@ const uint32_t SUBSCRIBER_READY_RETRY_MS = 1000U; // milliseconds /* Initializes a new instance of the P25PacketData class. */ -P25PacketData::P25PacketData(FNENetwork* network, TagP25Data* tag, bool debug) : +P25PacketData::P25PacketData(TrafficNetwork* network, TagP25Data* tag, bool debug) : m_network(network), m_tag(tag), m_assembler(nullptr), diff --git a/src/fne/network/callhandler/packetdata/P25PacketData.h b/src/fne/network/callhandler/packetdata/P25PacketData.h index cac67399..474dfa71 100644 --- a/src/fne/network/callhandler/packetdata/P25PacketData.h +++ b/src/fne/network/callhandler/packetdata/P25PacketData.h @@ -24,7 +24,7 @@ #include "common/p25/data/Assembler.h" #include "common/p25/data/DataHeader.h" #include "common/p25/data/DataBlock.h" -#include "network/FNENetwork.h" +#include "network/TrafficNetwork.h" #include "network/PeerNetwork.h" #include "network/callhandler/TagP25Data.h" @@ -48,11 +48,11 @@ namespace network public: /** * @brief Initializes a new instance of the P25PacketData class. - * @param network Instance of the FNENetwork class. + * @param network Instance of the TrafficNetwork class. * @param tag Instance of the TagP25Data class. * @param debug Flag indicating whether network debug is enabled. */ - P25PacketData(FNENetwork* network, TagP25Data* tag, bool debug); + P25PacketData(TrafficNetwork* network, TagP25Data* tag, bool debug); /** * @brief Finalizes a instance of the P25PacketData class. */ @@ -111,7 +111,7 @@ namespace network void cleanupStale(); private: - FNENetwork* m_network; + TrafficNetwork* m_network; TagP25Data* m_tag; p25::data::Assembler* m_assembler; diff --git a/src/fne/restapi/RESTAPI.cpp b/src/fne/restapi/RESTAPI.cpp index e531b826..60a023be 100644 --- a/src/fne/restapi/RESTAPI.cpp +++ b/src/fne/restapi/RESTAPI.cpp @@ -567,9 +567,9 @@ void RESTAPI::setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRu m_cryptoLookup = cryptoLookup; } -/* Sets the instance of the FNE network. */ +/* Sets the instance of the traffic network. */ -void RESTAPI::setNetwork(network::FNENetwork* network) +void RESTAPI::setNetwork(network::TrafficNetwork* network) { m_network = network; } diff --git a/src/fne/restapi/RESTAPI.h b/src/fne/restapi/RESTAPI.h index aa59f0e7..2e16fd57 100644 --- a/src/fne/restapi/RESTAPI.h +++ b/src/fne/restapi/RESTAPI.h @@ -37,7 +37,7 @@ // --------------------------------------------------------------------------- class HOST_SW_API HostFNE; -namespace network { class HOST_SW_API FNENetwork; } +namespace network { class HOST_SW_API TrafficNetwork; } // --------------------------------------------------------------------------- // Class Declaration @@ -79,10 +79,10 @@ public: ::lookups::PeerListLookup* peerListLookup, ::lookups::AdjSiteMapLookup* adjPeerMapLookup, CryptoContainer* cryptoLookup); /** - * @brief Sets the instance of the FNE network. - * @param network Instance oft he FNENetwork class. + * @brief Sets the instance of the traffic network. + * @param network Instance of the TrafficNetwork class. */ - void setNetwork(::network::FNENetwork* network); + void setNetwork(::network::TrafficNetwork* network); /** * @brief Opens connection to the network. @@ -112,7 +112,7 @@ private: bool m_debug; HostFNE* m_host; - network::FNENetwork* m_network; + network::TrafficNetwork* m_network; ::lookups::RadioIdLookup* m_ridLookup; ::lookups::TalkgroupRulesLookup* m_tidLookup;