Commit d5587352 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 9c836c2b
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <utils/common.hpp>
namespace nas::utils namespace nas::utils
{ {
...@@ -510,4 +512,42 @@ Plmn PlmnFrom(const VPlmn &plmn) ...@@ -510,4 +512,42 @@ Plmn PlmnFrom(const VPlmn &plmn)
return res; return res;
} }
void RemoveFromServiceAreaList(IEServiceAreaList &list, const VTrackingAreaIdentity &tai)
{
std::vector<int> deletedSubLists;
int index = 0;
for (auto &sublist : list.list)
{
if (sublist.present == 0)
{
if (nas::utils::DeepEqualsV(sublist.list00->plmn, tai.plmn))
::utils::EraseWhere(sublist.list00->tacs, [&tai](auto &i) { return (int)i == (int)tai.tac; });
if (sublist.list00->tacs.empty())
deletedSubLists.push_back(index);
}
else if (sublist.present == 1)
{
if (nas::utils::DeepEqualsV(sublist.list01->plmn, tai.plmn) && (int)tai.tac == (int)sublist.list01->tac)
deletedSubLists.push_back(index);
}
else if (sublist.present == 2)
{
::utils::EraseWhere(sublist.list10->tais, [&tai](auto &i) { return nas::utils::DeepEqualsV(i, tai); });
if (sublist.list10->tais.empty())
deletedSubLists.push_back(index);
}
index++;
}
int deletedSoFar = 0;
for (int i : deletedSubLists)
{
int indexToDelete = i - deletedSoFar;
list.list.erase(list.list.begin() + indexToDelete);
deletedSoFar++;
}
}
} // namespace nas::utils } // namespace nas::utils
...@@ -42,6 +42,7 @@ bool ServiceAreaListAllowsPlmn(const nas::IEServiceAreaList &list, const VPlmn & ...@@ -42,6 +42,7 @@ bool ServiceAreaListAllowsPlmn(const nas::IEServiceAreaList &list, const VPlmn &
bool ServiceAreaListAllowsTai(const nas::IEServiceAreaList &list, const VTrackingAreaIdentity &tai); bool ServiceAreaListAllowsTai(const nas::IEServiceAreaList &list, const VTrackingAreaIdentity &tai);
bool ServiceAreaListAllowsPlmn(const nas::VPartialServiceAreaList &list, const VPlmn &plmn); bool ServiceAreaListAllowsPlmn(const nas::VPartialServiceAreaList &list, const VPlmn &plmn);
bool ServiceAreaListAllowsTai(const nas::VPartialServiceAreaList &list, const VTrackingAreaIdentity &tai); bool ServiceAreaListAllowsTai(const nas::VPartialServiceAreaList &list, const VTrackingAreaIdentity &tai);
void RemoveFromServiceAreaList(nas::IEServiceAreaList &list, const VTrackingAreaIdentity &tai);
const char *EnumToString(ERegistrationType v); const char *EnumToString(ERegistrationType v);
const char *EnumToString(EMmCause v); const char *EnumToString(EMmCause v);
......
...@@ -45,9 +45,6 @@ void NasMm::setN1Capability(bool enabled) ...@@ -45,9 +45,6 @@ void NasMm::setN1Capability(bool enabled)
bool NasMm::isInNonAllowedArea() bool NasMm::isInNonAllowedArea()
{ {
if (!m_usim->isValid())
return false;
auto currentCell = m_base->shCtx.currentCell.get(); auto currentCell = m_base->shCtx.currentCell.get();
if (!currentCell.hasValue()) if (!currentCell.hasValue())
return false; return false;
......
...@@ -250,14 +250,24 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi ...@@ -250,14 +250,24 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
{ {
Tai tai = m_base->shCtx.getCurrentTai(); Tai tai = m_base->shCtx.getCurrentTai();
if (tai.hasValue()) if (tai.hasValue())
{
m_storage->forbiddenTaiListRps->add(tai); m_storage->forbiddenTaiListRps->add(tai);
m_storage->serviceAreaList->mutate([&tai](auto &value) {
nas::utils::RemoveFromServiceAreaList(value, nas::VTrackingAreaIdentity{tai});
});
}
} }
if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA || cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA) if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA || cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA)
{ {
Tai tai = m_base->shCtx.getCurrentTai(); Tai tai = m_base->shCtx.getCurrentTai();
if (tai.hasValue()) if (tai.hasValue())
{
m_storage->forbiddenTaiListRoaming->add(tai); m_storage->forbiddenTaiListRoaming->add(tai);
m_storage->serviceAreaList->mutate([&tai](auto &value) {
nas::utils::RemoveFromServiceAreaList(value, nas::VTrackingAreaIdentity{tai});
});
}
} }
if (cause == nas::EMmCause::ILLEGAL_UE || cause == nas::EMmCause::FIVEG_SERVICES_NOT_ALLOWED) if (cause == nas::EMmCause::ILLEGAL_UE || cause == nas::EMmCause::FIVEG_SERVICES_NOT_ALLOWED)
......
...@@ -94,4 +94,9 @@ void NasMm::serviceNeededForUplinkData() ...@@ -94,4 +94,9 @@ void NasMm::serviceNeededForUplinkData()
} }
} }
bool NasMm::isStateNonAllowedService()
{
return m_mmSubState == EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE;
}
} // namespace nr::ue } // namespace nr::ue
...@@ -615,7 +615,12 @@ void NasMm::receiveInitialRegistrationReject(const nas::RegistrationReject &msg) ...@@ -615,7 +615,12 @@ void NasMm::receiveInitialRegistrationReject(const nas::RegistrationReject &msg)
{ {
Tai tai = m_base->shCtx.getCurrentTai(); Tai tai = m_base->shCtx.getCurrentTai();
if (tai.hasValue()) if (tai.hasValue())
{
m_storage->forbiddenTaiListRoaming->add(tai); m_storage->forbiddenTaiListRoaming->add(tai);
m_storage->serviceAreaList->mutate([&tai](auto &value) {
nas::utils::RemoveFromServiceAreaList(value, nas::VTrackingAreaIdentity{tai});
});
}
} }
if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED) if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED)
...@@ -777,7 +782,12 @@ void NasMm::receiveMobilityRegistrationReject(const nas::RegistrationReject &msg ...@@ -777,7 +782,12 @@ void NasMm::receiveMobilityRegistrationReject(const nas::RegistrationReject &msg
{ {
Tai tai = m_base->shCtx.getCurrentTai(); Tai tai = m_base->shCtx.getCurrentTai();
if (tai.hasValue()) if (tai.hasValue())
{
m_storage->forbiddenTaiListRoaming->add(tai); m_storage->forbiddenTaiListRoaming->add(tai);
m_storage->serviceAreaList->mutate([&tai](auto &value) {
nas::utils::RemoveFromServiceAreaList(value, nas::VTrackingAreaIdentity{tai});
});
}
} }
if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED) if (cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::SERVING_NETWORK_NOT_AUTHORIZED)
......
...@@ -331,7 +331,11 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg) ...@@ -331,7 +331,11 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
{ {
Tai tai = m_base->shCtx.getCurrentTai(); Tai tai = m_base->shCtx.getCurrentTai();
if (tai.hasValue()) if (tai.hasValue())
{
m_storage->forbiddenTaiListRps->add(tai); m_storage->forbiddenTaiListRps->add(tai);
m_storage->serviceAreaList->mutate(
[&tai](auto &value) { nas::utils::RemoveFromServiceAreaList(value, nas::VTrackingAreaIdentity{tai}); });
}
} }
if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA || cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA) if (cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA || cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment