Commit c11a93f1 authored by gauthier's avatar gauthier
Browse files

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;
......
......@@ -105,7 +105,7 @@ bool pfcp_l4_stack::check_response_type(const uint8_t initial, const uint8_t tri
if (triggered == (initial+1)) return true;
break;
default:
if (triggered == GTP_VERSION_NOT_SUPPORTED_INDICATION) return true;
if (triggered == PFCP_VERSION_NOT_SUPPORTED_RESPONSE) return true;
}
return false;
......@@ -227,7 +227,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
......@@ -252,7 +252,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
......@@ -277,7 +277,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
////------------------------------------------------------------------------------
......@@ -332,32 +332,31 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
////------------------------------------------------------------------------------
//uint32_t pfcp_l4_stack::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)
//{
// std::ostringstream oss(std::ostringstream::binary);
// pfcp_msg msg(pfcp_ies);
// msg.set_seid(seid);
// msg.set_sequence_number(get_next_seq_num());
// msg.dump_to(oss);
// //std::cout << string_to_hex(oss.str()) << std::endl;
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::string bstream = oss.str();
//
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
// pfcp_procedure proc = {};
// proc.initial_msg_type = msg.get_message_type();
// proc.trxn_id = trxn_id;
// proc.retry_msg = std::make_shared<pfcp_msg>(msg);
// proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
// start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::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)
{
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::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)
{
......@@ -381,7 +380,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
......@@ -407,7 +406,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
////------------------------------------------------------------------------------
......@@ -459,37 +458,35 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
////------------------------------------------------------------------------------
//uint32_t pfcp_l4_stack::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)
//{
// std::ostringstream oss(std::ostringstream::binary);
// pfcp_msg msg(pfcp_ies);
// msg.set_seid(seid);
// msg.set_sequence_number(get_next_seq_num());
// msg.dump_to(oss);
// //std::cout << string_to_hex(oss.str()) << std::endl;
// //std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
// std::string bstream = oss.str();
//
// Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
// pfcp_procedure proc = {};
// proc.initial_msg_type = msg.get_message_type();
// proc.trxn_id = trxn_id;
// proc.retry_msg = std::make_shared<pfcp_msg>(msg);
// proc.remote_endpoint = dest;
// start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
// start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
// pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
// trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//
// udp_s.async_send_to(sm, dest);
// return msg.get_sequence_number();
//}
//
//------------------------------------------------------------------------------
uint32_t pfcp_l4_stack::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)
{
std::ostringstream oss(std::ostringstream::binary);
pfcp_msg msg(pfcp_ies);
msg.set_seid(seid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d seid " SEID_FMT " ", pfcp_ies.get_msg_name(), msg.get_sequence_number(), seid);
pfcp_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.trxn_id = trxn_id;
proc.retry_msg = std::make_shared<pfcp_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, PFCP_T1_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, PFCP_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_heartbeat_response& pfcp_ies, const uint64_t trxn_id, const pfcp_transaction_action& a)
{
......@@ -502,7 +499,7 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_heartbeat_res
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
......@@ -528,7 +525,7 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_s
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , pfcp_procedure>::iterator it_proc = pending_procedures.find(it->second);
......@@ -555,7 +552,7 @@ void pfcp_l4_stack::send_response(const endpoint& dest, const pfcp_association_r
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::pfcp().trace( "Sending %s, seq %d", pfcp_ies.get_msg_name(), msg.get_sequence_number());
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);