Commit bbac9e52 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for ePCO

parent dd8c27ba
......@@ -46,15 +46,16 @@ int encode_extended_protocol_configuration_options(
}
lenPtr = (buffer + encoded);
encoded++;
lenPtr = (buffer + encoded);
encoded++;
uint16_t temp = 0;
encoded += 2; //ENCODE_U16
encoded += encode_protocol_configuration_options(
extendedprotocolconfigurationoptions, buffer + encoded, len - encoded);
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
uint32_t len_ie = encoded - 2 - ((iei > 0) ? 1 : 0);
ENCODE_U16(lenPtr, len_ie , temp);
//*lenPtr = encoded - 2 - ((iei > 0) ? 1 : 0);
return encoded;
}
......@@ -84,16 +85,26 @@ int encode_protocol_configuration_options(
.protocol_or_container_ids[num_protocol_or_container_id]
.length;
encoded++;
if ( protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length
>0 ) {
if ((encode_result = encode_bstring(
protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.contents,
buffer + encoded, len - encoded)) < 0)
buffer + encoded, protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length
)) < 0)
return encode_result;
else
encoded += encode_result;
} else {
encoded += protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.length;
}
num_protocol_or_container_id += 1;
}
return encoded;
......@@ -111,11 +122,23 @@ int decode_extended_protocol_configuration_options(
decoded++;
}
ielen = *(buffer + decoded);
DECODE_U16(buffer+decoded, ielen, decoded);
if (((*(buffer + decoded) >> 7) & 0x1) != 1) {
return TLV_VALUE_DOESNT_MATCH;
}
// Bits 7 to 4 of octet 3 are spare, read as 0
if (((*(buffer + decoded) & 0x78) >> 3) != 0) {
return TLV_VALUE_DOESNT_MATCH;
}
extendedprotocolconfigurationoptions->configuration_protocol =
(*(buffer + decoded) >> 1) & 0x7;
decoded++;
decode_result = decode_protocol_configuration_options(
extendedprotocolconfigurationoptions, buffer + decoded, ielen - decoded);
extendedprotocolconfigurationoptions, buffer + decoded, ielen);
if (decode_result < 0) {
return decode_result;
......@@ -132,7 +155,7 @@ int decode_protocol_configuration_options(
const uint8_t* const buffer, const const uint32_t len) {
int decoded = 0;
int decode_result = 0;
/*
if (((*(buffer + decoded) >> 7) & 0x1) != 1) {
return TLV_VALUE_DOESNT_MATCH;
}
......@@ -141,10 +164,10 @@ int decode_protocol_configuration_options(
if (((*(buffer + decoded) & 0x78) >> 3) != 0) {
return TLV_VALUE_DOESNT_MATCH;
}
protocolconfigurationoptions->configuration_protocol =
(*(buffer + decoded) >> 1) & 0x7;
decoded++;
*/
// protocolconfigurationoptions->configuration_protocol =
// (*(buffer + decoded) >> 1) & 0x7;
// decoded++;
protocolconfigurationoptions->num_protocol_or_container_id = 0;
while (3 <= ((int32_t) len - (int32_t) decoded)) {
......@@ -155,6 +178,7 @@ int decode_protocol_configuration_options(
->num_protocol_or_container_id]
.id,
decoded);
DECODE_U8(
buffer + decoded,
protocolconfigurationoptions
......
......@@ -713,16 +713,24 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// TODO: AlwaysonPDUSessionRequested
// TODO: SMPDUDNRequestContainer
// TODO: ExtendedProtocolConfigurationOptions
if (decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.num_protocol_or_container_id >
0) {
Logger::smf_app().debug(
"pco ext %d, spare %d, configuration protocol %d,number_ids %d", decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.ext,
decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.spare,decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.configuration_protocol,decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions.num_protocol_or_container_id );
// if (decoded_nas_msg.plain.sm.pdu_session_establishment_request
// .extendedprotocolconfigurationoptions.num_protocol_or_container_id >
// 0) {
protocol_configuration_options_t pco = {};
xgpp_conv::protocol_configuration_options_nas_to_core(
decoded_nas_msg.plain.sm.pdu_session_establishment_request
.extendedprotocolconfigurationoptions,
pco);
smreq->req.set_pco(pco);
}
// }
// Get necessary information
supi_t supi = smreq->req.get_supi();
......
......@@ -48,18 +48,18 @@ int smf_app::pco_push_protocol_or_container_id(
pco.num_protocol_or_container_id) {
return RETURNerror;
}
pco.protocol_or_container_ids[pco.num_protocol_or_container_id].protocol_id =
pco_protocol_or_container_id_t pco_item = {};
pco_item.protocol_id =
poc_id->protocol_id;
pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.length_of_protocol_id_contents = poc_id->length_of_protocol_id_contents;
pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.protocol_id_contents = poc_id->protocol_id_contents;
assert(
pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.length_of_protocol_id_contents ==
pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
.protocol_id_contents.size());
pco_item.length_of_protocol_id_contents = poc_id->length_of_protocol_id_contents;
pco_item.protocol_id_contents = poc_id->protocol_id_contents;
// assert(
// pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
// .length_of_protocol_id_contents ==
// pco.protocol_or_container_ids[pco.num_protocol_or_container_id]
// .protocol_id_contents.size());
// poc_id->protocol_id_contents = nullptr;
pco.protocol_or_container_ids.push_back(pco_item);
pco.num_protocol_or_container_id += 1;
return RETURNok;
}
......
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