diff --git a/configs/talkgroup_rules.example.yml b/configs/talkgroup_rules.example.yml
index 5fffbbbd..73a56508 100644
--- a/configs/talkgroup_rules.example.yml
+++ b/configs/talkgroup_rules.example.yml
@@ -20,8 +20,8 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations: []
+ # List of peer talkgroup rewrites.
+ rewrite: []
#
# Source Configuration
#
@@ -45,8 +45,8 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations: []
+ # List of peer talkgroup rewrites.
+ rewrite: []
#
# Source Configuration
#
@@ -70,9 +70,9 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations:
- # Network Peer ID to mutate.
+ # List of peer talkgroup rewrites.
+ rewrite:
+ # Network Peer ID to rewrite this TGID for.
- peerid: 9000990
# Numerical talkgroup ID number.
tgid: 9999
@@ -99,8 +99,8 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations: []
+ # List of peer talkgroup rewrites.
+ rewrite: []
#
# Source Configuration
#
@@ -122,8 +122,8 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations: []
+ # List of peer talkgroup rewrites.
+ rewrite: []
#
# Source Configuration
#
@@ -145,8 +145,8 @@ groupVoice:
inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
exclusion: []
- # List of peer talkgroup mutations.
- mutations: []
+ # List of peer talkgroup rewrites.
+ rewrite: []
#
# Source Configuration
#
diff --git a/src/common/lookups/TalkgroupRulesLookup.cpp b/src/common/lookups/TalkgroupRulesLookup.cpp
index 6479bba5..7943bf26 100644
--- a/src/common/lookups/TalkgroupRulesLookup.cpp
+++ b/src/common/lookups/TalkgroupRulesLookup.cpp
@@ -271,7 +271,7 @@ TalkgroupRuleGroupVoice TalkgroupRulesLookup::find(uint32_t id, uint8_t slot)
/// Unique identifier for table entry.
/// DMR slot this talkgroup is valid on.
/// Table entry.
-TalkgroupRuleGroupVoice TalkgroupRulesLookup::findByMutation(uint32_t peerId, uint32_t id, uint8_t slot)
+TalkgroupRuleGroupVoice TalkgroupRulesLookup::findByRewrite(uint32_t peerId, uint32_t id, uint8_t slot)
{
TalkgroupRuleGroupVoice entry;
@@ -280,11 +280,11 @@ TalkgroupRuleGroupVoice TalkgroupRulesLookup::findByMutation(uint32_t peerId, ui
auto it = std::find_if(m_groupVoice.begin(), m_groupVoice.end(),
[&](TalkgroupRuleGroupVoice x)
{
- if (x.config().mutation().size() == 0)
+ if (x.config().rewrite().size() == 0)
return false;
- auto innerIt = std::find_if(x.config().mutation().begin(), x.config().mutation().end(),
- [&](TalkgroupRuleMutation y)
+ auto innerIt = std::find_if(x.config().rewrite().begin(), x.config().rewrite().end(),
+ [&](TalkgroupRuleRewrite y)
{
if (slot != 0U) {
return y.peerId() == peerId && y.tgId() == id && y.tgSlot() == slot;
@@ -293,7 +293,7 @@ TalkgroupRuleGroupVoice TalkgroupRulesLookup::findByMutation(uint32_t peerId, ui
return y.peerId() == peerId && y.tgId() == id;
});
- if (innerIt != x.config().mutation().end())
+ if (innerIt != x.config().rewrite().end())
return true;
return false;
});
@@ -367,12 +367,13 @@ bool TalkgroupRulesLookup::load()
uint32_t incCount = groupVoice.config().inclusion().size();
uint32_t excCount = groupVoice.config().exclusion().size();
+ uint32_t rewrCount = groupVoice.config().rewrite().size();
if (incCount > 0 && excCount > 0) {
::LogWarning(LOG_HOST, "Talkgroup (%s) defines both inclusions and exclusions! Inclusions take precedence and exclusions will be ignored.", groupName.c_str());
}
- ::LogInfoEx(LOG_HOST, "Talkgroup NAME: %s SRC_TGID: %u SRC_TS: %u ACTIVE: %u PARROT: %u INCLUSIONS: %u EXCLUSIONS: %u", groupName.c_str(), tgId, tgSlot, active, parrot, incCount, excCount);
+ ::LogInfoEx(LOG_HOST, "Talkgroup NAME: %s SRC_TGID: %u SRC_TS: %u ACTIVE: %u PARROT: %u INCLUSIONS: %u EXCLUSIONS: %u REWRITES: %u", groupName.c_str(), tgId, tgSlot, active, parrot, incCount, excCount, rewrCount);
}
}
m_mutex.unlock();
diff --git a/src/common/lookups/TalkgroupRulesLookup.h b/src/common/lookups/TalkgroupRulesLookup.h
index 55409403..f6453abc 100644
--- a/src/common/lookups/TalkgroupRulesLookup.h
+++ b/src/common/lookups/TalkgroupRulesLookup.h
@@ -81,31 +81,31 @@ namespace lookups
// ---------------------------------------------------------------------------
// Class Declaration
- // Represents an mutation block for a routing rule.
+ // Represents an rewrite block for a routing rule rewrites.
// ---------------------------------------------------------------------------
- class HOST_SW_API TalkgroupRuleMutation {
+ class HOST_SW_API TalkgroupRuleRewrite {
public:
- /// Initializes a new insatnce of the TalkgroupRuleMutation class.
- TalkgroupRuleMutation() :
+ /// Initializes a new insatnce of the TalkgroupRuleRewrite class.
+ TalkgroupRuleRewrite() :
m_peerId(0U),
m_tgId(0U),
m_tgSlot(0U)
{
/* stub */
}
- /// Initializes a new insatnce of the TalkgroupRuleMutation class.
+ /// Initializes a new insatnce of the TalkgroupRuleRewrite class.
///
- TalkgroupRuleMutation(yaml::Node& node) :
- TalkgroupRuleMutation()
+ TalkgroupRuleRewrite(yaml::Node& node) :
+ TalkgroupRuleRewrite()
{
m_peerId = node["peerId"].as(0U);
m_tgId = node["tgid"].as(0U);
m_tgSlot = (uint8_t)node["slot"].as(0U);
}
- /// Equals operator. Copies this TalkgroupRuleMutation to another TalkgroupRuleMutation.
- virtual TalkgroupRuleMutation& operator=(const TalkgroupRuleMutation& data)
+ /// Equals operator. Copies this TalkgroupRuleRewrite to another TalkgroupRuleRewrite.
+ virtual TalkgroupRuleRewrite& operator=(const TalkgroupRuleRewrite& data)
{
if (this != &data) {
m_peerId = data.m_peerId;
@@ -138,7 +138,7 @@ namespace lookups
m_parrot(false),
m_inclusion(),
m_exclusion(),
- m_mutation()
+ m_rewrite()
{
/* stub */
}
@@ -166,11 +166,11 @@ namespace lookups
}
}
- yaml::Node& mutationList = node["mutations"];
- if (mutationList.size() > 0U) {
- for (size_t i = 0; i < mutationList.size(); i++) {
- TalkgroupRuleMutation mutation = TalkgroupRuleMutation(mutationList[i]);
- m_mutation.push_back(mutation);
+ yaml::Node& rewriteList = node["rewrite"];
+ if (rewriteList.size() > 0U) {
+ for (size_t i = 0; i < rewriteList.size(); i++) {
+ TalkgroupRuleRewrite rewrite = TalkgroupRuleRewrite(rewriteList[i]);
+ m_rewrite.push_back(rewrite);
}
}
}
@@ -197,8 +197,8 @@ namespace lookups
__PROPERTY_PLAIN(std::vector, inclusion, inclusion);
/// List of peer IDs excluded by this rule.
__PROPERTY_PLAIN(std::vector, exclusion, exclusion);
- /// List of mutations performed by this rule.
- __PROPERTY_PLAIN(std::vector, mutation, mutation);
+ /// List of rewrites performed by this rule.
+ __PROPERTY_PLAIN(std::vector, rewrite, rewrite);
};
// ---------------------------------------------------------------------------
@@ -287,8 +287,8 @@ namespace lookups
void eraseEntry(uint32_t id, uint8_t slot);
/// Finds a table entry in this lookup table.
virtual TalkgroupRuleGroupVoice find(uint32_t id, uint8_t slot = 0U);
- /// Finds a table entry in this lookup table by mutation.
- virtual TalkgroupRuleGroupVoice findByMutation(uint32_t peerId, uint32_t id, uint8_t slot = 0U);
+ /// Finds a table entry in this lookup table by rewrite.
+ virtual TalkgroupRuleGroupVoice findByRewrite(uint32_t peerId, uint32_t id, uint8_t slot = 0U);
/// Flag indicating whether talkgroup ID access control is enabled or not.
bool getACL();
diff --git a/src/fne/network/fne/TagDMRData.cpp b/src/fne/network/fne/TagDMRData.cpp
index e36ed882..f5c4b0f7 100644
--- a/src/fne/network/fne/TagDMRData.cpp
+++ b/src/fne/network/fne/TagDMRData.cpp
@@ -129,8 +129,8 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
// is this data from a peer connection?
if (fromPeer) {
- // perform TGID mutations if configured
- mutateBuffer(buffer, peerId, dmrData, dataType, dstId, slotNo, false);
+ // perform TGID route rewrites if configured
+ routeRewrite(buffer, peerId, dmrData, dataType, dstId, slotNo, false);
}
// is the stream valid?
@@ -254,8 +254,8 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
::memset(outboundPeerBuffer, 0x00U, len);
::memcpy(outboundPeerBuffer, buffer, len);
- // perform TGID mutations if configured
- mutateBuffer(outboundPeerBuffer, peerId, dmrData, dataType, dstId, slotNo);
+ // perform TGID route rewrites if configured
+ routeRewrite(outboundPeerBuffer, peerId, dmrData, dataType, dstId, slotNo);
peer.second->writeMaster({ NET_FUNC_PROTOCOL, NET_PROTOCOL_SUBFUNC_DMR }, outboundPeerBuffer, len, pktSeq, streamId);
}
@@ -300,7 +300,7 @@ void TagDMRData::playbackParrot()
// ---------------------------------------------------------------------------
///
-/// Helper to mutate the network data buffer.
+/// Helper to route rewrite the network data buffer.
///
///
/// Peer ID
@@ -309,20 +309,20 @@ void TagDMRData::playbackParrot()
///
///
///
-void TagDMRData::mutateBuffer(uint8_t* buffer, uint32_t peerId, dmr::data::Data dmrData, uint8_t dataType, uint32_t dstId, uint32_t slotNo, bool outbound)
+void TagDMRData::routeRewrite(uint8_t* buffer, uint32_t peerId, dmr::data::Data dmrData, uint8_t dataType, uint32_t dstId, uint32_t slotNo, bool outbound)
{
- uint32_t mutatedDstId = dstId;
- uint32_t mutatedSlotNo = slotNo;
+ uint32_t rewriteDstId = dstId;
+ uint32_t rewriteSlotNo = slotNo;
- // does the data require mutation?
- if (peerMutate(peerId, mutatedDstId, mutatedSlotNo, outbound)) {
+ // does the data require route rewriting?
+ if (peerRewrite(peerId, rewriteDstId, rewriteSlotNo, outbound)) {
// rewrite destination TGID in the frame
- __SET_UINT16(mutatedDstId, buffer, 8U);
+ __SET_UINT16(rewriteDstId, buffer, 8U);
// set or clear the e.Slot flag (if 0x80 is set Slot 2 otherwise Slot 1)
- if (mutatedSlotNo == 2 && (buffer[15U] & 0x80U) == 0x00U)
+ if (rewriteSlotNo == 2 && (buffer[15U] & 0x80U) == 0x00U)
buffer[15U] |= 0x80;
- if (mutatedSlotNo == 1 && (buffer[15U] & 0x80U) == 0x80U)
+ if (rewriteSlotNo == 1 && (buffer[15U] & 0x80U) == 0x80U)
buffer[15U] = buffer[15U] & ~0x80U;
uint8_t data[DMR_FRAME_LENGTH_BYTES + 2U];
@@ -335,10 +335,10 @@ void TagDMRData::mutateBuffer(uint8_t* buffer, uint32_t peerId, dmr::data::Data
std::unique_ptr lc = fullLC.decode(data + 2U, dataType);
if (lc == nullptr) {
LogWarning(LOG_NET, "DMR Slot %u, bad LC received from the network, replacing", slotNo);
- lc = new_unique(lc::LC, dmrData.getFLCO(), dmrData.getSrcId(), mutatedDstId);
+ lc = new_unique(lc::LC, dmrData.getFLCO(), dmrData.getSrcId(), rewriteDstId);
}
- lc->setDstId(mutatedDstId);
+ lc->setDstId(rewriteDstId);
// Regenerate the LC data
fullLC.encode(*lc, data + 2U, dataType);
@@ -353,7 +353,7 @@ void TagDMRData::mutateBuffer(uint8_t* buffer, uint32_t peerId, dmr::data::Data
lc = new_unique(lc::PrivacyLC);
}
- lc->setDstId(mutatedDstId);
+ lc->setDstId(rewriteDstId);
// Regenerate the LC data
fullLC.encodePI(*lc, data + 2U);
@@ -365,27 +365,27 @@ void TagDMRData::mutateBuffer(uint8_t* buffer, uint32_t peerId, dmr::data::Data
}
///
-/// Helper to mutate destination ID and slot.
+/// Helper to route rewrite destination ID and slot.
///
/// Peer ID
///
///
///
-bool TagDMRData::peerMutate(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo, bool outbound)
+bool TagDMRData::peerRewrite(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo, bool outbound)
{
lookups::TalkgroupRuleGroupVoice tg;
if (outbound) {
tg = m_network->m_tidLookup->find(dstId, slotNo);
}
else {
- tg = m_network->m_tidLookup->findByMutation(peerId, dstId, slotNo);
+ tg = m_network->m_tidLookup->findByRewrite(peerId, dstId, slotNo);
}
- std::vector mutations = tg.config().mutation();
+ std::vector rewrites = tg.config().rewrite();
- bool mutated = false;
- if (mutations.size() > 0) {
- for (auto entry : mutations) {
+ bool rewrote = false;
+ if (rewrites.size() > 0) {
+ for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {
dstId = tg.source().tgId();
@@ -395,13 +395,13 @@ bool TagDMRData::peerMutate(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo,
dstId = entry.tgId();
slotNo = entry.tgSlot();
}
- mutated = true;
+ rewrote = true;
break;
}
}
}
- return mutated;
+ return rewrote;
}
///
diff --git a/src/fne/network/fne/TagDMRData.h b/src/fne/network/fne/TagDMRData.h
index b2f46625..073b3102 100644
--- a/src/fne/network/fne/TagDMRData.h
+++ b/src/fne/network/fne/TagDMRData.h
@@ -77,10 +77,10 @@ namespace network
bool m_debug;
- /// Helper to mutate the network data buffer.
- void mutateBuffer(uint8_t* buffer, uint32_t peerId, dmr::data::Data dmrData, uint8_t dataType, uint32_t dstId, uint32_t slotNo, bool outbound = true);
- /// Helper to mutate destination ID and slot.
- bool peerMutate(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo, bool outbound = true);
+ /// Helper to route rewrite the network data buffer.
+ void routeRewrite(uint8_t* buffer, uint32_t peerId, dmr::data::Data dmrData, uint8_t dataType, uint32_t dstId, uint32_t slotNo, bool outbound = true);
+ /// Helper to route rewrite destination ID and slot.
+ bool peerRewrite(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo, bool outbound = true);
/// Helper to determine if the peer is permitted for traffic.
bool isPeerPermitted(uint32_t peerId, dmr::data::Data& data, uint32_t streamId);
diff --git a/src/fne/network/fne/TagNXDNData.cpp b/src/fne/network/fne/TagNXDNData.cpp
index 26c7d658..5c6e0883 100644
--- a/src/fne/network/fne/TagNXDNData.cpp
+++ b/src/fne/network/fne/TagNXDNData.cpp
@@ -104,8 +104,8 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
// is this data from a peer connection?
if (fromPeer) {
- // perform TGID mutations if configured
- mutateBuffer(buffer, peerId, messageType, dstId, false);
+ // perform TGID route rewrites if configured
+ routeRewrite(buffer, peerId, messageType, dstId, false);
}
// is the stream valid?
@@ -224,8 +224,8 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
::memset(outboundPeerBuffer, 0x00U, len);
::memcpy(outboundPeerBuffer, buffer, len);
- // perform TGID mutations if configured
- mutateBuffer(outboundPeerBuffer, peerId, messageType, dstId);
+ // perform TGID route rewrites if configured
+ routeRewrite(outboundPeerBuffer, peerId, messageType, dstId);
peer.second->writeMaster({ NET_FUNC_PROTOCOL, NET_PROTOCOL_SUBFUNC_NXDN }, outboundPeerBuffer, len, pktSeq, streamId);
}
@@ -270,45 +270,45 @@ void TagNXDNData::playbackParrot()
// ---------------------------------------------------------------------------
///
-/// Helper to mutate the network data buffer.
+/// Helper to route rewrite the network data buffer.
///
///
/// Peer ID
///
///
///
-void TagNXDNData::mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t messageType, uint32_t dstId, bool outbound)
+void TagNXDNData::routeRewrite(uint8_t* buffer, uint32_t peerId, uint8_t messageType, uint32_t dstId, bool outbound)
{
- uint32_t mutatedDstId = dstId;
+ uint32_t rewriteDstId = dstId;
- // does the data require mutation?
- if (peerMutate(peerId, mutatedDstId, outbound)) {
+ // does the data require route writing?
+ if (peerRewrite(peerId, rewriteDstId, outbound)) {
// rewrite destination TGID in the frame
- __SET_UINT16(mutatedDstId, buffer, 8U);
+ __SET_UINT16(rewriteDstId, buffer, 8U);
}
}
///
-/// Helper to mutate destination ID.
+/// Helper to route rewrite destination ID.
///
/// Peer ID
///
///
-bool TagNXDNData::peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound)
+bool TagNXDNData::peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound)
{
lookups::TalkgroupRuleGroupVoice tg;
if (outbound) {
tg = m_network->m_tidLookup->find(dstId);
}
else {
- tg = m_network->m_tidLookup->findByMutation(peerId, dstId);
+ tg = m_network->m_tidLookup->findByRewrite(peerId, dstId);
}
- std::vector mutations = tg.config().mutation();
+ std::vector rewrites = tg.config().rewrite();
- bool mutated = false;
- if (mutations.size() > 0) {
- for (auto entry : mutations) {
+ bool rewrote = false;
+ if (rewrites.size() > 0) {
+ for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {
dstId = tg.source().tgId();
@@ -316,13 +316,13 @@ bool TagNXDNData::peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound)
else {
dstId = entry.tgId();
}
- mutated = true;
+ rewrote = true;
break;
}
}
}
- return mutated;
+ return rewrote;
}
///
diff --git a/src/fne/network/fne/TagNXDNData.h b/src/fne/network/fne/TagNXDNData.h
index d49723ed..ce1638e0 100644
--- a/src/fne/network/fne/TagNXDNData.h
+++ b/src/fne/network/fne/TagNXDNData.h
@@ -76,10 +76,10 @@ namespace network
bool m_debug;
- /// Helper to mutate the network data buffer.
- void mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t messageType, uint32_t dstId, bool outbound = true);
- /// Helper to mutate destination ID.
- bool peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound = true);
+ /// Helper to route rewrite the network data buffer.
+ void routeRewrite(uint8_t* buffer, uint32_t peerId, uint8_t messageType, uint32_t dstId, bool outbound = true);
+ /// Helper to route rewrite destination ID.
+ bool peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound = true);
/// Helper to determine if the peer is permitted for traffic.
bool isPeerPermitted(uint32_t peerId, nxdn::lc::RTCH& lc, uint8_t messageType, uint32_t streamId);
diff --git a/src/fne/network/fne/TagP25Data.cpp b/src/fne/network/fne/TagP25Data.cpp
index 82320da9..38c41f7f 100644
--- a/src/fne/network/fne/TagP25Data.cpp
+++ b/src/fne/network/fne/TagP25Data.cpp
@@ -148,8 +148,8 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
// is this data from a peer connection?
if (fromPeer) {
- // perform TGID mutations if configured
- mutateBuffer(buffer, peerId, duid, dstId, false);
+ // perform TGID route rewrites if configured
+ routeRewrite(buffer, peerId, duid, dstId, false);
}
// is the stream valid?
@@ -267,8 +267,8 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
::memset(outboundPeerBuffer, 0x00U, len);
::memcpy(outboundPeerBuffer, buffer, len);
- // perform TGID mutations if configured
- mutateBuffer(outboundPeerBuffer, peerId, duid, dstId);
+ // perform TGID route rewrites if configured
+ routeRewrite(outboundPeerBuffer, peerId, duid, dstId);
peer.second->writeMaster({ NET_FUNC_PROTOCOL, NET_PROTOCOL_SUBFUNC_P25 }, outboundPeerBuffer, len, pktSeq, streamId);
}
@@ -324,7 +324,7 @@ void TagP25Data::playbackParrot()
m_parrotFirstFrame = false;
}
- // repeat traffic to the connected peers
+ // repeat traffic to the connected peersmutations
for (auto peer : m_network->m_peers) {
m_network->writePeer(peer.first, { NET_FUNC_PROTOCOL, NET_PROTOCOL_SUBFUNC_P25 }, std::get<0>(pkt), std::get<1>(pkt), std::get<2>(pkt), std::get<3>(pkt), false);
if (m_network->m_debug) {
@@ -344,24 +344,24 @@ void TagP25Data::playbackParrot()
// ---------------------------------------------------------------------------
///
-/// Helper to mutate the network data buffer.
+/// Helper to route rewrite the network data buffer.
///
///
/// Peer ID
///
///
///
-void TagP25Data::mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t duid, uint32_t dstId, bool outbound)
+void TagP25Data::routeRewrite(uint8_t* buffer, uint32_t peerId, uint8_t duid, uint32_t dstId, bool outbound)
{
uint32_t srcId = __GET_UINT16(buffer, 5U);
uint32_t frameLength = buffer[23U];
- uint32_t mutatedDstId = dstId;
+ uint32_t rewriteDstId = dstId;
- // does the data require mutation?
- if (peerMutate(peerId, mutatedDstId, outbound)) {
+ // does the data require route writing?
+ if (peerRewrite(peerId, rewriteDstId, outbound)) {
// rewrite destination TGID in the frame
- __SET_UINT16(mutatedDstId, buffer, 8U);
+ __SET_UINT16(rewriteDstId, buffer, 8U);
UInt8Array data = std::unique_ptr(new uint8_t[frameLength]);
::memset(data.get(), 0x00U, frameLength);
@@ -376,9 +376,9 @@ void TagP25Data::mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t duid, ui
case TSBK_IOSP_GRP_VCH:
{
LogMessage(LOG_NET, P25_TSDU_STR ", %s, emerg = %u, encrypt = %u, prio = %u, chNo = %u, srcId = %u, dstId = %u",
- tsbk->toString(true).c_str(), tsbk->getEmergency(), tsbk->getEncrypted(), tsbk->getPriority(), tsbk->getGrpVchNo(), srcId, dstId);
+ tsbk->toString(true).c_str(), tsbk->getEmergency(), tsbk->getEncrypted(), tsbk->getPriority(), tsbk->getGrpVchNo(), srcId, rewriteDstId);
- tsbk->setDstId(dstId);
+ tsbk->setDstId(rewriteDstId);
}
break;
}
@@ -409,26 +409,26 @@ void TagP25Data::mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t duid, ui
}
///
-/// Helper to mutate destination ID.
+/// Helper to route rewrite destination ID.
///
/// Peer ID
///
///
-bool TagP25Data::peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound)
+bool TagP25Data::peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound)
{
lookups::TalkgroupRuleGroupVoice tg;
if (outbound) {
tg = m_network->m_tidLookup->find(dstId);
}
else {
- tg = m_network->m_tidLookup->findByMutation(peerId, dstId);
+ tg = m_network->m_tidLookup->findByRewrite(peerId, dstId);
}
- std::vector mutations = tg.config().mutation();
+ std::vector rewrites = tg.config().rewrite();
- bool mutated = false;
- if (mutations.size() > 0) {
- for (auto entry : mutations) {
+ bool rewrote = false;
+ if (rewrites.size() > 0) {
+ for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {
dstId = tg.source().tgId();
@@ -436,13 +436,13 @@ bool TagP25Data::peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound)
else {
dstId = entry.tgId();
}
- mutated = true;
+ rewrote = true;
break;
}
}
}
- return mutated;
+ return rewrote;
}
///
diff --git a/src/fne/network/fne/TagP25Data.h b/src/fne/network/fne/TagP25Data.h
index f6299625..549ce474 100644
--- a/src/fne/network/fne/TagP25Data.h
+++ b/src/fne/network/fne/TagP25Data.h
@@ -83,10 +83,10 @@ namespace network
bool m_debug;
- /// Helper to mutate the network data buffer.
- void mutateBuffer(uint8_t* buffer, uint32_t peerId, uint8_t duid, uint32_t dstId, bool outbound = true);
- /// Helper to mutate destination ID.
- bool peerMutate(uint32_t peerId, uint32_t& dstId, bool outbound = true);
+ /// Helper to route rewrite the network data buffer.
+ void routeRewrite(uint8_t* buffer, uint32_t peerId, uint8_t duid, uint32_t dstId, bool outbound = true);
+ /// Helper to route rewrite destination ID.
+ bool peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound = true);
/// Helper to determine if the peer is permitted for traffic.
bool isPeerPermitted(uint32_t peerId, p25::lc::LC& control, uint8_t duid, uint32_t streamId);