Commit 73e7a344 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent f081ff5a
......@@ -199,8 +199,7 @@ class smf_app {
virtual ~smf_app() {
Logger::smf_app().debug("Delete SMF_APP instance...");
// TODO: disconnect connections
// Unregister NRF
// TODO: Unregister NRF
}
void operator=(smf_app const&) = delete;
......@@ -832,7 +831,6 @@ class smf_app {
* @return void
*/
void trigger_upf_status_notification_subscribe();
};
} // namespace smf
#include "smf_config.hpp"
......
This diff is collapsed.
......@@ -158,11 +158,11 @@ typedef struct itti_cfg_s {
class smf_config {
private:
int load_itti(const libconfig::Setting &itti_cfg, itti_cfg_t &cfg);
int load_interface(const libconfig::Setting &if_cfg, interface_cfg_t &cfg);
int load_itti(const libconfig::Setting& itti_cfg, itti_cfg_t& cfg);
int load_interface(const libconfig::Setting& if_cfg, interface_cfg_t& cfg);
int load_thread_sched_params(
const libconfig::Setting &thread_sched_params_cfg,
util::thread_sched_params &cfg);
const libconfig::Setting& thread_sched_params_cfg,
util::thread_sched_params& cfg);
public:
/* Reader/writer lock for this configuration */
......@@ -310,13 +310,13 @@ class smf_config {
~smf_config();
void lock() { m_rw_lock.lock(); };
void unlock() { m_rw_lock.unlock(); };
int load(const std::string &config_file);
int load(const std::string& config_file);
int finalize();
void display();
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,
const pdu_session_type_t &pdn_session_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, const pdu_session_type_t& pdn_session_type);
std::string get_default_dnn();
};
......
......@@ -2870,20 +2870,23 @@ void smf_context::update_qos_info(
QOSFlowDescriptionsContents qos_flow_description_content = {};
// Only one flow description for new requested QoS Flow
// QOSFlowDescriptionsContents* qos_flow_description =
// (QOSFlowDescriptionsContents*) calloc(
// number_of_flow_descriptions, sizeof(QOSFlowDescriptionsContents));
// QOSFlowDescriptionsContents* qos_flow_description =
// (QOSFlowDescriptionsContents*) calloc(
// number_of_flow_descriptions, sizeof(QOSFlowDescriptionsContents));
if (number_of_flow_descriptions > 0) {
// qos_flow_description = nas_msg.plain.sm.pdu_session_modification_request
// .qosflowdescriptions.qosflowdescriptionscontents;
// qos_flow_description =
// nas_msg.plain.sm.pdu_session_modification_request
// .qosflowdescriptions.qosflowdescriptionscontents;
for (int i = 0; i < number_of_flow_descriptions; i++) {
if (nas_msg.plain.sm.pdu_session_modification_request
.qosflowdescriptions.qosflowdescriptionscontents[i].qfi == NO_QOS_FLOW_IDENTIFIER_ASSIGNED) {
if (nas_msg.plain.sm.pdu_session_modification_request.qosflowdescriptions
.qosflowdescriptionscontents[i]
.qfi == NO_QOS_FLOW_IDENTIFIER_ASSIGNED) {
// TODO: generate new QFI
generated_qfi.qfi = (uint8_t) 60; // hardcoded for now
qos_flow_description_content = nas_msg.plain.sm.pdu_session_modification_request
qos_flow_description_content =
nas_msg.plain.sm.pdu_session_modification_request
.qosflowdescriptions.qosflowdescriptionscontents[i];
qos_flow_description_content.qfi = generated_qfi.qfi;
break;
......@@ -3005,7 +3008,7 @@ void smf_context::update_qos_info(
i++;
}
// free_wrapper((void**) &qos_flow_description);
// free_wrapper((void**) &qos_flow_description);
}
//------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -33,17 +33,17 @@
#include "smf_subscription.hpp"
using namespace smf;
extern smf::smf_app *smf_app_inst;
extern itti_mw *itti_inst;
extern smf::smf_app* smf_app_inst;
extern itti_mw* itti_inst;
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_sm_context_status(
const sm_context_status_sig_t::slot_type &sig) {
const sm_context_status_sig_t::slot_type& sig) {
return sm_context_status.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_pdu_session_release(
const ee_pdu_session_release_sig_t::slot_type &sig) {
const ee_pdu_session_release_sig_t::slot_type& sig) {
return ee_pdu_session_release.connect(sig);
}
......@@ -40,10 +40,10 @@ namespace smf {
class smf_event {
public:
smf_event(){};
smf_event(smf_event const &) = delete;
void operator=(smf_event const &) = delete;
smf_event(smf_event const&) = delete;
void operator=(smf_event const&) = delete;
static smf_event &get_instance() {
static smf_event& get_instance() {
static smf_event instance;
return instance;
}
......@@ -61,7 +61,7 @@ class smf_event {
* the slot
*/
bs2::connection subscribe_sm_context_status(
const sm_context_status_sig_t::slot_type &sig);
const sm_context_status_sig_t::slot_type& sig);
/*
* Subscribe to Event Exposure Event: PDU Session Release
......@@ -71,7 +71,7 @@ class smf_event {
* the slot
*/
bs2::connection subscribe_ee_pdu_session_release(
const ee_pdu_session_release_sig_t::slot_type &sig);
const ee_pdu_session_release_sig_t::slot_type& sig);
private:
sm_context_status_sig_t
......
......@@ -39,13 +39,14 @@ namespace smf {
// Signal for PDU session status
// SCID, PDU Session Status, HTTP version
typedef bs2::signal_type<void(scid_t, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
sm_context_status_sig_t;
typedef bs2::signal_type<
void(scid_t, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type sm_context_status_sig_t;
// Signal for Event exposure
// PDU session Release, SUPI, PDU SessionID, HTTP version
typedef bs2::signal_type<void(supi64_t, pdu_session_id_t, uint8_t),
typedef bs2::signal_type<
void(supi64_t, pdu_session_id_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_pdu_session_release_sig_t;
......
......@@ -46,127 +46,127 @@ class smf_n1 {
private:
public:
smf_n1(){};
smf_n1(smf_n1 const &) = delete;
void operator=(smf_n1 const &) = delete;
smf_n1(smf_n1 const&) = delete;
void operator=(smf_n1 const&) = delete;
public:
static smf_n1 &get_instance() {
static smf_n1& get_instance() {
static smf_n1 instance;
return instance;
}
/*
* Create N1 SM Container: PDU Session Establishment Accept
* @param [pdu_session_create_sm_context_response] sm_context_res: include
* @param [pdu_session_create_sm_context_response&] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_establishment_accept(
pdu_session_create_sm_context_response &sm_context_res,
std::string &nas_msg_str, cause_value_5gsm_e sm_cause);
pdu_session_create_sm_context_response& sm_context_res,
std::string& nas_msg_str, cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Establishment Reject
* @param [pdu_session_msg] msg: include necessary information for encoding
* @param [pdu_session_msg&] msg: include necessary information for encoding
* NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
std::string &nas_msg_str,
bool create_n1_pdu_session_establishment_reject(
pdu_session_msg& msg, std::string& nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in PDU Session Update SM Context Response (PDU Session
* Modification UE-Initiated procedure - step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding
* NGAP msg
* @param [pdu_session_update_sm_context_response&] msg: include necessary
* information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(
pdu_session_update_sm_context_response &msg, std::string &nas_msg_str,
pdu_session_update_sm_context_response& msg, std::string& nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in N1N2MessageTransfer Request (PDU Session Modification
* SMF-Requested, step 1 (from SMF to AMF))
* @param [pdu_session_msg] msg: include necessary information for encoding
* NGAP msg
* @param [pdu_session_modification_network_requested&] msg: include necessary
* information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(
pdu_session_modification_network_requested &msg, std::string &nas_msg_str,
pdu_session_modification_network_requested& msg, std::string& nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Reject
* Included in PDU Session Update SM Context Response (PDU Session Release
* UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding
* NGAP msg
* @param [pdu_session_update_sm_context_request&] msg: include necessary
* information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_release_reject(
pdu_session_update_sm_context_request &sm_context_res,
std::string &nas_msg_str, cause_value_5gsm_e sm_cause);
pdu_session_update_sm_context_request& sm_context_res,
std::string& nas_msg_str, cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in PDU Session Update SM Context Response (PDU Session Release
* UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding
* NGAP msg
* @param [pdu_session_update_sm_context_response&] msg: include necessary
* information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_release_command(
pdu_session_update_sm_context_response &msg, std::string &nas_msg_str,
pdu_session_update_sm_context_response& msg, std::string& nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in N1N2MessageTransfer Request (PDU Session Release SMF-Requested,
* step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding
* NGAP msg
* @param [pdu_session_modification_network_requested&] msg: include necessary
* information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [uint8_t] sm_cause store NAS Cause
* @param [cause_value_5gsm_e] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n1_pdu_session_release_command(
pdu_session_modification_network_requested &msg, std::string &nas_msg_str,
pdu_session_modification_network_requested& msg, std::string& nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
......@@ -175,8 +175,8 @@ class smf_n1 {
* @param [const std::string&] n1_sm_msg N1 SM Container
* @return status of the decode process
*/
int decode_n1_sm_container(nas_message_t &nas_msg,
const std::string &n1_sm_msg);
int decode_n1_sm_container(
nas_message_t& nas_msg, const std::string& n1_sm_msg);
};
} // namespace smf
......
......@@ -43,36 +43,36 @@ using namespace smf;
using namespace std;
using json = nlohmann::json;
extern itti_mw *itti_inst;
extern smf_n10 *smf_n10_inst;
extern itti_mw* itti_inst;
extern smf_n10* smf_n10_inst;
extern smf_config smf_cfg;
void smf_n10_task(void *);
void smf_n10_task(void*);
/*
* To read content of the response from UDM
*/
static std::size_t callback(const char *in, std::size_t size, std::size_t num,
std::string *out) {
static std::size_t callback(
const char* in, std::size_t size, std::size_t num, std::string* out) {
const std::size_t totalBytes(size * num);
out->append(in, totalBytes);
return totalBytes;
}
//------------------------------------------------------------------------------
void smf_n10_task(void *args_p) {
void smf_n10_task(void* args_p) {
const task_id_t task_id = TASK_SMF_N10;
itti_inst->notify_task_ready(task_id);
do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto *msg = shared_msg.get();
auto* msg = shared_msg.get();
switch (msg->msg_type) {
case N10_SESSION_GET_SESSION_MANAGEMENT_SUBSCRIPTION:
break;
case TERMINATE:
if (itti_msg_terminate *terminate =
dynamic_cast<itti_msg_terminate *>(msg)) {
if (itti_msg_terminate* terminate =
dynamic_cast<itti_msg_terminate*>(msg)) {
Logger::smf_n10().info("Received terminate message");
return;
}
......@@ -97,20 +97,20 @@ smf_n10::smf_n10() {
//------------------------------------------------------------------------------
bool smf_n10::get_sm_data(
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
const supi64_t& supi, const std::string& dnn, const snssai_t& snssai,
std::shared_ptr<session_management_subscription> subscription) {
// retrieve a UE's Session Management Subscription Data
nlohmann::json jsonData = {};
curl_global_init(CURL_GLOBAL_DEFAULT);
struct curl_slist *headers = nullptr;
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");
CURL *curl = curl_easy_init();
CURL* curl = curl_easy_init();
std::string url =
std::string(inet_ntoa(*((struct in_addr *)&smf_cfg.udm_addr.ipv4_addr))) +
std::string(inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) +
":" + std::to_string(smf_cfg.udm_addr.port) + NUDM_SDM_BASE +
smf_cfg.udm_addr.api_version +
fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
......@@ -140,12 +140,12 @@ bool smf_n10::get_sm_data(
if (static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
Logger::smf_n10().debug("Got successful response from UDM, URL: %s ",
url.c_str());
Logger::smf_n10().debug(
"Got successful response from UDM, URL: %s ", url.c_str());
try {
jsonData = nlohmann::json::parse(*httpData.get());
break;
} catch (json::exception &e) {
} catch (json::exception& e) {
Logger::smf_n10().warn("Could not parse json data from UDM");
}
numRetries++;
......@@ -174,8 +174,8 @@ bool smf_n10::get_sm_data(
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4);
std::string default_session_type =
it.value()["pduSessionTypes"]["defaultSessionType"];
Logger::smf_n10().debug("Default session type %s",
default_session_type.c_str());
Logger::smf_n10().debug(
"Default session type %s", default_session_type.c_str());
if (default_session_type.compare("IPV4") == 0) {
pdu_session_type.pdu_session_type =
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4;
......@@ -192,8 +192,8 @@ bool smf_n10::get_sm_data(
// Ssc_Mode
ssc_mode_t ssc_mode(ssc_mode_e::SSC_MODE_1);
std::string default_ssc_mode = it.value()["sscModes"]["defaultSscMode"];
Logger::smf_n10().debug("Default SSC Mode %s",
default_ssc_mode.c_str());
Logger::smf_n10().debug(
"Default SSC Mode %s", default_ssc_mode.c_str());
if (default_ssc_mode.compare("SSC_MODE_1") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode =
ssc_mode_t(ssc_mode_e::SSC_MODE_1);
......@@ -228,9 +228,9 @@ bool smf_n10::get_sm_data(
dnn_configuration->session_ambr.downlink.c_str());
subscription->insert_dnn_configuration(it.key(), dnn_configuration);
} catch (nlohmann::json::exception &e) {
Logger::smf_n10().warn("Exception message %s, exception id %d ",
e.what(), e.id);
} catch (nlohmann::json::exception& e) {
Logger::smf_n10().warn(
"Exception message %s, exception id %d ", e.what(), e.id);
return false;
}
}
......
......@@ -45,8 +45,8 @@ class smf_n10 {
public:
smf_n10();
smf_n10(smf_n10 const &) = delete;
void operator=(smf_n10 const &) = delete;
smf_n10(smf_n10 const&) = delete;
void operator=(smf_n10 const&) = delete;
/*
* Get SM subscription data from UDM
......@@ -58,7 +58,7 @@ class smf_n10 {
*
*/
bool get_sm_data(
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
const supi64_t& supi, const std::string& dnn, const snssai_t& snssai,
std::shared_ptr<session_management_subscription> subscription);
/*
......
......@@ -721,7 +721,8 @@ void smf_n11::register_nf_instance(
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n11().debug("NF Instance Registration, response from NRF, HTTP Code: %d", httpCode);
Logger::smf_n11().debug(
"NF Instance Registration, response from NRF, HTTP Code: %d", httpCode);
if (static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_CREATED) {
......@@ -729,10 +730,13 @@ void smf_n11::register_nf_instance(
try {
response_data = json::parse(*httpData.get());
} catch (json::exception& e) {
Logger::smf_n11().warn("NF Instance Registration, could not parse json from the NRF response");
Logger::smf_n11().warn(
"NF Instance Registration, could not parse json from the NRF "
"response");
}
Logger::smf_n11().debug(
"NF Instance Registration, response from NRF, json data: \n %s", response_data.dump().c_str());
"NF Instance Registration, response from NRF, json data: \n %s",
response_data.dump().c_str());
// send response to APP to process
std::shared_ptr<itti_n11_register_nf_instance_response> itti_msg =
......@@ -750,7 +754,8 @@ void smf_n11::register_nf_instance(
itti_msg->get_msg_name());
}
} else {
Logger::smf_n11().warn("NF Instance Registration, could not get response from NRF");
Logger::smf_n11().warn(
"NF Instance Registration, could not get response from NRF");
}
curl_slist_free_all(headers);
......@@ -789,7 +794,8 @@ void smf_n11::update_nf_instance(
CURLcode res = {};
struct curl_slist* headers = nullptr;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers = curl_slist_append(headers, "content-type: application/json-patch+json");
headers =
curl_slist_append(headers, "content-type: application/json-patch+json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
......@@ -815,7 +821,8 @@ void smf_n11::update_nf_instance(
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n11().debug("NF Update, response from NRF, HTTP Code: %d", httpCode);
Logger::smf_n11().debug(
"NF Update, response from NRF, HTTP Code: %d", httpCode);
if ((static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_OK) or
......@@ -894,13 +901,15 @@ void smf_n11::deregister_nf_instance(
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n11().debug("NF De-register, response from NRF, HTTP Code: %d", httpCode);
Logger::smf_n11().debug(
"NF De-register, response from NRF, HTTP Code: %d", httpCode);
if ((static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_OK) or
(static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_NO_CONTENT)) {
Logger::smf_n11().debug("NF De-register, got successful response from NRF");
Logger::smf_n11().debug(
"NF De-register, got successful response from NRF");
} else {
Logger::smf_n11().warn("NF De-register, could not get response from NRF");
......@@ -960,16 +969,19 @@ void smf_n11::subscribe_upf_status_notify(
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n11().debug("NFSubscribeNotify, response from NRF, HTTP Code: %d", httpCode);
Logger::smf_n11().debug(
"NFSubscribeNotify, response from NRF, HTTP Code: %d", httpCode);
if ((static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_CREATED) or
(static_cast<http_response_codes_e>(httpCode) ==
http_response_codes_e::HTTP_RESPONSE_CODE_NO_CONTENT)) {
Logger::smf_n11().debug("NFSubscribeNotify, got successful response from NRF");
Logger::smf_n11().debug(
"NFSubscribeNotify, got successful response from NRF");
} else {
Logger::smf_n11().warn("NFSubscribeNotify, could not get response from NRF");
Logger::smf_n11().warn(
"NFSubscribeNotify, could not get response from NRF");
}
curl_slist_free_all(headers);
......
This diff is collapsed.
......@@ -49,11 +49,11 @@ class smf_n2 {
private:
public:
smf_n2(){};
smf_n2(smf_n2 const &) = delete;
void operator=(smf_n2 const &) = delete;
smf_n2(smf_n2 const&) = delete;
void operator=(smf_n2 const&) = delete;
public:
static smf_n2 &get_instance() {
static smf_n2& get_instance() {
static smf_n2 instance;
return instance;
}
......@@ -62,8 +62,9 @@ class smf_n2 {
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
* This IE is included in N1N2MessageTransfer Request (Accept, PDU Session
* Establishment procedure - UE initiated)
* @param [pdu_session_create_sm_context_response] sm_context_res: include
* @param [pdu_session_create_sm_context_response&] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @return boolean: True if the NGAP message has been created successfully,
......@@ -71,15 +72,16 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_setup_request_transfer(
pdu_session_create_sm_context_response &sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
pdu_session_create_sm_context_response& sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
* This IE is included in PDU Session Update SM Context Response​ (Service
* Request, step 2)
* @param [pdu_session_update_sm_context_response] sm_context_res: include
* @param [pdu_session_update_sm_context_response&] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @return boolean: True if the NGAP message has been created successfully,
......@@ -87,8 +89,8 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_setup_request_transfer(
pdu_session_update_sm_context_response &sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
pdu_session_update_sm_context_response& sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
......@@ -102,8 +104,8 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_setup_request_transfer(
pdu_session_report_response &msg, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
pdu_session_report_response& msg, n2_sm_info_type_e ngap_info_type,
std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Modify Request Transfer IE
......@@ -111,6 +113,7 @@ class smf_n2 {
* Modification procedure, UE-initiated, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @return boolean: True if the NGAP message has been created successfully,
......@@ -118,8 +121,8 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_modify_request_transfer(
pdu_session_update_sm_context_response &sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
pdu_session_update_sm_context_response& sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Modify Request Transfer IE
......@@ -127,6 +130,7 @@ class smf_n2 {
* Modification procedure, SMF-requested, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @return boolean: True if the NGAP message has been created successfully,
......@@ -134,8 +138,8 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_modify_request_transfer(
pdu_session_modification_network_requested &msg,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
pdu_session_modification_network_requested& msg,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Modify Response Transfer IE
......@@ -144,18 +148,14 @@ class smf_n2 {
* necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @return boolean: True if the NGAP message has been created successfully,
* otherwise return false
*
*/
bool create_n2_pdu_session_resource_modify_response_transfer(
pdu_session_update_sm_context_response &sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
// bool
// create_n2_pdu_session_resource_modify_response_transfer(pdu_session_modification_network_requested
// &msg, n2_sm_info_type_e ngap_info_type,
// std::string &ngap_msg_str);
pdu_session_update_sm_context_response& sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Release Command Transfer IE
......@@ -165,6 +165,7 @@ class smf_n2 {
* Session Release SMF-Requested, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include
* necessary information for encoding NGAP msg
* @param [n2_sm_info_type_e] ngap_info_type: NGAP info's type
* @param [std::string&] ngap_msg_str store the created NGAP message in form
* of string
* @return boolean: True if the NGAP message has been created successfully,
......@@ -172,8 +173,8 @@ class smf_n2 {
*
*/
bool create_n2_pdu_session_resource_release_command_transfer(
pdu_session_update_sm_context_response &sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string &ngap_msg_str);
pdu_session_update_sm_context_response& sm_context_res,
n2_sm_info_type_e ngap_info_type, std::string& ngap_msg_str);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceSetupResponseTransfer
......@@ -183,8 +184,8 @@ class smf_n2 {
* @return status of the decode process
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t> &ngap_IE,
const std::string &n2_sm_info);
std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t>& ngap_IE,
const std::string& n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceModifyResponseTransfer_t
......@@ -194,8 +195,8 @@ class smf_n2 {
* @return status of the decode process
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceModifyResponseTransfer_t> &ngap_IE,
const std::string &n2_sm_info);
std::shared_ptr<Ngap_PDUSessionResourceModifyResponseTransfer_t>& ngap_IE,
const std::string& n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceReleaseResponseTransfer_t
......@@ -205,9 +206,9 @@ class smf_n2 {
* @return status of the decode process
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceReleaseResponseTransfer_t>
&ngap_IE,
const std::string &n2_sm_info);
std::shared_ptr<Ngap_PDUSessionResourceReleaseResponseTransfer_t>&
ngap_IE,
const std::string& n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceSetupUnsuccessfulTransfer
......@@ -218,9 +219,9 @@ class smf_n2 {
* @return status of the decode process
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupUnsuccessfulTransfer_t>
&ngap_IE,
const std::string &n2_sm_info);
std::shared_ptr<Ngap_PDUSessionResourceSetupUnsuccessfulTransfer_t>&
ngap_IE,
const std::string& n2_sm_info);
};
} // namespace smf
......
This diff is collapsed.
......@@ -52,74 +52,75 @@ class smf_n4 : public pfcp::pfcp_l4_stack {
public:
smf_n4();
smf_n4(smf_n4 const &) = delete;
void operator=(smf_n4 const &) = delete;
void handle_itti_msg(itti_n4_heartbeat_request &s){};
void handle_itti_msg(itti_n4_heartbeat_response &s){};
void handle_itti_msg(itti_n4_association_setup_request &s){};
void handle_itti_msg(itti_n4_association_setup_response &s){};
void handle_itti_msg(itti_n4_association_update_request &s){};
void handle_itti_msg(itti_n4_association_update_response &s){};
void handle_itti_msg(itti_n4_association_release_request &s){};
void handle_itti_msg(itti_n4_association_release_response &s){};
void handle_itti_msg(itti_n4_version_not_supported_response &s){};
void handle_itti_msg(itti_n4_node_report_response &s){};
void handle_itti_msg(itti_n4_session_set_deletion_request &s){};
void handle_itti_msg(itti_n4_session_establishment_request &s){};
void handle_itti_msg(itti_n4_session_modification_request &s){};
void handle_itti_msg(itti_n4_session_deletion_request &s){};
void handle_itti_msg(itti_n4_session_report_response &s){};
void send_n4_msg(itti_n4_heartbeat_request &s){};
void send_n4_msg(itti_n4_heartbeat_response &s){};
void send_n4_msg(itti_n4_association_setup_request &s){};
void send_n4_msg(itti_n4_association_setup_response &s);
void send_n4_msg(itti_n4_association_update_request &s){};
void send_n4_msg(itti_n4_association_update_response &s){};
void send_n4_msg(itti_n4_association_release_request &s){};
void send_n4_msg(itti_n4_association_release_response &s){};
void send_n4_msg(itti_n4_version_not_supported_response &s){};
void send_n4_msg(itti_n4_node_report_request &s){};
void send_n4_msg(itti_n4_session_set_deletion_response &s){};
void send_n4_msg(itti_n4_session_establishment_request &s);
void send_n4_msg(itti_n4_session_modification_request &s);
void send_n4_msg(itti_n4_session_deletion_request &s);
void send_n4_msg(itti_n4_session_report_response &s);
void send_association_setup_request(itti_n4_association_setup_request &i);
void send_heartbeat_request(std::shared_ptr<pfcp_association> &a);
void send_heartbeat_response(const endpoint &r_endpoint,
const uint64_t trxn_id);
void send_release_request(std::shared_ptr<pfcp_association> &a);
void handle_receive_pfcp_msg(pfcp::pfcp_msg &msg, const endpoint &r_endpoint);
void handle_receive(char *recv_buffer, const std::size_t bytes_transferred,
const endpoint &r_endpoint);
void handle_receive_heartbeat_request(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
void handle_receive_heartbeat_response(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
void handle_receive_association_setup_request(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
smf_n4(smf_n4 const&) = delete;
void operator=(smf_n4 const&) = delete;
void handle_itti_msg(itti_n4_heartbeat_request& s){};
void handle_itti_msg(itti_n4_heartbeat_response& s){};
void handle_itti_msg(itti_n4_association_setup_request& s){};
void handle_itti_msg(itti_n4_association_setup_response& s){};
void handle_itti_msg(itti_n4_association_update_request& s){};
void handle_itti_msg(itti_n4_association_update_response& s){};
void handle_itti_msg(itti_n4_association_release_request& s){};
void handle_itti_msg(itti_n4_association_release_response& s){};
void handle_itti_msg(itti_n4_version_not_supported_response& s){};
void handle_itti_msg(itti_n4_node_report_response& s){};
void handle_itti_msg(itti_n4_session_set_deletion_request& s){};
void handle_itti_msg(itti_n4_session_establishment_request& s){};
void handle_itti_msg(itti_n4_session_modification_request& s){};
void handle_itti_msg(itti_n4_session_deletion_request& s){};
void handle_itti_msg(itti_n4_session_report_response& s){};
void send_n4_msg(itti_n4_heartbeat_request& s){};
void send_n4_msg(itti_n4_heartbeat_response& s){};
void send_n4_msg(itti_n4_association_setup_request& s){};
void send_n4_msg(itti_n4_association_setup_response& s);
void send_n4_msg(itti_n4_association_update_request& s){};
void send_n4_msg(itti_n4_association_update_response& s){};
void send_n4_msg(itti_n4_association_release_request& s){};
void send_n4_msg(itti_n4_association_release_response& s){};
void send_n4_msg(itti_n4_version_not_supported_response& s){};
void send_n4_msg(itti_n4_node_report_request& s){};
void send_n4_msg(itti_n4_session_set_deletion_response& s){};
void send_n4_msg(itti_n4_session_establishment_request& s);
void send_n4_msg(itti_n4_session_modification_request& s);
void send_n4_msg(itti_n4_session_deletion_request& s);
void send_n4_msg(itti_n4_session_report_response& s);
void send_association_setup_request(itti_n4_association_setup_request& i);
void send_heartbeat_request(std::shared_ptr<pfcp_association>& a);
void send_heartbeat_response(
const endpoint& r_endpoint, const uint64_t trxn_id);
void send_release_request(std::shared_ptr<pfcp_association>& a);
void handle_receive_pfcp_msg(pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive(
char* recv_buffer, const std::size_t bytes_transferred,
const endpoint& r_endpoint);
void handle_receive_heartbeat_request(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_heartbeat_response(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_association_setup_request(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_association_setup_response(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
pfcp::pfcp_msg& msg, const endpoint& remote_endpoint);
void handle_receive_association_update_request(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
pfcp::pfcp_msg& msg, const endpoint& remote_endpoint);
void handle_receive_association_release_response(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
pfcp::pfcp_msg& msg, const endpoint& remote_endpoint);
void handle_receive_session_establishment_response(
pfcp::pfcp_msg &msg, const endpoint &r_endpoint);
void handle_receive_session_modification_response(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
void handle_receive_session_deletion_response(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
void handle_receive_session_report_request(pfcp::pfcp_msg &msg,
const endpoint &r_endpoint);
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_session_modification_response(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_session_deletion_response(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void handle_receive_session_report_request(
pfcp::pfcp_msg& msg, const endpoint& r_endpoint);
void time_out_itti_event(const uint32_t timer_id);
};
}
} // namespace smf
#endif /* FILE_SMF_N4_HPP_SEEN */
......@@ -46,14 +46,14 @@ class ipv6_pool {
prefix_len = prfix_len;
}
ipv6_pool(const ipv6_pool &p) : prefix(p.prefix), prefix_len(p.prefix_len) {}
ipv6_pool(const ipv6_pool& p) : prefix(p.prefix), prefix_len(p.prefix_len) {}
bool alloc_address(struct in6_addr &allocated) {
bool alloc_address(struct in6_addr& allocated) {
allocated = prefix;
return true;
}
void free_address(const struct in_addr &allocated) {}
void free_address(const struct in_addr& allocated) {}
};
class ipv4_pool {
......@@ -62,7 +62,7 @@ class ipv4_pool {
int num;
std::map<int, uint32_t> alloc;
bool alloc_free_bit(int &bit_pos) {
bool alloc_free_bit(int& bit_pos) {
bit_pos = 0;
for (int i = 0; i < alloc.size(); ++i) {
if (alloc[i] != std::numeric_limits<uint32_t>::max()) {
......@@ -109,11 +109,11 @@ class ipv4_pool {
}
};
ipv4_pool(const ipv4_pool &p) : num(p.num), alloc(p.alloc) {
ipv4_pool(const ipv4_pool& p) : num(p.num), alloc(p.alloc) {
start.s_addr = p.start.s_addr;
};
bool alloc_address(struct in_addr &allocated) {
bool alloc_address(struct in_addr& allocated) {
int bit_pos = 0;
if (alloc_free_bit(bit_pos)) {
allocated.s_addr = be32toh(start.s_addr) + bit_pos; // overflow
......@@ -124,7 +124,7 @@ class ipv4_pool {
return false;
}
bool free_address(const struct in_addr &allocated) {
bool free_address(const struct in_addr& allocated) {
if (in_pool(allocated)) {
int bit_pos = be32toh(allocated.s_addr) - be32toh(start.s_addr);
return free_bit(bit_pos);
......@@ -132,7 +132,7 @@ class ipv4_pool {
return false;
}
bool in_pool(const struct in_addr &a) const {
bool in_pool(const struct in_addr& a) const {
int addr_start = be32toh(start.s_addr);
int addr = be32toh(a.s_addr);
return ((addr - addr_start) < num);
......@@ -160,16 +160,17 @@ class paa_dynamic {
paa_dynamic() : ipv4_pools(), ipv6_pools(), dnns(){};
public:
static paa_dynamic &get_instance() {
static paa_dynamic& get_instance() {
static paa_dynamic instance;
return instance;
}
paa_dynamic(paa_dynamic const &) = delete;
void operator=(paa_dynamic const &) = delete;
paa_dynamic(paa_dynamic const&) = delete;
void operator=(paa_dynamic const&) = delete;
void add_pool(const std::string &dnn_label, const int pool_id,
const struct in_addr &first, const int range) {
void add_pool(
const std::string& dnn_label, const int pool_id,
const struct in_addr& first, const int range) {
if (pool_id >= 0) {
uint32_t uint32pool_id = uint32_t(pool_id);
if (!ipv4_pools.count(uint32pool_id)) {
......@@ -184,8 +185,9 @@ class paa_dynamic {
}
}
void add_pool(const std::string &dnn_label, const int pool_id,
const struct in6_addr &prefix, const int prefix_len) {
void add_pool(
const std::string& dnn_label, const int pool_id,
const struct in6_addr& prefix, const int prefix_len) {
if (pool_id >= 0) {
uint32_t uint32pool_id = uint32_t(pool_id);
if (!ipv6_pools.count(uint32pool_id)) {
......@@ -200,9 +202,9 @@ class paa_dynamic {
}
}
bool get_free_paa(const std::string &dnn_label, paa_t &paa) {
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];
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
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();
......@@ -215,8 +217,8 @@ class paa_dynamic {
"Could not get PAA PDU_SESSION_TYPE_E_IPV4 for DNN %s",
dnn_label.c_str());
return false;
} else if (paa.pdu_session_type.pdu_session_type ==
PDU_SESSION_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();
......@@ -239,8 +241,8 @@ class paa_dynamic {
"Could not get PAA PDU_SESSION_TYPE_E_IPV4V6 for DNN %s",
dnn_label.c_str());
return false;
} else if (paa.pdu_session_type.pdu_session_type ==
PDU_SESSION_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) {
......@@ -258,9 +260,9 @@ class paa_dynamic {
return false;
}
bool release_paa(const std::string &dnn_label, const paa_t &paa) {
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];
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
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();
......@@ -270,8 +272,8 @@ class paa_dynamic {
}
}
return false;
} else if (paa.pdu_session_type.pdu_session_type ==
PDU_SESSION_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();
......@@ -281,20 +283,20 @@ class paa_dynamic {
}
}
return false;
} else if (paa.pdu_session_type.pdu_session_type ==
PDU_SESSION_TYPE_E_IPV6) {
} else if (
paa.pdu_session_type.pdu_session_type == PDU_SESSION_TYPE_E_IPV6) {
return true;
}
}
Logger::smf_app().warn("Could not release PAA for DNN %s",
dnn_label.c_str());
Logger::smf_app().warn(
"Could not release PAA for DNN %s", dnn_label.c_str());
return false;
}
bool release_paa(const std::string &dnn_label,
const struct in_addr &ipv4_address) {
bool release_paa(
const std::string& dnn_label, const struct in_addr& ipv4_address) {
if (dnns.count(dnn_label)) {
dnn_dynamic_pools &dnn_pool = dnns[dnn_label];
dnn_dynamic_pools& dnn_pool = dnns[dnn_label];
for (std::vector<uint32_t>::const_iterator it4 =
dnn_pool.ipv4_pool_ids.begin();
it4 != dnn_pool.ipv4_pool_ids.end(); ++it4) {
......@@ -303,8 +305,8 @@ class paa_dynamic {
}
}
}
Logger::smf_app().warn("Could not release PAA for DNN %s",
dnn_label.c_str());
Logger::smf_app().warn(
"Could not release PAA for DNN %s", dnn_label.c_str());
return false;
}
};
......
......@@ -49,16 +49,14 @@ int smf_app::pco_push_protocol_or_container_id(
return RETURNerror;
}
pco_protocol_or_container_id_t pco_item = {};
pco_item.protocol_id =
poc_id->protocol_id;
pco_item.length_of_protocol_id_contents = poc_id->length_of_protocol_id_contents;
pco_item.protocol_id = poc_id->protocol_id;
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;
// assert(pco_item.length_of_protocol_id_contents ==
// pco_item.protocol_id_contents.size());
// pco_item.protocol_id_contents = nullptr;
pco.protocol_or_container_ids.push_back(pco_item);
pco.num_protocol_or_container_id += 1;
return RETURNok;
......
This diff is collapsed.
......@@ -61,7 +61,7 @@ class pfcp_association {
timer_id_t timer_association;
timer_id_t timer_graceful_release;
explicit pfcp_association(const pfcp::node_id_t &node_id)
explicit pfcp_association(const pfcp::node_id_t& node_id)
: node_id(node_id),
recovery_time_stamp(),
function_features(),
......@@ -75,8 +75,9 @@ class pfcp_association {
timer_association = ITTI_INVALID_TIMER_ID;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
}
pfcp_association(const pfcp::node_id_t &node_id,
pfcp::recovery_time_stamp_t &recovery_time_stamp)
pfcp_association(
const pfcp::node_id_t& node_id,
pfcp::recovery_time_stamp_t& recovery_time_stamp)
: node_id(node_id),
recovery_time_stamp(recovery_time_stamp),
function_features(),
......@@ -90,8 +91,9 @@ class pfcp_association {
is_restore_sessions_pending = false;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
}
pfcp_association(const pfcp::node_id_t &ni, pfcp::recovery_time_stamp_t &rts,
pfcp::up_function_features_s &uff)
pfcp_association(
const pfcp::node_id_t& ni, pfcp::recovery_time_stamp_t& rts,
pfcp::up_function_features_s& uff)
: node_id(ni), recovery_time_stamp(rts), m_sessions(), sessions() {
hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
function_features.first = true;
......@@ -103,7 +105,7 @@ class pfcp_association {
timer_association = ITTI_INVALID_TIMER_ID;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
}
pfcp_association(pfcp_association const &p)
pfcp_association(pfcp_association const& p)
: node_id(p.node_id),
hash_node_id(p.hash_node_id),
recovery_time_stamp(p.recovery_time_stamp),
......@@ -115,12 +117,12 @@ class pfcp_association {
timer_association(0),
timer_graceful_release(0) {}
void notify_add_session(const pfcp::fseid_t &cp_fseid);
bool has_session(const pfcp::fseid_t &cp_fseid);
void notify_del_session(const pfcp::fseid_t &cp_fseid);
void notify_add_session(const pfcp::fseid_t& cp_fseid);
bool has_session(const pfcp::fseid_t& cp_fseid);
void notify_del_session(const pfcp::fseid_t& cp_fseid);
void del_sessions();
void restore_n4_sessions();
void set(const pfcp::up_function_features_s &ff) {
void set(const pfcp::up_function_features_s& ff) {
function_features.first = true;
function_features.second = ff;
};
......@@ -144,46 +146,51 @@ class pfcp_associations {
pfcp_associations()
: associations(PFCP_MAX_ASSOCIATIONS), pending_associations(){};
void trigger_heartbeat_request_procedure(
std::shared_ptr<pfcp_association> &s);
std::shared_ptr<pfcp_association>& s);
public:
static pfcp_associations &get_instance() {
static pfcp_associations& get_instance() {
static pfcp_associations instance;
return instance;
}
pfcp_associations(pfcp_associations const &) = delete;
void operator=(pfcp_associations const &) = delete;
bool add_association(pfcp::node_id_t &node_id,
pfcp::recovery_time_stamp_t &recovery_time_stamp,
bool &restore_n4_sessions);
bool add_association(pfcp::node_id_t &node_id,
pfcp::recovery_time_stamp_t &recovery_time_stamp,
pfcp::up_function_features_s &function_features,
bool &restore_n4_sessions);
bool update_association(pfcp::node_id_t &node_id,
pfcp::up_function_features_s &function_features);
bool get_association(const pfcp::node_id_t &node_id,
std::shared_ptr<pfcp_association> &sa) const;
bool get_association(const pfcp::fseid_t &cp_fseid,
std::shared_ptr<pfcp_association> &sa) const;
void notify_add_session(const pfcp::node_id_t &node_id,
const pfcp::fseid_t &cp_fseid);
void notify_del_session(const pfcp::fseid_t &cp_fseid);
void restore_n4_sessions(const pfcp::node_id_t &node_id);
pfcp_associations(pfcp_associations const&) = delete;
void operator=(pfcp_associations const&) = delete;
bool add_association(
pfcp::node_id_t& node_id,
pfcp::recovery_time_stamp_t& recovery_time_stamp,
bool& restore_n4_sessions);
bool add_association(
pfcp::node_id_t& node_id,
pfcp::recovery_time_stamp_t& recovery_time_stamp,
pfcp::up_function_features_s& function_features,
bool& restore_n4_sessions);
bool update_association(
pfcp::node_id_t& node_id,
pfcp::up_function_features_s& function_features);
bool get_association(
const pfcp::node_id_t& node_id,
std::shared_ptr<pfcp_association>& sa) const;
bool get_association(
const pfcp::fseid_t& cp_fseid,
std::shared_ptr<pfcp_association>& sa) const;
void notify_add_session(
const pfcp::node_id_t& node_id, const pfcp::fseid_t& cp_fseid);
void notify_del_session(const pfcp::fseid_t& cp_fseid);
void restore_n4_sessions(const pfcp::node_id_t& node_id);
void initiate_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user);
void timeout_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user);
void timeout_release_request(timer_id_t timer_id, uint64_t arg2_user);
void handle_receive_heartbeat_response(const uint64_t trxn_id);
bool select_up_node(pfcp::node_id_t &node_id,
const int node_selection_criteria);
bool add_peer_candidate_node(const pfcp::node_id_t &node_id);
bool select_up_node(
pfcp::node_id_t& node_id, const int node_selection_criteria);
bool add_peer_candidate_node(const pfcp::node_id_t& node_id);
};
}
} // namespace smf
#endif /* FILE_SMF_PFCP_ASSOCIATION_HPP_SEEN */
This diff is collapsed.
......@@ -62,11 +62,14 @@ class smf_procedure {
explicit smf_procedure(uint64_t tx) { trxn_id = tx; }
virtual ~smf_procedure() {}
virtual itti_msg_type_t get_procedure_type() { return ITTI_MSG_TYPE_NONE; }
virtual void handle_itti_msg(itti_n4_session_establishment_response &resp,
virtual void handle_itti_msg(
itti_n4_session_establishment_response& resp,
std::shared_ptr<smf::smf_context> pc) {}
virtual void handle_itti_msg(itti_n4_session_modification_response &resp,
virtual void handle_itti_msg(
itti_n4_session_modification_response& resp,
std::shared_ptr<smf::smf_context> pc) {}
virtual void handle_itti_msg(itti_n4_session_deletion_response &resp,
virtual void handle_itti_msg(
itti_n4_session_deletion_response& resp,
std::shared_ptr<smf::smf_context> pc) {}
};
......@@ -77,7 +80,7 @@ class smf_pdu_session;
class n4_session_restore_procedure : public smf_procedure {
public:
explicit n4_session_restore_procedure(
std::set<pfcp::fseid_t> &sessions2restore)
std::set<pfcp::fseid_t>& sessions2restore)
: smf_procedure(),
pending_sessions(sessions2restore),
restored_sessions() {
......@@ -94,7 +97,7 @@ class n4_session_restore_procedure : public smf_procedure {
class session_create_sm_context_procedure : public smf_procedure {
public:
explicit session_create_sm_context_procedure(
std::shared_ptr<smf_pdu_session> &ps)
std::shared_ptr<smf_pdu_session>& ps)
: smf_procedure(),
sps(ps),
n4_triggered(),
......@@ -108,7 +111,8 @@ class session_create_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc: smf context
* @return
*/
int run(std::shared_ptr<itti_n11_create_sm_context_request> req,
int run(
std::shared_ptr<itti_n11_create_sm_context_request> req,
std::shared_ptr<itti_n11_create_sm_context_response> resp,
std::shared_ptr<smf::smf_context> sc);
......@@ -118,7 +122,8 @@ class session_create_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc smf context
* @return void
*/
void handle_itti_msg(itti_n4_session_establishment_response &resp,
void handle_itti_msg(
itti_n4_session_establishment_response& resp,
std::shared_ptr<smf::smf_context> sc);
std::shared_ptr<itti_n4_session_establishment_request> n4_triggered;
......@@ -132,7 +137,7 @@ class session_create_sm_context_procedure : public smf_procedure {
class session_update_sm_context_procedure : public smf_procedure {
public:
explicit session_update_sm_context_procedure(
std::shared_ptr<smf_pdu_session> &ps)
std::shared_ptr<smf_pdu_session>& ps)
: smf_procedure(),
sps(ps),
n4_triggered(),
......@@ -147,7 +152,8 @@ class session_update_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc: smf context
* @return
*/
int run(std::shared_ptr<itti_n11_update_sm_context_request> req,
int run(
std::shared_ptr<itti_n11_update_sm_context_request> req,
std::shared_ptr<itti_n11_update_sm_context_response> resp,
std::shared_ptr<smf::smf_context> sc);
......@@ -157,7 +163,8 @@ class session_update_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc smf context
* @return void
*/
void handle_itti_msg(itti_n4_session_modification_response &resp,
void handle_itti_msg(
itti_n4_session_modification_response& resp,
std::shared_ptr<smf::smf_context> sc);
std::shared_ptr<itti_n4_session_modification_request> n4_triggered;
......@@ -172,7 +179,7 @@ class session_update_sm_context_procedure : public smf_procedure {
class session_release_sm_context_procedure : public smf_procedure {
public:
explicit session_release_sm_context_procedure(
std::shared_ptr<smf_pdu_session> &ps)
std::shared_ptr<smf_pdu_session>& ps)
: smf_procedure(),
sps(ps),
n4_triggered(),
......@@ -186,7 +193,8 @@ class session_release_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc: smf context
* @return
*/
int run(std::shared_ptr<itti_n11_release_sm_context_request> req,
int run(
std::shared_ptr<itti_n11_release_sm_context_request> req,
std::shared_ptr<itti_n11_release_sm_context_response> resp,
std::shared_ptr<smf::smf_context> sc);
......@@ -196,7 +204,8 @@ class session_release_sm_context_procedure : public smf_procedure {
* @param [std::shared_ptr<smf::smf_context>] sc smf context
* @return void
*/
void handle_itti_msg(itti_n4_session_deletion_response &resp,
void handle_itti_msg(
itti_n4_session_deletion_response& resp,
std::shared_ptr<smf::smf_context> sc);
std::shared_ptr<itti_n4_session_deletion_request> n4_triggered;
......
......@@ -36,5 +36,5 @@
using namespace smf;
extern smf::smf_app *smf_app_inst;
extern itti_mw *itti_inst;
extern smf::smf_app* smf_app_inst;
extern itti_mw* itti_inst;
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