Commit c11a93f1 authored by gauthier's avatar gauthier

initial step for Paging

parent 0038fb32
......@@ -267,12 +267,12 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
// return ie;
// }
// break;
// case PFCP_IE_REPORT_TYPE: {
// pfcp_report_type_ie *ie = new pfcp_report_type_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_REPORT_TYPE: {
pfcp_report_type_ie *ie = new pfcp_report_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case PFCP_IE_OFFENDING_IE: {
pfcp_offending_ie_ie *ie = new pfcp_offending_ie_ie(tlv);
ie->load_from(is);
......@@ -531,12 +531,12 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
// return ie;
// }
// break;
// case PFCP_IE_DOWNLINK_DATA_REPORT: {
// pfcp_downlink_data_report_ie *ie = new pfcp_downlink_data_report_ie(tlv);
// ie->load_from(is);
// return ie;
// }
// break;
case PFCP_IE_DOWNLINK_DATA_REPORT: {
pfcp_downlink_data_report_ie *ie = new pfcp_downlink_data_report_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case PFCP_IE_OUTER_HEADER_CREATION: {
pfcp_outer_header_creation_ie *ie = new pfcp_outer_header_creation_ie(tlv);
ie->load_from(is);
......@@ -970,11 +970,11 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
// }
// break;
default:
Logger::pfcp().error("Unknown GTP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
Logger::pfcp().error("Unknown PFCP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
return nullptr;
}
} else {
Logger::pfcp().error("GTP IE type %d length %d", tlv.get_type(), tlv.get_length());
Logger::pfcp().error("PFCP IE type %d length %d", tlv.get_type(), tlv.get_length());
return nullptr;
}
}
......@@ -1027,6 +1027,23 @@ pfcp_msg::pfcp_msg(const pfcp_association_release_response& pfcp_ies) : pfcp_msg
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_node_report_request& pfcp_ies) : pfcp_msg_header() {
ies = {};
set_message_type(PFCP_NODE_REPORT_REQUEST);
std::pair<bool, pfcp::node_id_t> node_id;
std::pair<bool, pfcp::node_report_type_t> node_report_type;
// TODO LATER std::pair<bool, pfcp::user_plane_path_failure_report> user_plane_path_failure_report;
if (pfcp_ies.node_id.first) {std::shared_ptr<pfcp_node_id_ie> sie(new pfcp_node_id_ie(pfcp_ies.node_id.second)); add_ie(sie);}
if (pfcp_ies.node_report_type.first) {std::shared_ptr<pfcp_node_report_type_ie> sie(new pfcp_node_report_type_ie(pfcp_ies.node_report_type.second)); add_ie(sie);}
// TODO LATER if (pfcp_ies.user_plane_path_failure_report.first) {
// std::shared_ptr<pfcp_user_plane_path_failure_report_ie>
// sie(new pfcp_user_plane_path_failure_report_ie(pfcp_ies.user_plane_path_failure_report.second));
// add_ie(sie);
//}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_establishment_request& pfcp_ies) : pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_ESTABLISHMENT_REQUEST);
......@@ -1188,7 +1205,26 @@ pfcp_msg::pfcp_msg(const pfcp_session_deletion_response& pfcp_ies) : pfcp_msg_he
//if (pfcp_ies.overload_control_information.first) {std::shared_ptr<pfcp_overload_control_information_ie> sie(new pfcp_overload_control_information_ie(pfcp_ies.overload_control_information.second)); add_ie(sie);}
//if (pfcp_ies.usage_report_information.first) {std::shared_ptr<pfcp_usage_report_within_session_deletion_response_ie> sie(new pfcp_usage_report_within_session_deletion_response_ie(pfcp_ies.additional_usage_reports_information.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_report_request& pfcp_ies) : pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_REPORT_REQUEST);
if (pfcp_ies.report_type.first) {std::shared_ptr<pfcp_report_type_ie> sie(new pfcp_report_type_ie(pfcp_ies.report_type.second)); add_ie(sie);}
if (pfcp_ies.downlink_data_report.first) {std::shared_ptr<pfcp_downlink_data_report_ie> sie(new pfcp_downlink_data_report_ie(pfcp_ies.downlink_data_report.second)); add_ie(sie);}
//TODO std::pair<bool, pfcp::usage_report_within_pfcp_session_report_request> usage_report;
//TODO std::pair<bool, pfcp::error_indication_report> error_indication_report;
//TODO std::pair<bool, pfcp::load_control_information> load_control_information;
//TODO std::pair<bool, pfcp::overload_control_information> overload_control_information;
//TODO std::pair<bool, pfcp::additional_usage_reports_information_t> additional_usage_reports_information;
}
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_report_response& pfcp_ies) : pfcp_msg_header() {
ies = {};
set_message_type(PFCP_SESSION_REPORT_REQUEST);
if (pfcp_ies.cause.first) {std::shared_ptr<pfcp_cause_ie> sie(new pfcp_cause_ie(pfcp_ies.cause.second)); add_ie(sie);}
if (pfcp_ies.offending_ie.first) {std::shared_ptr<pfcp_offending_ie_ie> sie(new pfcp_offending_ie_ie(pfcp_ies.offending_ie.second)); add_ie(sie);}
// TODO if (pfcp_ies.update_bar.first) {std::shared_ptr<pfcp_update_bar_within_pfcp_session_report_response_ie> sie(new pfcp_update_bar_within_pfcp_session_report_response_ie(pfcp_ies.update_bar.second)); add_ie(sie);}
// TODO SPEC std::pair<bool, pfcp::sxsrrsp_flags_t> sxsrrsp_flags;
}
......@@ -333,7 +333,7 @@ public:
explicit pfcp_msg(const pfcp_association_release_request& pfcp_ies);
explicit pfcp_msg(const pfcp_association_release_response& pfcp_ies);
// pfcp_msg(const pfcp_version_not_supported_response& pfcp_ies);
// pfcp_msg(const pfcp_node_report_request& pfcp_ies);
pfcp_msg(const pfcp_node_report_request& pfcp_ies);
// pfcp_msg(const pfcp_node_report_response& pfcp_ies);
explicit pfcp_msg(const pfcp_session_establishment_request& pfcp_ies);
explicit pfcp_msg(const pfcp_session_establishment_response& pfcp_ies);
......@@ -341,8 +341,8 @@ public:
explicit pfcp_msg(const pfcp_session_modification_response& pfcp_ies);
explicit pfcp_msg(const pfcp_session_deletion_request& pfcp_ies);
explicit pfcp_msg(const pfcp_session_deletion_response& pfcp_ies);
// pfcp_msg(const pfcp_session_report_request& pfcp_ies);
// pfcp_msg(const pfcp_session_report_response& pfcp_ies);
explicit pfcp_msg(const pfcp_session_report_request& pfcp_ies);
explicit pfcp_msg(const pfcp_session_report_response& pfcp_ies);
~pfcp_msg() {
ies.clear();
......@@ -1898,50 +1898,66 @@ public:
// s.set(redirect_information);
// }
//};
////-------------------------------------
//// IE REPORT_TYPE
//class pfcp_report_type_ie : public pfcp_ie {
//public:
// uint8_t todo;
//
// //--------
// pfcp_report_type_ie(const pfcp::report_type_t& b) : pfcp_ie(PFCP_IE_REPORT_TYPE){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_report_type_ie() : pfcp_ie(PFCP_IE_REPORT_TYPE){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_report_type_ie(const pfcp_tlv& t) : pfcp_ie(t) {
// todo = 0;
// };
// //--------
// void to_core_type(pfcp::report_type_t& b) {
// b.todo = todo;
// }
// //--------
// void dump_to(std::ostream& os) {
// tlv.dump_to(os);
// os.write(reinterpret_cast<const char*>(&todo), sizeof(todo));
// }
// //--------
// void load_from(std::istream& is) {
// //tlv.load_from(is);
// if (tlv.get_length() != 1) {
// throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
// }
// is.read(reinterpret_cast<char*>(&todo), sizeof(todo));
// }
// //--------
// void to_core_type(pfcp_ies_container& s) {
// pfcp::report_type_t report_type = {};
// to_core_type(report_type);
// s.set(report_type);
// }
//};
//-------------------------------------
// IE REPORT_TYPE
class pfcp_report_type_ie : public pfcp_ie {
public:
union {
struct {
uint8_t dldr :1;
uint8_t usar :1;
uint8_t erir :1;
uint8_t upir :1;
uint8_t spare :4;
} bf;
uint8_t b;
} u1;
//--------
pfcp_report_type_ie(const pfcp::report_type_t& b) : pfcp_ie(PFCP_IE_REPORT_TYPE){
u1.b = 0;
u1.bf.dldr = b.dldr;
u1.bf.usar = b.usar;
u1.bf.erir = b.erir;
u1.bf.upir = b.upir;
tlv.set_length(1);
}
//--------
pfcp_report_type_ie() : pfcp_ie(PFCP_IE_REPORT_TYPE){
u1.b = 0;
tlv.set_length(1);
}
//--------
pfcp_report_type_ie(const pfcp_tlv& t) : pfcp_ie(t) {
u1.b = 0;
};
//--------
void to_core_type(pfcp::report_type_t& b) {
b.dldr = u1.bf.dldr;
b.usar = u1.bf.usar;
b.erir = u1.bf.erir;
b.upir = u1.bf.upir;
}
//--------
void dump_to(std::ostream& os) {
tlv.dump_to(os);
os.write(reinterpret_cast<const char*>(&u1.b), sizeof(u1.b));
}
//--------
void load_from(std::istream& is) {
//tlv.load_from(is);
if (tlv.get_length() != 1) {
throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
}
is.read(reinterpret_cast<char*>(&u1.b), sizeof(u1.b));
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::report_type_t report_type = {};
to_core_type(report_type);
s.set(report_type);
}
};
//-------------------------------------
// IE OFFENDING_IE
class pfcp_offending_ie_ie : public pfcp_ie {
......@@ -4065,49 +4081,34 @@ public:
// }
//};
////-------------------------------------
//// IE DOWNLINK_DATA_REPORT
//class pfcp_downlink_data_report_ie : public pfcp_ie {
//public:
// uint8_t todo;
//
// //--------
// pfcp_downlink_data_report_ie(const pfcp::downlink_data_report& b) : pfcp_ie(PFCP_IE_DOWNLINK_DATA_REPORT){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_downlink_data_report_ie() : pfcp_ie(PFCP_IE_DOWNLINK_DATA_REPORT){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_downlink_data_report_ie(const pfcp_tlv& t) : pfcp_ie(t) {
// todo = 0;
// };
// //--------
// void to_core_type(pfcp::downlink_data_report& b) {
// b.todo = todo;
// }
// //--------
// void dump_to(std::ostream& os) {
// tlv.dump_to(os);
// os.write(reinterpret_cast<const char*>(&todo), sizeof(todo));
// }
// //--------
// void load_from(std::istream& is) {
// //tlv.load_from(is);
// if (tlv.get_length() != 1) {
// throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
// }
// is.read(reinterpret_cast<char*>(&todo), sizeof(todo));
// }
// //--------
// void to_core_type(pfcp_ies_container& s) {
// pfcp::downlink_data_report downlink_data_report = {};
// to_core_type(downlink_data_report);
// s.set(downlink_data_report);
// }
//};
// IE DOWNLINK_DATA_REPORT
class pfcp_downlink_data_report_ie : public pfcp_grouped_ie {
public:
//--------
pfcp_downlink_data_report_ie(const pfcp::downlink_data_report& b) : pfcp_grouped_ie(PFCP_IE_DOWNLINK_DATA_REPORT){
tlv.set_length(0);
if (b.pdr_id.first) {std::shared_ptr<pfcp_pdr_id_ie> sie(new pfcp_pdr_id_ie(b.pdr_id.second)); add_ie(sie);}
// TODO Later(SXa, N4) if (b.downlink_data_service_information.first) {std::shared_ptr<pfcp_downlink_data_service_information_ie> sie(new pfcp_downlink_data_service_information_ie(b.downlink_data_service_information.second)); add_ie(sie);}
}
//--------
pfcp_downlink_data_report_ie() : pfcp_grouped_ie(PFCP_IE_DOWNLINK_DATA_REPORT){
}
//--------
explicit pfcp_downlink_data_report_ie(const pfcp_tlv& t) : pfcp_grouped_ie(t) {
};
//--------
void to_core_type(pfcp::downlink_data_report& c) {
for (auto sie : ies) {
sie.get()->to_core_type(c);
}
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::downlink_data_report i = {};
to_core_type(i);
s.set(i);
}
};
//-------------------------------------
// IE OUTER_HEADER_CREATION
class pfcp_outer_header_creation_ie : public pfcp_ie {
......@@ -4998,51 +4999,58 @@ public:
// }
//};
////-------------------------------------
//// IE NODE_REPORT_TYPE
//class pfcp_node_report_type_ie : public pfcp_ie {
//public:
// uint8_t todo;
//
// //--------
// pfcp_node_report_type_ie(const pfcp::node_report_type_t& b) : pfcp_ie(PFCP_IE_NODE_REPORT_TYPE){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_node_report_type_ie() : pfcp_ie(PFCP_IE_NODE_REPORT_TYPE){
// todo = 0;
// tlv.set_length(1);
// }
// //--------
// pfcp_node_report_type_ie(const pfcp_tlv& t) : pfcp_ie(t) {
// todo = 0;
// };
// //--------
// void to_core_type(pfcp::node_report_type_t& b) {
// b.todo = todo;
// }
// //--------
// void dump_to(std::ostream& os) {
// tlv.dump_to(os);
// os.write(reinterpret_cast<const char*>(&todo), sizeof(todo));
// }
// //--------
// void load_from(std::istream& is) {
// //tlv.load_from(is);
// if (tlv.get_length() != 1) {
// throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
// }
// is.read(reinterpret_cast<char*>(&todo), sizeof(todo));
// }
// //--------
// void to_core_type(pfcp_ies_container& s) {
// pfcp::node_report_type_t node_report_type = {};
// to_core_type(node_report_type);
// s.set(node_report_type);
// }
//};
////-------------------------------------
//// IE USER_PLANE_PATH_FAILURE_REPORT
// IE NODE_REPORT_TYPE
class pfcp_node_report_type_ie : public pfcp_ie {
public:
union {
struct {
uint8_t upfr :1;
uint8_t spare1 :7;
} bf;
uint8_t b;
} u1;
//--------
pfcp_node_report_type_ie(const pfcp::node_report_type_t& b) : pfcp_ie(PFCP_IE_NODE_REPORT_TYPE){
u1.b = 0;
tlv.set_length(1);
}
//--------
pfcp_node_report_type_ie() : pfcp_ie(PFCP_IE_NODE_REPORT_TYPE){
u1.b = 0;
tlv.set_length(1);
}
//--------
pfcp_node_report_type_ie(const pfcp_tlv& t) : pfcp_ie(t) {
u1.b = 0;
};
//--------
void to_core_type(pfcp::node_report_type_t& b) {
u1.b = 0;
u1.bf.upfr = b.upfr;
}
//--------
void dump_to(std::ostream& os) {
tlv.dump_to(os);
os.write(reinterpret_cast<const char*>(&u1.b), sizeof(u1.b));
}
//--------
void load_from(std::istream& is) {
//tlv.load_from(is);
if (tlv.get_length() != 1) {
throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
}
is.read(reinterpret_cast<char*>(&u1.b), sizeof(u1.b));
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::node_report_type_t node_report_type = {};
to_core_type(node_report_type);
s.set(node_report_type);
}
};
//-------------------------------------
// IE USER_PLANE_PATH_FAILURE_REPORT
//class pfcp_user_plane_path_failure_report_ie : public pfcp_ie {
//public:
// uint8_t todo;
......
This diff is collapsed.
......@@ -130,13 +130,13 @@ public:
virtual uint32_t send_request(const endpoint& dest, const pfcp_association_setup_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_association_update_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const pfcp_association_release_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_node_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// session related messages
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_establishment_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_modification_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_deletion_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
virtual uint32_t send_request(const endpoint& dest, const uint64_t seid, const pfcp_session_report_request& pfcp_ies, const task_id_t& task_id, const uint64_t trxn_id);
// Node related messages
virtual void send_response(const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a = DELETE_TX);
......
......@@ -223,6 +223,12 @@ void pgw_app_task (void*)
}
break;
case SXAB_SESSION_REPORT_REQUEST:
if (itti_sxab_session_report_request* m = dynamic_cast<itti_sxab_session_report_request*>(msg)) {
pgw_app_inst->handle_itti_msg(std::ref(*m));
}
break;
case S5S8_CREATE_SESSION_REQUEST:
pgw_app_inst->handle_itti_msg(std::static_pointer_cast<itti_s5s8_create_session_request>(shared_msg));
break;
......@@ -285,7 +291,7 @@ pgw_app::pgw_app (const std::string& config_file) : m_s5s8_cp_teid_generator(),
}
//------------------------------------------------------------------------------
void pgw_app::send_delete_session_response_cause_request_accepted (const uint64_t gtpc_tx_id, const teid_t teid,
void pgw_app::send_delete_session_response_cause_request_accepted (const uint64_t gtpc_tx_id, const teid_t teid,
const endpoint& r_endpoint) const
{
cause_t cause = {.cause_value = REQUEST_ACCEPTED, .pce = 0, .bce = 0, .cs = 0};
......@@ -305,7 +311,7 @@ void pgw_app::send_delete_session_response_cause_request_accepted (const uint64_
}
//------------------------------------------------------------------------------
void pgw_app::send_modify_bearer_response_cause_context_not_found (const uint64_t gtpc_tx_id, const teid_t teid,
void pgw_app::send_modify_bearer_response_cause_context_not_found (const uint64_t gtpc_tx_id, const teid_t teid,
const endpoint& r_endpoint) const
{
cause_t cause = {.cause_value = CONTEXT_NOT_FOUND, .pce = 0, .bce = 0, .cs = 0};
......@@ -324,7 +330,7 @@ void pgw_app::send_modify_bearer_response_cause_context_not_found (const uint64_
}
}
//------------------------------------------------------------------------------
void pgw_app::send_delete_session_response_cause_context_not_found (const uint64_t gtpc_tx_id, const teid_t teid,
void pgw_app::send_delete_session_response_cause_context_not_found (const uint64_t gtpc_tx_id, const teid_t teid,
const endpoint& r_endpoint) const
{
cause_t cause = {.cause_value = CONTEXT_NOT_FOUND, .pce = 0, .bce = 0, .cs = 0};
......@@ -343,7 +349,7 @@ void pgw_app::send_delete_session_response_cause_context_not_found (const uint64
}
}
//------------------------------------------------------------------------------
void pgw_app::send_release_access_bearers_response_cause_context_not_found(const uint64_t gtpc_tx_id, const teid_t teid,
void pgw_app::send_release_access_bearers_response_cause_context_not_found(const uint64_t gtpc_tx_id, const teid_t teid,
const endpoint& r_endpoint) const
{
cause_t cause = {.cause_value = CONTEXT_NOT_FOUND, .pce = 0, .bce = 0, .cs = 0};
......@@ -362,7 +368,7 @@ void pgw_app::send_release_access_bearers_response_cause_context_not_found(const
}
}
//------------------------------------------------------------------------------
void pgw_app::send_release_access_bearers_response_cause_request_accepted(const uint64_t gtpc_tx_id, const teid_t teid,
void pgw_app::send_release_access_bearers_response_cause_request_accepted(const uint64_t gtpc_tx_id, const teid_t teid,
const endpoint& r_endpoint) const
{
cause_t cause = {.cause_value = REQUEST_ACCEPTED, .pce = 0, .bce = 0, .cs = 0};
......@@ -574,4 +580,10 @@ void pgw_app::handle_itti_msg (itti_sxab_session_deletion_response& smresp)
}
}
//------------------------------------------------------------------------------
void pgw_app::handle_itti_msg (itti_sxab_session_report_request& snr)
{
Logger::pgwc_app().debug("Received SXAB SESSION REPORT REQUEST seid" TEID_FMT " pfcp_tx_id %" PRIX64" ", snr.seid, snr.trxn_id);
}
......@@ -127,6 +127,7 @@ public:
void handle_itti_msg (itti_sxab_session_establishment_response& m);
void handle_itti_msg (itti_sxab_session_modification_response& m);
void handle_itti_msg (itti_sxab_session_deletion_response& m);
void handle_itti_msg (itti_sxab_session_report_request& snr);
void handle_itti_msg (itti_sxab_association_setup_request& m);
void restore_sx_sessions(const seid_t& seid) const;
......
......@@ -227,6 +227,9 @@ void pgwc_sxab::handle_receive_pfcp_msg(pfcp_msg& msg, const endpoint& remote_en
case PFCP_SESSION_DELETION_RESPONSE:
handle_receive_session_deletion_response(msg, remote_endpoint);
break;
case PFCP_SESSION_REPORT_REQUEST:
handle_receive_session_report_request(msg, remote_endpoint);
break;
case PFCP_PFCP_PFD_MANAGEMENT_REQUEST:
case PFCP_PFCP_PFD_MANAGEMENT_RESPONSE:
case PFCP_ASSOCIATION_SETUP_RESPONSE:
......@@ -242,7 +245,6 @@ void pgwc_sxab::handle_receive_pfcp_msg(pfcp_msg& msg, const endpoint& remote_en
case PFCP_SESSION_ESTABLISHMENT_REQUEST:
case PFCP_SESSION_MODIFICATION_REQUEST:
case PFCP_SESSION_DELETION_REQUEST:
case PFCP_SESSION_REPORT_REQUEST:
case PFCP_SESSION_REPORT_RESPONSE:
Logger::pgwc_sx().info( "handle_receive_pfcp_msg msg %d length %d, not handled, discarded!", msg.get_message_type(), msg.get_message_length());
break;
......@@ -414,6 +416,30 @@ void pgwc_sxab::handle_receive_session_deletion_response(pfcp::pfcp_msg& msg, co
}
// else ignore
}
//------------------------------------------------------------------------------
void pgwc_sxab::handle_receive_session_report_request(pfcp::pfcp_msg& msg, const endpoint& remote_endpoint)
{
bool error = true;
uint64_t trxn_id = 0;
pfcp_session_report_request msg_ies_container = {};
msg.to_core_type(msg_ies_container);
handle_receive_message_cb(msg, remote_endpoint, TASK_PGWC_SX, error, trxn_id);
if (!error) {
itti_sxab_session_report_request *itti_msg = new itti_sxab_session_report_request(TASK_PGWC_SX, TASK_PGWC_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_sxab_session_report_request> i = std::shared_ptr<itti_sxab_session_report_request>(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) {
Logger::pgwc_sx().error( "Could not send ITTI message %s to task TASK_PGWC_APP", i->get_msg_name());
}
}
// else ignore
}
//------------------------------------------------------------------------------
void pgwc_sxab::send_sx_msg(itti_sxab_association_setup_response& i)
{
......
......@@ -100,6 +100,7 @@ public:
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);
void time_out_itti_event(const uint32_t timer_id);
};
......
......@@ -143,8 +143,9 @@ void pfcp_pdr::buffering_requested(const char *buffer, const std::size_t num_byt
//------------------------------------------------------------------------------
void pfcp_pdr::notify_cp_requested(std::shared_ptr<pfcp::pfcp_session> session)
{
if (not notified_cp) {
notified_cp = true;
if (not notified_cp) {
Logger::spgwu_sx().trace( "notify_cp_requested()");
notified_cp = true;
pfcp::pfcp_session_report_request h;
......
......@@ -37,11 +37,11 @@
namespace pfcp {
class pfcp_session;
class pfcp_pdr {
public:
mutable std::mutex lock;
uint64_t local_seid;
mutable std::mutex lock;
uint64_t local_seid;
pfcp::pdr_id_t pdr_id;
std::pair<bool, pfcp::precedence_t> precedence;
std::pair<bool, pfcp::pdi> pdi;
......@@ -50,12 +50,12 @@ namespace pfcp {
std::pair<bool, pfcp::urr_id_t> urr_id;
std::pair<bool, pfcp::qer_id_t> qer_id;
std::pair<bool, pfcp::activate_predefined_rules_t> activate_predefined_rules;
bool notified_cp;
bool notified_cp;
explicit pfcp_pdr(uint64_t lseid) : lock(), local_seid(lseid), pdr_id(), precedence(), pdi(), outer_header_removal(), far_id(), urr_id(), qer_id(), activate_predefined_rules(), notified_cp(false) {}
explicit pfcp_pdr(const pfcp::create_pdr& c) :
explicit pfcp_pdr(const pfcp::create_pdr& c) :
lock(), local_seid(0), pdr_id(c.pdr_id.second), precedence(c.precedence), pdi(c.pdi), outer_header_removal(c.outer_header_removal),
far_id(c.far_id), urr_id(c.urr_id), qer_id(c.qer_id), activate_predefined_rules(c.activate_predefined_rules), notified_cp(false)
{}
......@@ -96,7 +96,7 @@ namespace pfcp {
void buffering_requested(const char *buffer, const std::size_t num_bytes);
void notify_cp_requested(std::shared_ptr<pfcp::pfcp_session> session);
// For sorting in collections
bool operator<(const pfcp_pdr &rhs) const { return (precedence.second.precedence < rhs.precedence.second.precedence); }
};
......
......@@ -789,12 +789,16 @@ void pfcp_switch::pfcp_session_look_up_pack_in_core(const char *buffer, const st
pfcp::far_id_t far_id = {};
if ((*it)->get(far_id)) {
std::shared_ptr<pfcp::pfcp_far> sfar = {};
//Logger::pfcp_switch().trace( "pfcp_session_look_up_pack_in_core %d bytes, far id %08X", num_bytes, far_id);
if (ssession->get(far_id.far_id, sfar)) {
//Logger::pfcp_switch().trace( "pfcp_session_look_up_pack_in_core %d bytes, got far, far id %08X", num_bytes, far_id);
sfar->apply_forwarding_rules(iph, num_bytes, nocp, buff);
if (buff) {
//Logger::pfcp_switch().trace( "Buffering %d bytes, far id %08X", num_bytes, far_id);
(*it)->buffering_requested(buffer, num_bytes);
}
if (nocp) {
//Logger::pfcp_switch().trace( "Notify CP %d bytes, far id %08X", num_bytes, far_id);
(*it)->notify_cp_requested(ssession);
}
}
......
......@@ -46,7 +46,7 @@ void pfcp_association::notify_add_session(const pfcp::fseid_t& cp_fseid)
sessions.insert(cp_fseid);
}
//------------------------------------------------------------------------------
bool pfcp_association::has_session(const pfcp::fseid_t& cp_fseid)
bool pfcp_association::has_session(const pfcp::fseid_t& cp_fseid) const
{
std::unique_lock<std::mutex> l(m_sessions);
auto it = sessions.find(cp_fseid);
......
......@@ -41,19 +41,19 @@ namespace spgwu {
#define PFCP_ASSOCIATION_HEARTBEAT_MAX_RETRIES 5
class pfcp_association {
public:
pfcp::node_id_t node_id;
std::size_t hash_node_id;
pfcp::node_id_t node_id; // peer
std::size_t hash_node_id;
pfcp::recovery_time_stamp_t recovery_time_stamp;
std::pair<bool,pfcp::cp_function_features_s> function_features;
//
mutable std::mutex m_sessions;
mutable std::mutex m_sessions;
std::set<pfcp::fseid_t> sessions;
//
timer_id_t timer_heartbeat;
int num_retries_timer_heartbeat;
uint64_t trxn_id_heartbeat;
timer_id_t timer_heartbeat;
int num_retries_timer_heartbeat;
uint64_t trxn_id_heartbeat;
timer_id_t timer_association;
timer_id_t timer_association;
explicit pfcp_association(const pfcp::node_id_t& node_id) :
node_id(node_id), recovery_time_stamp(), function_features(), m_sessions(), sessions() {
......@@ -92,10 +92,11 @@ namespace spgwu {
// trxn_id_heartbeat = p.trxn_id_heartbeat;
// }
void notify_add_session(const pfcp::fseid_t& cp_fseid);
bool has_session(const pfcp::fseid_t& cp_fseid);
bool has_session(const pfcp::fseid_t& cp_fseid) const ;
void notify_del_session(const pfcp::fseid_t& cp_fseid);
void del_sessions();
void set(const pfcp::cp_function_features_s& ff) {function_features.first = true; function_features.second = ff;};
const pfcp::node_id_t& peer_node_id() const {return this->node_id;};
};
#define PFCP_MAX_ASSOCIATIONS 16
......
......@@ -435,6 +435,11 @@ void spgwu_sx::handle_itti_msg (itti_sxab_session_deletion_response& msg)
send_sx_msg(msg);
}
//------------------------------------------------------------------------------
void spgwu_sx::send_sx_msg(itti_sxab_association_setup_request& i)
{
send_request(i.r_endpoint, i.pfcp_ies, TASK_SPGWU_SX, i.trxn_id);
}
//------------------------------------------------------------------------------
void spgwu_sx::send_sx_msg(itti_sxab_session_establishment_response& i)
{
send_response(i.r_endpoint, i.seid, i.pfcp_ies, i.trxn_id);
......@@ -450,6 +455,11 @@ void spgwu_sx::send_sx_msg(itti_sxab_session_deletion_response& i)
send_response(i.r_endpoint, i.seid, i.pfcp_ies, i.trxn_id);
}
//------------------------------------------------------------------------------
void spgwu_sx::send_sx_msg(itti_sxab_session_report_request& i)
{
send_request(i.r_endpoint, i.seid, i.pfcp_ies, TASK_SPGWU_SX, i.trxn_id);
}
//------------------------------------------------------------------------------
void spgwu_sx::start_association(const pfcp::node_id_t& node_id)
{
pfcp_associations::get_instance().add_peer_candidate_node(node_id);
......@@ -473,26 +483,24 @@ void spgwu_sx::start_association(const pfcp::node_id_t& node_id)
}
}
//------------------------------------------------------------------------------
void spgwu_sx::send_sx_msg(itti_sxab_association_setup_request& i)
{
send_request(i.r_endpoint, i.pfcp_ies, TASK_SPGWU_SX, i.trxn_id);
}
//------------------------------------------------------------------------------
void spgwu_sx::send_sx_msg(const pfcp::fseid_t& cp_fseid, const pfcp::pfcp_session_report_request& s)
{
itti_sxab_session_report_request isrr(TASK_SPGWU_SX, TASK_SPGWU_SX);
isrr.trxn_id = generate_trxn_id();
isrr.pfcp_ies = s;
pfcp::node_id_t this_node_id = {};
if (spgwu_cfg.get_pfcp_node_id(this_node_id) == RETURNok) {
if (this_node_id.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS) {
std::shared_ptr<pfcp_association> sa = {};
if (pfcp_associations::get_instance().get_association(cp_fseid, sa)) {
const pfcp::node_id_t& peer_node_id = sa->peer_node_id();
if (peer_node_id.node_id_type == pfcp::NODE_ID_TYPE_IPV4_ADDRESS) {
//a.l_endpoint = endpoint(boost::asio::ip::address_v4(spgwu_cfg.sx.addr4), 0);
isrr.r_endpoint = endpoint(this_node_id.u1.ipv4_address, pfcp::default_port);
isrr.r_endpoint = endpoint(peer_node_id.u1.ipv4_address, pfcp::default_port);
send_sx_msg(isrr);
} else {
Logger::spgwu_sx().warn( "TODO start_association() node_id IPV6, FQDN!");
}
} else {
Logger::spgwu_sx().warn( "Could not send PFCP_SESSION_REPORT_REQUEST, cause association not found for cp_fseid");
}
}
//------------------------------------------------------------------------------
......
......@@ -88,7 +88,7 @@ public:
void send_sx_msg (itti_sxab_session_establishment_response& s);
void send_sx_msg (itti_sxab_session_modification_response& s);
void send_sx_msg (itti_sxab_session_deletion_response& s);
void send_sx_msg (itti_sxab_session_report_request& s) {};
void send_sx_msg (itti_sxab_session_report_request& s) ;
void send_sx_msg(const pfcp::fseid_t& cp_fseid, const pfcp::pfcp_session_report_request& s);
......
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