A Discrete-Event Network Simulator
API
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 
29 namespace ns3
30 {
31 
40 class 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  {
113  FIRST_BYTE = 0x00,
115  LAST_BYTE = 0x00,
116  NO_LAST_BYTE = 0x01
117  };
118 
124  void PushExtensionBit(uint8_t extensionBit);
130  void PushLengthIndicator(uint16_t lengthIndicator);
131 
137  uint8_t PopExtensionBit();
143  uint16_t PopLengthIndicator();
144 
147  {
150  };
151 
157  void SetResegmentationFlag(uint8_t resegFlag);
163  uint8_t GetResegmentationFlag() const;
164 
167  {
168  PDU = 0,
169  SEGMENT = 1
170  };
171 
177  void SetPollingBit(uint8_t pollingBit);
183  uint8_t GetPollingBit() const;
184 
187  {
190  };
191 
197  void SetLastSegmentFlag(uint8_t lsf);
203  uint8_t GetLastSegmentFlag() const;
204 
207  {
209  LAST_PDU_SEGMENT = 1
210  };
211 
217  void SetSegmentOffset(uint16_t segmentOffset);
223  uint16_t GetSegmentOffset() const;
229  uint16_t GetLastOffset() const;
230 
231  //
232  // CONTROL PDU
233  //
234 
240  void SetAckSn(SequenceNumber10 ackSn);
246  SequenceNumber10 GetAckSn() const;
247 
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 
266  bool OneMoreNackWouldFitIn(uint16_t bytes);
267 
273  void PushNack(int nack);
274 
282  bool IsNackPresent(SequenceNumber10 nack);
283 
290  int PopNack();
291 
292  private:
293  uint16_t m_headerLength;
295 
296  // Data PDU fields
298  uint8_t m_pollingBit;
299  uint8_t m_framingInfo;
302  uint16_t m_segmentOffset;
303  uint16_t m_lastOffset;
304 
305  std::list<uint8_t> m_extensionBits;
306  std::list<uint16_t> m_lengthIndicators;
307 
308  // Control PDU fields
310 
311  // Status PDU fields
313  std::list<int> m_nackSnList;
314 
315  std::list<uint8_t> m_extensionBits1;
316  std::list<uint8_t> m_extensionBits2;
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
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
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.
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.