|
|
|
@@ -37,6 +37,7 @@
|
|
|
|
|
#include <nfapi.h>
|
|
|
|
|
#include <debug.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);
|
|
|
|
|
|
|
|
|
@@ -81,19 +82,19 @@ void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
|
|
|
|
|
if(size == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
void* buffer_p = NULL;
|
|
|
|
|
void* buffer_p = NULL;
|
|
|
|
|
if(config && config->allocate)
|
|
|
|
|
{
|
|
|
|
|
buffer_p = (config->allocate)(size);
|
|
|
|
|
if(buffer_p != NULL){
|
|
|
|
|
memset(buffer_p,0,size);
|
|
|
|
|
}
|
|
|
|
|
return buffer_p;
|
|
|
|
|
buffer_p = (config->allocate)(size);
|
|
|
|
|
if(buffer_p != NULL){
|
|
|
|
|
memset(buffer_p,0,size);
|
|
|
|
|
}
|
|
|
|
|
return buffer_p;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
buffer_p = calloc(1, size);
|
|
|
|
|
return buffer_p;
|
|
|
|
|
buffer_p = calloc(1, size);
|
|
|
|
|
return buffer_p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1551,7 +1552,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
|
|
|
|
|
// DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
|
|
|
|
|
int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
|
|
|
|
|
|
|
|
|
|
if (pdu->segments[j].segment_length == 3)
|
|
|
|
|
if (pdu->segments[j].segment_length == 3)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
|
|
|
|
|
pdu->segments[j].segment_data[0],
|
|
|
|
@@ -1583,43 +1584,43 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
|
|
|
|
|
|
|
|
|
|
return x && y && z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
|
|
|
|
{
|
|
|
|
|
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
|
|
|
|
|
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t j;
|
|
|
|
|
uint16_t num = value->number_of_TLVs;
|
|
|
|
|
for(j = 0; j < num; ++j){
|
|
|
|
|
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static 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 z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
|
|
|
|
return x && y && z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static 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);
|
|
|
|
|
return x && z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
|
|
|
|
{
|
|
|
|
|
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
|
|
|
|
|
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t j;
|
|
|
|
|
uint16_t num = value->number_of_TLVs;
|
|
|
|
|
for(j = 0; j < num; ++j){
|
|
|
|
|
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static 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 z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
|
|
|
|
return x && y && z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static 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);
|
|
|
|
|
return x && z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
|
|
|
|
{
|
|
|
|
|
nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
|
|
|
|
@@ -2707,15 +2708,15 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
|
|
|
|
|
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
|
|
|
|
|
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_HARQ_INDICATION:
|
|
|
|
|
result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
|
|
|
|
|
break;
|
|
|
|
@@ -4479,43 +4480,45 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
|
|
|
|
|
for(i = 0; i < totalNumPdus; ++i)
|
|
|
|
|
{
|
|
|
|
|
nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
|
|
|
|
|
if (pdu) {
|
|
|
|
|
uint16_t length = 0;
|
|
|
|
|
uint16_t index = 0;
|
|
|
|
|
if (pdu) {
|
|
|
|
|
uint16_t length = 0;
|
|
|
|
|
uint16_t index = 0;
|
|
|
|
|
|
|
|
|
|
if(!(pull16(ppReadPackedMsg, &length, end) &&
|
|
|
|
|
if(!(pull16(ppReadPackedMsg, &length, end) &&
|
|
|
|
|
pull16(ppReadPackedMsg, &index, end)))
|
|
|
|
|
return 0;
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
pdu->pdu_length = length;
|
|
|
|
|
pdu->pdu_index = index;
|
|
|
|
|
pdu->pdu_length = length;
|
|
|
|
|
pdu->pdu_index = index;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO : May need to rethink this bit
|
|
|
|
|
pdu->num_segments = 1;
|
|
|
|
|
pdu->segments[0].segment_length = pdu->pdu_length;
|
|
|
|
|
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
|
|
|
|
|
pdu->num_segments = 1;
|
|
|
|
|
pdu->segments[0].segment_length = pdu->pdu_length;
|
|
|
|
|
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
|
|
|
|
|
|
|
|
|
|
if(pdu->segments[0].segment_data)
|
|
|
|
|
{
|
|
|
|
|
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
|
|
|
|
|
if(pdu->segments[0].segment_data)
|
|
|
|
|
{
|
|
|
|
|
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
|
|
|
|
|
return 0;
|
|
|
|
|
if (pdu->segments[0].segment_length == 3)
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
|
|
|
|
if (pdu->segments[0].segment_length == 3)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
|
|
|
|
|
pdu->segments[0].segment_data[0],
|
|
|
|
|
pdu->segments[0].segment_data[1],
|
|
|
|
|
pdu->segments[0].segment_data[2]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@@ -4529,55 +4532,55 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
|
|
|
|
{
|
|
|
|
|
uint8_t proceed = 1;
|
|
|
|
|
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
|
|
|
|
|
|
|
|
|
|
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
|
|
|
|
|
{
|
|
|
|
|
nfapi_tl_t generic_tl;
|
|
|
|
|
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
switch(generic_tl.tag)
|
|
|
|
|
{
|
|
|
|
|
case NFAPI_UE_RELEASE_BODY_TAG:
|
|
|
|
|
{
|
|
|
|
|
pNfapiMsg->ue_release_request_body.tl = generic_tl;
|
|
|
|
|
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
uint8_t j;
|
|
|
|
|
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
|
|
|
|
|
for(j = 0; j < num; ++j){
|
|
|
|
|
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
|
|
|
|
{
|
|
|
|
|
uint8_t proceed = 1;
|
|
|
|
|
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
|
|
|
|
|
|
|
|
|
|
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
|
|
|
|
|
{
|
|
|
|
|
nfapi_tl_t generic_tl;
|
|
|
|
|
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
switch(generic_tl.tag)
|
|
|
|
|
{
|
|
|
|
|
case NFAPI_UE_RELEASE_BODY_TAG:
|
|
|
|
|
{
|
|
|
|
|
pNfapiMsg->ue_release_request_body.tl = generic_tl;
|
|
|
|
|
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
uint8_t j;
|
|
|
|
|
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
|
|
|
|
|
for(j = 0; j < num; ++j){
|
|
|
|
|
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
|
|
|
|
{
|
|
|
|
|
nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
|
|
|
|
@@ -4929,35 +4932,35 @@ static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPacked
|
|
|
|
|
return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
|
|
|
|
static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
|
|
|
|
{
|
|
|
|
|
nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
|
|
|
|
|
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv;
|
|
|
|
|
|
|
|
|
|
// the rxBodyEnd points to the end of the cqi PDU's
|
|
|
|
|
uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
|
|
|
|
uint8_t* rxPduEnd = rxBodyEnd;
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
|
|
|
|
|
value->tl.length);
|
|
|
|
|
uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
|
|
|
|
|
|
|
|
|
uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
|
|
|
|
|
|
|
|
|
|
if(rxBodyEnd > end)
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
|
|
|
|
|
rxBodyEnd, end);
|
|
|
|
|
if (rxBodyEnd > end)
|
|
|
|
|
{
|
|
|
|
|
// pdu end is past buffer end
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
|
|
|
|
if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
|
|
|
|
|
if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
|
|
|
|
|
return 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(value->number_of_pdus > 0)
|
|
|
|
|
if (value->number_of_pdus > 0)
|
|
|
|
|
{
|
|
|
|
|
value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
|
|
|
|
|
if(value->rx_pdu_list == NULL)
|
|
|
|
|
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
|
|
|
|
|
if (value->rx_pdu_list == NULL)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
|
|
|
|
|
return 0;
|
|
|
|
@@ -4967,87 +4970,97 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked
|
|
|
|
|
{
|
|
|
|
|
value->rx_pdu_list = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t i = 0;
|
|
|
|
|
nfapi_rx_indication_pdu_t* pdu = 0;
|
|
|
|
|
while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
|
|
|
|
|
{
|
|
|
|
|
nfapi_tl_t generic_tl;
|
|
|
|
|
if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
switch(generic_tl.tag)
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
|
|
|
|
|
for (int i = 0; i < value->number_of_pdus; i++)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s i = %u\n", __FUNCTION__, i);
|
|
|
|
|
nfapi_tl_t generic_tl;
|
|
|
|
|
|
|
|
|
|
// NFAPI_RX_UE_INFORMATION_TAG
|
|
|
|
|
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
case NFAPI_RX_UE_INFORMATION_TAG:
|
|
|
|
|
{
|
|
|
|
|
pdu = &(value->rx_pdu_list[i++]);
|
|
|
|
|
pdu->rx_ue_information.tl = generic_tl;
|
|
|
|
|
if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NFAPI_RX_INDICATION_REL8_TAG:
|
|
|
|
|
{
|
|
|
|
|
if(pdu != 0)
|
|
|
|
|
{
|
|
|
|
|
pdu->rx_indication_rel8.tl = generic_tl;
|
|
|
|
|
if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if(pdu->rx_indication_rel8.offset > 0)
|
|
|
|
|
{
|
|
|
|
|
// Need to check that the data is within the tlv
|
|
|
|
|
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
|
|
|
|
|
{
|
|
|
|
|
// If this the first pdu set the rxPduEnd
|
|
|
|
|
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
|
|
|
|
|
{
|
|
|
|
|
rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
|
|
|
|
|
|
|
|
|
|
if(rxPduEnd > end)
|
|
|
|
|
{
|
|
|
|
|
// pdu end is past buffer end
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NFAPI_RX_INDICATION_REL9_TAG:
|
|
|
|
|
{
|
|
|
|
|
if(pdu != 0)
|
|
|
|
|
{
|
|
|
|
|
pdu->rx_indication_rel9.tl = generic_tl;
|
|
|
|
|
if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
|
|
|
|
|
|
|
|
|
if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
|
|
|
|
|
|
|
|
|
pdu->rx_ue_information.tl = generic_tl;
|
|
|
|
|
if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NFAPI_RX_INDICATION_REL8_TAG
|
|
|
|
|
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
|
|
|
|
|
|
|
|
|
if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
pdu->rx_indication_rel8.tl = generic_tl;
|
|
|
|
|
if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
//What is offset not stripping 10 bytes
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
|
|
|
|
|
pdu->rx_indication_rel8.offset);
|
|
|
|
|
|
|
|
|
|
// NFAPI_RX_INDICATION_REL9_TAG
|
|
|
|
|
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
|
|
|
|
|
|
|
|
|
if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
pdu->rx_indication_rel9.tl = generic_tl;
|
|
|
|
|
if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t idx = 0;
|
|
|
|
|
for(idx = 0; idx < value->number_of_pdus; ++idx)
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < value->number_of_pdus; ++i)
|
|
|
|
|
{
|
|
|
|
|
if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
|
|
|
|
|
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
|
|
|
|
if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
|
|
|
|
|
{
|
|
|
|
|
uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
|
|
|
|
|
value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
|
|
|
|
|
if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
|
|
|
|
|
uint32_t length = pdu->rx_indication_rel8.length;
|
|
|
|
|
value->rx_pdu_list[i].data = nfapi_p7_allocate(length, config);
|
|
|
|
|
|
|
|
|
|
if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0)
|
|
|
|
|
{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -5825,18 +5838,18 @@ static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPa
|
|
|
|
|
pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
|
|
|
|
{
|
|
|
|
|
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
|
|
|
|
|
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
|
|
|
|
{
|
|
|
|
|
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
|
|
|
|
|
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
|
|
|
|
{
|
|
|
|
|
nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
|
|
|
|
@@ -6049,17 +6062,17 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
|
|
|
|
|
if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
|
|
|
|
|
retLen = sizeof(nfapi_timing_info_t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
|
|
|
|
|
retLen = sizeof(nfapi_ue_release_request_t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
|
|
|
|
|
retLen = sizeof(nfapi_ue_release_response_t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
|
|
|
|
|
retLen = sizeof(nfapi_ue_release_request_t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
|
|
|
|
|
retLen = sizeof(nfapi_ue_release_response_t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
|
|
|
|
|
break;
|
|
|
|
@@ -6179,14 +6192,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
|
|
|
|
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_REQUEST:
|
|
|
|
|
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
|
|
|
|
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_HARQ_INDICATION:
|
|
|
|
|
if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
|
|
|
|
|
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
@@ -6203,7 +6216,9 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|
|
|
|
|
|
|
|
|
case NFAPI_RX_ULSCH_INDICATION:
|
|
|
|
|
if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
|
|
|
|
|
{
|
|
|
|
|
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
@@ -6284,14 +6299,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
|
|
|
|
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case NFAPI_UE_RELEASE_RESPONSE:
|
|
|
|
|
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
|
|
|
|
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
|
|
|
@@ -6315,7 +6330,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
|
|
|
|
|
|
|
|
|
if(result == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|