Commit e8bb0157 authored by Rúben Soares da Silva's avatar Rúben Soares da Silva Committed by Rúben Soares Silva

aerial_lib: include header instead of source file

Expose needed (n)FAPI procedures to aerial_lib ( both P5 and P7 ) via a
header file.
Move (n)FAPI P7 packing/unpacking function interface into separate header file
Include needed headers in aerial_lib
parent 4384ea2b
......@@ -32,7 +32,6 @@
#ifdef ENABLE_AERIAL
#include "fapi_vnf_p5.h"
#include "fapi_vnf_p7.h"
#include "nfapi/open-nFAPI/nfapi/src/nfapi_p5.c"
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
extern RAN_CONTEXT_t RC;
......
......@@ -31,7 +31,7 @@
*/
#ifdef ENABLE_AERIAL
#include "fapi_vnf_p7.h"
#include "nfapi/open-nFAPI/nfapi/src/nfapi_p7.c"
#include "nr_nfapi_p7.h"
extern RAN_CONTEXT_t RC;
extern UL_RCC_IND_t UL_RCC_INFO;
......
......@@ -45,6 +45,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi_vnf_interface.h"
#include "nfapi_vnf.h"
......
......@@ -3981,6 +3981,20 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
/*! \brief Packs a NFAPI P5 message body
* \param header A pointer to the header of the P5 message
* \param ppWritePackedMsg A pointer to the buffer where to pack the P5 message
* \param end Pointer to the end of the packing buffer
* \param config A pointer to the nfapi configuration structure
* \return 0 means success, -1 means failure.
*
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
*/
uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t* header,
uint8_t** ppWritePackedMsg,
uint8_t* end,
nfapi_p4_p5_codec_config_t* config);
/*! \brief Decodes an NFAPI P5 message header
* \param pMessageBuf A pointer to an encoded P5 message header
* \param messageBufLen The size of the encoded P5 message header
......@@ -4107,4 +4121,8 @@ int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t
*/
int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
uint8_t unpack_nr_param_response(uint8_t** ppReadPackedMsg, uint8_t* end, void* msg, nfapi_p4_p5_codec_config_t* config);
uint8_t unpack_nr_config_response(uint8_t** ppReadPackedMsg, uint8_t* end, void* msg, nfapi_p4_p5_codec_config_t* config);
#endif /* _NFAPI_INTERFACE_H_ */
/*
* 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 nfapi/open-nFAPI/nfapi/public_inc/nr_nfapi_p7.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_NFAPI_P7_H
#define OPENAIRINTERFACE_NR_NFAPI_P7_H
#include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h"
uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_slot_indication_scf_t *msg,
nfapi_p7_codec_config_t *config);
void *nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t *config);
uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_srs_indication_t *pNfapiMsg,
nfapi_p7_codec_config_t *config);
uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_crc_indication_t *msg,
nfapi_p7_codec_config_t *config);
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config);
uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_rach_indication_t *msg,
nfapi_p7_codec_config_t *config);
#endif // OPENAIRINTERFACE_NR_NFAPI_P7_H
......@@ -1908,7 +1908,11 @@ static uint8_t pack_measurement_response(void *msg, uint8_t **ppWritePackedMsg,
pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header,
uint8_t **ppWritePackedMsg,
uint8_t *end,
nfapi_p4_p5_codec_config_t *config)
{
uint8_t result = 0;
// look for the specific message
......@@ -1978,9 +1982,8 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin
break;
default: {
if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
if(config && config->pack_p4_p5_vendor_extension) {
if (header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && header->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
if (config && config->pack_p4_p5_vendor_extension) {
result = (config->pack_p4_p5_vendor_extension)(header, ppWritePackedMsg, end, config);
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, header->message_id);
......@@ -1988,8 +1991,7 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, header->message_id);
}
}
break;
} break;
}
return result;
......@@ -2568,7 +2570,7 @@ static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, vo
&pNfapiMsg->vendor_extension));
}
static uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg;
unpack_tlv_t unpack_fns[] = {
......@@ -3215,7 +3217,7 @@ static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, v
unpack_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)));
}
static uint8_t unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
uint8_t unpack_nr_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config)
{
nfapi_nr_config_response_scf_t *pNfapiMsg = (nfapi_nr_config_response_scf_t *)msg;
uint8_t invalid_unsupported_TLVs, invalidTLVsIdle, InvalidTLVsRunning, missingTLVS;
......
......@@ -38,6 +38,7 @@
#include <nfapi.h>
#include <debug.h>
#include "nfapi_nr_interface_scf.h"
#include "nr_nfapi_p7.h"
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMsg, void *user_data);
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, void *user_data);
......@@ -829,7 +830,7 @@ static uint8_t pack_dl_config_request_body_value(void *tlv, uint8_t **ppWritePac
return 1;
}
static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t *)msg;
......@@ -1658,7 +1659,7 @@ static uint8_t pack_ul_config_request_body_value(void *tlv, uint8_t **ppWritePac
return 1;
}
static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t *)msg;
pNfapiMsg->n_ulcch = 0;
......@@ -1987,25 +1988,22 @@ static uint8_t pack_ul_dci_pdu_list_value(void *tlv, uint8_t **ppWritePackedMsg,
return push16(value->PDUSize, &pPackedLengthField, end);
}
static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t *)msg;
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
))
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && push16(pNfapiMsg->Slot, ppWritePackedMsg, end)
&& push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)))
return 0;
for(int i=0; i<pNfapiMsg->numPdus; i++) {
if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
for (int i = 0; i < pNfapiMsg->numPdus; i++) {
if (!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
return 0;
}
return 1;
}
static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t *)msg;
return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
......@@ -2152,10 +2150,15 @@ static uint8_t pack_release_request_body_value(void *tlv, uint8_t **ppWritePacke
return 1;
}
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t *)msg;
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG,
&pNfapiMsg->ue_release_request_body,
ppWritePackedMsg,
end,
&pack_release_request_body_value);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && y && z;
}
......@@ -2172,7 +2175,8 @@ static uint8_t pack_nr_ue_release_request(void *msg, uint8_t **ppWritePackedMsg,
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
}
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t *)msg;
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
......@@ -3080,11 +3084,11 @@ static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t *)msg;
return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end)
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
......@@ -3094,12 +3098,12 @@ static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t *)msg;
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && push32(pNfapiMsg->t2, ppWritePackedMsg, end)
&& push32(pNfapiMsg->t3, ppWritePackedMsg, end)
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
......@@ -3129,40 +3133,37 @@ static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t *)msg;
return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && push32(pNfapiMsg->last_slot, ppWritePackedMsg, end)
&& push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end)
&& push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end)
&& push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end)
&& push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end)
&& pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end)
&& pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
}
//NR UPLINK indication function packing
//SLOT INDICATION
static uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t *)msg;
if (!(push16((uint16_t)pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16((uint16_t)pNfapiMsg->slot , ppWritePackedMsg, end)
))
if (!(push16((uint16_t)pNfapiMsg->sfn, ppWritePackedMsg, end) && push16((uint16_t)pNfapiMsg->slot, ppWritePackedMsg, end)))
return 0;
return 1;
return 1;
}
//RX DATA INDICATION
......@@ -3186,20 +3187,16 @@ static uint8_t pack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t *value, ui
return 1;
}
static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t *)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
&& push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)))
return 0;
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
{
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
if (!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
return 0;
}
......@@ -3231,19 +3228,16 @@ static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppWr
return 1;
}
static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
))
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
&& push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)))
return 0;
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
{
if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
for (int i = 0; i < pNfapiMsg->number_crcs; i++) {
if (!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
return 0;
}
......@@ -3359,19 +3353,17 @@ static uint8_t pack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t *value,
return 1;
}
static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) {
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t *)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push16(pNfapiMsg->control_length , ppWritePackedMsg, end) &&
push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end))) {
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
&& push16(pNfapiMsg->control_length, ppWritePackedMsg, end) && push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end))) {
return 0;
}
for(int i=0; i<pNfapiMsg->number_of_pdus;i++) {
if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg, end)) {
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
if (!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end)) {
return 0;
}
}
......@@ -3405,26 +3397,22 @@ static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMs
return 1;
}
static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t *)msg;
if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
))
if (!(push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end)
&& push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
if (!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
return 0;
}
return 1;
return 1;
}
//UCI INDICATION
static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
......@@ -3630,28 +3618,25 @@ static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWr
return 1;
}
static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
if (!push16(pNfapiMsg->sfn , ppWritePackedMsg, end))
if (!push16(pNfapiMsg->sfn, ppWritePackedMsg, end))
return 0;
if (!push16(pNfapiMsg->slot , ppWritePackedMsg, end))
if (!push16(pNfapiMsg->slot, ppWritePackedMsg, end))
return 0;
if (!push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end))
return 0;
for (int i = 0; i < pNfapiMsg->num_ucis; i++)
{
for (int i = 0; i < pNfapiMsg->num_ucis; i++) {
if (!pack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppWritePackedMsg, end))
return 0;
}
return 1;
}
// Main pack function - public
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config)
......@@ -6055,16 +6040,17 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
//SLOT INDICATION
static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_slot_indication_scf_t *msg, nfapi_p7_codec_config_t* config)
uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_slot_indication_scf_t *msg,
nfapi_p7_codec_config_t *config)
{
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t *)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end)
))
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)))
return 0;
return 1;
return 1;
}
//RX DATA INDICATION
......@@ -6115,7 +6101,7 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *
//NR CRC INDICATION
static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppReadPackedMsg, uint8_t *end)
uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **ppReadPackedMsg, uint8_t *end)
{
if (!(pull32(ppReadPackedMsg, &value->handle, end) && pull16(ppReadPackedMsg, &value->rnti, end)
&& pull8(ppReadPackedMsg, &value->harq_id, end) && pull8(ppReadPackedMsg, &value->tb_crc_status, end)
......@@ -6141,24 +6127,23 @@ static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t *value, uint8_t **pp
return 1;
}
static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_crc_indication_t *msg, nfapi_p7_codec_config_t* config)
uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_crc_indication_t *msg,
nfapi_p7_codec_config_t *config)
{
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
))
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)
&& pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)))
return 0;
if (pNfapiMsg->number_crcs > 0)
{
if (pNfapiMsg->number_crcs > 0) {
pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config);
}
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
{
if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
for (int i = 0; i < pNfapiMsg->number_crcs; i++) {
if (!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
return 0;
}
......@@ -6270,16 +6255,17 @@ static uint8_t unpack_nr_srs_indication_body(nfapi_nr_srs_indication_pdu_t *valu
return 1;
}
static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_srs_indication_t *pNfapiMsg, nfapi_p7_codec_config_t* config) {
if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn, end) &&
pull16(ppReadPackedMsg,&pNfapiMsg->slot, end) &&
pull16(ppReadPackedMsg,&pNfapiMsg->control_length, end) &&
pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end))) {
uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_srs_indication_t *pNfapiMsg,
nfapi_p7_codec_config_t *config)
{
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end)
&& pull16(ppReadPackedMsg, &pNfapiMsg->control_length, end) && pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end))) {
return 0;
}
for(int i=0; i<pNfapiMsg->number_of_pdus; i++) {
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) {
if (!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end)) {
return 0;
}
......@@ -6312,7 +6298,7 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t *v
return 1;
}
static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_nr_rach_indication_t *msg,
nfapi_p7_codec_config_t *config)
......@@ -6603,7 +6589,7 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
return 1;
}
static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
{
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
......
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