forked from acouzens/open5gs
update it
This commit is contained in:
parent
e6fe6ab346
commit
4720ecb8b7
|
@ -12,7 +12,7 @@
|
|||
#include "mme_s6a_handler.h"
|
||||
|
||||
void emm_handle_attach_request(
|
||||
ue_ctx_t *ue, nas_attach_request_t *attach_request)
|
||||
mme_ue_t *ue, nas_attach_request_t *attach_request)
|
||||
{
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity =
|
||||
&attach_request->eps_mobile_identity;
|
||||
|
@ -59,7 +59,7 @@ void emm_handle_attach_request(
|
|||
}
|
||||
|
||||
void emm_handle_authentication_response(
|
||||
ue_ctx_t *ue, nas_authentication_response_t *authentication_response)
|
||||
mme_ue_t *ue, nas_authentication_response_t *authentication_response)
|
||||
{
|
||||
nas_authentication_response_parameter_t *authentication_response_parameter =
|
||||
&authentication_response->authentication_response_parameter;
|
||||
|
|
|
@ -10,9 +10,9 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(void) emm_handle_attach_request(
|
||||
ue_ctx_t *ue, nas_attach_request_t *attach_request);
|
||||
mme_ue_t *ue, nas_attach_request_t *attach_request);
|
||||
CORE_DECLARE(void) emm_handle_authentication_response(
|
||||
ue_ctx_t *ue, nas_authentication_response_t *authentication_response);
|
||||
mme_ue_t *ue, nas_authentication_response_t *authentication_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void emm_state_operational(emm_sm_t *s, event_t *e)
|
|||
d_assert(s, return, "Null param");
|
||||
d_assert(e, return, "Null param");
|
||||
|
||||
ue_ctx_t *ue = s->ctx;
|
||||
mme_ue_t *ue = s->ctx;
|
||||
d_assert(ue, return, "Null param");
|
||||
|
||||
mme_sm_trace(1, e);
|
||||
|
|
|
@ -29,7 +29,7 @@ void esm_state_operational(esm_sm_t *s, event_t *e)
|
|||
d_assert(s, return, "Null param");
|
||||
d_assert(e, return, "Null param");
|
||||
|
||||
ue_ctx_t *ue = s->ctx;
|
||||
mme_ue_t *ue = s->ctx;
|
||||
d_assert(ue, return, "Null param");
|
||||
|
||||
mme_sm_trace(1, e);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define TRACE_MODULE _mme_ctx
|
||||
#define TRACE_MODULE _mme_context
|
||||
|
||||
#include "core_debug.h"
|
||||
#include "core_pool.h"
|
||||
|
@ -16,36 +16,36 @@
|
|||
|
||||
#define S1AP_SCTP_PORT 36412
|
||||
|
||||
static mme_ctx_t self;
|
||||
static mme_context_t self;
|
||||
|
||||
pool_declare(sgw_pool, sgw_ctx_t, MAX_NUM_OF_SGW);
|
||||
pool_declare(enb_pool, enb_ctx_t, MAX_NUM_OF_ENB);
|
||||
pool_declare(ue_pool, ue_ctx_t, MAX_NUM_OF_UE);
|
||||
pool_declare(mme_sgw_pool, mme_sgw_t, MAX_NUM_OF_SGW);
|
||||
pool_declare(mme_enb_pool, mme_enb_t, MAX_NUM_OF_ENB);
|
||||
pool_declare(mme_ue_pool, mme_ue_t, MAX_NUM_OF_UE);
|
||||
|
||||
static int ctx_initialized = 0;
|
||||
static int context_initialized = 0;
|
||||
|
||||
static list_t sgw_list;
|
||||
static list_t enb_list;
|
||||
static list_t mme_sgw_list;
|
||||
static list_t mme_enb_list;
|
||||
|
||||
status_t mme_ctx_init()
|
||||
status_t mme_context_init()
|
||||
{
|
||||
d_assert(ctx_initialized == 0, return CORE_ERROR,
|
||||
"MME context already has been ctx_initialized");
|
||||
d_assert(context_initialized == 0, return CORE_ERROR,
|
||||
"MME context already has been context_initialized");
|
||||
|
||||
pool_init(&sgw_pool, MAX_NUM_OF_SGW);
|
||||
pool_init(&enb_pool, MAX_NUM_OF_ENB);
|
||||
pool_init(&ue_pool, MAX_NUM_OF_UE);
|
||||
pool_init(&mme_sgw_pool, MAX_NUM_OF_SGW);
|
||||
pool_init(&mme_enb_pool, MAX_NUM_OF_ENB);
|
||||
pool_init(&mme_ue_pool, MAX_NUM_OF_UE);
|
||||
|
||||
list_init(&sgw_list);
|
||||
list_init(&enb_list);
|
||||
list_init(&mme_sgw_list);
|
||||
list_init(&mme_enb_list);
|
||||
|
||||
/* Initialize MME context */
|
||||
memset(&self, 0, sizeof(mme_ctx_t));
|
||||
memset(&self, 0, sizeof(mme_context_t));
|
||||
|
||||
self.s1ap_addr = inet_addr("127.0.0.1");
|
||||
self.s1ap_port = S1AP_SCTP_PORT;
|
||||
|
||||
sgw_ctx_t *sgw = mme_ctx_sgw_add();
|
||||
mme_sgw_t *sgw = mme_sgw_add();
|
||||
d_assert(sgw, return CORE_ERROR, "Can't add SGW context");
|
||||
|
||||
self.s11_addr = inet_addr("127.0.0.1");
|
||||
|
@ -72,70 +72,70 @@ status_t mme_ctx_init()
|
|||
self.selected_enc_algorithm = NAS_SECURITY_ALGORITHMS_EEA0;
|
||||
self.selected_int_algorithm = NAS_SECURITY_ALGORITHMS_128_EIA1;
|
||||
|
||||
ctx_initialized = 1;
|
||||
context_initialized = 1;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t mme_ctx_final()
|
||||
status_t mme_context_final()
|
||||
{
|
||||
d_assert(ctx_initialized == 1, return CORE_ERROR,
|
||||
d_assert(context_initialized == 1, return CORE_ERROR,
|
||||
"HyperCell context already has been finalized");
|
||||
|
||||
mme_ctx_sgw_remove_all();
|
||||
mme_ctx_enb_remove_all();
|
||||
mme_sgw_remove_all();
|
||||
mme_enb_remove_all();
|
||||
|
||||
pool_final(&sgw_pool);
|
||||
pool_final(&enb_pool);
|
||||
pool_final(&ue_pool);
|
||||
pool_final(&mme_sgw_pool);
|
||||
pool_final(&mme_enb_pool);
|
||||
pool_final(&mme_ue_pool);
|
||||
|
||||
ctx_initialized = 0;
|
||||
context_initialized = 0;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
mme_ctx_t* mme_self()
|
||||
mme_context_t* mme_self()
|
||||
{
|
||||
return &self;
|
||||
}
|
||||
|
||||
sgw_ctx_t* mme_ctx_sgw_add()
|
||||
mme_sgw_t* mme_sgw_add()
|
||||
{
|
||||
sgw_ctx_t *sgw = NULL;
|
||||
mme_sgw_t *sgw = NULL;
|
||||
|
||||
pool_alloc_node(&sgw_pool, &sgw);
|
||||
pool_alloc_node(&mme_sgw_pool, &sgw);
|
||||
d_assert(sgw, return NULL, "Null param");
|
||||
|
||||
memset(sgw, 0, sizeof(sgw_ctx_t));
|
||||
memset(sgw, 0, sizeof(mme_sgw_t));
|
||||
|
||||
list_init(&sgw->gnode.local_list);
|
||||
list_init(&sgw->gnode.remote_list);
|
||||
|
||||
list_append(&sgw_list, sgw);
|
||||
list_append(&mme_sgw_list, sgw);
|
||||
|
||||
return sgw;
|
||||
}
|
||||
|
||||
status_t mme_ctx_sgw_remove(sgw_ctx_t *sgw)
|
||||
status_t mme_sgw_remove(mme_sgw_t *sgw)
|
||||
{
|
||||
d_assert(sgw, return CORE_ERROR, "Null param");
|
||||
|
||||
list_remove(&sgw_list, sgw);
|
||||
pool_free_node(&sgw_pool, sgw);
|
||||
list_remove(&mme_sgw_list, sgw);
|
||||
pool_free_node(&mme_sgw_pool, sgw);
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t mme_ctx_sgw_remove_all()
|
||||
status_t mme_sgw_remove_all()
|
||||
{
|
||||
sgw_ctx_t *sgw = NULL, *next_sgw = NULL;
|
||||
mme_sgw_t *sgw = NULL, *next_sgw = NULL;
|
||||
|
||||
sgw = mme_ctx_sgw_first();
|
||||
sgw = mme_sgw_first();
|
||||
while (sgw)
|
||||
{
|
||||
next_sgw = mme_ctx_sgw_next(sgw);
|
||||
next_sgw = mme_sgw_next(sgw);
|
||||
|
||||
mme_ctx_sgw_remove(sgw);
|
||||
mme_sgw_remove(sgw);
|
||||
|
||||
sgw = next_sgw;
|
||||
}
|
||||
|
@ -143,70 +143,70 @@ status_t mme_ctx_sgw_remove_all()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
sgw_ctx_t* mme_ctx_sgw_find_by_node(gtp_node_t *gnode)
|
||||
mme_sgw_t* mme_sgw_find_by_node(gtp_node_t *gnode)
|
||||
{
|
||||
sgw_ctx_t *sgw = NULL;
|
||||
mme_sgw_t *sgw = NULL;
|
||||
|
||||
sgw = mme_ctx_sgw_first();
|
||||
sgw = mme_sgw_first();
|
||||
while (sgw)
|
||||
{
|
||||
if (GTP_COMPARE_NODE(&sgw->gnode, gnode))
|
||||
break;
|
||||
|
||||
sgw = mme_ctx_sgw_next(sgw);
|
||||
sgw = mme_sgw_next(sgw);
|
||||
}
|
||||
|
||||
return sgw;
|
||||
}
|
||||
|
||||
sgw_ctx_t* mme_ctx_sgw_first()
|
||||
mme_sgw_t* mme_sgw_first()
|
||||
{
|
||||
return list_first(&sgw_list);
|
||||
return list_first(&mme_sgw_list);
|
||||
}
|
||||
|
||||
sgw_ctx_t* mme_ctx_sgw_next(sgw_ctx_t *sgw)
|
||||
mme_sgw_t* mme_sgw_next(mme_sgw_t *sgw)
|
||||
{
|
||||
return list_next(sgw);
|
||||
}
|
||||
|
||||
enb_ctx_t* mme_ctx_enb_add()
|
||||
mme_enb_t* mme_enb_add()
|
||||
{
|
||||
enb_ctx_t *enb = NULL;
|
||||
mme_enb_t *enb = NULL;
|
||||
|
||||
pool_alloc_node(&enb_pool, &enb);
|
||||
pool_alloc_node(&mme_enb_pool, &enb);
|
||||
d_assert(enb, return NULL, "Null param");
|
||||
|
||||
memset(enb, 0, sizeof(enb_ctx_t));
|
||||
memset(enb, 0, sizeof(mme_enb_t));
|
||||
|
||||
list_init(&enb->ue_list);
|
||||
|
||||
list_append(&enb_list, enb);
|
||||
list_append(&mme_enb_list, enb);
|
||||
|
||||
return enb;
|
||||
}
|
||||
|
||||
status_t mme_ctx_enb_remove(enb_ctx_t *enb)
|
||||
status_t mme_enb_remove(mme_enb_t *enb)
|
||||
{
|
||||
d_assert(enb, return CORE_ERROR, "Null param");
|
||||
|
||||
mme_ctx_ue_remove_all(enb);
|
||||
mme_ue_remove_all(enb);
|
||||
|
||||
list_remove(&enb_list, enb);
|
||||
pool_free_node(&enb_pool, enb);
|
||||
list_remove(&mme_enb_list, enb);
|
||||
pool_free_node(&mme_enb_pool, enb);
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t mme_ctx_enb_remove_all()
|
||||
status_t mme_enb_remove_all()
|
||||
{
|
||||
enb_ctx_t *enb = NULL, *next_enb = NULL;
|
||||
mme_enb_t *enb = NULL, *next_enb = NULL;
|
||||
|
||||
enb = mme_ctx_enb_first();
|
||||
enb = mme_enb_first();
|
||||
while (enb)
|
||||
{
|
||||
next_enb = mme_ctx_enb_next(enb);
|
||||
next_enb = mme_enb_next(enb);
|
||||
|
||||
mme_ctx_enb_remove(enb);
|
||||
mme_enb_remove(enb);
|
||||
|
||||
enb = next_enb;
|
||||
}
|
||||
|
@ -214,27 +214,27 @@ status_t mme_ctx_enb_remove_all()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
enb_ctx_t* mme_ctx_enb_find_by_sock(net_sock_t *sock)
|
||||
mme_enb_t* mme_enb_find_by_sock(net_sock_t *sock)
|
||||
{
|
||||
enb_ctx_t *enb = NULL;
|
||||
mme_enb_t *enb = NULL;
|
||||
|
||||
enb = mme_ctx_enb_first();
|
||||
enb = mme_enb_first();
|
||||
while (enb)
|
||||
{
|
||||
if (sock == enb->s1ap_sock)
|
||||
break;
|
||||
|
||||
enb = mme_ctx_enb_next(enb);
|
||||
enb = mme_enb_next(enb);
|
||||
}
|
||||
|
||||
return enb;
|
||||
}
|
||||
|
||||
enb_ctx_t* mme_ctx_enb_find_by_enb_id(c_uint32_t enb_id)
|
||||
mme_enb_t* mme_enb_find_by_enb_id(c_uint32_t enb_id)
|
||||
{
|
||||
enb_ctx_t *enb = NULL;
|
||||
mme_enb_t *enb = NULL;
|
||||
|
||||
enb = list_first(&enb_list);
|
||||
enb = list_first(&mme_enb_list);
|
||||
while (enb)
|
||||
{
|
||||
if (enb_id == enb->enb_id)
|
||||
|
@ -246,26 +246,26 @@ enb_ctx_t* mme_ctx_enb_find_by_enb_id(c_uint32_t enb_id)
|
|||
return enb;
|
||||
}
|
||||
|
||||
enb_ctx_t* mme_ctx_enb_first()
|
||||
mme_enb_t* mme_enb_first()
|
||||
{
|
||||
return list_first(&enb_list);
|
||||
return list_first(&mme_enb_list);
|
||||
}
|
||||
|
||||
enb_ctx_t* mme_ctx_enb_next(enb_ctx_t *enb)
|
||||
mme_enb_t* mme_enb_next(mme_enb_t *enb)
|
||||
{
|
||||
return list_next(enb);
|
||||
}
|
||||
|
||||
ue_ctx_t* mme_ctx_ue_add(enb_ctx_t *enb)
|
||||
mme_ue_t* mme_ue_add(mme_enb_t *enb)
|
||||
{
|
||||
ue_ctx_t *ue = NULL;
|
||||
mme_ue_t *ue = NULL;
|
||||
|
||||
d_assert(enb, return NULL, "Null param");
|
||||
|
||||
pool_alloc_node(&ue_pool, &ue);
|
||||
pool_alloc_node(&mme_ue_pool, &ue);
|
||||
d_assert(ue, return NULL, "Null param");
|
||||
|
||||
memset(ue, 0, sizeof(ue_ctx_t));
|
||||
memset(ue, 0, sizeof(mme_ue_t));
|
||||
|
||||
ue->enb = enb;
|
||||
|
||||
|
@ -276,7 +276,7 @@ ue_ctx_t* mme_ctx_ue_add(enb_ctx_t *enb)
|
|||
return ue;
|
||||
}
|
||||
|
||||
status_t mme_ctx_ue_remove(ue_ctx_t *ue)
|
||||
status_t mme_ue_remove(mme_ue_t *ue)
|
||||
{
|
||||
d_assert(ue, return CORE_ERROR, "Null param");
|
||||
d_assert(ue->enb, return CORE_ERROR, "Null param");
|
||||
|
@ -293,21 +293,21 @@ status_t mme_ctx_ue_remove(ue_ctx_t *ue)
|
|||
}
|
||||
|
||||
list_remove(&ue->enb->ue_list, ue);
|
||||
pool_free_node(&ue_pool, ue);
|
||||
pool_free_node(&mme_ue_pool, ue);
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t mme_ctx_ue_remove_all(enb_ctx_t *enb)
|
||||
status_t mme_ue_remove_all(mme_enb_t *enb)
|
||||
{
|
||||
ue_ctx_t *ue = NULL, *next_ue = NULL;
|
||||
mme_ue_t *ue = NULL, *next_ue = NULL;
|
||||
|
||||
ue = mme_ctx_ue_first(enb);
|
||||
ue = mme_ue_first(enb);
|
||||
while (ue)
|
||||
{
|
||||
next_ue = mme_ctx_ue_next(ue);
|
||||
next_ue = mme_ue_next(ue);
|
||||
|
||||
mme_ctx_ue_remove(ue);
|
||||
mme_ue_remove(ue);
|
||||
|
||||
ue = next_ue;
|
||||
}
|
||||
|
@ -315,29 +315,29 @@ status_t mme_ctx_ue_remove_all(enb_ctx_t *enb)
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
ue_ctx_t* mme_ctx_ue_find_by_enb_ue_s1ap_id(
|
||||
enb_ctx_t *enb, c_uint32_t enb_ue_s1ap_id)
|
||||
mme_ue_t* mme_ue_find_by_enb_ue_s1ap_id(
|
||||
mme_enb_t *enb, c_uint32_t enb_ue_s1ap_id)
|
||||
{
|
||||
ue_ctx_t *ue = NULL;
|
||||
mme_ue_t *ue = NULL;
|
||||
|
||||
ue = mme_ctx_ue_first(enb);
|
||||
ue = mme_ue_first(enb);
|
||||
while (ue)
|
||||
{
|
||||
if (enb_ue_s1ap_id == ue->enb_ue_s1ap_id)
|
||||
break;
|
||||
|
||||
ue = mme_ctx_ue_next(ue);
|
||||
ue = mme_ue_next(ue);
|
||||
}
|
||||
|
||||
return ue;
|
||||
}
|
||||
|
||||
ue_ctx_t* mme_ctx_ue_first(enb_ctx_t *enb)
|
||||
mme_ue_t* mme_ue_first(mme_enb_t *enb)
|
||||
{
|
||||
return list_first(&enb->ue_list);
|
||||
}
|
||||
|
||||
ue_ctx_t* mme_ctx_ue_next(ue_ctx_t *ue)
|
||||
mme_ue_t* mme_ue_next(mme_ue_t *ue)
|
||||
{
|
||||
return list_next(ue);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __MME_CTX_H__
|
||||
#define __MME_CTX_H__
|
||||
#ifndef __MME_CONTEXT__
|
||||
#define __MME_CONTEXT__
|
||||
|
||||
#include "core_list.h"
|
||||
#include "core_errno.h"
|
||||
|
@ -30,7 +30,7 @@ typedef struct _served_gummei {
|
|||
c_uint8_t mme_code[CODE_PER_MME];
|
||||
} srvd_gummei_t;
|
||||
|
||||
typedef struct _mme_ctx_t {
|
||||
typedef struct _mme_context_t {
|
||||
c_uint32_t s1ap_addr; /* MME S1AP local address */
|
||||
c_uint16_t s1ap_port; /* MME S1AP local port */
|
||||
net_sock_t *s1ap_sock; /* MME S1AP local listen socket */
|
||||
|
@ -66,14 +66,14 @@ typedef struct _mme_ctx_t {
|
|||
/* S1SetupResponse */
|
||||
srvd_gummei_t srvd_gummei;
|
||||
c_uint8_t relative_capacity;
|
||||
} mme_ctx_t;
|
||||
} mme_context_t;
|
||||
|
||||
typedef struct _sgw_ctx_t {
|
||||
typedef struct _mme_sgw_t {
|
||||
gtp_node_t gnode; /* SGW S11 remote GTPv2-C node */
|
||||
|
||||
} sgw_ctx_t;
|
||||
} mme_sgw_t;
|
||||
|
||||
typedef struct _enb_ctx_t {
|
||||
typedef struct _mme_enb_t {
|
||||
lnode_t node; /**< A node of list_t */
|
||||
|
||||
c_uint32_t enb_id; /** eNB_ID received from eNB */
|
||||
|
@ -83,9 +83,9 @@ typedef struct _enb_ctx_t {
|
|||
|
||||
list_t ue_list;
|
||||
|
||||
} enb_ctx_t;
|
||||
} mme_enb_t;
|
||||
|
||||
typedef struct _ue_ctx_t {
|
||||
typedef struct _mme_ue_t {
|
||||
lnode_t node; /**< A node of list_t */
|
||||
|
||||
/* State Machine */
|
||||
|
@ -117,39 +117,38 @@ typedef struct _ue_ctx_t {
|
|||
c_uint32_t i32;
|
||||
} ul_count;
|
||||
|
||||
enb_ctx_t *enb;
|
||||
} ue_ctx_t;
|
||||
mme_enb_t *enb;
|
||||
} mme_ue_t;
|
||||
|
||||
CORE_DECLARE(status_t) mme_ctx_init(void);
|
||||
CORE_DECLARE(status_t) mme_ctx_final(void);
|
||||
CORE_DECLARE(status_t) mme_context_init(void);
|
||||
CORE_DECLARE(status_t) mme_context_final(void);
|
||||
CORE_DECLARE(mme_context_t*) mme_self(void);
|
||||
|
||||
CORE_DECLARE(mme_ctx_t*) mme_self(void);
|
||||
CORE_DECLARE(mme_sgw_t*) mme_sgw_add(void);
|
||||
CORE_DECLARE(status_t) mme_sgw_remove(mme_sgw_t *sgw);
|
||||
CORE_DECLARE(status_t) mme_sgw_remove_all(void);
|
||||
CORE_DECLARE(mme_sgw_t*) mme_sgw_find_by_node(gtp_node_t *gnode);
|
||||
CORE_DECLARE(mme_sgw_t*) mme_sgw_first(void);
|
||||
CORE_DECLARE(mme_sgw_t*) mme_sgw_next(mme_sgw_t *sgw);
|
||||
|
||||
CORE_DECLARE(sgw_ctx_t*) mme_ctx_sgw_add(void);
|
||||
CORE_DECLARE(status_t) mme_ctx_sgw_remove(sgw_ctx_t *sgw);
|
||||
CORE_DECLARE(status_t) mme_ctx_sgw_remove_all(void);
|
||||
CORE_DECLARE(sgw_ctx_t*) mme_ctx_sgw_find_by_node(gtp_node_t *gnode);
|
||||
CORE_DECLARE(sgw_ctx_t*) mme_ctx_sgw_first(void);
|
||||
CORE_DECLARE(sgw_ctx_t*) mme_ctx_sgw_next(sgw_ctx_t *sgw);
|
||||
CORE_DECLARE(mme_enb_t*) mme_enb_add(void);
|
||||
CORE_DECLARE(status_t) mme_enb_remove(mme_enb_t *enb);
|
||||
CORE_DECLARE(status_t) mme_enb_remove_all(void);
|
||||
CORE_DECLARE(mme_enb_t*) mme_enb_find_by_sock(net_sock_t *sock);
|
||||
CORE_DECLARE(mme_enb_t*) mme_enb_find_by_enb_id(c_uint32_t enb_id);
|
||||
CORE_DECLARE(mme_enb_t*) mme_enb_first(void);
|
||||
CORE_DECLARE(mme_enb_t*) mme_enb_next(mme_enb_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_enb_id(c_uint32_t enb_id);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_first(void);
|
||||
CORE_DECLARE(enb_ctx_t*) mme_ctx_enb_next(enb_ctx_t *enb);
|
||||
|
||||
CORE_DECLARE(ue_ctx_t*) mme_ctx_ue_add(enb_ctx_t *enb);
|
||||
CORE_DECLARE(status_t) mme_ctx_ue_remove(ue_ctx_t *ue);
|
||||
CORE_DECLARE(status_t) mme_ctx_ue_remove_all(enb_ctx_t *enb);
|
||||
CORE_DECLARE(ue_ctx_t*) mme_ctx_ue_find_by_enb_ue_s1ap_id(
|
||||
enb_ctx_t *enb, c_uint32_t enb_ue_s1ap_id);
|
||||
CORE_DECLARE(ue_ctx_t*) mme_ctx_ue_first(enb_ctx_t *enb);
|
||||
CORE_DECLARE(ue_ctx_t*) mme_ctx_ue_next(ue_ctx_t *ue);
|
||||
CORE_DECLARE(mme_ue_t*) mme_ue_add(mme_enb_t *enb);
|
||||
CORE_DECLARE(status_t) mme_ue_remove(mme_ue_t *ue);
|
||||
CORE_DECLARE(status_t) mme_ue_remove_all(mme_enb_t *enb);
|
||||
CORE_DECLARE(mme_ue_t*) mme_ue_find_by_enb_ue_s1ap_id(
|
||||
mme_enb_t *enb, c_uint32_t enb_ue_s1ap_id);
|
||||
CORE_DECLARE(mme_ue_t*) mme_ue_first(mme_enb_t *enb);
|
||||
CORE_DECLARE(mme_ue_t*) mme_ue_next(mme_ue_t *ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MME_CTX_H__ */
|
||||
#endif /* __MME_CONTEXT__ */
|
||||
|
|
|
@ -53,7 +53,7 @@ char* mme_event_get_name(event_t *e)
|
|||
return EVT_NAME_UNKNOWN;
|
||||
}
|
||||
|
||||
void mme_event_s1ap_to_nas(ue_ctx_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
||||
void mme_event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
||||
{
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
event_t e;
|
||||
|
@ -72,7 +72,7 @@ void mme_event_s1ap_to_nas(ue_ctx_t *ue, S1ap_NAS_PDU_t *nasPdu)
|
|||
mme_event_send(&e);
|
||||
}
|
||||
|
||||
void mme_event_nas_to_s1ap(ue_ctx_t *ue, pkbuf_t *pkbuf)
|
||||
void mme_event_nas_to_s1ap(mme_ue_t *ue, pkbuf_t *pkbuf)
|
||||
{
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
/* forward declaration */
|
||||
typedef struct _ue_ctx_t ue_ctx_t;
|
||||
typedef struct _mme_ue_t mme_ue_t;
|
||||
typedef struct OCTET_STRING S1ap_NAS_PDU_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -33,8 +33,8 @@ typedef enum {
|
|||
|
||||
CORE_DECLARE(char*) mme_event_get_name(event_t *e);
|
||||
|
||||
CORE_DECLARE(void) mme_event_s1ap_to_nas(ue_ctx_t *ue, S1ap_NAS_PDU_t *nasPdu);
|
||||
CORE_DECLARE(void) mme_event_nas_to_s1ap(ue_ctx_t *ue, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(void) mme_event_s1ap_to_nas(mme_ue_t *ue, S1ap_NAS_PDU_t *nasPdu);
|
||||
CORE_DECLARE(void) mme_event_nas_to_s1ap(mme_ue_t *ue, pkbuf_t *pkbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ status_t mme_initialize()
|
|||
status_t rv;
|
||||
int ret;
|
||||
|
||||
rv = mme_ctx_init();
|
||||
rv = mme_context_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
ret = mme_s6a_init();
|
||||
|
@ -33,7 +33,7 @@ void mme_terminate(void)
|
|||
|
||||
mme_s6a_final();
|
||||
|
||||
mme_ctx_final();
|
||||
mme_context_final();
|
||||
}
|
||||
|
||||
void *THREAD_FUNC mme_sm_main(thread_id id, void *data)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "mme_context.h"
|
||||
|
||||
status_t mme_s11_build_create_session_req(
|
||||
c_uint8_t *type, pkbuf_t **pkbuf, ue_ctx_t *ue)
|
||||
c_uint8_t *type, pkbuf_t **pkbuf, mme_ue_t *ue)
|
||||
{
|
||||
status_t rv;
|
||||
gtp_message_t gtp_message;
|
||||
|
|
|
@ -8,7 +8,7 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(status_t) mme_s11_build_create_session_req(
|
||||
c_uint8_t *type, pkbuf_t **pkbuf, ue_ctx_t *ue);
|
||||
c_uint8_t *type, pkbuf_t **pkbuf, mme_ue_t *ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ static int _gtpv2_c_recv_cb(net_sock_t *sock, void *data)
|
|||
event_t e;
|
||||
pkbuf_t *pkbuf = NULL;
|
||||
gtp_node_t gnode;
|
||||
sgw_ctx_t *sgw = NULL;
|
||||
mme_sgw_t *sgw = NULL;
|
||||
|
||||
d_assert(sock, return -1, "Null param");
|
||||
|
||||
|
@ -30,7 +30,7 @@ static int _gtpv2_c_recv_cb(net_sock_t *sock, void *data)
|
|||
gnode.addr = sock->remote.sin_addr.s_addr;
|
||||
gnode.port = ntohs(sock->remote.sin_port);
|
||||
|
||||
sgw = mme_ctx_sgw_find_by_node(&gnode);
|
||||
sgw = mme_sgw_find_by_node(&gnode);
|
||||
d_assert(sgw, return -1, "Can't find SGW from [%s:%d]",
|
||||
INET_NTOP(&gnode.addr, buf), gnode.port);
|
||||
|
||||
|
@ -107,5 +107,5 @@ void test_send()
|
|||
|
||||
mme_s11_build_create_session_req(&type, &pkbuf, NULL);
|
||||
|
||||
mme_s11_send_to_sgw(mme_ctx_sgw_first(), type, teid, pkbuf);
|
||||
mme_s11_send_to_sgw(mme_sgw_first(), type, teid, pkbuf);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
static struct session_handler *mme_s6a_reg = NULL;
|
||||
|
||||
struct sess_state {
|
||||
ue_ctx_t *ue;
|
||||
mme_ue_t *ue;
|
||||
struct timespec ts; /* Time of sending the message */
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ pool_declare(sess_state_pool, struct sess_state, MAX_NUM_SESSION_STATE);
|
|||
static void mme_s6a_aia_cb(void *data, struct msg **msg);
|
||||
|
||||
/* Cb called when an answer is received */
|
||||
int mme_s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id)
|
||||
int mme_s6a_send_auth_info_req(mme_ue_t *ue, plmn_id_t *plmn_id)
|
||||
{
|
||||
struct msg *req = NULL;
|
||||
struct avp *avp;
|
||||
|
@ -140,7 +140,7 @@ static void mme_s6a_aia_cb(void *data, struct msg **msg)
|
|||
int error = 0;
|
||||
int new;
|
||||
|
||||
ue_ctx_t *ue = NULL;
|
||||
mme_ue_t *ue = NULL;
|
||||
nas_message_t message;
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
event_t e;
|
||||
|
|
|
@ -13,7 +13,7 @@ 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);
|
||||
mme_ue_t *ue, plmn_id_t *plmn_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -78,13 +78,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 = mme_ctx_enb_find_by_sock(sock);
|
||||
mme_enb_t *enb = mme_enb_find_by_sock(sock);
|
||||
if (!enb)
|
||||
{
|
||||
rc = net_register_sock(sock, _s1ap_recv_cb, NULL);
|
||||
d_assert(rc == 0, break, "register _s1ap_recv_cb failed");
|
||||
|
||||
enb_ctx_t *enb = mme_ctx_enb_add();
|
||||
mme_enb_t *enb = mme_enb_add();
|
||||
d_assert(enb, break, "Null param");
|
||||
enb->s1ap_sock = sock;
|
||||
|
||||
|
@ -108,7 +108,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 = mme_ctx_enb_find_by_sock(sock);
|
||||
mme_enb_t *enb = mme_enb_find_by_sock(sock);
|
||||
if (enb)
|
||||
{
|
||||
d_assert(FSM_STATE(&enb->s1ap_sm), break, "Null param");
|
||||
|
@ -124,7 +124,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
}
|
||||
case EVT_MSG_UE_EMM:
|
||||
{
|
||||
ue_ctx_t *ue = (ue_ctx_t *)event_get_param1(e);
|
||||
mme_ue_t *ue = (mme_ue_t *)event_get_param1(e);
|
||||
d_assert(ue, break, "Null param");
|
||||
|
||||
d_assert(FSM_STATE(&ue->emm_sm), break, "Null param");
|
||||
|
@ -134,7 +134,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
}
|
||||
case EVT_MSG_UE_ESM:
|
||||
{
|
||||
ue_ctx_t *ue = (ue_ctx_t *)event_get_param1(e);
|
||||
mme_ue_t *ue = (mme_ue_t *)event_get_param1(e);
|
||||
d_assert(ue, break, "Null param");
|
||||
|
||||
d_assert(FSM_STATE(&ue->esm_sm), break, "Null param");
|
||||
|
@ -191,7 +191,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 = mme_ctx_enb_find_by_sock(sock);
|
||||
mme_enb_t *enb = mme_enb_find_by_sock(sock);
|
||||
if (enb)
|
||||
{
|
||||
/* Remove eNB S1 state machine if exist */
|
||||
|
@ -203,7 +203,7 @@ void mme_state_operational(mme_sm_t *s, event_t *e)
|
|||
net_unregister_sock(sock);
|
||||
net_close(sock);
|
||||
|
||||
mme_ctx_enb_remove(enb);
|
||||
mme_enb_remove(enb);
|
||||
d_info("eNB-S1[%x] connection refused!!!", enb->enb_id);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "nas_security.h"
|
||||
|
||||
status_t nas_security_encode(
|
||||
pkbuf_t **pkbuf, ue_ctx_t *ue, nas_message_t *message)
|
||||
pkbuf_t **pkbuf, mme_ue_t *ue, nas_message_t *message)
|
||||
{
|
||||
int integrity_protected = 0;
|
||||
int new_security_context = 0;
|
||||
|
@ -110,7 +110,7 @@ status_t nas_security_encode(
|
|||
}
|
||||
|
||||
status_t nas_security_decode(
|
||||
nas_message_t *message, ue_ctx_t *ue, pkbuf_t *pkbuf)
|
||||
nas_message_t *message, mme_ue_t *ue, pkbuf_t *pkbuf)
|
||||
{
|
||||
status_t rv;
|
||||
c_int32_t hsize = 0;
|
||||
|
|
|
@ -20,9 +20,9 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(status_t) nas_security_encode(
|
||||
pkbuf_t **pkbuf, ue_ctx_t *ue, nas_message_t *message);
|
||||
pkbuf_t **pkbuf, mme_ue_t *ue, nas_message_t *message);
|
||||
CORE_DECLARE(status_t) nas_security_decode(
|
||||
nas_message_t *message, ue_ctx_t *ue, pkbuf_t *pkbuf);
|
||||
nas_message_t *message, mme_ue_t *ue, pkbuf_t *pkbuf);
|
||||
|
||||
CORE_DECLARE(void) nas_mac_calculate(c_uint8_t algorithm_identity,
|
||||
c_uint8_t *knas_int, c_uint32_t count, c_uint8_t bearer,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "s1ap_handler.h"
|
||||
#include "s1ap_path.h"
|
||||
|
||||
void s1ap_handle_s1_setup_request(enb_ctx_t *enb, s1ap_message_t *message)
|
||||
void s1ap_handle_s1_setup_request(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
|
@ -56,11 +56,11 @@ void s1ap_handle_s1_setup_request(enb_ctx_t *enb, s1ap_message_t *message)
|
|||
enb_id);
|
||||
}
|
||||
|
||||
void s1ap_handle_initial_ue_message(enb_ctx_t *enb, s1ap_message_t *message)
|
||||
void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
ue_ctx_t *ue = NULL;
|
||||
mme_ue_t *ue = NULL;
|
||||
S1ap_InitialUEMessage_IEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
|
@ -68,10 +68,10 @@ void s1ap_handle_initial_ue_message(enb_ctx_t *enb, s1ap_message_t *message)
|
|||
ies = &message->s1ap_InitialUEMessage_IEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
||||
ue = mme_ctx_ue_find_by_enb_ue_s1ap_id(enb, ies->eNB_UE_S1AP_ID);
|
||||
ue = mme_ue_find_by_enb_ue_s1ap_id(enb, ies->eNB_UE_S1AP_ID);
|
||||
if (!ue)
|
||||
{
|
||||
ue = mme_ctx_ue_add(enb);
|
||||
ue = mme_ue_add(enb);
|
||||
d_assert(ue, return, "Null param");
|
||||
|
||||
ue->enb_ue_s1ap_id = ies->eNB_UE_S1AP_ID;
|
||||
|
@ -83,7 +83,7 @@ void s1ap_handle_initial_ue_message(enb_ctx_t *enb, s1ap_message_t *message)
|
|||
enb->enb_id, ue->enb_ue_s1ap_id);
|
||||
}
|
||||
|
||||
d_assert(enb->s1ap_sock, mme_ctx_ue_remove(ue);return,);
|
||||
d_assert(enb->s1ap_sock, mme_ue_remove(ue);return,);
|
||||
d_info("[S1AP] InitialUEMessage : UE[eNB-UE-S1AP-ID(%d)] --> eNB[%s:%d]",
|
||||
ue->enb_ue_s1ap_id,
|
||||
INET_NTOP(&enb->s1ap_sock->remote.sin_addr.s_addr, buf),
|
||||
|
@ -103,17 +103,17 @@ void s1ap_handle_initial_ue_message(enb_ctx_t *enb, s1ap_message_t *message)
|
|||
}
|
||||
|
||||
void s1ap_handle_uplink_nas_transport(
|
||||
enb_ctx_t *enb, s1ap_message_t *message)
|
||||
mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
ue_ctx_t *ue = NULL;
|
||||
mme_ue_t *ue = NULL;
|
||||
S1ap_UplinkNASTransport_IEs_t *ies = NULL;
|
||||
|
||||
ies = &message->s1ap_UplinkNASTransport_IEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
|
||||
ue = mme_ctx_ue_find_by_enb_ue_s1ap_id(enb, ies->eNB_UE_S1AP_ID);
|
||||
ue = mme_ue_find_by_enb_ue_s1ap_id(enb, ies->eNB_UE_S1AP_ID);
|
||||
d_assert(ue, return, "Null param");
|
||||
|
||||
d_info("[S1AP] uplinkNASTransport : UE[eNB-UE-S1AP-ID(%d)] --> eNB[%s:%d]",
|
||||
|
|
|
@ -9,11 +9,11 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(void) s1ap_handle_s1_setup_request(
|
||||
enb_ctx_t *enb, s1ap_message_t *message);
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
CORE_DECLARE(void) s1ap_handle_initial_ue_message(
|
||||
enb_ctx_t *enb, s1ap_message_t *message);
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
CORE_DECLARE(void) s1ap_handle_uplink_nas_transport(
|
||||
enb_ctx_t *enb, s1ap_message_t *message);
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ status_t s1ap_send(net_sock_t *s, pkbuf_t *pkbuf)
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_send_to_enb(enb_ctx_t *enb, pkbuf_t *pkbuf)
|
||||
status_t s1ap_send_to_enb(mme_enb_t *enb, pkbuf_t *pkbuf)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
d_assert(enb,,);
|
||||
|
|
|
@ -14,7 +14,7 @@ CORE_DECLARE(status_t) s1ap_listen();
|
|||
CORE_DECLARE(status_t) s1ap_close();
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_send(net_sock_t *s, pkbuf_t *pkb);
|
||||
CORE_DECLARE(status_t) s1ap_send_to_enb(enb_ctx_t *enb, pkbuf_t *pkb);
|
||||
CORE_DECLARE(status_t) s1ap_send_to_enb(mme_enb_t *enb, pkbuf_t *pkb);
|
||||
|
||||
int _s1ap_recv_cb(net_sock_t *net_sock, void *data);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ void s1ap_state_operational(s1ap_sm_t *s, event_t *e)
|
|||
d_assert(s, return, "Null param");
|
||||
d_assert(e, return, "Null param");
|
||||
|
||||
enb_ctx_t *enb = s->ctx;
|
||||
mme_enb_t *enb = s->ctx;
|
||||
d_assert(enb, return, "Null param");
|
||||
|
||||
mme_sm_trace(1, e);
|
||||
|
|
|
@ -158,7 +158,7 @@ static void nas_message_test4(abts_case *tc, void *data)
|
|||
|
||||
static void nas_message_test5(abts_case *tc, void *data)
|
||||
{
|
||||
ue_ctx_t ue;
|
||||
mme_ue_t ue;
|
||||
|
||||
ue.ul_count.i32 = 0x123456;
|
||||
ABTS_INT_EQUAL(tc, 0x1234, ue.ul_count.overflow);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
net_sock_t *tests1ap_enb_connect(void)
|
||||
{
|
||||
status_t rv;
|
||||
mme_ctx_t *mme = mme_self();
|
||||
mme_context_t *mme = mme_self();
|
||||
net_sock_t *sock = NULL;
|
||||
|
||||
if (!mme) return NULL;
|
||||
|
|
Loading…
Reference in New Issue