Commit 7ab16895 authored by aligungr's avatar aligungr

S-TMSI handling in Initial UE Message

parent bbf325ab
......@@ -24,7 +24,8 @@
namespace nr::gnb
{
void NgapTask::handleInitialNasTransport(int ueId, const OctetString &nasPdu, long rrcEstablishmentCause)
void NgapTask::handleInitialNasTransport(int ueId, const OctetString &nasPdu, long rrcEstablishmentCause,
const std::optional<GutiMobileIdentity> &sTmsi)
{
m_logger->debug("Initial NAS message received from UE[%d]", ueId);
......@@ -54,25 +55,43 @@ void NgapTask::handleInitialNasTransport(int ueId, const OctetString &nasPdu, lo
amfCtx->nextStream += 1;
ueCtx->uplinkStream = amfCtx->nextStream;
std::vector<ASN_NGAP_InitialUEMessage_IEs *> ies;
auto *ieEstablishmentCause = asn::New<ASN_NGAP_InitialUEMessage_IEs>();
ieEstablishmentCause->id = ASN_NGAP_ProtocolIE_ID_id_RRCEstablishmentCause;
ieEstablishmentCause->criticality = ASN_NGAP_Criticality_ignore;
ieEstablishmentCause->value.present = ASN_NGAP_InitialUEMessage_IEs__value_PR_RRCEstablishmentCause;
ieEstablishmentCause->value.choice.RRCEstablishmentCause = rrcEstablishmentCause;
ies.push_back(ieEstablishmentCause);
auto *ieCtxRequest = asn::New<ASN_NGAP_InitialUEMessage_IEs>();
ieCtxRequest->id = ASN_NGAP_ProtocolIE_ID_id_UEContextRequest;
ieCtxRequest->criticality = ASN_NGAP_Criticality_ignore;
ieCtxRequest->value.present = ASN_NGAP_InitialUEMessage_IEs__value_PR_UEContextRequest;
ieCtxRequest->value.choice.UEContextRequest = ASN_NGAP_UEContextRequest_requested;
ies.push_back(ieCtxRequest);
auto *ieNasPdu = asn::New<ASN_NGAP_InitialUEMessage_IEs>();
ieNasPdu->id = ASN_NGAP_ProtocolIE_ID_id_NAS_PDU;
ieNasPdu->criticality = ASN_NGAP_Criticality_reject;
ieNasPdu->value.present = ASN_NGAP_InitialUEMessage_IEs__value_PR_NAS_PDU;
asn::SetOctetString(ieNasPdu->value.choice.NAS_PDU, nasPdu);
ies.push_back(ieNasPdu);
if (sTmsi)
{
auto *ieTmsi = asn::New<ASN_NGAP_InitialUEMessage_IEs>();
ieTmsi->id = ASN_NGAP_ProtocolIE_ID_id_FiveG_S_TMSI;
ieTmsi->criticality = ASN_NGAP_Criticality_reject;
ieTmsi->value.present = ASN_NGAP_InitialUEMessage_IEs__value_PR_FiveG_S_TMSI;
asn::SetBitStringInt<10>(sTmsi->amfSetId, ieTmsi->value.choice.FiveG_S_TMSI.aMFSetID);
asn::SetBitStringInt<6>(sTmsi->amfPointer, ieTmsi->value.choice.FiveG_S_TMSI.aMFPointer);
asn::SetOctetString4(ieTmsi->value.choice.FiveG_S_TMSI.fiveG_TMSI, sTmsi->tmsi);
ies.push_back(ieTmsi);
}
auto *pdu = asn::ngap::NewMessagePdu<ASN_NGAP_InitialUEMessage>({ieEstablishmentCause, ieCtxRequest, ieNasPdu});
auto *pdu = asn::ngap::NewMessagePdu<ASN_NGAP_InitialUEMessage>(ies);
sendNgapUeAssociated(ueId, pdu);
}
......
......@@ -55,7 +55,7 @@ void NgapTask::onLoop()
switch (w->present)
{
case NmGnbRrcToNgap::INITIAL_NAS_DELIVERY: {
handleInitialNasTransport(w->ueId, w->pdu, w->rrcEstablishmentCause);
handleInitialNasTransport(w->ueId, w->pdu, w->rrcEstablishmentCause, w->sTmsi);
break;
}
case NmGnbRrcToNgap::UPLINK_NAS_DELIVERY: {
......
......@@ -98,7 +98,8 @@ class NgapTask : public NtsTask
bool handleSctpStreamId(int amfId, int stream, const ASN_NGAP_NGAP_PDU &pdu);
/* NAS transport */
void handleInitialNasTransport(int ueId, const OctetString &nasPdu, long rrcEstablishmentCause);
void handleInitialNasTransport(int ueId, const OctetString &nasPdu, long rrcEstablishmentCause,
const std::optional<GutiMobileIdentity> &sTmsi);
void handleUplinkNasTransport(int ueId, const OctetString &nasPdu);
void receiveDownlinkNasTransport(int amfId, ASN_NGAP_DownlinkNASTransport *msg);
void deliverDownlinkNas(int ueId, OctetString &&nasPdu);
......@@ -108,7 +109,7 @@ class NgapTask : public NtsTask
/* PDU session management */
void receiveSessionResourceSetupRequest(int amfId, ASN_NGAP_PDUSessionResourceSetupRequest *msg);
void receiveSessionResourceReleaseCommand(int amfId, ASN_NGAP_PDUSessionResourceReleaseCommand *msg);
std::optional<NgapCause> setupPduSessionResource(NgapUeContext* ue, PduSessionResource *resource);
std::optional<NgapCause> setupPduSessionResource(NgapUeContext *ue, PduSessionResource *resource);
/* UE context management */
void receiveInitialContextSetup(int amfId, ASN_NGAP_InitialContextSetupRequest *msg);
......
......@@ -204,6 +204,7 @@ struct NmGnbRrcToNgap : NtsMessage
// INITIAL_NAS_DELIVERY
long rrcEstablishmentCause{};
std::optional<GutiMobileIdentity> sTmsi{};
explicit NmGnbRrcToNgap(PR present) : NtsMessage(NtsMessageType::GNB_RRC_TO_NGAP), present(present)
{
......
......@@ -104,6 +104,8 @@ void GnbRrcTask::receiveRrcSetupComplete(int ueId, const ASN_RRC_RRCSetupComplet
w->ueId = ueId;
w->pdu = asn::GetOctetString(setupComplete->dedicatedNAS_Message);
w->rrcEstablishmentCause = ue->establishmentCause;
w->sTmsi = std::nullopt; // TODO
m_base->ngapTask->push(w);
}
......
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