update it

This commit is contained in:
Sukchan Lee 2017-04-12 22:27:32 +09:00
parent 21839551cc
commit e2bbfabef7
10 changed files with 76 additions and 4 deletions

View File

@ -8,7 +8,7 @@ libmme_la_SOURCES = \
s1ap_build.h s1ap_handler.h s1ap_conv.h s1ap_path.h \
mme_s6a_handler.h \
nas_conv.h nas_security.h \
emm_handler.h \
emm_handler.h emm_build.h \
esm_handler.h esm_build.h \
mme_s11_path.h mme_s11_build.h mme_s11_handler.h \
mme_sm.h
@ -18,7 +18,7 @@ nodist_libmme_la_SOURCES = \
mme_init.c mme_event.c mme_context.c \
s1ap_sm.c s1ap_build.c s1ap_handler.c s1ap_conv.c s1ap_path.c \
mme_s6a_handler.c \
nas_conv.c nas_security.c emm_sm.c emm_handler.c \
nas_conv.c nas_security.c emm_sm.c emm_handler.c emm_build.c \
esm_sm.c esm_handler.c esm_build.c \
mme_s11_path.c mme_s11_build.c mme_s11_handler.c \
mme_sm.c

28
src/mme/emm_build.c Normal file
View File

@ -0,0 +1,28 @@
#define TRACE_MODULE _emm_build
#include "core_debug.h"
#include "nas_message.h"
#include "nas_security.h"
#include "emm_build.h"
status_t emm_build_attach_accept(pkbuf_t **pkbuf, mme_ue_t *ue)
{
nas_message_t message;
d_assert(ue, return CORE_ERROR, "Null param");
memset(&message, 0, sizeof(message));
message.h.security_header_type =
NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED;
message.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.emm.h.message_type = NAS_ATTACH_ACCEPT;
d_assert(nas_security_encode(pkbuf, ue, &message) == CORE_OK && *pkbuf,,);
return CORE_OK;
}

16
src/mme/emm_build.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __EMM_BUILD_H__
#define __EMM_BUILD_H__
#include "mme_context.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(status_t) emm_build_attach_accept(pkbuf_t **pkbuf, mme_ue_t *ue);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __EMM_BUILD_H__ */

View File

@ -10,10 +10,10 @@ extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(void) emm_handle_attach_request(
mme_ue_t *ue, nas_attach_request_t *attach_request);
mme_ue_t *ue, nas_attach_request_t *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);
mme_ue_t *ue, nas_authentication_response_t *authentication_response);
#ifdef __cplusplus
}

View File

@ -6,6 +6,7 @@
#include "mme_event.h"
#include "emm_handler.h"
#include "emm_build.h"
#include "mme_s6a_handler.h"
void emm_state_initial(fsm_t *s, event_t *e)

View File

@ -42,6 +42,7 @@ void esm_state_operational(fsm_t *s, event_t *e)
break;
}
case EVT_LO_MME_ESM_INFO_REQ:
case EVT_LO_MME_ESM_CREATE_SESSION:
{
index_t index = event_get_param1(e);
mme_esm_t *esm = NULL;
@ -68,6 +69,21 @@ void esm_state_operational(fsm_t *s, event_t *e)
"UE[%s] <--- ESM[%d]", ue->imsi_bcd, esm->pti);
break;
}
case EVT_LO_MME_ESM_CREATE_SESSION:
{
#if 0
pkbuf_t *pkbuf = NULL;
status_t rv;
rv = esm_build_information_request(&pkbuf, esm);
d_assert(rv == CORE_OK, break, "esm_build failed");
mme_event_nas_to_s1ap(ue, pkbuf);
d_info("[NAS] ESM information request : "
"UE[%s] <--- ESM[%d]", ue->imsi_bcd, esm->pti);
#endif
break;
}
}
break;

View File

@ -12,6 +12,7 @@ static char EVT_NAME_LO_MME_S1AP_ACCEPT[] = "LO_MME_S1AP_ACCEPT";
static char EVT_NAME_LO_MME_S1AP_CONNREFUSED[] = "LO_MME_S1AP_CONNREFUSED";
static char EVT_NAME_LO_MME_EMM_AUTH_REQ[] = "LO_MME_EMM_AUTH_REQ";
static char EVT_NAME_LO_MME_EMM_LOCATION_UPDATE[] = "LO_MME_EMM_LOCATION_UPDATE";
static char EVT_NAME_LO_MME_ESM_CREATE_SESSION[] = "LO_MME_ESM_CREATE_SESSION";
static char EVT_NAME_LO_MME_ESM_INFO_REQ[] = "LO_MME_ESM_INFO_REQ";
static char EVT_NAME_TM_MME_S11_T3[] = "TM_MME_S11_T3";
@ -41,6 +42,8 @@ char* mme_event_get_name(event_t *e)
return EVT_NAME_LO_MME_EMM_AUTH_REQ;
case EVT_LO_MME_EMM_LOCATION_UPDATE:
return EVT_NAME_LO_MME_EMM_LOCATION_UPDATE;
case EVT_LO_MME_ESM_CREATE_SESSION:
return EVT_NAME_LO_MME_ESM_CREATE_SESSION;
case EVT_LO_MME_ESM_INFO_REQ:
return EVT_NAME_LO_MME_ESM_INFO_REQ;

View File

@ -21,6 +21,7 @@ typedef enum {
EVT_LO_MME_S1AP_CONNREFUSED,
EVT_LO_MME_EMM_AUTH_REQ,
EVT_LO_MME_EMM_LOCATION_UPDATE,
EVT_LO_MME_ESM_CREATE_SESSION,
EVT_LO_MME_ESM_INFO_REQ,
EVT_TM_MME_S11_T3,

View File

@ -11,6 +11,8 @@
void mme_s11_handle_create_session_response(
mme_ue_t *ue, gtp_create_session_response_t *rsp)
{
event_t e;
gtp_f_teid_t *sgw_s11_teid = NULL;
gtp_f_teid_t *sgw_s1u_teid = NULL;
@ -53,4 +55,8 @@ void mme_s11_handle_create_session_response(
sgw_s1u_teid = rsp->bearer_contexts_created.s1_u_enodeb_f_teid.data;
esm->sgw_s1u_teid = ntohl(sgw_s1u_teid->teid);
esm->sgw_s1u_addr = sgw_s1u_teid->ipv4_addr;
event_set(&e, EVT_LO_MME_ESM_CREATE_SESSION);
event_set_param1(&e, (c_uintptr_t)esm->index);
mme_event_send(&e);
}

View File

@ -183,6 +183,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
break;
}
case EVT_LO_MME_ESM_INFO_REQ:
case EVT_LO_MME_ESM_CREATE_SESSION:
{
index_t index = event_get_param1(e);
mme_esm_t *esm = NULL;