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 
34 namespace ns3
35 {
36 
53 {
54  public:
59 
70  SatReturnLinkEncapsulatorArq(Mac48Address encapAddress,
71  Mac48Address decapAddress,
72  Mac48Address sourceE2EAddress,
73  Mac48Address destE2EAddress,
74  uint8_t rcIndex,
75  uint32_t additionalHeaderSize = 0);
76 
81 
86  static TypeId GetTypeId(void);
87  TypeId GetInstanceTypeId(void) const;
88 
92  virtual void DoDispose();
93 
101  virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
102  uint32_t& bytesLeft,
103  uint32_t& nextMinTxO);
104 
111  virtual void ReceivePdu(Ptr<Packet> p);
112 
117  virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
118 
123  virtual uint32_t GetTxBufferSizeInBytes() const;
124 
125  private:
131  void ArqReTxTimerExpired(uint8_t seqNo);
132 
137  void CleanUp(uint8_t sequenceNumber);
138 
145  uint32_t ConvertSeqNo(uint8_t seqNo) const;
146 
150  void ReassembleAndReceive();
151 
156  void RxWaitingTimerExpired(uint32_t sn);
157 
162  void SendAck(uint8_t seqNo) const;
163 
167  Ptr<SatArqSequenceNumber> m_seqNo;
168 
172  std::map<uint8_t, Ptr<SatArqBufferContext>> m_txedBuffer; // Transmitted packets buffer
173  std::map<uint8_t, Ptr<SatArqBufferContext>> m_retxBuffer; // Retransmission buffer
176 
181 
186 
192 
197  uint32_t m_arqWindowSize;
198 
202  uint32_t m_arqHeaderSize;
203 
208 
213 
218  std::map<uint32_t, Ptr<SatArqBufferContext>> m_reorderingBuffer;
219 };
220 
221 } // namespace ns3
222 
223 #endif // SATELLITE_RETURN_LINK_ENCAPSULATOR_ARQ
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.