Move P5 general packing/unpacking function declaration into nr_fapi_p5 header.
Fix Assert condition to properly check that body was packed successfully Fix retval value when performing bitwise AND with push16 Remove commented code
This commit is contained in:
committed by
Robert Schmidt
parent
c679112f50
commit
8a185cff69
@@ -18,16 +18,6 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi.h
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OPENAIRINTERFACE_NR_FAPI_H
|
#ifndef OPENAIRINTERFACE_NR_FAPI_H
|
||||||
#define OPENAIRINTERFACE_NR_FAPI_H
|
#define OPENAIRINTERFACE_NR_FAPI_H
|
||||||
@@ -50,23 +40,10 @@ typedef struct {
|
|||||||
uint32_t message_length;
|
uint32_t message_length;
|
||||||
} fapi_message_header_t;
|
} fapi_message_header_t;
|
||||||
|
|
||||||
int fapi_nr_p5_message_header_unpack(uint8_t **pMessageBuf,
|
int fapi_nr_message_header_unpack(uint8_t **pMessageBuf,
|
||||||
uint32_t messageBufLen,
|
uint32_t messageBufLen,
|
||||||
void *pUnpackedBuf,
|
void *pUnpackedBuf,
|
||||||
uint32_t unpackedBufLen,
|
uint32_t unpackedBufLen,
|
||||||
nfapi_p4_p5_codec_config_t *config);
|
nfapi_p4_p5_codec_config_t *config);
|
||||||
|
|
||||||
int fapi_nr_p5_message_pack(void *pMessageBuf,
|
|
||||||
uint32_t messageBufLen,
|
|
||||||
void *pPackedBuf,
|
|
||||||
uint32_t packedBufLen,
|
|
||||||
nfapi_p4_p5_codec_config_t *config);
|
|
||||||
|
|
||||||
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
|
||||||
uint32_t messageBufLen,
|
|
||||||
void *pUnpackedBuf,
|
|
||||||
uint32_t unpackedBufLen,
|
|
||||||
nfapi_p4_p5_codec_config_t *config);
|
|
||||||
|
|
||||||
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen);
|
|
||||||
#endif // OPENAIRINTERFACE_NR_FAPI_H
|
#endif // OPENAIRINTERFACE_NR_FAPI_H
|
||||||
|
|||||||
@@ -18,22 +18,26 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_H
|
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_H
|
||||||
#define OPENAIRINTERFACE_NR_FAPI_P5_H
|
#define OPENAIRINTERFACE_NR_FAPI_P5_H
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "nfapi_interface.h"
|
#include "nfapi_interface.h"
|
||||||
|
|
||||||
|
int fapi_nr_p5_message_pack(void *pMessageBuf,
|
||||||
|
uint32_t messageBufLen,
|
||||||
|
void *pPackedBuf,
|
||||||
|
uint32_t packedBufLen,
|
||||||
|
nfapi_p4_p5_codec_config_t *config);
|
||||||
|
|
||||||
|
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||||
|
uint32_t messageBufLen,
|
||||||
|
void *pUnpackedBuf,
|
||||||
|
uint32_t unpackedBufLen,
|
||||||
|
nfapi_p4_p5_codec_config_t *config);
|
||||||
|
|
||||||
|
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen);
|
||||||
|
|
||||||
uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||||
uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config);
|
||||||
uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
|
||||||
|
|||||||
@@ -18,16 +18,6 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/open-nFAPI/fapi/inc/nr_fapi_p5_utils.h
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
#ifndef OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||||
#define OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
#define OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||||
|
|||||||
@@ -18,19 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nr_fapi.h"
|
#include "nr_fapi.h"
|
||||||
#include "nr_fapi_p5.h"
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
bool isFAPIMessageIDValid(uint16_t id)
|
bool isFAPIMessageIDValid(uint16_t id)
|
||||||
@@ -41,8 +30,8 @@ bool isFAPIMessageIDValid(uint16_t id)
|
|||||||
|| id == NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO;
|
|| id == NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fapi_nr_p5_message_header_unpack(uint8_t **pMessageBuf,
|
int fapi_nr_message_header_unpack(uint8_t **pMessageBuf,
|
||||||
uint32_t messageBufLen,
|
uint32_t messageBufLen,
|
||||||
void *pUnpackedBuf,
|
void *pUnpackedBuf,
|
||||||
uint32_t unpackedBufLen,
|
uint32_t unpackedBufLen,
|
||||||
nfapi_p4_p5_codec_config_t *config)
|
nfapi_p4_p5_codec_config_t *config)
|
||||||
@@ -74,7 +63,7 @@ uint8_t fapi_nr_p5_message_body_pack(nfapi_p4_p5_message_header_t *header,
|
|||||||
// look for the specific message
|
// look for the specific message
|
||||||
switch (header->message_id) {
|
switch (header->message_id) {
|
||||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||||
result = 0;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
||||||
@@ -110,7 +99,7 @@ uint8_t fapi_nr_p5_message_body_pack(nfapi_p4_p5_message_header_t *header,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
AssertFatal(header->message_id >= 0x00 && header->message_id <= 0xFF,
|
AssertFatal(header->message_id <= 0xFF,
|
||||||
"FAPI message IDs are defined between 0x00 and 0xFF the message provided 0x%02x, which is not a FAPI message",
|
"FAPI message IDs are defined between 0x00 and 0xFF the message provided 0x%02x, which is not a FAPI message",
|
||||||
header->message_id);
|
header->message_id);
|
||||||
break;
|
break;
|
||||||
@@ -122,7 +111,7 @@ uint8_t fapi_nr_p5_message_body_pack(nfapi_p4_p5_message_header_t *header,
|
|||||||
int fapi_nr_p5_message_pack(void *pMessageBuf,
|
int fapi_nr_p5_message_pack(void *pMessageBuf,
|
||||||
uint32_t messageBufLen,
|
uint32_t messageBufLen,
|
||||||
void *pPackedBuf,
|
void *pPackedBuf,
|
||||||
uint32_t packedBufLen,
|
const uint32_t packedBufLen,
|
||||||
nfapi_p4_p5_codec_config_t *config)
|
nfapi_p4_p5_codec_config_t *config)
|
||||||
{
|
{
|
||||||
nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
|
nfapi_p4_p5_message_header_t *pMessageHeader = pMessageBuf;
|
||||||
@@ -130,9 +119,6 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
|||||||
AssertFatal(isFAPIMessageIDValid(pMessageHeader->message_id),
|
AssertFatal(isFAPIMessageIDValid(pMessageHeader->message_id),
|
||||||
"FAPI message IDs are defined between 0x00 and 0xFF the message provided 0x%02x, which is not a FAPI message",
|
"FAPI message IDs are defined between 0x00 and 0xFF the message provided 0x%02x, which is not a FAPI message",
|
||||||
pMessageHeader->message_id);
|
pMessageHeader->message_id);
|
||||||
uint32_t packedMsgLen;
|
|
||||||
uint32_t packedBodyLen;
|
|
||||||
uint16_t packedMsgLen16;
|
|
||||||
AssertFatal(pMessageBuf != NULL && pPackedBuf != NULL, "P5 Pack supplied pointers are null");
|
AssertFatal(pMessageBuf != NULL && pPackedBuf != NULL, "P5 Pack supplied pointers are null");
|
||||||
|
|
||||||
uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
|
uint8_t *pPackMessageEnd = pPackedBuf + packedBufLen;
|
||||||
@@ -140,8 +126,8 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
|||||||
uint8_t *pPacketBodyField = &pWritePackedMessage[8];
|
uint8_t *pPacketBodyField = &pWritePackedMessage[8];
|
||||||
uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[8];
|
uint8_t *pPacketBodyFieldStart = &pWritePackedMessage[8];
|
||||||
|
|
||||||
uint8_t res = fapi_nr_p5_message_body_pack(pMessageHeader, &pPacketBodyField, pPackMessageEnd, config);
|
const uint8_t res = fapi_nr_p5_message_body_pack(pMessageHeader, &pPacketBodyField, pPackMessageEnd, config);
|
||||||
AssertFatal(res >= 0, "fapi_nr_p5_message_body_pack error packing message body %d\n", res);
|
AssertFatal(res > 0, "fapi_nr_p5_message_body_pack error packing message body %d\n", res);
|
||||||
|
|
||||||
// PHY API message header
|
// PHY API message header
|
||||||
push8(1, &pWritePackedMessage, pPackMessageEnd); // Number of messages
|
push8(1, &pWritePackedMessage, pPackMessageEnd); // Number of messages
|
||||||
@@ -151,9 +137,8 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
|||||||
push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd); // Message type ID
|
push16(pMessageHeader->message_id, &pWritePackedMessage, pPackMessageEnd); // Message type ID
|
||||||
|
|
||||||
// check for a valid message length
|
// check for a valid message length
|
||||||
packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pPacketBodyField);
|
const uint32_t packedMsgLen = get_packed_msg_len((uintptr_t)pPackedBuf, (uintptr_t)pPacketBodyField);
|
||||||
packedBodyLen = get_packed_msg_len((uintptr_t)pPacketBodyFieldStart, (uintptr_t)pPacketBodyField);
|
uint16_t packedMsgLen16 = get_packed_msg_len((uintptr_t)pPacketBodyFieldStart, (uintptr_t)pPacketBodyField);
|
||||||
packedMsgLen16 = (uint16_t)packedBodyLen;
|
|
||||||
if (pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST
|
if (pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST
|
||||||
|| pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_START_REQUEST
|
|| pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_START_REQUEST
|
||||||
|| pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST
|
|| pMessageHeader->message_id == NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST
|
||||||
@@ -171,13 +156,13 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// return the packed length
|
// return the packed length
|
||||||
return (int)(packedMsgLen);
|
return packedMsgLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||||
uint32_t messageBufLen,
|
const uint32_t messageBufLen,
|
||||||
void *pUnpackedBuf,
|
void *pUnpackedBuf,
|
||||||
uint32_t unpackedBufLen,
|
const uint32_t unpackedBufLen,
|
||||||
nfapi_p4_p5_codec_config_t *config)
|
nfapi_p4_p5_codec_config_t *config)
|
||||||
{
|
{
|
||||||
fapi_message_header_t *pMessageHeader = pUnpackedBuf;
|
fapi_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||||
@@ -191,7 +176,7 @@ int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
|||||||
unpackedBufLen);
|
unpackedBufLen);
|
||||||
// clean the supplied buffer for - tag value blanking
|
// clean the supplied buffer for - tag value blanking
|
||||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||||
if (fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, pMessageHeader, sizeof(fapi_message_header_t), 0)
|
if (fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, pMessageHeader, sizeof(fapi_message_header_t), 0)
|
||||||
< 0) {
|
< 0) {
|
||||||
// failed to read the header
|
// failed to read the header
|
||||||
return -1;
|
return -1;
|
||||||
@@ -370,12 +355,7 @@ uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
|
|||||||
&pack_uint16_tlv_value);
|
&pack_uint16_tlv_value);
|
||||||
|
|
||||||
for (int i = 0; i < pNfapiMsg->cell_param.num_config_tlvs_to_report.value; ++i) {
|
for (int i = 0; i < pNfapiMsg->cell_param.num_config_tlvs_to_report.value; ++i) {
|
||||||
/*retval &= pack_nr_tlv(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag,
|
retval &= push16(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, ppWritePackedMsg, end) != 0;
|
||||||
&(pNfapiMsg->cell_param.config_tlvs_to_report_list[i]),
|
|
||||||
ppWritePackedMsg,
|
|
||||||
end,
|
|
||||||
&pack_uint8_tlv_value);*/
|
|
||||||
retval &= push16(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, ppWritePackedMsg, end);
|
|
||||||
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length, ppWritePackedMsg, end);
|
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length, ppWritePackedMsg, end);
|
||||||
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].value, ppWritePackedMsg, end);
|
retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].value, ppWritePackedMsg, end);
|
||||||
// Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
|
// Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
|
||||||
@@ -1707,8 +1687,8 @@ uint8_t unpack_nr_stop_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void
|
|||||||
uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
||||||
{
|
{
|
||||||
nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg;
|
nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg;
|
||||||
uint8_t retval = push16(pNfapiMsg->sfn, ppWritePackedMsg, end);
|
uint8_t retval = push16(pNfapiMsg->sfn, ppWritePackedMsg, end) != 0;
|
||||||
retval &= push16(pNfapiMsg->slot, ppWritePackedMsg, end);
|
retval &= push16(pNfapiMsg->slot, ppWritePackedMsg, end) != 0;
|
||||||
retval &= push8(pNfapiMsg->message_id, ppWritePackedMsg, end);
|
retval &= push8(pNfapiMsg->message_id, ppWritePackedMsg, end);
|
||||||
retval &= push8(pNfapiMsg->error_code, ppWritePackedMsg, end);
|
retval &= push8(pNfapiMsg->error_code, ppWritePackedMsg, end);
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,6 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void copy_vendor_extension_value(nfapi_vendor_extension_tlv_t *dst, const nfapi_vendor_extension_tlv_t *src)
|
void copy_vendor_extension_value(nfapi_vendor_extension_tlv_t *dst, const nfapi_vendor_extension_tlv_t *src)
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include "nr_fapi_p5.h"
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi.h"
|
|
||||||
|
|
||||||
// Pack routines
|
// Pack routines
|
||||||
//TODO: Add pacl/unpack fns for uint32 and uint64
|
//TODO: Add pacl/unpack fns for uint32 and uint64
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifdef ENABLE_AERIAL
|
#ifdef ENABLE_AERIAL
|
||||||
#include "nfapi/oai_integration/aerial/fapi_nvIPC.h"
|
#include "nfapi/oai_integration/aerial/fapi_nvIPC.h"
|
||||||
#include "nfapi/oai_integration/aerial/fapi_vnf_p5.h"
|
#include "nfapi/oai_integration/aerial/fapi_vnf_p5.h"
|
||||||
#include "nr_fapi.h"
|
#include "nr_fapi_p5.h"
|
||||||
#endif
|
#endif
|
||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_config_request_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void fill_config_request_tlv(nfapi_nr_config_request_scf_t *nfapi_resp)
|
void fill_config_request_tlv(nfapi_nr_config_request_scf_t *nfapi_resp)
|
||||||
@@ -259,7 +250,7 @@ void test_pack_unpack(nfapi_nr_config_request_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,22 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_config_response_test.c
|
|
||||||
* \brief Defines a unitary test for the FAPI CONFIG.response message ( 0x03 )
|
|
||||||
* The test consists of filling a message with randomized data, filling each lists as well with random TLVs
|
|
||||||
* After the message is created, is is packed into a byte buffer
|
|
||||||
* After packing, the header is unpacked to mimic SCTP PEEK and the values unpacked checked against the original message
|
|
||||||
* After the header is checked, the whole message is unpacked.
|
|
||||||
* The test ends by checking all of the unpacked message contents against the original message
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void fill_config_response_tlv_list(nfapi_nr_generic_tlv_scf_t *list, uint8_t size)
|
void fill_config_response_tlv_list(nfapi_nr_generic_tlv_scf_t *list, uint8_t size)
|
||||||
@@ -106,7 +92,7 @@ void test_pack_unpack(nfapi_nr_config_response_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_error_indication_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_error_indication_scf_t *req)
|
void test_pack_unpack(nfapi_nr_error_indication_scf_t *req)
|
||||||
@@ -49,7 +40,7 @@ void test_pack_unpack(nfapi_nr_error_indication_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_param_request_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_param_request_scf_t *req)
|
void test_pack_unpack(nfapi_nr_param_request_scf_t *req)
|
||||||
@@ -50,7 +41,7 @@ void test_pack_unpack(nfapi_nr_param_request_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_param_response_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void fill_param_response_tlv(nfapi_nr_param_response_scf_t *nfapi_resp)
|
void fill_param_response_tlv(nfapi_nr_param_response_scf_t *nfapi_resp)
|
||||||
@@ -242,7 +233,7 @@ void test_pack_unpack(nfapi_nr_param_response_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_start_request_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_start_request_scf_t *req)
|
void test_pack_unpack(nfapi_nr_start_request_scf_t *req)
|
||||||
@@ -50,7 +41,7 @@ void test_pack_unpack(nfapi_nr_start_request_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_start_response_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_start_response_scf_t *req)
|
void test_pack_unpack(nfapi_nr_start_response_scf_t *req)
|
||||||
@@ -50,7 +41,7 @@ void test_pack_unpack(nfapi_nr_start_response_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_stop_indication_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_stop_indication_scf_t *req)
|
void test_pack_unpack(nfapi_nr_stop_indication_scf_t *req)
|
||||||
@@ -50,7 +41,7 @@ void test_pack_unpack(nfapi_nr_stop_indication_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,17 +18,8 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_stop_request_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
|
#include "nr_fapi_p5.h"
|
||||||
#include "nr_fapi_p5_utils.h"
|
#include "nr_fapi_p5_utils.h"
|
||||||
|
|
||||||
void test_pack_unpack(nfapi_nr_stop_request_scf_t *req)
|
void test_pack_unpack(nfapi_nr_stop_request_scf_t *req)
|
||||||
@@ -50,7 +41,7 @@ void test_pack_unpack(nfapi_nr_stop_request_scf_t *req)
|
|||||||
header_buffer[idx] = msg_buf[idx];
|
header_buffer[idx] = msg_buf[idx];
|
||||||
}
|
}
|
||||||
uint8_t *pReadPackedMessage = header_buffer;
|
uint8_t *pReadPackedMessage = header_buffer;
|
||||||
int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
int unpack_header_result = fapi_nr_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0);
|
||||||
DevAssert(unpack_header_result >= 0);
|
DevAssert(unpack_header_result >= 0);
|
||||||
DevAssert(header.message_id == req->header.message_id);
|
DevAssert(header.message_id == req->header.message_id);
|
||||||
DevAssert(header.message_length == req->header.message_length);
|
DevAssert(header.message_length == req->header.message_length);
|
||||||
|
|||||||
@@ -18,18 +18,7 @@
|
|||||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
/*! \file nfapi/tests/p5/nr_fapi_param_request_test.c
|
|
||||||
* \brief
|
|
||||||
* \author Ruben S. Silva
|
|
||||||
* \date 2024
|
|
||||||
* \version 0.1
|
|
||||||
* \company OpenAirInterface Software Alliance
|
|
||||||
* \email: contact@openairinterface.org, rsilva@allbesmart.pt
|
|
||||||
* \note
|
|
||||||
* \warning
|
|
||||||
*/
|
|
||||||
#include "nfapi/tests/nr_fapi_test.h"
|
#include "nfapi/tests/nr_fapi_test.h"
|
||||||
#include "nr_fapi_p5.h"
|
|
||||||
#include "nr_fapi.h"
|
#include "nr_fapi.h"
|
||||||
void printbits(uint64_t n, uint8_t numBytesToPrint)
|
void printbits(uint64_t n, uint8_t numBytesToPrint)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user