add preliminary support for CFNE to have the "affiliated" flag to pass traffic;

pull/48/head
Bryan Biedenkapp 2 years ago
parent 345495076b
commit 49f1b02ccf

@ -16,6 +16,8 @@ groupVoice:
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
inclusion: [] inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic). # List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
@ -39,6 +41,8 @@ groupVoice:
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# Flag indicating whether or not this talkgroup is a parrot talkgroup. # Flag indicating whether or not this talkgroup is a parrot talkgroup.
parrot: true parrot: true
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
@ -57,13 +61,15 @@ groupVoice:
slot: 1 slot: 1
# Textual name of the talkgroup. # Textual name of the talkgroup.
- name: Parrot Mutation Example - name: Rewrite Example
# #
# Talkgroup Configuration # Talkgroup Configuration
# #
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# Flag indicating whether or not this talkgroup is a parrot talkgroup. # Flag indicating whether or not this talkgroup is a parrot talkgroup.
parrot: true parrot: true
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
@ -83,7 +89,7 @@ groupVoice:
# #
source: source:
# Numerical talkgroup ID number. # Numerical talkgroup ID number.
tgid: 9990 tgid: 5
# DMR slot number. # DMR slot number.
slot: 1 slot: 1
@ -95,6 +101,8 @@ groupVoice:
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
inclusion: [] inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic). # List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
@ -118,6 +126,8 @@ groupVoice:
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
inclusion: [] inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic). # List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).
@ -141,6 +151,8 @@ groupVoice:
config: config:
# Flag indicating whether this talkgroup is active or not. # Flag indicating whether this talkgroup is active or not.
active: true active: true
# Flag indicating whether this talkgroup will only repeat with affiliations.
affiliated: false
# List of peer IDs included for this talkgroup (peers listed here will be selected for traffic). # List of peer IDs included for this talkgroup (peers listed here will be selected for traffic).
inclusion: [] inclusion: []
# List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic). # List of peer IDs excluded for this talkgroup (peers listed here will be ignored for traffic).

@ -177,6 +177,23 @@ bool AffiliationLookup::groupUnaff(uint32_t srcId)
} }
} }
/// <summary>
/// Helper to determine if the group destination ID has any affiations.
/// </summary>
/// <param name="srcId"></param>
/// <param name="dstId"></param>
/// <returns></returns>
bool AffiliationLookup::hasGroupAff(uint32_t dstId) const
{
for (auto entry : m_grpAffTable) {
if (entry.second == dstId) {
return true;
}
}
return false;
}
/// <summary> /// <summary>
/// Helper to determine if the source ID has affiliated to the group destination ID. /// Helper to determine if the source ID has affiliated to the group destination ID.
/// </summary> /// </summary>

@ -125,6 +125,8 @@ namespace lookups
virtual void groupAff(uint32_t srcId, uint32_t dstId); virtual void groupAff(uint32_t srcId, uint32_t dstId);
/// <summary>Helper to group unaffiliate a source ID.</summary> /// <summary>Helper to group unaffiliate a source ID.</summary>
virtual bool groupUnaff(uint32_t srcId); virtual bool groupUnaff(uint32_t srcId);
/// <summary>Helper to determine if the group destination ID has any affiations.</summary>
virtual bool hasGroupAff(uint32_t dstId) const;
/// <summary>Helper to determine if the source ID has affiliated to the group destination ID.</summary> /// <summary>Helper to determine if the source ID has affiliated to the group destination ID.</summary>
virtual bool isGroupAff(uint32_t srcId, uint32_t dstId) const; virtual bool isGroupAff(uint32_t srcId, uint32_t dstId) const;
/// <summary>Helper to release group affiliations.</summary> /// <summary>Helper to release group affiliations.</summary>

@ -121,6 +121,7 @@ namespace lookups
/// <summary>Initializes a new instance of the TalkgroupRuleConfig class.</summary> /// <summary>Initializes a new instance of the TalkgroupRuleConfig class.</summary>
TalkgroupRuleConfig() : TalkgroupRuleConfig() :
m_active(false), m_active(false),
m_affiliated(false),
m_parrot(false), m_parrot(false),
m_inclusion(), m_inclusion(),
m_exclusion(), m_exclusion(),
@ -134,6 +135,7 @@ namespace lookups
TalkgroupRuleConfig() TalkgroupRuleConfig()
{ {
m_active = node["active"].as<bool>(false); m_active = node["active"].as<bool>(false);
m_affiliated = node["affiliated"].as<bool>(false);
m_parrot = node["parrot"].as<bool>(false); m_parrot = node["parrot"].as<bool>(false);
yaml::Node& inclusionList = node["inclusion"]; yaml::Node& inclusionList = node["inclusion"];
@ -166,6 +168,7 @@ namespace lookups
{ {
if (this != &data) { if (this != &data) {
m_active = data.m_active; m_active = data.m_active;
m_affiliated = data.m_affiliated;
m_parrot = data.m_parrot; m_parrot = data.m_parrot;
m_inclusion = data.m_inclusion; m_inclusion = data.m_inclusion;
m_exclusion = data.m_exclusion; m_exclusion = data.m_exclusion;
@ -178,6 +181,8 @@ namespace lookups
public: public:
/// <summary>Flag indicating whether the rule is active.</summary> /// <summary>Flag indicating whether the rule is active.</summary>
__PROPERTY_PLAIN(bool, active); __PROPERTY_PLAIN(bool, active);
/// <summary>Flag indicating whether this talkgroup will only repeat with affiliations.</summary>
__PROPERTY_PLAIN(bool, affiliated);
/// <summary>Flag indicating whether or not the talkgroup is a parrot.</summary> /// <summary>Flag indicating whether or not the talkgroup is a parrot.</summary>
__PROPERTY_PLAIN(bool, parrot); __PROPERTY_PLAIN(bool, parrot);
/// <summary>List of peer IDs included by this rule.</summary> /// <summary>List of peer IDs included by this rule.</summary>

@ -438,6 +438,15 @@ bool TagDMRData::isPeerPermitted(uint32_t peerId, data::Data& data, uint32_t str
} }
} }
} }
// is this a TG that requires affiliations to repeat?
if (tg.config().affiliated()) {
// check the affiliations for this peer to see if we can repeat traffic
lookups::AffiliationLookup* aff = m_network->m_peerAffiliations[peerId];
if (!aff->hasGroupAff(data.getDstId())) {
return false;
}
}
} }
return true; return true;

@ -360,6 +360,15 @@ bool TagNXDNData::isPeerPermitted(uint32_t peerId, lc::RTCH& lc, uint8_t message
} }
} }
} }
// is this a TG that requires affiliations to repeat?
if (tg.config().affiliated()) {
// check the affiliations for this peer to see if we can repeat traffic
lookups::AffiliationLookup* aff = m_network->m_peerAffiliations[peerId];
if (!aff->hasGroupAff(lc.getDstId())) {
return false;
}
}
} }
return true; return true;

@ -495,6 +495,15 @@ bool TagP25Data::isPeerPermitted(uint32_t peerId, lc::LC& control, uint8_t duid,
} }
} }
// is this a TG that requires affiliations to repeat?
if (tg.config().affiliated()) {
// check the affiliations for this peer to see if we can repeat traffic
lookups::AffiliationLookup* aff = m_network->m_peerAffiliations[peerId];
if (!aff->hasGroupAff(control.getDstId())) {
return false;
}
}
return true; return true;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.