A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-rlc-am-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Manuel Requena <manuel.requena@cttc.es>
7 */
8
9#ifndef LTE_RLC_AM_HEADER_H
10#define LTE_RLC_AM_HEADER_H
11
13
14#include "ns3/header.h"
15
16#include <list>
17
18namespace ns3
19{
20
21/**
22 * \ingroup lte
23 * \brief The packet header for the AM Radio Link Control (RLC) protocol packets
24 *
25 * This class has fields corresponding to those in an RLC header as well as
26 * methods for serialization to and deserialization from a byte buffer.
27 * It follows 3GPP TS 36.322 Radio Link Control (RLC) protocol specification.
28 */
29class LteRlcAmHeader : public Header
30{
31 public:
32 /**
33 * \brief Constructor
34 *
35 * Creates a null header
36 */
38 ~LteRlcAmHeader() override;
39
40 /// Set data PDU function
41 void SetDataPdu();
42 /**
43 * Set control PDU function
44 *
45 * \param controlPduType
46 */
47 void SetControlPdu(uint8_t controlPduType);
48 /**
49 * Is data PDU function
50 * \returns true if data PDU
51 */
52 bool IsDataPdu() const;
53 /**
54 * Is control PDU function
55 * \returns true if control PDU
56 */
57 bool IsControlPdu() const;
58
59 /// DataControlPdu_t enumeration
65
66 /// Control PDU type status
67 static constexpr uint8_t STATUS_PDU{0};
68
69 //
70 // DATA PDU
71 //
72
73 /**
74 * Set sequence number
75 *
76 * \param sequenceNumber sequence number
77 */
78 void SetSequenceNumber(SequenceNumber10 sequenceNumber);
79 /**
80 * Get sequence number
81 *
82 * \returns sequence number
83 */
85
86 /**
87 * Set sequence number
88 *
89 * \param framingInfo framing info
90 */
91 void SetFramingInfo(uint8_t framingInfo);
92 /**
93 * Get framing info
94 *
95 * \returns framing info
96 */
97 uint8_t GetFramingInfo() const;
98
99 /// FramingInfoByte_t enumeration
101 {
104 LAST_BYTE = 0x00,
105 NO_LAST_BYTE = 0x01
106 };
107
108 /**
109 * Push extension bit function
110 *
111 * \param extensionBit the extension bit
112 */
113 void PushExtensionBit(uint8_t extensionBit);
114 /**
115 * Push length indicator function
116 *
117 * \param lengthIndicator the length indicator
118 */
119 void PushLengthIndicator(uint16_t lengthIndicator);
120
121 /**
122 * Pop extension bit function
123 *
124 * \returns the extension bit
125 */
126 uint8_t PopExtensionBit();
127 /**
128 * Pop length indicator function
129 *
130 * \returns the length indicator
131 */
132 uint16_t PopLengthIndicator();
133
134 /// ExtensionBit_t typedef
140
141 /**
142 * Pop extension bit function
143 *
144 * \param resegFlag resegmentation flag
145 */
146 void SetResegmentationFlag(uint8_t resegFlag);
147 /**
148 * Get resegmentation flag function
149 *
150 * \returns resegmentation flag
151 */
152 uint8_t GetResegmentationFlag() const;
153
154 /// ResegmentationFlag_t typedef
156 {
157 PDU = 0,
158 SEGMENT = 1
159 };
160
161 /**
162 * Set polling bit function
163 *
164 * \param pollingBit polling bit
165 */
166 void SetPollingBit(uint8_t pollingBit);
167 /**
168 * Get polling bit function
169 *
170 * \returns polling bit
171 */
172 uint8_t GetPollingBit() const;
173
174 /// PollingBit_t enumeration
180
181 /**
182 * Set last segment flag function
183 *
184 * \param lsf last segment flag
185 */
186 void SetLastSegmentFlag(uint8_t lsf);
187 /**
188 * Get last segment flag function
189 *
190 * \returns last segment flag
191 */
192 uint8_t GetLastSegmentFlag() const;
193
194 /// LastSegmentFlag_t typedef
200
201 /**
202 * Set segment offset function
203 *
204 * \param segmentOffset segment offset
205 */
206 void SetSegmentOffset(uint16_t segmentOffset);
207 /**
208 * Get segment offset function
209 *
210 * \returns segment offset
211 */
212 uint16_t GetSegmentOffset() const;
213 /**
214 * Get last offset function
215 *
216 * \returns last offset
217 */
218 uint16_t GetLastOffset() const;
219
220 //
221 // CONTROL PDU
222 //
223
224 /**
225 * Set ack sn function
226 *
227 * \param ackSn ack sn
228 */
229 void SetAckSn(SequenceNumber10 ackSn);
230 /**
231 * Get ack sn function
232 *
233 * \returns sequence number
234 */
236
237 /**
238 * \brief Get the type ID.
239 * \return the object TypeId
240 */
241 static TypeId GetTypeId();
242 TypeId GetInstanceTypeId() const override;
243 void Print(std::ostream& os) const override;
244 uint32_t GetSerializedSize() const override;
245 void Serialize(Buffer::Iterator start) const override;
246 uint32_t Deserialize(Buffer::Iterator start) override;
247
248 /**
249 *
250 *
251 * \param bytes max allowed CONTROL PDU size
252 *
253 * \return true if one more NACK would fit in the CONTROL PDU; false otherwise
254 */
255 bool OneMoreNackWouldFitIn(uint16_t bytes);
256
257 /**
258 * Add one more NACK to the CONTROL PDU
259 *
260 * \param nack
261 */
262 void PushNack(int nack);
263
264 /**
265 *
266 *
267 * \param nack SN of the NACK
268 *
269 * \return true if the NACK is present in the STATUS PDU, false otherwise
270 */
272
273 /**
274 * Retrieve one NACK from the CONTROL PDU
275 *
276 *
277 * \return the SN >= 0 of the next nack; returns -1 if no NACK is left
278 */
279 int PopNack();
280
281 private:
282 uint16_t m_headerLength; ///< header length
283 uint8_t m_dataControlBit; ///< data control bit
284
285 // Data PDU fields
286 uint8_t m_resegmentationFlag; ///< resegmentation flag
287 uint8_t m_pollingBit; ///< polling bit
288 uint8_t m_framingInfo; ///< 2 bits
289 SequenceNumber10 m_sequenceNumber; ///< sequence number
290 uint8_t m_lastSegmentFlag; ///< last segment flag
291 uint16_t m_segmentOffset; ///< segment offset
292 uint16_t m_lastOffset; ///< last offset
293
294 std::list<uint8_t> m_extensionBits; ///< Includes extensionBit of the fixed part
295 std::list<uint16_t> m_lengthIndicators; ///< length indicators
296
297 // Control PDU fields
298 uint8_t m_controlPduType; ///< control PDU type
299
300 // Status PDU fields
302 std::list<int> m_nackSnList; ///< nack sn list
303
304 std::list<uint8_t> m_extensionBits1; ///< Includes E1 after ACK_SN
305 std::list<uint8_t> m_extensionBits2; ///< extension bits 2
306};
307
308}; // namespace ns3
309
310#endif // LTE_RLC_AM_HEADER_H
iterator in a Buffer instance
Definition buffer.h:89
Protocol header serialization and deserialization.
Definition header.h:33
The packet header for the AM Radio Link Control (RLC) protocol packets.
uint8_t GetPollingBit() const
Get polling bit function.
LastSegmentFlag_t
LastSegmentFlag_t typedef.
PollingBit_t
PollingBit_t enumeration.
uint8_t PopExtensionBit()
Pop extension bit function.
void SetSegmentOffset(uint16_t segmentOffset)
Set segment offset function.
void PushExtensionBit(uint8_t extensionBit)
Push extension bit function.
uint32_t Deserialize(Buffer::Iterator start) override
bool IsDataPdu() const
Is data PDU function.
SequenceNumber10 GetAckSn() const
Get ack sn function.
void SetPollingBit(uint8_t pollingBit)
Set polling bit function.
bool OneMoreNackWouldFitIn(uint16_t bytes)
uint32_t GetSerializedSize() const override
uint16_t m_headerLength
header length
void SetLastSegmentFlag(uint8_t lsf)
Set last segment flag function.
void Print(std::ostream &os) const override
ExtensionBit_t
ExtensionBit_t typedef.
uint16_t GetLastOffset() const
Get last offset function.
SequenceNumber10 m_sequenceNumber
sequence number
uint16_t m_lastOffset
last offset
LteRlcAmHeader()
Constructor.
void PushNack(int nack)
Add one more NACK to the CONTROL PDU.
uint8_t m_dataControlBit
data control bit
std::list< uint8_t > m_extensionBits
Includes extensionBit of the fixed part.
void SetFramingInfo(uint8_t framingInfo)
Set sequence number.
static constexpr uint8_t STATUS_PDU
Control PDU type status.
DataControlPdu_t
DataControlPdu_t enumeration.
uint8_t GetLastSegmentFlag() const
Get last segment flag function.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(Buffer::Iterator start) const override
FramingInfoByte_t
FramingInfoByte_t enumeration.
SequenceNumber10 m_ackSn
ack sn
uint16_t PopLengthIndicator()
Pop length indicator function.
uint8_t m_controlPduType
control PDU type
ResegmentationFlag_t
ResegmentationFlag_t typedef.
uint16_t m_segmentOffset
segment offset
std::list< uint8_t > m_extensionBits2
extension bits 2
void SetAckSn(SequenceNumber10 ackSn)
Set ack sn function.
std::list< uint8_t > m_extensionBits1
Includes E1 after ACK_SN.
bool IsControlPdu() const
Is control PDU function.
void SetDataPdu()
Set data PDU function.
uint8_t m_framingInfo
2 bits
uint8_t m_resegmentationFlag
resegmentation flag
void PushLengthIndicator(uint16_t lengthIndicator)
Push length indicator function.
uint8_t GetResegmentationFlag() const
Get resegmentation flag function.
void SetResegmentationFlag(uint8_t resegFlag)
Pop extension bit function.
uint16_t GetSegmentOffset() const
Get segment offset function.
uint8_t m_pollingBit
polling bit
static TypeId GetTypeId()
Get the type ID.
uint8_t m_lastSegmentFlag
last segment flag
bool IsNackPresent(SequenceNumber10 nack)
std::list< int > m_nackSnList
nack sn list
uint8_t GetFramingInfo() const
Get framing info.
SequenceNumber10 GetSequenceNumber() const
Get sequence number.
int PopNack()
Retrieve one NACK from the CONTROL PDU.
void SetControlPdu(uint8_t controlPduType)
Set control PDU function.
std::list< uint16_t > m_lengthIndicators
length indicators
void SetSequenceNumber(SequenceNumber10 sequenceNumber)
Set sequence number.
SequenceNumber10 class.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.