From ccb913d1b66a4b6e04ae8737bf34f656d4de2cce Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Mon, 6 Mar 2017 10:00:30 +0900 Subject: [PATCH] update it --- src/mme/Makefile.am | 6 ++---- src/mme/init.c | 6 +++--- src/mme/s6a_init.c | 27 --------------------------- src/mme/{ue_s6a_sm.c => s6a_sm.c} | 25 +++++++++++++++++++++++-- src/mme/{s6a_message.h => s6a_sm.h} | 14 +++++--------- src/mme/ue_emm_sm.c | 2 +- 6 files changed, 34 insertions(+), 46 deletions(-) delete mode 100644 src/mme/s6a_init.c rename src/mme/{ue_s6a_sm.c => s6a_sm.c} (93%) rename src/mme/{s6a_message.h => s6a_sm.h} (53%) diff --git a/src/mme/Makefile.am b/src/mme/Makefile.am index 41f0c6a019..894d7ce50a 100644 --- a/src/mme/Makefile.am +++ b/src/mme/Makefile.am @@ -6,15 +6,13 @@ libmme_la_SOURCES = \ event.h context.h \ s1ap_build.h s1ap_conv.h s1ap_path.h \ nas_conv.h \ - s6a_message.h \ - sm.h + sm.h s6a_sm.h nodist_libmme_la_SOURCES = \ init.c event.c context.c \ s1ap_build.c s1ap_conv.c s1ap_path.c \ nas_conv.c \ - s6a_init.c ue_s6a_sm.c \ - mme_sm.c enb_s1ap_sm.c ue_emm_sm.c + mme_sm.c enb_s1ap_sm.c ue_emm_sm.c s6a_sm.c libmme_la_DEPENDENCIES = \ $(top_srcdir)/lib/core/src/libcore.la \ diff --git a/src/mme/init.c b/src/mme/init.c index fdf358a461..258e024b97 100644 --- a/src/mme/init.c +++ b/src/mme/init.c @@ -6,7 +6,7 @@ #include "context.h" #include "event.h" -#include "s6a_message.h" +#include "s6a_sm.h" #define EVENT_WAIT_TIMEOUT 10000 /* 10 msec */ @@ -21,7 +21,7 @@ status_t mme_initialize() rv = mme_ctx_init(); if (rv != CORE_OK) return rv; - ret = s6a_mme_init(); + ret = s6a_sm_init(); if (ret != 0) return -1; rv = thread_create(&mme_sm_thread, NULL, mme_sm_main, NULL); @@ -34,7 +34,7 @@ void mme_terminate(void) { thread_delete(mme_sm_thread); - s6a_mme_final(); + s6a_sm_final(); mme_ctx_final(); } diff --git a/src/mme/s6a_init.c b/src/mme/s6a_init.c deleted file mode 100644 index 4726c709f4..0000000000 --- a/src/mme/s6a_init.c +++ /dev/null @@ -1,27 +0,0 @@ -#define TRACE_MODULE _s6a_mme_init - -#include "core_debug.h" - -#include "s6a_lib.h" - -struct session_handler *s6a_mme_reg = NULL; - -status_t s6a_mme_init(void) -{ - status_t rv; - - rv = s6a_init(MODE_MME); - if (rv != CORE_OK) return rv; - - d_assert(fd_sess_handler_create(&s6a_mme_reg, - (void *)free, NULL, NULL) == 0, return -1,); - - return CORE_OK; -} - -void s6a_mme_final(void) -{ - d_assert(fd_sess_handler_destroy(&s6a_mme_reg, NULL) == 0,,); - - s6a_final(); -} diff --git a/src/mme/ue_s6a_sm.c b/src/mme/s6a_sm.c similarity index 93% rename from src/mme/ue_s6a_sm.c rename to src/mme/s6a_sm.c index c71f5cfd3a..6d31aecd00 100644 --- a/src/mme/ue_s6a_sm.c +++ b/src/mme/s6a_sm.c @@ -2,8 +2,10 @@ #include "core_debug.h" -#include "s6a_message.h" #include "s6a_lib.h" +#include "s6a_sm.h" + +static struct session_handler *s6a_mme_reg = NULL; struct sess_state { c_int32_t randval; /* a random value to store in Test-AVP */ @@ -31,7 +33,7 @@ int s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id) mi->randval = (int32_t)random(); /* Create the request */ - d_assert(fd_msg_new( s6a_cmd_air, MSGFL_ALLOC_ETEID, &req ) == 0, + d_assert(fd_msg_new(s6a_cmd_air, MSGFL_ALLOC_ETEID, &req) == 0, free(mi); return -1,); /* Create a new session */ @@ -221,3 +223,22 @@ out: return; } +status_t s6a_sm_init(void) +{ + status_t rv; + + rv = s6a_init(MODE_MME); + if (rv != CORE_OK) return rv; + + d_assert(fd_sess_handler_create(&s6a_mme_reg, + (void *)free, NULL, NULL) == 0, return -1,); + + return CORE_OK; +} + +void s6a_sm_final(void) +{ + d_assert(fd_sess_handler_destroy(&s6a_mme_reg, NULL) == 0,,); + + s6a_final(); +} diff --git a/src/mme/s6a_message.h b/src/mme/s6a_sm.h similarity index 53% rename from src/mme/s6a_message.h rename to src/mme/s6a_sm.h index 60309d0b73..9995d72e9f 100644 --- a/src/mme/s6a_message.h +++ b/src/mme/s6a_sm.h @@ -1,20 +1,16 @@ -#ifndef _S6A_AUTH_H__ -#define _S6A_AUTH_H__ +#ifndef __S6A_SM_H__ +#define __S6A_SM_H__ #include "core_errno.h" -#include "plmn_id.h" - #include "context.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -extern struct session_handler *s6a_mme_reg; - -CORE_DECLARE(status_t) s6a_mme_init(void); -CORE_DECLARE(void) s6a_mme_final(void); +CORE_DECLARE(status_t) s6a_sm_init(void); +CORE_DECLARE(void) s6a_sm_final(void); CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id); @@ -22,5 +18,5 @@ CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id); } #endif /* __cplusplus */ -#endif +#endif /* __S6A_SM_H__ */ diff --git a/src/mme/ue_emm_sm.c b/src/mme/ue_emm_sm.c index 04840ed0b7..bbc2a9d0e3 100644 --- a/src/mme/ue_emm_sm.c +++ b/src/mme/ue_emm_sm.c @@ -4,7 +4,7 @@ #include "nas_message.h" #include "nas_conv.h" -#include "s6a_message.h" +#include "s6a_sm.h" #include "sm.h" #include "context.h"