Commit 6ac9597f authored by root's avatar root

changes 5 -may3

parent 922f0702
......@@ -109,6 +109,7 @@ void wait_f1_setup_response(void);
int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update);
MessageDef *RCconfig_NR_CU_E1(const E1_t *entity);
ngran_node_t get_node_type(void);
xnap_net_config_t Read_IPconfig_Xn(void);
#ifdef E2_AGENT
#include "openair2/E2AP/e2_agent_arg.h"
......
......@@ -5,7 +5,8 @@ add_library(xnap
xnap_gNB_management_procedures.c
xnap_gNB_task.c
xnap_gNB_itti_messaging.c
xnap_gNB_handler.c)
xnap_gNB_handler.c
xnap_gNB_interface_management.c)
target_link_libraries(xnap
PUBLIC asn1_xnap
PRIVATE nr_rrc)
......
......@@ -19,30 +19,55 @@
* contact@openairinterface.org
*/
/*! \file xnap_common.c
* \brief xnap encoder,decoder dunctions for gNB
* \author Sreeshma Shiv <sreeshmau@iisc.ac.in>
* \date Dec 2023
* \version 1.0
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
#include "xnap_common.h"
#include "XNAP_XnAP-PDU.h"
ssize_t XNAP_generate_initiating_message(uint8_t **buffer,
uint32_t *length,
XNAP_ProcedureCode_t procedureCode,
XNAP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
int xnap_gNB_encode_pdu(XNAP_XnAP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
XNAP_XnAP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(XNAP_XnAP_PDU_t));
pdu.present = XNAP_XnAP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage->procedureCode = procedureCode;
pdu.choice.initiatingMessage->criticality = criticality;
ANY_fromType_aper((ANY_t *)&pdu.choice.initiatingMessage->value, td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_XNAP_XnAP_PDU, 0, &pdu, (void **)buffer)) < 0) {
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
xer_fprint(stdout, &asn_DEF_XNAP_XnAP_PDU, (void *)pdu);
encoded = aper_encode_to_new_buffer(&asn_DEF_XNAP_XnAP_PDU, 0, pdu, (void **)buffer);
if (encoded < 0) {
return -1;
}
*length = encoded;
*len = encoded;
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_XNAP_XnAP_PDU, pdu);
return encoded;
}
int xnap_gNB_decode_pdu(XNAP_XnAP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(buffer != NULL);
dec_ret = aper_decode(NULL, &asn_DEF_XNAP_XnAP_PDU, (void **)&pdu, buffer, length, 0, 0);
xer_fprint(stdout, &asn_DEF_XNAP_XnAP_PDU, pdu);
if (dec_ret.code != RC_OK) {
LOG_E(XNAP, "Failed to decode PDU\n");
return -1;
}
return 0;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
/* 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
* 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
*
* Author and copyright: Laurent Thomas, open-cells.com
*
* 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.
......@@ -23,22 +20,26 @@
#ifndef XNAP_COMMON_H_
#define XNAP_COMMON_H_
#include "XNAP_XnAP-PDU.h"
#include "intertask_interface.h"
#include "common/openairinterface5g_limits.h"
#include "oai_asn1.h"
#include "XNAP_ProtocolIE-Field.h"
#include "XNAP_InitiatingMessage.h"
#include "XNAP_ProtocolIE-ContainerPair.h"
#include "XNAP_ProtocolExtensionField.h"
#include "XNAP_ProtocolExtensionContainer.h"
#include "XNAP_ProtocolExtensionField.h"
#include "XNAP_ProtocolIE-ContainerPair.h"
#include "XNAP_ProtocolIE-Field.h"
#include "XNAP_ProtocolIE-FieldPair.h"
#include "XNAP_SuccessfulOutcome.h"
#include "XNAP_UnsuccessfulOutcome.h"
#include "XNAP_XnAP-PDU.h"
#include "XNAP_asn_constant.h"
#include "common/openairinterface5g_limits.h"
#include "intertask_interface.h"
#include "oai_asn1.h"
#ifndef XNAP_PORT
#define XNAP_PORT 38422
#define XNAP_PORT 38423
#endif
extern int asn1_xer_print;
#define XNAP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do { \
IE_TYPE **ptr; \
......@@ -54,11 +55,7 @@
DevAssert(ie != NULL); \
} while (0)
ssize_t xnap_generate_initiating_message(uint8_t **buffer,
uint32_t *length,
XNAP_ProcedureCode_t procedureCode,
XNAP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
typedef int (*xnap_message_decoded_callback)(instance_t instance, sctp_assoc_t assocId, uint32_t stream, XNAP_XnAP_PDU_t *pdu);
int xnap_gNB_decode_pdu(XNAP_XnAP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) __attribute__((warn_unused_result));
int xnap_gNB_encode_pdu(XNAP_XnAP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) __attribute__((warn_unused_result));
#endif /* XNAP_COMMON_H_ */
This diff is collapsed.
/*
* 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
*/
/*! \file xnap_gNB_interface_management.h
* \brief xnap interface handler procedures for gNB
* \date 2023 Dec
* \version 1.0
*/
#ifndef XNAP_GNB_INTERFACE_MANAGEMENT_H_
#define XNAP_GNB_INTERFACE_MANAGEMENT_H_
/*Xn Setup*/
int xnap_gNB_handle_xn_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, XNAP_XnAP_PDU_t *pdu);
int xnap_gNB_handle_xn_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, XNAP_XnAP_PDU_t *pdu);
int xnap_gNB_handle_xn_setup_failure(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, XNAP_XnAP_PDU_t *pdu);
#endif /* XNAP_GNB_INTERFACE_MANAGEMENT_H_ */
......@@ -210,7 +210,7 @@ void *xnap_task(void *arg)
LOG_D(XNAP, "Starting XNAP layer\n");
itti_mark_task_ready(TASK_XNAP);
const int instance = 0;
xnap_net_config_t xn_net_config = Read_IPconfig_Xn();
xnap_net_config_t *xn_net_config = Read_IPconfig_Xn();
createXninst(instance, NULL, xn_net_config);
while (1) {
......@@ -223,6 +223,7 @@ void *xnap_task(void *arg)
break;
case XNAP_REGISTER_GNB_REQ: {
xnap_net_config_t *xn_nc = &XNAP_REGISTER_GNB_REQ(received_msg).net_config;
xnap_gNB_init_sctp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), xn_nc);
} break;
......
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