rlc_am: tiny refactor of rlc_amd_pdu_header_t

mainly turning header into proper class and adding default init value
master
Andre Puschmann 5 years ago
parent 8756d14660
commit 1eaa99530f

@ -108,30 +108,11 @@ typedef struct {
} rlc_um_nr_pdu_header_t; } rlc_um_nr_pdu_header_t;
// AMD PDU Header // AMD PDU Header
struct rlc_amd_pdu_header_t { class 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; public:
rf = 0; rlc_amd_pdu_header_t() {}
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;
}
rlc_amd_pdu_header_t(const rlc_amd_pdu_header_t& h) { copy(h); } 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) 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]; 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) // NACK helper (for LTE and NR)

@ -797,15 +797,10 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt
return 0; return 0;
#endif #endif
} }
rlc_amd_pdu_header_t header; rlc_amd_pdu_header_t header = {};
header.dc = RLC_DC_FIELD_DATA_PDU; header.dc = RLC_DC_FIELD_DATA_PDU;
header.rf = 0;
header.p = 0;
header.fi = RLC_FI_FIELD_START_AND_END_ALIGNED; header.fi = RLC_FI_FIELD_START_AND_END_ALIGNED;
header.sn = vt_s; 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 head_len = rlc_am_packed_length(&header);
uint32_t to_move = 0; uint32_t to_move = 0;

Loading…
Cancel
Save