A Discrete-Event Network Simulator
API
lte-rlc-am-header.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Manuel Requena <manuel.requena@cttc.es>
19  */
20 
21 #ifndef LTE_RLC_AM_HEADER_H
22 #define LTE_RLC_AM_HEADER_H
23 
24 #include "ns3/header.h"
25 #include "ns3/lte-rlc-sequence-number.h"
26 
27 #include <list>
28 
29 namespace ns3 {
30 
39 class LteRlcAmHeader : public Header
40 {
41 public:
42 
48  LteRlcAmHeader ();
49  ~LteRlcAmHeader ();
50 
52  void SetDataPdu (void);
58  void SetControlPdu (uint8_t controlPduType);
63  bool IsDataPdu (void) const;
68  bool IsControlPdu (void) const;
69 
71  typedef enum {
75 
77  typedef enum {
78  STATUS_PDU = 000,
79  } ControPduType_t;
80 
81  //
82  // DATA PDU
83  //
84 
90  void SetSequenceNumber (SequenceNumber10 sequenceNumber);
97 
103  void SetFramingInfo (uint8_t framingInfo);
109  uint8_t GetFramingInfo () const;
110 
112  typedef enum {
113  FIRST_BYTE = 0x00,
116 
118  typedef enum {
119  LAST_BYTE = 0x00,
122 
128  void PushExtensionBit (uint8_t extensionBit);
134  void PushLengthIndicator (uint16_t lengthIndicator);
135 
141  uint8_t PopExtensionBit (void);
147  uint16_t PopLengthIndicator (void);
148 
150  typedef enum {
153  } ExtensionBit_t;
154 
160  void SetResegmentationFlag (uint8_t resegFlag);
166  uint8_t GetResegmentationFlag () const;
167 
169  typedef enum {
170  PDU = 0,
173 
179  void SetPollingBit (uint8_t pollingBit);
185  uint8_t GetPollingBit () const;
186 
188  typedef enum {
191  } PollingBit_t;
192 
198  void SetLastSegmentFlag (uint8_t lsf);
204  uint8_t GetLastSegmentFlag () const;
205 
207  typedef enum {
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 
248 
253  static TypeId GetTypeId (void);
254  virtual TypeId GetInstanceTypeId (void) const;
255  virtual void Print (std::ostream &os) const;
256  virtual uint32_t GetSerializedSize (void) const;
257  virtual void Serialize (Buffer::Iterator start) const;
258  virtual uint32_t Deserialize (Buffer::Iterator start);
259 
267  bool OneMoreNackWouldFitIn (uint16_t bytes);
268 
274  void PushNack (int nack);
275 
283  bool IsNackPresent (SequenceNumber10 nack);
284 
285 
292  int PopNack (void);
293 
294 
295 private:
296  uint16_t m_headerLength;
298 
299  // Data PDU fields
301  uint8_t m_pollingBit;
302  uint8_t m_framingInfo;
305  uint16_t m_segmentOffset;
306  uint16_t m_lastOffset;
307 
308  std::list <uint8_t> m_extensionBits;
309  std::list <uint16_t> m_lengthIndicators;
310 
311  // Control PDU fields
313 
314  // Status PDU fields
316  std::list <int> m_nackSnList;
317 
318  std::list <uint8_t> m_extensionBits1;
319  std::list <uint8_t> m_extensionBits2;
320 
321 };
322 
323 }; // namespace ns3
324 
325 #endif // LTE_RLC_AM_HEADER_H
uint8_t PopExtensionBit(void)
Pop extension bit function.
uint8_t GetLastSegmentFlag() const
Get last segment flag function.
Protocol header serialization and deserialization.
Definition: header.h:42
uint8_t m_controlPduType
control PDU type
std::list< uint8_t > m_extensionBits2
extension bits 2
uint16_t m_headerLength
header length
void SetResegmentationFlag(uint8_t resegFlag)
Pop extension bit function.
std::list< uint8_t > m_extensionBits
Includes extensionBit of the fixed part.
uint8_t m_dataControlBit
data control bit
def start()
Definition: core.py:1855
void SetSequenceNumber(SequenceNumber10 sequenceNumber)
Set sequence number.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetDataPdu(void)
Set data PDU function.
void SetPollingBit(uint8_t pollingBit)
Set polling bit function.
uint8_t m_lastSegmentFlag
last segment flag
FramingInfoLastByte_t
FramingInfoLastByte_t enumeration.
std::list< uint16_t > m_lengthIndicators
length indicators
virtual uint32_t GetSerializedSize(void) const
iterator in a Buffer instance
Definition: buffer.h:98
SequenceNumber10 GetSequenceNumber() const
Get sequence number.
uint8_t m_pollingBit
polling bit
PollingBit_t
PollingBit_t enumeration.
bool IsNackPresent(SequenceNumber10 nack)
void PushNack(int nack)
Add one more NACK to the CONTROL PDU.
uint8_t m_framingInfo
2 bits
void SetFramingInfo(uint8_t framingInfo)
Set sequence number.
bool IsControlPdu(void) const
Is control PDU function.
std::list< int > m_nackSnList
nack sn list
void SetSegmentOffset(uint16_t segmentOffset)
Set segment offset function.
uint8_t m_resegmentationFlag
resegmentation flag
virtual void Print(std::ostream &os) const
SequenceNumber10 m_sequenceNumber
sequence number
void PushLengthIndicator(uint16_t lengthIndicator)
Push length indicator function.
void SetControlPdu(uint8_t controlPduType)
Set control PDU function.
The packet header for the AM Radio Link Control (RLC) protocol packets.
SequenceNumber10 m_ackSn
ack sn
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t Deserialize(Buffer::Iterator start)
uint8_t GetResegmentationFlag() const
Get resegmentation flag function.
bool IsDataPdu(void) const
Is data PDU function.
uint8_t GetFramingInfo() const
Get framing info.
uint8_t GetPollingBit() const
Get polling bit function.
ResegmentationFlag_t
ResegmentationFlag_t typedef.
LastSegmentFlag_t
LastSegmentFlag_t typedef.
static TypeId GetTypeId(void)
Get the type ID.
std::list< uint8_t > m_extensionBits1
Includes E1 after ACK_SN.
SequenceNumber10 GetAckSn() const
Get ack sn function.
DataControlPdu_t
DataControlPdu_t enumeration.
uint16_t GetLastOffset() const
Get last offset function.
uint16_t m_lastOffset
last offset
uint16_t PopLengthIndicator(void)
Pop length indicator function.
bool OneMoreNackWouldFitIn(uint16_t bytes)
FramingInfoFirstByte_t
FramingInfoFirstByte_t enumeration.
int PopNack(void)
Retrieve one NACK from the CONTROL PDU.
ExtensionBit_t
ExtensionBit_t typedef.
SequenceNumber10 class.
void SetAckSn(SequenceNumber10 ackSn)
Set ack sn function.
uint16_t GetSegmentOffset() const
Get segment offset function.
void SetLastSegmentFlag(uint8_t lsf)
Set last segment flag function.
void PushExtensionBit(uint8_t extensionBit)
Push extension bit function.
uint16_t m_segmentOffset
segment offset
virtual void Serialize(Buffer::Iterator start) const
a unique identifier for an interface.
Definition: type-id.h:58
LteRlcAmHeader()
Constructor.
ControPduType_t
ControlPduType_t enumeration.