2019-04-26 12:27:38 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2013-2019 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
|
|
|
|
2017-05-31 14:39:17 -07:00
|
|
|
#include "srslte/common/common.h"
|
2019-07-23 07:49:34 -07:00
|
|
|
#include "srslte/common/log.h"
|
2017-06-01 03:25:42 -07:00
|
|
|
#include "srslte/interfaces/ue_interfaces.h"
|
2019-07-01 10:49:19 -07:00
|
|
|
#include "srslte/upper/pdcp_entity_lte.h"
|
2017-05-18 03:52:29 -07:00
|
|
|
|
2017-06-01 03:25:42 -07:00
|
|
|
namespace srslte {
|
2017-05-18 03:52:29 -07:00
|
|
|
|
2019-06-20 08:33:03 -07:00
|
|
|
class pdcp : public srsue::pdcp_interface_rlc, public srsue::pdcp_interface_rrc
|
2017-05-18 03:52:29 -07:00
|
|
|
{
|
|
|
|
public:
|
2019-11-18 09:32:38 -08:00
|
|
|
pdcp(srslte::timer_handler* timers_, log* log_);
|
2018-07-17 06:27:04 -07:00
|
|
|
virtual ~pdcp();
|
2019-06-27 01:50:47 -07:00
|
|
|
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();
|
|
|
|
|
2017-09-18 05:02:31 -07:00
|
|
|
// GW interface
|
2018-07-25 06:09:19 -07:00
|
|
|
bool is_lcid_enabled(uint32_t lcid);
|
2017-09-18 05:02:31 -07:00
|
|
|
|
2017-05-18 03:52:29 -07:00
|
|
|
// RRC interface
|
2017-11-23 10:46:34 -08:00
|
|
|
void reestablish();
|
2019-07-01 10:49:19 -07:00
|
|
|
void reestablish(uint32_t lcid);
|
2017-05-18 03:52:29 -07:00
|
|
|
void reset();
|
2019-12-29 14:45:37 -08:00
|
|
|
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking);
|
2019-07-01 10:49:19 -07:00
|
|
|
void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
|
2019-07-25 09:31:04 -07:00
|
|
|
void add_bearer(uint32_t lcid, pdcp_config_t cnfg);
|
|
|
|
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);
|
2018-09-17 04:10:44 -07:00
|
|
|
void change_lcid(uint32_t old_lcid, uint32_t new_lcid);
|
2019-07-01 10:49:19 -07:00
|
|
|
void config_security(uint32_t lcid,
|
|
|
|
uint8_t* k_rrc_enc,
|
|
|
|
uint8_t* k_rrc_int,
|
|
|
|
uint8_t* k_up_enc,
|
2017-05-18 03:52:29 -07:00
|
|
|
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
|
|
|
|
INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
|
2019-07-01 10:49:19 -07:00
|
|
|
void config_security_all(uint8_t* k_rrc_enc,
|
|
|
|
uint8_t* k_rrc_int,
|
|
|
|
uint8_t* k_up_enc,
|
2017-12-02 13:43:35 -08:00
|
|
|
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
|
|
|
|
INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
|
2020-03-01 05:51:51 -08:00
|
|
|
void enable_integrity(uint32_t lcid, srslte_direction_t direction);
|
|
|
|
void enable_encryption(uint32_t lcid, srslte_direction_t direction);
|
2019-12-06 11:39:22 -08:00
|
|
|
bool get_bearer_status(uint32_t lcid, uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn);
|
2017-05-18 03:52:29 -07:00
|
|
|
|
|
|
|
// RLC interface
|
2019-05-13 07:34:15 -07:00
|
|
|
void write_pdu(uint32_t lcid, unique_byte_buffer_t sdu);
|
|
|
|
void write_pdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
|
|
|
|
void write_pdu_bcch_bch(unique_byte_buffer_t sdu);
|
|
|
|
void write_pdu_bcch_dlsch(unique_byte_buffer_t sdu);
|
|
|
|
void write_pdu_pcch(unique_byte_buffer_t sdu);
|
2018-07-17 06:27:04 -07:00
|
|
|
|
2017-05-18 03:52:29 -07:00
|
|
|
private:
|
2019-06-20 07:41:14 -07:00
|
|
|
srsue::rlc_interface_pdcp* rlc = nullptr;
|
|
|
|
srsue::rrc_interface_pdcp* rrc = nullptr;
|
|
|
|
srsue::gw_interface_pdcp* gw = nullptr;
|
2017-05-18 03:52:29 -07:00
|
|
|
|
2019-07-23 07:49:34 -07:00
|
|
|
typedef std::map<uint16_t, pdcp_entity_lte*> pdcp_map_t;
|
2019-07-01 10:49:19 -07:00
|
|
|
typedef std::pair<uint16_t, pdcp_entity_lte*> pdcp_map_pair_t;
|
2018-07-16 12:17:01 -07:00
|
|
|
|
2019-11-18 09:32:38 -08:00
|
|
|
srslte::timer_handler* timers = nullptr;
|
|
|
|
log* pdcp_log = nullptr;
|
|
|
|
pdcp_map_t pdcp_array, pdcp_array_mrb;
|
|
|
|
pthread_rwlock_t rwlock;
|
2018-07-16 12:17:01 -07:00
|
|
|
|
2017-05-18 03:52:29 -07:00
|
|
|
bool valid_lcid(uint32_t lcid);
|
2018-05-15 07:57:23 -07:00
|
|
|
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
|