Commit c0d05ab6 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 629a07ad
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <lib/crypt/milenage.hpp> #include <lib/crypt/milenage.hpp>
#include <lib/nas/nas.hpp> #include <lib/nas/nas.hpp>
#include <lib/nas/timer.hpp>
#include <ue/nas/storage.hpp> #include <ue/nas/storage.hpp>
#include <ue/nas/usim/usim.hpp> #include <ue/nas/usim/usim.hpp>
#include <ue/nts.hpp> #include <ue/nts.hpp>
...@@ -179,7 +178,7 @@ class NasMm ...@@ -179,7 +178,7 @@ class NasMm
bool switchToECallInactivityIfNeeded(); bool switchToECallInactivityIfNeeded();
private: /* Timer */ private: /* Timer */
void onTimerExpire(nas::NasTimer &timer); void onTimerExpire(UeTimer &timer);
public: public:
/* Interface */ /* Interface */
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace nr::ue namespace nr::ue
{ {
void NasMm::onTimerExpire(nas::NasTimer &timer) void NasMm::onTimerExpire(UeTimer &timer)
{ {
auto logExpired = [this, &timer]() { auto logExpired = [this, &timer]() {
m_logger->debug("NAS timer[%d] expired [%d]", timer.getCode(), timer.getExpiryCount()); m_logger->debug("NAS timer[%d] expired [%d]", timer.getCode(), timer.getExpiryCount());
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <array> #include <array>
#include <bitset> #include <bitset>
#include <lib/nas/nas.hpp> #include <lib/nas/nas.hpp>
#include <lib/nas/timer.hpp>
#include <ue/nts.hpp> #include <ue/nts.hpp>
#include <ue/types.hpp> #include <ue/types.hpp>
#include <utils/nts.hpp> #include <utils/nts.hpp>
...@@ -84,8 +83,8 @@ class NasSm ...@@ -84,8 +83,8 @@ class NasSm
void receiveReleaseCommand(const nas::PduSessionReleaseCommand &msg); void receiveReleaseCommand(const nas::PduSessionReleaseCommand &msg);
/* Timer */ /* Timer */
std::unique_ptr<nas::NasTimer> newTransactionTimer(int code); std::unique_ptr<UeTimer> newTransactionTimer(int code);
void onTimerExpire(nas::NasTimer &timer); void onTimerExpire(UeTimer &timer);
void onTransactionTimerExpire(int pti); void onTransactionTimerExpire(int pti);
/* Procedure */ /* Procedure */
......
...@@ -16,20 +16,20 @@ ...@@ -16,20 +16,20 @@
namespace nr::ue namespace nr::ue
{ {
std::unique_ptr<nas::NasTimer> NasSm::newTransactionTimer(int code) std::unique_ptr<UeTimer> NasSm::newTransactionTimer(int code)
{ {
std::unique_ptr<nas::NasTimer> timer; std::unique_ptr<UeTimer> timer;
switch (code) switch (code)
{ {
case 3580: case 3580:
timer = std::make_unique<nas::NasTimer>(3580, false, 16); timer = std::make_unique<UeTimer>(3580, false, 16);
break; break;
case 3581: case 3581:
timer = std::make_unique<nas::NasTimer>(3581, false, 16); timer = std::make_unique<UeTimer>(3581, false, 16);
break; break;
case 3582: case 3582:
timer = std::make_unique<nas::NasTimer>(3582, false, 16); timer = std::make_unique<UeTimer>(3582, false, 16);
break; break;
default: default:
m_logger->err("Bad SM transaction timer code"); m_logger->err("Bad SM transaction timer code");
...@@ -40,7 +40,7 @@ std::unique_ptr<nas::NasTimer> NasSm::newTransactionTimer(int code) ...@@ -40,7 +40,7 @@ std::unique_ptr<nas::NasTimer> NasSm::newTransactionTimer(int code)
return timer; return timer;
} }
void NasSm::onTimerExpire(nas::NasTimer &timer) void NasSm::onTimerExpire(UeTimer &timer)
{ {
} }
......
...@@ -122,7 +122,7 @@ void NasTask::onLoop() ...@@ -122,7 +122,7 @@ void NasTask::onLoop()
void NasTask::performTick() void NasTask::performTick()
{ {
auto sendExpireMsg = [this](nas::NasTimer *timer) { auto sendExpireMsg = [this](UeTimer *timer) {
auto *nw = new NwUeNasToNas(NwUeNasToNas::NAS_TIMER_EXPIRE); auto *nw = new NwUeNasToNas(NwUeNasToNas::NAS_TIMER_EXPIRE);
nw->timer = timer; nw->timer = timer;
push(nw); push(nw);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <ue/nas/usim/usim.hpp> #include <ue/nas/usim/usim.hpp>
#include <lib/crypt/milenage.hpp> #include <lib/crypt/milenage.hpp>
#include <lib/nas/nas.hpp> #include <lib/nas/nas.hpp>
#include <lib/nas/timer.hpp>
#include <ue/nas/mm/mm.hpp> #include <ue/nas/mm/mm.hpp>
#include <ue/nas/sm/sm.hpp> #include <ue/nas/sm/sm.hpp>
#include <ue/nts.hpp> #include <ue/nts.hpp>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <utility> #include <utility>
#include <lib/app/cli_base.hpp> #include <lib/app/cli_base.hpp>
#include <lib/nas/timer.hpp>
#include <lib/rls/rls_base.hpp> #include <lib/rls/rls_base.hpp>
#include <lib/rrc/rrc.hpp> #include <lib/rrc/rrc.hpp>
#include <utils/network.hpp> #include <utils/network.hpp>
...@@ -174,7 +173,7 @@ struct NwUeNasToNas : NtsMessage ...@@ -174,7 +173,7 @@ struct NwUeNasToNas : NtsMessage
} present; } present;
// NAS_TIMER_EXPIRE // NAS_TIMER_EXPIRE
nas::NasTimer *timer{}; UeTimer *timer{};
explicit NwUeNasToNas(PR present) : NtsMessage(NtsMessageType::UE_NAS_TO_NAS), present(present) explicit NwUeNasToNas(PR present) : NtsMessage(NtsMessageType::UE_NAS_TO_NAS), present(present)
{ {
......
...@@ -12,31 +12,28 @@ ...@@ -12,31 +12,28 @@
#include <utils/common.hpp> #include <utils/common.hpp>
namespace nas UeTimer::UeTimer(int timerCode, bool isMmTimer, int defaultInterval)
{
NasTimer::NasTimer(int timerCode, bool isMmTimer, int defaultInterval)
: m_code(timerCode), m_isMm(isMmTimer), m_interval(defaultInterval), m_startMillis(0), m_isRunning(false), : m_code(timerCode), m_isMm(isMmTimer), m_interval(defaultInterval), m_startMillis(0), m_isRunning(false),
m_expiryCount(0), m_lastDebugPrintMs(0) m_expiryCount(0), m_lastDebugPrintMs(0)
{ {
} }
bool NasTimer::isRunning() const bool UeTimer::isRunning() const
{ {
return m_isRunning; return m_isRunning;
} }
int NasTimer::getCode() const int UeTimer::getCode() const
{ {
return m_code; return m_code;
} }
bool NasTimer::isMmTimer() const bool UeTimer::isMmTimer() const
{ {
return m_isMm; return m_isMm;
} }
void NasTimer::start(bool clearExpiryCount) void UeTimer::start(bool clearExpiryCount)
{ {
if (clearExpiryCount) if (clearExpiryCount)
resetExpiryCount(); resetExpiryCount();
...@@ -44,7 +41,7 @@ void NasTimer::start(bool clearExpiryCount) ...@@ -44,7 +41,7 @@ void NasTimer::start(bool clearExpiryCount)
m_isRunning = true; m_isRunning = true;
} }
void NasTimer::start(const nas::IEGprsTimer2 &v, bool clearExpiryCount) void UeTimer::start(const nas::IEGprsTimer2 &v, bool clearExpiryCount)
{ {
if (clearExpiryCount) if (clearExpiryCount)
resetExpiryCount(); resetExpiryCount();
...@@ -53,7 +50,7 @@ void NasTimer::start(const nas::IEGprsTimer2 &v, bool clearExpiryCount) ...@@ -53,7 +50,7 @@ void NasTimer::start(const nas::IEGprsTimer2 &v, bool clearExpiryCount)
m_isRunning = true; m_isRunning = true;
} }
void NasTimer::start(const nas::IEGprsTimer3 &v, bool clearExpiryCount) void UeTimer::start(const nas::IEGprsTimer3 &v, bool clearExpiryCount)
{ {
if (clearExpiryCount) if (clearExpiryCount)
resetExpiryCount(); resetExpiryCount();
...@@ -81,7 +78,7 @@ void NasTimer::start(const nas::IEGprsTimer3 &v, bool clearExpiryCount) ...@@ -81,7 +78,7 @@ void NasTimer::start(const nas::IEGprsTimer3 &v, bool clearExpiryCount)
m_isRunning = true; m_isRunning = true;
} }
void NasTimer::stop(bool clearExpiryCount) void UeTimer::stop(bool clearExpiryCount)
{ {
if (clearExpiryCount) if (clearExpiryCount)
resetExpiryCount(); resetExpiryCount();
...@@ -93,7 +90,7 @@ void NasTimer::stop(bool clearExpiryCount) ...@@ -93,7 +90,7 @@ void NasTimer::stop(bool clearExpiryCount)
} }
} }
bool NasTimer::performTick() bool UeTimer::performTick()
{ {
if (m_isRunning) if (m_isRunning)
{ {
...@@ -114,12 +111,12 @@ bool NasTimer::performTick() ...@@ -114,12 +111,12 @@ bool NasTimer::performTick()
return false; return false;
} }
int NasTimer::getInterval() const int UeTimer::getInterval() const
{ {
return m_interval; return m_interval;
} }
int NasTimer::getRemaining() const int UeTimer::getRemaining() const
{ {
if (!m_isRunning) if (!m_isRunning)
return 0; return 0;
...@@ -128,17 +125,17 @@ int NasTimer::getRemaining() const ...@@ -128,17 +125,17 @@ int NasTimer::getRemaining() const
return std::max(m_interval - elapsed, 0); return std::max(m_interval - elapsed, 0);
} }
void NasTimer::resetExpiryCount() void UeTimer::resetExpiryCount()
{ {
m_expiryCount = 0; m_expiryCount = 0;
} }
int NasTimer::getExpiryCount() const int UeTimer::getExpiryCount() const
{ {
return m_expiryCount; return m_expiryCount;
} }
Json ToJson(const NasTimer &v) Json ToJson(const UeTimer &v)
{ {
std::stringstream ss{}; std::stringstream ss{};
if (v.isRunning()) if (v.isRunning())
...@@ -148,5 +145,3 @@ Json ToJson(const NasTimer &v) ...@@ -148,5 +145,3 @@ Json ToJson(const NasTimer &v)
return ss.str(); return ss.str();
} }
} // namespace nas
...@@ -8,14 +8,10 @@ ...@@ -8,14 +8,10 @@
#pragma once #pragma once
#include "ie4.hpp" #include <lib/nas/ie4.hpp>
#include <utils/json.hpp> #include <utils/json.hpp>
namespace nas class UeTimer
{
class NasTimer
{ {
private: private:
const int m_code; const int m_code;
...@@ -29,12 +25,12 @@ class NasTimer ...@@ -29,12 +25,12 @@ class NasTimer
long m_lastDebugPrintMs; long m_lastDebugPrintMs;
public: public:
NasTimer(int timerCode, bool isMmTimer, int defaultInterval); UeTimer(int timerCode, bool isMmTimer, int defaultInterval);
public: public:
void start(bool clearExpiryCount = true); void start(bool clearExpiryCount = true);
void start(const IEGprsTimer2 &v, bool clearExpiryCount = true); void start(const nas::IEGprsTimer2 &v, bool clearExpiryCount = true);
void start(const IEGprsTimer3 &v, bool clearExpiryCount = true); void start(const nas::IEGprsTimer3 &v, bool clearExpiryCount = true);
void stop(bool clearExpiryCount = true); void stop(bool clearExpiryCount = true);
void resetExpiryCount(); void resetExpiryCount();
bool performTick(); bool performTick();
...@@ -46,6 +42,4 @@ class NasTimer ...@@ -46,6 +42,4 @@ class NasTimer
[[nodiscard]] int getExpiryCount() const; [[nodiscard]] int getExpiryCount() const;
}; };
Json ToJson(const NasTimer &v); Json ToJson(const UeTimer &v);
} // namespace nas
\ No newline at end of file
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#pragma once #pragma once
#include "timer.hpp"
#include <array> #include <array>
#include <atomic> #include <atomic>
#include <memory> #include <memory>
...@@ -17,7 +19,6 @@ ...@@ -17,7 +19,6 @@
#include <lib/app/monitor.hpp> #include <lib/app/monitor.hpp>
#include <lib/app/ue_ctl.hpp> #include <lib/app/ue_ctl.hpp>
#include <lib/nas/nas.hpp> #include <lib/nas/nas.hpp>
#include <lib/nas/timer.hpp>
#include <utils/common_types.hpp> #include <utils/common_types.hpp>
#include <utils/json.hpp> #include <utils/json.hpp>
#include <utils/locked.hpp> #include <utils/locked.hpp>
...@@ -189,26 +190,26 @@ struct TaskBase ...@@ -189,26 +190,26 @@ struct TaskBase
struct NasTimers struct NasTimers
{ {
nas::NasTimer t3346; /* MM - ... */ UeTimer t3346; /* MM - ... */
nas::NasTimer t3396; /* SM - ... */ UeTimer t3396; /* SM - ... */
nas::NasTimer t3444; /* MM - ... */ UeTimer t3444; /* MM - ... */
nas::NasTimer t3445; /* MM - ... */ UeTimer t3445; /* MM - ... */
nas::NasTimer t3502; /* MM - Initiation of the registration procedure, if still required */ UeTimer t3502; /* MM - Initiation of the registration procedure, if still required */
nas::NasTimer t3510; /* MM - Registration Request transmission timer */ UeTimer t3510; /* MM - Registration Request transmission timer */
nas::NasTimer t3511; /* MM - Retransmission of the REGISTRATION REQUEST, if still required */ UeTimer t3511; /* MM - Retransmission of the REGISTRATION REQUEST, if still required */
nas::NasTimer t3512; /* MM - Periodic registration update timer */ UeTimer t3512; /* MM - Periodic registration update timer */
nas::NasTimer t3516; /* MM - 5G AKA - RAND and RES* storing timer */ UeTimer t3516; /* MM - 5G AKA - RAND and RES* storing timer */
nas::NasTimer t3517; /* MM - Service Request transmission timer */ UeTimer t3517; /* MM - Service Request transmission timer */
nas::NasTimer t3519; /* MM - Transmission with fresh SUCI timer */ UeTimer t3519; /* MM - Transmission with fresh SUCI timer */
nas::NasTimer t3520; /* MM - ... */ UeTimer t3520; /* MM - ... */
nas::NasTimer t3521; /* MM - De-registration transmission timer for not switch off */ UeTimer t3521; /* MM - De-registration transmission timer for not switch off */
nas::NasTimer t3525; /* MM - ... */ UeTimer t3525; /* MM - ... */
nas::NasTimer t3540; /* MM - ... */ UeTimer t3540; /* MM - ... */
nas::NasTimer t3584; /* SM - ... */ UeTimer t3584; /* SM - ... */
nas::NasTimer t3585; /* SM - ... */ UeTimer t3585; /* SM - ... */
NasTimers(); NasTimers();
}; };
...@@ -333,7 +334,7 @@ struct ProcedureTransaction ...@@ -333,7 +334,7 @@ struct ProcedureTransaction
static constexpr const int MAX_ID = 254; static constexpr const int MAX_ID = 254;
EPtState state{}; EPtState state{};
std::unique_ptr<nas::NasTimer> timer{}; std::unique_ptr<UeTimer> timer{};
std::unique_ptr<nas::SmMessage> message{}; std::unique_ptr<nas::SmMessage> message{};
int psi{}; int psi{};
}; };
......
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