Commit 173e1468 authored by aligungr's avatar aligungr

NGAP paging handling

parent 96f19d78
......@@ -198,4 +198,12 @@ inline Unique<T> WrapUnique(T *ptr, asn_TYPE_descriptor_t &desc)
return asn::Unique<T>(ptr, asn::Deleter<T>{desc});
}
template <typename T>
inline Unique<T> UniqueCopy(const T &value, asn_TYPE_descriptor_t &desc)
{
auto *ptr = New<T>();
DeepCopy(desc, value, ptr);
return WrapUnique(ptr, desc);
}
} // namespace asn
\ No newline at end of file
......@@ -13,6 +13,9 @@
#include <gnb/gtp/task.hpp>
#include <gnb/rrc/task.hpp>
#include <asn/ngap/ASN_NGAP_FiveG-S-TMSI.h>
#include <asn/ngap/ASN_NGAP_Paging.h>
namespace nr::gnb
{
......@@ -27,4 +30,31 @@ void NgapTask::handleRadioLinkFailure(int ueId)
sendContextRelease(ueId, NgapCause::RadioNetwork_radio_connection_with_ue_lost);
}
void NgapTask::receivePaging(int amfId, ASN_NGAP_Paging *msg)
{
m_logger->debug("Paging received");
auto *amf = findAmfContext(amfId);
if (amf == nullptr)
return;
auto *w = new NwGnbNgapToRrc(NwGnbNgapToRrc::PAGING);
auto *ieUePagingIdentity = asn::ngap::GetProtocolIe(msg, ASN_NGAP_ProtocolIE_ID_id_UEPagingIdentity);
if (ieUePagingIdentity)
{
if (ieUePagingIdentity->UEPagingIdentity.present == ASN_NGAP_UEPagingIdentity_PR_fiveG_S_TMSI)
w->uePagingTmsi = asn::UniqueCopy(*ieUePagingIdentity->UEPagingIdentity.choice.fiveG_S_TMSI,
asn_DEF_ASN_NGAP_FiveG_S_TMSI);
}
auto *ieTaiListForPaging = asn::ngap::GetProtocolIe(msg, ASN_NGAP_ProtocolIE_ID_id_TAIListForPaging);
if (ieTaiListForPaging)
{
w->taiListForPaging = asn::UniqueCopy(ieTaiListForPaging->TAIListForPaging, asn_DEF_ASN_NGAP_TAIListForPaging);
}
m_base->rrcTask->push(w);
}
} // namespace nr::gnb
......@@ -8,8 +8,10 @@
#pragma once
#include "types.hpp"
#include <app/cli_base.hpp>
#include <app/cli_cmd.hpp>
#include <asn/utils/utils.hpp>
#include <rrc/rrc.hpp>
#include <sctp/sctp.hpp>
#include <utility>
......@@ -18,7 +20,8 @@
#include <utils/octet_string.hpp>
#include <utils/unique_buffer.hpp>
#include "types.hpp"
extern "C" struct ASN_NGAP_FiveG_S_TMSI;
extern "C" struct ASN_NGAP_TAIListForPaging;
namespace nr::gnb
{
......@@ -103,6 +106,7 @@ struct NwGnbNgapToRrc : NtsMessage
RADIO_POWER_ON,
NAS_DELIVERY,
AN_RELEASE,
PAGING,
} present;
// NAS_DELIVERY
......@@ -112,6 +116,10 @@ struct NwGnbNgapToRrc : NtsMessage
// NAS_DELIVERY
OctetString pdu{};
// PAGING
asn::Unique<ASN_NGAP_FiveG_S_TMSI> uePagingTmsi{};
asn::Unique<ASN_NGAP_TAIListForPaging> taiListForPaging{};
explicit NwGnbNgapToRrc(PR present) : NtsMessage(NtsMessageType::GNB_NGAP_TO_RRC), present(present)
{
}
......
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