event name changes for new archi

This commit is contained in:
Sukchan Lee 2017-08-26 00:25:55 +09:00
parent 8d1a5e2d35
commit 0242e104c8
20 changed files with 85 additions and 96 deletions

View File

@ -57,7 +57,7 @@ static void event_emm_to_esm(
memcpy(esmbuf->payload,
esm_message_container->data, esm_message_container->len);
event_set(&e, MME_EVT_ESM_BEARER_MSG);
event_set(&e, MME_EVT_ESM_MESSAGE);
event_set_param1(&e, (c_uintptr_t)bearer->index);
event_set_param3(&e, (c_uintptr_t)esmbuf);
mme_event_send(&e);
@ -357,34 +357,6 @@ void emm_handle_identity_response(
}
}
void emm_handle_authentication_request(mme_ue_t *mme_ue)
{
pkbuf_t *emmbuf = NULL;
nas_message_t message;
nas_authentication_request_t *authentication_request =
&message.emm.authentication_request;
d_assert(mme_ue, return, "Null param");
d_trace(3, "[NAS] Authentication request : UE[%s] <-- EMM\n",
mme_ue->imsi_bcd);
memset(&message, 0, sizeof(message));
message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.emm.h.message_type = NAS_AUTHENTICATION_REQUEST;
memcpy(authentication_request->authentication_parameter_rand.rand,
mme_ue->rand, RAND_LEN);
memcpy(authentication_request->authentication_parameter_autn.autn,
mme_ue->autn, AUTN_LEN);
authentication_request->authentication_parameter_autn.length =
AUTN_LEN;
d_assert(nas_plain_encode(&emmbuf, &message) == CORE_OK && emmbuf,,);
d_assert(nas_send_to_downlink_nas_transport(mme_ue, emmbuf) == CORE_OK,,);
}
void emm_handle_authentication_response(mme_ue_t *mme_ue,
nas_authentication_response_t *authentication_response)
{

View File

@ -20,7 +20,6 @@ CORE_DECLARE(void) emm_handle_identity_request(mme_ue_t *mme_ue);
CORE_DECLARE(void) emm_handle_identity_response(
mme_ue_t *mme_ue, nas_identity_response_t *identity_response);
CORE_DECLARE(void) emm_handle_authentication_request(mme_ue_t *mme_ue);
CORE_DECLARE(void) emm_handle_authentication_response(
mme_ue_t *mme_ue, nas_authentication_response_t *authentication_response);

View File

@ -48,7 +48,7 @@ void emm_state_operational(fsm_t *s, event_t *e)
{
break;
}
case MME_EVT_EMM_UE_MSG:
case MME_EVT_EMM_MESSAGE:
{
index_t index = event_get_param1(e);
mme_ue_t *mme_ue = NULL;
@ -201,7 +201,7 @@ void emm_state_operational(fsm_t *s, event_t *e)
}
break;
}
case MME_EVT_EMM_UE_T3413:
case MME_EVT_EMM_T3413:
{
index_t index = event_get_param1(e);
mme_ue_t *mme_ue = NULL;

View File

@ -44,7 +44,7 @@ void esm_state_operational(fsm_t *s, event_t *e)
{
break;
}
case MME_EVT_ESM_BEARER_MSG:
case MME_EVT_ESM_MESSAGE:
{
index_t index = event_get_param1(e);
mme_bearer_t *bearer = NULL;

View File

@ -1076,7 +1076,7 @@ mme_ue_t* mme_ue_add(enb_ue_t *enb_ue)
list_init(&mme_ue->sess_list);
/* Create t3413 timer */
mme_ue->t3413 = event_timer(&self.tm_service, MME_EVT_EMM_UE_T3413,
mme_ue->t3413 = event_timer(&self.tm_service, MME_EVT_EMM_T3413,
self.t3413_value * 1000, mme_ue->index);
mme_ue->enb_ue = enb_ue;

View File

@ -176,8 +176,6 @@ struct _mme_ue_t {
c_uint8_t xres[MAX_RES_LEN];
c_uint8_t xres_len;
c_uint8_t kasme[SHA256_DIGEST_SIZE];
c_uint8_t rand[RAND_LEN];
c_uint8_t autn[AUTN_LEN];
c_uint8_t knas_int[SHA256_DIGEST_SIZE/2];
c_uint8_t knas_enc[SHA256_DIGEST_SIZE/2];
c_uint8_t kenb[SHA256_DIGEST_SIZE];

View File

@ -16,25 +16,25 @@ char* mme_event_get_name(event_t *e)
case FSM_EXIT_SIG:
return FSM_NAME_EXIT_SIG;
case MME_EVT_S1AP_ENB_MSG:
return "MME_EVT_S1AP_ENB_MSG";
case MME_EVT_S1AP_ENB_LO_ACCEPT:
return "MME_EVT_S1AP_ENB_LO_ACCEPT";
case MME_EVT_S1AP_ENB_LO_CONNREFUSED:
return"MME_EVT_S1AP_ENB_LO_CONNREFUSED";
case MME_EVT_S1AP_MESSAGE:
return "MME_EVT_S1AP_MESSAGE";
case MME_EVT_S1AP_LO_ACCEPT:
return "MME_EVT_S1AP_LO_ACCEPT";
case MME_EVT_S1AP_LO_CONNREFUSED:
return"MME_EVT_S1AP_LO_CONNREFUSED";
case MME_EVT_EMM_UE_MSG:
return "MME_EVT_EMM_UE_MSG";
case MME_EVT_EMM_UE_T3413:
return "MME_EVT_EMM_UE_T3413";
case MME_EVT_EMM_MESSAGE:
return "MME_EVT_EMM_MESSAGE";
case MME_EVT_EMM_T3413:
return "MME_EVT_EMM_T3413";
case MME_EVT_ESM_BEARER_MSG:
return "MME_EVT_ESM_BEARER_MSG";
case MME_EVT_ESM_MESSAGE:
return "MME_EVT_ESM_MESSAGE";
case MME_EVT_S11_UE_MSG:
return "MME_EVT_S11_UE_MSG";
case MME_EVT_S11_TRANSACTION_T3:
return "MME_EVT_S11_TRANSACTION_T3";
case MME_EVT_S11_MESSAGE:
return "MME_EVT_S11_MESSAGE";
case MME_EVT_S11_T3:
return "MME_EVT_S11_T3";
case MME_EVT_S6A_MESSAGE:
return "MME_EVT_S6A_MESSAGE";

View File

@ -12,17 +12,17 @@ extern "C" {
typedef enum {
MME_EVT_BASE = FSM_USER_SIG,
MME_EVT_S1AP_ENB_MSG,
MME_EVT_S1AP_ENB_LO_ACCEPT,
MME_EVT_S1AP_ENB_LO_CONNREFUSED,
MME_EVT_S1AP_MESSAGE,
MME_EVT_S1AP_LO_ACCEPT,
MME_EVT_S1AP_LO_CONNREFUSED,
MME_EVT_EMM_UE_MSG,
MME_EVT_EMM_UE_T3413,
MME_EVT_EMM_MESSAGE,
MME_EVT_EMM_T3413,
MME_EVT_ESM_BEARER_MSG,
MME_EVT_ESM_MESSAGE,
MME_EVT_S11_UE_MSG,
MME_EVT_S11_TRANSACTION_T3,
MME_EVT_S11_MESSAGE,
MME_EVT_S11_T3,
MME_EVT_S6A_MESSAGE,

View File

@ -70,7 +70,7 @@ static void *THREAD_FUNC sm_main(thread_id id, void *data)
"MME event queue creation failed");
tm_service_init(&mme_self()->tm_service);
gtp_xact_init(&mme_self()->gtp_xact_ctx,
&mme_self()->tm_service, MME_EVT_S11_TRANSACTION_T3);
&mme_self()->tm_service, MME_EVT_S11_T3);
fsm_create(&mme_sm, mme_state_initial, mme_state_final);
fsm_init(&mme_sm, 0);

View File

@ -38,7 +38,7 @@ static int _gtpv2_c_recv_cb(net_sock_t *sock, void *data)
INET_NTOP(&gnode.addr, buf), gnode.port);
d_trace_hex(10, pkbuf->payload, pkbuf->len);
event_set(&e, MME_EVT_S11_UE_MSG);
event_set(&e, MME_EVT_S11_MESSAGE);
event_set_param1(&e, (c_uintptr_t)sock);
event_set_param2(&e, (c_uintptr_t)sgw);
event_set_param3(&e, (c_uintptr_t)pkbuf);

View File

@ -4,9 +4,15 @@
#include "mme_s6a_handler.h"
#include "s6a_message.h"
#include "nas_path.h"
void mme_s6a_handle_aia(mme_ue_t *mme_ue, s6a_aia_message_t *aia_message)
{
pkbuf_t *emmbuf = NULL;
nas_message_t message;
nas_authentication_request_t *authentication_request =
&message.emm.authentication_request;
e_utran_vector_t *e_utran_vector = NULL;
d_assert(mme_ue, return, "Null param");
@ -16,9 +22,24 @@ void mme_s6a_handle_aia(mme_ue_t *mme_ue, s6a_aia_message_t *aia_message)
mme_ue->xres_len = e_utran_vector->xres_len;
memcpy(mme_ue->xres, e_utran_vector->xres, mme_ue->xres_len);
memcpy(mme_ue->autn, e_utran_vector->autn, AUTN_LEN);
memcpy(mme_ue->rand, e_utran_vector->rand, RAND_LEN);
memcpy(mme_ue->kasme, e_utran_vector->kasme, SHA256_DIGEST_SIZE);
d_trace(3, "[NAS] Authentication request : UE[%s] <-- EMM\n",
mme_ue->imsi_bcd);
memset(&message, 0, sizeof(message));
message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.emm.h.message_type = NAS_AUTHENTICATION_REQUEST;
memcpy(authentication_request->authentication_parameter_rand.rand,
e_utran_vector->rand, RAND_LEN);
memcpy(authentication_request->authentication_parameter_autn.autn,
e_utran_vector->autn, AUTN_LEN);
authentication_request->authentication_parameter_autn.length =
AUTN_LEN;
d_assert(nas_plain_encode(&emmbuf, &message) == CORE_OK && emmbuf,,);
d_assert(nas_send_to_downlink_nas_transport(mme_ue, emmbuf) == CORE_OK,,);
}
void mme_s6a_handle_ula(mme_ue_t *mme_ue, s6a_ula_message_t *ula_message)

View File

@ -82,7 +82,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case MME_EVT_S1AP_ENB_LO_ACCEPT:
case MME_EVT_S1AP_LO_ACCEPT:
{
int rc;
@ -111,7 +111,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case MME_EVT_S1AP_ENB_LO_CONNREFUSED:
case MME_EVT_S1AP_LO_CONNREFUSED:
{
index_t index = event_get_param1(e);
mme_enb_t *enb = NULL;
@ -131,7 +131,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case MME_EVT_S1AP_ENB_MSG:
case MME_EVT_S1AP_MESSAGE:
{
s1ap_message_t message;
index_t index = event_get_param1(e);
@ -154,7 +154,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
pkbuf_free(pkbuf);
break;
}
case MME_EVT_EMM_UE_MSG:
case MME_EVT_EMM_MESSAGE:
{
nas_message_t message;
index_t index = event_get_param1(e);
@ -218,7 +218,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case MME_EVT_EMM_UE_T3413:
case MME_EVT_EMM_T3413:
{
index_t index = event_get_param1(e);
mme_ue_t *mme_ue = NULL;
@ -232,7 +232,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case MME_EVT_ESM_BEARER_MSG:
case MME_EVT_ESM_MESSAGE:
{
nas_message_t message;
index_t index = event_get_param1(e);
@ -246,7 +246,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
d_assert(mme_ue = bearer->mme_ue, break, "No UE context");
d_assert(FSM_STATE(&bearer->sm), break, "No ESM State Machine");
if (event_get(e) == MME_EVT_ESM_BEARER_MSG)
if (event_get(e) == MME_EVT_ESM_MESSAGE)
{
pkbuf = (pkbuf_t *)event_get_param3(e);
d_assert(pkbuf, break, "Null param");
@ -258,14 +258,14 @@ void mme_state_operational(fsm_t *s, event_t *e)
fsm_dispatch(&bearer->sm, (fsm_event_t*)e);
if (event_get(e) == MME_EVT_ESM_BEARER_MSG)
if (event_get(e) == MME_EVT_ESM_MESSAGE)
{
pkbuf_free(pkbuf);
}
break;
}
case MME_EVT_S11_UE_MSG:
case MME_EVT_S11_MESSAGE:
{
status_t rv;
net_sock_t *sock = (net_sock_t *)event_get_param1(e);
@ -376,7 +376,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
pkbuf_free(pkbuf);
break;
}
case MME_EVT_S11_TRANSACTION_T3:
case MME_EVT_S11_T3:
{
gtp_xact_timeout(event_get_param1(e));
break;
@ -407,7 +407,6 @@ void mme_state_operational(fsm_t *s, event_t *e)
}
mme_s6a_handle_aia(mme_ue, &s6a_message->aia_message);
emm_handle_authentication_request(mme_ue);
break;
}
case S6A_CMD_CODE_UPDATE_LOCATION:

View File

@ -84,7 +84,7 @@ static void event_s1ap_to_nas(enb_ue_t *enb_ue, S1ap_NAS_PDU_t *nasPdu)
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(&e, MME_EVT_EMM_MESSAGE);
event_set_param1(&e, (c_uintptr_t)enb_ue->index);
event_set_param2(&e, (c_uintptr_t)security_header_type.type);
event_set_param3(&e, (c_uintptr_t)nasbuf);
@ -106,7 +106,7 @@ static void event_s1ap_to_nas(enb_ue_t *enb_ue, S1ap_NAS_PDU_t *nasPdu)
h->procedure_transaction_identity);
if (bearer)
{
event_set(&e, MME_EVT_ESM_BEARER_MSG);
event_set(&e, MME_EVT_ESM_MESSAGE);
event_set_param1(&e, (c_uintptr_t)bearer->index);
event_set_param2(&e, (c_uintptr_t)security_header_type.type);
event_set_param3(&e, (c_uintptr_t)nasbuf);

View File

@ -68,7 +68,7 @@ static int _s1ap_accept_cb(net_sock_t *net_sock, void *data)
INET_NTOP(&remote_sock->remote.sin_addr.s_addr, buf));
event_t e;
event_set(&e, MME_EVT_S1AP_ENB_LO_ACCEPT);
event_set(&e, MME_EVT_S1AP_LO_ACCEPT);
event_set_param1(&e, (c_uintptr_t)remote_sock);
/* FIXME : how to close remote_sock */
mme_event_send(&e);
@ -91,7 +91,7 @@ static status_t s1ap_recv(net_sock_t *sock, pkbuf_t *pkbuf)
d_trace(10, "S1AP_PDU is received from eNB-Inf\n");
d_trace_hex(10, pkbuf->payload, pkbuf->len);
event_set(&e, MME_EVT_S1AP_ENB_MSG);
event_set(&e, MME_EVT_S1AP_MESSAGE);
event_set_param1(&e, (c_uintptr_t)sock->app_index);
event_set_param2(&e, (c_uintptr_t)pkbuf);
return mme_event_send(&e);
@ -136,7 +136,7 @@ int _s1ap_recv_cb(net_sock_t *sock, void *data)
event_t e;
event_set(&e, MME_EVT_S1AP_ENB_LO_CONNREFUSED);
event_set(&e, MME_EVT_S1AP_LO_CONNREFUSED);
event_set_param1(&e, (c_uintptr_t)sock->app_index);
mme_event_send(&e);

View File

@ -43,7 +43,7 @@ void s1ap_state_operational(fsm_t *s, event_t *e)
{
break;
}
case MME_EVT_S1AP_ENB_MSG:
case MME_EVT_S1AP_MESSAGE:
{
index_t index = event_get_param1(e);
mme_enb_t *enb = NULL;

View File

@ -15,13 +15,13 @@ char* sgw_event_get_name(event_t *e)
case FSM_EXIT_SIG:
return FSM_NAME_EXIT_SIG;
case SGW_EVT_S11_SESSION_MSG:
return "SGW_EVT_S11_SESSION_MSG";
case SGW_EVT_S5C_SESSION_MSG:
return "SGW_EVT_S5C_SESSION_MSG";
case SGW_EVT_S11_MESSAGE:
return "SGW_EVT_S11_MESSAGE";
case SGW_EVT_S5C_MESSAGE:
return "SGW_EVT_S5C_MESSAGE";
case SGW_EVT_TRANSACTION_T3:
return "SGW_EVT_TRANSACTION_T3";
case SGW_EVT_GTP_T3:
return "SGW_EVT_GTP_T3";
default:
break;

View File

@ -10,10 +10,10 @@ extern "C" {
typedef enum {
SGW_EVT_BASE = FSM_USER_SIG,
SGW_EVT_S11_SESSION_MSG,
SGW_EVT_S5C_SESSION_MSG,
SGW_EVT_S11_MESSAGE,
SGW_EVT_S5C_MESSAGE,
SGW_EVT_TRANSACTION_T3,
SGW_EVT_GTP_T3,
SGW_EVT_LO_DLDATA_NOTI,

View File

@ -63,7 +63,7 @@ static void *THREAD_FUNC sm_main(thread_id id, void *data)
"SGW event queue creation failed");
tm_service_init(&sgw_self()->tm_service);
gtp_xact_init(&sgw_self()->gtp_xact_ctx,
&sgw_self()->tm_service, SGW_EVT_TRANSACTION_T3);
&sgw_self()->tm_service, SGW_EVT_GTP_T3);
fsm_create(&sgw_sm, sgw_state_initial, sgw_state_final);
fsm_init(&sgw_sm, 0);

View File

@ -32,12 +32,12 @@ static int _gtpv2_c_recv_cb(net_sock_t *sock, void *data)
if (GTP_COMPARE_NODE(gnode, &sgw_self()->s11_node))
{
d_trace(10, "S11 PDU received from MME\n");
event_set(&e, SGW_EVT_S11_SESSION_MSG);
event_set(&e, SGW_EVT_S11_MESSAGE);
}
else if (GTP_COMPARE_NODE(gnode, &sgw_self()->s5c_node))
{
d_trace(10, "S5-C PDU received from PGW\n");
event_set(&e, SGW_EVT_S5C_SESSION_MSG);
event_set(&e, SGW_EVT_S5C_MESSAGE);
}
else
d_assert(0, pkbuf_free(pkbuf); return -1, "Unknown GTP-Node");

View File

@ -52,8 +52,8 @@ void sgw_state_operational(fsm_t *s, event_t *e)
}
break;
}
case SGW_EVT_S11_SESSION_MSG:
case SGW_EVT_S5C_SESSION_MSG:
case SGW_EVT_S11_MESSAGE:
case SGW_EVT_S5C_MESSAGE:
{
status_t rv;
net_sock_t *sock = (net_sock_t *)event_get_param1(e);
@ -120,7 +120,7 @@ void sgw_state_operational(fsm_t *s, event_t *e)
pkbuf_free(pkbuf);
break;
}
case SGW_EVT_TRANSACTION_T3:
case SGW_EVT_GTP_T3:
{
gtp_xact_timeout(event_get_param1(e));
break;