Skip to content

Commit 5c371c9

Browse files
committed
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;
1 parent a09338f commit 5c371c9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/p25/Control.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,8 @@ void Control::processNetwork()
11111111
}
11121112

11131113
bool grantDemand = (buffer[14U] & 0x80U) == 0x80U;
1114+
bool grantDenial = (buffer[14U] & 0x40U) == 0x40U;
1115+
bool unitToUnit = (buffer[14U] & 0x01U) == 0x01U;
11141116

11151117
// process network message header
11161118
uint8_t duid = buffer[22U];
@@ -1283,7 +1285,15 @@ void Control::processNetwork()
12831285
LogMessage(LOG_NET, P25_TSDU_STR " remote grant demand, srcId = %u, dstId = %u", srcId, dstId);
12841286
}
12851287

1286-
if (!m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, true, true)) {
1288+
// are we denying the grant?
1289+
if (grantDenial) {
1290+
m_control->writeRF_TSDU_Deny(srcId, dstId, P25_DENY_RSN_PTT_COLLIDE, (!unitToUnit) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH);
1291+
return;
1292+
}
1293+
1294+
// perform grant response logic
1295+
if (!m_control->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, unitToUnit, true))
1296+
{
12871297
LogError(LOG_NET, P25_TSDU_STR " call failure, network call not granted, dstId = %u", dstId);
12881298
return;
12891299
}

src/p25/packet/ControlSignaling.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2726,11 +2726,14 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
27262726
osp->setDstId(dstId);
27272727
osp->setSrcId(srcId);
27282728

2729+
bool noNet = false;
2730+
27292731
// validate the source RID
27302732
if (!acl::AccessControl::validateSrcId(srcId)) {
27312733
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", osp->toString().c_str(), srcId);
27322734
::ActivityLog("P25", true, "location registration request from %u denied", srcId);
27332735
osp->setResponse(P25_RSP_REFUSED);
2736+
noNet = true;
27342737
}
27352738

27362739
// validate the source RID is registered
@@ -2751,6 +2754,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
27512754
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, TGID rejection, dstId = %u", osp->toString().c_str(), dstId);
27522755
::ActivityLog("P25", true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId);
27532756
osp->setResponse(P25_RSP_DENY);
2757+
noNet = true;
27542758
}
27552759
}
27562760
}
@@ -2764,7 +2768,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
27642768
ret = true;
27652769
}
27662770

2767-
writeRF_TSDU_SBF_Imm(osp.get(), false);
2771+
writeRF_TSDU_SBF_Imm(osp.get(), noNet);
27682772
return ret;
27692773
}
27702774

0 commit comments

Comments
 (0)