reorganize source tree to make class usage more clear (the Tag*Data classes are the call router/data handler classes); enhance logging for call collision to report RxStatus;

3.6-maint
Bryan Biedenkapp 2 years ago
parent 3be3366e5f
commit 9cf87ff00c

@ -14,8 +14,8 @@ file(GLOB dvmfne_SRC
"src/host/network/Network.h" "src/host/network/Network.h"
"src/host/network/Network.cpp" "src/host/network/Network.cpp"
"src/fne/network/fne/*.h" "src/fne/network/callhandler/*.h"
"src/fne/network/fne/*.cpp" "src/fne/network/callhandler/*.cpp"
"src/fne/network/influxdb/*.h" "src/fne/network/influxdb/*.h"
"src/fne/network/*.h" "src/fne/network/*.h"
"src/fne/network/*.cpp" "src/fne/network/*.cpp"

@ -16,9 +16,9 @@
#include "common/StopWatch.h" #include "common/StopWatch.h"
#include "common/Thread.h" #include "common/Thread.h"
#include "common/ThreadFunc.h" #include "common/ThreadFunc.h"
#include "network/fne/TagDMRData.h" #include "network/callhandler/TagDMRData.h"
#include "network/fne/TagP25Data.h" #include "network/callhandler/TagP25Data.h"
#include "network/fne/TagNXDNData.h" #include "network/callhandler/TagNXDNData.h"
#include "ActivityLog.h" #include "ActivityLog.h"
#include "HostFNE.h" #include "HostFNE.h"
#include "FNEMain.h" #include "FNEMain.h"

@ -32,9 +32,9 @@
// Class Prototypes // Class Prototypes
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
namespace network { namespace fne { class HOST_SW_API TagDMRData; } } namespace network { namespace callhandler { class HOST_SW_API TagDMRData; } }
namespace network { namespace fne { class HOST_SW_API TagP25Data; } } namespace network { namespace callhandler { class HOST_SW_API TagP25Data; } }
namespace network { namespace fne { class HOST_SW_API TagNXDNData; } } namespace network { namespace callhandler { class HOST_SW_API TagNXDNData; } }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
@ -56,9 +56,9 @@ private:
yaml::Node m_conf; yaml::Node m_conf;
friend class network::FNENetwork; friend class network::FNENetwork;
friend class network::fne::TagDMRData; friend class network::callhandler::TagDMRData;
friend class network::fne::TagP25Data; friend class network::callhandler::TagP25Data;
friend class network::fne::TagNXDNData; friend class network::callhandler::TagNXDNData;
network::FNENetwork* m_network; network::FNENetwork* m_network;
network::DiagNetwork* m_diagNetwork; network::DiagNetwork* m_diagNetwork;

@ -18,7 +18,7 @@
#include "HostFNE.h" #include "HostFNE.h"
using namespace network; using namespace network;
using namespace network::fne; using namespace network::callhandler;
#include <cassert> #include <cassert>

@ -16,14 +16,14 @@
#include "common/Log.h" #include "common/Log.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "network/FNENetwork.h" #include "network/FNENetwork.h"
#include "network/fne/TagDMRData.h" #include "network/callhandler/TagDMRData.h"
#include "network/fne/TagP25Data.h" #include "network/callhandler/TagP25Data.h"
#include "network/fne/TagNXDNData.h" #include "network/callhandler/TagNXDNData.h"
#include "fne/ActivityLog.h" #include "fne/ActivityLog.h"
#include "HostFNE.h" #include "HostFNE.h"
using namespace network; using namespace network;
using namespace network::fne; using namespace network::callhandler;
#include <cassert> #include <cassert>
#include <cerrno> #include <cerrno>

@ -36,9 +36,9 @@
class HOST_SW_API HostFNE; class HOST_SW_API HostFNE;
class HOST_SW_API RESTAPI; class HOST_SW_API RESTAPI;
namespace network { namespace fne { class HOST_SW_API TagDMRData; } } namespace network { namespace callhandler { class HOST_SW_API TagDMRData; } }
namespace network { namespace fne { class HOST_SW_API TagP25Data; } } namespace network { namespace callhandler { class HOST_SW_API TagP25Data; } }
namespace network { namespace fne { class HOST_SW_API TagNXDNData; } } namespace network { namespace callhandler { class HOST_SW_API TagNXDNData; } }
namespace network namespace network
{ {
@ -235,12 +235,12 @@ namespace network
/// <summary>Gets the current status of the network.</summary> /// <summary>Gets the current status of the network.</summary>
NET_CONN_STATUS getStatus() { return m_status; } NET_CONN_STATUS getStatus() { return m_status; }
/// <summary>Gets the instance of the DMR traffic handler.</summary> /// <summary>Gets the instance of the DMR call handler.</summary>
fne::TagDMRData* dmrTrafficHandler() const { return m_tagDMR; } callhandler::TagDMRData* dmrTrafficHandler() const { return m_tagDMR; }
/// <summary>Gets the instance of the P25 traffic handler.</summary> /// <summary>Gets the instance of the P25 call handler.</summary>
fne::TagP25Data* p25TrafficHandler() const { return m_tagP25; } callhandler::TagP25Data* p25TrafficHandler() const { return m_tagP25; }
/// <summary>Gets the instance of the NXDN traffic handler.</summary> /// <summary>Gets the instance of the NXDN call handler.</summary>
fne::TagNXDNData* nxdnTrafficHandler() const { return m_tagNXDN; } callhandler::TagNXDNData* nxdnTrafficHandler() const { return m_tagNXDN; }
/// <summary>Sets the instances of the Radio ID and Talkgroup Rules lookup tables.</summary> /// <summary>Sets the instances of the Radio ID and Talkgroup Rules lookup tables.</summary>
void setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRulesLookup* tidLookup, lookups::PeerListLookup* peerListLookup); void setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRulesLookup* tidLookup, lookups::PeerListLookup* peerListLookup);
@ -264,12 +264,12 @@ namespace network
private: private:
friend class DiagNetwork; friend class DiagNetwork;
friend class fne::TagDMRData; friend class callhandler::TagDMRData;
fne::TagDMRData* m_tagDMR; callhandler::TagDMRData* m_tagDMR;
friend class fne::TagP25Data; friend class callhandler::TagP25Data;
fne::TagP25Data* m_tagP25; callhandler::TagP25Data* m_tagP25;
friend class fne::TagNXDNData; friend class callhandler::TagNXDNData;
fne::TagNXDNData* m_tagNXDN; callhandler::TagNXDNData* m_tagNXDN;
friend class ::RESTAPI; friend class ::RESTAPI;
HostFNE* m_host; HostFNE* m_host;

@ -17,8 +17,8 @@
#include "common/network/json/json.h" #include "common/network/json/json.h"
#include "common/Log.h" #include "common/Log.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "fne/network/fne/TagDMRData.h" #include "fne/network/callhandler/TagDMRData.h"
#include "fne/network/fne/TagP25Data.h" #include "fne/network/callhandler/TagP25Data.h"
#include "fne/network/RESTAPI.h" #include "fne/network/RESTAPI.h"
#include "HostFNE.h" #include "HostFNE.h"

@ -20,12 +20,12 @@
#include "common/Log.h" #include "common/Log.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "network/FNENetwork.h" #include "network/FNENetwork.h"
#include "network/fne/TagDMRData.h" #include "network/callhandler/TagDMRData.h"
#include "HostFNE.h" #include "HostFNE.h"
using namespace system_clock; using namespace system_clock;
using namespace network; using namespace network;
using namespace network::fne; using namespace network::callhandler;
using namespace dmr; using namespace dmr;
#include <cassert> #include <cassert>
@ -188,7 +188,8 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
RxStatus status = it->second; RxStatus status = it->second;
if (streamId != status.streamId) { if (streamId != status.streamId) {
if (status.srcId != 0U && status.srcId != srcId) { if (status.srcId != 0U && status.srcId != srcId) {
LogWarning(LOG_NET, "DMR, Call Collision, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogWarning(LOG_NET, "DMR, Call Collision, peer = %u, srcId = %u, dstId = %u, slotNo = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxSlotNo = %u, rxStreamId = %u, external = %u",
peerId, srcId, dstId, slotNo, streamId, status.peerId, status.srcId, status.dstId, status.slotNo, status.streamId, external);
return false; return false;
} }
} }
@ -215,6 +216,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
status.dstId = dstId; status.dstId = dstId;
status.slotNo = slotNo; status.slotNo = slotNo;
status.streamId = streamId; status.streamId = streamId;
status.peerId = peerId;
m_status[dstId] = status; // this *could* be an issue if a dstId appears on both slots somehow... m_status[dstId] = status; // this *could* be an issue if a dstId appears on both slots somehow...
LogMessage(LOG_NET, "DMR, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogMessage(LOG_NET, "DMR, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external);

@ -10,8 +10,8 @@
* Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL
* *
*/ */
#if !defined(__FNE__TAG_DMR_DATA_H__) #if !defined(__CALLHANDLER__TAG_DMR_DATA_H__)
#define __FNE__TAG_DMR_DATA_H__ #define __CALLHANDLER__TAG_DMR_DATA_H__
#include "fne/Defines.h" #include "fne/Defines.h"
#include "common/dmr/DMRDefines.h" #include "common/dmr/DMRDefines.h"
@ -24,11 +24,11 @@
namespace network namespace network
{ {
namespace fne namespace callhandler
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// Implements the DMR data FNE networking logic. // Implements the DMR call handler and data FNE networking logic.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class HOST_SW_API TagDMRData { class HOST_SW_API TagDMRData {
@ -80,6 +80,7 @@ namespace network
uint32_t dstId; uint32_t dstId;
uint8_t slotNo; uint8_t slotNo;
uint32_t streamId; uint32_t streamId;
uint32_t peerId;
}; };
typedef std::pair<const uint32_t, RxStatus> StatusMapPair; typedef std::pair<const uint32_t, RxStatus> StatusMapPair;
std::unordered_map<uint32_t, RxStatus> m_status; std::unordered_map<uint32_t, RxStatus> m_status;
@ -105,7 +106,7 @@ namespace network
/// <summary>Helper to write a network CSBK.</summary> /// <summary>Helper to write a network CSBK.</summary>
void write_CSBK(uint32_t peerId, uint8_t slot, dmr::lc::CSBK* csbk); void write_CSBK(uint32_t peerId, uint8_t slot, dmr::lc::CSBK* csbk);
}; };
} // namespace fne } // namespace callhandler
} // namespace network } // namespace network
#endif // __FNE__TAG_DMR_DATA_H__ #endif // __CALLHANDLER__TAG_DMR_DATA_H__

