Commit c2dbba5d authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent d79d6434
...@@ -26,12 +26,12 @@ static nas::IEDeRegistrationType MakeDeRegistrationType(EDeregCause deregCause) ...@@ -26,12 +26,12 @@ static nas::IEDeRegistrationType MakeDeRegistrationType(EDeregCause deregCause)
return res; return res;
} }
void NasMm::sendDeregistration(EDeregCause deregCause) EProcRc NasMm::sendDeregistration(EDeregCause deregCause)
{ {
if (m_rmState != ERmState::RM_REGISTERED) if (m_rmState != ERmState::RM_REGISTERED)
{ {
m_logger->warn("De-registration could not be triggered. UE is already de-registered"); m_logger->warn("De-registration could not be triggered. UE is already de-registered");
return; return EProcRc::CANCEL;
} }
m_logger->debug("Starting de-registration procedure due to [%s]", ToJson(deregCause).str().c_str()); m_logger->debug("Starting de-registration procedure due to [%s]", ToJson(deregCause).str().c_str());
...@@ -54,7 +54,10 @@ void NasMm::sendDeregistration(EDeregCause deregCause) ...@@ -54,7 +54,10 @@ void NasMm::sendDeregistration(EDeregCause deregCause)
request->mobileIdentity = getOrGeneratePreferredId(); request->mobileIdentity = getOrGeneratePreferredId();
sendNasMessage(*request); auto rc = sendNasMessage(*request);
if (rc != EProcRc::OK)
return EProcRc::STAY;
m_lastDeregistrationRequest = std::move(request); m_lastDeregistrationRequest = std::move(request);
m_lastDeregCause = deregCause; m_lastDeregCause = deregCause;
m_timers->t3521.resetExpiryCount(); m_timers->t3521.resetExpiryCount();
...@@ -65,6 +68,10 @@ void NasMm::sendDeregistration(EDeregCause deregCause) ...@@ -65,6 +68,10 @@ void NasMm::sendDeregistration(EDeregCause deregCause)
m_timers->t3521.start(); m_timers->t3521.start();
} }
m_sm->localReleaseAllSessions();
switchMmState(EMmSubState::MM_DEREGISTERED_INITIATED_PS);
// TODO: Bu ikisinin burada olması gerektiğinden emin değilim // TODO: Bu ikisinin burada olması gerektiğinden emin değilim
if (deregCause == EDeregCause::SWITCH_OFF) if (deregCause == EDeregCause::SWITCH_OFF)
{ {
...@@ -78,9 +85,7 @@ void NasMm::sendDeregistration(EDeregCause deregCause) ...@@ -78,9 +85,7 @@ void NasMm::sendDeregistration(EDeregCause deregCause)
m_usim->invalidate(); m_usim->invalidate();
} }
m_sm->localReleaseAllSessions(); return EProcRc::OK;
switchMmState(EMmSubState::MM_DEREGISTERED_INITIATED_PS);
} }
void NasMm::receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOriginating &msg) void NasMm::receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOriginating &msg)
......
...@@ -103,14 +103,14 @@ static void RemoveCleartextIEs(nas::PlainMmMessage &msg, OctetString &&nasMsgCon ...@@ -103,14 +103,14 @@ static void RemoveCleartextIEs(nas::PlainMmMessage &msg, OctetString &&nasMsgCon
} }
} }
void NasMm::sendNasMessage(const nas::PlainMmMessage &msg) EProcRc NasMm::sendNasMessage(const nas::PlainMmMessage &msg)
{ {
if (m_cmState == ECmState::CM_IDLE && !IsInitialNasMessage(msg)) if (m_cmState == ECmState::CM_IDLE && !IsInitialNasMessage(msg))
{ {
m_logger->warn("NAS Transport aborted, Service Request is needed for uplink signalling"); m_logger->warn("NAS Transport aborted, Service Request is needed for uplink signalling");
if (m_mmState != EMmState::MM_SERVICE_REQUEST_INITIATED) if (m_mmState != EMmState::MM_SERVICE_REQUEST_INITIATED)
serviceRequestRequiredForSignalling(); serviceRequestRequiredForSignalling();
return; return EProcRc::STAY;
} }
bool hasNsCtx = bool hasNsCtx =
...@@ -170,6 +170,8 @@ void NasMm::sendNasMessage(const nas::PlainMmMessage &msg) ...@@ -170,6 +170,8 @@ void NasMm::sendNasMessage(const nas::PlainMmMessage &msg)
m->pduId = 0; m->pduId = 0;
m->nasPdu = std::move(pdu); m->nasPdu = std::move(pdu);
m_base->rrcTask->push(m); m_base->rrcTask->push(m);
return EProcRc::OK;
} }
void NasMm::receiveNasMessage(const nas::NasMessage &msg) void NasMm::receiveNasMessage(const nas::NasMessage &msg)
......
...@@ -93,7 +93,7 @@ class NasMm ...@@ -93,7 +93,7 @@ class NasMm
void onSimRemoval(); void onSimRemoval();
private: /* Messaging */ private: /* Messaging */
void sendNasMessage(const nas::PlainMmMessage &msg); EProcRc sendNasMessage(const nas::PlainMmMessage &msg);
void receiveNasMessage(const nas::NasMessage &msg); void receiveNasMessage(const nas::NasMessage &msg);
void receiveMmMessage(const nas::PlainMmMessage &msg); void receiveMmMessage(const nas::PlainMmMessage &msg);
void receiveMmStatus(const nas::FiveGMmStatus &msg); void receiveMmStatus(const nas::FiveGMmStatus &msg);
...@@ -133,7 +133,7 @@ class NasMm ...@@ -133,7 +133,7 @@ class NasMm
nas::IEUeSecurityCapability createSecurityCapabilityIe(); nas::IEUeSecurityCapability createSecurityCapabilityIe();
private: /* De-registration */ private: /* De-registration */
void sendDeregistration(EDeregCause deregCause); EProcRc sendDeregistration(EDeregCause deregCause);
void receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOriginating &msg); void receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOriginating &msg);
void receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTerminated &msg); void receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTerminated &msg);
void performLocalDeregistration(); void performLocalDeregistration();
......
...@@ -104,11 +104,13 @@ void NasMm::invokeProcedures() ...@@ -104,11 +104,13 @@ void NasMm::invokeProcedures()
{ {
if (m_procCtl.deregistration) if (m_procCtl.deregistration)
{ {
sendDeregistration(*m_procCtl.deregistration); EProcRc rc = sendDeregistration(*m_procCtl.deregistration);
if (rc != EProcRc::STAY)
m_procCtl.deregistration = std::nullopt;
m_procCtl.initialRegistration = std::nullopt; m_procCtl.initialRegistration = std::nullopt;
m_procCtl.mobilityRegistration = std::nullopt; m_procCtl.mobilityRegistration = std::nullopt;
m_procCtl.serviceRequest = std::nullopt; m_procCtl.serviceRequest = std::nullopt;
m_procCtl.deregistration = std::nullopt;
return; return;
} }
......
...@@ -555,8 +555,8 @@ enum class EServiceReqCause ...@@ -555,8 +555,8 @@ enum class EServiceReqCause
enum class EProcRc enum class EProcRc
{ {
OK, OK,
INVALID, CANCEL,
FAIL, STAY,
}; };
struct ProcControl struct ProcControl
......
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