update it

This commit is contained in:
Sukchan Lee 2017-04-11 19:14:18 +09:00
parent 9161a61669
commit ac9c0f92a8
7 changed files with 35 additions and 11 deletions

View File

@ -502,6 +502,7 @@ mme_esm_t* mme_esm_add(mme_ue_t *ue, c_uint8_t pti)
index_alloc(&mme_esm_pool, &esm);
d_assert(esm, return NULL, "Null param");
esm->teid = esm->index;
esm->pti = pti;
esm->ue = ue;
@ -552,6 +553,11 @@ mme_esm_t* mme_esm_find(index_t index)
return index_find(&mme_esm_pool, index);
}
mme_esm_t* mme_esm_find_by_teid(c_uint32_t teid)
{
return mme_esm_find(teid);
}
mme_esm_t* mme_esm_find_by_pti(mme_ue_t *ue, c_uint8_t pti)
{
mme_esm_t *esm = NULL;

View File

@ -156,8 +156,13 @@ typedef struct _mme_esm_t {
index_t index; /**< An index of this node */
fsm_t sm;
/* IMPORTANT!
* MME-S11-F-TEID is same with an index */
c_uint32_t teid;
c_uint32_t sgw_addr; /* SGW-S11-F-TEID IPv4 Address */
c_uint32_t sgw_teid; /* SGW-S11-F-TEID */
c_uint8_t pti; /** Procedure Trasaction Identity */
c_uint32_t teid; /* MME-S11-F-TEID */
mme_ue_t *ue;
mme_sgw_t *sgw;
@ -211,6 +216,7 @@ CORE_DECLARE(status_t) mme_esm_remove(mme_esm_t *esm);
CORE_DECLARE(status_t) mme_esm_remove_all(mme_ue_t *ue);
CORE_DECLARE(mme_esm_t*) mme_esm_find(index_t index);
CORE_DECLARE(mme_esm_t*) mme_esm_find_by_pti(mme_ue_t *ue, c_uint8_t pti);
CORE_DECLARE(mme_esm_t*) mme_esm_find_by_teid(c_uint32_t teid);
CORE_DECLARE(mme_esm_t*) mme_esm_first(mme_ue_t *ue);
CORE_DECLARE(mme_esm_t*) mme_esm_next(mme_esm_t *esm);

View File

@ -63,7 +63,11 @@ status_t mme_s11_build_create_session_req(
memset(&s11, 0, sizeof(gtp_f_teid_t));
s11.ipv4 = 1;
s11.interface_type = GTP_F_TEID_S11_MME_GTP_C;
#if 0
s11.teid = htonl(0x80000084);
#else
s11.teid = htonl(1);
#endif
s11.ipv4_addr = inet_addr("10.50.54.10");
req->sender_f_teid_for_control_plane.presence = 1;
req->sender_f_teid_for_control_plane.data = &s11;

View File

@ -229,6 +229,7 @@ void mme_state_operational(fsm_t *s, event_t *e)
c_uint8_t type;
c_uint32_t teid;
gtp_message_t gtp_message;
mme_esm_t *esm = NULL;
d_assert(pkbuf, break, "Null param");
d_assert(sock, pkbuf_free(pkbuf); break, "Null param");
@ -240,10 +241,13 @@ void mme_state_operational(fsm_t *s, event_t *e)
if (rv != CORE_OK)
break;
esm = mme_esm_find_by_teid(teid);
d_assert(esm, pkbuf_free(pkbuf); break,
"No Session Context(TEID:%d)", teid);
switch(type)
{
case GTP_CREATE_SESSION_RESPONSE_TYPE:
d_info("receive reponse");
d_info("receive reponse : %d, %d", teid, esm->pti);
break;
default:
d_warn("Not implmeneted(type:%d)", type);

View File

@ -41,8 +41,8 @@ typedef struct _pgw_sess_t {
* PGW-S5C-F-TEID is same with an index */
c_uint32_t teid;
c_uint32_t sgw_ipv4; /* SGW-S11-F-TEID IPv4 Address */
c_uint32_t sgw_teid; /* SGW-S11-F-TEID */
c_uint32_t sgw_addr; /* SGW-S5C-F-TEID IPv4 Address */
c_uint32_t sgw_teid; /* SGW-S5C-F-TEID */
} pgw_sess_t;
CORE_DECLARE(status_t) pgw_context_init(void);

View File

@ -47,7 +47,7 @@ void pgw_handle_create_session_request(
d_assert(sess, return, "sess_add failed");
sess->sgw_teid = ntohl(sgw_f_teid->teid);
sess->sgw_ipv4 = sgw_f_teid->ipv4_addr;
sess->sgw_addr = sgw_f_teid->ipv4_addr;
memset(&gtp_message, 0, sizeof(gtp_message_t));

View File

@ -75,14 +75,18 @@ void sgw_state_operational(fsm_t *s, event_t *e)
if (rv != CORE_OK)
break;
if (teid)
sess = sgw_sess_find_by_teid(teid);
if (type == GTP_CREATE_SESSION_REQUEST_TYPE)
{
sgw_handle_create_session_request(xact, type, &gtp_message);
pkbuf_free(pkbuf);
break;
}
sess = sgw_sess_find_by_teid(teid);
d_assert(sess, pkbuf_free(pkbuf); break,
"No Session Context(TEID:%d)", teid);
switch(type)
{
case GTP_CREATE_SESSION_REQUEST_TYPE:
sgw_handle_create_session_request(
xact, type, &gtp_message);
break;
case GTP_CREATE_SESSION_RESPONSE_TYPE:
sgw_handle_create_session_response(
xact, sess, type, &gtp_message);