Commit 61d09a6e authored by aligungr's avatar aligungr

MM refactor

parent e3df4898
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "mm.hpp"
#include <utils/common.hpp>
namespace nr::ue
{
void NasMm::handleRrcEvent(const NwUeRrcToNas &msg)
{
switch (msg.present)
{
case NwUeRrcToNas::RRC_CONNECTION_SETUP: {
handleRrcConnectionSetup();
break;
}
case NwUeRrcToNas::PLMN_SEARCH_RESPONSE: {
handlePlmnSearchResponse(msg.gnbName);
break;
}
case NwUeRrcToNas::PLMN_SEARCH_FAILURE: {
handlePlmnSearchFailure();
break;
}
case NwUeRrcToNas::NAS_DELIVERY: {
OctetView buffer{msg.nasPdu};
auto nasMessage = nas::DecodeNasMessage(buffer);
if (nasMessage != nullptr)
receiveNasMessage(*nasMessage);
break;
}
case NwUeRrcToNas::RRC_CONNECTION_RELEASE: {
handleRrcConnectionRelease();
break;
}
case NwUeRrcToNas::RADIO_LINK_FAILURE: {
handleRadioLinkFailure();
break;
}
}
}
} // namespace nr::ue
...@@ -77,14 +77,14 @@ class NasMm ...@@ -77,14 +77,14 @@ class NasMm
public: /* Transport */ public: /* Transport */
void sendNasMessage(const nas::PlainMmMessage &msg); void sendNasMessage(const nas::PlainMmMessage &msg);
void receiveNasMessage(const nas::NasMessage &msg);
private: /* Transport */ private: /* Transport */
void sendMmStatus(nas::EMmCause cause); void receiveNasMessage(const nas::NasMessage &msg);
void receiveMmMessage(const nas::PlainMmMessage &msg); void receiveMmMessage(const nas::PlainMmMessage &msg);
void receiveDlNasTransport(const nas::DlNasTransport &msg); void receiveDlNasTransport(const nas::DlNasTransport &msg);
void receiveMmStatus(const nas::FiveGMmStatus &msg); void receiveMmStatus(const nas::FiveGMmStatus &msg);
void receiveMmCause(const nas::IE5gMmCause &msg); void receiveMmCause(const nas::IE5gMmCause &msg);
void sendMmStatus(nas::EMmCause cause);
private: /* Registration */ private: /* Registration */
void sendInitialRegistration(bool isEmergencyReg, bool dueToDereg); void sendInitialRegistration(bool isEmergencyReg, bool dueToDereg);
...@@ -141,16 +141,14 @@ class NasMm ...@@ -141,16 +141,14 @@ class NasMm
NetworkSlice makeRequestedNssai(bool &isDefaultNssai) const; NetworkSlice makeRequestedNssai(bool &isDefaultNssai) const;
void handleNetworkSlicingSubscriptionChange(); void handleNetworkSlicingSubscriptionChange();
public: /* Radio */ private: /* Radio */
void localReleaseConnection();
void handlePlmnSearchResponse(const std::string &gnbName); void handlePlmnSearchResponse(const std::string &gnbName);
void handlePlmnSearchFailure(); void handlePlmnSearchFailure();
void handleRrcConnectionSetup(); void handleRrcConnectionSetup();
void handleRrcConnectionRelease(); void handleRrcConnectionRelease();
void handleRadioLinkFailure(); void handleRadioLinkFailure();
private: /* Radio */
void localReleaseConnection();
private: /* Access Control */ private: /* Access Control */
bool isHighPriority(); bool isHighPriority();
bool hasEmergency(); bool hasEmergency();
...@@ -161,6 +159,9 @@ class NasMm ...@@ -161,6 +159,9 @@ class NasMm
public: /* Timer */ public: /* Timer */
void onTimerExpire(nas::NasTimer &timer); void onTimerExpire(nas::NasTimer &timer);
public: /* Interface */
void handleRrcEvent(const NwUeRrcToNas &msg);
}; };
} // namespace nr::ue } // namespace nr::ue
\ No newline at end of file
...@@ -56,37 +56,7 @@ void NasTask::onLoop() ...@@ -56,37 +56,7 @@ void NasTask::onLoop()
switch (msg->msgType) switch (msg->msgType)
{ {
case NtsMessageType::UE_RRC_TO_NAS: { case NtsMessageType::UE_RRC_TO_NAS: {
auto *w = dynamic_cast<NwUeRrcToNas *>(msg); mm->handleRrcEvent(*dynamic_cast<NwUeRrcToNas *>(msg));
switch (w->present)
{
case NwUeRrcToNas::RRC_CONNECTION_SETUP: {
mm->handleRrcConnectionSetup();
break;
}
case NwUeRrcToNas::PLMN_SEARCH_RESPONSE: {
mm->handlePlmnSearchResponse(w->gnbName);
break;
}
case NwUeRrcToNas::PLMN_SEARCH_FAILURE: {
mm->handlePlmnSearchFailure();
break;
}
case NwUeRrcToNas::NAS_DELIVERY: {
OctetView buffer{w->nasPdu};
auto nasMessage = nas::DecodeNasMessage(buffer);
if (nasMessage != nullptr)
mm->receiveNasMessage(*nasMessage);
break;
}
case NwUeRrcToNas::RRC_CONNECTION_RELEASE: {
mm->handleRrcConnectionRelease();
break;
}
case NwUeRrcToNas::RADIO_LINK_FAILURE: {
mm->handleRadioLinkFailure();
break;
}
}
break; break;
} }
case NtsMessageType::UE_NAS_TO_NAS: { case NtsMessageType::UE_NAS_TO_NAS: {
......
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