A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-rlc-am.h
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_H
22 #define LTE_RLC_AM_H
23 
24 #include <ns3/event-id.h>
25 #include <ns3/lte-rlc-sequence-number.h>
26 #include <ns3/lte-rlc.h>
27 
28 #include <vector>
29 #include <map>
30 
31 namespace ns3 {
32 
36 class LteRlcAm : public LteRlc
37 {
38 public:
39  LteRlcAm ();
40  virtual ~LteRlcAm ();
41  static TypeId GetTypeId (void);
42  virtual void DoDispose ();
43 
47  virtual void DoTransmitPdcpPdu (Ptr<Packet> p);
48 
52  virtual void DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId);
53  virtual void DoNotifyHarqDeliveryFailure ();
54  virtual void DoReceivePdu (Ptr<Packet> p);
55 
56 private:
62  void ExpireReorderingTimer (void);
63  void ExpirePollRetransmitTimer (void);
64 
65  bool IsInsideReceivingWindow (SequenceNumber10 seqNumber);
66 //
67 // void ReassembleOutsideWindow (void);
68 // void ReassembleSnLessThan (uint16_t seqNumber);
69 //
70  void ReassembleAndDeliver (Ptr<Packet> packet);
71 
72  void DoReportBufferStatus ();
73 
74 private:
75  std::vector < Ptr<Packet> > m_txonBuffer; // Transmission buffer
76  std::vector < Ptr<Packet> > m_txedBuffer; // Transmitted packets buffer
77 
78  struct RetxBuffer
79  {
80  Ptr<Packet> m_pdu;
81  uint16_t m_retxCount;
82  };
83 
84  std::vector < RetxBuffer > m_retxBuffer; // Retransmission buffer
85 
86  uint32_t m_txonBufferSize;
87  uint32_t m_retxBufferSize;
88  uint32_t m_txedBufferSize;
89 
90  bool m_statusPduRequested;
91  uint32_t m_statusPduBufferSize;
92 
93  struct PduBuffer
94  {
95  SequenceNumber10 m_seqNumber;
96  std::list < Ptr<Packet> > m_byteSegments;
97 
98  bool m_pduComplete;
99  uint16_t m_totalSize;
100  uint16_t m_currSize;
101  };
102 
103  std::map <uint16_t, PduBuffer > m_rxonBuffer; // Reception buffer
104 
105  Ptr<Packet> m_controlPduBuffer; // Control PDU buffer (just one PDU)
106 
107  // SDU reassembly
108 // std::vector < Ptr<Packet> > m_reasBuffer; // Reassembling buffer
109 //
110  std::list < Ptr<Packet> > m_sdusBuffer; // List of SDUs in a packet (PDU)
111 
115  // Transmitting side
117  SequenceNumber10 m_vtMs; // VT(MS)
118  SequenceNumber10 m_vtS; // VT(S)
119  SequenceNumber10 m_pollSn; // POLL_SN
120 
121  // Receiving side
122  SequenceNumber10 m_vrR; // VR(R)
123  SequenceNumber10 m_vrMr; // VR(MR)
124  SequenceNumber10 m_vrX; // VR(X)
125  SequenceNumber10 m_vrMs; // VR(MS)
126  SequenceNumber10 m_vrH; // VR(H)
127 
132  uint32_t m_byteWithoutPoll;
133 
137  uint16_t m_windowSize;
138 
143  Time m_pollRetransmitTimerValue;
144  EventId m_reorderingTimer;
145  EventId m_statusProhibitTimer;
146 
150  uint16_t m_maxRetxThreshold; // TODO How these parameters are configured???
151  uint16_t m_pollPdu;
152  uint16_t m_pollByte;
153 
157  typedef enum { NONE = 0,
158  WAITING_S0_FULL = 1,
159  WAITING_SI_SF = 2 } ReassemblingState_t;
160  ReassemblingState_t m_reassemblingState;
161  Ptr<Packet> m_keepS0;
162 
167 
168 };
169 
170 
171 } // namespace ns3
172 
173 #endif // LTE_RLC_AM_H
keep track of time unit.
Definition: nstime.h:149
virtual void DoNotifyTxOpportunity(uint32_t bytes, uint8_t layer, uint8_t harqId)
Definition: lte-rlc-am.cc:159
EventId m_pollRetransmitTimer
Definition: lte-rlc-am.h:142
SequenceNumber10 m_expectedSeqNumber
Definition: lte-rlc-am.h:166
uint32_t m_pduWithoutPoll
Definition: lte-rlc-am.h:131
uint16_t m_maxRetxThreshold
Definition: lte-rlc-am.h:150
an identifier for simulation events.
Definition: event-id.h:46
virtual void DoDispose()
Definition: lte-rlc-am.cc:101
SequenceNumber10 m_vtA
Definition: lte-rlc-am.h:116
void ReassembleAndDeliver(Ptr< Packet > packet)
Definition: lte-rlc-am.cc:1056
uint16_t m_windowSize
Definition: lte-rlc-am.h:137
a unique identifier for an interface.
Definition: type-id.h:44
void ExpireReorderingTimer(void)
Definition: lte-rlc-am.cc:1594
virtual void DoTransmitPdcpPdu(Ptr< Packet > p)
Definition: lte-rlc-am.cc:128