Fixup clang-format in pdcp before PR.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 15613465cf
commit d4fb4d8c86

@ -119,7 +119,6 @@ protected:
bool integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* mac); bool integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* mac);
void cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* ct); void cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t count, uint8_t* ct);
void cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t count, uint8_t* msg); void cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t count, uint8_t* msg);
}; };
inline uint32_t pdcp_entity_base::HFN(uint32_t count) inline uint32_t pdcp_entity_base::HFN(uint32_t count)

@ -46,8 +46,7 @@ public:
srslte::timer_handler* timers_, srslte::timer_handler* timers_,
srslte::log* log_); srslte::log* log_);
~pdcp_entity_nr(); ~pdcp_entity_nr();
void init( uint32_t lcid_, void init(uint32_t lcid_, pdcp_config_t cfg_);
pdcp_config_t cfg_);
void reset(); void reset();
void reestablish(); void reestablish();

@ -33,7 +33,7 @@ pdcp::~pdcp()
// destroy all remaining entities // destroy all remaining entities
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) { for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) {
delete(it->second); delete (it->second);
} }
pdcp_array.clear(); pdcp_array.clear();
@ -53,11 +53,10 @@ void pdcp::init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_
gw = gw_; gw = gw_;
} }
void pdcp::stop() void pdcp::stop() {}
{
}
void pdcp::reestablish() { void pdcp::reestablish()
{
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) { for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) {
it->second->reestablish(); it->second->reestablish();
@ -78,9 +77,9 @@ void pdcp::reset()
{ {
// destroy all bearers // destroy all bearers
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); /* post increment in erase */ ) { for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); /* post increment in erase */) {
it->second->reset(); it->second->reset();
delete(it->second); delete (it->second);
pdcp_array.erase(it++); pdcp_array.erase(it++);
} }
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
@ -114,7 +113,7 @@ void pdcp::write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking)
void pdcp::write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu) void pdcp::write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (valid_mch_lcid(lcid)){ if (valid_mch_lcid(lcid)) {
pdcp_array_mrb.at(lcid)->write_sdu(std::move(sdu), true); pdcp_array_mrb.at(lcid)->write_sdu(std::move(sdu), true);
} }
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
@ -149,7 +148,7 @@ void pdcp::add_bearer_mrb(uint32_t lcid, pdcp_config_t cfg)
pdcp_log->error("Error inserting PDCP entity in to array\n."); pdcp_log->error("Error inserting PDCP entity in to array\n.");
goto unlock_and_exit; goto unlock_and_exit;
} }
pdcp_array_mrb.at(lcid)->init( lcid, cfg); pdcp_array_mrb.at(lcid)->init(lcid, cfg);
pdcp_log->info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)\n", pdcp_log->info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)\n",
rrc->get_rb_name(lcid).c_str(), rrc->get_rb_name(lcid).c_str(),
lcid, lcid,
@ -167,7 +166,7 @@ void pdcp::del_bearer(uint32_t lcid)
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
if (valid_lcid(lcid)) { if (valid_lcid(lcid)) {
pdcp_map_t::iterator it = pdcp_array.find(lcid); pdcp_map_t::iterator it = pdcp_array.find(lcid);
delete(it->second); delete (it->second);
pdcp_array.erase(it); pdcp_array.erase(it);
pdcp_log->warning("Deleted PDCP bearer %s\n", rrc->get_rb_name(lcid).c_str()); pdcp_log->warning("Deleted PDCP bearer %s\n", rrc->get_rb_name(lcid).c_str());
} else { } else {
@ -204,9 +203,9 @@ exit:
} }
void pdcp::config_security(uint32_t lcid, void pdcp::config_security(uint32_t lcid,
uint8_t *k_rrc_enc, uint8_t* k_rrc_enc,
uint8_t *k_rrc_int, uint8_t* k_rrc_int,
uint8_t *k_up_enc, uint8_t* k_up_enc,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo, CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo) INTEGRITY_ALGORITHM_ID_ENUM integ_algo)
{ {
@ -217,8 +216,11 @@ void pdcp::config_security(uint32_t lcid,
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void pdcp::config_security_all(uint8_t* k_rrc_enc, uint8_t* k_rrc_int, uint8_t* k_up_enc, void pdcp::config_security_all(uint8_t* k_rrc_enc,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo, INTEGRITY_ALGORITHM_ID_ENUM integ_algo) uint8_t* k_rrc_int,
uint8_t* k_up_enc,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) { for (pdcp_map_t::iterator it = pdcp_array.begin(); it != pdcp_array.end(); ++it) {

@ -34,7 +34,7 @@ class pdcp : public pdcp_interface_rlc, public pdcp_interface_gtpu, public pdcp_
{ {
public: public:
pdcp(srslte::timer_handler* timers, srslte::log* pdcp_log_); pdcp(srslte::timer_handler* timers, srslte::log* pdcp_log_);
virtual ~pdcp() {}; virtual ~pdcp(){};
void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_); void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_);
void stop(); void stop();

@ -43,7 +43,7 @@ void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interfa
void pdcp::stop() void pdcp::stop()
{ {
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
for(std::map<uint32_t, user_interface>::iterator iter=users.begin(); iter!=users.end(); ++iter) { for (std::map<uint32_t, user_interface>::iterator iter = users.begin(); iter != users.end(); ++iter) {
clear_user(&iter->second); clear_user(&iter->second);
} }
users.clear(); users.clear();
@ -70,7 +70,7 @@ void pdcp::add_user(uint16_t rnti)
} }
// Private unlocked deallocation of user // Private unlocked deallocation of user
void pdcp::clear_user(user_interface *ue) void pdcp::clear_user(user_interface* ue)
{ {
ue->pdcp->stop(); ue->pdcp->stop();
delete ue->pdcp; delete ue->pdcp;
@ -91,7 +91,7 @@ void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cfg)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {
if(rnti != SRSLTE_MRNTI){ if (rnti != SRSLTE_MRNTI) {
users[rnti].pdcp->add_bearer(lcid, cfg); users[rnti].pdcp->add_bearer(lcid, cfg);
} else { } else {
users[rnti].pdcp->add_bearer_mrb(lcid, cfg); users[rnti].pdcp->add_bearer_mrb(lcid, cfg);
@ -109,7 +109,11 @@ void pdcp::reset(uint16_t rnti)
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void pdcp::config_security(uint16_t rnti, uint32_t lcid, uint8_t* k_rrc_enc_, uint8_t* k_rrc_int_, uint8_t* k_up_enc_, void pdcp::config_security(uint16_t rnti,
uint32_t lcid,
uint8_t* k_rrc_enc_,
uint8_t* k_rrc_int_,
uint8_t* k_up_enc_,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_, srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_)
{ {
@ -147,9 +151,9 @@ void pdcp::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {
if(rnti != SRSLTE_MRNTI){ if (rnti != SRSLTE_MRNTI) {
users[rnti].pdcp->write_sdu(lcid, std::move(sdu)); users[rnti].pdcp->write_sdu(lcid, std::move(sdu));
}else { } else {
users[rnti].pdcp->write_sdu_mch(lcid, std::move(sdu)); users[rnti].pdcp->write_sdu_mch(lcid, std::move(sdu));
} }
} }
@ -166,7 +170,8 @@ void pdcp::user_interface_rlc::write_sdu(uint32_t lcid, srslte::unique_byte_buff
rlc->write_sdu(rnti, lcid, std::move(sdu)); rlc->write_sdu(rnti, lcid, std::move(sdu));
} }
bool pdcp::user_interface_rlc::rb_is_um(uint32_t lcid) { bool pdcp::user_interface_rlc::rb_is_um(uint32_t lcid)
{
return rlc->rb_is_um(rnti, lcid); return rlc->rb_is_um(rnti, lcid);
} }
@ -195,4 +200,4 @@ std::string pdcp::user_interface_rrc::get_rb_name(uint32_t lcid)
return std::string(rb_id_text[lcid]); return std::string(rb_id_text[lcid]);
} }
} } // namespace srsenb

Loading…
Cancel
Save