From 5c371c97cbd028aa417b0426e29afdaf01ceb798 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Fri, 1 Sep 2023 13:54:44 -0400 Subject: [PATCH] add support to grant demand to support denying a grant and supporting unit to unit; better support LOC_REG_RSP being sent over the network; --- src/p25/Control.cpp | 12 +++++++++++- src/p25/packet/ControlSignaling.cpp | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/p25/Control.cpp b/src/p25/Control.cpp index b0250d13..e86a3471 100644 --- a/src/p25/Control.cpp +++ b/src/p25/Control.cpp @@ -1111,6 +1111,8 @@ void Control::processNetwork() } bool grantDemand = (buffer[14U] & 0x80U) == 0x80U; + bool grantDenial = (buffer[14U] & 0x40U) == 0x40U; + bool unitToUnit = (buffer[14U] & 0x01U) == 0x01U; // process network message header uint8_t duid = buffer[22U]; @@ -1283,7 +1285,15 @@ void Control::processNetwork() LogMessage(LOG_NET, P25_TSDU_STR " remote grant demand, srcId = %u, dstId = %u", srcId, dstId); } - if (!m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, true, true)) { + // are we denying the grant? + if (grantDenial) { + m_control->writeRF_TSDU_Deny(srcId, dstId, P25_DENY_RSN_PTT_COLLIDE, (!unitToUnit) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH); + return; + } + + // perform grant response logic + if (!m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, unitToUnit, true)) + { LogError(LOG_NET, P25_TSDU_STR " call failure, network call not granted, dstId = %u", dstId); return; } diff --git a/src/p25/packet/ControlSignaling.cpp b/src/p25/packet/ControlSignaling.cpp index a0e08ade..98793869 100644 --- a/src/p25/packet/ControlSignaling.cpp +++ b/src/p25/packet/ControlSignaling.cpp @@ -2726,11 +2726,14 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId, osp->setDstId(dstId); osp->setSrcId(srcId); + bool noNet = false; + // validate the source RID if (!acl::AccessControl::validateSrcId(srcId)) { LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", osp->toString().c_str(), srcId); ::ActivityLog("P25", true, "location registration request from %u denied", srcId); osp->setResponse(P25_RSP_REFUSED); + noNet = true; } // validate the source RID is registered @@ -2751,6 +2754,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId, LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, TGID rejection, dstId = %u", osp->toString().c_str(), dstId); ::ActivityLog("P25", true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId); osp->setResponse(P25_RSP_DENY); + noNet = true; } } } @@ -2764,7 +2768,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId, ret = true; } - writeRF_TSDU_SBF_Imm(osp.get(), false); + writeRF_TSDU_SBF_Imm(osp.get(), noNet); return ret; }