Commit 8792d6c1 authored by gauthier's avatar gauthier
Browse files

GTPV2-C status value "REMOTE PEER NOT RESPONDING"

parent 7cb55cbd
......@@ -41,12 +41,14 @@ public:
l_endpoint = {};
r_endpoint = {};
teid = UNASSIGNED_TEID;
l_teid = UNASSIGNED_TEID;
gtpc_tx_id = 0;
}
itti_s11_msg(const itti_s11_msg& i) : itti_msg(i) {
l_endpoint = i.l_endpoint;
r_endpoint = i.r_endpoint;
teid = i.teid;
l_teid = i.l_teid;
gtpc_tx_id = i.gtpc_tx_id;
}
itti_s11_msg(const itti_s11_msg& i, const task_id_t orig, const task_id_t dest) : itti_s11_msg(i) {
......@@ -56,10 +58,22 @@ public:
endpoint l_endpoint;
endpoint r_endpoint;
teid_t teid;
teid_t teid; // remote teid
teid_t l_teid; // local teid
uint64_t gtpc_tx_id;
};
class itti_s11_remote_peer_not_responding : public itti_s11_msg {
public:
itti_s11_remote_peer_not_responding(const task_id_t orig, const task_id_t dest):
itti_s11_msg(S11_REMOTE_PEER_NOT_RESPONDING, orig, dest) {}
itti_s11_remote_peer_not_responding(const itti_s11_remote_peer_not_responding& i) : itti_s11_msg(i) {}
itti_s11_remote_peer_not_responding(const itti_s11_remote_peer_not_responding& i, const task_id_t orig, const task_id_t dest) :
itti_s11_msg(i, orig, dest) {}
const char* get_msg_name() {return "S11_REMOTE_PEER_NOT_RESPONDING";};
};
//-----------------------------------------------------------------------------
class itti_s11_create_session_request : public itti_s11_msg {
public:
itti_s11_create_session_request(const task_id_t origin, const task_id_t destination):
......
......@@ -41,11 +41,12 @@ public:
l_endpoint = {};
r_endpoint = {};
teid = UNASSIGNED_TEID;
l_teid = UNASSIGNED_TEID;
gtpc_tx_id = 0;
}
itti_s5s8_msg(const itti_s5s8_msg& i) : itti_msg(i), l_endpoint(i.l_endpoint),
r_endpoint(i.r_endpoint), teid(i.teid), gtpc_tx_id(i.gtpc_tx_id) {}
r_endpoint(i.r_endpoint), teid(i.teid), l_teid(i.l_teid), gtpc_tx_id(i.gtpc_tx_id) {}
itti_s5s8_msg(const itti_s5s8_msg& i, const task_id_t orig, const task_id_t dest) :
itti_s5s8_msg(i)
......@@ -56,10 +57,21 @@ public:
endpoint l_endpoint;
endpoint r_endpoint;
teid_t teid;
teid_t teid; // remote teid
teid_t l_teid; // local teid
uint64_t gtpc_tx_id;
};
class itti_s5s8_remote_peer_not_responding : public itti_s5s8_msg {
public:
itti_s5s8_remote_peer_not_responding(const task_id_t orig, const task_id_t dest):
itti_s5s8_msg(S5S8_REMOTE_PEER_NOT_RESPONDING, orig, dest) {}
itti_s5s8_remote_peer_not_responding(const itti_s5s8_remote_peer_not_responding& i) : itti_s5s8_msg(i) {}
itti_s5s8_remote_peer_not_responding(const itti_s5s8_remote_peer_not_responding& i, const task_id_t orig, const task_id_t dest) :
itti_s5s8_msg(i, orig, dest) {}
const char* get_msg_name() {return "S5S8_REMOTE_PEER_NOT_RESPONDING";};
};
//-----------------------------------------------------------------------------
class itti_s5s8_create_session_request : public itti_s5s8_msg {
public:
itti_s5s8_create_session_request(const task_id_t orig, const task_id_t dest):
......
......@@ -86,7 +86,12 @@ uint32_t gtpv2c_stack::get_next_seq_num() {
//------------------------------------------------------------------------------
void gtpv2c_stack::handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint)
{
Logger::gtpv2_c().error( "TODO implement in derived class");
Logger::gtpv2_c().error( "TODO implement gtpv2c_stack::handle_receive in derived class");
}
//------------------------------------------------------------------------------
void gtpv2c_stack::notify_ul_error(const endpoint& r_endpoint, const teid_t teid, const cause_value_e cause, const uint64_t gtpc_tx_id)
{
Logger::gtpv2_c().error( "TODO implement gtpv2c_stack::notify_ul_error in derived class");
}
//------------------------------------------------------------------------------
bool gtpv2c_stack::check_initial_message_type(const uint8_t initial)
......@@ -332,11 +337,11 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const gtpv2c_e
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
......@@ -347,6 +352,7 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
......@@ -358,11 +364,11 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -371,6 +377,7 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
......@@ -382,11 +389,11 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -395,6 +402,7 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
......@@ -406,11 +414,11 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -419,6 +427,7 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
......@@ -430,11 +439,11 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -443,6 +452,7 @@ uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t t
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
......@@ -480,14 +490,14 @@ void gtpv2c_stack::send_triggered_message(const endpoint& dest, const gtpv2c_ech
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -507,14 +517,14 @@ void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -534,14 +544,14 @@ void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_modify_bearer_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_modify_bearer_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -561,14 +571,14 @@ void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_release_access_bearers_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_release_access_bearers_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -588,14 +598,14 @@ void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_downlink_data_notification_acknowledge& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_downlink_data_notification_acknowledge& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(teid);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
......@@ -615,11 +625,6 @@ void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::notify_ul_error(const gtpv2c_procedure& p, const cause_value_e cause)
{
Logger::gtpv2_c().trace( "notify_ul_error proc " PROC_ID_FMT " cause %d", p.gtpc_tx_id, cause);
}
//------------------------------------------------------------------------------
void gtpv2c_stack::time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &handled)
{
......@@ -643,7 +648,12 @@ void gtpv2c_stack::time_out_event(const uint32_t timer_id, const task_id_t& task
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), it_proc->second.remote_endpoint);
} else {
// abort procedure
notify_ul_error(it_proc->second, cause_value_e::REMOTE_PEER_NOT_RESPONDING);
notify_ul_error(it_proc->second.remote_endpoint, it_proc->second.local_teid, cause_value_e::REMOTE_PEER_NOT_RESPONDING, it_proc->second.gtpc_tx_id);
handled = true;
it_proc->second.proc_cleanup_timer_id = 0;
Logger::gtpv2_c().trace( "Delete proc " PROC_ID_FMT " Retry %d seq %d timer id %u",
it_proc->second.gtpc_tx_id, it_proc->second.retry_count, it_proc->first, timer_id);
pending_procedures.erase(it_proc);
}
}
} else {
......
......@@ -50,6 +50,7 @@ class gtpv2c_procedure {
public:
std::shared_ptr<gtpv2c_msg> retry_msg;
endpoint remote_endpoint;
teid_t local_teid; // for peer not responding
timer_id_t retry_timer_id;
timer_id_t proc_cleanup_timer_id;
uint64_t gtpc_tx_id;
......@@ -64,6 +65,7 @@ public:
gtpv2c_procedure() :
retry_msg(),
remote_endpoint(),
local_teid(0),
retry_timer_id(0),
proc_cleanup_timer_id(0),
gtpc_tx_id(0),
......@@ -74,6 +76,7 @@ public:
gtpv2c_procedure(const gtpv2c_procedure& p) :
retry_msg(p.retry_msg),
remote_endpoint(p.remote_endpoint),
local_teid(p.local_teid),
retry_timer_id(p.retry_timer_id),
proc_cleanup_timer_id(p.proc_cleanup_timer_id),
gtpc_tx_id(p.gtpc_tx_id),
......@@ -129,6 +132,8 @@ public:
static const uint8_t version = 2;
gtpv2c_stack(const std::string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_param);
virtual void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint);
virtual void notify_ul_error(const endpoint& r_endpoint, const teid_t l_teid, const cause_value_e cause, const uint64_t gtpc_tx_id);
void handle_receive_message_cb(const gtpv2c_msg& msg, const endpoint& r_endpoint, const task_id_t& task_id, bool& error, uint64_t& gtpc_tx_id);
// Path mangement messages
......@@ -136,11 +141,11 @@ public:
virtual void send_triggered_message(const endpoint& r_endpoint, const gtpv2c_echo_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
// Tunnel management messages
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
......
......@@ -73,6 +73,7 @@ typedef enum {
ITTI_MSG_TYPE_FIRST = 0,
ASYNC_SHELL_CMD = ITTI_MSG_TYPE_FIRST,
RESTORE_SX_SESSIONS,
S11_REMOTE_PEER_NOT_RESPONDING,
S11_CREATE_SESSION_REQUEST,
S11_CREATE_SESSION_RESPONSE,
S11_CREATE_BEARER_REQUEST,
......@@ -94,6 +95,7 @@ typedef enum {
S1U_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION,
S1U_END_MARKER,
S1U_G_PDU, // UNUSED
S5S8_REMOTE_PEER_NOT_RESPONDING,
S5S8_CREATE_SESSION_REQUEST,
S5S8_CREATE_SESSION_RESPONSE,
S5S8_CREATE_BEARER_REQUEST,
......
......@@ -144,7 +144,7 @@ void pgw_s5s8::send_msg(itti_s5s8_release_access_bearers_response& i)
//------------------------------------------------------------------------------
void pgw_s5s8::send_msg(itti_s5s8_downlink_data_notification& i)
{
send_initial_message(i.r_endpoint, i.teid, i.gtp_ies, TASK_PGWC_S5S8, i.gtpc_tx_id);
send_initial_message(i.r_endpoint, i.teid, i.l_teid, i.gtp_ies, TASK_PGWC_S5S8, i.gtpc_tx_id);
}
//------------------------------------------------------------------------------
void pgw_s5s8::handle_receive_create_session_request(gtpv2c_msg& msg, const endpoint& remote_endpoint)
......@@ -394,6 +394,27 @@ void pgw_s5s8::handle_receive(char* recv_buffer, const std::size_t bytes_transfe
}
}
//------------------------------------------------------------------------------
void pgw_s5s8::notify_ul_error(const endpoint& r_endpoint, const teid_t l_teid, const cause_value_e cause, const uint64_t gtpc_tx_id)
{
switch (cause) {
case cause_value_e::REMOTE_PEER_NOT_RESPONDING:
{
itti_s5s8_remote_peer_not_responding *itti_msg = new itti_s5s8_remote_peer_not_responding(TASK_PGWC_S5S8, TASK_PGWC_APP);
itti_msg->r_endpoint = r_endpoint;
itti_msg->gtpc_tx_id = gtpc_tx_id;
itti_msg->teid = l_teid;
std::shared_ptr<itti_s5s8_remote_peer_not_responding> i = std::shared_ptr<itti_s5s8_remote_peer_not_responding>(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) {
Logger::pgwc_s5s8().error( "Could not send ITTI message %s to task TASK_PGWC_APP", i->get_msg_name());
}
}
break;
default:
Logger::pgwc_s5s8().warn( "notify_ul_error cause %d not handled", cause);
}
}
//------------------------------------------------------------------------------
void pgw_s5s8::time_out_itti_event(const uint32_t timer_id)
{
bool handled = false;
......
......@@ -53,6 +53,7 @@ public:
void operator=(pgw_s5s8 const&) = delete;
void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint);
void notify_ul_error(const endpoint& r_endpoint, const teid_t l_teid, const cause_value_e cause, const uint64_t gtpc_tx_id);
void send_msg(itti_s5s8_create_session_response& m);
void send_msg(itti_s5s8_delete_session_response& m);
......
......@@ -184,20 +184,20 @@ void sgwc_app_task (void *args_p)
auto *msg = shared_msg.get();
switch (msg->msg_type) {
case S11_CREATE_SESSION_REQUEST:
/*
* We received a create session request from MME (with GTP abstraction here)
* procedures might be:
* E-UTRAN Initial Attach
* UE requests PDN connectivity
*/
if (itti_s11_create_session_request* m = dynamic_cast<itti_s11_create_session_request*>(msg)) {
case S5S8_CREATE_SESSION_RESPONSE:
if (itti_s5s8_create_session_response* m = dynamic_cast<itti_s5s8_create_session_response*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
case S5S8_CREATE_SESSION_RESPONSE:
if (itti_s5s8_create_session_response* m = dynamic_cast<itti_s5s8_create_session_response*>(msg)) {
case S5S8_DELETE_SESSION_RESPONSE:
if (itti_s5s8_delete_session_response* m = dynamic_cast<itti_s5s8_delete_session_response*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
case S5S8_DOWNLINK_DATA_NOTIFICATION:
if (itti_s5s8_downlink_data_notification* m = dynamic_cast<itti_s5s8_downlink_data_notification*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
......@@ -214,20 +214,32 @@ void sgwc_app_task (void *args_p)
}
break;
case S5S8_DOWNLINK_DATA_NOTIFICATION:
if (itti_s5s8_downlink_data_notification* m = dynamic_cast<itti_s5s8_downlink_data_notification*>(msg)) {
case S5S8_REMOTE_PEER_NOT_RESPONDING:
if (itti_s5s8_remote_peer_not_responding* m = dynamic_cast<itti_s5s8_remote_peer_not_responding*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
case S11_DELETE_SESSION_REQUEST:
case S11_CREATE_SESSION_REQUEST:
/*
* We received a create session request from MME (with GTP abstraction here)
* procedures might be:
* E-UTRAN Initial Attach
* UE requests PDN connectivity
*/
if (itti_s11_create_session_request* m = dynamic_cast<itti_s11_create_session_request*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
case S11_DELETE_SESSION_REQUEST:
if (itti_s11_delete_session_request* m = dynamic_cast<itti_s11_delete_session_request*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
case S5S8_DELETE_SESSION_RESPONSE:
if (itti_s5s8_delete_session_response* m = dynamic_cast<itti_s5s8_delete_session_response*>(msg)) {
case S11_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE:
if (itti_s11_downlink_data_notification_acknowledge* m = dynamic_cast<itti_s11_downlink_data_notification_acknowledge*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
......@@ -244,8 +256,8 @@ void sgwc_app_task (void *args_p)
}
break;
case S11_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE:
if (itti_s11_downlink_data_notification_acknowledge* m = dynamic_cast<itti_s11_downlink_data_notification_acknowledge*>(msg)) {
case S11_REMOTE_PEER_NOT_RESPONDING:
if (itti_s11_remote_peer_not_responding* m = dynamic_cast<itti_s11_remote_peer_not_responding*>(msg)) {
sgwc_app_inst->handle_itti_msg(ref(*m));
}
break;
......@@ -447,6 +459,11 @@ void sgwc_app::handle_itti_msg (itti_s11_release_access_bearers_request& m)
}
}
//------------------------------------------------------------------------------
void sgwc_app::handle_itti_msg (itti_s11_remote_peer_not_responding& m)
{
Logger::sgwc_app().debug("Received S11 REMOTE_PEER_NOT_RESPONDING event, gtpc_tx_id " PROC_ID_FMT ", todo when necessary.", m.gtpc_tx_id);
}
//------------------------------------------------------------------------------
void sgwc_app::handle_itti_msg (itti_s11_downlink_data_notification_acknowledge& m)
{
Logger::sgwc_app().debug("Received S11 DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE sender teid " TEID_FMT " gtpc_tx_id " PROC_ID_FMT " ", m.teid, m.gtpc_tx_id);
......@@ -549,6 +566,33 @@ void sgwc_app::handle_itti_msg (itti_s5s8_release_access_bearers_response& m)
}
}
//------------------------------------------------------------------------------
void sgwc_app::handle_itti_msg (itti_s5s8_remote_peer_not_responding& m)
{
if (!m.l_teid) {
// Node not responding to path management messages: ECHO
// TODO
Logger::sgwc_app().debug("Received S5S8 REMOTE_PEER_NOT_RESPONDING event gtpc_tx_id " PROC_ID_FMT " local teid 0", m.gtpc_tx_id);
} else if (is_s5s8sgw_teid_2_sgw_contexts(m.l_teid)) {
Logger::sgwc_app().debug("Received S5S8 REMOTE_PEER_NOT_RESPONDING event gtpc_tx_id " PROC_ID_FMT " local teid " TEID_FMT ".", m.gtpc_tx_id, m.l_teid);
std::pair<std::shared_ptr<sgw_eps_bearer_context>, std::shared_ptr<sgw_pdn_connection>> p = s5s8sgw_teid_2_sgw_contexts(m.l_teid);
if ((p.first.get()) && (p.second.get())) {
p.first->handle_itti_msg(m, p.second);
// cleanup
if (0 == p.first->get_num_pdn_connections()) {
delete_sgw_eps_bearer_context(p.first);
} else {
Logger::sgwc_app().debug("sgw_eps_bearer_context: %s!", p.first->toString().c_str());
}
} else {
Logger::sgwc_app().debug("Received S5S8 REMOTE_PEER_NOT_RESPONDING with local teid " TEID_FMT ", SGW contexts not found, ignore!", m.l_teid);
}
} else {
Logger::sgwc_app().debug("Received S5S8 REMOTE_PEER_NOT_RESPONDING with local teid " TEID_FMT ", SGW EPS bearer context not found, ignore!", m.l_teid);
}
}
//------------------------------------------------------------------------------
void sgwc_app::handle_itti_msg (itti_s5s8_downlink_data_notification& m)
{
......
......@@ -117,11 +117,13 @@ public:
void handle_itti_msg (itti_s11_delete_session_request& m);
void handle_itti_msg (itti_s11_modify_bearer_request& m);
void handle_itti_msg (itti_s11_release_access_bearers_request& m);
void handle_itti_msg (itti_s11_remote_peer_not_responding& m);
void handle_itti_msg (itti_s11_downlink_data_notification_acknowledge& m);
void handle_itti_msg (itti_s5s8_create_session_response& m);
void handle_itti_msg (itti_s5s8_delete_session_response& m);
void handle_itti_msg (itti_s5s8_modify_bearer_response& m);
void handle_itti_msg (itti_s5s8_release_access_bearers_response& m);
void handle_itti_msg (itti_s5s8_remote_peer_not_responding& m);
void handle_itti_msg (itti_s5s8_downlink_data_notification& m);
};
......
......@@ -373,6 +373,17 @@ void sgw_eps_bearer_context::handle_itti_msg (itti_s5s8_release_access_bearers_r
}
}
//------------------------------------------------------------------------------
void sgw_eps_bearer_context::handle_itti_msg (itti_s5s8_remote_peer_not_responding& resp, std::shared_ptr<sgw_pdn_connection> spc)
{
shared_ptr<sebc_procedure> sp = find_procedure(resp.gtpc_tx_id);
if (sp.get()) {
sp->handle_itti_msg(resp, shared_from_this(), spc);
remove_procedure(sp.get());
} else {
Logger::sgwc_app().debug("S5S8 RELEASE_ACCESS_BEARERS_RESPONSE ignored, no procedure found gtpc_tx_id " PROC_ID_FMT "!", resp.gtpc_tx_id);
}
}
//------------------------------------------------------------------------------
void sgw_eps_bearer_context::handle_itti_msg (itti_s5s8_delete_session_response& dsresp, std::shared_ptr<sgw_pdn_connection> spc)
{
shared_ptr<sebc_procedure> sp = find_procedure(dsresp.gtpc_tx_id);
......
......@@ -231,6 +231,7 @@ public:
void handle_itti_msg (itti_s5s8_modify_bearer_response& m, std::shared_ptr<sgw_pdn_connection> spc);
void handle_itti_msg (itti_s5s8_release_access_bearers_response& m, std::shared_ptr<sgw_pdn_connection> spc);
void handle_itti_msg (itti_s5s8_downlink_data_notification& m, std::shared_ptr<sgw_pdn_connection> spc);
void handle_itti_msg (itti_s5s8_remote_peer_not_responding& resp, std::shared_ptr<sgw_pdn_connection> spc);
std::string toString() const;
......
......@@ -55,6 +55,10 @@ void sebc_procedure::handle_itti_msg (itti_s5s8_release_access_bearers_response&
{
Logger::sgwc_app().error( "Unhandled message itti_s5s8_release_access_bearers_response");
}
void sebc_procedure::handle_itti_msg (itti_s5s8_remote_peer_not_responding& resp, std::shared_ptr<sgw_eps_bearer_context> ebc, std::shared_ptr<sgw_pdn_connection> spc)
{
Logger::sgwc_app().error( "Unhandled message itti_s5s8_remote_peer_not_responding");
}
void sebc_procedure::handle_itti_msg (itti_s5s8_downlink_data_notification& resp, std::shared_ptr<sgw_eps_bearer_context> ebc, std::shared_ptr<sgw_pdn_connection> spc)
{