Commit 61ae53a0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Avoid raw pointer

parent 515cdc7e
......@@ -587,24 +587,30 @@ void smf_app::handle_itti_msg(
return;
}
itti_n4_session_failure_indication* itti_n4 =
new itti_n4_session_failure_indication(TASK_SMF_APP, TASK_SMF_N4);
itti_n4->seid = m.seid;
itti_n4->trxn_id = m.trxn_id;
itti_n4->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
/* itti_n4_session_failure_indication* itti_n4 =
new itti_n4_session_failure_indication(TASK_SMF_APP,
TASK_SMF_N4); itti_n4->seid = m.seid; itti_n4->trxn_id =
m.trxn_id; itti_n4->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
std::shared_ptr<itti_n4_session_failure_indication>
itti_n4_failure_indication =
std::shared_ptr<itti_n4_session_failure_indication>(itti_n4);
std::make_shared<itti_n4_session_failure_indication>(
TASK_SMF_APP, TASK_SMF_N4);
itti_n4_failure_indication->seid = m.seid;
itti_n4_failure_indication->trxn_id = m.trxn_id;
itti_n4_failure_indication->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name());
itti_n4_failure_indication->get_msg_name());
int ret = itti_inst->send_msg(itti_n4_failure_indication);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name());
itti_n4_failure_indication->get_msg_name());
return;
}
}
......@@ -864,7 +870,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// authorization by the external DN
// Step 3. check if the DNN requested is valid
std::string nd_dnn;
std::string nd_dnn = {};
util::dotted_to_string(dnn, nd_dnn);
dnn = nd_dnn;
// Update DNN
......@@ -1027,7 +1033,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
"version %d)",
smreq->http_version);
// Step 1. Get supi, dnn, nssai, pdu_session id from sm_context
// Step 1. Get SUPI, DNN, NSSAI, PDU Session ID from sm_context
// SM Context ID - uint32_t in our case
scid_t scid = {};
try {
......@@ -1058,7 +1064,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
return;
}
// Step 2. Store supi, dnn, nssai in itti_n11_update_sm_context_request to be
// Step 2. Store SUPI, DNN, NSSAI in itti_n11_update_sm_context_request to be
// processed later on
supi64_t supi64 = smf_supi_to_u64(scf.get()->supi);
smreq->req.set_supi(scf.get()->supi);
......@@ -1110,7 +1116,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
scf.get()->target_amf = smreq.get()->req.get_target_serving_nf_id();
}
// Step 7. handle the message in smf_context
// Step 7. Handle the message in smf_context
if (!sc.get()->handle_pdu_session_update_sm_context_request(smreq)) {
Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't process!");
......@@ -1668,7 +1674,7 @@ bool smf_app::get_session_management_subscription_data(
const supi64_t& supi, const std::string& dnn, const snssai_t& snssai,
std::shared_ptr<session_management_subscription> subscription) {
Logger::smf_app().debug(
"Get Session Management Subscription from configuration file");
"Get Session Management Subscription from the configuration file");
std::shared_ptr<dnn_configuration_t> dnn_configuration =
std::make_shared<dnn_configuration_t>();
......@@ -1703,7 +1709,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration->pdu_session_types.default_session_type =
pdu_session_type;
// Ssc_Mode
// SSC_Mode
dnn_configuration->ssc_modes.default_ssc_mode.ssc_mode =
smf_cfg.session_management_subscription[i].ssc_mode;
......@@ -1722,7 +1728,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration->_5g_qos_profile.priority_level =
smf_cfg.session_management_subscription[i].default_qos.priority_level;
// session_ambr
// Session_ambr
dnn_configuration->session_ambr.uplink =
smf_cfg.session_management_subscription[i].session_ambr.uplink;
dnn_configuration->session_ambr.downlink =
......
This diff is collapsed.
......@@ -610,14 +610,21 @@ void smf_n4::handle_receive_session_establishment_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) {
itti_n4_session_establishment_response* itti_msg =
new itti_n4_session_establishment_response(TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
/* itti_n4_session_establishment_response* itti_msg =
new itti_n4_session_establishment_response(TASK_SMF_N4,
TASK_SMF_APP); itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std::shared_ptr<itti_n4_session_establishment_response> i =
std::shared_ptr<itti_n4_session_establishment_response>(itti_msg);
std::make_shared<itti_n4_session_establishment_response>(
TASK_SMF_N4, TASK_SMF_APP);
i->pfcp_ies = msg_ies_container;
i->r_endpoint = remote_endpoint;
i->trxn_id = trxn_id;
i->seid = msg.get_seid();
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) {
Logger::smf_n4().error(
......@@ -638,19 +645,28 @@ void smf_n4::handle_receive_session_modification_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) {
itti_n4_session_modification_response* itti_msg =
new itti_n4_session_modification_response(TASK_SMF_N4, TASK_SMF_APP);
/* itti_n4_session_modification_response* itti_msg =
new itti_n4_session_modification_response(TASK_SMF_N4,
TASK_SMF_APP); itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std::shared_ptr<itti_n4_session_modification_response> itti_msg =
std::make_shared<itti_n4_session_modification_response>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_modification_response> i =
std::shared_ptr<itti_n4_session_modification_response>(itti_msg);
int ret = itti_inst->send_msg(i);
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name());
itti_msg->get_msg_name());
}
}
// else ignore
......@@ -666,19 +682,28 @@ void smf_n4::handle_receive_session_deletion_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) {
itti_n4_session_deletion_response* itti_msg =
/* itti_n4_session_deletion_response* itti_msg =
new itti_n4_session_deletion_response(TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_deletion_response> i =
std::shared_ptr<itti_n4_session_deletion_response>(itti_msg);
int ret = itti_inst->send_msg(i);
*/
std::shared_ptr<itti_n4_session_deletion_response> itti_msg =
std::make_shared<itti_n4_session_deletion_response>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name());
itti_msg->get_msg_name());
}
}
// else ignore
......@@ -694,19 +719,26 @@ void smf_n4::handle_receive_session_report_request(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) {
itti_n4_session_report_request* itti_msg =
/* itti_n4_session_report_request* itti_msg =
new itti_n4_session_report_request(TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_report_request> i =
std::shared_ptr<itti_n4_session_report_request>(itti_msg);
int ret = itti_inst->send_msg(i);
*/
std::shared_ptr<itti_n4_session_report_request> itti_msg =
std::make_shared<itti_n4_session_report_request>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name());
itti_msg->get_msg_name());
}
}
// else ignore
......
......@@ -106,8 +106,6 @@ int session_create_sm_context_procedure::run(
snssai_t snssai = sm_context_req->req.get_snssai();
std::string dnn = sm_context_req->req.get_dnn();
// if (not pfcp_associations::get_instance().select_up_node(
// up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, snssai, dnn)) {
sm_context_resp->res.set_cause(
......@@ -132,19 +130,27 @@ int session_create_sm_context_procedure::run(
n11_triggered_pending = sm_context_resp;
uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid);
/*
itti_n4_session_establishment_request* n4_ser =
new itti_n4_session_establishment_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = 0;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
n4_triggered = std::shared_ptr<itti_n4_session_establishment_request>(n4_ser);
*/
n4_triggered = std::make_shared<itti_n4_session_establishment_request>(
TASK_SMF_APP, TASK_SMF_N4);
n4_triggered->seid = 0;
n4_triggered->trxn_id = this->trxn_id;
n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
//-------------------
// IE node_id_t
//-------------------
pfcp::node_id_t node_id = {};
smf_cfg.get_pfcp_node_id(node_id);
n4_ser->pfcp_ies.set(node_id);
n4_triggered->pfcp_ies.set(node_id);
//-------------------
// IE fseid_t
......@@ -152,7 +158,7 @@ int session_create_sm_context_procedure::run(
pfcp::fseid_t cp_fseid = {};
smf_cfg.get_pfcp_fseid(cp_fseid);
cp_fseid.seid = sps->seid;
n4_ser->pfcp_ies.set(cp_fseid);
n4_triggered->pfcp_ies.set(cp_fseid);
//*******************
// UPLINK
......@@ -266,8 +272,8 @@ int session_create_sm_context_procedure::run(
//-------------------
// ADD IEs to message
//-------------------
n4_ser->pfcp_ies.set(create_pdr);
n4_ser->pfcp_ies.set(create_far);
n4_triggered->pfcp_ies.set(create_pdr);
n4_triggered->pfcp_ies.set(create_far);
// TODO: verify whether N4 SessionID should be included in PDR and FAR
// (Section 5.8.2.11@3GPP TS 23.501)
......@@ -301,12 +307,13 @@ int session_create_sm_context_procedure::run(
smf_app_inst->set_seid_2_smf_context(cp_fseid.seid, sc);
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name());
"Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name());
n4_triggered->get_msg_name());
return RETURNerror;
}
......@@ -386,8 +393,10 @@ void session_create_sm_context_procedure::handle_itti_msg(
// fill content for N1N2MessageTransfer (including N1, N2 SM)
// Create N1 SM container & N2 SM Information
std::string n1_sm_msg, n1_sm_msg_hex;
std::string n2_sm_info, n2_sm_info_hex;
std::string n1_sm_msg = {};
std::string n1_sm_msg_hex = {};
std::string n2_sm_info = {};
std::string n2_sm_info_hex = {};
if (n11_triggered_pending->res.get_cause() !=
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) {
......@@ -436,14 +445,11 @@ void session_create_sm_context_procedure::handle_itti_msg(
}
// Fill N1N2MesasgeTransferRequestData
// get supi and put into URL
// get SUPI and put into URL
supi_t supi = n11_triggered_pending->res.get_supi();
std::string supi_str = n11_triggered_pending->res.get_supi_prefix() + "-" +
smf_supi_to_string(supi);
std::string url =
// std::string(inet_ntoa(*((struct in_addr*)
// &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NAMF_COMMUNICATION_BASE +
"http://" + sps.get()->get_amf_addr() + NAMF_COMMUNICATION_BASE +
smf_cfg.amf_addr.api_version +
fmt::format(
......@@ -477,9 +483,6 @@ void session_create_sm_context_procedure::handle_itti_msg(
// N1N2MsgTxfrFailureNotification
std::string callback_uri =
// std::string(
// inet_ntoa(*((struct in_addr*) &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NSMF_PDU_SESSION_BASE +
sps.get()->get_amf_addr() + NSMF_PDU_SESSION_BASE +
smf_cfg.sbi_api_version +
fmt::format(
......@@ -555,12 +558,20 @@ int session_update_sm_context_procedure::run(
n11_triggered_pending = sm_context_resp;
uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid);
itti_n4_session_modification_request* n4_ser =
/* itti_n4_session_modification_request* n4_ser =
new itti_n4_session_modification_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = sps->up_fseid.seid;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
n4_triggered = std::shared_ptr<itti_n4_session_modification_request>(n4_ser);
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
n4_triggered = std::make_shared<itti_n4_session_modification_request>(
TASK_SMF_APP, TASK_SMF_N4);
n4_triggered->seid = sps->up_fseid.seid;
n4_triggered->trxn_id = this->trxn_id;
n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
// qos Flow to be modified
pdu_session_update_sm_context_request sm_context_req_msg =
......@@ -648,7 +659,7 @@ int session_update_sm_context_procedure::run(
// of a first DL packet
update_far.set(apply_action);
n4_ser->pfcp_ies.set(update_far);
n4_triggered->pfcp_ies.set(update_far);
send_n4 = true;
flow.far_id_dl.first = true;
......@@ -695,7 +706,7 @@ int session_update_sm_context_procedure::run(
create_far.set(forwarding_parameters);
// Add IEs to message
n4_ser->pfcp_ies.set(create_far);
n4_triggered->pfcp_ies.set(create_far);
send_n4 = true;
......@@ -764,7 +775,7 @@ int session_update_sm_context_procedure::run(
create_pdr.set(far_id);
// Add IEs to message
n4_ser->pfcp_ies.set(create_pdr);
n4_triggered->pfcp_ies.set(create_pdr);
send_n4 = true;
......@@ -788,7 +799,7 @@ int session_update_sm_context_procedure::run(
apply_action.forw = 1;
update_far.set(apply_action);
n4_ser->pfcp_ies.set(update_far);
n4_triggered->pfcp_ies.set(update_far);
send_n4 = true;
......@@ -825,7 +836,7 @@ int session_update_sm_context_procedure::run(
update_pdr.set(flow.far_id_dl.second);
// Add IEs to message
n4_ser->pfcp_ies.set(update_pdr);
n4_triggered->pfcp_ies.set(update_pdr);
send_n4 = true;
Logger::smf_app().debug(
......@@ -884,7 +895,7 @@ int session_update_sm_context_procedure::run(
far.set(far_id);
far.set(apply_action);
// Add IEs to message
n4_ser->pfcp_ies.set(far);
n4_triggered->pfcp_ies.set(far);
send_n4 = true;
......@@ -906,7 +917,7 @@ int session_update_sm_context_procedure::run(
far.set(far_id);
far.set(apply_action);
// Add IEs to message
n4_ser->pfcp_ies.set(far);
n4_triggered->pfcp_ies.set(far);
send_n4 = true;
}
......@@ -925,12 +936,13 @@ int session_update_sm_context_procedure::run(
if (send_n4) {
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name());
"Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name());
n4_triggered->get_msg_name());
return RETURNerror;
}
} else {
......@@ -1406,20 +1418,29 @@ int session_release_sm_context_procedure::run(
n11_triggered_pending = sm_context_res;
uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid);
itti_n4_session_deletion_request* n4_ser =
/* itti_n4_session_deletion_request* n4_ser =
new itti_n4_session_deletion_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = sps->up_fseid.seid;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
n4_triggered = std::shared_ptr<itti_n4_session_deletion_request>(n4_ser);
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
n4_triggered = std::make_shared<itti_n4_session_deletion_request>(
TASK_SMF_APP, TASK_SMF_N4);
n4_triggered->seid = sps->up_fseid.seid;
n4_triggered->trxn_id = this->trxn_id;
n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name());
"Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name());
n4_triggered->get_msg_name());
return RETURNerror;
}
return RETURNok;
......
......@@ -260,9 +260,14 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json["cause"].dump().c_str());
// Send response to APP to process
itti_n11_n1n2_message_transfer_response_status* itti_msg =
/* itti_n11_n1n2_message_transfer_response_status* itti_msg =
new itti_n11_n1n2_message_transfer_response_status(
TASK_SMF_SBI, TASK_SMF_APP);
*/
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> itti_msg =
std::make_shared<itti_n11_n1n2_message_transfer_response_status>(
TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->set_response_code(response_code);
itti_msg->set_scid(sm_context_res->scid);
itti_msg->set_procedure_type(session_management_procedures_type_e::
......@@ -274,13 +279,12 @@ void smf_sbi::send_n1n2_message_transfer_request(
} else {
itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_REJECT);
}
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> i =
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status>(itti_msg);
int ret = itti_inst->send_msg(i);
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_sbi().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name());
itti_msg->get_msg_name());
}
return;
}
......@@ -421,9 +425,14 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json["cause"].dump().c_str());
// Send response to APP to process
itti_n11_n1n2_message_transfer_response_status* itti_msg =
/* itti_n11_n1n2_message_transfer_response_status* itti_msg =
new itti_n11_n1n2_message_transfer_response_status(
TASK_SMF_SBI, TASK_SMF_APP);
*/
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> itti_msg =
std::make_shared<itti_n11_n1n2_message_transfer_response_status>(
TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->set_response_code(httpCode);
itti_msg->set_procedure_type(
session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED);
......@@ -431,13 +440,11 @@ void smf_sbi::send_n1n2_message_transfer_request(
itti_msg->set_seid(report_msg->res.get_seid());
itti_msg->set_trxn_id(report_msg->res.get_trxn_id());
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> i =
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status>(itti_msg);
int ret = itti_inst->send_msg(i);
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_sbi().error(
"Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name());
itti_msg->get_msg_name());
}
}
......
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