Loading...
Searching...
No Matches
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#include <stdint.h>
34
35namespace ns3
36{
37
53{
54 public:
59
70 SatGenericStreamEncapsulatorArq(Mac48Address encapAddress,
71 Mac48Address decapAddress,
72 Mac48Address sourceE2EAddress,
73 Mac48Address destE2EAddress,
74 uint8_t flowId,
75 uint32_t additionalHeaderSize = 0);
76
85 virtual void NotifyConstructionCompleted() override;
86
91
96 static TypeId GetTypeId(void);
97
101 virtual void DoDispose();
102
110 virtual Ptr<Packet> NotifyTxOpportunity(uint32_t bytes,
111 uint32_t& bytesLeft,
112 uint32_t& nextMinTxO);
113
120 virtual void ReceivePdu(Ptr<Packet> p);
121
126 virtual void ReceiveAck(Ptr<SatArqAckMessage> ack);
127
132 virtual uint32_t GetTxBufferSizeInBytes() const;
133
134 private:
140 void ArqReTxTimerExpired(uint8_t seqNo);
141
146 void CleanUp(uint8_t sequenceNumber);
147
154 uint32_t ConvertSeqNo(uint8_t seqNo) const;
155
160
165 void RxWaitingTimerExpired(uint32_t sn);
166
171 void SendAck(uint8_t seqNo) const;
172
176 Ptr<SatArqSequenceNumber> m_seqNo;
177
181 std::map<uint8_t, Ptr<SatArqBufferContext>> m_txedBuffer; // Transmitted packets buffer
182 std::map<uint8_t, Ptr<SatArqBufferContext>> m_retxBuffer; // Retransmission buffer
185
190
196
202
207
212
217
222 std::map<uint32_t, Ptr<SatArqBufferContext>> m_reorderingBuffer;
223};
224
225} // namespace ns3
226
227#endif // SATELLITE_GENERIC_STREAM_ENCAPSULATOR_ARQ
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 NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
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()
Default constructor, not used.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.