@ -22,12 +22,12 @@
#include "common/Log.h" #include "common/Log.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "network/FNENetwork.h" #include "network/FNENetwork.h"
#include "network/fne/TagNXDNData.h" #include "network/callhandler/TagNXDNData.h"
#include "HostFNE.h" #include "HostFNE.h"
using namespace system_clock; using namespace system_clock;
using namespace network; using namespace network;
using namespace network::fne; using namespace network::callhandler;
using namespace nxdn; using namespace nxdn;
#include <cassert> #include <cassert>
@ -160,7 +160,8 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
RxStatus status = m_status[dstId]; RxStatus status = m_status[dstId];
if (streamId != status.streamId) { if (streamId != status.streamId) {
if (status.srcId != 0U && status.srcId != srcId) { if (status.srcId != 0U && status.srcId != srcId) {
LogWarning(LOG_NET, "NXDN, Call Collision, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogWarning(LOG_NET, "NXDN, Call Collision, peer = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, external = %u",
peerId, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, external);
return false; return false;
} }
} }
@ -186,6 +187,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
status.srcId = srcId; status.srcId = srcId;
status.dstId = dstId; status.dstId = dstId;
status.streamId = streamId; status.streamId = streamId;
status.peerId = peerId;
m_status[dstId] = status; m_status[dstId] = status;
LogMessage(LOG_NET, "NXDN, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogMessage(LOG_NET, "NXDN, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external);

@ -10,8 +10,8 @@
* Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL
* *
*/ */
#if !defined(__FNE__TAG_NXDN_DATA_H__) #if !defined(__CALLHANDLER__TAG_NXDN_DATA_H__)
#define __FNE__TAG_NXDN_DATA_H__ #define __CALLHANDLER__TAG_NXDN_DATA_H__
#include "fne/Defines.h" #include "fne/Defines.h"
#include "common/Clock.h" #include "common/Clock.h"
@ -24,11 +24,11 @@
namespace network namespace network
{ {
namespace fne namespace callhandler
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// Implements the NXDN data FNE networking logic. // Implements the NXDN call handler and data FNE networking logic.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class HOST_SW_API TagNXDNData { class HOST_SW_API TagNXDNData {
@ -72,6 +72,7 @@ namespace network
uint32_t srcId; uint32_t srcId;
uint32_t dstId; uint32_t dstId;
uint32_t streamId; uint32_t streamId;
uint32_t peerId;
}; };
typedef std::pair<const uint32_t, RxStatus> StatusMapPair; typedef std::pair<const uint32_t, RxStatus> StatusMapPair;
std::unordered_map<uint32_t, RxStatus> m_status; std::unordered_map<uint32_t, RxStatus> m_status;
@ -94,7 +95,7 @@ namespace network
/// <summary>Helper to write a network RCCH.</summary> /// <summary>Helper to write a network RCCH.</summary>
void write_Message(uint32_t peerId, nxdn::lc::RCCH* rcch); void write_Message(uint32_t peerId, nxdn::lc::RCCH* rcch);
}; };
} // namespace fne } // namespace callhandler
} // namespace network } // namespace network
#endif // __FNE__TAG_NXDN_DATA_H__ #endif // __CALLHANDLER__TAG_NXDN_DATA_H__

