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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Manuel Requena <manuel.requena@cttc.es>
18 */
19
20#ifndef LTE_RLC_AM_HEADER_H
21#define LTE_RLC_AM_HEADER_H
22
24
25#include "ns3/header.h"
26
27#include <list>
28
29namespace ns3
30{
31
32/**
33 * \ingroup lte
34 * \brief The packet header for the AM Radio Link Control (RLC) protocol packets
35 *
36 * This class has fields corresponding to those in an RLC header as well as
37 * methods for serialization to and deserialization from a byte buffer.
38 * It follows 3GPP TS 36.322 Radio Link Control (RLC) protocol specification.
39 */
40class LteRlcAmHeader : public Header
41{
42 public:
43 /**
44 * \brief Constructor
45 *
46 * Creates a null header
47 */
49 ~LteRlcAmHeader() override;
50
51 /// Set data PDU function
52 void SetDataPdu();
53 /**
54 * Set control PDU function
55 *
56 * \param controlPduType
57 */
58 void SetControlPdu(uint8_t controlPduType);
59 /**
60 * Is data PDU function
61 * \returns true if data PDU
62 */
63 bool IsDataPdu() const;
64 /**
65 * Is control PDU function
66 * \returns true if control PDU
67 */
68 bool IsControlPdu() const;
69
70 /// DataControlPdu_t enumeration
72 {
74 DATA_PDU = 1
75 };
76
77 /// Control PDU type status
78 static constexpr uint8_t STATUS_PDU{0};
79
80 //
81 // DATA PDU
82 //
83
84 /**
85 * Set sequence number
86 *
87 * \param sequenceNumber sequence number
88 */
89 void SetSequenceNumber(SequenceNumber10 sequenceNumber);
90 /**
91 * Get sequence number
92 *
93 * \returns sequence number
94 */
96
97 /**
98 * Set sequence number
99 *
100 * \param framingInfo framing info
101 */
102 void SetFramingInfo(uint8_t framingInfo);
103 /**
104 * Get framing info
105 *
106 * \returns framing info
107 */
108 uint8_t GetFramingInfo() const;
109
110 /// FramingInfoByte_t enumeration
112 {
115 LAST_BYTE = 0x00,
116 NO_LAST_BYTE = 0x01
117 };
118
119 /**
120 * Push extension bit function
121 *
122 * \param extensionBit the extension bit
123 */
124 void PushExtensionBit(uint8_t extensionBit);
125 /**
126 * Push length indicator function
127 *
128 * \param lengthIndicator the length indicator
129 */
130 void PushLengthIndicator(uint16_t lengthIndicator);
131
132 /**
133 * Pop extension bit function
134 *
135 * \returns the extension bit
136 */
137 uint8_t PopExtensionBit();
138 /**
139 * Pop length indicator function
140 *
141 * \returns the length indicator
142 */
143 uint16_t PopLengthIndicator();
144
145 /// ExtensionBit_t typedef
147 {
150 };
151
152 /**
153 * Pop extension bit function
154 *
155 * \param resegFlag resegmentation flag
156 */
157 void SetResegmentationFlag(uint8_t resegFlag);
158 /**
159 * Get resegmentation flag function
160 *
161 * \returns resegmentation flag
162 */
163 uint8_t GetResegmentationFlag() const;
164
165 /// ResegmentationFlag_t typedef
167 {
168 PDU = 0,
169 SEGMENT = 1
170 };
171
172 /**
173 * Set polling bit function
174 *
175 * \param pollingBit polling bit
176 */
177 void SetPollingBit(uint8_t pollingBit);
178 /**
179 * Get polling bit function
180 *
181 * \returns polling bit
182 */
183 uint8_t GetPollingBit() const;
184
185 /// PollingBit_t enumeration
187 {
190 };
191
192 /**
193 * Set last segment flag function
194 *
195 * \param lsf last segment flag
196 */
197 void SetLastSegmentFlag(uint8_t lsf);
198 /**
199 * Get last segment flag function
200 *
201 * \returns last segment flag
202 */
203 uint8_t GetLastSegmentFlag() const;
204
205 /// LastSegmentFlag_t typedef
207 {
210 };
211
212 /**
213 * Set segment offset function
214 *
215 * \param segmentOffset segment offset
216 */
217 void SetSegmentOffset(uint16_t segmentOffset);
218 /**
219 * Get segment offset function
220 *
221 * \returns segment offset
222 */
223 uint16_t GetSegmentOffset() const;
224 /**
225 * Get last offset function
226 *
227 * \returns last offset
228 */
229 uint16_t GetLastOffset() const;
230
231 //
232 // CONTROL PDU
233 //
234
235 /**
236 * Set ack sn function
237 *
238 * \param ackSn ack sn
239 */
240 void SetAckSn(SequenceNumber10 ackSn);
241 /**
242 * Get ack sn function
243 *
244 * \returns sequence number
245 */
247
248 /**
249 * \brief Get the type ID.
250 * \return the object TypeId
251 */
252 static TypeId GetTypeId();
253 TypeId GetInstanceTypeId() const override;
254 void Print(std::ostream& os) const override;
255 uint32_t GetSerializedSize() const override;
256 void Serialize(Buffer::Iterator start) const override;
257 uint32_t Deserialize(Buffer::Iterator start) override;
258
259 /**
260 *
261 *
262 * \param bytes max allowed CONTROL PDU size
263 *
264 * \return true if one more NACK would fit in the CONTROL PDU; false otherwise
265 */
266 bool OneMoreNackWouldFitIn(uint16_t bytes);
267
268 /**
269 * Add one more NACK to the CONTROL PDU
270 *
271 * \param nack
272 */
273 void PushNack(int nack);
274
275 /**
276 *
277 *
278 * \param nack SN of the NACK
279 *
280 * \return true if the NACK is present in the STATUS PDU, false otherwise
281 */
283
284 /**
285 * Retrieve one NACK from the CONTROL PDU
286 *
287 *
288 * \return the SN >= 0 of the next nack; returns -1 if no NACK is left
289 */
290 int PopNack();
291
292 private:
293 uint16_t m_headerLength; ///< header length
294 uint8_t m_dataControlBit; ///< data control bit
295
296 // Data PDU fields
297 uint8_t m_resegmentationFlag; ///< resegmentation flag
298 uint8_t m_pollingBit; ///< polling bit
299 uint8_t m_framingInfo; ///< 2 bits
300 SequenceNumber10 m_sequenceNumber; ///< sequence number
301 uint8_t m_lastSegmentFlag; ///< last segment flag
302 uint16_t m_segmentOffset; ///< segment offset
303 uint16_t m_lastOffset; ///< last offset
304
305 std::list<uint8_t> m_extensionBits; ///< Includes extensionBit of the fixed part
306 std::list<uint16_t> m_lengthIndicators; ///< length indicators
307
308 // Control PDU fields
309 uint8_t m_controlPduType; ///< control PDU type
310
311 // Status PDU fields
313 std::list<int> m_nackSnList; ///< nack sn list
314
315 std::list<uint8_t> m_extensionBits1; ///< Includes E1 after ACK_SN
316 std::list<uint8_t> m_extensionBits2; ///< extension bits 2
317};
318
319}; // namespace ns3
320
321#endif // LTE_RLC_AM_HEADER_H
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
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:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.