srsLTE/srsenb/hdr/stack/upper/pdcp.h

117 lines
4.0 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-06-02 03:46:06 -07:00
*
* This file is part of srsLTE.
*
2019-04-26 12:27:38 -07:00
* srsLTE is free software: you can redistribute it and/or modify
2017-06-02 03:46:06 -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-06-02 03:46:06 -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/.
*
*/
2017-06-01 03:25:57 -07:00
#include "srslte/common/timers.h"
2017-06-01 03:25:57 -07:00
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
2017-06-01 03:25:57 -07:00
#include "srslte/upper/pdcp.h"
#include <map>
2017-06-01 03:25:57 -07:00
2018-03-31 10:04:04 -07:00
#ifndef SRSENB_PDCP_H
#define SRSENB_PDCP_H
2017-06-01 03:25:57 -07:00
namespace srsenb {
class pdcp : public pdcp_interface_rlc, public pdcp_interface_gtpu, public pdcp_interface_rrc
2017-06-01 03:25:57 -07:00
{
public:
2020-07-08 14:06:15 -07:00
pdcp(srslte::task_sched_handle task_sched_, const char* logname);
virtual ~pdcp() {}
void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_);
2019-11-18 10:07:14 -08:00
void stop();
2017-06-01 03:25:57 -07:00
// pdcp_interface_rlc
void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) override;
2019-05-13 07:34:15 -07:00
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t sdu) {}
2017-06-01 03:25:57 -07:00
// pdcp_interface_rrc
void reset(uint16_t rnti) override;
void add_user(uint16_t rnti) override;
void rem_user(uint16_t rnti) override;
void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) override;
void add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cnfg) override;
void del_bearer(uint16_t rnti, uint32_t lcid) override;
void config_security(uint16_t rnti, uint32_t lcid, srslte::as_security_config_t cfg_sec) override;
void enable_integrity(uint16_t rnti, uint32_t lcid) override;
void enable_encryption(uint16_t rnti, uint32_t lcid) override;
bool get_bearer_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state) override;
bool set_bearer_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state) override;
2019-07-23 08:12:01 -07:00
private:
2017-06-01 03:25:57 -07:00
class user_interface_rlc : public srsue::rlc_interface_pdcp
{
public:
2019-07-23 08:12:01 -07:00
uint16_t rnti;
srsenb::rlc_interface_pdcp* rlc;
2017-06-01 03:25:57 -07:00
// rlc_interface_pdcp
2019-05-13 07:34:15 -07:00
void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking);
void discard_sdu(uint32_t lcid, uint32_t discard_sn);
2017-11-23 10:46:34 -08:00
bool rb_is_um(uint32_t lcid);
};
2019-07-23 08:12:01 -07:00
2017-06-01 03:25:57 -07:00
class user_interface_gtpu : public srsue::gw_interface_pdcp
{
2019-07-23 08:12:01 -07:00
public:
uint16_t rnti;
srsenb::gtpu_interface_pdcp* gtpu;
2017-06-01 03:25:57 -07:00
// gw_interface_pdcp
2019-05-13 07:34:15 -07:00
void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t sdu) {}
2019-07-23 08:12:01 -07:00
};
2017-06-01 03:25:57 -07:00
class user_interface_rrc : public srsue::rrc_interface_pdcp
{
2019-07-23 08:12:01 -07:00
public:
uint16_t rnti;
srsenb::rrc_interface_pdcp* rrc;
2017-06-01 03:25:57 -07:00
// rrc_interface_pdcp
2019-05-13 07:34:15 -07:00
void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
void write_pdu_bcch_bch(srslte::unique_byte_buffer_t pdu);
void write_pdu_bcch_dlsch(srslte::unique_byte_buffer_t pdu);
void write_pdu_pcch(srslte::unique_byte_buffer_t pdu);
void write_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu) {}
std::string get_rb_name(uint32_t lcid);
2017-06-01 03:25:57 -07:00
};
2019-07-23 08:12:01 -07:00
class user_interface
2017-06-01 03:25:57 -07:00
{
2019-07-23 08:12:01 -07:00
public:
user_interface_rlc rlc_itf;
2017-06-01 03:25:57 -07:00
user_interface_gtpu gtpu_itf;
2019-07-23 08:12:01 -07:00
user_interface_rrc rrc_itf;
srslte::pdcp* pdcp;
};
2019-07-23 08:12:01 -07:00
void clear_user(user_interface* ue);
std::map<uint32_t, user_interface> users;
2020-07-08 14:06:15 -07:00
rlc_interface_pdcp* rlc;
rrc_interface_pdcp* rrc;
gtpu_interface_pdcp* gtpu;
srslte::task_sched_handle task_sched;
srslte::log_ref log_h;
srslte::byte_buffer_pool* pool;
2019-07-23 08:12:01 -07:00
};
2017-06-01 03:25:57 -07:00
2019-07-23 08:12:01 -07:00
} // namespace srsenb
2018-03-31 10:04:04 -07:00
#endif // SRSENB_PDCP_H