Commit 8a273192 authored by aligungr's avatar aligungr

L3 RRC/NAS developments

parent 5551dbea
......@@ -74,7 +74,10 @@ void UeAppTask::onLoop()
switch (w->present)
{
case NwUeTunToApp::DATA_PDU_DELIVERY: {
handleUplinkDataRequest(w->psi, std::move(w->data));
auto *m = new NwUeAppToNas(NwUeAppToNas::UPLINK_DATA_DELIVERY);
m->psi = w->psi;
m->data = std::move(w->data);
m_base->nasTask->push(m);
break;
}
case NwUeTunToApp::TUN_ERROR: {
......@@ -224,40 +227,4 @@ void UeAppTask::setupTunInterface(const PduSession *pduSession)
allocatedName.c_str(), ipAddress.c_str());
}
void UeAppTask::handleUplinkDataRequest(int psi, OctetString &&data)
{
if (!m_pduSessions[psi].has_value())
return;
if (m_cmState == ECmState::CM_CONNECTED)
{
if (m_pduSessions[psi]->uplinkPending)
{
m_pduSessions[psi]->uplinkPending = false;
auto *w = new NwUeAppToNas(NwUeAppToNas::UPLINK_STATUS_CHANGE);
w->psi = psi;
w->isPending = false;
m_base->nasTask->push(w);
}
auto *nw = new NwUeAppToRls(NwUeAppToRls::DATA_PDU_DELIVERY);
nw->psi = psi;
nw->pdu = std::move(data);
m_base->rlsTask->push(nw);
}
else
{
if (!m_pduSessions[psi]->uplinkPending)
{
m_pduSessions[psi]->uplinkPending = true;
auto *w = new NwUeAppToNas(NwUeAppToNas::UPLINK_STATUS_CHANGE);
w->psi = psi;
w->isPending = true;
m_base->nasTask->push(w);
}
}
}
} // namespace nr::ue
......@@ -45,7 +45,6 @@ class UeAppTask : public NtsTask
private:
void receiveStatusUpdate(NwUeStatusUpdate &msg);
void setupTunInterface(const PduSession *pduSession);
void handleUplinkDataRequest(int psi, OctetString &&data);
};
} // namespace nr::ue
......@@ -7,11 +7,14 @@
//
#include "sm.hpp"
#include <algorithm>
#include <lib/nas/proto_conf.hpp>
#include <lib/nas/utils.hpp>
#include <ue/app/task.hpp>
#include <ue/nas/mm/mm.hpp>
#include <ue/rls/task.hpp>
namespace nr::ue
{
......@@ -39,4 +42,35 @@ void NasSm::onTimerTick()
}
}
void NasSm::handleUplinkDataRequest(int psi, OctetString &&data)
{
if (m_pduSessions[psi]->psState != EPsState::ACTIVE)
return;
if (m_mm->m_cmState == ECmState::CM_CONNECTED)
{
// TODO: We should also check if radio resources are established by RRC.
// Checking CM state is not sufficient
if (m_pduSessions[psi]->uplinkPending)
{
m_pduSessions[psi]->uplinkPending = false;
handleUplinkStatusChange(psi, false);
}
auto *nw = new NwUeNasToRls(NwUeNasToRls::DATA_PDU_DELIVERY);
nw->psi = psi;
nw->pdu = std::move(data);
m_base->rlsTask->push(nw);
}
else
{
if (!m_pduSessions[psi]->uplinkPending)
{
m_pduSessions[psi]->uplinkPending = true;
handleUplinkStatusChange(psi, true);
}
}
}
} // namespace nr::ue
......@@ -91,6 +91,7 @@ class NasSm
private: /* Service Access Point */
void handleNasEvent(const NwUeNasToNas &msg);
void onTimerTick();
void handleUplinkDataRequest(int psi, OctetString &&data);
};
} // namespace nr::ue
\ No newline at end of file
......@@ -88,8 +88,8 @@ void NasTask::onLoop()
auto *w = dynamic_cast<NwUeAppToNas *>(msg);
switch (w->present)
{
case NwUeAppToNas::UPLINK_STATUS_CHANGE: {
sm->handleUplinkStatusChange(w->psi, w->isPending);
case NwUeAppToNas::UPLINK_DATA_DELIVERY: {
sm->handleUplinkDataRequest(w->psi, std::move(w->data));
break;
}
default:
......
......@@ -196,19 +196,19 @@ struct NwUeAppToNas : NtsMessage
{
enum PR
{
UPLINK_STATUS_CHANGE,
UPLINK_DATA_DELIVERY,
} present;
// UPLINK_STATUS_CHANGE
// UPLINK_DATA_DELIVERY
int psi{};
bool isPending{};
OctetString data;
explicit NwUeAppToNas(PR present) : NtsMessage(NtsMessageType::UE_APP_TO_NAS), present(present)
{
}
};
struct NwUeAppToRls : NtsMessage
struct NwUeNasToRls : NtsMessage
{
enum PR
{
......@@ -219,7 +219,7 @@ struct NwUeAppToRls : NtsMessage
int psi{};
OctetString pdu;
explicit NwUeAppToRls(PR present) : NtsMessage(NtsMessageType::UE_APP_TO_RLS), present(present)
explicit NwUeNasToRls(PR present) : NtsMessage(NtsMessageType::UE_NAS_TO_RLS), present(present)
{
}
};
......
......@@ -57,7 +57,8 @@ enum class NtsMessageType
UE_RLS_TO_RRC,
UE_RLS_TO_APP,
UE_RLS_TO_RLS,
UE_NAS_TO_APP,
UE_NAS_TO_APP,
UE_NAS_TO_RLS,
};
struct NtsMessage
......
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