From 446a905013d88a32d375081fe0ca71af0c4e1072 Mon Sep 17 00:00:00 2001 From: Rakesh Mundlamuri Date: Wed, 7 Jan 2026 12:08:25 +0530 Subject: [PATCH] Add TRP Information Request NRPPA message decoding procedures --- common/utils/LOG/log.h | 1 + common/utils/T/T_messages.txt | 21 ++ common/utils/ocp_itti/all_msg.h | 2 +- common/utils/ocp_itti/intertask_interface.h | 1 + openair2/COMMON/nrppa_messages_def.h | 25 +++ openair2/COMMON/nrppa_messages_types.h | 67 +++++++ openair3/NRPPA/CMakeLists.txt | 14 +- openair3/NRPPA/nrppa_common.h | 62 ++++++ openair3/NRPPA/nrppa_gNB.c | 79 ++++++++ openair3/NRPPA/nrppa_gNB.h | 32 ++++ openair3/NRPPA/nrppa_gNB_decoder.c | 116 ++++++++++++ openair3/NRPPA/nrppa_gNB_decoder.h | 30 +++ openair3/NRPPA/nrppa_gNB_handlers.c | 179 ++++++++++++++++++ openair3/NRPPA/nrppa_gNB_handlers.h | 28 +++ .../nrppa_gNB_location_information_transfer.c | 95 ++++++++++ .../nrppa_gNB_location_information_transfer.h | 28 +++ openair3/NRPPA/nrppa_gNB_ue_context.c | 85 +++++++++ openair3/NRPPA/nrppa_gNB_ue_context.h | 43 +++++ openair3/NRPPA/nrppa_includes.h | 39 ++++ tests/nr-cu-nrppa/CMakeLists.txt | 2 +- tests/nr-cu-nrppa/nr-cu-nrppa.c | 4 + 21 files changed, 948 insertions(+), 5 deletions(-) create mode 100644 openair2/COMMON/nrppa_messages_def.h create mode 100644 openair2/COMMON/nrppa_messages_types.h create mode 100644 openair3/NRPPA/nrppa_common.h create mode 100644 openair3/NRPPA/nrppa_gNB.c create mode 100644 openair3/NRPPA/nrppa_gNB.h create mode 100644 openair3/NRPPA/nrppa_gNB_decoder.c create mode 100644 openair3/NRPPA/nrppa_gNB_decoder.h create mode 100644 openair3/NRPPA/nrppa_gNB_handlers.c create mode 100644 openair3/NRPPA/nrppa_gNB_handlers.h create mode 100644 openair3/NRPPA/nrppa_gNB_location_information_transfer.c create mode 100644 openair3/NRPPA/nrppa_gNB_location_information_transfer.h create mode 100644 openair3/NRPPA/nrppa_gNB_ue_context.c create mode 100644 openair3/NRPPA/nrppa_gNB_ue_context.h create mode 100644 openair3/NRPPA/nrppa_includes.h diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index a9db2e9c5c..837c6897a6 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -165,6 +165,7 @@ static const char *const flag_name[] = {FOREACH_FLAG(FLAG_TEXT) ""}; COMP_DEF(M2AP, ) \ COMP_DEF(M3AP, ) \ COMP_DEF(NGAP, ) \ + COMP_DEF(NRPPA, ) \ COMP_DEF(GNB_APP, log) \ COMP_DEF(NR_RRC, log) \ COMP_DEF(NR_MAC, log) \ diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index d2405f9033..00f063f703 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -586,6 +586,27 @@ ID = LEGACY_NGAP_TRACE GROUP = ALL:LEGACY_NGAP:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log +ID = LEGACY_NRPPA_INFO + DESC = NRPPA legacy logs - info level + GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_NRPPA_ERROR + DESC = NRPPA legacy logs - error level + GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_NRPPA_WARNING + DESC = NRPPA legacy logs - warning level + GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log +ID = LEGACY_NRPPA_DEBUG + DESC = NRPPA legacy logs - debug level + GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_NRPPA_TRACE + DESC = NRPPA legacy logs - trace level + GROUP = ALL:LEGACY_NRPPA:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log + ID = LEGACY_X2AP_INFO DESC = X2AP legacy logs - info level GROUP = ALL:LEGACY_X2AP:LEGACY_GROUP_INFO:LEGACY diff --git a/common/utils/ocp_itti/all_msg.h b/common/utils/ocp_itti/all_msg.h index 377bfc4343..8b74409a3c 100644 --- a/common/utils/ocp_itti/all_msg.h +++ b/common/utils/ocp_itti/all_msg.h @@ -14,4 +14,4 @@ #include "openair2/COMMON/f1ap_messages_def.h" #include "openair2/COMMON/e1ap_messages_def.h" #include "openair2/COMMON/ngap_messages_def.h" - +#include "openair2/COMMON/nrppa_messages_def.h" diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 7580698dcf..353a0bae5a 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -230,6 +230,7 @@ typedef struct IttiMsgText_s { #include #include #include +#include #include #include #include diff --git a/openair2/COMMON/nrppa_messages_def.h b/openair2/COMMON/nrppa_messages_def.h new file mode 100644 index 0000000000..ae17d73742 --- /dev/null +++ b/openair2/COMMON/nrppa_messages_def.h @@ -0,0 +1,25 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "openair2/COMMON/nrppa_messages_types.h" + +// LMF -> CU +MESSAGE_DEF(NRPPA_TRP_INFORMATION_REQ, MESSAGE_PRIORITY_MED, nrppa_trp_information_req_t, nrppa_trp_information_req) diff --git a/openair2/COMMON/nrppa_messages_types.h b/openair2/COMMON/nrppa_messages_types.h new file mode 100644 index 0000000000..55563a59ab --- /dev/null +++ b/openair2/COMMON/nrppa_messages_types.h @@ -0,0 +1,67 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NRPPA_MESSAGES_TYPES_H_ +#define NRPPA_MESSAGES_TYPES_H_ + +// Defines to access message fields. + +#define NRPPA_TRP_INFORMATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nrppa_trp_information_req + +/* Structure of Positioning related NRPPA messages */ +/* IE structures for Positioning related messages as per TS 38.455 V16.7.1*/ + +typedef enum nrppa_trp_information_type_item_e { + NRPPA_TRP_INFORMATION_TYPE_ITEM_NR_PCI, + NRPPA_TRP_INFORMATION_TYPE_ITEM_NG_RAN_CGI, + NRPPA_TRP_INFORMATION_TYPE_ITEM_NR_ARFCN, + NRPPA_TRP_INFORMATION_TYPE_ITEM_PRS_CONFIG, + NRPPA_TRP_INFORMATION_TYPE_ITEM_SSB_CONFIG, + NRPPA_TRP_INFORMATION_TYPE_ITEM_SFN_INIT_TIME, + NRPPA_TRP_INFORMATION_TYPE_ITEM_SPATIAL_DIRECTION_INFO, + NRPPA_TRP_INFORMATION_TYPE_ITEM_GEO_COORDINATES +} nrppa_trp_information_type_item_pr; + +typedef struct nrppa_trp_information_type_list_s { + nrppa_trp_information_type_item_pr *trp_information_type_item; + uint8_t trp_information_type_list_length; +} nrppa_trp_information_type_list_t; + +typedef struct nrppa_trp_list_item_s { + uint32_t trp_id; +} nrppa_trp_list_item_t; + +typedef struct nrppa_trp_list_s { + nrppa_trp_list_item_t *trp_list_item; + uint32_t trp_list_length; +} nrppa_trp_list_t; + +typedef struct nrppa_trp_information_req_s { + // IE 9.2.4 (mandatory) + uint16_t transaction_id; + bool has_trp_list; + // mandatory + nrppa_trp_list_t trp_list; + // mandatory + nrppa_trp_information_type_list_t trp_information_type_list; +} nrppa_trp_information_req_t; + +#endif // NRPPA_MESSAGES_TYPES_H_ diff --git a/openair3/NRPPA/CMakeLists.txt b/openair3/NRPPA/CMakeLists.txt index 613cbfc3ce..28ad4c8618 100644 --- a/openair3/NRPPA/CMakeLists.txt +++ b/openair3/NRPPA/CMakeLists.txt @@ -1,5 +1,13 @@ add_subdirectory(MESSAGES) -add_executable(test_nrppa ${OPENAIR3_DIR}/NRPPA/test_nrppa.c ) -target_link_libraries(test_nrppa asn1_nrppa) - +add_library(nrppa + nrppa_gNB.c + nrppa_gNB_config.c + nrppa_gNB_handlers.c + nrppa_gNB_decoder.c + nrppa_gNB_ue_context.c + nrppa_gNB_location_information_transfer.c + ) + +target_link_libraries(nrppa PUBLIC asn1_nrppa) +target_link_libraries(nrppa PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) diff --git a/openair3/NRPPA/nrppa_common.h b/openair3/NRPPA/nrppa_common.h new file mode 100644 index 0000000000..b7c613e77a --- /dev/null +++ b/openair3/NRPPA/nrppa_common.h @@ -0,0 +1,62 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NRPPA_COMMON_H_ +#define NRPPA_COMMON_H_ + +#include "oai_asn1.h" +#include "common/utils/LOG/log.h" +#include "ds/byte_array.h" +#include "nrppa_includes.h" + +#define NRPPA_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ + do { \ + IE_TYPE **ptr; \ + ie = NULL; \ + for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \ + ptr++) { \ + if ((*ptr)->id == IE_ID) { \ + ie = *ptr; \ + break; \ + } \ + } \ + if (ie == NULL) { \ + if (mandatory) { \ + AssertFatal(false, "NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ + } else { \ + LOG_I(NRPPA, "NRPPA_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ + } \ + } \ + } while (0); \ + if (mandatory && !ie) \ + return -1 + +// gnb and ue related info in NRPPA message +typedef struct nrppa_gnb_ue_info_s { + instance_t instance; + int32_t gNB_ue_ngap_id; + int64_t amf_ue_ngap_id; + byte_array_t routing_id; +} nrppa_gnb_ue_info_t; + +typedef int (*nrppa_message_decoded_callback)(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu); + +#endif /* NRPPA_COMMON_H_ */ diff --git a/openair3/NRPPA/nrppa_gNB.c b/openair3/NRPPA/nrppa_gNB.c new file mode 100644 index 0000000000..d7f067de98 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB.c @@ -0,0 +1,79 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "tree.h" +#include "queue.h" + +#include "intertask_interface.h" + +#include "assertions.h" +#include "conversions.h" + +#include "nrppa_gNB.h" +#include "nrppa_common.h" +#include "nrppa_gNB_handlers.h" +#include "nrppa_gNB_location_information_transfer.h" + +void nrppa_gNB_init(void) +{ + LOG_I(NRPPA, "Starting NRPPA layer\n"); + itti_mark_task_ready(TASK_NRPPA); +} + +void *nrppa_gNB_process_itti_msg(void *notUsed) +{ + MessageDef *received_msg = NULL; + int result; + itti_receive_msg(TASK_NRPPA, &received_msg); + if (received_msg) { + instance_t instance = ITTI_MSG_DESTINATION_INSTANCE(received_msg); + LOG_I(NRPPA, "Received message %s\n", ITTI_MSG_NAME(received_msg)); + switch (ITTI_MSG_ID(received_msg)) { + case TERMINATE_MESSAGE: + LOG_W(NRPPA, " *** Exiting NRPPA thread\n"); + itti_exit_task(); + break; + case NGAP_DOWNLINKUEASSOCIATEDNRPPA: + nrppa_handle_downlink_ue_associated_nrppa_transport(instance, &NGAP_DOWNLINKUEASSOCIATEDNRPPA(received_msg)); + break; + case NGAP_DOWNLINKNONUEASSOCIATEDNRPPA: + nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance, &NGAP_DOWNLINKNONUEASSOCIATEDNRPPA(received_msg)); + break; + default: + LOG_E(NRPPA, "Received unhandled message: %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; + } + result = itti_free(ITTI_MSG_ORIGIN_ID(received_msg), received_msg); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + } + return NULL; +} + +void *nrppa_gNB_task(void *arg) +{ + nrppa_gNB_init(); + + while (1) { + (void)nrppa_gNB_process_itti_msg(NULL); + } + + return NULL; +} diff --git a/openair3/NRPPA/nrppa_gNB.h b/openair3/NRPPA/nrppa_gNB.h new file mode 100644 index 0000000000..628cfc4587 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB.h @@ -0,0 +1,32 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include + +#ifndef NRPPA_GNB_H_ +#define NRPPA_GNB_H_ + +void nrppa_gNB_init(void); +void *nrppa_gNB_process_itti_msg(void *notUsed); +void *nrppa_gNB_task(void *arg); + +#endif /* NRPPA_GNB_H_ */ diff --git a/openair3/NRPPA/nrppa_gNB_decoder.c b/openair3/NRPPA/nrppa_gNB_decoder.c new file mode 100644 index 0000000000..d197d0d141 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_decoder.c @@ -0,0 +1,116 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "assertions.h" +#include "intertask_interface.h" +#include "nrppa_common.h" +#include "nrppa_gNB_decoder.h" + +static int nrppa_gNB_decode_initiating_message(NRPPA_NRPPA_PDU_t *pdu) +{ + asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}}; + DevAssert(pdu != NULL); + + switch (pdu->choice.initiatingMessage->procedureCode) { + case NRPPA_ProcedureCode_id_tRPInformationExchange: // TRPInformationRequest + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu); + LOG_I(NRPPA, "TRP Information Request initiating message\n"); + free(res.buffer); + break; + + default: + AssertFatal(false, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); + return -1; + } + return 0; +} + +static int nrppa_gNB_decode_successful_outcome(NRPPA_NRPPA_PDU_t *pdu) +{ + asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}}; + DevAssert(pdu != NULL); + + switch (pdu->choice.successfulOutcome->procedureCode) { + case NRPPA_ProcedureCode_id_tRPInformationExchange: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu); + LOG_I(NRPPA, "TRP Information Response successfull outcome message\n"); + free(res.buffer); + break; + + default: + AssertFatal(false, + "Unknown procedure ID (%d) for successfull outcome message\n", + (int)pdu->choice.initiatingMessage->procedureCode); + return -1; + } + return 0; +} + +static int nrppa_gNB_decode_unsuccessful_outcome(NRPPA_NRPPA_PDU_t *pdu) +{ + asn_encode_to_new_buffer_result_t res = {NULL, {0, NULL, NULL}}; + DevAssert(pdu != NULL); + + switch (pdu->choice.unsuccessfulOutcome->procedureCode) { + case NRPPA_ProcedureCode_id_tRPInformationExchange: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NRPPA_NRPPA_PDU, pdu); + LOG_I(NRPPA, "TRP Information Failure unsuccessfull outcome message\n"); + free(res.buffer); + break; + + default: + AssertFatal(false, + "Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)pdu->choice.initiatingMessage->procedureCode); + return -1; + } + return 0; +} + +int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) +{ + asn_dec_rval_t dec_ret; + DevAssert(pdu != NULL); + DevAssert(buffer != NULL); + asn_codec_ctx_t st = {.max_stack_size = 100 * 1000}; // if we enable asn1c debug the stack size become large + dec_ret = aper_decode(&st, &asn_DEF_NRPPA_NRPPA_PDU, (void **)&pdu, buffer, length, 0, 0); + if (dec_ret.code != RC_OK) { + LOG_E(NRPPA, "Failed to decode pdu\n"); + return -1; + } + + switch (pdu->present) { + case NRPPA_NRPPA_PDU_PR_initiatingMessage: + return nrppa_gNB_decode_initiating_message(pdu); + + case NRPPA_NRPPA_PDU_PR_successfulOutcome: + return nrppa_gNB_decode_successful_outcome(pdu); + + case NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome: + return nrppa_gNB_decode_unsuccessful_outcome(pdu); + + default: + LOG_I(NRPPA, "Unknown presence (%d) or not implemented\n", (int)pdu->present); + break; + } + + return -1; +} diff --git a/openair3/NRPPA/nrppa_gNB_decoder.h b/openair3/NRPPA/nrppa_gNB_decoder.h new file mode 100644 index 0000000000..668208b8a5 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_decoder.h @@ -0,0 +1,30 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nrppa_common.h" + +#ifndef NRPPA_GNB_DECODER_H_ +#define NRPPA_GNB_DECODER_H_ + +int nrppa_gNB_decode_pdu(NRPPA_NRPPA_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) + __attribute__((warn_unused_result)); + +#endif /* NRPPA_GNB_DECODER_H_ */ diff --git a/openair3/NRPPA/nrppa_gNB_handlers.c b/openair3/NRPPA/nrppa_gNB_handlers.c new file mode 100644 index 0000000000..ce36e34d81 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_handlers.c @@ -0,0 +1,179 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "intertask_interface.h" +#include "nrppa_gNB_handlers.h" +#include "nrppa_gNB_decoder.h" +#include "nrppa_common.h" +#include "nrppa_gNB_location_information_transfer.h" + +char *nrppa_direction2String(int nrppa_dir) +{ + static char *nrppa_direction_String[] = { + "", /* Nothing */ + "Originating message", /* originating message */ + "Successfull outcome", /* successfull outcome */ + "UnSuccessfull outcome", /* successfull outcome */ + }; + return (nrppa_direction_String[nrppa_dir]); +} + +/* Handlers matrix. Only gNB related procedure present here */ +nrppa_message_decoded_callback nrppa_messages_callback[][3] = { + {0, 0, 0}, // NRPPA_ProcedureCode_id_errorIndication ((NRPPA_ProcedureCode_t)0) + {0, 0, 0}, // NRPPA_ProcedureCode_id_privateMessage ((NRPPA_ProcedureCode_t)1) + {0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementInitiation ((NRPPA_ProcedureCode_t)2) + {0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementFailureIndication ((NRPPA_ProcedureCode_t)3) + {0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementReport ((NRPPA_ProcedureCode_t)4) + {0, 0, 0}, // NRPPA_ProcedureCode_id_e_CIDMeasurementTermination ((NRPPA_ProcedureCode_t)5) + {0, 0, 0}, // NRPPA_ProcedureCode_id_oTDOAInformationExchange ((NRPPA_ProcedureCode_t)6) + {0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationControl ((NRPPA_ProcedureCode_t)7) + {0, 0, 0}, // NRPPA_ProcedureCode_id_assistanceInformationFeedback ((NRPPA_ProcedureCode_t)8) + {0, 0, 0}, // NRPPA_ProcedureCode_id_positioningInformationExchange ((NRPPA_ProcedureCode_t)9) + {0, 0, 0}, // NRPPA_ProcedureCode_id_positioningInformationUpdate ((NRPPA_ProcedureCode_t)10) + {0, 0, 0}, // NRPPA_ProcedureCode_id_Measurement ((NRPPA_ProcedureCode_t)11) + {0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementReport ((NRPPA_ProcedureCode_t)12) + {0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementUpdate ((NRPPA_ProcedureCode_t)13) + {0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementAbort ((NRPPA_ProcedureCode_t)14) + {0, 0, 0}, // NRPPA_ProcedureCode_id_MeasurementFailureIndication ((NRPPA_ProcedureCode_t)15) + {nrppa_gNB_handle_trp_information_request, 0, 0}, // NRPPA_ProcedureCode_id_tRPInformationExchange ((NRPPA_ProcedureCode_t)16) + {0, 0, 0}, // NRPPA_ProcedureCode_id_positioningActivation ((NRPPA_ProcedureCode_t)17) + {0, 0, 0}, // NRPPA_ProcedureCode_id_positioningDeactivation ((NRPPA_ProcedureCode_t)18) +}; + +// Processing DOWNLINK UE ASSOCIATED NRPPA TRANSPORT (9.2.9.1 of TS 38.413 Version 16.0.0) +int nrppa_handle_downlink_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_ue_associated_nrppa_t *msg) +{ + LOG_I(NRPPA, "Handling DOWNLINKUEASSOCIATEDNRPPA TRANSPORT\n"); + uint8_t *const data = msg->nrppa_pdu.buf; + const uint32_t data_length = msg->nrppa_pdu.len; + NRPPA_NRPPA_PDU_t pdu; + int ret; + DevAssert(data != NULL); + memset(&pdu, 0, sizeof(pdu)); + + if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) { + LOG_E(NRPPA, "Failed to decode PDU\n"); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + /* Checking procedure Code and direction of message*/ + if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback)) + || (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) { + LOG_E(NRPPA, + "Either procedureCode %ld or direction %d exceed expected\n", + pdu.choice.initiatingMessage->procedureCode, + pdu.present); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + + /* No handler present. + * This can mean not implemented or no procedure for gNB (wrong direction).*/ + if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + LOG_E(NRPPA, + "No handler for procedureCode %ld in %s\n", + pdu.choice.initiatingMessage->procedureCode, + nrppa_direction2String(pdu.present - 1)); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + + /* Calling the right handler*/ + nrppa_gnb_ue_info_t nrppa_msg_info; + nrppa_msg_info.instance = instance; + nrppa_msg_info.gNB_ue_ngap_id = msg->gNB_ue_ngap_id; + nrppa_msg_info.amf_ue_ngap_id = msg->amf_ue_ngap_id; + nrppa_msg_info.routing_id.buf = msg->routing_id.buf; + nrppa_msg_info.routing_id.len = msg->routing_id.len; + ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu); + + if (msg->routing_id.buf) { + free(msg->routing_id.buf); + } + + if (msg->nrppa_pdu.buf) { + free(msg->nrppa_pdu.buf); + } + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return ret; +} + +// Processing DOWNLINK NON UE ASSOCIATED NRPPA TRANSPORT (9.2.9.3 of TS 38.413 Version 16.0.0) +int nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_non_ue_associated_nrppa_t *msg) +{ + LOG_I(NRPPA, "Handling DOWNLINKNONUEASSOCIATEDNRPPA TRANSPORT\n"); + uint8_t *const data = msg->nrppa_pdu.buf; + const uint32_t data_length = msg->nrppa_pdu.len; + NRPPA_NRPPA_PDU_t pdu; + int ret; + DevAssert(data != NULL); + memset(&pdu, 0, sizeof(pdu)); + + if (nrppa_gNB_decode_pdu(&pdu, data, data_length) < 0) { + LOG_E(NRPPA, "Failed to decode Downlink Non UE Associated NRPPa PDU\n"); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + + /* Checking procedure Code and direction of message*/ + if (pdu.choice.initiatingMessage->procedureCode >= sizeof(nrppa_messages_callback) / (3 * sizeof(nrppa_message_decoded_callback)) + || (pdu.present > NRPPA_NRPPA_PDU_PR_unsuccessfulOutcome)) { + LOG_E(NRPPA, + "Either procedureCode %ld or direction %d exceed expected\n", + pdu.choice.initiatingMessage->procedureCode, + pdu.present); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + + /* No handler present. + * This can mean not implemented or no procedure for gNB (wrong direction).*/ + if (nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + LOG_E(NRPPA, + "No handler for procedureCode %ld in %s\n", + pdu.choice.initiatingMessage->procedureCode, + nrppa_direction2String(pdu.present - 1)); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return -1; + } + + /* Calling the right handler*/ + nrppa_gnb_ue_info_t nrppa_msg_info; + nrppa_msg_info.instance = instance; + nrppa_msg_info.gNB_ue_ngap_id = 0; // non-ue associated + nrppa_msg_info.amf_ue_ngap_id = 0; // non-ue associated + nrppa_msg_info.routing_id.buf = msg->routing_id.buf; + nrppa_msg_info.routing_id.len = msg->routing_id.len; + ret = (*nrppa_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])(&nrppa_msg_info, &pdu); + + if (msg->routing_id.buf) { + free(msg->routing_id.buf); + } + + if (msg->nrppa_pdu.buf) { + free(msg->nrppa_pdu.buf); + } + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return ret; +} diff --git a/openair3/NRPPA/nrppa_gNB_handlers.h b/openair3/NRPPA/nrppa_gNB_handlers.h new file mode 100644 index 0000000000..ecee41caa1 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_handlers.h @@ -0,0 +1,28 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NRPPA_GNB_HANDLERS_H_ +#define NRPPA_GNB_HANDLERS_H_ + +int nrppa_handle_downlink_ue_associated_nrppa_transport(instance_t instance, const ngap_downlink_ue_associated_nrppa_t *msg); +int nrppa_handle_downlink_non_ue_associated_nrppa_transport(instance_t instance, + const ngap_downlink_non_ue_associated_nrppa_t *msg); +#endif /* NRPPA_GNB_HANDLERS_H_ */ diff --git a/openair3/NRPPA/nrppa_gNB_location_information_transfer.c b/openair3/NRPPA/nrppa_gNB_location_information_transfer.c new file mode 100644 index 0000000000..6a617ea02b --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_location_information_transfer.c @@ -0,0 +1,95 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "intertask_interface.h" +#include "nrppa_common.h" +#include "nrppa_gNB_location_information_transfer.h" +#include "nrppa_gNB_ue_context.h" +#include "nrppa_messages_types.h" + +void free_trp_information_request(nrppa_trp_information_req_t *msg) +{ + if (msg->trp_information_type_list.trp_information_type_item) { + free(msg->trp_information_type_list.trp_information_type_item); + } +} + +int nrppa_gNB_handle_trp_information_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu) +{ + LOG_I(NRPPA, "Processing Received TRP Information Request \n"); + DevAssert(pdu != NULL); + DevAssert(nrppa_msg_info != NULL); + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NRPPA_NRPPA_PDU, pdu); + } + + // Forward request to RRC + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, NRPPA_TRP_INFORMATION_REQ); + nrppa_trp_information_req_t *req = &NRPPA_TRP_INFORMATION_REQ(msg); + + // Processing Received TRPInformationRequest + NRPPA_TRPInformationRequest_t *container = NULL; + NRPPA_TRPInformationRequest_IEs_t *ie = NULL; + + // IE 9.2.3 Message type : mandatory + container = &pdu->choice.initiatingMessage->value.choice.TRPInformationRequest; + + // IE 9.2.4 nrppatransactionID : mandatory + req->transaction_id = pdu->choice.initiatingMessage->nrppatransactionID; + + // IE TRP List : optional + NRPPA_FIND_PROTOCOLIE_BY_ID(NRPPA_TRPInformationRequest_IEs_t, ie, container, NRPPA_ProtocolIE_ID_id_TRPList, false); + + if (ie == NULL) { + req->has_trp_list = false; + } else { + LOG_W(NRPPA, "TRPInformationRequest IE TRP List : not handled\n"); + } + + // IE TRP Information Type List: mandatory + // not implemented in oai-lmf + NRPPA_FIND_PROTOCOLIE_BY_ID(NRPPA_TRPInformationRequest_IEs_t, + ie, + container, + NRPPA_ProtocolIE_ID_id_TRPInformationTypeList, + false); + + if (ie == NULL) { + LOG_W(NRPPA, "TRPInformationRequest IE TRP Information Type List is mandatory but not handled\n"); + } else { + uint8_t trp_info_list_len = ie->value.choice.TRPInformationTypeList.list.count; + AssertError(trp_info_list_len > 0, return false, "at least 1 TRP Information Type must be present"); + nrppa_trp_information_type_list_t *trp_info_list = &req->trp_information_type_list; + trp_info_list->trp_information_type_list_length = trp_info_list_len; + trp_info_list->trp_information_type_item = calloc_or_fail(trp_info_list_len, sizeof(*trp_info_list->trp_information_type_item)); + for (int i = 0; i < trp_info_list_len; i++) { + trp_info_list->trp_information_type_item[i] = *ie->value.choice.TRPInformationTypeList.list.array[i]; + } + } + + nrppa_store_ue_context(nrppa_msg_info, req->transaction_id); + + LOG_I(NRPPA, "Forwarding to RRC TRPInformationRequest transaction_id=%d\n", req->transaction_id); + itti_send_msg_to_task(TASK_RRC_GNB, 0, msg); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NRPPA_NRPPA_PDU, &pdu); + return 0; +} diff --git a/openair3/NRPPA/nrppa_gNB_location_information_transfer.h b/openair3/NRPPA/nrppa_gNB_location_information_transfer.h new file mode 100644 index 0000000000..5295505b22 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_location_information_transfer.h @@ -0,0 +1,28 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NRPPA_GNB_POSITIONING_PROCEDURES_H_ +#define NRPPA_GNB_POSITIONING_PROCEDURES_H_ + +int nrppa_gNB_handle_trp_information_request(nrppa_gnb_ue_info_t *nrppa_msg_info, const NRPPA_NRPPA_PDU_t *pdu); +void free_trp_information_request(nrppa_trp_information_req_t *msg); + +#endif /* NRPPA_GNB_POSITIONING_PROCEDURES_H_ */ diff --git a/openair3/NRPPA/nrppa_gNB_ue_context.c b/openair3/NRPPA/nrppa_gNB_ue_context.c new file mode 100644 index 0000000000..1a1a0e7c0e --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_ue_context.c @@ -0,0 +1,85 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nrppa_gNB_ue_context.h" +#include "tree.h" +#include "T.h" +#include "common/utils/T/T.h" +#include "common/utils/utils.h" +#include "common/utils/LOG/log.h" + +static RB_HEAD(nrppa_ue_map, nrppa_gNB_ue_context_s) nrppa_ue_head = RB_INITIALIZER(&nrppa_ue_head); + +/* Generate the tree management functions prototypes */ +RB_PROTOTYPE(nrppa_ue_map, nrppa_gNB_ue_context_s, entries, nrppa_gNB_compare_transaction_id); + +static int nrppa_gNB_compare_transaction_id(struct nrppa_gNB_ue_context_s *p1, struct nrppa_gNB_ue_context_s *p2) +{ + if (p1->transaction_id > p2->transaction_id) { + return 1; + } + + if (p1->transaction_id < p2->transaction_id) { + return -1; + } + + return 0; +} + +/* Generate the tree management functions */ +RB_GENERATE(nrppa_ue_map, nrppa_gNB_ue_context_s, entries, nrppa_gNB_compare_transaction_id); + +void nrppa_store_ue_context(const nrppa_gnb_ue_info_t *info, const uint16_t transaction_id) +{ + LOG_I(NRPPA, "Create NRPPa UE context (gNB UE ID %u) for transaction ID : %u\n", info->gNB_ue_ngap_id, transaction_id); + nrppa_gNB_ue_context_t *ue_info_p = calloc_or_fail(1, sizeof(*ue_info_p)); + ue_info_p->transaction_id = transaction_id; + ue_info_p->gNB_ue_ngap_id = info->gNB_ue_ngap_id; + ue_info_p->amf_ue_ngap_id = info->amf_ue_ngap_id; + if (info->routing_id.len > 0 && info->routing_id.buf != NULL) { + ue_info_p->routing_id.len = info->routing_id.len; + ue_info_p->routing_id.buf = calloc_or_fail(1, info->routing_id.len); + memcpy(ue_info_p->routing_id.buf, info->routing_id.buf, info->routing_id.len); + } else { + ue_info_p->routing_id.len = 0; + ue_info_p->routing_id.buf = NULL; + } + if (RB_INSERT(nrppa_ue_map, &nrppa_ue_head, ue_info_p)) + LOG_E(NRPPA, "Bug in UE uniq number allocation %u, we try to add a existing UE\n", ue_info_p->gNB_ue_ngap_id); + return; +} + +struct nrppa_gNB_ue_context_s *nrppa_get_ue_context(uint16_t transaction_id) +{ + nrppa_gNB_ue_context_t temp = {.transaction_id = transaction_id}; + return RB_FIND(nrppa_ue_map, &nrppa_ue_head, &temp); +} + +struct nrppa_gNB_ue_context_s *nrppa_detach_ue_context(uint16_t transaction_id) +{ + struct nrppa_gNB_ue_context_s *tmp = nrppa_get_ue_context(transaction_id); + if (tmp == NULL) { + LOG_E(NRPPA, "Trying to free a NULL UE context, %u\n", transaction_id); + return NULL; + } + RB_REMOVE(nrppa_ue_map, &nrppa_ue_head, tmp); + return tmp; +} diff --git a/openair3/NRPPA/nrppa_gNB_ue_context.h b/openair3/NRPPA/nrppa_gNB_ue_context.h new file mode 100644 index 0000000000..1aaeabe359 --- /dev/null +++ b/openair3/NRPPA/nrppa_gNB_ue_context.h @@ -0,0 +1,43 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include "tree.h" +#include "ds/byte_array.h" +#include "nrppa_common.h" + +#ifndef NRPPA_GNB_UE_CONTEXT_H_ +#define NRPPA_GNB_UE_CONTEXT_H_ + +typedef struct nrppa_gNB_ue_context_s { + /* Tree related data */ + RB_ENTRY(nrppa_gNB_ue_context_s) entries; + uint16_t transaction_id; + uint32_t gNB_ue_ngap_id; + uint64_t amf_ue_ngap_id; + byte_array_t routing_id; +} nrppa_gNB_ue_context_t; + +void nrppa_store_ue_context(const nrppa_gnb_ue_info_t *info, const uint16_t transaction_id); +nrppa_gNB_ue_context_t *nrppa_get_ue_context(uint16_t transaction_id); +nrppa_gNB_ue_context_t *nrppa_detach_ue_context(uint16_t transaction_id); + +#endif /* NRPPA_GNB_UE_CONTEXT_H_ */ diff --git a/openair3/NRPPA/nrppa_includes.h b/openair3/NRPPA/nrppa_includes.h new file mode 100644 index 0000000000..8239033926 --- /dev/null +++ b/openair3/NRPPA/nrppa_includes.h @@ -0,0 +1,39 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NRPPA_INCLUDE_H_ +#define NRPPA_INCLUDE_H_ + +#include "NRPPA_NRPPA-PDU.h" +#include "NRPPA_InitiatingMessage.h" +#include "NRPPA_SuccessfulOutcome.h" +#include "NRPPA_UnsuccessfulOutcome.h" +#include "NRPPA_ProtocolIE-ID.h" +#include "NRPPA_ProtocolIE-Field.h" +#include "NRPPA_ProtocolIE-Container.h" +#include "NRPPA_ProtocolExtensionField.h" +#include "NRPPA_ProtocolIE-ContainerList.h" +#include "NRPPA_ProtocolExtensionContainer.h" +#include "NRPPA_ProtocolIE-Single-Container.h" +#include "NRPPA_asn_constant.h" +#include "NRPPA_TRPInformationRequest.h" + +#endif /* NRPPA_INCLUDE_H_ */ diff --git a/tests/nr-cu-nrppa/CMakeLists.txt b/tests/nr-cu-nrppa/CMakeLists.txt index 1db9b33e37..f24ff4b880 100644 --- a/tests/nr-cu-nrppa/CMakeLists.txt +++ b/tests/nr-cu-nrppa/CMakeLists.txt @@ -5,6 +5,6 @@ add_executable(nr-cu-nrppa-test nr-cu-nrppa.c target_link_libraries(nr-cu-nrppa-test PRIVATE CONFIG_LIB ITTI SCTP_CLIENT f1ap ngap SECURITY - UTIL softmodem_common) + UTIL softmodem_common nrppa) target_link_libraries(nr-cu-nrppa-test PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_dependencies(nr-cu-nrppa-test params_libconfig) diff --git a/tests/nr-cu-nrppa/nr-cu-nrppa.c b/tests/nr-cu-nrppa/nr-cu-nrppa.c index 2c29ce6258..893ee63e8c 100644 --- a/tests/nr-cu-nrppa/nr-cu-nrppa.c +++ b/tests/nr-cu-nrppa/nr-cu-nrppa.c @@ -28,6 +28,7 @@ #include "openair2/GNB_APP/gnb_paramdef.h" #include "openair3/SCTP/sctp_default_values.h" #include "openair3/NRPPA/nrppa_gNB_config.h" +#include "openair3/NRPPA/nrppa_gNB.h" RAN_CONTEXT_t RC; THREAD_STRUCT thread_struct; @@ -83,6 +84,9 @@ int main(int argc, char **argv) rc = itti_create_task(TASK_NGAP, ngap_gNB_task, NULL); AssertFatal(rc >= 0, "Create task for NGAP failed\n"); + rc = itti_create_task(TASK_NRPPA, nrppa_gNB_task, NULL); + AssertFatal(rc >= 0, "Create task for NRPPA failed\n"); + MessageDef *msg_p; msg_p = itti_alloc_new_message(TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); RCconfig_NR_NG(msg_p, 0);