Commit c2dbba5d authored by aligungr's avatar aligungr

L3 RRC/NAS developments

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