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

Code cleanup/replace pdn_type by pdu_session-type

parent 853160e1
......@@ -28,7 +28,6 @@
#ifndef FILE_3GPP_23_003_SEEN
#define FILE_3GPP_23_003_SEEN
//#include "3gpp_29.274.h"
#include <stdint.h>
typedef struct plmn_s {
......
......@@ -332,7 +332,46 @@ typedef struct pdu_session_type_s {
}
} pdu_session_type_t;
//-------------------------------------
// 8.14 PDU Session (UE IP) Address Allocation (PAA)
struct paa_s {
pdu_session_type_t pdu_session_type;
uint8_t ipv6_prefix_length;
struct in6_addr ipv6_address;
struct in_addr ipv4_address;
//------------------------------------------------------------------------------
bool is_ip_assigned() {
switch (pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
if (ipv4_address.s_addr)
return true;
return false;
break;
case PDU_SESSION_TYPE_E_IPV6:
if (ipv6_address.s6_addr32[0] | ipv6_address.s6_addr32[1]
| ipv6_address.s6_addr32[2] | ipv6_address.s6_addr32[3])
return true;
return false;
break;
case PDU_SESSION_TYPE_E_IPV4V6:
// TODO
if (ipv4_address.s_addr)
return true;
if (ipv6_address.s6_addr32[0] | ipv6_address.s6_addr32[1]
| ipv6_address.s6_addr32[2] | ipv6_address.s6_addr32[3])
return true;
return false;
break;
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
default:
return false;
}
}
};
typedef struct paa_s paa_t;
#endif
#endif
......@@ -1357,7 +1357,7 @@ typedef struct graceful_release_period_s {
//-------------------------------------
// 8.2.79 PDN Type
enum pdn_type_value_e {
enum pdu_session_type_value_e {
/* Request / Initial message */
IPV4 = 1,
IPV6 = 2,
......@@ -1366,10 +1366,10 @@ enum pdn_type_value_e {
ETHERNET = 5
};
typedef struct pdn_type_s {
typedef struct pdu_session_type_s {
uint8_t spare :5;
uint8_t pdn_type :3;
} pdn_type_t;
uint8_t pdu_session_type :3;
} pdu_session_type_t;
//-------------------------------------
// 8.2.80 Failed Rule ID
......
This diff is collapsed.
......@@ -38,142 +38,6 @@
#include <string>
#include <vector>
namespace gtpv1u {
struct gtpu_exception : public std::exception {
gtpu_exception() throw () {
cause = 0;
phrase.assign("GTPV1-U Exception unknown cause");
}
gtpu_exception(int acause) throw () {
cause = acause;
phrase = fmt::format("GTPV1-U Exception cause {}", cause);
}
const char* what() const throw () {
return phrase.c_str();
}
public:
int cause;
std::string phrase;
};
struct gtpu_msg_bad_length_exception : public gtpu_exception {
public:
gtpu_msg_bad_length_exception(const uint8_t msg_type,
const uint16_t msg_size) throw () {
phrase = fmt::format("GTPV1-U msg {} Bad Length {} Exception", msg_type,
msg_size);
}
gtpu_msg_bad_length_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_bad_length_exception() throw () {
}
};
struct gtpu_msg_unimplemented_ie_exception : public gtpu_exception {
public:
gtpu_msg_unimplemented_ie_exception(const uint8_t msg_type,
const uint8_t ie_type,
const uint8_t instance = 0) throw () {
phrase = fmt::format(
"GTPV1-U msg {} Unimplemented {} IE Instance {} Exception", msg_type,
ie_type, instance);
}
gtpu_msg_unimplemented_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_unimplemented_ie_exception() throw () {
}
};
struct gtpu_msg_illegal_ie_exception : public gtpu_exception {
public:
gtpu_msg_illegal_ie_exception(const uint8_t msg_type,
const uint8_t ie_type) throw () {
phrase = fmt::format("GTPV1-U msg {} Illegal {} Exception", msg_type,
ie_type);
}
gtpu_msg_illegal_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_illegal_ie_exception() throw () {
}
};
struct gtpu_ie_exception : public gtpu_exception {
public:
gtpu_ie_exception(uint8_t ie_type) throw () {
phrase = fmt::format("GTPV1-U IE {} Exception", ie_type);
}
gtpu_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_ie_exception() throw () {
}
};
struct gtpu_ie_unimplemented_exception : public gtpu_ie_exception {
public:
gtpu_ie_unimplemented_exception(uint8_t ie_type) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE {} Unimplemented Exception", ie_type);
}
virtual ~gtpu_ie_unimplemented_exception() throw () {
}
};
struct gtpu_tlv_exception : public gtpu_ie_exception {
public:
gtpu_tlv_exception(uint8_t ie_type) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE TLV {} Exception", ie_type);
}
virtual ~gtpu_tlv_exception() throw () {
}
};
struct gtpu_tlv_bad_length_exception : public gtpu_tlv_exception {
public:
gtpu_tlv_bad_length_exception(uint8_t ie_type, uint16_t ie_length) throw ()
:
gtpu_tlv_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE TLV {} Bad Length {} Exception", ie_type);
}
virtual ~gtpu_tlv_bad_length_exception() throw () {
}
};
struct gtpu_ie_value_exception : public gtpu_ie_exception {
public:
gtpu_ie_value_exception(uint8_t ie_type, const char *field) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE {} Bad Value of {} Exception", ie_type,
field);
}
virtual ~gtpu_ie_value_exception() throw () {
}
};
#define GTPU_IE_RECOVERY 14
#define GTPU_IE_TUNNEL_ENDPOINT_IDENTIFIER_DATA_I 16
#define GTPU_IE_GTP_U_PEER_ADDRESS 133
#define GTPU_IE_EXTENSION_HEADER_TYPE_LIST 141
#define GTPU_IE_PRIVATE_EXTENSION 255
#define GTPU_ECHO_REQUEST (1)
#define GTPU_ECHO_RESPONSE (2)
#define GTPU_ERROR_INDICATION (26)
#define GTPU_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION (31)
#define GTPU_END_MARKER (254)
#define GTPU_G_PDU (255)
} // namespace
// 8.2 Recovery
// 8.3 Tunnel Endpoint Identifier Data I
......
......@@ -36,46 +36,50 @@
//------------------------------------------------------------------------------
void xgpp_conv::paa_to_pfcp_ue_ip_address(
const paa_t &paa, pfcp::ue_ip_address_t &ue_ip_address) {
switch (paa.pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
switch (paa.pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
break;
case PDN_TYPE_E_IPV6:
case PDU_SESSION_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case PDN_TYPE_E_IPV4V6:
case PDU_SESSION_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case PDN_TYPE_E_NON_IP:
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
default:
;
}
}
//------------------------------------------------------------------------------
void xgpp_conv::pdn_ip_to_pfcp_ue_ip_address(
const pdn_type_t &pdn_type, const struct in_addr &ipv4_address,
const pdu_session_type_t &pdu_session_type, const struct in_addr &ipv4_address,
const struct in6_addr ipv6_address, pfcp::ue_ip_address_t &ue_ip_address) {
switch (pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
switch (pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = ipv4_address;
break;
case PDN_TYPE_E_IPV6:
case PDU_SESSION_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_IPV4V6:
case PDU_SESSION_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = ipv4_address;
ue_ip_address.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_NON_IP:
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
default:
;
}
......
......@@ -31,13 +31,14 @@
#include "3gpp_29.274.h"
#include "3gpp_29.244.h"
#include "3gpp_29.281.h"
#include "3gpp_24.501.h"
#include "endpoint.hpp"
namespace xgpp_conv {
void paa_to_pfcp_ue_ip_address(const paa_t &paa,
pfcp::ue_ip_address_t &ue_ip_address);
void pdn_ip_to_pfcp_ue_ip_address(const pdn_type_t &pdn_type,
void pdn_ip_to_pfcp_ue_ip_address(const pdu_session_type_t &pdu_session_type,
const struct in_addr &ipv4_address,
const struct in6_addr ipv6_address,
pfcp::ue_ip_address_t &ue_ip_address);
......
......@@ -430,8 +430,11 @@ namespace pfcp {
virtual bool get(pfcp::graceful_release_period_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_GRACEFUL_RELEASE_PERIOD, __FILE__, __LINE__);}
virtual void set(const pfcp::graceful_release_period_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_GRACEFUL_RELEASE_PERIOD, __FILE__, __LINE__);}
// PFCP_IE_PDN_TYPE
virtual bool get(pfcp::pdn_type_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
virtual void set(const pfcp::pdn_type_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
//virtual bool get(pfcp::pdn_type_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
//virtual void set(const pfcp::pdn_type_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
virtual bool get(pfcp::pdu_session_type_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
virtual void set(const pfcp::pdu_session_type_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_PDN_TYPE, __FILE__, __LINE__);}
// PFCP_IE_FAILED_RULE_ID
virtual bool get(pfcp::failed_rule_id_t& v) const {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_FAILED_RULE_ID, __FILE__, __LINE__);}
virtual void set(const pfcp::failed_rule_id_t& v) {throw pfcp_msg_illegal_ie_exception(0, PFCP_IE_FAILED_RULE_ID, __FILE__, __LINE__);}
......@@ -2886,7 +2889,8 @@ public:
std::vector<pfcp::create_qer> create_qers;
std::pair<bool, pfcp::create_bar> create_bar;
std::pair<bool, pfcp::create_traffic_endpoint> create_traffic_endpoint;
std::pair<bool, pfcp::pdn_type_t> pdn_type;
//std::pair<bool, pfcp::pdn_type_t> pdn_type;
std::pair<bool, pfcp::pdu_session_type_t> pdu_session_type;
std::pair<bool, fq_csid_t> sgw_c_fq_csid;
std::pair<bool, fq_csid_t> mme_fq_csid;
std::pair<bool, fq_csid_t> pgw_c_fq_csid;
......@@ -2905,7 +2909,7 @@ public:
create_qers(),
create_bar(),
create_traffic_endpoint(),
pdn_type(),
pdu_session_type(),
sgw_c_fq_csid(),
mme_fq_csid(),
pgw_c_fq_csid(),
......@@ -2924,7 +2928,7 @@ public:
create_qers = i.create_qers;
create_bar = i.create_bar;
create_traffic_endpoint = i.create_traffic_endpoint;
pdn_type = i.pdn_type;
pdu_session_type = i.pdu_session_type;
sgw_c_fq_csid = i.sgw_c_fq_csid;
mme_fq_csid = i.mme_fq_csid;
pgw_c_fq_csid = i.pgw_c_fq_csid;
......
......@@ -409,20 +409,24 @@ int smf_config::load(const string &config_file) {
dnn_cfg.lookupValue(SMF_CONFIG_STRING_DNN_NI, astring);
dnn[dnn_idx].dnn = astring;
dnn[dnn_idx].dnn_label = EPC::Utility::dnn_label(astring);
dnn_cfg.lookupValue(SMF_CONFIG_STRING_PDN_TYPE, astring);
dnn_cfg.lookupValue(SMF_CONFIG_STRING_PDU_SESSION_TYPE, astring);
if (boost::iequals(astring, "IPv4")) {
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4;
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_IPV4;
} else if (boost::iequals(astring, "IPv6") == 0) {
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV6;
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_IPV6;
} else if (boost::iequals(astring, "IPv4IPv6") == 0) {
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_IPV4V6;
} else if (boost::iequals(astring, "Non-IP") == 0) {
dnn[dnn_idx].pdn_type.pdn_type = PDN_TYPE_E_NON_IP;
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_IPV4V6;
} else if (boost::iequals(astring, "Unstructured") == 0) {
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_UNSTRUCTURED;
} else if (boost::iequals(astring, "Ethernet") == 0) {
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_ETHERNET;
} else if (boost::iequals(astring, "Reserved") == 0) {
dnn[dnn_idx].pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_RESERVED;
} else {
Logger::smf_app().error(
" " SMF_CONFIG_STRING_PDN_TYPE " in %d'th DNN :%s", i + 1,
" " SMF_CONFIG_STRING_PDU_SESSION_TYPE " in %d'th DNN :%s", i + 1,
astring.c_str());
throw("Error PDN_TYPE in config file");
throw("Error PDU_SESSION_TYPE in config file");
}
dnn_cfg.lookupValue(SMF_CONFIG_STRING_IPV4_POOL,
dnn[dnn_idx].pool_id_iv4);
......@@ -430,16 +434,16 @@ int smf_config::load(const string &config_file) {
dnn[dnn_idx].pool_id_iv6);
if ((0 <= dnn[dnn_idx].pool_id_iv4)
&& (dnn[dnn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV6)) {
&& (dnn[dnn_idx].pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV6)) {
Logger::smf_app().error(
"PDN_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDN_TYPE versus pool identifier DNN");
"PDU_SESSION_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDU_SESSION_TYPE versus pool identifier DNN");
}
if ((0 <= dnn[dnn_idx].pool_id_iv6)
&& (dnn[dnn_idx].pdn_type.pdn_type == PDN_TYPE_E_IPV4)) {
&& (dnn[dnn_idx].pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4)) {
Logger::smf_app().error(
"PDN_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDN_TYPE versus pool identifier DNN");
"PDU_SESSION_TYPE versus pool identifier %d 'th DNN in config file", i + 1);
throw("PDU_SESSION_TYPE versus pool identifier DNN");
}
if (((0 <= dnn[dnn_idx].pool_id_iv4) || (0 <= dnn[dnn_idx].pool_id_iv6))
......@@ -756,8 +760,8 @@ void smf_config::display() {
Logger::smf_app().info(" DNN %d:", i);
Logger::smf_app().info(" " SMF_CONFIG_STRING_DNN_NI ": %s",
dnn[i].dnn.c_str());
Logger::smf_app().info(" " SMF_CONFIG_STRING_PDN_TYPE ": %s",
dnn[i].pdn_type.toString().c_str());
Logger::smf_app().info(" " SMF_CONFIG_STRING_PDU_SESSION_TYPE ": %s",
dnn[i].pdu_session_type.toString().c_str());
if (dnn[i].pool_id_iv4 >= 0) {
std::string range_low(inet_ntoa(ue_pool_range_low[dnn[i].pool_id_iv4]));
std::string range_high(inet_ntoa(ue_pool_range_high[dnn[i].pool_id_iv4]));
......@@ -830,20 +834,6 @@ void smf_config::display() {
}
//------------------------------------------------------------------------------
bool smf_config::is_dotted_dnn_handled(const string &dnn,
const pdn_type_t &pdn_type) {
for (int i = 0; i < smf_cfg.num_dnn; i++) {
if (0 == dnn.compare(smf_cfg.dnn[i].dnn_label)) {
// TODO refine
if (pdn_type.pdn_type == smf_cfg.dnn[i].pdn_type.pdn_type) {
return true;
}
}
}
return false;
}
//------------------------------------------------------------------------------
int smf_config::get_pfcp_node_id(pfcp::node_id_t &node_id) {
node_id = { };
......@@ -895,9 +885,9 @@ bool smf_config::is_dotted_dnn_handled(
Logger::smf_app().debug("DNN matched!");
Logger::smf_app().debug("PDU Session Type %d, PDN Type %d",
pdn_session_type.pdu_session_type,
smf_cfg.dnn[i].pdn_type.pdn_type);
smf_cfg.dnn[i].pdu_session_type.pdu_session_type);
if (pdn_session_type.pdu_session_type
== smf_cfg.dnn[i].pdn_type.pdn_type) {
== smf_cfg.dnn[i].pdu_session_type.pdu_session_type) {
return true;
}
}
......
......@@ -80,7 +80,7 @@
#define SMF_CONFIG_STRING_DNN_LIST "DNN_LIST"
#define SMF_CONFIG_STRING_DNN_NI "DNN_NI"
#define SMF_CONFIG_STRING_PDN_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_PDU_SESSION_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
......@@ -178,7 +178,7 @@ class smf_config {
std::string dnn_label;
int pool_id_iv4;
int pool_id_iv6;
pdn_type_t pdn_type;
pdu_session_type_t pdu_session_type;
} dnn[SMF_NUM_DNN_MAX];
int num_ue_pool;
......@@ -298,8 +298,6 @@ class smf_config {
int load(const std::string &config_file);
int finalize();
void display();
bool is_dotted_dnn_handled(const std::string &dnn,
const pdn_type_t &pdn_type);
int get_pfcp_node_id(pfcp::node_id_t &node_id);
int get_pfcp_fseid(pfcp::fseid_t &fseid);
bool is_dotted_dnn_handled(const std::string &dnn,
......
......@@ -106,66 +106,70 @@ void smf_qos_flow::deallocate_ressources() {
//------------------------------------------------------------------------------
void smf_pdu_session::set(const paa_t &paa) {
switch (paa.pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
switch (paa.pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
ipv4 = true;
ipv6 = false;
ipv4_address = paa.ipv4_address;
pdn_type.pdn_type = paa.pdn_type.pdn_type;
pdu_session_type.pdu_session_type = paa.pdu_session_type.pdu_session_type;
break;
case PDN_TYPE_E_IPV6:
case PDU_SESSION_TYPE_E_IPV6:
ipv4 = false;
ipv6 = true;
ipv6_address = paa.ipv6_address;
pdn_type.pdn_type = paa.pdn_type.pdn_type;
pdu_session_type.pdu_session_type = paa.pdu_session_type.pdu_session_type;
break;
case PDN_TYPE_E_IPV4V6:
case PDU_SESSION_TYPE_E_IPV4V6:
ipv4 = true;
ipv6 = true;
ipv4_address = paa.ipv4_address;
ipv6_address = paa.ipv6_address;
pdn_type.pdn_type = paa.pdn_type.pdn_type;
pdu_session_type.pdu_session_type = paa.pdu_session_type.pdu_session_type;
break;
case PDN_TYPE_E_NON_IP:
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
ipv4 = false;
ipv6 = false;
pdn_type.pdn_type = paa.pdn_type.pdn_type;
pdu_session_type.pdu_session_type = paa.pdu_session_type.pdu_session_type;
break;
default:
Logger::smf_app().error("smf_pdu_session::set(paa_t) Unknown PDN type %d",
paa.pdn_type.pdn_type);
paa.pdu_session_type.pdu_session_type);
}
}
//------------------------------------------------------------------------------
void smf_pdu_session::get_paa(paa_t &paa) {
switch (pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
switch (pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
ipv4 = true;
ipv6 = false;
paa.ipv4_address = ipv4_address;
break;
case PDN_TYPE_E_IPV6:
case PDU_SESSION_TYPE_E_IPV6:
ipv4 = false;
ipv6 = true;
paa.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_IPV4V6:
case PDU_SESSION_TYPE_E_IPV4V6:
ipv4 = true;
ipv6 = true;
paa.ipv4_address = ipv4_address;
paa.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_NON_IP:
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
ipv4 = false;
ipv6 = false;
break;
default:
Logger::smf_app().error(
"smf_pdu_session::get_paa (paa_t) Unknown PDN type %d",
pdn_type.pdn_type);
pdu_session_type.pdu_session_type);
}
paa.pdn_type.pdn_type = pdn_type.pdn_type;
paa.pdu_session_type.pdu_session_type = pdu_session_type.pdu_session_type;
}
//------------------------------------------------------------------------------
......@@ -361,7 +365,7 @@ std::string smf_pdu_session::toString() const {
smf_qos_flow flow = { };
s.append("PDN CONNECTION:\n");
s.append("\tPDN type:\t\t\t").append(pdn_type.toString()).append("\n");
s.append("\tPDN type:\t\t\t").append(pdu_session_type.toString()).append("\n");
if (ipv4)
s.append("\tPAA IPv4:\t\t\t").append(conv::toString(ipv4_address)).append(
"\n");
......@@ -420,8 +424,8 @@ upCnx_state_e smf_pdu_session::get_upCnx_state() const {
}
//------------------------------------------------------------------------------
pdn_type_t smf_pdu_session::get_pdn_type() const {
return pdn_type;
pdu_session_type_t smf_pdu_session::get_pdu_session_type() const {
return pdu_session_type;
}
//------------------------------------------------------------------------------
......@@ -737,7 +741,7 @@ void smf_context::handle_itti_msg(
session_report_msg.set_snssai(sd.get()->nssai); //s-nssai
session_report_msg.set_dnn(sd.get()->dnn_in_use); //dnn
session_report_msg.set_pdu_session_type(
sp.get()->get_pdn_type().pdn_type); //pdu session type
sp.get()->get_pdu_session_type().pdu_session_type); //pdu session type
//get supi and put into URL
std::string supi_prefix = { };
get_supi_prefix(supi_prefix);
......@@ -1255,7 +1259,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if (nullptr == sp.get()) {
Logger::smf_app().debug("Create a new PDU session");
sp = std::shared_ptr<smf_pdu_session>(new smf_pdu_session());
sp.get()->pdn_type.pdn_type = smreq->req.get_pdu_session_type();
sp.get()->pdu_session_type.pdu_session_type = smreq->req.get_pdu_session_type();
sp.get()->pdu_session_id = pdu_session_id;
sp.get()->amf_id = smreq->req.get_serving_nf_id(); //amf id
sd->insert_pdu_session(sp);
......@@ -1294,8 +1298,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//Step 7. Address allocation based on PDN type
Logger::smf_app().debug("UE Address Allocation");
switch (sp->pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4: {
switch (sp->pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4: {
if (!pco_ids.ci_ipv4_address_allocation_via_dhcpv4) { //use SM NAS signalling
//static or dynamic address allocation
bool paa_res = false; //how to define static or dynamic
......@@ -1308,7 +1312,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if (nullptr != ss.get()) {
ss.get()->find_dnn_configuration(sd->dnn_in_use, sdc);
if (nullptr != sdc.get()) {
paa.pdn_type.pdn_type = sdc.get()->pdu_session_types
paa.pdu_session_type.pdu_session_type = sdc.get()->pdu_session_types
.default_session_type.pdu_session_type;
//TODO: static ip address
}
......@@ -1337,18 +1341,18 @@ void smf_context::handle_pdu_session_create_sm_context_request(
}
break;
case PDN_TYPE_E_IPV6: {
case PDU_SESSION_TYPE_E_IPV6: {
//TODO:
}
break;
case PDN_TYPE_E_IPV4V6: {
case PDU_SESSION_TYPE_E_IPV4V6: {
//TODO:
}
break;
default:
Logger::smf_app().error("Unknown PDN type %d", sp->pdn_type.pdn_type);
Logger::smf_app().error("Unknown PDN type %d", sp->pdu_session_type.pdu_session_type);
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED]);
smContextCreateError.setError(problem_details);
......@@ -1458,15 +1462,17 @@ void smf_context::handle_pdu_session_create_sm_context_request(
paa_t free_paa = { };
free_paa = sm_context_resp->res.get_paa();
if (free_paa.is_ip_assigned()) {
switch (sp->pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
case PDN_TYPE_E_IPV4V6:
switch (sp->pdu_session_type.pdu_session_type) {
case PDU_SESSION_TYPE_E_IPV4:
case PDU_SESSION_TYPE_E_IPV4V6:
paa_dynamic::get_instance().release_paa(sd->dnn_in_use,
free_paa.ipv4_address);
break;
case PDN_TYPE_E_IPV6:
case PDN_TYPE_E_NON_IP:
case PDU_SESSION_TYPE_E_IPV6:
case PDU_SESSION_TYPE_E_UNSTRUCTURED:
case PDU_SESSION_TYPE_E_ETHERNET:
case PDU_SESSION_TYPE_E_RESERVED:
default:
;
}
......@@ -1583,7 +1589,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
n11_sm_context_resp->res.set_snssai(sm_context_req_msg.get_snssai());
n11_sm_context_resp->res.set_dnn(sm_context_req_msg.get_dnn());
n11_sm_context_resp->res.set_pdu_session_type(
sp.get()->get_pdn_type().pdn_type);
sp.get()->get_pdu_session_type().pdu_session_type);
//Step 2.1. Decode N1 (if content is available)
if (sm_context_req_msg.n1_sm_msg_is_set()) {
......
......@@ -130,7 +130,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
ipv6 = false;
ipv4_address.s_addr = INADDR_ANY;
ipv6_address = in6addr_any;
pdn_type = { };
pdu_session_type = { };
seid = 0;
up_fseid = { };
qos_flows.clear();
......@@ -392,15 +392,15 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
/*
* Get PDN Type of this PDU session
* @param void
* @return pdn_type_t: PDN Type
* @return pdu_session_type_t: PDN Type
*/
pdn_type_t get_pdn_type() const;
pdu_session_type_t get_pdu_session_type() const;
bool ipv4; // IP Address(es): IPv4 address and/or IPv6 prefix
bool ipv6; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in_addr ipv4_address; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in6_addr ipv6_address; // IP Address(es): IPv4 address and/or IPv6 prefix
pdn_type_t pdn_type; // IPv4, IPv6, IPv4v6 or Non-IP
pdu_session_type_t pdu_session_type; // IPv4, IPv6, IPv4v6 or Non-IP
bool released; //(release access bearers request)
......
......@@ -240,17 +240,17 @@ class paa_dynamic {
bool get_free_paa(const std::string &dnn_label, paa_t &paa) {
if (dnns.count(dnn_label)) {
dnn_dynamic_pools &dnn_pool = dnns[dnn_label];
if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV4) {
if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4) {
for (std::vector<uint32_t>::const_iterator it4 = dnn_pool.ipv4_pool_ids
.begin(); it4 != dnn_pool.ipv4_pool_ids.end(); ++it4) {
if (ipv4_pools[*it4].alloc_address(paa.ipv4_address)) {
return true;
}
}
Logger::smf_app().warn("Could not get PAA PDN_TYPE_E_IPV4 for DNN %s",
Logger::smf_app().warn("Could not get PAA PDU_SESSION_TYPE_E_IPV4 for DNN %s",
dnn_label.c_str());
return false;
} else if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV4V6) {
} else if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4V6) {
bool success = false;
std::vector<uint32_t>::const_iterator it4 = { };
for (it4 = dnn_pool.ipv4_pool_ids.begin();
......@@ -269,17 +269,17 @@ class paa_dynamic {
}
ipv4_pools[*it4].free_address(paa.ipv4_address);
}
Logger::smf_app().warn("Could not get PAA PDN_TYPE_E_IPV4V6 for DNN %s",
Logger::smf_app().warn("Could not get PAA PDU_SESSION_TYPE_E_IPV4V6 for DNN %s",
dnn_label.c_str());
return false;
} else if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV6) {
} else if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV6) {
for (std::vector<uint32_t>::const_iterator it6 = dnn_pool.ipv6_pool_ids
.begin(); it6 != dnn_pool.ipv6_pool_ids.end(); ++it6) {
if (ipv6_pools[*it6].alloc_address(paa.ipv6_address)) {
return true;
}
}
Logger::smf_app().warn("Could not get PAA PDN_TYPE_E_IPV6 for DNN %s",
Logger::smf_app().warn("Could not get PAA PDU_SESSION_TYPE_E_IPV6 for DNN %s",
dnn_label.c_str());
return false;
}
......@@ -291,7 +291,7 @@ class paa_dynamic {
bool release_paa(const std::string &dnn_label, const paa_t &paa) {
if (dnns.count(dnn_label)) {
dnn_dynamic_pools &dnn_pool = dnns[dnn_label];
if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV4) {
if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4) {
for (std::vector<uint32_t>::const_iterator it4 = dnn_pool.ipv4_pool_ids
.begin(); it4 != dnn_pool.ipv4_pool_ids.end(); ++it4) {
if (ipv4_pools[*it4].free_address(paa.ipv4_address)) {
......@@ -299,7 +299,7 @@ class paa_dynamic {
}
}
return false;
} else if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV4V6) {
} else if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV4V6) {
bool success = false;
std::vector<uint32_t>::const_iterator it4 = { };
for (it4 = dnn_pool.ipv4_pool_ids.begin();
......@@ -309,7 +309,7 @@ class paa_dynamic {
}
}
return false;
} else if (paa.pdn_type.pdn_type == PDN_TYPE_E_IPV6) {
} else if (paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV6) {
return true;
}
}
......
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