Files
openairinterface5g/nfapi/open-nFAPI/fapi/inc/nr_fapi.h
T
Rúben Soares Silva 3d34917626 Implementation of PNF using WLS as message transport
The common library exposes functions for the PNF to return the received blocks to the VNF for it to call WLS_Enqueue on them.
This is done in order to ensure the Blocks are returned after processing, also preventing the Dequeueing of blocks that are still being used, i.e. the internal value is not -1
All saved blocks are to be enqueued at the reception of a SLOT.indication by the VNF

Additionally, the definition of NFAPI_MAX_PACKED_MESSAGE_SIZE was moved to nfapi_interface.h and removed from the other headers, this is done to allow to set the maximum message size when using WLS by only changing the value in one place

Fixup fapi_nr_message_header_unpack call in nfapi_hex_parser
2025-07-11 10:01:26 +01:00

114 lines
4.6 KiB
C

/*
* 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 OPENAIRINTERFACE_NR_FAPI_H
#define OPENAIRINTERFACE_NR_FAPI_H
#include "stdint.h"
#include "string.h"
#include "nfapi_interface.h"
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include <arpa/inet.h>
#include <netinet/in.h>
#include "assertions.h"
#include "debug.h"
#define INDENTED_PRINTF(format, ...) printf("%*s" format, depth * 2, "", ##__VA_ARGS__)
#define INDENTED_GENERIC_PRINT(string, format, ...) INDENTED_PRINTF(string " = " format "\n", ##__VA_ARGS__)
#define INDENTED_TLV_PRINT(tlv_name, tlv) INDENTED_GENERIC_PRINT("(0x%04x) " tlv_name, "0x%02x", tlv.tl.tag, tlv.value)
#define INDENTED_TLV_FORMAT_PRINT(tlv_name, format, tlv) INDENTED_GENERIC_PRINT("(0x%04x) " tlv_name, format, tlv.tl.tag, tlv.value)
#define EQ_TLV(_tlv_a, _tlv_b) \
do { \
EQ(_tlv_a.tl.tag, _tlv_b.tl.tag); \
EQ(_tlv_a.value, _tlv_b.value); \
} while (0)
#define EQ(_a, _b) \
do { \
if ((_a) != (_b)) { \
return false; \
} \
} while (0)
#define COPY_TL(_dst_tl, _src_tl) \
do { \
_dst_tl.tag = _src_tl.tag; \
_dst_tl.length = _src_tl.length; \
} while (0)
#define COPY_TLV(_dst, _src) \
do { \
COPY_TL(_dst.tl, _src.tl); \
_dst.value = _src.value; \
} while (0)
typedef struct {
uint8_t num_msg;
uint8_t opaque_handle;
uint16_t message_id;
uint32_t message_length;
} fapi_message_header_t;
void copy_vendor_extension_value(nfapi_vendor_extension_tlv_t *dst, const nfapi_vendor_extension_tlv_t *src);
bool isFAPIMessageIDValid(uint16_t id);
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen);
/*! \brief Decodes a FAPI P5 message header
* \param pMessageBuf A pointer to an encoded P5 message header
* \param messageBufLen The size of the encoded P5 message header
* \param pUnpackedBuf A pointer to the fapi_message_header
* \param unpackedBufLen The size of fapi_message_header structure.
* \param config A pointer to the nfapi configuration structure
* \return true on success, false on failure.
*
* The function will decode a byte stream pointed to by pMessageBuf into a FAPI p5 header structure pointed to by pUnpackedBuf
*/
bool fapi_nr_message_header_unpack(void *pMessageBuf,
uint32_t messageBufLen,
void *pUnpackedBuf,
uint32_t unpackedBufLen,
nfapi_p4_p5_codec_config_t *config);
/*! \brief Decodes a FAPI P7 message header
* \param pMessageBuf A pointer to an encoded P5 message header
* \param messageBufLen The size of the encoded P5 message header
* \param pUnpackedBuf A pointer to the fapi_message_header
* \param unpackedBufLen The size of fapi_message_header structure.
* \param config A pointer to the nfapi configuration structure
* \return true on success, false on failure.
*
* This function is a dummy function that points to fapi_nr_message_header_unpack,
* since in FAPI there's no difference in the structure of the message headers for P5 and P7
*/
bool fapi_nr_p7_message_header_unpack(void *pMessageBuf,
uint32_t messageBufLen,
void *pUnpackedBuf,
uint32_t unpackedBufLen,
nfapi_p7_codec_config_t *config);
#endif // OPENAIRINTERFACE_NR_FAPI_H