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
40class LteRlcAmHeader : public Header
41{
42 public:
49 ~LteRlcAmHeader() override;
50
52 void SetDataPdu();
58 void SetControlPdu(uint8_t controlPduType);
63 bool IsDataPdu() const;
68 bool IsControlPdu() const;
69
72 {
74 DATA_PDU = 1
75 };
76
78 static constexpr uint8_t STATUS_PDU{0};
79
80 //
81 // DATA PDU
82 //
83
89 void SetSequenceNumber(SequenceNumber10 sequenceNumber);
96
102 void SetFramingInfo(uint8_t framingInfo);
108 uint8_t GetFramingInfo() const;
109
112 {
114 NO_FIRST_BYTE = 0x02
115 };
116
119 {
120 LAST_BYTE = 0x00,
121 NO_LAST_BYTE = 0x01
122 };
123
129 void PushExtensionBit(uint8_t extensionBit);
135 void PushLengthIndicator(uint16_t lengthIndicator);
136
142 uint8_t PopExtensionBit();
148 uint16_t PopLengthIndicator();
149
152 {
155 };
156
162 void SetResegmentationFlag(uint8_t resegFlag);
168 uint8_t GetResegmentationFlag() const;
169
172 {
173 PDU = 0,
174 SEGMENT = 1
175 };
176
182 void SetPollingBit(uint8_t pollingBit);
188 uint8_t GetPollingBit() const;
189
192 {
195 };
196
202 void SetLastSegmentFlag(uint8_t lsf);
208 uint8_t GetLastSegmentFlag() const;
209
212 {
215 };
216
222 void SetSegmentOffset(uint16_t segmentOffset);
228 uint16_t GetSegmentOffset() const;
234 uint16_t GetLastOffset() const;
235
236 //
237 // CONTROL PDU
238 //
239
245 void SetAckSn(SequenceNumber10 ackSn);
252
257 static TypeId GetTypeId();
258 TypeId GetInstanceTypeId() const override;
259 void Print(std::ostream& os) const override;
260 uint32_t GetSerializedSize() const override;
261 void Serialize(Buffer::Iterator start) const override;
262 uint32_t Deserialize(Buffer::Iterator start) override;
263
271 bool OneMoreNackWouldFitIn(uint16_t bytes);
272
278 void PushNack(int nack);
279
288
295 int PopNack();
296
297 private:
298 uint16_t m_headerLength;
300
301 // Data PDU fields
303 uint8_t m_pollingBit;
308 uint16_t m_lastOffset;
309
310 std::list<uint8_t> m_extensionBits;
311 std::list<uint16_t> m_lengthIndicators;
312
313 // Control PDU fields
315
316 // Status PDU fields
318 std::list<int> m_nackSnList;
319
320 std::list<uint8_t> m_extensionBits1;
321 std::list<uint8_t> m_extensionBits2;
322};
323
324}; // namespace ns3
325
326#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
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.
FramingInfoLastByte_t
FramingInfoLastByte_t enumeration.
void SetControlPdu(uint8_t controlPduType)
Set control PDU function.
FramingInfoFirstByte_t
FramingInfoFirstByte_t enumeration.
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.