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 
23 #include "ns3/header.h"
24 #include "ns3/lte-rlc-sequence-number.h"
25 
26 #include <list>
27 
28 namespace ns3
29 {
30 
39 class LteRlcAmHeader : public Header
40 {
41  public:
48  ~LteRlcAmHeader() override;
49 
51  void SetDataPdu();
57  void SetControlPdu(uint8_t controlPduType);
62  bool IsDataPdu() const;
67  bool IsControlPdu() const;
68 
71  {
73  DATA_PDU = 1
74  };
75 
78  {
79  STATUS_PDU = 000,
80  };
81 
82  //
83  // DATA PDU
84  //
85 
91  void SetSequenceNumber(SequenceNumber10 sequenceNumber);
98 
104  void SetFramingInfo(uint8_t framingInfo);
110  uint8_t GetFramingInfo() const;
111 
114  {
115  FIRST_BYTE = 0x00,
116  NO_FIRST_BYTE = 0x02
117  };
118 
121  {
122  LAST_BYTE = 0x00,
123  NO_LAST_BYTE = 0x01
124  };
125 
131  void PushExtensionBit(uint8_t extensionBit);
137  void PushLengthIndicator(uint16_t lengthIndicator);
138 
144  uint8_t PopExtensionBit();
150  uint16_t PopLengthIndicator();
151 
154  {
157  };
158 
164  void SetResegmentationFlag(uint8_t resegFlag);
170  uint8_t GetResegmentationFlag() const;
171 
174  {
175  PDU = 0,
176  SEGMENT = 1
177  };
178 
184  void SetPollingBit(uint8_t pollingBit);
190  uint8_t GetPollingBit() const;
191 
194  {
197  };
198 
204  void SetLastSegmentFlag(uint8_t lsf);
210  uint8_t GetLastSegmentFlag() const;
211 
214  {
216  LAST_PDU_SEGMENT = 1
217  };
218 
224  void SetSegmentOffset(uint16_t segmentOffset);
230  uint16_t GetSegmentOffset() const;
236  uint16_t GetLastOffset() const;
237 
238  //
239  // CONTROL PDU
240  //
241 
247  void SetAckSn(SequenceNumber10 ackSn);
253  SequenceNumber10 GetAckSn() const;
254 
259  static TypeId GetTypeId();
260  TypeId GetInstanceTypeId() const override;
261  void Print(std::ostream& os) const override;
262  uint32_t GetSerializedSize() const override;
263  void Serialize(Buffer::Iterator start) const override;
264  uint32_t Deserialize(Buffer::Iterator start) override;
265 
273  bool OneMoreNackWouldFitIn(uint16_t bytes);
274 
280  void PushNack(int nack);
281 
289  bool IsNackPresent(SequenceNumber10 nack);
290 
297  int PopNack();
298 
299  private:
300  uint16_t m_headerLength;
302 
303  // Data PDU fields
305  uint8_t m_pollingBit;
306  uint8_t m_framingInfo;
309  uint16_t m_segmentOffset;
310  uint16_t m_lastOffset;
311 
312  std::list<uint8_t> m_extensionBits;
313  std::list<uint16_t> m_lengthIndicators;
314 
315  // Control PDU fields
317 
318  // Status PDU fields
320  std::list<int> m_nackSnList;
321 
322  std::list<uint8_t> m_extensionBits1;
323  std::list<uint8_t> m_extensionBits2;
324 };
325 
326 }; // namespace ns3
327 
328 #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.
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
ControPduType_t
ControlPduType_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.
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:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.