2017-03-27 10:32:24 +00:00
|
|
|
#define TRACE_MODULE _esm_handler
|
|
|
|
|
|
|
|
#include "core_debug.h"
|
|
|
|
|
|
|
|
#include "nas_message.h"
|
|
|
|
|
2017-04-11 06:13:30 +00:00
|
|
|
#include "mme_context.h"
|
2017-04-04 01:49:19 +00:00
|
|
|
#include "mme_event.h"
|
2017-04-13 10:58:58 +00:00
|
|
|
#include "esm_build.h"
|
|
|
|
#include "s1ap_build.h"
|
|
|
|
#include "s1ap_path.h"
|
2017-08-10 07:47:18 +00:00
|
|
|
#include "nas_path.h"
|
2017-04-11 06:13:30 +00:00
|
|
|
#include "mme_s11_build.h"
|
|
|
|
#include "mme_s11_path.h"
|
2017-04-08 02:38:09 +00:00
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
void esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
2017-04-08 02:38:09 +00:00
|
|
|
nas_pdn_connectivity_request_t *pdn_connectivity_request)
|
|
|
|
{
|
2017-04-14 02:51:27 +00:00
|
|
|
if (pdn_connectivity_request->presencemask &
|
2017-04-14 10:18:08 +00:00
|
|
|
NAS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT)
|
2017-04-14 02:51:27 +00:00
|
|
|
{
|
|
|
|
nas_protocol_configuration_options_t *protocol_configuration_options =
|
|
|
|
&pdn_connectivity_request->protocol_configuration_options;
|
|
|
|
bearer->ue_pco_len = protocol_configuration_options->length;
|
|
|
|
d_assert(bearer->ue_pco_len <= MAX_PCO_LEN, return,
|
|
|
|
"length(%d) exceeds MAX:%d", bearer->ue_pco_len, MAX_PCO_LEN);
|
|
|
|
memcpy(bearer->ue_pco, protocol_configuration_options->buffer,
|
|
|
|
bearer->ue_pco_len);
|
|
|
|
}
|
2017-04-08 02:38:09 +00:00
|
|
|
}
|
2017-04-11 06:07:46 +00:00
|
|
|
|
2017-08-10 07:47:18 +00:00
|
|
|
void esm_handle_information_request(mme_ue_t *mme_ue)
|
|
|
|
{
|
|
|
|
status_t rv;
|
|
|
|
pkbuf_t *esmbuf = NULL;
|
|
|
|
mme_sess_t *sess = NULL;
|
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
|
|
|
d_assert(mme_ue, return, "Null param");
|
|
|
|
sess = mme_sess_first(mme_ue);
|
|
|
|
d_assert(sess, return, "Null param");
|
|
|
|
bearer = mme_default_bearer_in_sess(sess);
|
|
|
|
d_assert(bearer, return, "Null param");
|
|
|
|
|
|
|
|
rv = esm_build_information_request(&esmbuf, bearer);
|
|
|
|
d_assert(rv == CORE_OK && esmbuf, return, "esm_build failed");
|
|
|
|
d_assert(nas_send_to_downlink_nas_transport(mme_ue, esmbuf) == CORE_OK,,);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
void esm_handle_information_response(mme_bearer_t *bearer,
|
2017-04-11 06:07:46 +00:00
|
|
|
nas_esm_information_response_t *esm_information_response)
|
|
|
|
{
|
2017-04-28 07:11:45 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2017-04-11 11:44:38 +00:00
|
|
|
pkbuf_t *pkbuf = NULL;
|
|
|
|
status_t rv;
|
2017-04-11 06:13:30 +00:00
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
d_assert(bearer, return, "Null param");
|
2017-04-28 07:11:45 +00:00
|
|
|
mme_ue = bearer->mme_ue;
|
|
|
|
d_assert(mme_ue, return, "Null param");
|
2017-04-12 04:45:57 +00:00
|
|
|
|
2017-04-11 12:38:24 +00:00
|
|
|
if (esm_information_response->presencemask &
|
|
|
|
NAS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT)
|
|
|
|
{
|
2017-04-28 07:11:45 +00:00
|
|
|
bearer->pdn = mme_pdn_find_by_apn(mme_ue,
|
2017-04-11 12:38:24 +00:00
|
|
|
esm_information_response->access_point_name.apn);
|
2017-04-13 10:15:53 +00:00
|
|
|
d_assert(bearer->pdn, return, "No PDN Context[APN:%s])",
|
2017-04-11 12:38:24 +00:00
|
|
|
esm_information_response->access_point_name.apn);
|
|
|
|
}
|
|
|
|
|
2017-04-11 14:25:33 +00:00
|
|
|
if (esm_information_response->presencemask &
|
|
|
|
NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT)
|
|
|
|
{
|
|
|
|
nas_protocol_configuration_options_t *protocol_configuration_options =
|
|
|
|
&esm_information_response->protocol_configuration_options;
|
2017-04-13 10:15:53 +00:00
|
|
|
bearer->ue_pco_len = protocol_configuration_options->length;
|
|
|
|
d_assert(bearer->ue_pco_len <= MAX_PCO_LEN, return,
|
|
|
|
"length(%d) exceeds MAX:%d", bearer->ue_pco_len, MAX_PCO_LEN);
|
|
|
|
memcpy(bearer->ue_pco, protocol_configuration_options->buffer,
|
|
|
|
bearer->ue_pco_len);
|
2017-04-11 14:25:33 +00:00
|
|
|
}
|
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
rv = mme_s11_build_create_session_request(&pkbuf, bearer);
|
2017-04-11 11:44:38 +00:00
|
|
|
d_assert(rv == CORE_OK, return, "S11 build error");
|
|
|
|
|
2017-04-13 10:15:53 +00:00
|
|
|
rv = mme_s11_send_to_sgw(bearer->sgw,
|
2017-04-11 11:44:38 +00:00
|
|
|
GTP_CREATE_SESSION_REQUEST_TYPE, 0, pkbuf);
|
|
|
|
d_assert(rv == CORE_OK, return, "S11 send error");
|
2017-04-11 06:07:46 +00:00
|
|
|
}
|