satellite-return-link-encapsulator-arq.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_RETURN_LINK_ENCAPSULATOR_ARQ
22 #define SATELLITE_RETURN_LINK_ENCAPSULATOR_ARQ
23 
28 
29 #include <ns3/event-id.h>
30 #include <ns3/mac48-address.h>
31 
32 #include <map>
33 #include <stdint.h>
34 
35 namespace ns3
36 {
37 
54 {
55  public:
60 
71  SatReturnLinkEncapsulatorArq(Mac48Address encapAddress,
72  Mac48Address decapAddress,
73  Mac48Address sourceE2EAddress,
74  Mac48Address destE2EAddress,
75  uint8_t rcIndex,
76  uint32_t additionalHeaderSize = 0);
77 
82 
87  static TypeId GetTypeId(void);
88  TypeId GetInstanceTypeId(void) const;
89 
93  virtual void DoDispose();
94 
102  virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
103  uint32_t& bytesLeft,
104  uint32_t& nextMinTxO);
105 
112  virtual void ReceivePdu(Ptr<Packet> p);
113 
118  virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
119 
124  virtual uint32_t GetTxBufferSizeInBytes() const;
125 
126  private:
132  void ArqReTxTimerExpired(uint8_t seqNo);
133 
138  void CleanUp(uint8_t sequenceNumber);
139 
146  uint32_t ConvertSeqNo(uint8_t seqNo) const;
147 
151  void ReassembleAndReceive();
152 
157  void RxWaitingTimerExpired(uint32_t sn);
158 
163  void SendAck(uint8_t seqNo) const;
164 
168  Ptr<SatArqSequenceNumber> m_seqNo;
169 
173  std::map<uint8_t, Ptr<SatArqBufferContext>> m_txedBuffer; // Transmitted packets buffer
174  std::map<uint8_t, Ptr<SatArqBufferContext>> m_retxBuffer; // Retransmission buffer
177 
182 
187 
193 
198  uint32_t m_arqWindowSize;
199 
203  uint32_t m_arqHeaderSize;
204 
209 
214 
219  std::map<uint32_t, Ptr<SatArqBufferContext>> m_reorderingBuffer;
220 };
221 
222 } // namespace ns3
223 
224 #endif // SATELLITE_RETURN_LINK_ENCAPSULATOR_ARQ
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.