update it

This commit is contained in:
Sukchan Lee 2017-04-04 11:00:25 +09:00
parent 67fb7cf8f2
commit 9083860434
8 changed files with 52 additions and 48 deletions

6
main.c
View File

@ -129,11 +129,11 @@ int main(int argc, char *argv[])
d_trace_level(&_ue_emm_sm, 100); d_trace_level(&_ue_emm_sm, 100);
extern int _s1ap_recv; extern int _s1ap_recv;
d_trace_level(&_ue_emm_sm, 100);
extern int _s1ap_send;
d_trace_level(&_s1ap_recv, 100); d_trace_level(&_s1ap_recv, 100);
extern int _s6a; extern int _s1ap_send;
d_trace_level(&_s1ap_send, 100); d_trace_level(&_s1ap_send, 100);
extern int _s6a;
d_trace_level(&_s6a, 100);
extern int _tlv_msg; extern int _tlv_msg;
d_trace_level(&_tlv_msg, 1); d_trace_level(&_tlv_msg, 1);
#endif #endif

View File

@ -6,17 +6,19 @@ libmme_la_SOURCES = \
kdf.h kasumi.h snow_3g.h zuc.h \ kdf.h kasumi.h snow_3g.h zuc.h \
mme_event.h mme_ctx.h \ mme_event.h mme_ctx.h \
s1ap_build.h s1ap_handler.h s1ap_conv.h s1ap_path.h \ 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 esm_handler.h \ nas_conv.h nas_security.h emm_handler.h esm_handler.h \
mme_s11_path.h mme_s11_build.h \ mme_s11_path.h mme_s11_build.h \
mme_sm.h s6a_sm.h mme_sm.h
nodist_libmme_la_SOURCES = \ nodist_libmme_la_SOURCES = \
kdf.c kasumi.c snow_3g.c zuc.c \ kdf.c kasumi.c snow_3g.c zuc.c \
mme_init.c mme_event.c mme_ctx.c \ mme_init.c mme_event.c mme_ctx.c \
s1ap_sm.c s1ap_build.c s1ap_handler.c s1ap_conv.c s1ap_path.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 esm_sm.c esm_handler.c \ nas_conv.c nas_security.c emm_sm.c emm_handler.c esm_sm.c esm_handler.c \
mme_s11_path.c mme_s11_build.c \ mme_s11_path.c mme_s11_build.c \
mme_sm.c s6a_sm.c mme_sm.c
libmme_la_DEPENDENCIES = \ libmme_la_DEPENDENCIES = \
$(top_srcdir)/lib/core/src/libcore.la \ $(top_srcdir)/lib/core/src/libcore.la \

View File

@ -9,7 +9,7 @@
#include "kdf.h" #include "kdf.h"
#include "nas_security.h" #include "nas_security.h"
#include "nas_conv.h" #include "nas_conv.h"
#include "s6a_sm.h" #include "mme_s6a_handler.h"
void emm_handle_attach_request( void emm_handle_attach_request(
ue_ctx_t *ue, nas_attach_request_t *attach_request) ue_ctx_t *ue, nas_attach_request_t *attach_request)
@ -45,7 +45,7 @@ void emm_handle_attach_request(
d_assert(ue->imsi, return,); d_assert(ue->imsi, return,);
d_info("[NAS] Attach request : UE[%s] --> EMM", ue->imsi); d_info("[NAS] Attach request : UE[%s] --> EMM", ue->imsi);
s6a_send_auth_info_req(ue, plmn_id); mme_s6a_send_auth_info_req(ue, plmn_id);
break; break;
} }
default: default:

View File

@ -9,4 +9,4 @@
#include "kdf.h" #include "kdf.h"
#include "nas_security.h" #include "nas_security.h"
#include "nas_conv.h" #include "nas_conv.h"
#include "s6a_sm.h" #include "mme_s6a_handler.h"

View File

@ -5,7 +5,7 @@
#include "mme_event.h" #include "mme_event.h"
#include "s6a_sm.h" #include "mme_s6a_handler.h"
static thread_id mme_sm_thread; static thread_id mme_sm_thread;
void *THREAD_FUNC mme_sm_main(thread_id id, void *data); void *THREAD_FUNC mme_sm_main(thread_id id, void *data);
@ -18,7 +18,7 @@ status_t mme_initialize()
rv = mme_ctx_init(); rv = mme_ctx_init();
if (rv != CORE_OK) return rv; if (rv != CORE_OK) return rv;
ret = s6a_sm_init(); ret = mme_s6a_init();
if (ret != 0) return -1; if (ret != 0) return -1;
rv = thread_create(&mme_sm_thread, NULL, mme_sm_main, NULL); rv = thread_create(&mme_sm_thread, NULL, mme_sm_main, NULL);
@ -31,7 +31,7 @@ void mme_terminate(void)
{ {
thread_delete(mme_sm_thread); thread_delete(mme_sm_thread);
s6a_sm_final(); mme_s6a_final();
mme_ctx_final(); mme_ctx_final();
} }

View File

