srsLTE/lib/include/srslte/upper/pdcp.h

88 lines
3.3 KiB
C
Raw Normal View History

2019-04-26 12:27:38 -07:00
/*
2020-03-13 04:12:52 -07:00
* Copyright 2013-2020 Software Radio Systems Limited
2017-05-18 03:52:29 -07:00
*
2019-04-26 12:27:38 -07:00
* This file is part of srsLTE.
2017-05-18 03:52:29 -07:00
*
2019-04-26 12:27:38 -07:00
* srsLTE is free software: you can redistribute it and/or modify
2017-05-18 03:52:29 -07:00
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
2019-04-26 12:27:38 -07:00
* srsLTE is distributed in the hope that it will be useful,
2017-05-18 03:52:29 -07:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
2018-03-31 10:04:04 -07:00
#ifndef SRSLTE_PDCP_H
#define SRSLTE_PDCP_H
2017-05-18 03:52:29 -07:00
#include "srslte/common/common.h"
2019-07-23 07:49:34 -07:00
#include "srslte/common/log.h"
2020-07-08 14:06:15 -07:00
#include "srslte/common/task_scheduler.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/pdcp_entity_lte.h"
2017-05-18 03:52:29 -07:00
namespace srslte {
2017-05-18 03:52:29 -07:00
class pdcp : public srsue::pdcp_interface_rlc, public srsue::pdcp_interface_rrc
2017-05-18 03:52:29 -07:00
{
public:
2020-07-08 14:06:15 -07:00
pdcp(srslte::task_sched_handle task_sched_, const char* logname);
2018-07-17 06:27:04 -07:00
virtual ~pdcp();
void init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_);
2017-05-18 03:52:29 -07:00
void stop();
// GW interface
bool is_lcid_enabled(uint32_t lcid);
2017-05-18 03:52:29 -07:00
// RRC interface
void reestablish() override;
void reestablish(uint32_t lcid) override;
void reset() override;
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu) override;
void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
void add_bearer(uint32_t lcid, pdcp_config_t cnfg) override;
void add_bearer_mrb(uint32_t lcid, pdcp_config_t cnfg);
2018-08-03 07:28:06 -07:00
void del_bearer(uint32_t lcid);
void change_lcid(uint32_t old_lcid, uint32_t new_lcid) override;
void config_security(uint32_t lcid, as_security_config_t sec_cfg) override;
void config_security_all(as_security_config_t sec_cfg) override;
void enable_integrity(uint32_t lcid, srslte_direction_t direction) override;
void enable_encryption(uint32_t lcid, srslte_direction_t direction) override;
void enable_security_timed(uint32_t lcid, srslte_direction_t direction, uint32_t sn);
bool get_bearer_state(uint32_t lcid, srslte::pdcp_lte_state_t* state);
bool set_bearer_state(uint32_t lcid, const srslte::pdcp_lte_state_t& state);
2017-05-18 03:52:29 -07:00
// RLC interface
void write_pdu(uint32_t lcid, unique_byte_buffer_t sdu) override;
void write_pdu_mch(uint32_t lcid, unique_byte_buffer_t sdu) override;
void write_pdu_bcch_bch(unique_byte_buffer_t sdu) override;
void write_pdu_bcch_dlsch(unique_byte_buffer_t sdu) override;
void write_pdu_pcch(unique_byte_buffer_t sdu) override;
2018-07-17 06:27:04 -07:00
2017-05-18 03:52:29 -07:00
private:
2020-07-08 14:06:15 -07:00
srsue::rlc_interface_pdcp* rlc = nullptr;
srsue::rrc_interface_pdcp* rrc = nullptr;
srsue::gw_interface_pdcp* gw = nullptr;
srslte::task_sched_handle task_sched;
srslte::log_ref pdcp_log;
2020-04-09 10:37:22 -07:00
2020-06-16 04:08:34 -07:00
std::map<uint16_t, std::unique_ptr<pdcp_entity_base> > pdcp_array, pdcp_array_mrb;
2018-07-16 12:17:01 -07:00
// cache valid lcids to be checked from separate thread
std::mutex cache_mutex;
std::set<uint32_t> valid_lcids_cached;
2017-05-18 03:52:29 -07:00
bool valid_lcid(uint32_t lcid);
bool valid_mch_lcid(uint32_t lcid);
2017-05-18 03:52:29 -07:00
};
2018-03-31 10:04:04 -07:00
} // namespace srslte
#endif // SRSLTE_PDCP_H