Add a DMR hang time for locking out disimilar calls.
This commit is contained in:
parent
b8ce945987
commit
8af3016583
8
Conf.cpp
8
Conf.cpp
|
@ -95,6 +95,7 @@ m_dmrDstIdBlacklistSlot2(),
|
||||||
m_dmrDstIdWhitelistSlot1(),
|
m_dmrDstIdWhitelistSlot1(),
|
||||||
m_dmrDstIdWhitelistSlot2(),
|
m_dmrDstIdWhitelistSlot2(),
|
||||||
m_dmrLookupFile(),
|
m_dmrLookupFile(),
|
||||||
|
m_dmrCallHang(3U),
|
||||||
m_dmrTXHang(4U),
|
m_dmrTXHang(4U),
|
||||||
m_fusionEnabled(true),
|
m_fusionEnabled(true),
|
||||||
m_dstarNetworkEnabled(true),
|
m_dstarNetworkEnabled(true),
|
||||||
|
@ -354,6 +355,8 @@ bool CConf::read()
|
||||||
m_dmrLookupFile = value;
|
m_dmrLookupFile = value;
|
||||||
else if (::strcmp(key, "TXHang") == 0)
|
else if (::strcmp(key, "TXHang") == 0)
|
||||||
m_dmrTXHang = (unsigned int)::atoi(value);
|
m_dmrTXHang = (unsigned int)::atoi(value);
|
||||||
|
else if (::strcmp(key, "CallHang") == 0)
|
||||||
|
m_dmrCallHang = (unsigned int)::atoi(value);
|
||||||
} 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;
|
||||||
|
@ -682,6 +685,11 @@ std::string CConf::getDMRLookupFile() const
|
||||||
return m_dmrLookupFile;
|
return m_dmrLookupFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CConf::getDMRCallHang() const
|
||||||
|
{
|
||||||
|
return m_dmrCallHang;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CConf::getDMRTXHang() const
|
unsigned int CConf::getDMRTXHang() const
|
||||||
{
|
{
|
||||||
return m_dmrTXHang;
|
return m_dmrTXHang;
|
||||||
|
|
2
Conf.h
2
Conf.h
|
@ -90,6 +90,7 @@ public:
|
||||||
std::vector<unsigned int> getDMRDstIdWhitelistSlot1() const;
|
std::vector<unsigned int> getDMRDstIdWhitelistSlot1() const;
|
||||||
std::vector<unsigned int> getDMRDstIdWhitelistSlot2() const;
|
std::vector<unsigned int> getDMRDstIdWhitelistSlot2() const;
|
||||||
std::string getDMRLookupFile() const;
|
std::string getDMRLookupFile() const;
|
||||||
|
unsigned int getDMRCallHang() const;
|
||||||
unsigned int getDMRTXHang() const;
|
unsigned int getDMRTXHang() const;
|
||||||
|
|
||||||
// The System Fusion section
|
// The System Fusion section
|
||||||
|
@ -201,6 +202,7 @@ private:
|
||||||
std::vector<unsigned int> m_dmrDstIdWhitelistSlot1;
|
std::vector<unsigned int> m_dmrDstIdWhitelistSlot1;
|
||||||
std::vector<unsigned int> m_dmrDstIdWhitelistSlot2;
|
std::vector<unsigned int> m_dmrDstIdWhitelistSlot2;
|
||||||
std::string m_dmrLookupFile;
|
std::string m_dmrLookupFile;
|
||||||
|
unsigned int m_dmrCallHang;
|
||||||
unsigned int m_dmrTXHang;
|
unsigned int m_dmrTXHang;
|
||||||
|
|
||||||
bool m_fusionEnabled;
|
bool m_fusionEnabled;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile) :
|
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>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile) :
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_colorCode(colorCode),
|
m_colorCode(colorCode),
|
||||||
m_selfOnly(selfOnly),
|
m_selfOnly(selfOnly),
|
||||||
|
@ -38,7 +38,7 @@ m_lookup(NULL)
|
||||||
m_lookup = new CDMRLookup(lookupFile);
|
m_lookup = new CDMRLookup(lookupFile);
|
||||||
m_lookup->read();
|
m_lookup->read();
|
||||||
|
|
||||||
CDMRSlot::init(id, colorCode, selfOnly, prefixes, blackList, DstIdBlacklistSlot1, DstIdWhitelistSlot1, DstIdBlacklistSlot2, DstIdWhitelistSlot2, modem, network, display, duplex, m_lookup);
|
CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1, DstIdWhitelistSlot1, DstIdBlacklistSlot2, DstIdWhitelistSlot2, modem, network, display, duplex, m_lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDMRControl::~CDMRControl()
|
CDMRControl::~CDMRControl()
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
class CDMRControl {
|
class CDMRControl {
|
||||||
public:
|
public:
|
||||||
CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile);
|
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>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile);
|
||||||
~CDMRControl();
|
~CDMRControl();
|
||||||
|
|
||||||
bool processWakeup(const unsigned char* data);
|
bool processWakeup(const unsigned char* data);
|
||||||
|
|
249
DMRSlot.cpp
249
DMRSlot.cpp
|
@ -41,6 +41,7 @@ CDMRIPSC* CDMRSlot::m_network = NULL;
|
||||||
CDisplay* CDMRSlot::m_display = NULL;
|
CDisplay* CDMRSlot::m_display = NULL;
|
||||||
bool CDMRSlot::m_duplex = true;
|
bool CDMRSlot::m_duplex = true;
|
||||||
CDMRLookup* CDMRSlot::m_lookup = NULL;
|
CDMRLookup* CDMRSlot::m_lookup = NULL;
|
||||||
|
unsigned int CDMRSlot::m_hangCount = 3U * 17U;
|
||||||
|
|
||||||
unsigned char* CDMRSlot::m_idle = NULL;
|
unsigned char* CDMRSlot::m_idle = NULL;
|
||||||
|
|
||||||
|
@ -136,32 +137,30 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
if (lc == NULL)
|
if (lc == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int id;
|
unsigned int id = lc->getSrcId();
|
||||||
unsigned int did;
|
|
||||||
id = lc->getSrcId();
|
|
||||||
if (!validateId(id)) {
|
if (!validateId(id)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", m_slotNo, id);
|
LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", m_slotNo, id);
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, did);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did);
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
did = lc->getDstId();
|
did = lc->getDstId();
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, did);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
// Store the LC for the embedded LC
|
// Store the LC for the embedded LC
|
||||||
|
@ -249,9 +248,8 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
writeNetworkRF(data, DT_TERMINATOR_WITH_LC);
|
writeNetworkRF(data, DT_TERMINATOR_WITH_LC);
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
writeQueueRF(data);
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueRF(data);
|
writeQueueRF(data);
|
||||||
writeQueueRF(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rfBits == 0U) m_rfBits = 1U;
|
if (m_rfBits == 0U) m_rfBits = 1U;
|
||||||
|
@ -275,15 +273,16 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
if (DstIdBlacklist(dstId,m_slotNo)) {
|
if (DstIdBlacklist(dstId, m_slotNo)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(dstId,m_slotNo,true)) {
|
if (!DstIdWhitelist(dstId, m_slotNo, true)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -345,15 +344,16 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
if (DstIdBlacklist(dstId,m_slotNo)) {
|
if (DstIdBlacklist(dstId, m_slotNo)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(dstId,m_slotNo,true)) {
|
if (!DstIdWhitelist(dstId, m_slotNo, true)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -506,23 +506,23 @@ void CDMRSlot::writeModem(unsigned char *data)
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
// - G7RZU
|
// add check for valid dst id (e.g. TG)
|
||||||
unsigned int did;
|
// - G7RZU
|
||||||
did = lc->getDstId();
|
unsigned int did = lc->getDstId();
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, did);
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did);
|
||||||
delete lc;
|
delete lc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
did = lc->getDstId();
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
did = lc->getDstId();
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, did);
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
delete lc;
|
LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did);
|
||||||
return;
|
delete lc;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_rfLC = lc;
|
m_rfLC = lc;
|
||||||
|
|
||||||
|
@ -681,9 +681,8 @@ void CDMRSlot::writeEndRF(bool writeEnd)
|
||||||
data[0U] = TAG_EOT;
|
data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
writeQueueRF(data);
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueRF(data);
|
writeQueueRF(data);
|
||||||
writeQueueRF(data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,9 +752,8 @@ void CDMRSlot::writeEndNet(bool writeEnd)
|
||||||
data[0U] = TAG_EOT;
|
data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
writeQueueNet(data);
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueNet(data);
|
writeQueueRF(data);
|
||||||
writeQueueNet(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_netLC;
|
delete m_netLC;
|
||||||
|
@ -765,8 +763,9 @@ void CDMRSlot::writeEndNet(bool writeEnd)
|
||||||
closeFile();
|
closeFile();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//add
|
//add
|
||||||
void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
||||||
{
|
{
|
||||||
if (m_rfState != RS_RF_LISTENING && m_netState == RS_NET_IDLE)
|
if (m_rfState != RS_RF_LISTENING && m_netState == RS_NET_IDLE)
|
||||||
return;
|
return;
|
||||||
|
@ -790,17 +789,16 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
// add check for valid dst id (e.g. TG)
|
||||||
|
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +808,6 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
// Regenerate the LC data
|
// Regenerate the LC data
|
||||||
fullLC.encode(*m_netLC, data + 2U, DT_VOICE_LC_HEADER);
|
fullLC.encode(*m_netLC, data + 2U, DT_VOICE_LC_HEADER);
|
||||||
|
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
CDMRSlotType slotType;
|
CDMRSlotType slotType;
|
||||||
slotType.setColorCode(m_colorCode);
|
slotType.setColorCode(m_colorCode);
|
||||||
|
@ -831,7 +828,6 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
m_netBits = 1U;
|
m_netBits = 1U;
|
||||||
m_netErrs = 0U;
|
m_netErrs = 0U;
|
||||||
|
|
||||||
|
|
||||||
writeQueueNet(m_idle);
|
writeQueueNet(m_idle);
|
||||||
writeQueueNet(m_idle);
|
writeQueueNet(m_idle);
|
||||||
writeQueueNet(m_idle);
|
writeQueueNet(m_idle);
|
||||||
|
@ -878,17 +874,16 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
// add check for valid dst id (e.g. TG)
|
// add check for valid dst id (e.g. TG)
|
||||||
|
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,20 +899,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
// Regenerate the LC data
|
// Regenerate the LC data
|
||||||
CDMRFullLC fullLC;
|
CDMRFullLC fullLC;
|
||||||
fullLC.encode(*m_netLC, data + 2U, DT_TERMINATOR_WITH_LC);
|
fullLC.encode(*m_netLC, data + 2U, DT_TERMINATOR_WITH_LC);
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
CDMRSlotType slotType;
|
CDMRSlotType slotType;
|
||||||
slotType.setColorCode(m_colorCode);
|
slotType.setColorCode(m_colorCode);
|
||||||
|
@ -930,9 +926,8 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
data[0U] = TAG_EOT;
|
data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
writeQueueNet(data);
|
for (unsigned int i = 0U; i < m_hangCount; i++)
|
||||||
writeQueueNet(data);
|
writeQueueRF(data);
|
||||||
writeQueueNet(data);
|
|
||||||
|
|
||||||
#if defined(DUMP_DMR)
|
#if defined(DUMP_DMR)
|
||||||
writeFile(data);
|
writeFile(data);
|
||||||
|
@ -964,20 +959,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
unsigned int dstId = dataHeader.getDstId();
|
unsigned int dstId = dataHeader.getDstId();
|
||||||
|
|
||||||
m_netLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
m_netLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate the data header
|
// Regenerate the data header
|
||||||
dataHeader.get(data + 2U);
|
dataHeader.get(data + 2U);
|
||||||
|
|
||||||
|
@ -1015,18 +1011,18 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
} else if (dataType == DT_VOICE_SYNC) {
|
} else if (dataType == DT_VOICE_SYNC) {
|
||||||
if (m_netState == RS_NET_IDLE) {
|
if (m_netState == RS_NET_IDLE) {
|
||||||
m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,20 +1113,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData)
|
||||||
} else if (dataType == DT_VOICE) {
|
} else if (dataType == DT_VOICE) {
|
||||||
if (m_netState != RS_NET_AUDIO)
|
if (m_netState != RS_NET_AUDIO)
|
||||||
return;
|
return;
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = m_netLC->getDstId();
|
||||||
did = m_netLC->getDstId();
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char fid = m_netLC->getFID();
|
unsigned char fid = m_netLC->getFID();
|
||||||
if (fid == FID_ETSI || fid == FID_DMRA)
|
if (fid == FID_ETSI || fid == FID_DMRA)
|
||||||
m_netErrs += m_fec.regenerateDMR(data + 2U);
|
m_netErrs += m_fec.regenerateDMR(data + 2U);
|
||||||
|
@ -1187,20 +1184,21 @@ 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();
|
||||||
// add check for valid dst id (e.g. TG)
|
|
||||||
|
|
||||||
|
// add check for valid dst id (e.g. TG)
|
||||||
// - G7RZU
|
// - G7RZU
|
||||||
unsigned int did;
|
unsigned int did = dstId;
|
||||||
did = dstId;
|
if (DstIdBlacklist(did, m_slotNo)) {
|
||||||
if (DstIdBlacklist(did,m_slotNo)) {
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType);
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
// true sets allow greater than 4k. Need to add boolean in conf for this later.
|
||||||
if (!DstIdWhitelist(did,m_slotNo,true)) {
|
if (!DstIdWhitelist(did, m_slotNo, true)) {
|
||||||
LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType);
|
LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate the CSBK data
|
// Regenerate the CSBK data
|
||||||
csbk.get(data + 2U);
|
csbk.get(data + 2U);
|
||||||
|
|
||||||
|
@ -1418,7 +1416,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, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup)
|
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>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup)
|
||||||
{
|
{
|
||||||
assert(id != 0U);
|
assert(id != 0U);
|
||||||
assert(modem != NULL);
|
assert(modem != NULL);
|
||||||
|
@ -1439,6 +1437,7 @@ void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, cons
|
||||||
m_display = display;
|
m_display = display;
|
||||||
m_duplex = duplex;
|
m_duplex = duplex;
|
||||||
m_lookup = lookup;
|
m_lookup = lookup;
|
||||||
|
m_hangCount = callHang * 17U,
|
||||||
|
|
||||||
m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U];
|
m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||||
|
|
||||||
|
@ -1473,55 +1472,53 @@ bool CDMRSlot::validateId(unsigned int id)
|
||||||
//is dst id blacklisted?
|
//is dst id blacklisted?
|
||||||
bool CDMRSlot::DstIdBlacklist(unsigned int did, unsigned int slot)
|
bool CDMRSlot::DstIdBlacklist(unsigned int did, unsigned int slot)
|
||||||
{
|
{
|
||||||
if (slot == 1) {
|
if (slot == 1U) {
|
||||||
if (std::find(m_dstBlackListSlot1.begin(), m_dstBlackListSlot1.end(), did) != m_dstBlackListSlot1.end())
|
if (std::find(m_dstBlackListSlot1.begin(), m_dstBlackListSlot1.end(), did) != m_dstBlackListSlot1.end())
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (std::find(m_dstBlackListSlot2.begin(), m_dstBlackListSlot2.end(), did) != m_dstBlackListSlot2.end())
|
if (std::find(m_dstBlackListSlot2.begin(), m_dstBlackListSlot2.end(), did) != m_dstBlackListSlot2.end())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRSlot::DstIdWhitelist(unsigned int did, unsigned int slot, bool gt4k)
|
bool CDMRSlot::DstIdWhitelist(unsigned int did, unsigned int slot, bool gt4k)
|
||||||
{
|
{
|
||||||
if (slot == 1) {
|
if (slot == 1U) {
|
||||||
if(m_dstWhiteListSlot1.size() == 0)
|
if (m_dstWhiteListSlot1.size() == 0U)
|
||||||
return true;
|
return true;
|
||||||
// No reflectors on slot1, so we only allow all IDs over 99999 unless specifically whitelisted.
|
|
||||||
if(gt4k) {
|
|
||||||
if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end() || did >= 99999) {
|
|
||||||
|
|
||||||
return true;
|
// No reflectors on slot1, so we only allow all IDs over 99999 unless specifically whitelisted.
|
||||||
|
if (gt4k) {
|
||||||
|
if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end() || did >= 99999U)
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end())
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(m_dstWhiteListSlot2.size() == 0)
|
if (m_dstWhiteListSlot2.size() == 0U)
|
||||||
return true;
|
return true;
|
||||||
//On slot2 we allow reflector control IDs, but not secondary TG IDs unless specifically listed. Also allow echo.
|
|
||||||
if(gt4k) {
|
|
||||||
if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end() || did >= 4000) {
|
|
||||||
|
|
||||||
//if dstId in secondary TG range
|
//On slot2 we allow reflector control IDs, but not secondary TG IDs unless specifically listed. Also allow echo.
|
||||||
if(did > 5000 && did < 10000)
|
if (gt4k) {
|
||||||
return false;
|
if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end() || did >= 4000) {
|
||||||
|
//if dstId in secondary TG range
|
||||||
return true;
|
if (did > 5000U && did < 10000U)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end())
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CDMRSlot::setShortLC(unsigned int slotNo, unsigned int id, FLCO flco, bool voice)
|
void CDMRSlot::setShortLC(unsigned int slotNo, unsigned int id, FLCO flco, bool voice)
|
||||||
{
|
{
|
||||||
assert(m_modem != NULL);
|
assert(m_modem != NULL);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
void clock();
|
void clock();
|
||||||
|
|
||||||
static void init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup);
|
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>& blackList, const std::vector<unsigned int>& DstIdBlacklistSlot1, const std::vector<unsigned int>& DstIdWhitelistSlot1, const std::vector<unsigned int>& DstIdBlacklistSlot2, const std::vector<unsigned int>& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_slotNo;
|
unsigned int m_slotNo;
|
||||||
|
@ -100,6 +100,7 @@ private:
|
||||||
static CDisplay* m_display;
|
static CDisplay* m_display;
|
||||||
static bool m_duplex;
|
static bool m_duplex;
|
||||||
static CDMRLookup* m_lookup;
|
static CDMRLookup* m_lookup;
|
||||||
|
static unsigned int m_hangCount;
|
||||||
|
|
||||||
static unsigned char* m_idle;
|
static unsigned char* m_idle;
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ ColorCode=1
|
||||||
SelfOnly=0
|
SelfOnly=0
|
||||||
# Prefixes=234,235
|
# Prefixes=234,235
|
||||||
LookupFile=DMRIds.dat
|
LookupFile=DMRIds.dat
|
||||||
|
CallHang=3
|
||||||
TXHang=4
|
TXHang=4
|
||||||
#Blacklist=
|
#Blacklist=
|
||||||
#DstIdBlackListSlot1=
|
#DstIdBlackListSlot1=
|
||||||
|
|
|
@ -296,6 +296,7 @@ int CMMDVMHost::run()
|
||||||
std::vector<unsigned int> dstIDWhiteListSlot2 = m_conf.getDMRDstIdWhitelistSlot2();
|
std::vector<unsigned int> dstIDWhiteListSlot2 = m_conf.getDMRDstIdWhitelistSlot2();
|
||||||
unsigned int timeout = m_conf.getTimeout();
|
unsigned int timeout = m_conf.getTimeout();
|
||||||
std::string lookupFile = m_conf.getDMRLookupFile();
|
std::string lookupFile = m_conf.getDMRLookupFile();
|
||||||
|
unsigned int callHang = m_conf.getDMRCallHang();
|
||||||
unsigned int txHang = m_conf.getDMRTXHang();
|
unsigned int txHang = m_conf.getDMRTXHang();
|
||||||
|
|
||||||
LogInfo("DMR Parameters");
|
LogInfo("DMR Parameters");
|
||||||
|
@ -317,9 +318,10 @@ int CMMDVMHost::run()
|
||||||
|
|
||||||
LogInfo(" Timeout: %us", timeout);
|
LogInfo(" Timeout: %us", timeout);
|
||||||
LogInfo(" Lookup File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None");
|
LogInfo(" Lookup File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None");
|
||||||
|
LogInfo(" Call Hang: %us", callHang);
|
||||||
LogInfo(" TX Hang: %us", txHang);
|
LogInfo(" TX Hang: %us", txHang);
|
||||||
|
|
||||||
dmr = new CDMRControl(id, colorCode, selfOnly, prefixes, blackList,dstIDBlackListSlot1,dstIDWhiteListSlot1, dstIDBlackListSlot2, dstIDWhiteListSlot2, timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile);
|
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList,dstIDBlackListSlot1,dstIDWhiteListSlot1, dstIDBlackListSlot2, dstIDWhiteListSlot2, timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile);
|
||||||
|
|
||||||
m_dmrTXTimer.setTimeout(txHang);
|
m_dmrTXTimer.setTimeout(txHang);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue