update it
This commit is contained in:
parent
1b98807ec8
commit
f19673d935
|
@ -16,34 +16,15 @@
|
|||
#include "s1ap_build.h"
|
||||
#include "s1ap_path.h"
|
||||
|
||||
static void event_emm_to_esm(mme_bearer_t *bearer,
|
||||
nas_esm_message_container_t *bearer_message_container)
|
||||
{
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
event_t e;
|
||||
|
||||
d_assert(bearer, return, "Null param");
|
||||
d_assert(bearer_message_container, return, "Null param");
|
||||
|
||||
/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
sendbuf = pkbuf_alloc(NAS_HEADROOM, bearer_message_container->len);
|
||||
d_assert(sendbuf, return, "Null param");
|
||||
memcpy(sendbuf->payload,
|
||||
bearer_message_container->data, bearer_message_container->len);
|
||||
|
||||
event_set(&e, MME_EVT_ESM_BEARER_MSG);
|
||||
event_set_param1(&e, (c_uintptr_t)bearer->index);
|
||||
event_set_param2(&e, (c_uintptr_t)sendbuf);
|
||||
mme_event_send(&e);
|
||||
}
|
||||
|
||||
void emm_handle_esm_message_container(
|
||||
mme_ue_t *ue, nas_esm_message_container_t *esm_message_container)
|
||||
{
|
||||
pkbuf_t *esmbuf = NULL;
|
||||
event_t e;
|
||||
|
||||
nas_esm_header_t *h = NULL;
|
||||
c_uint8_t pti = 0;
|
||||
c_uint8_t pti = NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
|
||||
c_uint8_t ebi = NAS_EPS_BEARER_IDENTITY_UNASSIGNED;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
||||
d_assert(ue, return, "Null param");
|
||||
|
@ -54,26 +35,27 @@ void emm_handle_esm_message_container(
|
|||
d_assert(h, return, "Null param");
|
||||
|
||||
pti = h->procedure_transaction_identity;
|
||||
if (pti == NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED)
|
||||
{
|
||||
d_error("Procedure Trasaction is NOT triggered by UE");
|
||||
return;
|
||||
}
|
||||
ebi = h->eps_bearer_identity;
|
||||
if (pti == NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED && ebi)
|
||||
bearer = mme_bearer_find_by_ebi(ue, ebi);
|
||||
else if (ebi == NAS_EPS_BEARER_IDENTITY_UNASSIGNED && pti)
|
||||
bearer = mme_bearer_find_by_pti(ue, pti);
|
||||
|
||||
bearer = mme_bearer_find_by_pti(ue, pti);
|
||||
if (!bearer)
|
||||
{
|
||||
bearer = mme_bearer_add(ue, pti);
|
||||
d_assert(bearer, return, "Null param");
|
||||
}
|
||||
else
|
||||
{
|
||||
d_warn("Duplicated: MME-UE-S1AP-ID[%d] sends "
|
||||
"PDN Connectivity Message[PTI(%d)]",
|
||||
ue->mme_ue_s1ap_id, bearer->pti);
|
||||
}
|
||||
d_assert(bearer, return, "Null param");
|
||||
|
||||
event_emm_to_esm(bearer, esm_message_container);
|
||||
/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
esmbuf = pkbuf_alloc(NAS_HEADROOM, esm_message_container->len);
|
||||
d_assert(esmbuf, return, "Null param");
|
||||
memcpy(esmbuf->payload,
|
||||
esm_message_container->data, esm_message_container->len);
|
||||
|
||||
event_set(&e, MME_EVT_ESM_BEARER_MSG);
|
||||
event_set_param1(&e, (c_uintptr_t)bearer->index);
|
||||
event_set_param2(&e, (c_uintptr_t)esmbuf);
|
||||
mme_event_send(&e);
|
||||
}
|
||||
|
||||
void emm_handle_attach_request(
|
||||
|
@ -282,3 +264,11 @@ void emm_handle_lo_create_session(mme_bearer_t *bearer)
|
|||
d_assert(s1ap_send_to_enb(enb, s1apbuf) == CORE_OK,, "s1ap send error");
|
||||
}
|
||||
|
||||
void emm_handle_attach_complete(
|
||||
mme_ue_t *ue, nas_attach_complete_t *attach_complete)
|
||||
{
|
||||
d_assert(ue, return, "Null param");
|
||||
|
||||
emm_handle_esm_message_container(
|
||||
ue, &attach_complete->esm_message_container);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,9 @@ CORE_DECLARE(void) emm_handle_attach_request(
|
|||
CORE_DECLARE(void) emm_handle_authentication_request(mme_ue_t *ue);
|
||||
CORE_DECLARE(void) emm_handle_authentication_response(
|
||||
mme_ue_t *ue, nas_authentication_response_t *authentication_response);
|
||||
|
||||
CORE_DECLARE(void) emm_handle_lo_create_session(mme_bearer_t *bearer);
|
||||
CORE_DECLARE(void) emm_handle_attach_complete(
|
||||
mme_ue_t *ue, nas_attach_complete_t *attach_complete);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -129,6 +129,8 @@ void emm_state_operational(fsm_t *s, event_t *e)
|
|||
{
|
||||
d_info("[NAS] Attach complete : UE[%s] --> EMM",
|
||||
ue->imsi_bcd);
|
||||
emm_handle_attach_complete(
|
||||
ue, &message->emm.attach_complete);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -102,6 +102,12 @@ void esm_state_operational(fsm_t *s, event_t *e)
|
|||
bearer, &message->esm.esm_information_response);
|
||||
break;
|
||||
}
|
||||
case NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT:
|
||||
{
|
||||
d_info("[NAS] Activate default eps bearer context accept : "
|
||||
"UE[%s] --> ESM[%d]", ue->imsi_bcd, bearer->pti);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
d_warn("Not implemented(type:%d)",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
static void event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
||||
{
|
||||
nas_esm_header_t *h = NULL;
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
pkbuf_t *nasbuf = NULL;
|
||||
event_t e;
|
||||
|
||||
d_assert(ue, return, "Null param");
|
||||
|
@ -23,20 +23,20 @@ static void event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
|||
|
||||
/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
sendbuf = pkbuf_alloc(NAS_HEADROOM, nasPdu->size);
|
||||
d_assert(sendbuf, return, "Null param");
|
||||
memcpy(sendbuf->payload, nasPdu->buf, nasPdu->size);
|
||||
nasbuf = pkbuf_alloc(NAS_HEADROOM, nasPdu->size);
|
||||
d_assert(nasbuf, return, "Null param");
|
||||
memcpy(nasbuf->payload, nasPdu->buf, nasPdu->size);
|
||||
|
||||
d_assert(nas_security_decode(ue, sendbuf) == CORE_OK,
|
||||
pkbuf_free(sendbuf); return, "Can't decode NAS_PDU");
|
||||
d_assert(nas_security_decode(ue, nasbuf) == CORE_OK,
|
||||
pkbuf_free(nasbuf); return, "Can't decode NAS_PDU");
|
||||
|
||||
h = sendbuf->payload;
|
||||
d_assert(h, pkbuf_free(sendbuf); return, "Null param");
|
||||
h = nasbuf->payload;
|
||||
d_assert(h, pkbuf_free(nasbuf); return, "Null param");
|
||||
if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM)
|
||||
{
|
||||
event_set(&e, MME_EVT_EMM_UE_MSG);
|
||||
event_set_param1(&e, (c_uintptr_t)ue->index);
|
||||
event_set_param2(&e, (c_uintptr_t)sendbuf);
|
||||
event_set_param2(&e, (c_uintptr_t)nasbuf);
|
||||
mme_event_send(&e);
|
||||
}
|
||||
else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM)
|
||||
|
@ -47,7 +47,7 @@ static void event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
|||
{
|
||||
event_set(&e, MME_EVT_ESM_BEARER_MSG);
|
||||
event_set_param1(&e, (c_uintptr_t)bearer->index);
|
||||
event_set_param2(&e, (c_uintptr_t)sendbuf);
|
||||
event_set_param2(&e, (c_uintptr_t)nasbuf);
|
||||
mme_event_send(&e);
|
||||
}
|
||||
else
|
||||
|
@ -55,7 +55,7 @@ static void event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
|||
ue->imsi_bcd, h->procedure_transaction_identity);
|
||||
}
|
||||
else
|
||||
d_assert(0, pkbuf_free(sendbuf); return, "Unknown protocol:%d",
|
||||
d_assert(0, pkbuf_free(nasbuf); return, "Unknown protocol:%d",
|
||||
h->protocol_discriminator);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
S1ap_S1SetupRequestIEs_t *ies = NULL;
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
pkbuf_t *s1apbuf = NULL;
|
||||
c_uint32_t enb_id;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
|
@ -87,7 +87,7 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
cause.present = S1ap_Cause_PR_protocol;
|
||||
cause.choice.protocol =
|
||||
S1ap_CauseProtocol_message_not_compatible_with_receiver_state;
|
||||
rv = s1ap_build_setup_failure(&sendbuf, cause);
|
||||
rv = s1ap_build_setup_failure(&s1apbuf, cause);
|
||||
}
|
||||
#endif
|
||||
d_assert(enb->s1ap_sock, return,);
|
||||
|
@ -97,9 +97,9 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
|||
|
||||
enb->enb_id = enb_id;
|
||||
|
||||
d_assert(s1ap_build_setup_rsp(&sendbuf) == CORE_OK,
|
||||
d_assert(s1ap_build_setup_rsp(&s1apbuf) == CORE_OK,
|
||||
return, "build error");
|
||||
d_assert(s1ap_send_to_enb(enb, sendbuf) == CORE_OK, , "send error");
|
||||
d_assert(s1ap_send_to_enb(enb, s1apbuf) == CORE_OK, , "send error");
|
||||
|
||||
d_assert(enb->s1ap_sock, return,);
|
||||
d_info("[S1AP] S1SetupResponse: eNB[%s:%d] <-- MME",
|
||||
|
|
|
@ -125,10 +125,12 @@ static void nas_sm_test1(abts_case *tc, void *data)
|
|||
pkbuf_free(recvbuf);
|
||||
|
||||
/* Send UE Capability Info Indication */
|
||||
#if 0
|
||||
rv = tests1ap_build_ue_capability_info_indication(&sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
#endif
|
||||
|
||||
/* Send Initial Context Setup Response */
|
||||
rv = tests1ap_build_initial_context_setup_response(&sendbuf);
|
||||
|
@ -136,13 +138,13 @@ static void nas_sm_test1(abts_case *tc, void *data)
|
|||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
/* Send Attach Complete */
|
||||
/* Send Attach Complete + Activate default EPS bearer cotext accept */
|
||||
rv = tests1ap_build_attach_complete(&sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
core_sleep(time_from_msec(1000));
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR);
|
||||
/* eNB disonncect from MME */
|
||||
|
|
Loading…
Reference in New Issue