From afe73820d6977342432af9c74e10ee9883faffd6 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 23 Sep 2024 15:34:28 +0200 Subject: [PATCH] Refactor and cleanup rrc_gNB_send_NGAP_NAS_FIRST_REQ * add function to process AMF Identifier * add function to select AMF * set const parameters in utility nnsf functions * adopt utilities for memory allocation * improve readability and maintainability * improve logging --- openair2/RRC/NR/rrc_gNB_NGAP.c | 49 +++-- openair3/NGAP/ngap_gNB_nas_procedures.c | 244 ++++++++++++------------ openair3/NGAP/ngap_gNB_nnsf.c | 28 ++- openair3/NGAP/ngap_gNB_nnsf.h | 28 ++- 4 files changed, 173 insertions(+), 176 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 85d9cffeb3..0749fc12aa 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -148,26 +148,38 @@ void nr_rrc_pdcp_config_security(gNB_RRC_UE_t *UE, bool enable_ciphering) nr_pdcp_config_set_security(UE->rrc_ue_id, DL_SCH_LCID_DCCH, true, &security_parameters); } -//------------------------------------------------------------------------------ -/* -* Initial UE NAS message on S1AP. -*/ +/** @brief Process AMF Identifier and fill GUAMI struct members */ +static nr_guami_t get_guami(const uint32_t amf_Id) +{ + nr_guami_t guami = {0}; + guami.amf_region_id = (amf_Id >> 16) & 0xff; + guami.amf_set_id = (amf_Id >> 6) & 0x3ff; + guami.amf_pointer = amf_Id & 0x3f; + return guami; +} + +/** + * @brief Prepare the Initial UE Message (Uplink NAS) to be forwarded to the AMF over N2 + * extracts NAS PDU, Selected PLMN and Registered AMF from the RRCSetupComplete + */ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRCSetupComplete_IEs_t *rrcSetupComplete) -//------------------------------------------------------------------------------ { MessageDef *message_p = itti_alloc_new_message(TASK_RRC_GNB, rrc->module_id, NGAP_NAS_FIRST_REQ); ngap_nas_first_req_t *req = &NGAP_NAS_FIRST_REQ(message_p); memset(req, 0, sizeof(*req)); + // RAN UE NGAP ID req->gNB_ue_ngap_id = UE->rrc_ue_id; + // RRC Establishment Cause /* Assume that cause is coded in the same way in RRC and NGap, just check that the value is in NGap range */ AssertFatal(UE->establishment_cause < NGAP_RRC_CAUSE_LAST, "Establishment cause invalid (%jd/%d)!", UE->establishment_cause, NGAP_RRC_CAUSE_LAST); req->establishment_cause = UE->establishment_cause; - /* Forward NAS message */ + // NAS-PDU req->nas_pdu = create_byte_array(rrcSetupComplete->dedicatedNAS_Message.size, rrcSetupComplete->dedicatedNAS_Message.buf); + // Selected PLMN Identity: indicates the selected PLMN id for the non-3GPP access /* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */ int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1; if (selected_plmn_identity != 0) @@ -175,32 +187,29 @@ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRC req->selected_plmn_identity = 0; /* always zero because we only support one */ - /* Fill UE identities with available information */ + /* 5G-S-TMSI */ if (UE->Initialue_identity_5g_s_TMSI.presence) { - /* Fill s-TMSI */ + // 5G-S-TMSI req->ue_identity.presenceMask = NGAP_UE_IDENTITIES_FiveG_s_tmsi; req->ue_identity.s_tmsi.amf_set_id = UE->Initialue_identity_5g_s_TMSI.amf_set_id; req->ue_identity.s_tmsi.amf_pointer = UE->Initialue_identity_5g_s_TMSI.amf_pointer; req->ue_identity.s_tmsi.m_tmsi = UE->Initialue_identity_5g_s_TMSI.fiveg_tmsi; } else if (rrcSetupComplete->registeredAMF != NULL) { + /** + * Fetch the AMF-Identifier from the registeredAMF IE + * The IE AMF-Identifier (AMFI) comprises of an AMF Region ID (8b), + * an AMF Set ID (10b) and an AMF Pointer (6b) + * as specified in TS 23.003 [21], clause 2.10.1. */ NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; req->ue_identity.presenceMask = NGAP_UE_IDENTITIES_guami; - - /* The IE AMF-Identifier (AMFI) comprises of an AMF Region ID (8b), an AMF Set ID (10b) and an AMF Pointer (6b) as specified in TS 23.003 [21], clause 2.10.1. */ uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier); - req->ue_identity.guami.amf_region_id = (amf_Id >> 16) & 0xff; - req->ue_identity.guami.amf_set_id = (amf_Id >> 6) & 0x3ff; - req->ue_identity.guami.amf_pointer = amf_Id & 0x3f; - - UE->ue_guami.amf_region_id = req->ue_identity.guami.amf_region_id; - UE->ue_guami.amf_set_id = req->ue_identity.guami.amf_set_id; - UE->ue_guami.amf_pointer = req->ue_identity.guami.amf_pointer; - + UE->ue_guami = req->ue_identity.guami = get_guami(amf_Id); LOG_I(NGAP, - "Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n", + "GUAMI in NGAP_NAS_FIRST_REQ (UE %04x): AMF Set ID %u, Region ID %u, Pointer %u\n", + UE->rnti, req->ue_identity.guami.amf_set_id, req->ue_identity.guami.amf_region_id, - UE->rnti); + req->ue_identity.guami.amf_pointer); } else { req->ue_identity.presenceMask = NGAP_UE_IDENTITIES_NONE; } diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 2892678da3..5fe80db46e 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -68,20 +68,104 @@ static void allocAddrCopy(BIT_STRING_t *out, transport_layer_addr_t in) } } -//------------------------------------------------------------------------------ -int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEfirstReq) -//------------------------------------------------------------------------------ +/** @brief Selects the AMF instance for a given UE based on identity information. + * It attempts to select an AMF using the following prioritized criteria: + * 1. GUAMI, if provided and valid (via Region ID, Set ID, Pointer). + * 2. 5G-S-TMSI, using AMF Set ID if GUAMI is unavailable or unusable. + * 3. Selected PLMN identity and local PLMN configuration. + * 4. Fallback to AMF with highest relative capacity, considering load balancing. + * @ref AMF Discovery and Selection (3GPP TS 23.501 clause 6.3.5) */ +static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ngap_nas_first_req_t *msg) { - ngap_gNB_instance_t *instance_p = NULL; - struct ngap_gNB_amf_data_s *amf_desc_p = NULL; - NGAP_NGAP_PDU_t pdu; - uint8_t *buffer = NULL; - uint32_t length = 0; + ngap_gNB_amf_data_t *amf = NULL; + + /* Select the AMF corresponding to the provided GUAMI. */ + if (msg->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) { + const nr_guami_t *guami = &msg->ue_identity.guami; + amf = ngap_gNB_nnsf_select_amf_by_guami(instance_p, msg->establishment_cause, *guami); + if (amf) { + NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + guami->mcc, + guami->mnc, + guami->amf_region_id, + guami->amf_set_id, + guami->amf_pointer); + } + } + + if (amf == NULL) { + /* Select the AMF corresponding to the provided s-TMSI. */ + //TODO have not be test. it's should be test + if (msg->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) { + const fiveg_s_tmsi_t *fgs_tmsi = &msg->ue_identity.s_tmsi; + amf = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, msg->establishment_cause, msg->selected_plmn_identity, fgs_tmsi->amf_set_id); + if (amf) { + NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + fgs_tmsi->amf_set_id, + msg->selected_plmn_identity, + instance_p->plmn[msg->selected_plmn_identity].plmn.mcc, + instance_p->plmn[msg->selected_plmn_identity].plmn.mnc); + } + } + } + + if (amf == NULL) { + /* Select AMF based on the selected PLMN identity, received through RRC + * Connection Setup Complete */ + amf = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, msg->establishment_cause, msg->selected_plmn_identity); + if (amf) { + NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", + msg->gNB_ue_ngap_id, + amf->amf_name, + amf->assoc_id, + msg->selected_plmn_identity, + instance_p->plmn[msg->selected_plmn_identity].plmn.mcc, + instance_p->plmn[msg->selected_plmn_identity].plmn.mnc); + } + } + + if (amf == NULL) { + /* + * If no AMF corresponds to the GUAMI, the s-TMSI, or the selected PLMN + * identity, selects the AMF with the highest capacity. + */ + amf = ngap_gNB_nnsf_select_amf(instance_p, msg->establishment_cause); + if (amf) { + NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", msg->gNB_ue_ngap_id, amf->amf_name, amf->assoc_id); + } + } + + return amf; +} + +/** @brief NAS Transport Messages: Initial UE Message + * forward the first received (layer 3) uplink NAS message + * from the radio interface to the AMF over N2 + * NG-RAN node -> AMF (9.2.5.1, 3GPP TS 38.413) */ +int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEfirstReq) +{ + NGAP_NGAP_PDU_t pdu = {0}; + uint8_t *buffer = NULL; + uint32_t length = 0; DevAssert(UEfirstReq != NULL); /* Retrieve the NGAP gNB instance associated with Mod_id */ - instance_p = ngap_gNB_get_instance(instance); + ngap_gNB_instance_t *instance_p = ngap_gNB_get_instance(instance); DevAssert(instance_p != NULL); - memset(&pdu, 0, sizeof(pdu)); + + // AMF selection from the Initial UE message contents + struct ngap_gNB_amf_data_s *amf = select_amf(instance_p, UEfirstReq); + if (amf == NULL) { + NGAP_WARN("No AMF is associated to the gNB\n"); + return -1; + } + + // Message Type (M) pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; asn1cCalloc(pdu.choice.initiatingMessage, head); head->procedureCode = NGAP_ProcedureCode_id_InitialUEMessage; @@ -89,98 +173,18 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf head->value.present = NGAP_InitiatingMessage__value_PR_InitialUEMessage; NGAP_InitialUEMessage_t *out = &head->value.choice.InitialUEMessage; - /* Select the AMF corresponding to the provided GUAMI. */ - //TODO have not be test. it's should be test - if (UEfirstReq->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) { - amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami(instance_p, UEfirstReq->establishment_cause, UEfirstReq->ue_identity.guami); - - if (amf_desc_p) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", - UEfirstReq->gNB_ue_ngap_id, - amf_desc_p->amf_name, - amf_desc_p->assoc_id, - UEfirstReq->ue_identity.guami.mcc, - UEfirstReq->ue_identity.guami.mnc, - UEfirstReq->ue_identity.guami.amf_region_id, - UEfirstReq->ue_identity.guami.amf_set_id, - UEfirstReq->ue_identity.guami.amf_pointer); - } - } - - if (amf_desc_p == NULL) { - /* Select the AMF corresponding to the provided s-TMSI. */ - //TODO have not be test. it's should be test - if (UEfirstReq->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) { - amf_desc_p = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, UEfirstReq->establishment_cause, UEfirstReq->selected_plmn_identity, UEfirstReq->ue_identity.s_tmsi.amf_set_id); - - if (amf_desc_p) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n", - UEfirstReq->gNB_ue_ngap_id, - amf_desc_p->amf_name, - amf_desc_p->assoc_id, - UEfirstReq->ue_identity.s_tmsi.amf_set_id, - UEfirstReq->selected_plmn_identity, - instance_p->plmn[UEfirstReq->selected_plmn_identity].plmn.mcc, - instance_p->plmn[UEfirstReq->selected_plmn_identity].plmn.mnc); - } - } - } - - if (amf_desc_p == NULL) { - /* Select AMF based on the selected PLMN identity, received through RRC - * Connection Setup Complete */ - //TODO have not be test. it's should be test - amf_desc_p = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, UEfirstReq->establishment_cause, UEfirstReq->selected_plmn_identity); - - if (amf_desc_p) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", - UEfirstReq->gNB_ue_ngap_id, - amf_desc_p->amf_name, - amf_desc_p->assoc_id, - UEfirstReq->selected_plmn_identity, - instance_p->plmn[UEfirstReq->selected_plmn_identity].plmn.mcc, - instance_p->plmn[UEfirstReq->selected_plmn_identity].plmn.mnc); - } - } - - if (amf_desc_p == NULL) { - /* - * If no AMF corresponds to the GUAMI, the s-TMSI, or the selected PLMN - * identity, selects the AMF with the highest capacity. - */ - //TODO have not be test. it's should be test - amf_desc_p = ngap_gNB_nnsf_select_amf(instance_p, UEfirstReq->establishment_cause); - - if (amf_desc_p) { - NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", UEfirstReq->gNB_ue_ngap_id, amf_desc_p->amf_name, amf_desc_p->assoc_id); - } - } - - if (amf_desc_p == NULL) { - /* - * In case gNB has no AMF associated, the gNB should inform RRC and discard - * this request. - */ - NGAP_WARN("No AMF is associated to the gNB\n"); - // TODO: Inform RRC - return -1; - } - - /* The gNB should allocate a unique gNB UE NGAP ID for this UE. The value - * will be used for the duration of the connectivity. - */ - struct ngap_gNB_ue_context_s *ue_desc_p = calloc(1, sizeof(*ue_desc_p)); + /* Store the UE context in NGAP with: + * selected AMF, selected PLMN identity, gNB ID + * the unique gNB UE NGAP ID, used for the duration of the connectivity */ + struct ngap_gNB_ue_context_s *ue_desc_p = calloc_or_fail(1, sizeof(*ue_desc_p)); DevAssert(ue_desc_p != NULL); - /* Keep a reference to the selected AMF */ - ue_desc_p->amf_ref = amf_desc_p; + ue_desc_p->amf_ref = amf; ue_desc_p->gNB_ue_ngap_id = UEfirstReq->gNB_ue_ngap_id; ue_desc_p->gNB_instance = instance_p; ue_desc_p->selected_plmn_identity = UEfirstReq->selected_plmn_identity; - - // insert in master table ngap_store_ue_context(ue_desc_p); - /* mandatory */ + // RAN UE NGAP ID (M) { asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; @@ -188,7 +192,8 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_RAN_UE_NGAP_ID; ie->value.choice.RAN_UE_NGAP_ID = ue_desc_p->gNB_ue_ngap_id; } - /* mandatory */ + + /* NAS-PDU (M): transferred transparently */ { asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); ie->id = NGAP_ProtocolIE_ID_id_NAS_PDU; @@ -197,38 +202,33 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf OCTET_STRING_fromBuf(&ie->value.choice.NAS_PDU, (const char *)UEfirstReq->nas_pdu.buf, UEfirstReq->nas_pdu.len); } - /* mandatory */ + // User Location Information (M) { asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); ie->id = NGAP_ProtocolIE_ID_id_UserLocationInformation; ie->criticality = NGAP_Criticality_reject; ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_UserLocationInformation; - ie->value.choice.UserLocationInformation.present = NGAP_UserLocationInformation_PR_userLocationInformationNR; - asn1cCalloc(ie->value.choice.UserLocationInformation.choice.userLocationInformationNR, userinfo_nr_p); /* Set nRCellIdentity. default userLocationInformationNR */ MACRO_GNB_ID_TO_CELL_IDENTITY(instance_p->gNB_id, 0, // Cell ID &userinfo_nr_p->nR_CGI.nRCellIdentity); - MCC_MNC_TO_TBCD(instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mcc, - instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mnc, - instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mnc_digit_length, - &userinfo_nr_p->nR_CGI.pLMNIdentity); - /* Set TAI */ + plmn_id_t *plmn = &instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn; + MCC_MNC_TO_TBCD(plmn->mcc, plmn->mnc, plmn->mnc_digit_length, &userinfo_nr_p->nR_CGI.pLMNIdentity); + + /* In case of network sharing, + the selected PLMN is indicated by the PLMN Identity IE within the TAI IE */ INT24_TO_OCTET_STRING(instance_p->tac, &userinfo_nr_p->tAI.tAC); - MCC_MNC_TO_PLMNID(instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mcc, - instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mnc, - instance_p->plmn[ue_desc_p->selected_plmn_identity].plmn.mnc_digit_length, - &userinfo_nr_p->tAI.pLMNIdentity); + MCC_MNC_TO_PLMNID(plmn->mcc, plmn->mnc, plmn->mnc_digit_length, &userinfo_nr_p->tAI.pLMNIdentity); } /* Set the establishment cause according to those provided by RRC */ DevCheck(UEfirstReq->establishment_cause < NGAP_RRC_CAUSE_LAST, UEfirstReq->establishment_cause, NGAP_RRC_CAUSE_LAST, 0); - /* mandatory */ + // RRC Establishment Cause (M) { asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); ie->id = NGAP_ProtocolIE_ID_id_RRCEstablishmentCause; @@ -237,7 +237,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ie->value.choice.RRCEstablishmentCause = UEfirstReq->establishment_cause; } - /* optional */ + // 5G-S-TMSI (O) if (UEfirstReq->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) { NGAP_DEBUG("FIVEG_S_TMSI_PRESENT\n"); asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); @@ -249,7 +249,8 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf M_TMSI_TO_OCTET_STRING(UEfirstReq->ue_identity.s_tmsi.m_tmsi, &ie->value.choice.FiveG_S_TMSI.fiveG_TMSI); } - /* optional */ + /* UE Context Request (O): instruct the AMF to trigger an + Initial Context Setup procedure towards the NG-RAN node. */ { asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); ie->id = NGAP_ProtocolIE_ID_id_UEContextRequest; @@ -258,10 +259,8 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ie->value.choice.UEContextRequest = NGAP_UEContextRequest_requested; } - if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { - /* Failed to encode message */ - DevMessage("Failed to encode initial UE message\n"); - } + if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) + DevMessage("Failed to encode initial UE message\n"); /* Update the current NGAP UE state */ ue_desc_p->ue_state = NGAP_UE_WAITING_CSR; @@ -277,16 +276,13 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf * the stream should not be changed during the communication of the * UE-associated signalling. */ - amf_desc_p->nextstream = (amf_desc_p->nextstream + 1) % amf_desc_p->out_streams; - - if ((amf_desc_p->nextstream == 0) && (amf_desc_p->out_streams > 1)) { - amf_desc_p->nextstream += 1; + amf->nextstream = (amf->nextstream + 1) % amf->out_streams; + if ((amf->nextstream == 0) && (amf->out_streams > 1)) { + amf->nextstream += 1; } - - ue_desc_p->tx_stream = amf_desc_p->nextstream; + ue_desc_p->tx_stream = amf->nextstream; /* Send encoded message over sctp */ - ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf_desc_p->assoc_id, - buffer, length, ue_desc_p->tx_stream); + ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf->assoc_id, buffer, length, ue_desc_p->tx_stream); return 0; } diff --git a/openair3/NGAP/ngap_gNB_nnsf.c b/openair3/NGAP/ngap_gNB_nnsf.c index 54c8a505bb..648d455bea 100644 --- a/openair3/NGAP/ngap_gNB_nnsf.c +++ b/openair3/NGAP/ngap_gNB_nnsf.c @@ -33,9 +33,7 @@ #include "queue.h" #include "tree.h" -struct ngap_gNB_amf_data_s * -ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause) +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, const ngap_rrc_establishment_cause_t cause) { struct ngap_gNB_amf_data_s *amf_data_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; @@ -86,10 +84,9 @@ ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, return amf_highest_capacity_p; } -struct ngap_gNB_amf_data_s * -ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - int selected_plmn_identity) +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const int selected_plmn_identity) { struct ngap_gNB_amf_data_s *amf_data_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; @@ -156,11 +153,10 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, return amf_highest_capacity_p; } -struct ngap_gNB_amf_data_s * -ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - int selected_plmn_identity, - uint8_t amf_setid) +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const int selected_plmn_identity, + uint8_t amf_setid) { struct ngap_gNB_amf_data_s *amf_data_p = NULL; @@ -234,9 +230,9 @@ ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p, return NULL; } -struct ngap_gNB_amf_data_s *ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - nr_guami_t guami) +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const nr_guami_t guami) { struct ngap_gNB_amf_data_s *amf_data_p = NULL; @@ -326,7 +322,7 @@ struct ngap_gNB_amf_data_s *ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_ return NULL; } -struct ngap_gNB_amf_data_s *ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, nr_guami_t guami) +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, const nr_guami_t guami) { struct ngap_gNB_amf_data_s *amf_data_p = NULL; struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; diff --git a/openair3/NGAP/ngap_gNB_nnsf.h b/openair3/NGAP/ngap_gNB_nnsf.h index 8b20b0cad4..074b163f75 100644 --- a/openair3/NGAP/ngap_gNB_nnsf.h +++ b/openair3/NGAP/ngap_gNB_nnsf.h @@ -34,25 +34,21 @@ #include "ngap_gNB_defs.h" #include "ngap_messages_types.h" -struct ngap_gNB_amf_data_s * -ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause); +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, const ngap_rrc_establishment_cause_t cause); -struct ngap_gNB_amf_data_s * -ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - int selected_plmn_identity); +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const int selected_plmn_identity); -struct ngap_gNB_amf_data_s* -ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - int selected_plmn_identity, - uint8_t amf_setid); +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const int selected_plmn_identity, + uint8_t amf_setid); -struct ngap_gNB_amf_data_s *ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, - ngap_rrc_establishment_cause_t cause, - nr_guami_t guami); +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, + const ngap_rrc_establishment_cause_t cause, + const nr_guami_t guami); -struct ngap_gNB_amf_data_s *ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, nr_guami_t guami); +ngap_gNB_amf_data_t *ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, const nr_guami_t guami); #endif /* NGAP_GNB_NNSF_H_ */