|
|
|
@ -299,7 +299,7 @@ s1ap::add_new_enb_ctx(const enb_ctx_t &enb_ctx, const struct sctp_sndrcvinfo *en
|
|
|
|
|
memcpy(enb_ptr,&enb_ctx,sizeof(enb_ctx_t));
|
|
|
|
|
m_active_enbs.insert(std::pair<uint16_t,enb_ctx_t*>(enb_ptr->enb_id,enb_ptr));
|
|
|
|
|
m_sctp_to_enb_id.insert(std::pair<int32_t,uint16_t>(enb_sri->sinfo_assoc_id, enb_ptr->enb_id));
|
|
|
|
|
m_enb_id_to_ue_ids.insert(std::pair<uint16_t,std::set<uint32_t> >(enb_ptr->enb_id,ue_set));
|
|
|
|
|
m_enb_assoc_to_ue_ids.insert(std::pair<int32_t,std::set<uint32_t> >(enb_sri->sinfo_assoc_id,ue_set));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -335,7 +335,7 @@ s1ap::delete_enb_ctx(int32_t assoc_id)
|
|
|
|
|
m_s1ap_log->console("Deleting eNB context. eNB Id: 0x%x\n", enb_id);
|
|
|
|
|
|
|
|
|
|
//Delete connected UEs ctx
|
|
|
|
|
release_ues_ecm_ctx_in_enb(enb_id);
|
|
|
|
|
release_ues_ecm_ctx_in_enb(assoc_id);
|
|
|
|
|
|
|
|
|
|
//Delete eNB
|
|
|
|
|
delete it_ctx->second;
|
|
|
|
@ -398,23 +398,23 @@ s1ap::add_ue_ctx_to_mme_ue_s1ap_id_map(ue_ctx_t *ue_ctx)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
s1ap::add_ue_to_enb_set(uint16_t enb_id, uint32_t mme_ue_s1ap_id)
|
|
|
|
|
s1ap::add_ue_to_enb_set(int32_t enb_assoc, uint32_t mme_ue_s1ap_id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
std::map<uint16_t,std::set<uint32_t> >::iterator ues_in_enb = m_enb_id_to_ue_ids.find(enb_id);
|
|
|
|
|
if(ues_in_enb == m_enb_id_to_ue_ids.end())
|
|
|
|
|
std::map<int32_t,std::set<uint32_t> >::iterator ues_in_enb = m_enb_assoc_to_ue_ids.find(enb_assoc);
|
|
|
|
|
if(ues_in_enb == m_enb_assoc_to_ue_ids.end())
|
|
|
|
|
{
|
|
|
|
|
m_s1ap_log->error("Could not find eNB from eNB Id 0x%x",enb_id);
|
|
|
|
|
m_s1ap_log->error("Could not find eNB from eNB SCTP association %d",enb_assoc);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::set<uint32_t>::iterator ue_id = ues_in_enb->second.find(mme_ue_s1ap_id);
|
|
|
|
|
if(ue_id != ues_in_enb->second.end())
|
|
|
|
|
{
|
|
|
|
|
m_s1ap_log->error("Could not find eNB from eNB Id %d",enb_id);
|
|
|
|
|
m_s1ap_log->error("UE with MME UE S1AP Id already exists %d",mme_ue_s1ap_id);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
ues_in_enb->second.insert(mme_ue_s1ap_id);
|
|
|
|
|
m_s1ap_log->debug("Added UE with MME-UE S1AP Id %d to eNB 0x%xcontext %d\n", mme_ue_s1ap_id, enb_id);
|
|
|
|
|
m_s1ap_log->debug("Added UE with MME-UE S1AP Id %d to eNB with association %d\n", mme_ue_s1ap_id, enb_assoc);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -447,11 +447,11 @@ s1ap::find_ue_ctx_from_imsi(uint64_t imsi)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
s1ap::release_ues_ecm_ctx_in_enb(uint16_t enb_id)
|
|
|
|
|
s1ap::release_ues_ecm_ctx_in_enb(int32_t enb_assoc)
|
|
|
|
|
{
|
|
|
|
|
m_s1ap_log->console("Releasing UEs context\n");
|
|
|
|
|
//delete UEs ctx
|
|
|
|
|
std::map<uint16_t,std::set<uint32_t> >::iterator ues_in_enb = m_enb_id_to_ue_ids.find(enb_id);
|
|
|
|
|
std::map<int32_t,std::set<uint32_t> >::iterator ues_in_enb = m_enb_assoc_to_ue_ids.find(enb_assoc);
|
|
|
|
|
std::set<uint32_t>::iterator ue_id = ues_in_enb->second.begin();
|
|
|
|
|
if(ue_id == ues_in_enb->second.end())
|
|
|
|
|
{
|
|
|
|
@ -497,8 +497,8 @@ s1ap::release_ue_ecm_ctx(uint32_t mme_ue_s1ap_id)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
uint16_t enb_id = it->second;
|
|
|
|
|
std::map<uint16_t,std::set<uint32_t> >::iterator ue_set = m_enb_id_to_ue_ids.find(enb_id);
|
|
|
|
|
if(ue_set == m_enb_id_to_ue_ids.end())
|
|
|
|
|
std::map<int32_t,std::set<uint32_t> >::iterator ue_set = m_enb_assoc_to_ue_ids.find(ecm_ctx->enb_sri.sinfo_assoc_id);
|
|
|
|
|
if(ue_set == m_enb_assoc_to_ue_ids.end())
|
|
|
|
|
{
|
|
|
|
|
m_s1ap_log->error("Could not find the eNB's UEs.\n");
|
|
|
|
|
return false;
|
|
|
|
|