Commit f6aba399 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 90f9633f
......@@ -115,8 +115,8 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
{"mm-state", ToJson(m_base->nasTask->mm->m_mmSubState)},
{"5u-state", ToJson(m_base->nasTask->mm->m_usim->m_uState)},
{"sim-inserted", m_base->nasTask->mm->m_usim->isValid()},
{"stored-suci", ToJson(m_base->nasTask->mm->m_usim->m_storedSuci)},
{"stored-guti", ToJson(m_base->nasTask->mm->m_usim->m_storedGuti)},
{"stored-suci", ToJson(m_base->nasTask->mm->m_storage->storedSuci->get())},
{"stored-guti", ToJson(m_base->nasTask->mm->m_storage->storedGuti->get())},
{"has-emergency", ::ToJson(m_base->nasTask->mm->hasEmergency())},
{"pdu-sessions", Json::Arr(std::move(pduSessions))},
});
......
......@@ -432,7 +432,7 @@ void NasMm::receiveAuthenticationReject(const nas::AuthenticationReject &msg)
switchUState(E5UState::U3_ROAMING_NOT_ALLOWED);
// Delete the stored 5G-GUTI, TAI list, last visited registered TAI and ngKSI. The USIM shall be considered invalid
// until switching off the UE or the UICC containing the USIM is removed
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_taiList = {};
m_usim->m_currentNsCtx = {};
......
......@@ -39,8 +39,8 @@ void NasMm::receiveConfigurationUpdate(const nas::ConfigurationUpdateCommand &ms
if (msg.guti.has_value() && msg.guti->type == nas::EIdentityType::GUTI)
{
hasNewConfig = true;
m_usim->m_storedSuci = {};
m_usim->m_storedGuti = *msg.guti;
m_storage->storedSuci->clear();
m_storage->storedGuti->set(*msg.guti);
m_timers->t3519.stop();
}
......
......@@ -100,7 +100,7 @@ void NasMm::receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOrigina
m_timers->t3521.stop();
m_timers->t3519.stop();
m_usim->m_storedSuci = {};
m_storage->storedSuci->clear();
m_sm->localReleaseAllSessions();
......@@ -195,7 +195,7 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
// set the 5GS update status to 5U2 NOT UPDATED and shall start timer T3502. A UE not supporting S1 mode may
// enter the state 5GMM-DEREGISTERED.PLMN-SEARCH in order to perform a PLMN selection according to 3GPP
// TS 23.122 [5]; otherwise the UE shall enter the state 5GMM-DEREGISTERED.ATTEMPTING-REGISTRATION."
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_usim->m_taiList = {};
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_equivalentPlmnList = {};
......@@ -218,7 +218,7 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA || cause == nas::EMmCause::N1_MODE_NOT_ALLOWED)
{
switchUState(E5UState::U3_ROAMING_NOT_ALLOWED);
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_taiList = {};
m_usim->m_currentNsCtx = {};
......
......@@ -90,7 +90,7 @@ bool NasMm::switchToECallInactivityIfNeeded()
return false;
// Perform item c) in 5.5.3
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_usim->m_taiList = {};
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_equivalentPlmnList = {};
......
......@@ -33,12 +33,12 @@ void NasMm::receiveIdentityRequest(const nas::IdentityRequest &msg)
}
else if (msg.identityType.value == nas::EIdentityType::GUTI)
{
resp.mobileIdentity = m_usim->m_storedGuti;
resp.mobileIdentity = m_storage->storedGuti->get();
}
else if (msg.identityType.value == nas::EIdentityType::TMSI)
{
// TMSI is already a part of GUTI
resp.mobileIdentity = m_usim->m_storedGuti;
resp.mobileIdentity = m_storage->storedGuti->get();
if (resp.mobileIdentity.type != nas::EIdentityType::NO_IDENTITY)
{
resp.mobileIdentity.type = nas::EIdentityType::TMSI;
......@@ -57,15 +57,16 @@ void NasMm::receiveIdentityRequest(const nas::IdentityRequest &msg)
nas::IE5gsMobileIdentity NasMm::getOrGenerateSuci()
{
if (m_timers->t3519.isRunning() && m_usim->m_storedSuci.type != nas::EIdentityType::NO_IDENTITY)
return m_usim->m_storedSuci;
if (m_timers->t3519.isRunning() && m_storage->storedSuci->get().type != nas::EIdentityType::NO_IDENTITY)
return m_storage->storedSuci->get();
m_storage->storedSuci->set(generateSuci());
m_usim->m_storedSuci = generateSuci();
m_timers->t3519.start();
if (m_usim->m_storedSuci.type == nas::EIdentityType::NO_IDENTITY)
if (m_storage->storedSuci->get().type == nas::EIdentityType::NO_IDENTITY)
return {};
return m_usim->m_storedSuci;
return m_storage->storedSuci->get();
}
nas::IE5gsMobileIdentity NasMm::generateSuci()
......@@ -99,8 +100,8 @@ nas::IE5gsMobileIdentity NasMm::generateSuci()
nas::IE5gsMobileIdentity NasMm::getOrGeneratePreferredId()
{
if (m_usim->m_storedGuti.type != nas::EIdentityType::NO_IDENTITY)
return m_usim->m_storedGuti;
if (m_storage->storedGuti->get().type != nas::EIdentityType::NO_IDENTITY)
return m_storage->storedGuti->get();
auto suci = getOrGenerateSuci();
if (suci.type != nas::EIdentityType::NO_IDENTITY)
......
......@@ -223,7 +223,6 @@ void NasMm::handleRrcConnectionRelease()
void NasMm::handleRrcEstablishmentFailure()
{
}
void NasMm::handleRadioLinkFailure()
......@@ -253,14 +252,15 @@ void NasMm::localReleaseConnection()
void NasMm::handlePaging(const std::vector<GutiMobileIdentity> &tmsiIds)
{
if (m_usim->m_storedGuti.type == nas::EIdentityType::NO_IDENTITY)
auto guti = m_storage->storedGuti->get();
if (guti.type == nas::EIdentityType::NO_IDENTITY)
return;
bool tmsiMatches = false;
for (auto &tmsi : tmsiIds)
{
if (tmsi.amfSetId == m_usim->m_storedGuti.gutiOrTmsi.amfSetId &&
tmsi.amfPointer == m_usim->m_storedGuti.gutiOrTmsi.amfPointer &&
tmsi.tmsi == m_usim->m_storedGuti.gutiOrTmsi.tmsi)
if (tmsi.amfSetId == guti.gutiOrTmsi.amfSetId && tmsi.amfPointer == guti.gutiOrTmsi.amfPointer &&
tmsi.tmsi == guti.gutiOrTmsi.tmsi)
{
tmsiMatches = true;
break;
......
......@@ -274,7 +274,7 @@ void NasMm::receiveInitialRegistrationAccept(const nas::RegistrationAccept &msg)
{
if (msg.mobileIdentity->type == nas::EIdentityType::GUTI)
{
m_usim->m_storedGuti = *msg.mobileIdentity;
m_storage->storedGuti->set(*msg.mobileIdentity);
m_timers->t3519.stop();
sendComplete = true;
}
......@@ -392,7 +392,7 @@ void NasMm::receiveMobilityRegistrationAccept(const nas::RegistrationAccept &msg
{
if (msg.mobileIdentity->type == nas::EIdentityType::GUTI)
{
m_usim->m_storedGuti = *msg.mobileIdentity;
m_storage->storedGuti->set(*msg.mobileIdentity);
m_timers->t3519.stop();
sendComplete = true;
}
......@@ -525,7 +525,7 @@ void NasMm::receiveInitialRegistrationReject(const nas::RegistrationReject &msg)
cause == nas::EMmCause::TA_NOT_ALLOWED || cause == nas::EMmCause::ROAMING_NOT_ALLOWED_IN_TA ||
cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA || cause == nas::EMmCause::N1_MODE_NOT_ALLOWED)
{
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_taiList = {};
m_usim->m_currentNsCtx = {};
......@@ -674,7 +674,7 @@ void NasMm::receiveMobilityRegistrationReject(const nas::RegistrationReject &msg
cause == nas::EMmCause::NO_SUITIBLE_CELLS_IN_TA || cause == nas::EMmCause::N1_MODE_NOT_ALLOWED ||
cause == nas::EMmCause::UE_IDENTITY_CANNOT_BE_DERIVED_FROM_NETWORK)
{
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_taiList = {};
m_usim->m_currentNsCtx = {};
......@@ -814,7 +814,7 @@ void NasMm::handleAbnormalInitialRegFailure(nas::ERegistrationType regType)
else
{
// The UE shall delete 5G-GUTI, TAI list, last visited TAI, list of equivalent PLMNs and ngKSI, ..
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_usim->m_taiList = {};
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_equivalentPlmnList = {};
......@@ -889,7 +889,7 @@ void NasMm::resetRegAttemptCounter()
// the UE shall stop timer T3519 if running, and delete any stored SUCI"
m_regCounter = 0;
m_timers->t3519.stop();
m_usim->m_storedSuci = {};
m_storage->storedSuci->clear();
// TODO: Registration attempt counter shall be reset for these cases as well (not implemented yet)
// - the UE is powered on;
......
......@@ -142,7 +142,7 @@ void NasMm::sendServiceRequest(EServiceReqCause reqCause)
}
// Assign TMSI (TMSI is a part of GUTI)
request->tmsi = m_usim->m_storedGuti;
request->tmsi = m_storage->storedGuti->get();
if (request->tmsi.type != nas::EIdentityType::NO_IDENTITY)
{
request->tmsi.type = nas::EIdentityType::TMSI;
......@@ -286,7 +286,7 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
cause == nas::EMmCause::PLMN_NOT_ALLOWED || cause == nas::EMmCause::TA_NOT_ALLOWED ||
cause == nas::EMmCause::N1_MODE_NOT_ALLOWED)
{
m_usim->m_storedGuti = {};
m_storage->storedGuti->clear();
m_storage->lastVisitedRegisteredTai->clear();
m_usim->m_taiList = {};
m_usim->m_currentNsCtx = {};
......
......@@ -111,7 +111,7 @@ void NasMm::onTimerExpire(UeTimer &timer)
break;
}
case 3519: {
m_usim->m_storedSuci = {};
m_storage->storedSuci->clear();
break;
}
case 3520: {
......
......@@ -25,6 +25,12 @@ namespace nr::ue
MmStorage::MmStorage(TaskBase *base) : m_base{base}
{
storedSuci = std::make_unique<nas::NasSlot<nas::IE5gsMobileIdentity>>(0, std::nullopt);
storedGuti = std::make_unique<nas::NasSlot<nas::IE5gsMobileIdentity>>(0, std::nullopt);
lastVisitedRegisteredTai = std::make_unique<nas::NasSlot<Tai>>(0, std::nullopt);
forbiddenTaiListRoaming = std::make_unique<nas::NasList<Tai>>(
FORBIDDEN_TAI_LIST_SIZE, FORBIDDEN_TAI_CLEAR_PERIOD, [this](const std::vector<Tai> &buffer, size_t count) {
BackupTaiListInSharedCtx(buffer, count, m_base->shCtx.forbiddenTaiRoaming);
......@@ -36,8 +42,6 @@ MmStorage::MmStorage(TaskBase *base) : m_base{base}
});
serviceAreaList = std::make_unique<nas::NasSlot<nas::IEServiceAreaList>>(0, std::nullopt);
lastVisitedRegisteredTai = std::make_unique<nas::NasSlot<Tai>>(0, std::nullopt);
}
} // namespace nr::ue
\ No newline at end of file
......@@ -19,10 +19,14 @@ class MmStorage
TaskBase *m_base;
public:
std::unique_ptr<nas::NasSlot<nas::IE5gsMobileIdentity>> storedSuci;
std::unique_ptr<nas::NasSlot<nas::IE5gsMobileIdentity>> storedGuti;
std::unique_ptr<nas::NasSlot<Tai>> lastVisitedRegisteredTai;
std::unique_ptr<nas::NasList<Tai>> forbiddenTaiListRoaming;
std::unique_ptr<nas::NasList<Tai>> forbiddenTaiListRps;
std::unique_ptr<nas::NasSlot<nas::IEServiceAreaList>> serviceAreaList;
std::unique_ptr<nas::NasSlot<Tai>> lastVisitedRegisteredTai;
public:
explicit MmStorage(TaskBase *base);
......
......@@ -30,10 +30,6 @@ class Usim
// State related
E5UState m_uState{};
// Identity related
nas::IE5gsMobileIdentity m_storedSuci{};
nas::IE5gsMobileIdentity m_storedGuti{};
// Plmn related
nas::IE5gsTrackingAreaIdentityList m_taiList{};
nas::IEPlmnList m_equivalentPlmnList{};
......
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