satellite-generic-stream-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_GENERIC_STREAM_ENCAPSULATOR_ARQ
22 #define SATELLITE_GENERIC_STREAM_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 
52 {
53  public:
58 
69  SatGenericStreamEncapsulatorArq(Mac48Address encapAddress,
70  Mac48Address decapAddress,
71  Mac48Address sourceE2EAddress,
72  Mac48Address destE2EAddress,
73  uint8_t flowId,
74  uint32_t additionalHeaderSize = 0);
75 
80 
85  static TypeId GetTypeId(void);
86  TypeId GetInstanceTypeId(void) const;
87 
91  virtual void DoDispose();
92 
100  virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
101  uint32_t& bytesLeft,
102  uint32_t& nextMinTxO);
103 
110  virtual void ReceivePdu(Ptr<Packet> p);
111 
116  virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
117 
122  virtual uint32_t GetTxBufferSizeInBytes() const;
123 
124  private:
130  void ArqReTxTimerExpired(uint8_t seqNo);
131 
136  void CleanUp(uint8_t sequenceNumber);
137 
144  uint32_t ConvertSeqNo(uint8_t seqNo) const;
145 
149  void ReassembleAndReceive();
150 
155  void RxWaitingTimerExpired(uint32_t sn);
156 
161  void SendAck(uint8_t seqNo) const;
162 
166  Ptr<SatArqSequenceNumber> m_seqNo;
167 
171  std::map<uint8_t, Ptr<SatArqBufferContext>> m_txedBuffer; // Transmitted packets buffer
172  std::map<uint8_t, Ptr<SatArqBufferContext>> m_retxBuffer; // Retransmission buffer
175 
180 
186 
191  uint32_t m_arqWindowSize;
192 
196  uint32_t m_arqHeaderSize;
197 
202 
207 
212  std::map<uint32_t, Ptr<SatArqBufferContext>> m_reorderingBuffer;
213 };
214 
215 } // namespace ns3
216 
217 #endif // SATELLITE_GENERIC_STREAM_ENCAPSULATOR_ARQ
SatGenericStreamEncapsulatorArq class is inherited from the SatGenericStreamEncapsulator class,...
void ArqReTxTimerExpired(uint8_t seqNo)
ARQ Tx timer has expired.
Time m_rxWaitingTimer
Waiting time for waiting a certain SN to be received.
uint32_t m_maxNoOfRetransmissions
Maximum number of retransmissions.
virtual void ReceivePdu(Ptr< Packet > p)
Receive a packet, thus decapsulate and defragment/deconcatenate if needed.
uint32_t m_nextExpectedSeqNo
Next expected sequence number at the packet reception.
virtual void ReceiveAck(Ptr< SatArqAckMessage > ack)
Receive a control message (ARQ ACK)
virtual ~SatGenericStreamEncapsulatorArq()
Destructor for SatGenericStreamEncapsulatorArq.
void RxWaitingTimerExpired(uint32_t sn)
Rx waiting timer for a PDU has expired.
std::map< uint32_t, Ptr< SatArqBufferContext > > m_reorderingBuffer
key = sequence number value = GSE packet
std::map< uint8_t, Ptr< SatArqBufferContext > > m_txedBuffer
Transmitted and retransmission context buffer.
void ReassembleAndReceive()
Reassemble and receive the received PDUs if possible.
void CleanUp(uint8_t sequenceNumber)
Clean-up a certain sequence number.
uint32_t ConvertSeqNo(uint8_t seqNo) const
Convert the 8-bit sequence number value from ARQ header into 32-bit continuous sequence number stream...
void SendAck(uint8_t seqNo) const
Send ACK for a given sequence number.
virtual void DoDispose()
Dispose of this class instance.
virtual uint32_t GetTxBufferSizeInBytes() const
Get the buffered packets for this encapsulator.
std::map< uint8_t, Ptr< SatArqBufferContext > > m_retxBuffer
Ptr< SatArqSequenceNumber > m_seqNo
Sequence number handler.
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Notify a Tx opportunity to this encapsulator.
SatGenericStreamEncapsulator class is used in the FWD link for GSE encapsulation and fragmentation of...
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.