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