Commit 5551dbea authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent e3fa41ad
......@@ -67,6 +67,8 @@ class NasMm
int64_t m_lastTimeMmStateChange{};
friend class UeCmdHandler;
friend class NasSm;
friend class NasTask;
public:
NasMm(TaskBase *base, NasTimers *timers);
......@@ -97,14 +99,10 @@ class NasMm
private: /* Transport */
void receiveDlNasTransport(const nas::DlNasTransport &msg);
public: /* Transport */
void deliverUlTransport(const nas::UlNasTransport &msg);
public: /* Registration */
void sendMobilityRegistration(ERegUpdateCause updateCause);
private: /* Registration */
void sendMobilityRegistration(ERegUpdateCause updateCause);
void sendInitialRegistration(EInitialRegCause regCause);
void receiveRegistrationAccept(const nas::RegistrationAccept &msg);
void receiveInitialRegistrationAccept(const nas::RegistrationAccept &msg);
......@@ -132,10 +130,8 @@ class NasMm
void receiveSecurityModeCommand(const nas::SecurityModeCommand &msg);
nas::IEUeSecurityCapability createSecurityCapabilityIe();
public: /* De-registration */
void sendDeregistration(EDeregCause deregCause);
private: /* De-registration */
void sendDeregistration(EDeregCause deregCause);
void receiveDeregistrationAccept(const nas::DeRegistrationAcceptUeOriginating &msg);
void receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTerminated &msg);
void performLocalDeregistration();
......@@ -154,6 +150,7 @@ class NasMm
void sendServiceRequest(EServiceReqCause reqCause);
void receiveServiceAccept(const nas::ServiceAccept &msg);
void receiveServiceReject(const nas::ServiceReject &msg);
void serviceNeededForUplinkData();
private: /* Network Slicing */
NetworkSlice makeRequestedNssai(bool &isDefaultNssai) const;
......@@ -170,11 +167,9 @@ class NasMm
void handlePaging(const std::vector<GutiMobileIdentity> &tmsiIds);
void updateProvidedGuti(bool provide = true);
public: /* Access Control */
private: /* Access Control */
bool isHighPriority();
bool hasEmergency();
private: /* Access Control */
void setN1Capability(bool enabled);
bool isInNonAllowedArea();
......@@ -185,14 +180,9 @@ class NasMm
private: /* Timer */
void onTimerExpire(UeTimer &timer);
public:
/* Interface */
void handleRrcEvent(const NwUeRrcToNas &msg); // used by RRC
void handleNasEvent(const NwUeNasToNas &msg); // used by NAS
bool isRegistered(); // used by SM
bool isRegisteredForEmergency(); // used by SM
void serviceNeededForUplinkData(); // used by SM
bool isStateNonAllowedService(); // used by SM
private: /* Service Access Point */
void handleRrcEvent(const NwUeRrcToNas &msg);
void handleNasEvent(const NwUeNasToNas &msg);
};
} // namespace nr::ue
\ No newline at end of file
......@@ -10,8 +10,6 @@
#include <utils/common.hpp>
static constexpr const int64_t SERVICE_REQUEST_NEEDED_FOR_DATA_THRESHOLD = 1000;
namespace nr::ue
{
......@@ -72,31 +70,4 @@ void NasMm::handleNasEvent(const NwUeNasToNas &msg)
}
}
bool NasMm::isRegistered()
{
return m_rmState == ERmState::RM_REGISTERED;
}
bool NasMm::isRegisteredForEmergency()
{
return isRegistered() && m_registeredForEmergency;
}
void NasMm::serviceNeededForUplinkData()
{
auto currentTime = utils::CurrentTimeMillis();
if (currentTime - m_lastTimeServiceReqNeededIndForData > SERVICE_REQUEST_NEEDED_FOR_DATA_THRESHOLD)
{
sendServiceRequest(m_cmState == ECmState::CM_CONNECTED ? EServiceReqCause::CONNECTED_UPLINK_DATA_PENDING
: EServiceReqCause::IDLE_UPLINK_DATA_PENDING);
m_lastTimeServiceReqNeededIndForData = currentTime;
}
}
bool NasMm::isStateNonAllowedService()
{
return m_mmSubState == EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE;
}
} // namespace nr::ue
......@@ -459,4 +459,18 @@ void NasMm::receiveServiceReject(const nas::ServiceReject &msg)
}
}
void NasMm::serviceNeededForUplinkData()
{
static constexpr const int64_t SERVICE_REQUEST_NEEDED_FOR_DATA_THRESHOLD = 1000;
auto currentTime = utils::CurrentTimeMillis();
if (currentTime - m_lastTimeServiceReqNeededIndForData > SERVICE_REQUEST_NEEDED_FOR_DATA_THRESHOLD)
{
sendServiceRequest(m_cmState == ECmState::CM_CONNECTED ? EServiceReqCause::CONNECTED_UPLINK_DATA_PENDING
: EServiceReqCause::IDLE_UPLINK_DATA_PENDING);
m_lastTimeServiceReqNeededIndForData = currentTime;
}
}
} // namespace nr::ue
......@@ -41,13 +41,13 @@ void NasSm::sendEstablishmentRequest(const SessionConfig &config)
m_logger->debug("Sending PDU Session Establishment Request");
/* Control the protocol state */
if (!m_mm->isRegistered())
if (m_mm->m_rmState != ERmState::RM_REGISTERED)
{
m_logger->err("PDU session establishment could not be triggered, UE is not registered");
return;
}
if (m_mm->isStateNonAllowedService() && !m_mm->hasEmergency() && !m_mm->isHighPriority())
if (m_mm->m_mmSubState == EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE && !m_mm->hasEmergency() && !m_mm->isHighPriority())
{
m_logger->err("PDU session establishment could not be triggered, non allowed service condition");
return;
......@@ -59,7 +59,7 @@ void NasSm::sendEstablishmentRequest(const SessionConfig &config)
m_logger->err("PDU session type [%s] is not supported", nas::utils::EnumToString(config.type));
return;
}
if (m_mm->isRegisteredForEmergency() && !config.isEmergency)
if (m_mm->m_rmState == ERmState::RM_REGISTERED && m_mm->m_registeredForEmergency && !config.isEmergency)
{
m_logger->err("Non-emergency PDU session cannot be requested, UE is registered for emergency only");
return;
......
......@@ -19,7 +19,7 @@ namespace nr::ue
void NasSm::sendReleaseRequest(int psi)
{
/* Control the protocol state */
if (m_mm->isStateNonAllowedService() && !m_mm->hasEmergency() && !m_mm->isHighPriority())
if (m_mm->m_mmSubState == EMmSubState::MM_REGISTERED_NON_ALLOWED_SERVICE && !m_mm->hasEmergency() && !m_mm->isHighPriority())
{
m_logger->err("PDU session release could not start, non allowed service condition");
return;
......
......@@ -32,22 +32,17 @@ class NasSm
std::array<ProcedureTransaction, 255> m_procedureTransactions{};
friend class UeCmdHandler;
friend class NasMm;
friend class NasTask;
public:
NasSm(TaskBase *base, NasTimers *timers);
public:
/* Base */
public: /* Base */
void onStart(NasMm *mm);
void onQuit();
void establishInitialSessions();
/* Transport */
void receiveSmMessage(const nas::SmMessage &msg);
void receiveForwardingFailure(const nas::SmMessage &msg, nas::EMmCause cause,
const std::optional<nas::IEGprsTimer3> &backoffTimer);
/* Resource */
private: /* Resource */
void localReleaseSession(int psi);
void localReleaseAllSessions();
bool anyEmergencySession();
......@@ -57,45 +52,45 @@ class NasSm
std::bitset<16> getUplinkDataStatus();
std::bitset<16> getPduSessionStatus();
/* Session Release */
void sendReleaseRequest(int psi);
void sendReleaseRequestForAll();
private:
/* Transport */
private: /* Transport */
void receiveSmMessage(const nas::SmMessage &msg);
void sendSmMessage(int psi, const nas::SmMessage &msg);
void receiveSmStatus(const nas::FiveGSmStatus &msg);
void sendSmCause(const nas::ESmCause &cause, int pti, int psi);
void receiveForwardingFailure(const nas::SmMessage &msg, nas::EMmCause cause,
const std::optional<nas::IEGprsTimer3> &backoffTimer);
/* Allocation */
private: /* Allocation */
int allocatePduSessionId(const SessionConfig &config);
int allocateProcedureTransactionId();
void freeProcedureTransactionId(int pti);
void freePduSessionId(int psi);
/* Session Establishment */
private: /* Session Establishment */
void establishInitialSessions();
void sendEstablishmentRequest(const SessionConfig &config);
void receiveEstablishmentAccept(const nas::PduSessionEstablishmentAccept &msg);
void receiveEstablishmentReject(const nas::PduSessionEstablishmentReject &msg);
/* Session Release */
private: /* Session Release */
void sendReleaseRequest(int psi);
void sendReleaseRequestForAll();
void receiveReleaseReject(const nas::PduSessionReleaseReject &msg);
void receiveReleaseCommand(const nas::PduSessionReleaseCommand &msg);
/* Timer */
private: /* Timer */
std::unique_ptr<UeTimer> newTransactionTimer(int code);
void onTimerExpire(UeTimer &timer);
void onTransactionTimerExpire(int pti);
/* Procedure */
private: /* Procedure */
bool checkPtiAndPsi(const nas::SmMessage &msg);
void abortProcedureByPti(int pti);
void abortProcedureByPtiOrPsi(int pti, int psi);
public:
/* Interface */
void handleNasEvent(const NwUeNasToNas &msg); // used by NAS
void onTimerTick(); // used by NAS
private: /* Service Access Point */
void handleNasEvent(const NwUeNasToNas &msg);
void onTimerTick();
};
} // namespace nr::ue
\ No newline at end of file
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