2017-04-12 12:44:18 +00:00
|
|
|
#define TRACE_MODULE _mme_s11_handler
|
|
|
|
|
|
|
|
#include "core_debug.h"
|
|
|
|
|
|
|
|
#include "gtp_types.h"
|
|
|
|
|
|
|
|
#include "mme_event.h"
|
|
|
|
#include "mme_context.h"
|
|
|
|
#include "mme_s11_handler.h"
|
|
|
|
|
|
|
|
void mme_s11_handle_create_session_response(
|
|
|
|
mme_ue_t *ue, gtp_create_session_response_t *rsp)
|
|
|
|
{
|
2017-04-12 13:27:32 +00:00
|
|
|
event_t e;
|
|
|
|
|
2017-04-12 12:44:18 +00:00
|
|
|
gtp_f_teid_t *sgw_s11_teid = NULL;
|
|
|
|
gtp_f_teid_t *sgw_s1u_teid = NULL;
|
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
2017-04-13 03:21:47 +00:00
|
|
|
pdn_t *pdn = NULL;
|
2017-04-12 12:44:18 +00:00
|
|
|
|
|
|
|
d_assert(ue, return, "Null param");
|
|
|
|
d_assert(rsp, return, "Null param");
|
|
|
|
|
|
|
|
if (rsp->sender_f_teid_for_control_plane.presence == 0)
|
|
|
|
{
|
|
|
|
d_error("No GTP TEID");
|
|
|
|
return;
|
|
|
|
}
|
2017-04-13 03:21:47 +00:00
|
|
|
if (rsp->pdn_address_allocation.presence == 0)
|
|
|
|
{
|
|
|
|
d_error("No PDN Address Allocation");
|
|
|
|
return;
|
|
|
|
}
|
2017-04-12 12:44:18 +00:00
|
|
|
if (rsp->bearer_contexts_created.presence == 0)
|
|
|
|
{
|
|
|
|
d_error("No Bearer");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (rsp->bearer_contexts_created.eps_bearer_id.presence == 0)
|
|
|
|
{
|
|
|
|
d_error("No EPS Bearer ID");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (rsp->bearer_contexts_created.s1_u_enodeb_f_teid.presence == 0)
|
|
|
|
{
|
|
|
|
d_error("No GTP TEID");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
bearer = mme_bearer_find_by_ebi(
|
2017-04-12 12:44:18 +00:00
|
|
|
ue, rsp->bearer_contexts_created.eps_bearer_id.u8);
|
2017-04-13 10:15:53 +00:00
|
|
|
d_assert(bearer, return, "No ESM Context");
|
|
|
|
pdn = bearer->pdn;
|
2017-04-13 03:21:47 +00:00
|
|
|
d_assert(pdn, return, "No PDN Context");
|
2017-04-12 12:44:18 +00:00
|
|
|
|
|
|
|
/* Receive Control Plane(UL) : SGW-S11 */
|
|
|
|
sgw_s11_teid = rsp->sender_f_teid_for_control_plane.data;
|
|
|
|
ue->sgw_s11_teid = ntohl(sgw_s11_teid->teid);
|
|
|
|
ue->sgw_s11_addr = sgw_s11_teid->ipv4_addr;
|
|
|
|
|
2017-04-13 03:21:47 +00:00
|
|
|
memcpy(&pdn->paa, rsp->pdn_address_allocation.data,
|
|
|
|
rsp->pdn_address_allocation.len);
|
|
|
|
|
|
|
|
if (rsp->protocol_configuration_options.presence)
|
|
|
|
{
|
2017-04-13 10:15:53 +00:00
|
|
|
bearer->pgw_pco_len = rsp->protocol_configuration_options.len;
|
|
|
|
memcpy(bearer->pgw_pco, rsp->protocol_configuration_options.data,
|
|
|
|
bearer->pgw_pco_len);
|
2017-04-13 03:21:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-12 12:44:18 +00:00
|
|
|
/* Receive Data Plane(UL) : SGW-S1U */
|
|
|
|
sgw_s1u_teid = rsp->bearer_contexts_created.s1_u_enodeb_f_teid.data;
|
2017-04-13 10:15:53 +00:00
|
|
|
bearer->sgw_s1u_teid = ntohl(sgw_s1u_teid->teid);
|
|
|
|
bearer->sgw_s1u_addr = sgw_s1u_teid->ipv4_addr;
|
2017-04-12 13:27:32 +00:00
|
|
|
|
2017-04-13 13:30:56 +00:00
|
|
|
d_info("[GTP] Create Session Response : "
|
|
|
|
"MME[%d] <-- SGW[%d]", ue->mme_s11_teid, ue->sgw_s11_teid);
|
|
|
|
|
2017-04-13 02:08:42 +00:00
|
|
|
event_set(&e, MME_EVT_EMM_BEARER_LO_CREATE_SESSION);
|
2017-04-13 10:15:53 +00:00
|
|
|
event_set_param1(&e, (c_uintptr_t)bearer->index);
|
2017-04-12 13:27:32 +00:00
|
|
|
mme_event_send(&e);
|
2017-04-12 12:44:18 +00:00
|
|
|
}
|