|
|
@ -36,24 +36,18 @@ void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interfa
|
|
|
|
rlc = rlc_;
|
|
|
|
rlc = rlc_;
|
|
|
|
rrc = rrc_;
|
|
|
|
rrc = rrc_;
|
|
|
|
gtpu = gtpu_;
|
|
|
|
gtpu = gtpu_;
|
|
|
|
|
|
|
|
|
|
|
|
pthread_rwlock_init(&rwlock, NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::stop()
|
|
|
|
void pdcp::stop()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
pthread_rwlock_destroy(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::add_user(uint16_t rnti)
|
|
|
|
void pdcp::add_user(uint16_t rnti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_wrlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti) == 0) {
|
|
|
|
if (users.count(rnti) == 0) {
|
|
|
|
srslte::pdcp* obj = new srslte::pdcp(timers, log_h);
|
|
|
|
srslte::pdcp* obj = new srslte::pdcp(timers, log_h);
|
|
|
|
obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf);
|
|
|
|
obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf);
|
|
|
@ -66,7 +60,6 @@ void pdcp::add_user(uint16_t rnti)
|
|
|
|
users[rnti].gtpu_itf.gtpu = gtpu;
|
|
|
|
users[rnti].gtpu_itf.gtpu = gtpu;
|
|
|
|
users[rnti].pdcp = obj;
|
|
|
|
users[rnti].pdcp = obj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Private unlocked deallocation of user
|
|
|
|
// Private unlocked deallocation of user
|
|
|
@ -79,17 +72,14 @@ void pdcp::clear_user(user_interface* ue)
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::rem_user(uint16_t rnti)
|
|
|
|
void pdcp::rem_user(uint16_t rnti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_wrlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
clear_user(&users[rnti]);
|
|
|
|
clear_user(&users[rnti]);
|
|
|
|
users.erase(rnti);
|
|
|
|
users.erase(rnti);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cfg)
|
|
|
|
void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cfg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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);
|
|
|
@ -97,16 +87,13 @@ void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cfg)
|
|
|
|
users[rnti].pdcp->add_bearer_mrb(lcid, cfg);
|
|
|
|
users[rnti].pdcp->add_bearer_mrb(lcid, cfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::reset(uint16_t rnti)
|
|
|
|
void pdcp::reset(uint16_t rnti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
users[rnti].pdcp->reset();
|
|
|
|
users[rnti].pdcp->reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::config_security(uint16_t rnti,
|
|
|
|
void pdcp::config_security(uint16_t rnti,
|
|
|
@ -117,25 +104,19 @@ void pdcp::config_security(uint16_t rnti,
|
|
|
|
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_)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
users[rnti].pdcp->config_security(lcid, k_rrc_enc_, k_rrc_int_, k_up_enc_, cipher_algo_, integ_algo_);
|
|
|
|
users[rnti].pdcp->config_security(lcid, k_rrc_enc_, k_rrc_int_, k_up_enc_, cipher_algo_, integ_algo_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::enable_integrity(uint16_t rnti, uint32_t lcid)
|
|
|
|
void pdcp::enable_integrity(uint16_t rnti, uint32_t lcid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
users[rnti].pdcp->enable_integrity(lcid, srslte::DIRECTION_TXRX);
|
|
|
|
users[rnti].pdcp->enable_integrity(lcid, srslte::DIRECTION_TXRX);
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::enable_encryption(uint16_t rnti, uint32_t lcid)
|
|
|
|
void pdcp::enable_encryption(uint16_t rnti, uint32_t lcid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
users[rnti].pdcp->enable_encryption(lcid, srslte::DIRECTION_TXRX);
|
|
|
|
users[rnti].pdcp->enable_encryption(lcid, srslte::DIRECTION_TXRX);
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool pdcp::get_bearer_status(uint16_t rnti,
|
|
|
|
bool pdcp::get_bearer_status(uint16_t rnti,
|
|
|
@ -153,16 +134,13 @@ bool pdcp::get_bearer_status(uint16_t rnti,
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu)
|
|
|
|
void pdcp::write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
users[rnti].pdcp->write_pdu(lcid, std::move(sdu));
|
|
|
|
users[rnti].pdcp->write_pdu(lcid, std::move(sdu));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu)
|
|
|
|
void pdcp::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pthread_rwlock_rdlock(&rwlock);
|
|
|
|
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (users.count(rnti)) {
|
|
|
|
if (rnti != SRSLTE_MRNTI) {
|
|
|
|
if (rnti != SRSLTE_MRNTI) {
|
|
|
|
// TODO: expose blocking mode as function param
|
|
|
|
// TODO: expose blocking mode as function param
|
|
|
@ -171,7 +149,6 @@ void pdcp::write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t
|
|
|
|
users[rnti].pdcp->write_sdu_mch(lcid, std::move(sdu));
|
|
|
|
users[rnti].pdcp->write_sdu_mch(lcid, std::move(sdu));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&rwlock);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void pdcp::user_interface_gtpu::write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
|
|
|
|
void pdcp::user_interface_gtpu::write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
|
|
|
|