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

Support ePCO in PDU Session Establishment Accept

parent bbac9e52
......@@ -115,3 +115,28 @@ void xgpp_conv::protocol_configuration_options_nas_to_core(
pco.protocol_or_container_ids.push_back(pco_item);
}
}
void xgpp_conv::protocol_configuration_options_core_to_nas(
const protocol_configuration_options_t& pco,
protocol_configuration_options_nas_t& pco_nas) {
pco_nas.ext = pco.ext;
pco_nas.spare = pco.spare;
pco_nas.configuration_protocol = pco.configuration_protocol;
pco_nas.num_protocol_or_container_id = pco.num_protocol_or_container_id;
for (int i = 0; i < pco.num_protocol_or_container_id; i++) {
pco_nas.protocol_or_container_ids[i].length =
pco.protocol_or_container_ids[i].length_of_protocol_id_contents;
pco_nas.protocol_or_container_ids[i].id =
pco.protocol_or_container_ids[i].protocol_id;
pco_nas.protocol_or_container_ids[i].contents = bfromcstralloc(
pco.protocol_or_container_ids[i].protocol_id_contents.length(), "\0");
pco_nas.protocol_or_container_ids[i].contents->slen =
pco.protocol_or_container_ids[i].protocol_id_contents.length();
memcpy(
(void*) pco_nas.protocol_or_container_ids[i].contents->data,
(void*) pco.protocol_or_container_ids[i].protocol_id_contents.c_str(),
pco.protocol_or_container_ids[i].protocol_id_contents.length());
}
}
......@@ -49,6 +49,9 @@ void protocol_configuration_options_nas_to_core(
const protocol_configuration_options_nas_t& pco_nas,
protocol_configuration_options_t& pco);
void protocol_configuration_options_core_to_nas(
const protocol_configuration_options_t& pco,
protocol_configuration_options_nas_t& pco_nas);
} // namespace xgpp_conv
#endif /* FILE_3GPP_CONVERSIONS_HPP_SEEN */
......@@ -45,17 +45,16 @@ int encode_extended_protocol_configuration_options(
encoded++;
}
lenPtr = (buffer + encoded);
lenPtr = (buffer + encoded);
uint16_t temp = 0;
encoded += 2; //ENCODE_U16
encoded += 2; // ENCODE_U16
encoded += encode_protocol_configuration_options(
extendedprotocolconfigurationoptions, buffer + encoded, len - encoded);
uint32_t len_ie = encoded - 2 - ((iei > 0) ? 1 : 0);
ENCODE_U16(lenPtr, len_ie , temp);
ENCODE_U16(lenPtr, len_ie, temp);
//*lenPtr = encoded - 2 - ((iei > 0) ? 1 : 0);
return encoded;
}
......@@ -85,26 +84,25 @@ int encode_protocol_configuration_options(
.protocol_or_container_ids[num_protocol_or_container_id]
.length;
encoded++;
if ( protocolconfigurationoptions
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, 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;
}
.length > 0) {
if ((encode_result = encode_bstring(
protocolconfigurationoptions
.protocol_or_container_ids[num_protocol_or_container_id]
.contents,
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;
......@@ -122,7 +120,7 @@ int decode_extended_protocol_configuration_options(
decoded++;
}
DECODE_U16(buffer+decoded, ielen, decoded);
DECODE_U16(buffer + decoded, ielen, decoded);
if (((*(buffer + decoded) >> 7) & 0x1) != 1) {
return TLV_VALUE_DOESNT_MATCH;
......@@ -155,19 +153,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;
}
// Bits 7 to 4 of octet 3 are spare, read as 0
if (((*(buffer + decoded) & 0x78) >> 3) != 0) {
return TLV_VALUE_DOESNT_MATCH;
}
*/
// protocolconfigurationoptions->configuration_protocol =
// (*(buffer + decoded) >> 1) & 0x7;
// decoded++;
protocolconfigurationoptions->num_protocol_or_container_id = 0;
while (3 <= ((int32_t) len - (int32_t) decoded)) {
......
......@@ -713,24 +713,28 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// TODO: AlwaysonPDUSessionRequested
// TODO: SMPDUDNRequestContainer
// TODO: ExtendedProtocolConfigurationOptions
Logger::smf_app().debug(
"pco ext %d, spare %d, configuration protocol %d,number_ids %d", decoded_nas_msg.plain.sm.pdu_session_establishment_request
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);
// }
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_epco(pco);
// }
// Get necessary information
supi_t supi = smreq->req.get_supi();
......
......@@ -1316,7 +1316,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// TODO: PCO
protocol_configuration_options_t pco_req = {};
smreq->req.get_pco(pco_req);
smreq->req.get_epco(pco_req);
protocol_configuration_options_t pco_resp = {};
protocol_configuration_options_ids_t pco_ids = {
.pi_ipcp = 0,
......@@ -1326,6 +1326,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
.ci_ipv4_link_mtu_request = 0};
smf_app_inst->process_pco_request(pco_req, pco_resp, pco_ids);
sm_context_resp_pending->res.set_epco(pco_resp);
// Step 7. Address allocation based on PDN type
Logger::smf_app().debug("UE Address Allocation");
......
......@@ -341,15 +341,15 @@ std::string pdu_session_create_sm_context_request::get_sm_context_status_uri()
}
//-----------------------------------------------------------------------------
void pdu_session_create_sm_context_request::set_pco(
void pdu_session_create_sm_context_request::set_epco(
const protocol_configuration_options_t& p) {
epco = p;
m_epco = p;
}
//-----------------------------------------------------------------------------
void pdu_session_create_sm_context_request::get_pco(
void pdu_session_create_sm_context_request::get_epco(
protocol_configuration_options_t& p) const {
p = epco;
p = m_epco;
}
/*
......@@ -400,6 +400,18 @@ std::string pdu_session_create_sm_context_response::get_smf_context_uri()
return m_smf_context_uri;
}
//-----------------------------------------------------------------------------
void pdu_session_create_sm_context_response::set_epco(
const protocol_configuration_options_t& p) {
m_epco = p;
}
//-----------------------------------------------------------------------------
void pdu_session_create_sm_context_response::get_epco(
protocol_configuration_options_t& p) const {
p = m_epco;
}
/*
* class: PDU Session Update SM Context Request
*/
......
......@@ -247,12 +247,16 @@ class pdu_session_create_sm_context_request
public:
pdu_session_create_sm_context_request()
: pdu_session_sm_context_request(PDU_SESSION_CREATE_SM_CONTEXT_REQUEST),
m_unauthenticated_supi(true) {}
m_unauthenticated_supi(true) {
m_epco = {};
}
pdu_session_create_sm_context_request(
supi_t supi, pdu_session_id_t pdi, std::string dnn, snssai_t snssai)
: pdu_session_sm_context_request(
PDU_SESSION_CREATE_SM_CONTEXT_REQUEST, supi, pdi, dnn, snssai),
m_unauthenticated_supi(true) {}
m_unauthenticated_supi(true) {
m_epco = {};
}
std::string get_serving_nf_id() const;
void set_serving_nf_id(const std::string& value);
......@@ -262,8 +266,8 @@ class pdu_session_create_sm_context_request
std::string get_dnn_selection_mode() const;
void set_sm_context_status_uri(const std::string& value);
std::string get_sm_context_status_uri() const;
void set_pco(const protocol_configuration_options_t& p);
void get_pco(protocol_configuration_options_t& p) const;
void set_epco(const protocol_configuration_options_t& p);
void get_epco(protocol_configuration_options_t& p) const;
private:
bool m_unauthenticated_supi;
......@@ -274,7 +278,7 @@ class pdu_session_create_sm_context_request
std::string m_an_type;
std::string m_dnn_selection_mode; // SelMode
std::string m_sm_context_status_uri;
protocol_configuration_options_t epco;
protocol_configuration_options_t m_epco;
};
//---------------------------------------------------------------------------------------
......@@ -286,6 +290,7 @@ class pdu_session_create_sm_context_response
PDU_SESSION_CREATE_SM_CONTEXT_RESPONSE) {
m_paa = {};
m_qos_flow_context = {};
m_epco = {};
}
pdu_session_create_sm_context_response(
supi_t supi, pdu_session_id_t pdi, std::string dnn, snssai_t snssai)
......@@ -293,6 +298,7 @@ class pdu_session_create_sm_context_response
PDU_SESSION_CREATE_SM_CONTEXT_RESPONSE, supi, pdi, dnn, snssai) {
m_paa = {};
m_qos_flow_context = {};
m_epco = {};
}
void set_paa(const paa_t& paa);
......@@ -303,12 +309,15 @@ class pdu_session_create_sm_context_response
std::string get_amf_url() const;
void set_smf_context_uri(const std::string& value);
std::string get_smf_context_uri() const;
void set_epco(const protocol_configuration_options_t& p);
void get_epco(protocol_configuration_options_t& p) const;
private:
paa_t m_paa;
qos_flow_context_updated m_qos_flow_context;
std::string m_amf_url;
std::string m_smf_context_uri;
protocol_configuration_options_t m_epco;
};
//---------------------------------------------------------------------------------------
......
......@@ -35,6 +35,7 @@
#include "smf.h"
#include "smf_app.hpp"
#include "3gpp_conversions.hpp"
extern "C" {
#include "dynamic_memory_check.h"
......@@ -217,6 +218,12 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
}
// TODO: ExtendedProtocolConfigurationOptions
protocol_configuration_options_t pco_res = {};
sm_context_res.get_epco(pco_res);
// sm_msg->pdu_session_establishment_accept.
xgpp_conv::protocol_configuration_options_core_to_nas(
pco_res, sm_msg->pdu_session_establishment_accept
.extendedprotocolconfigurationoptions);
// DNN
util::string_to_bstring(
......
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