add API to change LCID of PDCP bearers

This commit is contained in:
Andre Puschmann 2018-09-17 13:10:44 +02:00
parent 068fd2d81e
commit 27459bf706
2 changed files with 23 additions and 0 deletions

View File

@ -61,6 +61,7 @@ public:
void add_bearer(uint32_t lcid, srslte_pdcp_config_t cnfg = srslte_pdcp_config_t());
void add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cnfg = srslte_pdcp_config_t());
void del_bearer(uint32_t lcid);
void change_lcid(uint32_t old_lcid, uint32_t new_lcid);
void config_security(uint32_t lcid,
uint8_t *k_enc,
uint8_t *k_int,

View File

@ -187,6 +187,28 @@ void pdcp::del_bearer(uint32_t lcid)
pthread_rwlock_unlock(&rwlock);
}
void pdcp::change_lcid(uint32_t old_lcid, uint32_t new_lcid)
{
pthread_rwlock_wrlock(&rwlock);
// make sure old LCID exists and new LCID is still free
if (valid_lcid(old_lcid) && not valid_lcid(new_lcid)) {
// insert old PDCP entity into new LCID
pdcp_map_t::iterator it = pdcp_array.find(old_lcid);
pdcp_entity_interface *pdcp_entity = it->second;
if (not pdcp_array.insert(pdcp_map_pair_t(new_lcid, pdcp_entity)).second) {
pdcp_log->error("Error inserting PDCP entity into array\n.");
goto exit;
}
// erase from old position
pdcp_array.erase(it);
pdcp_log->warning("Changed LCID of PDCP bearer from %d to %d\n", old_lcid, new_lcid);
} else {
pdcp_log->error("Can't change PDCP of bearer %s from %d to %d. Bearer doesn't exist or new LCID already occupied.\n", rrc->get_rb_name(old_lcid).c_str(), old_lcid, new_lcid);
}
exit:
pthread_rwlock_unlock(&rwlock);
}
void pdcp::config_security(uint32_t lcid,
uint8_t *k_enc,