commit
9364dfc113
29
Conf.cpp
29
Conf.cpp
|
@ -43,7 +43,8 @@ enum SECTION {
|
||||||
SECTION_TFTSERIAL,
|
SECTION_TFTSERIAL,
|
||||||
SECTION_HD44780,
|
SECTION_HD44780,
|
||||||
SECTION_NEXTION,
|
SECTION_NEXTION,
|
||||||
SECTION_OLED
|
SECTION_OLED,
|
||||||
|
SECTION_TGREWRITE
|
||||||
};
|
};
|
||||||
|
|
||||||
CConf::CConf(const std::string& file) :
|
CConf::CConf(const std::string& file) :
|
||||||
|
@ -95,6 +96,8 @@ m_dmrColorCode(2U),
|
||||||
m_dmrSelfOnly(false),
|
m_dmrSelfOnly(false),
|
||||||
m_dmrTGRewriteSlot1(false),
|
m_dmrTGRewriteSlot1(false),
|
||||||
m_dmrTGRewriteSlot2(false),
|
m_dmrTGRewriteSlot2(false),
|
||||||
|
m_dmrBMAutoRewrite(false),
|
||||||
|
m_dmrBMRewriteReflectorVoicePrompts(false),
|
||||||
m_dmrPrefixes(),
|
m_dmrPrefixes(),
|
||||||
m_dmrBlackList(),
|
m_dmrBlackList(),
|
||||||
m_dmrDstIdBlacklistSlot1RF(),
|
m_dmrDstIdBlacklistSlot1RF(),
|
||||||
|
@ -203,6 +206,7 @@ bool CConf::read()
|
||||||
section = SECTION_NEXTION;
|
section = SECTION_NEXTION;
|
||||||
else if (::strncmp(buffer, "[OLED]", 6U) == 0)
|
else if (::strncmp(buffer, "[OLED]", 6U) == 0)
|
||||||
section = SECTION_OLED;
|
section = SECTION_OLED;
|
||||||
|
|
||||||
else
|
else
|
||||||
section = SECTION_NONE;
|
section = SECTION_NONE;
|
||||||
|
|
||||||
|
@ -332,10 +336,6 @@ bool CConf::read()
|
||||||
m_dmrColorCode = (unsigned int)::atoi(value);
|
m_dmrColorCode = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "SelfOnly") == 0)
|
else if (::strcmp(key, "SelfOnly") == 0)
|
||||||
m_dmrSelfOnly = ::atoi(value) == 1;
|
m_dmrSelfOnly = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "TGRewriteSlot1") == 0)
|
|
||||||
m_dmrTGRewriteSlot1 = ::atoi(value) == 1;
|
|
||||||
else if (::strcmp(key, "TGRewriteSlot2") == 0)
|
|
||||||
m_dmrTGRewriteSlot2 = ::atoi(value) == 1;
|
|
||||||
else if (::strcmp(key, "Prefixes") == 0) {
|
else if (::strcmp(key, "Prefixes") == 0) {
|
||||||
char* p = ::strtok(value, ",\r\n");
|
char* p = ::strtok(value, ",\r\n");
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
|
@ -422,6 +422,14 @@ bool CConf::read()
|
||||||
m_dmrTXHang = (unsigned int)::atoi(value);
|
m_dmrTXHang = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "CallHang") == 0)
|
else if (::strcmp(key, "CallHang") == 0)
|
||||||
m_dmrCallHang = (unsigned int)::atoi(value);
|
m_dmrCallHang = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "TGRewriteSlot1") == 0)
|
||||||
|
m_dmrTGRewriteSlot1 = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "TGRewriteSlot2") == 0)
|
||||||
|
m_dmrTGRewriteSlot2 = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "BMAutoRewrite") == 0)
|
||||||
|
m_dmrBMAutoRewrite = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "BMRewriteReflectorVoicePrompts") == 0)
|
||||||
|
m_dmrBMRewriteReflectorVoicePrompts = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_FUSION) {
|
} else if (section == SECTION_FUSION) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_fusionEnabled = ::atoi(value) == 1;
|
m_fusionEnabled = ::atoi(value) == 1;
|
||||||
|
@ -520,6 +528,7 @@ bool CConf::read()
|
||||||
m_oledBrightness = (unsigned char)::atoi(value);
|
m_oledBrightness = (unsigned char)::atoi(value);
|
||||||
else if (::strcmp(key, "Brightness") == 0)
|
else if (::strcmp(key, "Brightness") == 0)
|
||||||
m_oledInvert = (unsigned char)::atoi(value);
|
m_oledInvert = (unsigned char)::atoi(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -764,6 +773,16 @@ bool CConf::getDMRTGRewriteSlot2() const
|
||||||
return m_dmrTGRewriteSlot2;
|
return m_dmrTGRewriteSlot2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getDMRBMAutoRewrite() const
|
||||||
|
{
|
||||||
|
return m_dmrBMAutoRewrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CConf::getDMRBMRewriteReflectorVoicePrompts() const
|
||||||
|
{
|
||||||
|
return m_dmrBMRewriteReflectorVoicePrompts;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<unsigned int> CConf::getDMRPrefixes() const
|
std::vector<unsigned int> CConf::getDMRPrefixes() const
|
||||||
{
|
{
|
||||||
return m_dmrPrefixes;
|
return m_dmrPrefixes;
|
||||||
|
|
5
Conf.h
5
Conf.h
|
@ -90,6 +90,8 @@ public:
|
||||||
bool getDMRSelfOnly() const;
|
bool getDMRSelfOnly() const;
|
||||||
bool getDMRTGRewriteSlot1() const;
|
bool getDMRTGRewriteSlot1() const;
|
||||||
bool getDMRTGRewriteSlot2() const;
|
bool getDMRTGRewriteSlot2() const;
|
||||||
|
bool getDMRBMAutoRewrite() const;
|
||||||
|
bool getDMRBMRewriteReflectorVoicePrompts() const;
|
||||||
std::vector<unsigned int> getDMRPrefixes() const;
|
std::vector<unsigned int> getDMRPrefixes() const;
|
||||||
std::vector<unsigned int> getDMRBlackList() const;
|
std::vector<unsigned int> getDMRBlackList() const;
|
||||||
std::vector<unsigned int> getDMRDstIdBlacklistSlot1RF() const;
|
std::vector<unsigned int> getDMRDstIdBlacklistSlot1RF() const;
|
||||||
|
@ -217,6 +219,9 @@ private:
|
||||||
bool m_dmrSelfOnly;
|
bool m_dmrSelfOnly;
|
||||||
bool m_dmrTGRewriteSlot1;
|
bool m_dmrTGRewriteSlot1;
|
||||||
bool m_dmrTGRewriteSlot2;
|
bool m_dmrTGRewriteSlot2;
|
||||||
|
bool m_dmrBMAutoRewrite;
|
||||||
|
bool m_dmrBMRewriteReflectorVoicePrompts;
|
||||||
|
|
||||||
std::vector<unsigned int> m_dmrPrefixes;
|
std::vector<unsigned int> m_dmrPrefixes;
|
||||||
std::vector<unsigned int> m_dmrBlackList;
|
std::vector<unsigned int> m_dmrBlackList;
|
||||||
std::vector<unsigned int> m_dmrDstIdBlacklistSlot1RF;
|
std::vector<unsigned int> m_dmrDstIdBlacklistSlot1RF;
|
||||||
|
|
|
@ -19,52 +19,59 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <string.h>
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstBlackListSlot1RF;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstBlackListSlot2RF;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstWhiteListSlot1RF;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstWhiteListSlot2RF;
|
|
||||||
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstBlackListSlot1NET;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstBlackListSlot2NET;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstWhiteListSlot1NET;
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_dstWhiteListSlot2NET;
|
|
||||||
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_srcIdBlacklist;
|
|
||||||
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_prefixes;
|
|
||||||
|
|
||||||
bool CDMRAccessControl::m_selfOnly = false;
|
|
||||||
|
|
||||||
unsigned int CDMRAccessControl::m_id = 0U;
|
|
||||||
|
|
||||||
unsigned int CDMRAccessControl::m_dstRewriteID = 0U;
|
|
||||||
unsigned int CDMRAccessControl::m_srcID = 0U;
|
|
||||||
|
|
||||||
std::time_t CDMRAccessControl::m_time;
|
|
||||||
|
|
||||||
unsigned int CDMRAccessControl::m_callHang = 0U;
|
|
||||||
|
|
||||||
bool CDMRAccessControl::m_tgRewriteSlot1 = false;
|
|
||||||
bool CDMRAccessControl::m_tgRewriteSlot2 = false;
|
|
||||||
|
|
||||||
|
|
||||||
void CDMRAccessControl::init(const std::vector<unsigned int>& dstIdBlacklistSlot1RF, const std::vector<unsigned int>& dstIdWhitelistSlot1RF, const std::vector<unsigned int>& dstIdBlacklistSlot2RF, const std::vector<unsigned int>& dstIdWhitelistSlot2RF, const std::vector<unsigned int>& dstIdBlacklistSlot1NET, const std::vector<unsigned int>& dstIdWhitelistSlot1NET, const std::vector<unsigned int>& dstIdBlacklistSlot2NET, const std::vector<unsigned int>& dstIdWhitelistSlot2NET, const std::vector<unsigned int>& srcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes, unsigned int id, unsigned int callHang, bool tgRewriteSlot1, bool tgRewriteSlot2)
|
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot1RF;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot2RF;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstWhiteListSlot1RF;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstWhiteListSlot2RF;
|
||||||
|
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot1NET;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstBlackListSlot2NET;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstWhiteListSlot1NET;
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_dstWhiteListSlot2NET;
|
||||||
|
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_SrcIdBlacklist;
|
||||||
|
|
||||||
|
std::vector<unsigned int> DMRAccessControl::m_prefixes;
|
||||||
|
|
||||||
|
bool DMRAccessControl::m_selfOnly = false;
|
||||||
|
|
||||||
|
unsigned int DMRAccessControl::m_id = 0U;
|
||||||
|
|
||||||
|
unsigned int DMRAccessControl::m_dstRewriteID = 0U;
|
||||||
|
unsigned int DMRAccessControl::m_SrcID = 0U;
|
||||||
|
|
||||||
|
CDMRLC* DMRAccessControl::m_lastdmrLC;
|
||||||
|
|
||||||
|
std::time_t DMRAccessControl::m_time;
|
||||||
|
|
||||||
|
unsigned int DMRAccessControl::m_callHang;
|
||||||
|
|
||||||
|
bool DMRAccessControl::m_TGRewriteSlot1;
|
||||||
|
bool DMRAccessControl::m_TGRewriteSlot2;
|
||||||
|
bool DMRAccessControl::m_BMAutoRewrite;
|
||||||
|
bool DMRAccessControl::m_BMRewriteReflectorVoicePrompts;
|
||||||
|
|
||||||
|
void DMRAccessControl::init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id,unsigned int callHang,bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts)
|
||||||
{
|
{
|
||||||
m_dstBlackListSlot1RF = dstIdBlacklistSlot1RF;
|
m_dstBlackListSlot1RF = DstIdBlacklistSlot1RF;
|
||||||
m_dstWhiteListSlot1RF = dstIdWhitelistSlot1RF;
|
m_dstWhiteListSlot1RF = DstIdWhitelistSlot1RF;
|
||||||
m_dstBlackListSlot2RF = dstIdBlacklistSlot2RF;
|
m_dstBlackListSlot2RF = DstIdBlacklistSlot2RF;
|
||||||
m_dstWhiteListSlot2RF = dstIdWhitelistSlot2RF;
|
m_dstWhiteListSlot2RF = DstIdWhitelistSlot2RF;
|
||||||
m_dstBlackListSlot1NET = dstIdBlacklistSlot1NET;
|
m_dstBlackListSlot1NET = DstIdBlacklistSlot1NET;
|
||||||
m_dstWhiteListSlot1NET = dstIdWhitelistSlot1NET;
|
m_dstWhiteListSlot1NET = DstIdWhitelistSlot1NET;
|
||||||
m_dstBlackListSlot2NET = dstIdBlacklistSlot2NET;
|
m_dstBlackListSlot2NET = DstIdBlacklistSlot2NET;
|
||||||
m_dstWhiteListSlot2NET = dstIdWhitelistSlot2NET;
|
m_dstWhiteListSlot2NET = DstIdWhitelistSlot2NET;
|
||||||
m_callHang = callHang;
|
m_callHang = callHang;
|
||||||
m_tgRewriteSlot1 = tgRewriteSlot1;
|
m_TGRewriteSlot1 = TGRewriteSlot1;
|
||||||
m_tgRewriteSlot2 = tgRewriteSlot2;
|
m_TGRewriteSlot2 = TGRewriteSlot2;
|
||||||
|
m_BMAutoRewrite = BMAutoRewrite;
|
||||||
|
m_BMRewriteReflectorVoicePrompts = BMRewriteReflectorVoicePrompts;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRAccessControl::dstIdBlacklist(unsigned int did, unsigned int slot, bool network)
|
bool DMRAccessControl::DstIdBlacklist(unsigned int did, unsigned int slot, bool network)
|
||||||
{
|
{
|
||||||
static std::vector<unsigned int> blacklist;
|
static std::vector<unsigned int> blacklist;
|
||||||
|
|
||||||
|
@ -83,7 +90,7 @@ bool CDMRAccessControl::dstIdBlacklist(unsigned int did, unsigned int slot, bool
|
||||||
return std::find(blacklist.begin(), blacklist.end(), did) != blacklist.end();
|
return std::find(blacklist.begin(), blacklist.end(), did) != blacklist.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRAccessControl::dstIdWhitelist(unsigned int did, unsigned int slot, bool gt4k, bool network)
|
bool DMRAccessControl::DstIdWhitelist(unsigned int did, unsigned int slot, bool gt4k, bool network)
|
||||||
{
|
{
|
||||||
if (network) {
|
if (network) {
|
||||||
if (slot == 1U) {
|
if (slot == 1U) {
|
||||||
|
@ -107,9 +114,8 @@ bool CDMRAccessControl::dstIdWhitelist(unsigned int did, unsigned int slot, bool
|
||||||
if (gt4k) {
|
if (gt4k) {
|
||||||
if (std::find(m_dstWhiteListSlot2NET.begin(), m_dstWhiteListSlot2NET.end(), did) != m_dstWhiteListSlot2NET.end() || did == 0)
|
if (std::find(m_dstWhiteListSlot2NET.begin(), m_dstWhiteListSlot2NET.end(), did) != m_dstWhiteListSlot2NET.end() || did == 0)
|
||||||
return true;
|
return true;
|
||||||
|
// If dstId in secondary TG range or whitelist
|
||||||
// If dstId in secondary TG range or whitelist
|
else if (did >= 4000) {
|
||||||
else if (did >= 4000U) {
|
|
||||||
if (did > 5000U && did < 10000U)
|
if (did > 5000U && did < 10000U)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -145,7 +151,7 @@ bool CDMRAccessControl::dstIdWhitelist(unsigned int did, unsigned int slot, bool
|
||||||
if (std::find(m_dstWhiteListSlot2RF.begin(), m_dstWhiteListSlot2RF.end(), did) != m_dstWhiteListSlot2RF.end() || did == 0)
|
if (std::find(m_dstWhiteListSlot2RF.begin(), m_dstWhiteListSlot2RF.end(), did) != m_dstWhiteListSlot2RF.end() || did == 0)
|
||||||
return true;
|
return true;
|
||||||
// If dstId in secondary TG range or whitelist
|
// If dstId in secondary TG range or whitelist
|
||||||
else if (did >= 4000U) {
|
else if (did >= 4000) {
|
||||||
if (did > 5000U && did < 10000U)
|
if (did > 5000U && did < 10000U)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
@ -161,12 +167,12 @@ bool CDMRAccessControl::dstIdWhitelist(unsigned int did, unsigned int slot, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRAccessControl::validateSrcId(unsigned int id)
|
bool DMRAccessControl::validateSrcId(unsigned int id)
|
||||||
{
|
{
|
||||||
if (m_selfOnly) {
|
if (m_selfOnly) {
|
||||||
return id == m_id;
|
return id == m_id;
|
||||||
} else {
|
} else {
|
||||||
if (std::find(m_srcIdBlacklist.begin(), m_srcIdBlacklist.end(), id) != m_srcIdBlacklist.end())
|
if (std::find(m_SrcIdBlacklist.begin(), m_SrcIdBlacklist.end(), id) != m_SrcIdBlacklist.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int prefix = id / 10000U;
|
unsigned int prefix = id / 10000U;
|
||||||
|
@ -180,54 +186,62 @@ bool CDMRAccessControl::validateSrcId(unsigned int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRAccessControl::validateAccess (unsigned int srcId, unsigned int dstId, unsigned int slot, bool network)
|
bool DMRAccessControl::validateAccess (unsigned int src_id, unsigned int dst_id, unsigned int slot, bool network)
|
||||||
{
|
{
|
||||||
// source ID validation is only applied to RF traffic
|
// source ID validation is only applied to RF traffic
|
||||||
if (!network && !CDMRAccessControl::validateSrcId(srcId)) {
|
if (!network && !DMRAccessControl::validateSrcId(src_id)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", slot, srcId);
|
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", slot, src_id);
|
||||||
return false;
|
return false;
|
||||||
} else if (CDMRAccessControl::dstIdBlacklist(dstId, slot, network)) {
|
} else if (DMRAccessControl::DstIdBlacklist(dst_id, slot, network)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", slot, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", slot, dst_id);
|
||||||
return false;
|
return false;
|
||||||
} else if (!CDMRAccessControl::dstIdWhitelist(dstId, slot, true, network)) {
|
} else if (!DMRAccessControl::DstIdWhitelist(dst_id, slot, true, network)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", slot, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", slot, dst_id);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CDMRAccessControl::dstIdRewrite(unsigned int did, unsigned int sid, unsigned int slot, bool network)
|
unsigned int DMRAccessControl::DstIdRewrite (unsigned int did, unsigned int sid, unsigned int slot, bool network, CDMRLC* dmrLC)
|
||||||
{
|
{
|
||||||
if (slot == 1U && !m_tgRewriteSlot1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (slot == 2U && !m_tgRewriteSlot2)
|
if (slot == 1U && m_TGRewriteSlot1 == false)
|
||||||
return 0;
|
return 0U;
|
||||||
|
|
||||||
|
if (slot == 2U && m_TGRewriteSlot2 == false)
|
||||||
|
return 0U;
|
||||||
|
|
||||||
|
|
||||||
std::time_t currenttime = std::time(nullptr);
|
std::time_t currenttime = std::time(nullptr);
|
||||||
|
|
||||||
if (network) {
|
if (network) {
|
||||||
m_dstRewriteID = did;
|
m_dstRewriteID = did;
|
||||||
m_srcID = sid;
|
m_SrcID = sid;
|
||||||
|
//not needed at present - for direct dial, which requires change at master end.
|
||||||
if (did < 4000U && did > 0 && did != 9U) {
|
//memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC));
|
||||||
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9", slot, did);
|
if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP ) {
|
||||||
return 9U;
|
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9",slot,did);
|
||||||
} else {
|
return 9U;
|
||||||
return 0U;
|
// rewrite incoming BM voice prompts to TG 9
|
||||||
}
|
} else if (m_BMRewriteReflectorVoicePrompts && (sid >= 4000U && sid <= 5000U) && dmrLC->getFLCO() == FLCO_USER_USER) {
|
||||||
} else if (did == 9U && m_dstRewriteID != 9U && m_dstRewriteID != 0U && (m_time + m_callHang) > currenttime) {
|
dmrLC->setFLCO(FLCO_GROUP);
|
||||||
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)",slot,did,m_dstRewriteID);
|
LogMessage("DMR Slot %u, Rewrite inbound private call to %u to Group Call on TG 9 (BM reflector voice prompt)",slot,did);
|
||||||
return m_dstRewriteID;
|
return 9U;
|
||||||
} else if (did < 4000U && did > 0U && did != 9U) {
|
} else {
|
||||||
m_dstRewriteID = did;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
} else if (m_BMAutoRewrite && did == 9U && m_dstRewriteID != 9U && m_dstRewriteID != 0U && (m_time + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP ) {
|
||||||
return 0U;
|
LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)",slot,did,m_dstRewriteID);
|
||||||
|
return(m_dstRewriteID);
|
||||||
|
} else if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did !=9U) {
|
||||||
|
m_dstRewriteID = did;
|
||||||
|
}
|
||||||
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRAccessControl::setOverEndTime()
|
|
||||||
|
void DMRAccessControl::setOverEndTime()
|
||||||
{
|
{
|
||||||
m_time = std::time(nullptr);
|
m_time = std::time(nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include "DMRLC.h"
|
||||||
|
|
||||||
class CDMRAccessControl {
|
class DMRAccessControl {
|
||||||
public:
|
public:
|
||||||
static bool validateAccess(unsigned int srcId, unsigned int dstId, unsigned int slot, bool network);
|
static bool validateAccess (unsigned int src_id, unsigned int dst_id, unsigned int slot, bool network);
|
||||||
|
|
||||||
static void init(const std::vector<unsigned int>& dstIdBlacklistSlot1RF, const std::vector<unsigned int>& dstIdWhitelistSlot1RF, const std::vector<unsigned int>& dstIdBlacklistSlot2RF, const std::vector<unsigned int>& dstIdWhitelistSlot2RF, const std::vector<unsigned int>& dstIdBlacklistSlot1NET, const std::vector<unsigned int>& dstIdWhitelistSlot1NET, const std::vector<unsigned int>& dstIdBlacklistSlot2NET, const std::vector<unsigned int>& dstIdWhitelistSlot2NET, const std::vector<unsigned int>& srcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes, unsigned int id, unsigned int callHang, bool tgRewrteSlot1, bool tgRewrteSlot2);
|
static void init(const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, const std::vector<unsigned int>& SrcIdBlacklist, bool selfOnly, const std::vector<unsigned int>& prefixes,unsigned int id,unsigned int callHang, bool TGRewrteSlot1, bool TGRewrteSlot2, bool m_BMAutoRewrite, bool m_BMRewriteReflectorVoicePrompts);
|
||||||
|
|
||||||
static unsigned int dstIdRewrite(unsigned int id, unsigned int sid,unsigned int slot, bool network);
|
static unsigned int DstIdRewrite(unsigned int id, unsigned int sid,unsigned int slot, bool network, CDMRLC* dmrLC);
|
||||||
|
|
||||||
static void setOverEndTime();
|
static void setOverEndTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -39,7 +39,7 @@ private:
|
||||||
static std::vector<unsigned int> m_dstWhiteListSlot1NET;
|
static std::vector<unsigned int> m_dstWhiteListSlot1NET;
|
||||||
static std::vector<unsigned int> m_dstWhiteListSlot2NET;
|
static std::vector<unsigned int> m_dstWhiteListSlot2NET;
|
||||||
|
|
||||||
static std::vector<unsigned int> m_srcIdBlacklist;
|
static std::vector<unsigned int> m_SrcIdBlacklist;
|
||||||
|
|
||||||
static std::vector<unsigned int> m_prefixes;
|
static std::vector<unsigned int> m_prefixes;
|
||||||
|
|
||||||
|
@ -48,18 +48,26 @@ private:
|
||||||
static bool m_selfOnly;
|
static bool m_selfOnly;
|
||||||
static unsigned int m_id;
|
static unsigned int m_id;
|
||||||
|
|
||||||
static bool dstIdBlacklist(unsigned int did,unsigned int slot, bool network);
|
static bool DstIdBlacklist(unsigned int did,unsigned int slot, bool network);
|
||||||
static bool dstIdWhitelist(unsigned int did,unsigned int slot,bool gt4k, bool network);
|
static bool DstIdWhitelist(unsigned int did,unsigned int slot,bool gt4k, bool network);
|
||||||
|
|
||||||
static bool validateSrcId(unsigned int id);
|
static bool validateSrcId(unsigned int id);
|
||||||
|
|
||||||
static std::time_t m_time;
|
static std::time_t m_time;
|
||||||
|
|
||||||
static unsigned int m_dstRewriteID;
|
static unsigned int m_dstRewriteID;
|
||||||
static unsigned int m_srcID;
|
static unsigned int m_SrcID;
|
||||||
|
|
||||||
static bool m_tgRewriteSlot1;
|
static bool m_TGRewriteSlot1;
|
||||||
static bool m_tgRewriteSlot2;
|
static bool m_TGRewriteSlot2;
|
||||||
|
static bool m_BMAutoRewrite;
|
||||||
|
static bool m_BMRewriteReflectorVoicePrompts;
|
||||||
|
|
||||||
|
static CDMRLC* m_lastdmrLC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2) :
|
|
||||||
|
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts) :
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_colorCode(colorCode),
|
m_colorCode(colorCode),
|
||||||
m_selfOnly(selfOnly),
|
m_selfOnly(selfOnly),
|
||||||
|
@ -36,9 +37,9 @@ m_lookup(NULL)
|
||||||
assert(display != NULL);
|
assert(display != NULL);
|
||||||
|
|
||||||
m_lookup = new CDMRLookup(lookupFile);
|
m_lookup = new CDMRLookup(lookupFile);
|
||||||
m_lookup->read();
|
//m_lookup->read();
|
||||||
|
|
||||||
CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, modem, network, display, duplex, m_lookup, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2);
|
CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, modem, network, display, duplex, m_lookup, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDMRControl::~CDMRControl()
|
CDMRControl::~CDMRControl()
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
class CDMRControl {
|
class CDMRControl {
|
||||||
public:
|
public:
|
||||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF,const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2);
|
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF,const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts);
|
||||||
~CDMRControl();
|
~CDMRControl();
|
||||||
|
|
||||||
bool processWakeup(const unsigned char* data);
|
bool processWakeup(const unsigned char* data);
|
||||||
|
|
|
@ -152,9 +152,6 @@ unsigned int CDMRDataHeader::getDstId() const
|
||||||
|
|
||||||
unsigned int CDMRDataHeader::getBlocks() const
|
unsigned int CDMRDataHeader::getBlocks() const
|
||||||
{
|
{
|
||||||
if (m_blocks == 0U)
|
|
||||||
return 1U;
|
|
||||||
|
|
||||||
return m_blocks;
|
return m_blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
74
DMRSlot.cpp
74
DMRSlot.cpp
|
@ -154,14 +154,16 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
|
|
||||||
unsigned int sid = lc->getSrcId();
|
unsigned int sid = lc->getSrcId();
|
||||||
unsigned int did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(sid, did, m_slotNo, false)) {
|
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, false)) {
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int rwId = CDMRAccessControl::dstIdRewrite(did, sid, m_slotNo, false);
|
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,false,lc);
|
||||||
if (rwId != 0U)
|
if (rw_id) {
|
||||||
lc->setDstId(rwId);
|
|
||||||
|
lc->setDstId(rw_id);
|
||||||
|
}
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
|
@ -253,14 +255,16 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
writeNetworkRF(data, DT_TERMINATOR_WITH_LC);
|
writeNetworkRF(data, DT_TERMINATOR_WITH_LC);
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueRF(data);
|
writeQueueRF(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogMessage("DMR Slot %u, received RF end of voice transmission, %.1f seconds, BER: %.1f%%", m_slotNo, float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits));
|
LogMessage("DMR Slot %u, received RF end of voice transmission, %.1f seconds, BER: %.1f%%", m_slotNo, float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits));
|
||||||
|
|
||||||
writeEndRF();
|
writeEndRF();
|
||||||
CDMRAccessControl::setOverEndTime();
|
DMRAccessControl::setOverEndTime();
|
||||||
} else if (dataType == DT_DATA_HEADER) {
|
} else if (dataType == DT_DATA_HEADER) {
|
||||||
if (m_rfState == RS_RF_DATA)
|
if (m_rfState == RS_RF_DATA)
|
||||||
return;
|
return;
|
||||||
|
@ -273,9 +277,10 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
bool gi = dataHeader.getGI();
|
bool gi = dataHeader.getGI();
|
||||||
unsigned int srcId = dataHeader.getSrcId();
|
unsigned int srcId = dataHeader.getSrcId();
|
||||||
unsigned int dstId = dataHeader.getDstId();
|
unsigned int dstId = dataHeader.getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(srcId, dstId, m_slotNo, false))
|
if (!DMRAccessControl::validateAccess(srcId, dstId, m_slotNo, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
m_rfFrames = dataHeader.getBlocks();
|
m_rfFrames = dataHeader.getBlocks();
|
||||||
|
|
||||||
m_rfDataHeader = dataHeader;
|
m_rfDataHeader = dataHeader;
|
||||||
|
@ -328,7 +333,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
bool gi = csbk.getGI();
|
bool gi = csbk.getGI();
|
||||||
unsigned int srcId = csbk.getSrcId();
|
unsigned int srcId = csbk.getSrcId();
|
||||||
unsigned int dstId = csbk.getDstId();
|
unsigned int dstId = csbk.getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(srcId, dstId, m_slotNo, false))
|
if (!DMRAccessControl::validateAccess(srcId, dstId, m_slotNo, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Regenerate the CSBK data
|
// Regenerate the CSBK data
|
||||||
|
@ -485,15 +490,14 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
|
||||||
if (lc != NULL) {
|
if (lc != NULL) {
|
||||||
unsigned int sid = lc->getSrcId();
|
unsigned int sid = lc->getSrcId();
|
||||||
unsigned int did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(sid, did, m_slotNo, false)) {
|
if (!DMRAccessControl::validateAccess(sid,did,m_slotNo,false)) {
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,false,lc);
|
||||||
// Test dst rewrite
|
if (rw_id) {
|
||||||
unsigned int rwId = CDMRAccessControl::dstIdRewrite(did, sid, m_slotNo, false);
|
lc->setDstId(rw_id);
|
||||||
if (rwId != 0U)
|
}
|
||||||
lc->setDstId(rwId);
|
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
|
@ -654,9 +658,11 @@ void CDMRSlot::writeEndRF(bool writeEnd)
|
||||||
|
|
||||||
data[0U] = TAG_EOT;
|
data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueRF(data);
|
writeQueueRF(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,8 +735,10 @@ void CDMRSlot::writeEndNet(bool writeEnd)
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int i = 0U; i < 3U; i++)
|
for (unsigned int i = 0U; i < 3U; i++)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
|
@ -770,13 +778,15 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
unsigned int sid = m_netLC->getSrcId();
|
unsigned int sid = m_netLC->getSrcId();
|
||||||
if (!CDMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Test dst rewrite
|
// Test dst rewrite
|
||||||
unsigned int rwId = CDMRAccessControl::dstIdRewrite(did, sid, m_slotNo, true);
|
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did, sid,m_slotNo, true,m_netLC);
|
||||||
if (rwId != 0U)
|
if (rw_id) {
|
||||||
m_netLC->setDstId(rwId);
|
|
||||||
|
m_netLC->setDstId(rw_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Store the LC for the embedded LC
|
// Store the LC for the embedded LC
|
||||||
m_netEmbeddedLC.setData(*m_netLC);
|
m_netEmbeddedLC.setData(*m_netLC);
|
||||||
|
@ -838,13 +848,15 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
unsigned int sid = m_netLC->getSrcId();
|
unsigned int sid = m_netLC->getSrcId();
|
||||||
if (!CDMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(sid, did, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Test dst rewrite
|
// Test dst rewrite
|
||||||
unsigned int rwId = CDMRAccessControl::dstIdRewrite(did, sid, m_slotNo, true);
|
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,true, m_netLC);
|
||||||
if (rwId != 0U)
|
if (rw_id) {
|
||||||
m_netLC->setDstId(rwId);
|
|
||||||
|
m_netLC->setDstId(rw_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
CDMRSlotType slotType;
|
CDMRSlotType slotType;
|
||||||
|
@ -875,7 +887,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
unsigned int id = m_netLC->getSrcId();
|
unsigned int id = m_netLC->getSrcId();
|
||||||
if (!CDMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Regenerate the LC data
|
// Regenerate the LC data
|
||||||
|
@ -895,8 +907,10 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < m_hangCount; i++)
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (unsigned int i = 0U; i < 3U; i++)
|
for (unsigned int i = 0U; i < 3U; i++)
|
||||||
writeQueueNet(data);
|
writeQueueNet(data);
|
||||||
|
@ -911,7 +925,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
LogMessage("DMR Slot %u, received network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", m_slotNo, float(m_netFrames) / 16.667F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
|
LogMessage("DMR Slot %u, received network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", m_slotNo, float(m_netFrames) / 16.667F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
|
||||||
|
|
||||||
writeEndNet();
|
writeEndNet();
|
||||||
CDMRAccessControl::setOverEndTime();
|
DMRAccessControl::setOverEndTime();
|
||||||
} else if (dataType == DT_DATA_HEADER) {
|
} else if (dataType == DT_DATA_HEADER) {
|
||||||
if (m_netState == RS_NET_DATA)
|
if (m_netState == RS_NET_DATA)
|
||||||
return;
|
return;
|
||||||
|
@ -928,7 +942,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
bool gi = dataHeader.getGI();
|
bool gi = dataHeader.getGI();
|
||||||
unsigned int srcId = dataHeader.getSrcId();
|
unsigned int srcId = dataHeader.getSrcId();
|
||||||
unsigned int dstId = dataHeader.getDstId();
|
unsigned int dstId = dataHeader.getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(srcId, dstId, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(srcId, dstId, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_netFrames = dataHeader.getBlocks();
|
m_netFrames = dataHeader.getBlocks();
|
||||||
|
@ -973,7 +987,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
unsigned int did = dmrData.getDstId();
|
unsigned int did = dmrData.getDstId();
|
||||||
unsigned int id = dmrData.getSrcId();
|
unsigned int id = dmrData.getSrcId();
|
||||||
if (!CDMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_lastFrameValid = false;
|
m_lastFrameValid = false;
|
||||||
|
@ -1072,7 +1086,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
|
|
||||||
unsigned int did = m_netLC->getDstId();
|
unsigned int did = m_netLC->getDstId();
|
||||||
unsigned int id = m_netLC->getSrcId();
|
unsigned int id = m_netLC->getSrcId();
|
||||||
if (!CDMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned char fid = m_netLC->getFID();
|
unsigned char fid = m_netLC->getFID();
|
||||||
|
@ -1132,7 +1146,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
bool gi = csbk.getGI();
|
bool gi = csbk.getGI();
|
||||||
unsigned int srcId = csbk.getSrcId();
|
unsigned int srcId = csbk.getSrcId();
|
||||||
unsigned int dstId = csbk.getDstId();
|
unsigned int dstId = csbk.getDstId();
|
||||||
if (!CDMRAccessControl::validateAccess(srcId, dstId, m_slotNo, true))
|
if (!DMRAccessControl::validateAccess(srcId,dstId,m_slotNo,true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Regenerate the CSBK data
|
// Regenerate the CSBK data
|
||||||
|
@ -1354,7 +1368,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
|
||||||
m_queue.addData(data, len);
|
m_queue.addData(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& srcIdBlacklist, const std::vector<unsigned int>& dstIdBlacklistSlot1RF, const std::vector<unsigned int>& dstIdWhitelistSlot1RF, const std::vector<unsigned int>& dstIdBlacklistSlot2RF, const std::vector<unsigned int>& dstIdWhitelistSlot2RF, const std::vector<unsigned int>& dstIdBlacklistSlot1NET, const std::vector<unsigned int>& dstIdWhitelistSlot1NET, const std::vector<unsigned int>& dstIdBlacklistSlot2NET, const std::vector<unsigned int>& dstIdWhitelistSlot2NET, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool tgRewriteSlot1, bool tgRewriteSlot2)
|
void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlacklist, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts)
|
||||||
{
|
{
|
||||||
assert(id != 0U);
|
assert(id != 0U);
|
||||||
assert(modem != NULL);
|
assert(modem != NULL);
|
||||||
|
@ -1389,7 +1403,7 @@ void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHa
|
||||||
slotType.getData(m_idle + 2U);
|
slotType.getData(m_idle + 2U);
|
||||||
|
|
||||||
//Load black and white lists to DMRAccessControl
|
//Load black and white lists to DMRAccessControl
|
||||||
CDMRAccessControl::init(dstIdBlacklistSlot1RF, dstIdWhitelistSlot1RF, dstIdBlacklistSlot2RF, dstIdWhitelistSlot2RF, dstIdBlacklistSlot1NET, dstIdWhitelistSlot1NET, dstIdBlacklistSlot2NET, dstIdWhitelistSlot2NET, srcIdBlacklist, m_selfOnly, m_prefixes, m_id, callHang, tgRewriteSlot1, tgRewriteSlot2);
|
DMRAccessControl::init(DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, SrcIdBlacklist, m_selfOnly, m_prefixes, m_id,callHang, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
void clock();
|
void clock();
|
||||||
|
|
||||||
static void init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2);
|
static void init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& SrcIdBlackList, const std::vector<unsigned int>& DstIdBlacklistSlot1RF, const std::vector<unsigned int>& DstIdWhitelistSlot1RF, const std::vector<unsigned int>& DstIdBlacklistSlot2RF, const std::vector<unsigned int>& DstIdWhitelistSlot2RF, const std::vector<unsigned int>& DstIdBlacklistSlot1NET, const std::vector<unsigned int>& DstIdWhitelistSlot1NET, const std::vector<unsigned int>& DstIdBlacklistSlot2NET, const std::vector<unsigned int>& DstIdWhitelistSlot2NET, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_slotNo;
|
unsigned int m_slotNo;
|
||||||
|
|
12
MMDVM.ini
12
MMDVM.ini
|
@ -72,8 +72,16 @@ TXHang=4
|
||||||
#DstIdBlackListSlot2NET=
|
#DstIdBlackListSlot2NET=
|
||||||
#DstIdWhiteListSlot1NET=
|
#DstIdWhiteListSlot1NET=
|
||||||
#DstIdWhiteListSlot2NET=
|
#DstIdWhiteListSlot2NET=
|
||||||
#TGRewriteSlot1=0
|
TGRewriteSlot1=0
|
||||||
#TGRewriteSlot2=0
|
TGRewriteSlot2=0
|
||||||
|
BMAutoRewrite=0
|
||||||
|
BMRewriteReflectorVoicePrompts=0
|
||||||
|
|
||||||
|
|
||||||
|
DirectDial=0
|
||||||
|
TargetTG=9
|
||||||
|
#RewriteMapSlot1=
|
||||||
|
#RewritemapSlot2=
|
||||||
|
|
||||||
[System Fusion]
|
[System Fusion]
|
||||||
Enable=1
|
Enable=1
|
||||||
|
|
|
@ -296,8 +296,10 @@ int CMMDVMHost::run()
|
||||||
unsigned int id = m_conf.getDMRId();
|
unsigned int id = m_conf.getDMRId();
|
||||||
unsigned int colorCode = m_conf.getDMRColorCode();
|
unsigned int colorCode = m_conf.getDMRColorCode();
|
||||||
bool selfOnly = m_conf.getDMRSelfOnly();
|
bool selfOnly = m_conf.getDMRSelfOnly();
|
||||||
bool tgRewriteSlot1 = m_conf.getDMRTGRewriteSlot1();
|
bool TGRewriteSlot1 = m_conf.getDMRTGRewriteSlot1();
|
||||||
bool tgRewriteSlot2 = m_conf.getDMRTGRewriteSlot2();
|
bool TGRewriteSlot2 = m_conf.getDMRTGRewriteSlot2();
|
||||||
|
bool BMAutoRewrite = m_conf.getDMRBMAutoRewrite();
|
||||||
|
bool BMRewriteReflectorVoicePrompts = m_conf.getDMRBMRewriteReflectorVoicePrompts();
|
||||||
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
std::vector<unsigned int> prefixes = m_conf.getDMRPrefixes();
|
||||||
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
std::vector<unsigned int> blackList = m_conf.getDMRBlackList();
|
||||||
std::vector<unsigned int> dstIDBlackListSlot1RF = m_conf.getDMRDstIdBlacklistSlot1RF();
|
std::vector<unsigned int> dstIDBlackListSlot1RF = m_conf.getDMRDstIdBlacklistSlot1RF();
|
||||||
|
@ -356,14 +358,19 @@ int CMMDVMHost::run()
|
||||||
LogInfo(" RSSI Multiplier: %d", rssiMultiplier);
|
LogInfo(" RSSI Multiplier: %d", rssiMultiplier);
|
||||||
LogInfo(" RSSI Offset: %d", rssiOffset);
|
LogInfo(" RSSI Offset: %d", rssiOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tgRewriteSlot1)
|
if (TGRewriteSlot1)
|
||||||
LogInfo(" TG Rewrite Slot 1 enabled");
|
LogInfo(" TG Rewrite Slot 1 enabled");
|
||||||
|
|
||||||
if (tgRewriteSlot2)
|
if (TGRewriteSlot2)
|
||||||
LogInfo(" TG Rewrite Slot 2 enabled");
|
LogInfo(" TG Rewrite Slot 2 enabled");
|
||||||
|
if (BMAutoRewrite)
|
||||||
|
LogInfo(" BrandMeister Auto Rewrite enabled");
|
||||||
|
if(BMRewriteReflectorVoicePrompts)
|
||||||
|
LogInfo(" BrandMeister Rewrite Reflector Voice Prompts enabled");
|
||||||
|
|
||||||
|
|
||||||
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList,dstIDBlackListSlot1RF,dstIDWhiteListSlot1RF, dstIDBlackListSlot2RF, dstIDWhiteListSlot2RF, dstIDBlackListSlot1NET,dstIDWhiteListSlot1NET, dstIDBlackListSlot2NET, dstIDWhiteListSlot2NET, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile, rssiMultiplier, rssiOffset, jitter, tgRewriteSlot1, tgRewriteSlot2);
|
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList,dstIDBlackListSlot1RF,dstIDWhiteListSlot1RF, dstIDBlackListSlot2RF, dstIDWhiteListSlot2RF, dstIDBlackListSlot1NET,dstIDWhiteListSlot1NET, dstIDBlackListSlot2NET, dstIDWhiteListSlot2NET, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts);
|
||||||
|
|
||||||
m_dmrTXTimer.setTimeout(txHang);
|
m_dmrTXTimer.setTimeout(txHang);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,19 @@ groups, although it will function with permanent talk-groups too.
|
||||||
It is useful to set the CallHang parameter to a generous amount. I am currently
|
It is useful to set the CallHang parameter to a generous amount. I am currently
|
||||||
using seven seconds.
|
using seven seconds.
|
||||||
|
|
||||||
|
In addition to the above, there is also the capability ro rewrite voice prompts
|
||||||
|
on link/unlink so all users can hear them on TG9.
|
||||||
|
|
||||||
Two boolean configuration options control the TG Rewrite feature:
|
Configuration options are as follows:
|
||||||
|
|
||||||
TGRewriteSlot1=[0|1]
|
TGRewriteSlot1=[0|1]
|
||||||
TGRewriteSlot2=[0|1]
|
TGRewriteSlot2=[0|1]
|
||||||
|
BMAutoRewrite=[0|1]
|
||||||
|
BMRewriteReflectorVoicePrompts=[0|1]
|
||||||
|
|
||||||
|
Note at present, Auto rewrite is the only type of rewrite that is implemented so
|
||||||
|
to do something useful, this option must be set.
|
||||||
|
|
||||||
|
|
||||||
ACL's are applied before the rewrite, so still apply to rewritten traffic on
|
ACL's are applied before the rewrite, so still apply to rewritten traffic on
|
||||||
original (non-rewritten) talk-group.
|
original (non-rewritten) talk-group.
|
||||||
|
|
Loading…
Reference in a new issue