This commit is contained in:
Sukchan Lee 2017-04-28 16:12:18 +09:00
commit 57d94969bf
5 changed files with 68 additions and 47 deletions

View File

@ -101,6 +101,45 @@ typedef struct _gtp_ambr_t {
c_uint32_t downlink;
} __attribute__ ((packed)) gtp_ambr_t;
/* 8.12 Indication */
typedef struct _gtp_indication_t {
ED8(c_uint8_t daf:1;,
c_uint8_t dtf:1;,
c_uint8_t hi:1;,
c_uint8_t dfi:1;,
c_uint8_t oi:1;,
c_uint8_t isrsi:1;,
c_uint8_t israi:1;,
c_uint8_t sgwci:1;)
ED8(c_uint8_t sqci:1;,
c_uint8_t uimsi:1;,
c_uint8_t cfsi:1;,
c_uint8_t crsi:1;,
c_uint8_t p:1;,
c_uint8_t pt:1;,
c_uint8_t si:1;,
c_uint8_t msv:1;)
ED8(c_uint8_t retloc:1;,
c_uint8_t pbic:1;,
c_uint8_t srni:1;,
c_uint8_t s6af:1;,
c_uint8_t s4af:1;,
c_uint8_t mbmdt:1;,
c_uint8_t israu:1;,
c_uint8_t ccrsi:1;)
ED8(c_uint8_t spare1:1;,
c_uint8_t spare2:1;,
c_uint8_t spare3:1;,
c_uint8_t spare4:1;,
c_uint8_t spare5:1;,
c_uint8_t csfbi:1;,
c_uint8_t clii:1;,
c_uint8_t cpsr:1;)
} __attribute__ ((packed)) gtp_indication_t;
/* 8.13 Protocol Configuration Options (PCO)
* 10.5.6.3 Protocol configuration options in 3GPP TS 24.008
* RFC 3232 [103]

View File

@ -655,10 +655,6 @@ mme_ue_t *emm_find_ue_by_message(enb_ue_t *enb_ue, nas_message_t *message)
guti.mme_gid,
guti.mme_code,
guti.m_tmsi);
printf("Search mme_ue by GUTI[G:%d,C:%d,M_TMSI:0x%x]\n",
guti.mme_gid,
guti.mme_code,
guti.m_tmsi);
mme_ue = mme_ue_find_by_guti(&guti);
if (!mme_ue)

View File

@ -64,8 +64,8 @@ status_t mme_context_init()
self.mme_addr = inet_addr(g_mme_ip_addr);
self.mme_ue_s1ap_id_hash = hash_make();
self.imsi_hash = hash_make();
self.guti_hash = hash_make();
self.imsi_ue_hash = hash_make();
self.guti_ue_hash = hash_make();
self.s1ap_addr = self.mme_addr;
self.s1ap_port = S1AP_SCTP_PORT;
@ -114,11 +114,11 @@ status_t mme_context_final()
d_assert(self.mme_ue_s1ap_id_hash, , "Null param");
hash_destroy(self.mme_ue_s1ap_id_hash);
d_assert(self.imsi_hash, , "Null param");
hash_destroy(self.imsi_hash);
d_assert(self.imsi_ue_hash, , "Null param");
hash_destroy(self.imsi_ue_hash);
d_assert(self.guti_hash, , "Null param");
hash_destroy(self.guti_hash);
d_assert(self.guti_ue_hash, , "Null param");
hash_destroy(self.guti_ue_hash);
pool_final(&mme_pdn_pool);
index_final(&mme_bearer_pool);
@ -485,53 +485,24 @@ mme_ue_t* mme_ue_find(index_t index)
return index_find(&mme_ue_pool, index);
}
#if 0
mme_ue_t* mme_ue_find_by_mme_ue_s1ap_id(c_uint32_t mme_ue_s1ap_id)
{
d_assert(self.mme_ue_s1ap_id_hash, return NULL, "Null param");
return hash_get(self.mme_ue_s1ap_id_hash,
&mme_ue_s1ap_id, sizeof(mme_ue_s1ap_id));
}
#endif
mme_ue_t* mme_ue_find_by_imsi(c_uint8_t *imsi, int imsi_len)
{
mme_ue_t *iter = NULL;
d_assert(imsi && imsi_len, return NULL,"Invalid Param");
#if 0
d_assert(imsi && imsi_len, return NULL, "Invalid Param");
for (iter = list_first(&self.mme_ue_list); iter; iter = list_next(iter))
{
if (!memcmp(iter->imsi,imsi, imsi_len))
break;
}
#endif
return iter;
return (mme_ue_t *)hash_get(self.imsi_ue_hash, imsi, imsi_len);
}
mme_ue_t* mme_ue_find_by_guti(guti_t *guti)
{
mme_ue_t *iter = NULL;
d_assert(guti, return NULL,"Invalid Param");
#if 0
d_assert(imsi && imsi_len, return NULL, "Invalid Param");
for (iter = list_first(&self.mme_ue_list); iter; iter = list_next(iter))
{
if (!memcmp(iter->imsi,imsi, imsi_len))
break;
}
#endif
return iter;
return (mme_ue_t *)hash_get(self.guti_ue_hash, guti, sizeof(guti_t));
}
hash_index_t *mme_ue_first()
{
d_assert(self.mme_ue_s1ap_id_hash, return NULL, "Null param");
return hash_first(self.mme_ue_s1ap_id_hash);
d_assert(self.imsi_ue_hash, return NULL, "Null param");
return hash_first(self.imsi_ue_hash);
}
hash_index_t *mme_ue_next(hash_index_t *hi)

View File

@ -78,8 +78,8 @@ typedef struct _mme_context_t {
list_t enb_list;
hash_t *mme_ue_s1ap_id_hash; /* hash table for MME-UE-S1AP-ID */
hash_t *imsi_hash; /* hash table (IMSI : MME_UE) */
hash_t *guti_hash; /* hash table (GUTI : MME_UE) */
hash_t *imsi_ue_hash; /* hash table (IMSI : MME_UE) */
hash_t *guti_ue_hash; /* hash table (GUTI : MME_UE) */
} mme_context_t;
typedef struct _mme_sgw_t {

View File

@ -187,9 +187,11 @@ status_t mme_s11_build_delete_session_request(pkbuf_t **pkbuf, mme_sess_t *sess)
status_t rv;
mme_ue_t *mme_ue = NULL;
gtp_message_t gtp_message;
mme_bearer_t *bearer;
gtp_delete_session_request_t *req = &gtp_message.delete_session_request;
gtp_f_teid_t mme_s11_teid;
gtp_indication_t indication;
d_assert(sess, return CORE_ERROR, "Null param");
mme_ue = sess->mme_ue;
@ -197,6 +199,19 @@ status_t mme_s11_build_delete_session_request(pkbuf_t **pkbuf, mme_sess_t *sess)
memset(&gtp_message, 0, sizeof(gtp_message_t));
bearer = mme_default_bearer_in_sess(sess);
if (bearer)
{
req->linked_eps_bearer_id.presence = 1;
req->linked_eps_bearer_id.u8 = bearer->ebi;
}
memset(&indication, 0, sizeof(gtp_indication_t));
indication.oi = 1;
req->indication_flags.presence = 1;
req->indication_flags.data = &indication;
req->indication_flags.len = sizeof(gtp_indication_t);
memset(&mme_s11_teid, 0, sizeof(gtp_f_teid_t));
mme_s11_teid.ipv4 = 1;
mme_s11_teid.interface_type = GTP_F_TEID_S11_MME_GTP_C;