diff --git a/lib/include/srslte/upper/rlc_common.h b/lib/include/srslte/upper/rlc_common.h index 52e22b2f2..2c873a112 100644 --- a/lib/include/srslte/upper/rlc_common.h +++ b/lib/include/srslte/upper/rlc_common.h @@ -108,30 +108,11 @@ typedef struct { } rlc_um_nr_pdu_header_t; // AMD PDU Header -struct rlc_amd_pdu_header_t { - rlc_dc_field_t dc; // Data or control - uint8_t rf; // Resegmentation flag - uint8_t p; // Polling bit - uint8_t fi; // Framing info - uint16_t sn; // Sequence number - uint8_t lsf; // Last segment flag - uint16_t so; // Segment offset - uint32_t N_li; // Number of length indicators - uint16_t li[RLC_AM_WINDOW_SIZE]; // Array of length indicators - - rlc_amd_pdu_header_t() - { - dc = RLC_DC_FIELD_CONTROL_PDU; - rf = 0; - p = 0; - fi = 0; - sn = 0; - lsf = 0; - so = 0; - N_li = 0; - for (int i = 0; i < RLC_AM_WINDOW_SIZE; i++) - li[i] = 0; - } +class rlc_amd_pdu_header_t +{ +public: + rlc_amd_pdu_header_t() {} + rlc_amd_pdu_header_t(const rlc_amd_pdu_header_t& h) { copy(h); } rlc_amd_pdu_header_t& operator=(const rlc_amd_pdu_header_t& h) { @@ -152,6 +133,16 @@ struct rlc_amd_pdu_header_t { li[i] = h.li[i]; } } + + rlc_dc_field_t dc = RLC_DC_FIELD_CONTROL_PDU; // Data or control + uint8_t rf = 0; // Resegmentation flag + uint8_t p = 0; // Polling bit + uint8_t fi = RLC_FI_FIELD_START_AND_END_ALIGNED; // Framing info + uint16_t sn = 0; // Sequence number + uint8_t lsf = 0; // Last segment flag + uint16_t so = 0; // Segment offset + uint32_t N_li = 0; // Number of length indicators + uint16_t li[RLC_AM_WINDOW_SIZE] = {0}; // Array of length indicators }; // NACK helper (for LTE and NR) diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 7097afbd9..121ea4a43 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -797,15 +797,10 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt return 0; #endif } - rlc_amd_pdu_header_t header; + rlc_amd_pdu_header_t header = {}; header.dc = RLC_DC_FIELD_DATA_PDU; - header.rf = 0; - header.p = 0; header.fi = RLC_FI_FIELD_START_AND_END_ALIGNED; header.sn = vt_s; - header.lsf = 0; - header.so = 0; - header.N_li = 0; uint32_t head_len = rlc_am_packed_length(&header); uint32_t to_move = 0;