@ -18,12 +18,12 @@
#include "common/Thread.h" #include "common/Thread.h"
#include "common/Utils.h" #include "common/Utils.h"
#include "network/FNENetwork.h" #include "network/FNENetwork.h"
#include "network/fne/TagP25Data.h" #include "network/callhandler/TagP25Data.h"
#include "HostFNE.h" #include "HostFNE.h"
using namespace system_clock; using namespace system_clock;
using namespace network; using namespace network;
using namespace network::fne; using namespace network::callhandler;
using namespace p25; using namespace p25;
#include <cassert> #include <cassert>
@ -218,7 +218,8 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
RxStatus status = m_status[dstId]; RxStatus status = m_status[dstId];
if (streamId != status.streamId && ((duid != P25_DUID_TDU) && (duid != P25_DUID_TDULC))) { if (streamId != status.streamId && ((duid != P25_DUID_TDU) && (duid != P25_DUID_TDULC))) {
if (status.srcId != 0U && status.srcId != srcId) { if (status.srcId != 0U && status.srcId != srcId) {
LogWarning(LOG_NET, "P25, Call Collision, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogWarning(LOG_NET, "P25, Call Collision, peer = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, external = %u",
peerId, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, external);
return false; return false;
} }
} }
@ -244,6 +245,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
status.srcId = srcId; status.srcId = srcId;
status.dstId = dstId; status.dstId = dstId;
status.streamId = streamId; status.streamId = streamId;
status.peerId = peerId;
m_status[dstId] = status; m_status[dstId] = status;
LogMessage(LOG_NET, "P25, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external); LogMessage(LOG_NET, "P25, Call Start, peer = %u, srcId = %u, dstId = %u, streamId = %u, external = %u", peerId, srcId, dstId, streamId, external);

@ -10,8 +10,8 @@
* Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL * Copyright (C) 2023-2024 Bryan Biedenkapp, N2PLL
* *
*/ */
#if !defined(__FNE__TAG_P25_DATA_H__) #if !defined(__CALLHANDLER__TAG_P25_DATA_H__)
#define __FNE__TAG_P25_DATA_H__ #define __CALLHANDLER__TAG_P25_DATA_H__
#include "fne/Defines.h" #include "fne/Defines.h"
#include "common/Clock.h" #include "common/Clock.h"
@ -29,11 +29,11 @@
namespace network namespace network
{ {
namespace fne namespace callhandler
{ {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
// Implements the P25 data FNE networking logic. // Implements the P25 call handler and data FNE networking logic.
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class HOST_SW_API TagP25Data { class HOST_SW_API TagP25Data {
@ -89,6 +89,7 @@ namespace network
uint32_t srcId; uint32_t srcId;
uint32_t dstId; uint32_t dstId;
uint32_t streamId; uint32_t streamId;
uint32_t peerId;
}; };
typedef std::pair<const uint32_t, RxStatus> StatusMapPair; typedef std::pair<const uint32_t, RxStatus> StatusMapPair;
std::unordered_map<uint32_t, RxStatus> m_status; std::unordered_map<uint32_t, RxStatus> m_status;
@ -120,7 +121,7 @@ namespace network
/// <summary>Helper to write a network TSDU.</summary> /// <summary>Helper to write a network TSDU.</summary>
void write_TSDU(uint32_t peerId, p25::lc::TSBK* tsbk); void write_TSDU(uint32_t peerId, p25::lc::TSBK* tsbk);
}; };
} // namespace fne } // namespace callhandler
} // namespace network } // namespace network
#endif // __FNE__TAG_P25_DATA_H__ #endif // __CALLHANDLER__TAG_P25_DATA_H__
Loading…
Cancel
Save

Powered by TurnKey Linux.