mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
489 lines
13 KiB
C
489 lines
13 KiB
C
4 years ago
|
/**
|
||
8 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
8 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
8 years ago
|
*
|
||
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_PDU_H
|
||
|
#define SRSRAN_PDU_H
|
||
8 years ago
|
|
||
4 years ago
|
#include "srsran/common/interfaces_common.h"
|
||
|
#include "srsran/srslog/srslog.h"
|
||
4 years ago
|
#include <sstream>
|
||
6 years ago
|
#include <stdint.h>
|
||
8 years ago
|
#include <stdio.h>
|
||
6 years ago
|
#include <vector>
|
||
8 years ago
|
|
||
6 years ago
|
/* MAC PDU Packing/Unpacking functions. Section 6 of 36.321 */
|
||
7 years ago
|
class subh;
|
||
8 years ago
|
|
||
4 years ago
|
namespace srsran {
|
||
6 years ago
|
|
||
4 years ago
|
#define CE_SUBHEADER_LEN (1)
|
||
|
|
||
5 years ago
|
/* 3GPP 36.321 Table 6.2.1-1 */
|
||
|
enum class dl_sch_lcid {
|
||
5 years ago
|
CCCH = 0b00000,
|
||
|
RESERVED = 0b10001,
|
||
5 years ago
|
//...
|
||
|
SCELL_ACTIVATION_4_OCTET = 0b11000,
|
||
|
SCELL_ACTIVATION = 0b11011,
|
||
|
CON_RES_ID = 0b11100,
|
||
|
TA_CMD = 0b11101,
|
||
|
DRX_CMD = 0b11110,
|
||
|
PADDING = 0b11111
|
||
|
};
|
||
5 years ago
|
const char* to_string(dl_sch_lcid v);
|
||
4 years ago
|
const char* to_string_short(dl_sch_lcid v);
|
||
5 years ago
|
uint32_t ce_size(dl_sch_lcid v);
|
||
|
uint32_t ce_subheader_size(dl_sch_lcid v);
|
||
|
uint32_t ce_total_size(dl_sch_lcid v);
|
||
|
constexpr bool is_mac_ce(dl_sch_lcid v)
|
||
5 years ago
|
{
|
||
|
return v > dl_sch_lcid::RESERVED;
|
||
|
}
|
||
5 years ago
|
constexpr bool is_sdu(dl_sch_lcid v)
|
||
|
{
|
||
|
return v <= dl_sch_lcid::RESERVED;
|
||
|
}
|
||
5 years ago
|
|
||
|
/* 3GPP 36.321 Table 6.2.1-2 */
|
||
|
enum class ul_sch_lcid {
|
||
|
CCCH = 0b00000,
|
||
|
RESERVED = 0b10001,
|
||
|
//...
|
||
|
PHR_REPORT_EXT = 0b11001,
|
||
|
PHR_REPORT = 0b11010,
|
||
|
CRNTI = 0b11011,
|
||
|
TRUNC_BSR = 0b11100,
|
||
|
SHORT_BSR = 0b11101,
|
||
|
LONG_BSR = 0b11110,
|
||
|
PADDING = 0b11111
|
||
|
};
|
||
5 years ago
|
const char* to_string(ul_sch_lcid v);
|
||
|
uint32_t ce_size(ul_sch_lcid v);
|
||
|
constexpr bool is_mac_ce(ul_sch_lcid v)
|
||
5 years ago
|
{
|
||
5 years ago
|
return v > ul_sch_lcid::RESERVED;
|
||
|
}
|
||
|
constexpr bool is_sdu(ul_sch_lcid v)
|
||
|
{
|
||
|
return v <= ul_sch_lcid::RESERVED;
|
||
5 years ago
|
}
|
||
|
|
||
|
/* 3GPP 36.321 Table 6.2.1-4 */
|
||
|
enum class mch_lcid {
|
||
|
MCCH = 0b00000,
|
||
|
//...
|
||
|
MTCH_MAX_LCID = 0b11100,
|
||
|
MCH_SCHED_INFO = 0b11110,
|
||
|
PADDING = 0b11111
|
||
|
};
|
||
5 years ago
|
const char* to_string(mch_lcid v);
|
||
|
constexpr bool is_mac_ce(mch_lcid v)
|
||
|
{
|
||
|
return v >= mch_lcid::MCH_SCHED_INFO;
|
||
|
}
|
||
|
constexpr bool is_sdu(mch_lcid v)
|
||
|
{
|
||
|
return v < mch_lcid::MCH_SCHED_INFO;
|
||
|
}
|
||
5 years ago
|
|
||
|
/* Common LCID type */
|
||
|
struct lcid_t {
|
||
5 years ago
|
enum class ch_type { dl_sch, ul_sch, mch } type;
|
||
5 years ago
|
union {
|
||
|
uint32_t lcid;
|
||
|
dl_sch_lcid dl_sch;
|
||
|
ul_sch_lcid ul_sch;
|
||
|
mch_lcid mch;
|
||
|
};
|
||
5 years ago
|
lcid_t(ch_type t, uint32_t lcid_) : type(t), lcid(lcid_) {}
|
||
|
lcid_t(dl_sch_lcid lcid_) : type(ch_type::dl_sch), dl_sch(lcid_) {}
|
||
|
lcid_t(ul_sch_lcid lcid_) : type(ch_type::ul_sch), ul_sch(lcid_) {}
|
||
|
lcid_t(mch_lcid lcid_) : type(ch_type::mch), mch(lcid_) {}
|
||
5 years ago
|
const char* to_string() const;
|
||
5 years ago
|
bool is_sch() const { return type == ch_type::dl_sch or type == ch_type::ul_sch; }
|
||
|
bool is_sdu() const;
|
||
|
bool operator==(lcid_t t) const { return type == t.type and lcid == t.lcid; }
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
6 years ago
|
template <class SubH>
|
||
8 years ago
|
class pdu
|
||
|
{
|
||
|
public:
|
||
4 years ago
|
pdu(uint32_t max_subheaders_, srslog::basic_logger& logger) :
|
||
6 years ago
|
max_subheaders(max_subheaders_),
|
||
|
subheaders(max_subheaders_),
|
||
4 years ago
|
logger(logger),
|
||
6 years ago
|
nof_subheaders(0),
|
||
|
cur_idx(-1),
|
||
|
pdu_len(0),
|
||
|
rem_len(0),
|
||
|
last_sdu_idx(-1),
|
||
|
pdu_is_ul(false),
|
||
6 years ago
|
buffer_tx(nullptr)
|
||
5 years ago
|
{}
|
||
5 years ago
|
virtual ~pdu() = default;
|
||
6 years ago
|
|
||
4 years ago
|
void to_string(fmt::memory_buffer& buffer)
|
||
6 years ago
|
{
|
||
|
for (int i = 0; i < nof_subheaders; i++) {
|
||
4 years ago
|
fmt::format_to(buffer, " ");
|
||
4 years ago
|
subheaders[i].to_string(buffer);
|
||
8 years ago
|
}
|
||
|
}
|
||
6 years ago
|
|
||
8 years ago
|
/* Resets the Read/Write position and remaining PDU length */
|
||
6 years ago
|
void reset()
|
||
|
{
|
||
|
cur_idx = -1;
|
||
|
last_sdu_idx = -1;
|
||
|
rem_len = pdu_len;
|
||
8 years ago
|
}
|
||
|
|
||
6 years ago
|
void init_rx(uint32_t pdu_len_bytes, bool is_ulsch = false) { init_(NULL, pdu_len_bytes, is_ulsch); }
|
||
8 years ago
|
|
||
6 years ago
|
void init_tx(byte_buffer_t* buffer, uint32_t pdu_len_bytes, bool is_ulsch = false)
|
||
6 years ago
|
{
|
||
6 years ago
|
init_(buffer, pdu_len_bytes, is_ulsch);
|
||
8 years ago
|
}
|
||
|
|
||
6 years ago
|
uint32_t nof_subh() { return nof_subheaders; }
|
||
|
|
||
|
bool new_subh()
|
||
|
{
|
||
5 years ago
|
if (nof_subheaders < (int)max_subheaders - 1 &&
|
||
|
rem_len >= 2 /* Even a MAC CE with one byte (e.g. PHR) needs a 1 Byte subheader */
|
||
|
&& buffer_tx->get_headroom() > 1) {
|
||
8 years ago
|
nof_subheaders++;
|
||
6 years ago
|
return next();
|
||
8 years ago
|
} else {
|
||
6 years ago
|
return false;
|
||
8 years ago
|
}
|
||
|
}
|
||
|
|
||
6 years ago
|
bool next()
|
||
|
{
|
||
8 years ago
|
if (cur_idx < nof_subheaders - 1) {
|
||
|
cur_idx++;
|
||
6 years ago
|
return true;
|
||
8 years ago
|
} else {
|
||
6 years ago
|
return false;
|
||
8 years ago
|
}
|
||
|
}
|
||
6 years ago
|
|
||
4 years ago
|
int get_current_idx() { return cur_idx; }
|
||
|
|
||
6 years ago
|
void del_subh()
|
||
|
{
|
||
8 years ago
|
if (nof_subheaders > 0) {
|
||
|
nof_subheaders--;
|
||
|
}
|
||
6 years ago
|
if (cur_idx >= 0) {
|
||
4 years ago
|
subheaders[cur_idx].init();
|
||
8 years ago
|
cur_idx--;
|
||
|
}
|
||
|
}
|
||
|
|
||
6 years ago
|
SubH* get()
|
||
|
{
|
||
8 years ago
|
if (cur_idx >= 0) {
|
||
|
return &subheaders[cur_idx];
|
||
|
} else {
|
||
6 years ago
|
return nullptr;
|
||
8 years ago
|
}
|
||
|
}
|
||
6 years ago
|
|
||
4 years ago
|
// Get subheader at specified index
|
||
|
SubH* get(uint32_t idx)
|
||
|
{
|
||
4 years ago
|
if (nof_subheaders > 0 && idx < (uint32_t)nof_subheaders) {
|
||
4 years ago
|
return &subheaders[idx];
|
||
|
} else {
|
||
|
return nullptr;
|
||
|
}
|
||
|
}
|
||
|
|
||
6 years ago
|
bool is_ul() { return pdu_is_ul; }
|
||
|
|
||
6 years ago
|
uint8_t* get_current_sdu_ptr() { return &buffer_tx->msg[buffer_tx->N_bytes]; }
|
||
6 years ago
|
|
||
5 years ago
|
void add_sdu(uint32_t sdu_sz) { buffer_tx->N_bytes += sdu_sz; }
|
||
8 years ago
|
|
||
|
// Section 6.1.2
|
||
4 years ago
|
uint32_t parse_packet(uint8_t* ptr)
|
||
6 years ago
|
{
|
||
|
uint8_t* init_ptr = ptr;
|
||
|
nof_subheaders = 0;
|
||
|
bool ret = false;
|
||
7 years ago
|
do {
|
||
7 years ago
|
if (nof_subheaders < (int)max_subheaders) {
|
||
7 years ago
|
ret = subheaders[nof_subheaders].read_subheader(&ptr);
|
||
7 years ago
|
nof_subheaders++;
|
||
7 years ago
|
}
|
||
5 years ago
|
|
||
5 years ago
|
if (ret && ((ptr - init_ptr) >= (int32_t)pdu_len)) {
|
||
4 years ago
|
// stop processing last subheader indicates another one but all bytes are consumed
|
||
5 years ago
|
nof_subheaders = 0;
|
||
4 years ago
|
logger.warning(init_ptr, pdu_len, "Corrupted MAC PDU - all bytes have been consumed (pdu_len=%d)", pdu_len);
|
||
4 years ago
|
return SRSRAN_ERROR;
|
||
5 years ago
|
}
|
||
5 years ago
|
} while (ret && (nof_subheaders + 1) < (int)max_subheaders && ((int32_t)pdu_len > (ptr - init_ptr)));
|
||
7 years ago
|
|
||
6 years ago
|
for (int i = 0; i < nof_subheaders; i++) {
|
||
8 years ago
|
subheaders[i].read_payload(&ptr);
|
||
4 years ago
|
|
||
|
// stop processing if we read payload beyond the PDU length
|
||
|
if ((ptr - init_ptr) > (int32_t)pdu_len) {
|
||
|
nof_subheaders = 0;
|
||
4 years ago
|
logger.warning(init_ptr, pdu_len, "Corrupted MAC PDU - all bytes have been consumed (pdu_len=%d)", pdu_len);
|
||
4 years ago
|
return SRSRAN_ERROR;
|
||
4 years ago
|
}
|
||
8 years ago
|
}
|
||
4 years ago
|
return SRSRAN_SUCCESS;
|
||
8 years ago
|
}
|
||
|
|
||
6 years ago
|
protected:
|
||
4 years ago
|
std::vector<SubH> subheaders;
|
||
|
uint32_t pdu_len;
|
||
|
uint32_t rem_len;
|
||
|
int cur_idx;
|
||
|
int nof_subheaders;
|
||
|
uint32_t max_subheaders;
|
||
|
bool pdu_is_ul;
|
||
|
byte_buffer_t* buffer_tx = nullptr;
|
||
|
int last_sdu_idx;
|
||
|
srslog::basic_logger& logger;
|
||
6 years ago
|
|
||
8 years ago
|
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */
|
||
6 years ago
|
virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch)
|
||
6 years ago
|
{
|
||
5 years ago
|
nof_subheaders = 0;
|
||
|
pdu_len = pdu_len_bytes;
|
||
|
rem_len = pdu_len;
|
||
|
pdu_is_ul = is_ulsch;
|
||
|
buffer_tx = buffer_tx_;
|
||
|
last_sdu_idx = -1;
|
||
8 years ago
|
reset();
|
||
6 years ago
|
for (uint32_t i = 0; i < max_subheaders; i++) {
|
||
|
subheaders[i].parent = this;
|
||
8 years ago
|
subheaders[i].init();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
6 years ago
|
typedef enum { SCH_SUBH_TYPE = 0, MCH_SUBH_TYPE = 1 } subh_type;
|
||
7 years ago
|
|
||
6 years ago
|
template <class SubH>
|
||
8 years ago
|
class subh
|
||
|
{
|
||
7 years ago
|
public:
|
||
6 years ago
|
virtual ~subh() {}
|
||
|
|
||
4 years ago
|
virtual bool read_subheader(uint8_t** ptr) = 0;
|
||
|
virtual void read_payload(uint8_t** ptr) = 0;
|
||
|
virtual void write_subheader(uint8_t** ptr, bool is_last) = 0;
|
||
|
virtual void write_payload(uint8_t** ptr) = 0;
|
||
|
virtual void to_string(fmt::memory_buffer& buffer) = 0;
|
||
6 years ago
|
|
||
5 years ago
|
pdu<SubH>* parent = nullptr;
|
||
6 years ago
|
|
||
7 years ago
|
private:
|
||
8 years ago
|
virtual void init() = 0;
|
||
|
};
|
||
|
|
||
|
class sch_subh : public subh<sch_subh>
|
||
|
{
|
||
7 years ago
|
public:
|
||
6 years ago
|
sch_subh(subh_type type_ = SCH_SUBH_TYPE) : type(type_) {}
|
||
7 years ago
|
|
||
6 years ago
|
virtual ~sch_subh() {}
|
||
6 years ago
|
|
||
8 years ago
|
// Size of MAC CEs
|
||
5 years ago
|
const static int MAC_CE_CONTRES_LEN = 6;
|
||
|
const static uint32_t MTCH_STOP_EMPTY = 0b11111111111;
|
||
|
const static uint32_t SDU = 0b00000;
|
||
8 years ago
|
|
||
|
// Reading functions
|
||
5 years ago
|
bool is_sdu();
|
||
|
bool is_var_len_ce();
|
||
|
uint32_t lcid_value() { return lcid; }
|
||
|
ul_sch_lcid ul_sch_ce_type();
|
||
|
dl_sch_lcid dl_sch_ce_type();
|
||
|
mch_lcid mch_ce_type();
|
||
|
uint32_t size_plus_header();
|
||
|
void set_payload_size(uint32_t size);
|
||
7 years ago
|
|
||
|
bool read_subheader(uint8_t** ptr);
|
||
6 years ago
|
void read_payload(uint8_t** ptr);
|
||
7 years ago
|
|
||
8 years ago
|
uint32_t get_sdu_lcid();
|
||
7 years ago
|
uint32_t get_payload_size();
|
||
8 years ago
|
uint32_t get_header_size(bool is_last);
|
||
|
uint8_t* get_sdu_ptr();
|
||
6 years ago
|
|
||
8 years ago
|
uint16_t get_c_rnti();
|
||
|
uint64_t get_con_res_id();
|
||
|
uint8_t get_ta_cmd();
|
||
6 years ago
|
uint8_t get_activation_deactivation_cmd();
|
||
8 years ago
|
float get_phr();
|
||
4 years ago
|
uint32_t get_bsr(uint32_t buff_size_idx[4], uint32_t buff_size_bytes[4]);
|
||
7 years ago
|
|
||
6 years ago
|
bool get_next_mch_sched_info(uint8_t* lcid, uint16_t* mtch_stop);
|
||
|
|
||
8 years ago
|
// Writing functions
|
||
7 years ago
|
void write_subheader(uint8_t** ptr, bool is_last);
|
||
6 years ago
|
void write_payload(uint8_t** ptr);
|
||
|
|
||
|
int set_sdu(uint32_t lcid, uint32_t nof_bytes, uint8_t* payload);
|
||
|
int set_sdu(uint32_t lcid, uint32_t requested_bytes, read_pdu_interface* sdu_itf);
|
||
|
bool set_c_rnti(uint16_t crnti);
|
||
5 years ago
|
bool set_bsr(uint32_t buff_size[4], ul_sch_lcid format);
|
||
4 years ago
|
void update_bsr(uint32_t buff_size[4], ul_sch_lcid format);
|
||
6 years ago
|
bool set_con_res_id(uint64_t con_res_id);
|
||
|
bool set_ta_cmd(uint8_t ta_cmd);
|
||
4 years ago
|
bool set_scell_activation_cmd(const std::array<bool, SRSRAN_MAX_CARRIERS>& active_scell_idxs);
|
||
6 years ago
|
bool set_phr(float phr);
|
||
|
void set_padding();
|
||
|
void set_padding(uint32_t padding_len);
|
||
6 years ago
|
void set_type(subh_type type_);
|
||
8 years ago
|
|
||
4 years ago
|
void init();
|
||
|
void to_string(fmt::memory_buffer& buffer);
|
||
7 years ago
|
|
||
6 years ago
|
bool set_next_mch_sched_info(uint8_t lcid, uint16_t mtch_stop);
|
||
|
|
||
|
protected:
|
||
7 years ago
|
static const int MAX_CE_PAYLOAD_LEN = 8;
|
||
6 years ago
|
uint32_t lcid = 0;
|
||
|
int nof_bytes = 0;
|
||
4 years ago
|
uint8_t* payload = w_payload_ce; // points to write buffer initially
|
||
6 years ago
|
uint8_t w_payload_ce[64] = {};
|
||
|
uint8_t nof_mch_sched_ce = 0;
|
||
|
uint8_t cur_mch_sched_ce = 0;
|
||
|
bool F_bit = false;
|
||
|
subh_type type = SCH_SUBH_TYPE;
|
||
6 years ago
|
|
||
|
private:
|
||
|
uint32_t sizeof_ce(uint32_t lcid, bool is_ul);
|
||
8 years ago
|
static uint8_t buff_size_table(uint32_t buffer_size);
|
||
|
static uint8_t phr_report_table(float phr_value);
|
||
|
};
|
||
|
|
||
|
class sch_pdu : public pdu<sch_subh>
|
||
|
{
|
||
|
public:
|
||
4 years ago
|
sch_pdu(uint32_t max_subh, srslog::basic_logger& logger) : pdu(max_subh, logger) {}
|
||
7 years ago
|
|
||
6 years ago
|
void parse_packet(uint8_t* ptr);
|
||
|
uint8_t* write_packet();
|
||
4 years ago
|
uint8_t* write_packet(srslog::basic_logger& log);
|
||
6 years ago
|
bool has_space_ce(uint32_t nbytes, bool var_len = false);
|
||
|
bool has_space_sdu(uint32_t nbytes);
|
||
|
int get_pdu_len();
|
||
|
int rem_size();
|
||
|
int get_sdu_space();
|
||
|
|
||
|
static uint32_t size_header_sdu(uint32_t nbytes);
|
||
|
bool update_space_ce(uint32_t nbytes, bool var_len = false);
|
||
|
bool update_space_sdu(uint32_t nbytes);
|
||
4 years ago
|
void to_string(fmt::memory_buffer& buffer);
|
||
8 years ago
|
};
|
||
|
|
||
|
class rar_subh : public subh<rar_subh>
|
||
|
{
|
||
|
public:
|
||
6 years ago
|
typedef enum { BACKOFF = 0, RAPID } rar_subh_type_t;
|
||
|
|
||
6 years ago
|
rar_subh()
|
||
|
{
|
||
7 years ago
|
bzero(&grant, sizeof(grant));
|
||
|
ta = 0;
|
||
|
temp_rnti = 0;
|
||
|
preamble = 0;
|
||
|
parent = NULL;
|
||
6 years ago
|
type = BACKOFF;
|
||
7 years ago
|
}
|
||
8 years ago
|
|
||
6 years ago
|
static const uint32_t RAR_GRANT_LEN = 20;
|
||
|
|
||
8 years ago
|
// Reading functions
|
||
|
bool read_subheader(uint8_t** ptr);
|
||
|
void read_payload(uint8_t** ptr);
|
||
6 years ago
|
bool has_rapid();
|
||
8 years ago
|
uint32_t get_rapid();
|
||
|
uint32_t get_ta_cmd();
|
||
|
uint16_t get_temp_crnti();
|
||
|
void get_sched_grant(uint8_t grant[RAR_GRANT_LEN]);
|
||
6 years ago
|
|
||
8 years ago
|
// Writing functoins
|
||
6 years ago
|
void write_subheader(uint8_t** ptr, bool is_last);
|
||
|
void write_payload(uint8_t** ptr);
|
||
|
void set_rapid(uint32_t rapid);
|
||
|
void set_ta_cmd(uint32_t ta);
|
||
|
void set_temp_crnti(uint16_t temp_rnti);
|
||
|
void set_sched_grant(uint8_t grant[RAR_GRANT_LEN]);
|
||
|
|
||
4 years ago
|
void init();
|
||
|
void to_string(fmt::memory_buffer& buffer);
|
||
6 years ago
|
|
||
|
private:
|
||
|
uint8_t grant[RAR_GRANT_LEN];
|
||
|
uint32_t ta;
|
||
|
uint16_t temp_rnti;
|
||
|
uint32_t preamble;
|
||
6 years ago
|
rar_subh_type_t type;
|
||
8 years ago
|
};
|
||
|
|
||
|
class rar_pdu : public pdu<rar_subh>
|
||
|
{
|
||
|
public:
|
||
4 years ago
|
rar_pdu(uint32_t max_rars = 16, srslog::basic_logger& logger = srslog::fetch_basic_logger("MAC"));
|
||
6 years ago
|
|
||
|
void set_backoff(uint8_t bi);
|
||
|
bool has_backoff();
|
||
|
uint8_t get_backoff();
|
||
|
|
||
4 years ago
|
bool write_packet(uint8_t* ptr);
|
||
|
void to_string(fmt::memory_buffer& buffer);
|
||
8 years ago
|
|
||
7 years ago
|
private:
|
||
6 years ago
|
bool has_backoff_indicator;
|
||
|
uint8_t backoff_indicator;
|
||
8 years ago
|
};
|
||
|
|
||
7 years ago
|
class mch_pdu : public sch_pdu
|
||
|
{
|
||
|
public:
|
||
4 years ago
|
mch_pdu(uint32_t max_subh, srslog::basic_logger& logger) : sch_pdu(max_subh, logger) {}
|
||
7 years ago
|
|
||
6 years ago
|
private:
|
||
7 years ago
|
/* Prepares the PDU for parsing or writing by setting the number of subheaders to 0 and the pdu length */
|
||
6 years ago
|
virtual void init_(byte_buffer_t* buffer_tx_, uint32_t pdu_len_bytes, bool is_ulsch)
|
||
6 years ago
|
{
|
||
5 years ago
|
nof_subheaders = 0;
|
||
|
pdu_len = pdu_len_bytes;
|
||
|
rem_len = pdu_len;
|
||
|
pdu_is_ul = is_ulsch;
|
||
|
buffer_tx = buffer_tx_;
|
||
|
last_sdu_idx = -1;
|
||
7 years ago
|
reset();
|
||
6 years ago
|
for (uint32_t i = 0; i < max_subheaders; i++) {
|
||
6 years ago
|
subheaders[i].set_type(MCH_SUBH_TYPE);
|
||
7 years ago
|
subheaders[i].parent = this;
|
||
|
subheaders[i].init();
|
||
|
}
|
||
|
}
|
||
7 years ago
|
};
|
||
7 years ago
|
|
||
4 years ago
|
} // namespace srsran
|
||
7 years ago
|
|
||
|
#endif // MACPDU_H
|