diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 4aeb17011..e0f5e1422 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -346,43 +346,6 @@ s1ap::delete_enb_ctx(int32_t assoc_id) //UE Context Management -/*void -s1ap::add_new_ue_ctx(const ue_ctx_t &ue_ctx) -{ - std::map::iterator ctx_it = m_imsi_to_ue_ctx.find(ue_ctx.emm_ctx.imsi); - if(ctx_it != m_imsi_to_ue_ctx.end()) - { - m_s1ap_log->warning("UE Context already exists. Replacing UE Context\n"); - delete ctx_it->second; - m_imsi_to_ue_ctx.erase(ctx_it); - } - std::map::iterator imsi_it = m_mme_ue_s1ap_id_to_imsi.find(ue_ctx.ecm_ctx.mme_ue_s1ap_id); - if(imsi_it != m_mme_ue_s1ap_id_to_imsi.end()) - { - m_s1ap_log->warning("MME UE S1AP Id already exists, replacing it.\n"); - m_mme_ue_s1ap_id_to_imsi.erase(imsi_it); - } - - ue_ctx_t *new_ctx = new ue_ctx_t; - memcpy(new_ctx, &ue_ctx,sizeof(ue_ctx)); - - //This map will store UEs context - m_imsi_to_ue_ctx.insert(std::pair(new_ctx->emm_ctx.imsi,new_ctx)); - m_mme_ue_s1ap_id_to_imsi.insert(std::pair(ue_ctx.ecm_ctx.mme_ue_s1ap_id,ue_ctx.emm_ctx.imsi)); - - //Store which enb currently holds the UE - std::map::iterator it_enb = m_sctp_to_enb_id.find(new_ctx->ecm_ctx.enb_sri.sinfo_assoc_id); - uint16_t enb_id = it_enb->second; - std::map >::iterator it_ue_id = m_enb_id_to_ue_ids.find(enb_id); - if(it_ue_id==m_enb_id_to_ue_ids.end()) - { - m_s1ap_log->error("Could not find eNB's UEs\n"); - return; - } - it_ue_id->second.insert(new_ctx->ecm_ctx.mme_ue_s1ap_id); - return; -} -*/ bool s1ap::add_ue_ctx_to_imsi_map(ue_ctx_t *ue_ctx) { @@ -434,33 +397,6 @@ s1ap::add_ue_ctx_to_mme_ue_s1ap_id_map(ue_ctx_t *ue_ctx) return true; } - /* -void -s1ap::store_tmp_ue_emm_ctx(const ue_emm_ctx_t &tmp_ue_emm_ctx) -{ - ue_emm_ctx_t *ue_ptr = new ue_emm_ctx_t; - memcpy(ue_ptr,&tmp_ue_emm_ctx,sizeof(tmp_ue_emm_ctx)); - - //This map will store UE's ECM context. - m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.insert(std::pair(ue_ptr->mme_ue_s1ap_id,ue_ptr)); -} - -bool -s1ap::get_tmp_ue_emm_ctx(uint32_t mme_ue_s1ap_id, ue_emm_ctx_t* ue_emm_ptr) -{ - - std::map::iterator it = m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.find(mme_ue_s1ap_id); - if(it == m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.end() ) - { - return false; - } - memcpy(ue_emm_ptr, it->second,sizeof(ue_emm_ctx_t)); - delete it->second; - m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.erase(it); - return true; -} - */ - ue_ctx_t* s1ap::find_ue_ctx_from_mme_ue_s1ap_id(uint32_t mme_ue_s1ap_id) { @@ -647,125 +583,3 @@ s1ap::print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx) } //namespace srsepc - /* -void -s1ap::add_new_ue_emm_ctx(const ue_emm_ctx_t &ue_emm_ctx) -{ - std::map::iterator emm_ctx_it = m_imsi_to_ue_emm_ctx.find(ue_emm_ctx.imsi); - if(emm_ctx_it != m_imsi_to_ue_emm_ctx.end()) - { - m_s1ap_log->warning("EMM Context already exists. Replacing EMM Context\n"); - delete emm_ctx_it->second; - m_imsi_to_ue_emm_ctx.erase(emm_ctx_it); - } - - ue_emm_ctx_t *ue_ptr = new ue_emm_ctx_t; - memcpy(ue_ptr,&ue_emm_ctx,sizeof(ue_emm_ctx)); - //This map will store UEs EMM context - m_imsi_to_ue_emm_ctx.insert(std::pair(ue_ptr->imsi,ue_ptr)); -} - */ - -/* - void - s1ap::add_new_ue_ecm_ctx(const ue_ecm_ctx_t &ue_ecm_ctx) - { - ue_ecm_ctx_t *ue_ptr = new ue_ecm_ctx_t; - memcpy(ue_ptr,&ue_ecm_ctx,sizeof(ue_ecm_ctx)); - - //This map will store UE's ECM context. - m_mme_ue_s1ap_id_to_ue_ecm_ctx.insert(std::pair(ue_ptr->mme_ue_s1ap_id,ue_ptr)); - //Store which enb currently holds the UE - std::map::iterator it_enb = m_sctp_to_enb_id.find(ue_ptr->enb_sri.sinfo_assoc_id); - uint16_t enb_id = it_enb->second; - std::map >::iterator it_ue_id = m_enb_id_to_ue_ids.find(enb_id); - if(it_ue_id==m_enb_id_to_ue_ids.end()) - { - m_s1ap_log->error("Could not find eNB's UEs\n"); - return; - } - it_ue_id->second.insert(ue_ptr->mme_ue_s1ap_id); - } - */ - /* -ue_emm_ctx_t* -s1ap::find_ue_emm_ctx_from_imsi(uint64_t imsi) -{ - std::map::iterator it = m_imsi_to_ue_emm_ctx.find(imsi); - if(it == m_imsi_to_ue_emm_ctx.end()) - { - return NULL; - } - else - { - return it->second; - } -} - -ue_ecm_ctx_t* -s1ap::find_ue_ecm_ctx_from_mme_ue_s1ap_id(uint32_t mme_ue_s1ap_id) -{ - std::map::iterator it = m_mme_ue_s1ap_id_to_ue_ecm_ctx.find(mme_ue_s1ap_id); - if(it == m_mme_ue_s1ap_id_to_ue_ecm_ctx.end()) - { - return NULL; - } - else - { - return it->second; - } -}*/ - /* -bool -s1ap::delete_ue_emm_ctx(uint64_t imsi) -{ - std::map::iterator ue_emm_ctx_it = m_imsi_to_ue_emm_ctx.find(imsi); - if(ue_emm_ctx_it == m_imsi_to_ue_emm_ctx.end()) - { - m_s1ap_log->info("Cannot delete UE EMM context, UE not found. IMSI: %d\n", imsi); - return false; - } - - //Delete UE context - m_imsi_to_ue_emm_ctx.erase(ue_emm_ctx_it); - delete ue_emm_ctx_it->second; - m_s1ap_log->info("Deleted UE EMM Context.\n"); - return true; -} - */ - /* -bool -s1ap::delete_ue_ecm_ctx(uint32_t mme_ue_s1ap_id) -{ - std::map::iterator ue_ecm_ctx_it = m_mme_ue_s1ap_id_to_ue_ecm_ctx.find(mme_ue_s1ap_id); - if(ue_ecm_ctx_it == m_mme_ue_s1ap_id_to_ue_ecm_ctx.end()) - { - m_s1ap_log->info("Cannot delete UE ECM context, UE not found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); - return false; - } - ue_ecm_ctx_t* ue_ecm_ctx = ue_ecm_ctx_it->second; - - //Delete UE within eNB UE set - std::map::iterator it = m_sctp_to_enb_id.find(ue_ecm_ctx->enb_sri.sinfo_assoc_id); - if(it == m_sctp_to_enb_id.end() ) - { - m_s1ap_log->error("Could not find eNB for this request.\n"); - return false; - } - uint16_t enb_id = it->second; - std::map >::iterator ue_set = m_enb_id_to_ue_ids.find(enb_id); - if(ue_set == m_enb_id_to_ue_ids.end()) - { - m_s1ap_log->error("Could not find the eNB's UEs.\n"); - return false; - } - ue_set->second.erase(mme_ue_s1ap_id); - - //Delete UE context - m_mme_ue_s1ap_id_to_ue_ecm_ctx.erase(ue_ecm_ctx_it); - delete ue_ecm_ctx; - m_s1ap_log->info("Deleted UE ECM Context.\n"); - - return true; -} - */