update it
This commit is contained in:
parent
a56e171e04
commit
e62868a3f7
|
@ -42,7 +42,7 @@ void hss_ctx_final(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ue_ctx_t* hss_ue_ctx_add()
|
||||
ue_ctx_t* hss_ctx_ue_add()
|
||||
{
|
||||
ue_ctx_t *ue = NULL;
|
||||
|
||||
|
@ -62,7 +62,7 @@ ue_ctx_t* hss_ue_ctx_add()
|
|||
return ue;
|
||||
}
|
||||
|
||||
status_t hss_ue_ctx_remove(ue_ctx_t *ue)
|
||||
status_t hss_ctx_ue_remove(ue_ctx_t *ue)
|
||||
{
|
||||
d_assert(ue, return CORE_ERROR, "Null param");
|
||||
|
||||
|
@ -72,7 +72,7 @@ status_t hss_ue_ctx_remove(ue_ctx_t *ue)
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t hss_ue_ctx_remove_all()
|
||||
status_t hss_ctx_ue_remove_all()
|
||||
{
|
||||
ue_ctx_t *ue = NULL, *next_ue = NULL;
|
||||
|
||||
|
@ -81,7 +81,7 @@ status_t hss_ue_ctx_remove_all()
|
|||
{
|
||||
next_ue = list_next(ue);
|
||||
|
||||
hss_ue_ctx_remove(ue);
|
||||
hss_ctx_ue_remove(ue);
|
||||
|
||||
ue = next_ue;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ status_t hss_ue_ctx_remove_all()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
ue_ctx_t* hss_ue_ctx_find_by_imsi(c_uint8_t *imsi, c_uint8_t imsi_len)
|
||||
ue_ctx_t* hss_ctx_ue_find_by_imsi(c_uint8_t *imsi, c_uint8_t imsi_len)
|
||||
{
|
||||
ue_ctx_t *ue = NULL;
|
||||
|
||||
|
@ -105,12 +105,12 @@ ue_ctx_t* hss_ue_ctx_find_by_imsi(c_uint8_t *imsi, c_uint8_t imsi_len)
|
|||
return ue;
|
||||
}
|
||||
|
||||
ue_ctx_t* hss_ue_ctx_first()
|
||||
ue_ctx_t* hss_ctx_ue_first()
|
||||
{
|
||||
return list_first(&g_ue_list);
|
||||
}
|
||||
|
||||
ue_ctx_t* hss_ue_ctx_next(ue_ctx_t *ue)
|
||||
ue_ctx_t* hss_ctx_ue_next(ue_ctx_t *ue)
|
||||
{
|
||||
return list_next(ue);
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ CORE_DECLARE(hss_ctx_t*) hss_self(void);
|
|||
CORE_DECLARE(status_t) hss_ctx_init(void);
|
||||
CORE_DECLARE(void) hss_ctx_final(void);
|
||||
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ue_ctx_add(void);
|
||||
CORE_DECLARE(status_t) hss_ue_ctx_remove(ue_ctx_t *ue);
|
||||
CORE_DECLARE(status_t) hss_ue_ctx_remove_all(void);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ue_ctx_find_by_imsi(
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ctx_ue_add(void);
|
||||
CORE_DECLARE(status_t) hss_ctx_ue_remove(ue_ctx_t *ue);
|
||||
CORE_DECLARE(status_t) hss_ctx_ue_remove_all(void);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ctx_ue_find_by_imsi(
|
||||
c_uint8_t *imsi, c_uint8_t imsi_len);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ue_ctx_first(void);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ue_ctx_next(ue_ctx_t *ue);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ctx_ue_first(void);
|
||||
CORE_DECLARE(ue_ctx_t*) hss_ctx_ue_next(ue_ctx_t *ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ static int hss_air_cb( struct msg **msg, struct avp *avp,
|
|||
goto out,);
|
||||
d_assert(fd_msg_avp_hdr(avp, &hdr) == 0 && hdr,,);
|
||||
|
||||
ue = hss_ue_ctx_find_by_imsi(
|
||||
ue = hss_ctx_ue_find_by_imsi(
|
||||
hdr->avp_value->os.data, hdr->avp_value->os.len);
|
||||
if (!ue)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ status_t hss_initialize(void)
|
|||
#define UE1_IMSI "001010123456800"
|
||||
#define UE2_IMSI "001010123456796"
|
||||
|
||||
ue = hss_ue_ctx_add();
|
||||
ue = hss_ctx_ue_add();
|
||||
d_assert(ue, return -1, "UE context add failed");
|
||||
|
||||
strcpy((char*)ue->imsi, UE1_IMSI);
|
||||
|
@ -171,7 +171,7 @@ status_t hss_initialize(void)
|
|||
memcpy(ue->k, core_ascii_to_hex(K, strlen(K), buf), MAX_KEY_LEN);
|
||||
ue->sqn = 32;
|
||||
|
||||
ue = hss_ue_ctx_add();
|
||||
ue = hss_ctx_ue_add();
|
||||
d_assert(ue, return -1, "UE context add failed");
|
||||
|
||||
strcpy((char*)ue->imsi, UE2_IMSI);
|
||||
|
@ -206,7 +206,7 @@ void hss_terminate(void)
|
|||
|
||||
/* FIXME : this is a sample UE for testing */
|
||||
{
|
||||
hss_ue_ctx_remove_all();
|
||||
hss_ctx_ue_remove_all();
|
||||
}
|
||||
|
||||
hss_ctx_final();
|
||||
|
|
|
@ -12,7 +12,7 @@ nodist_libmme_la_SOURCES = \
|
|||
init.c event.c context.c \
|
||||
s1ap_build.c s1ap_conv.c s1ap_path.c \
|
||||
s6a_init.c s6a_auth_info.c \
|
||||
mme_sm.c enb_s1_sm.c
|
||||
mme_sm.c enb_s1ap_sm.c
|
||||
|
||||
libmme_la_DEPENDENCIES = \
|
||||
$(top_srcdir)/lib/core/src/libcore.la \
|
||||
|
|
|
@ -22,10 +22,7 @@ static int g_mme_ctx_initialized = 0;
|
|||
|
||||
static list_t g_enb_list;
|
||||
|
||||
static rwlock_id g_rwlock;
|
||||
static int g_cpath_post_q;
|
||||
|
||||
status_t context_init()
|
||||
status_t mme_ctx_init()
|
||||
{
|
||||
d_assert(g_mme_ctx_initialized == 0, return CORE_ERROR,
|
||||
"MME context already has been initialized");
|
||||
|
@ -36,9 +33,6 @@ status_t context_init()
|
|||
|
||||
list_init(&g_enb_list);
|
||||
|
||||
rwlock_create(&g_rwlock);
|
||||
d_assert(g_rwlock, return CORE_ERROR, "RW-lock creation failed");
|
||||
|
||||
/* Initialize MME context */
|
||||
memset(&self, 0, sizeof(mme_ctx_t));
|
||||
|
||||
|
@ -67,12 +61,12 @@ status_t context_init()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t context_final()
|
||||
status_t mme_ctx_final()
|
||||
{
|
||||
d_assert(g_mme_ctx_initialized == 1, return CORE_ERROR,
|
||||
"HyperCell context already has been finalized");
|
||||
|
||||
enb_ctx_remove_all();
|
||||
mme_ctx_enb_remove_all();
|
||||
|
||||
pool_final(&enb_pool);
|
||||
pool_final(&ue_pool);
|
||||
|
@ -83,43 +77,12 @@ status_t context_final()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t context_read_lock()
|
||||
{
|
||||
return rwlock_rdlock(g_rwlock);
|
||||
}
|
||||
|
||||
status_t context_write_lock()
|
||||
{
|
||||
return rwlock_wrlock(g_rwlock);
|
||||
}
|
||||
|
||||
status_t context_unlock()
|
||||
{
|
||||
return rwlock_unlock(g_rwlock);
|
||||
}
|
||||
|
||||
void context_post_cpath()
|
||||
{
|
||||
g_cpath_post_q = 1;
|
||||
}
|
||||
|
||||
int context_fetch_cpath()
|
||||
{
|
||||
if (g_cpath_post_q)
|
||||
{
|
||||
g_cpath_post_q = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
mme_ctx_t* mme_self()
|
||||
{
|
||||
return &self;
|
||||
}
|
||||
|
||||
enb_ctx_t* enb_ctx_add()
|
||||
enb_ctx_t* mme_ctx_enb_add()
|
||||
{
|
||||
|
||||
enb_ctx_t *enb = NULL;
|
||||
|
@ -137,7 +100,7 @@ enb_ctx_t* enb_ctx_add()
|
|||
return enb;
|
||||
}
|
||||
|
||||
status_t enb_ctx_remove(enb_ctx_t *enb)
|
||||
status_t mme_ctx_enb_remove(enb_ctx_t *enb)
|
||||
{
|
||||
d_assert(enb, return CORE_ERROR, "Null param");
|
||||
|
||||
|
@ -147,7 +110,7 @@ status_t enb_ctx_remove(enb_ctx_t *enb)
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t enb_ctx_remove_all()
|
||||
status_t mme_ctx_enb_remove_all()
|
||||
{
|
||||
enb_ctx_t *enb = NULL, *next_enb = NULL;
|
||||
|
||||
|
@ -156,7 +119,7 @@ status_t enb_ctx_remove_all()
|
|||
{
|
||||
next_enb = list_next(enb);
|
||||
|
||||
enb_ctx_remove(enb);
|
||||
mme_ctx_enb_remove(enb);
|
||||
|
||||
enb = next_enb;
|
||||
}
|
||||
|
@ -164,7 +127,7 @@ status_t enb_ctx_remove_all()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
enb_ctx_t* enb_ctx_find_by_sock(net_sock_t *sock)
|
||||
enb_ctx_t* mme_ctx_enb_find_by_sock(net_sock_t *sock)
|
||||
{
|
||||
enb_ctx_t *enb = NULL;
|
||||
|
||||
|
@ -180,7 +143,7 @@ enb_ctx_t* enb_ctx_find_by_sock(net_sock_t *sock)
|
|||
return enb;
|
||||
}
|
||||
|
||||
enb_ctx_t* enb_ctx_find_by_id(c_uint32_t id)
|
||||
enb_ctx_t* mme_ctx_enb_find_by_id(c_uint32_t id)
|
||||
{
|
||||
enb_ctx_t *enb = NULL;
|
||||
|
||||
|
@ -196,12 +159,12 @@ enb_ctx_t* enb_ctx_find_by_id(c_uint32_t id)
|
|||
return enb;
|
||||
}
|
||||
|
||||
enb_ctx_t* enb_ctx_first()
|
||||
enb_ctx_t* mme_ctx_enb_first()
|
||||
{
|
||||
return list_first(&g_enb_list);
|
||||
}
|
||||
|
||||
enb_ctx_t* enb_ctx_next(enb_ctx_t *enb)
|
||||
enb_ctx_t* mme_ctx_enb_next(enb_ctx_t *enb)
|
||||
{
|
||||
return list_next(enb);
|
||||
}
|
||||
|
|
|
@ -89,25 +89,18 @@ typedef struct _rab_ctx_t {
|
|||
ue_ctx_t *ue;
|
||||
} rab_ctx_t;
|
||||
|
||||
CORE_DECLARE(status_t) context_init(void);
|
||||
CORE_DECLARE(status_t) context_final(void);
|
||||
|
||||
CORE_DECLARE(status_t) context_read_lock(void);
|
||||
CORE_DECLARE(status_t) context_write_lock(void);
|
||||
CORE_DECLARE(status_t) context_unlock(void);
|
||||
|
||||
CORE_DECLARE(void) context_post_cpath(void);
|
||||
CORE_DECLARE(int) context_fetch_cpath(void);
|
||||
CORE_DECLARE(status_t) mme_ctx_init(void);
|
||||
CORE_DECLARE(status_t) mme_ctx_final(void);
|
||||
|
||||
CORE_DECLARE(mme_ctx_t*) mme_self(void);
|
||||
|
||||
CORE_DECLARE(enb_ctx_t*) enb_ctx_add(void);
|
||||
CORE_DECLARE(status_t) enb_ctx_remove(enb_ctx_t *enb);
|
||||
CORE_DECLARE(status_t) enb_ctx_remove_all(void);
|
||||
CORE_DECLARE(enb_ctx_t*) enb_ctx_find_by_sock(net_sock_t *sock);
|
||||
CORE_DECLARE(enb_ctx_t*) enb_ctx_find_by_id(c_uint32_t id);
|
||||
CORE_DECLARE(enb_ctx_t*) enb_ctx_first(void);
|
||||
CORE_DECLARE(enb_ctx_t*) enb_ctx_next(enb_ctx_t *enb);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_add(void);
|
||||
CORE_DECLARE(status_t) mme_ctx_enb_remove(enb_ctx_t *enb);
|
||||
CORE_DECLARE(status_t) mme_ctx_enb_remove_all(void);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_find_by_sock(net_sock_t *sock);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_find_by_id(c_uint32_t id);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_first(void);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_next(enb_ctx_t *enb);
|
||||
#define self() mme_self()
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -165,7 +165,7 @@ status_t enb_s1_handle_s1setuprequest(enb_ctx_t *enb, s1ap_message *message)
|
|||
rv = s1ap_conv_uint32_from_enb_id(&enb_id, &ies->global_ENB_ID.eNB_ID);
|
||||
d_assert(rv == CORE_OK, return rv, "Null param");
|
||||
|
||||
if (enb_ctx_find_by_id(enb_id))
|
||||
if (mme_ctx_enb_find_by_id(enb_id))
|
||||
{
|
||||
S1ap_Cause_t cause;
|
||||
d_error("eNB-id[0x%x] duplicated from [%s]", enb_id,
|
|
@ -18,7 +18,7 @@ status_t mme_initialize()
|
|||
status_t rv;
|
||||
int ret;
|
||||
|
||||
rv = context_init();
|
||||
rv = mme_ctx_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
ret = s6a_mme_init();
|
||||
|
@ -36,7 +36,7 @@ void mme_terminate(void)
|
|||
|
||||
s6a_mme_final();
|
||||
|
||||
context_final();
|
||||
mme_ctx_final();
|
||||
}
|
||||
|
||||
void *THREAD_FUNC mme_sm_main(void *data)
|
||||
|
|
|
@ -64,13 +64,13 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
d_trace(1, "eNB-S1 accepted[%s] in master_sm module\n",
|
||||
INET_NTOP(&sock->remote.sin_addr.s_addr, buf));
|
||||
|
||||
enb_ctx_t *enb = enb_ctx_find_by_sock(sock);
|
||||
enb_ctx_t *enb = mme_ctx_enb_find_by_sock(sock);
|
||||
if (!enb)
|
||||
{
|
||||
rc = net_register_sock(sock, _s1ap_recv_cb, (void*)s->queue_id);
|
||||
d_assert(rc == 0, break, "register _s1ap_recv_cb failed");
|
||||
|
||||
enb_ctx_t *enb = enb_ctx_add();
|
||||
enb_ctx_t *enb = mme_ctx_enb_add();
|
||||
d_assert(enb, break, "Null param");
|
||||
enb->s1_sock = sock;
|
||||
|
||||
|
@ -96,7 +96,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
net_sock_t *sock = (net_sock_t *)event_get_param1(e);
|
||||
d_assert(sock, break, "Null param");
|
||||
|
||||
enb_ctx_t *enb = enb_ctx_find_by_sock(sock);
|
||||
enb_ctx_t *enb = mme_ctx_enb_find_by_sock(sock);
|
||||
if (enb)
|
||||
{
|
||||
fsm_dispatch((fsm_t*)&enb->s1_sm, (fsm_event_t*)e);
|
||||
|
@ -116,7 +116,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
d_info("Socket[%s] connection refused",
|
||||
INET_NTOP(&sock->remote.sin_addr.s_addr, buf));
|
||||
|
||||
enb_ctx_t *enb = enb_ctx_find_by_sock(sock);
|
||||
enb_ctx_t *enb = mme_ctx_enb_find_by_sock(sock);
|
||||
if (enb)
|
||||
{
|
||||
/* Remove eNB S1 state machine if exist */
|
||||
|
@ -129,7 +129,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
net_unregister_sock(sock);
|
||||
net_close(sock);
|
||||
|
||||
enb_ctx_remove(enb);
|
||||
mme_ctx_enb_remove(enb);
|
||||
d_info("eNB-S1[%x] connection refused!!!", enb->id);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue