Commit f278b008 authored by Guido Casati's avatar Guido Casati

Add encoding/decoding library for F1AP Setup Request (Interface Management)

parent 1a8ed864
......@@ -190,7 +190,7 @@ typedef struct served_cells_to_activate_s {
f1ap_plmn_t plmn;
// NR Global Cell Id
uint64_t nr_cellid;
/// NRPCI
/// NRPCI [int 0..1007]
uint16_t nrpci;
/// num SI messages per DU cell
uint8_t num_SI;
......
......@@ -34,6 +34,8 @@
#include "f1ap_encoder.h"
#include "f1ap_itti_messaging.h"
#include "f1ap_cu_interface_management.h"
#include "f1ap_default_values.h"
#include "lib/f1ap_interface_management.h"
int CU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
{
......
add_library(f1ap_lib OBJECT
f1ap_lib_common.c
f1ap_rrc_message_transfer.c
f1ap_interface_management.c
)
target_link_libraries(f1ap_lib PRIVATE asn1_f1ap)
target_include_directories(f1ap_lib PUBLIC
......
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
*/
#ifndef F1AP_INTERFACE_MANAGEMENT_H_
#define F1AP_INTERFACE_MANAGEMENT_H_
#include <stdbool.h>
#include "f1ap_messages_types.h"
struct F1AP_F1AP_PDU;
struct F1AP_F1AP_PDU *encode_f1ap_setup_request(const f1ap_setup_req_t *msg);
bool decode_f1ap_setup_request(const struct F1AP_F1AP_PDU *pdu, f1ap_setup_req_t *out);
f1ap_setup_req_t cp_f1ap_setup_request(const f1ap_setup_req_t *msg);
bool eq_f1ap_setup_request(const f1ap_setup_req_t *a, const f1ap_setup_req_t *b);
void free_f1ap_setup_request(const f1ap_setup_req_t *msg);
#endif /* F1AP_INTERFACE_MANAGEMENT_H_ */
......@@ -23,7 +23,7 @@
#include "f1ap_messages_types.h"
#include "OCTET_STRING.h"
#include "common/utils/utils.h"
#include "common/utils/assertions.h"
#include "common/utils/utils.h"
......@@ -35,6 +35,79 @@ bool eq_f1ap_plmn(const f1ap_plmn_t *a, const f1ap_plmn_t *b)
return true;
}
bool eq_f1ap_freq_info(const f1ap_nr_frequency_info_t *a, const f1ap_nr_frequency_info_t *b)
{
if (a->arfcn != b->arfcn)
return false;
if (a->band != b->band)
return false;
return true;
}
bool eq_f1ap_tx_bandwidth(const f1ap_transmission_bandwidth_t *a, const f1ap_transmission_bandwidth_t *b)
{
if (a->nrb != b->nrb)
return false;
if (a->scs != b->scs)
return false;
return true;
}
bool eq_f1ap_cell_info(const f1ap_served_cell_info_t *a, const f1ap_served_cell_info_t *b)
{
if (a->nr_cellid != b->nr_cellid)
return false;
if (a->nr_pci != b->nr_pci)
return false;
if (*a->tac != *b->tac)
return false;
if (a->mode != b->mode)
return false;
if (a->mode == F1AP_MODE_TDD) {
/* TDD */
if (!eq_f1ap_tx_bandwidth(&a->tdd.tbw, &b->tdd.tbw))
return false;
if (!eq_f1ap_freq_info(&a->tdd.freqinfo, &b->tdd.freqinfo))
return false;
} else if (a->mode == F1AP_MODE_FDD) {
/* FDD */
if (!eq_f1ap_tx_bandwidth(&a->fdd.dl_tbw, &b->fdd.dl_tbw))
return false;
if (!eq_f1ap_freq_info(&a->fdd.dl_freqinfo, &b->fdd.dl_freqinfo))
return false;
if (!eq_f1ap_tx_bandwidth(&a->fdd.ul_tbw, &b->fdd.ul_tbw))
return false;
if (!eq_f1ap_freq_info(&a->fdd.ul_freqinfo, &b->fdd.ul_freqinfo))
return false;
}
if (a->measurement_timing_config_len != b->measurement_timing_config_len)
return false;
if (*a->measurement_timing_config != *b->measurement_timing_config)
return false;
if (!eq_f1ap_plmn(&a->plmn, &b->plmn))
return false;
return true;
}
bool eq_f1ap_sys_info(const f1ap_gnb_du_system_info_t *a, const f1ap_gnb_du_system_info_t *b)
{
/* MIB */
if (a->mib_length != b->mib_length)
return false;
for (int i = 0; i < a->mib_length; i++) {
if (a->mib[i] != b->mib[i])
return false;
}
/* SIB1 */
if (a->sib1_length != b->sib1_length)
return false;
for (int i = 0; i < a->sib1_length; i++) {
if (a->sib1[i] != b->sib1[i])
return false;
}
return true;
}
uint8_t *cp_octet_string(const OCTET_STRING_t *os, int *len)
{
uint8_t *buf = calloc_or_fail(os->size, sizeof(*buf));
......
......@@ -25,6 +25,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "openair3/UTILS/conversions.h"
#ifdef ENABLE_TESTS
#define PRINT_ERROR(...) fprintf(stderr, ##__VA_ARGS__)
......@@ -69,6 +70,14 @@
struct f1ap_plmn_t;
bool eq_f1ap_plmn(const struct f1ap_plmn_t *a, const struct f1ap_plmn_t *b);
struct f1ap_served_cell_info_t;
bool eq_f1ap_cell_info(const struct f1ap_served_cell_info_t *a, const struct f1ap_served_cell_info_t *b);
struct f1ap_gnb_du_system_info_t;
bool eq_f1ap_sys_info(const struct f1ap_gnb_du_system_info_t *a, const struct f1ap_gnb_du_system_info_t *b);
struct f1ap_nr_frequency_info_t;
bool eq_f1ap_freq_info(const struct f1ap_nr_frequency_info_t *a, const struct f1ap_nr_frequency_info_t *b);
struct f1ap_transmission_bandwidth_t;
bool eq_f1ap_tx_bandwidth(const struct f1ap_transmission_bandwidth_t *a, const struct f1ap_transmission_bandwidth_t *b);
struct OCTET_STRING;
uint8_t *cp_octet_string(const struct OCTET_STRING *os, int *len);
......
......@@ -27,5 +27,15 @@
#include "F1AP_InitiatingMessage.h"
#include "F1AP_NRCellIdentity.h"
#include "F1AP_ProtocolIE-Field.h"
#include "F1AP_ServedPLMNs-Item.h"
#include "F1AP_ProtocolExtensionContainer.h"
#include "F1AP_ProtocolExtensionField.h"
#include "F1AP_ProtocolIE-Field.h"
#include "F1AP_SliceSupportItem.h"
#include "F1AP_NR-Mode-Info.h"
#include "F1AP_GNB-DU-System-Information.h"
#include "F1AP_FDD-Info.h"
#include "F1AP_TDD-Info.h"
#include "F1AP_FreqBandNrItem.h"
#endif /* F1AP_LIB_INCLUDES_H_ */
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