@ -1,17 +1,18 @@
#define TRACE_MODULE _s6a_sm #define TRACE_MODULE _mme_s6a_handler
#include "core_debug.h" #include "core_debug.h"
#include "core_pool.h" #include "core_pool.h"
#include "mme_event.h"
#include "nas_message.h" #include "nas_message.h"
#include "s6a_lib.h" #include "s6a_lib.h"
#include "s6a_sm.h"
#include "mme_event.h"
#include "mme_s6a_handler.h"
#define SIZE_OF_SESS_STATE_POOL 32 #define SIZE_OF_SESS_STATE_POOL 32
static struct session_handler *s6a_mme_reg = NULL; static struct session_handler *mme_s6a_reg = NULL;
struct sess_state { struct sess_state {
ue_ctx_t *ue; ue_ctx_t *ue;
@ -20,10 +21,10 @@ struct sess_state {
pool_declare(sess_state_pool, struct sess_state, SIZE_OF_SESS_STATE_POOL); pool_declare(sess_state_pool, struct sess_state, SIZE_OF_SESS_STATE_POOL);
static void s6a_aia_cb(void *data, struct msg **msg); static void mme_s6a_aia_cb(void *data, struct msg **msg);
/* Cb called when an answer is received */ /* Cb called when an answer is received */
int s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id) int mme_s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id)
{ {
struct msg *req = NULL; struct msg *req = NULL;
struct avp *avp; struct avp *avp;
@ -104,10 +105,10 @@ int s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id)
svg = mi; svg = mi;
/* Store this value in the session */ /* Store this value in the session */
d_assert(fd_sess_state_store(s6a_mme_reg, sess, &mi) == 0, goto out,); d_assert(fd_sess_state_store(mme_s6a_reg, sess, &mi) == 0, goto out,);
/* Send the request */ /* Send the request */
d_assert(fd_msg_send(&req, s6a_aia_cb, svg) == 0, goto out,); d_assert(fd_msg_send(&req, mme_s6a_aia_cb, svg) == 0, goto out,);
/* Increment the counter */ /* Increment the counter */
d_assert(pthread_mutex_lock(&s6a_config->stats_lock) == 0,,); d_assert(pthread_mutex_lock(&s6a_config->stats_lock) == 0,,);
@ -127,7 +128,7 @@ out:
return -1; return -1;
} }
static void s6a_aia_cb(void *data, struct msg **msg) static void mme_s6a_aia_cb(void *data, struct msg **msg)
{ {
struct sess_state *mi = NULL; struct sess_state *mi = NULL;
struct timespec ts; struct timespec ts;
@ -152,7 +153,7 @@ static void s6a_aia_cb(void *data, struct msg **msg)
d_assert(fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &sess, &new) == 0 && d_assert(fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &sess, &new) == 0 &&
new == 0, return,); new == 0, return,);
d_assert(fd_sess_state_retrieve(s6a_mme_reg, sess, &mi) == 0 && d_assert(fd_sess_state_retrieve(mme_s6a_reg, sess, &mi) == 0 &&
mi && (void *)mi == data, fd_msg_free(*msg); *msg = NULL; return,); mi && (void *)mi == data, fd_msg_free(*msg); *msg = NULL; return,);
ue = mi->ue; ue = mi->ue;
@ -264,7 +265,7 @@ out:
pool_free_node(&sess_state_pool, mi); pool_free_node(&sess_state_pool, mi);
} }
status_t s6a_sm_init(void) status_t mme_s6a_init(void)
{ {
status_t rv; status_t rv;
@ -273,15 +274,15 @@ status_t s6a_sm_init(void)
pool_init(&sess_state_pool, SIZE_OF_SESS_STATE_POOL); pool_init(&sess_state_pool, SIZE_OF_SESS_STATE_POOL);
d_assert(fd_sess_handler_create(&s6a_mme_reg, d_assert(fd_sess_handler_create(&mme_s6a_reg,
(void *)free, NULL, NULL) == 0, return -1,); (void *)free, NULL, NULL) == 0, return -1,);
return CORE_OK; return CORE_OK;
} }
void s6a_sm_final(void) void mme_s6a_final(void)
{ {
d_assert(fd_sess_handler_destroy(&s6a_mme_reg, NULL) == 0,,); d_assert(fd_sess_handler_destroy(&mme_s6a_reg, NULL) == 0,,);
d_print("%d not freed in sess_state_pool[%d] of S6A-SM\n", d_print("%d not freed in sess_state_pool[%d] of S6A-SM\n",
pool_size(&sess_state_pool) - pool_avail(&sess_state_pool), pool_size(&sess_state_pool) - pool_avail(&sess_state_pool),

23
src/mme/mme_s6a_handler.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef __MME_S6A_HANDLER_H__
#define __MME_S6A_HANDLER_H__
#include "core_errno.h"
#include "mme_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(status_t) mme_s6a_init(void);
CORE_DECLARE(void) mme_s6a_final(void);
CORE_DECLARE(int) mme_s6a_send_auth_info_req(
ue_ctx_t *ue, plmn_id_t *plmn_id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MME_S6A_HANDLER_H__ */

View File

@ -1,22 +0,0 @@
#ifndef __S6A_SM_H__
#define __S6A_SM_H__
#include "core_errno.h"
#include "mme_ctx.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
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, plmn_id_t *plmn_id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __S6A_SM_H__ */