SatGenericStreamEncapsulatorArq class is inherited from the SatGenericStreamEncapsulator class, which is used in FWD link for encapsulation and fragmentation of higher layer packets. More...
#include "satellite-generic-stream-encapsulator-arq.h"
Public Member Functions | |
SatGenericStreamEncapsulatorArq () | |
Default constructor, not used. More... | |
SatGenericStreamEncapsulatorArq (Mac48Address encapAddress, Mac48Address decapAddress, Mac48Address sourceE2EAddress, Mac48Address destE2EAddress, uint8_t flowId, uint32_t additionalHeaderSize=0) | |
Constructor. More... | |
virtual | ~SatGenericStreamEncapsulatorArq () |
Destructor for SatGenericStreamEncapsulatorArq. More... | |
virtual void | DoDispose () |
Dispose of this class instance. More... | |
TypeId | GetInstanceTypeId (void) const |
virtual uint32_t | GetTxBufferSizeInBytes () const |
Get the buffered packets for this encapsulator. More... | |
virtual Ptr< Packet > | NotifyTxOpportunity (uint32_t bytes, uint32_t &bytesLeft, uint32_t &nextMinTxO) |
Notify a Tx opportunity to this encapsulator. More... | |
virtual void | ReceiveAck (Ptr< SatArqAckMessage > ack) |
Receive a control message (ARQ ACK) More... | |
virtual void | ReceivePdu (Ptr< Packet > p) |
Receive a packet, thus decapsulate and defragment/deconcatenate if needed. More... | |
Public Member Functions inherited from ns3::SatGenericStreamEncapsulator | |
SatGenericStreamEncapsulator () | |
Default constructor, not used. More... | |
SatGenericStreamEncapsulator (Mac48Address encapAddress, Mac48Address decapAddress, Mac48Address sourceE2EAddress, Mac48Address destE2EAddress, uint8_t flowId, uint32_t additionalHeaderSize=0) | |
Constructor. More... | |
virtual | ~SatGenericStreamEncapsulator () |
Destructor for SatGenericStreamEncapsulator. More... | |
virtual void | EnquePdu (Ptr< Packet > p, Mac48Address dest) |
Enqueue a Higher Layer packet to txBuffer. More... | |
virtual uint32_t | GetMinTxOpportunityInBytes () const |
Get minimum Tx opportunity in bytes, which takes the assumed header sizes into account. More... | |
Public Member Functions inherited from ns3::SatBaseEncapsulator | |
SatBaseEncapsulator () | |
Default constructor not used. More... | |
SatBaseEncapsulator (Mac48Address encapAddress, Mac48Address decapAddress, Mac48Address sourceE2EAddress, Mac48Address destE2EAddress, uint8_t flowId, uint32_t additionalHeaderSize=0) | |
Constructor. More... | |
virtual | ~SatBaseEncapsulator () |
Destructor for SatBaseEncapsulator. More... | |
virtual Time | GetHolDelay () const |
Get Head-of-Line packet buffering delay. More... | |
Ptr< SatQueue > | GetQueue () |
Get the queue instance. More... | |
void | SetCtrlMsgCallback (SatBaseEncapsulator::SendCtrlCallback cb) |
void | SetQueue (Ptr< SatQueue > queue) |
Set the used queue from outside. More... | |
void | SetReceiveCallback (ReceiveCallback cb) |
Method to set receive callback. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::SatGenericStreamEncapsulator | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::SatBaseEncapsulator | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
void | ArqReTxTimerExpired (uint8_t seqNo) |
ARQ Tx timer has expired. More... | |
void | CleanUp (uint8_t sequenceNumber) |
Clean-up a certain sequence number. More... | |
uint32_t | ConvertSeqNo (uint8_t seqNo) const |
Convert the 8-bit sequence number value from ARQ header into 32-bit continuous sequence number stream at the receiver. More... | |
void | ReassembleAndReceive () |
Reassemble and receive the received PDUs if possible. More... | |
void | RxWaitingTimerExpired (uint32_t sn) |
Rx waiting timer for a PDU has expired. More... | |
void | SendAck (uint8_t seqNo) const |
Send ACK for a given sequence number. More... | |
Private Attributes | |
uint32_t | m_arqHeaderSize |
ARQ header size in Bytes. More... | |
uint32_t | m_arqWindowSize |
ARQ window size, i.e. More... | |
uint32_t | m_maxNoOfRetransmissions |
Maximum number of retransmissions. More... | |
uint32_t | m_nextExpectedSeqNo |
Next expected sequence number at the packet reception. More... | |
std::map< uint32_t, Ptr< SatArqBufferContext > > | m_reorderingBuffer |
key = sequence number value = GSE packet More... | |
Time | m_retransmissionTimer |
Retransmission timer, i.e. More... | |
std::map< uint8_t, Ptr< SatArqBufferContext > > | m_retxBuffer |
uint32_t | m_retxBufferSize |
Time | m_rxWaitingTimer |
Waiting time for waiting a certain SN to be received. More... | |
Ptr< SatArqSequenceNumber > | m_seqNo |
Sequence number handler. More... | |
std::map< uint8_t, Ptr< SatArqBufferContext > > | m_txedBuffer |
Transmitted and retransmission context buffer. More... | |
uint32_t | m_txedBufferSize |
Additional Inherited Members | |
Public Types inherited from ns3::SatBaseEncapsulator | |
typedef Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > | ReceiveCallback |
Callback to send packet to lower layer. More... | |
typedef Callback< bool, Ptr< SatControlMessage >, const Address & > | SendCtrlCallback |
Control msg sending callback. More... | |
Protected Member Functions inherited from ns3::SatGenericStreamEncapsulator | |
Ptr< Packet > | GetNewGsePdu (uint32_t txOpportunityBytes, uint32_t maxGsePduSize, uint32_t additionalHeaderSize=0) |
Get new packet performs the GSE fragmentation and encapsulation for a one single packet. More... | |
void | IncreaseFragmentId () |
Method increases the fragment id by one. More... | |
virtual void | ProcessPdu (Ptr< Packet > p) |
Process the reception of individual GSE PDUs. More... | |
void | Reset () |
Reset defragmentation variables. More... | |
Protected Attributes inherited from ns3::SatGenericStreamEncapsulator | |
uint32_t | m_currRxFragmentId |
Current fragment id in the reassembly process. More... | |
Ptr< Packet > | m_currRxPacketFragment |
Current packet in the reassembly process. More... | |
uint32_t | m_currRxPacketFragmentBytes |
Currently received bytes of the fragmented packet. More... | |
uint32_t | m_currRxPacketSize |
The total size of the ALPDU size reassembly process. More... | |
uint32_t | m_maxGsePduSize |
Maximum GSE PDU size. More... | |
uint32_t | m_minGseTxOpportunity |
If the GSE opportunity is smaller than this, a NULL packet is returned. More... | |
uint32_t | m_txFragmentId |
Fragment id used in the packet transmissions. More... | |
Protected Attributes inherited from ns3::SatBaseEncapsulator | |
uint32_t | m_additionalHeaderSize |
Additional value in to take into account when pulling packets to represent E2E tags. More... | |
SendCtrlCallback | m_ctrlCallback |
Callback to send control messages. More... | |
Mac48Address | m_decapAddress |
Mac48Address | m_destE2EAddress |
Mac48Address | m_encapAddress |
Source and destination mac addresses. More... | |
uint8_t | m_flowId |
Flow identifier. More... | |
ReceiveCallback | m_rxCallback |
Receive callback. More... | |
Mac48Address | m_sourceE2EAddress |
Ptr< SatQueue > | m_txQueue |
Used queue in satellite encapsulator. More... | |
Static Protected Attributes inherited from ns3::SatGenericStreamEncapsulator | |
static const uint32_t | MAX_FRAGMENT_ID = 256 |
The fragment is described with 8 bits, thus the maximum fragment id is 256. More... | |
static const uint32_t | MAX_HL_PACKET_SIZE = 65536 |
The maximum packet size is described with 16 bits, thus, the maximum HL packet size is 65536 bytes. More... | |
SatGenericStreamEncapsulatorArq class is inherited from the SatGenericStreamEncapsulator class, which is used in FWD link for encapsulation and fragmentation of higher layer packets.
This class implements the ARQ retransmission logic in both transmission and reception side for GSE.
Implemented algorithm is based on Selective Repeat ARQ. Retransmission logic is based on a set of timers and added increasing sequence numbers for each sent packet. When a packet is received, and ACK is sent to the receiver with a proper sequence number.
Definition at line 52 of file satellite-generic-stream-encapsulator-arq.h.
ns3::SatGenericStreamEncapsulatorArq::SatGenericStreamEncapsulatorArq | ( | ) |
Default constructor, not used.
Default constructor is not meant to be used!
Definition at line 46 of file satellite-generic-stream-encapsulator-arq.cc.
ns3::SatGenericStreamEncapsulatorArq::SatGenericStreamEncapsulatorArq | ( | Mac48Address | encapAddress, |
Mac48Address | decapAddress, | ||
Mac48Address | sourceE2EAddress, | ||
Mac48Address | destE2EAddress, | ||
uint8_t | flowId, | ||
uint32_t | additionalHeaderSize = 0 |
||
) |
Constructor.
encapAddress | MAC addressd of encapsulator |
decapAddress | MAC addressd of decapsulator |
sourceE2EAddress | E2E source MAC addressd of packets (used to set SatAddressE2ETag) |
destE2EAddress | E2E destination MAC addressd of packets (used to set SatAddressE2ETag) |
flowId | Flow identifier |
additionalHeaderSize | Additional value in to take into account when pulling packets to represent E2E tags |
Definition at line 66 of file satellite-generic-stream-encapsulator-arq.cc.
References m_arqWindowSize, and m_seqNo.
|
virtual |
Destructor for SatGenericStreamEncapsulatorArq.
Definition at line 97 of file satellite-generic-stream-encapsulator-arq.cc.
References m_seqNo.
|
private |
ARQ Tx timer has expired.
The PDU will be flushed, if the maximum retransmissions has been reached. Otherwise the packet will be resent.
seqNo | Sequence number |
Definition at line 343 of file satellite-generic-stream-encapsulator-arq.cc.
References CleanUp(), ns3::SatBaseEncapsulator::m_encapAddress, m_maxNoOfRetransmissions, m_retxBuffer, m_retxBufferSize, and m_txedBuffer.
Referenced by NotifyTxOpportunity().
|
private |
Clean-up a certain sequence number.
sequenceNumber | Sequence number |
Definition at line 388 of file satellite-generic-stream-encapsulator-arq.cc.
References m_retxBuffer, m_retxBufferSize, m_seqNo, m_txedBuffer, and m_txedBufferSize.
Referenced by ArqReTxTimerExpired(), and ReceiveAck().
|
private |
Convert the 8-bit sequence number value from ARQ header into 32-bit continuous sequence number stream at the receiver.
seqNo | 8-bit sequence number |
Definition at line 550 of file satellite-generic-stream-encapsulator-arq.cc.
References m_arqWindowSize, and m_nextExpectedSeqNo.
Referenced by ReceivePdu().
|
virtual |
Dispose of this class instance.
Reimplemented from ns3::SatGenericStreamEncapsulator.
Definition at line 149 of file satellite-generic-stream-encapsulator-arq.cc.
References ns3::SatGenericStreamEncapsulator::DoDispose(), m_reorderingBuffer, m_retxBuffer, m_seqNo, and m_txedBuffer.
TypeId ns3::SatGenericStreamEncapsulatorArq::GetInstanceTypeId | ( | void | ) | const |
Definition at line 143 of file satellite-generic-stream-encapsulator-arq.cc.
References GetTypeId().
|
virtual |
Get the buffered packets for this encapsulator.
Reimplemented from ns3::SatBaseEncapsulator.
Definition at line 652 of file satellite-generic-stream-encapsulator-arq.cc.
References m_retxBufferSize, and ns3::SatBaseEncapsulator::m_txQueue.
Referenced by NotifyTxOpportunity().
|
static |
Get the type ID.
Definition at line 104 of file satellite-generic-stream-encapsulator-arq.cc.
References m_arqHeaderSize, m_arqWindowSize, m_maxNoOfRetransmissions, m_retransmissionTimer, and m_rxWaitingTimer.
Referenced by GetInstanceTypeId().
|
virtual |
Notify a Tx opportunity to this encapsulator.
bytes | Notified tx opportunity bytes from lower layer |
&bytesLeft | Bytes left after this TxOpportunity in SatQueue |
&nextMinTxO | Minimum TxO after this TxO |
Give priority to the retransmissions. Whenever, the retransmission timer is expired, packet is moved to the retransmission buffer from the transmitted buffer.
Reimplemented from ns3::SatGenericStreamEncapsulator.
Definition at line 188 of file satellite-generic-stream-encapsulator-arq.cc.
References ArqReTxTimerExpired(), ns3::SatGenericStreamEncapsulator::GetMinTxOpportunityInBytes(), ns3::SatGenericStreamEncapsulator::GetNewGsePdu(), GetTxBufferSizeInBytes(), m_arqHeaderSize, ns3::SatBaseEncapsulator::m_decapAddress, ns3::SatBaseEncapsulator::m_destE2EAddress, ns3::SatBaseEncapsulator::m_encapAddress, ns3::SatBaseEncapsulator::m_flowId, m_retransmissionTimer, m_retxBuffer, m_retxBufferSize, m_seqNo, ns3::SatBaseEncapsulator::m_sourceE2EAddress, m_txedBuffer, m_txedBufferSize, ns3::SatBaseEncapsulator::m_txQueue, ns3::SatMacTag::SetDestAddress(), ns3::SatAddressE2ETag::SetE2EDestAddress(), ns3::SatAddressE2ETag::SetE2ESourceAddress(), ns3::SatFlowIdTag::SetFlowId(), ns3::SatArqHeader::SetSeqNo(), and ns3::SatMacTag::SetSourceAddress().
|
private |
Reassemble and receive the received PDUs if possible.
As long as the PDU is the next expected one, process the PDU and erase it.
Definition at line 588 of file satellite-generic-stream-encapsulator-arq.cc.
References m_nextExpectedSeqNo, m_reorderingBuffer, and ns3::SatGenericStreamEncapsulator::ProcessPdu().
Referenced by ReceivePdu(), and RxWaitingTimerExpired().
|
virtual |
Receive a control message (ARQ ACK)
ack | Control message pointer received from lower layer |
Take the packet away from the transmitted or retransmission buffer and release the sequence number for further use.
Reimplemented from ns3::SatBaseEncapsulator.
Definition at line 419 of file satellite-generic-stream-encapsulator-arq.cc.
References CleanUp(), and ns3::SatBaseEncapsulator::m_encapAddress.
|
virtual |
Receive a packet, thus decapsulate and defragment/deconcatenate if needed.
The decapsuled/defragmented HL PDU is forwarded back to LLC and to upper layer.
p | A packet pointer received from lower layer |
Reimplemented from ns3::SatGenericStreamEncapsulator.
Definition at line 436 of file satellite-generic-stream-encapsulator-arq.cc.
References ConvertSeqNo(), ns3::SatMacTag::GetDestAddress(), ns3::SatArqHeader::GetSeqNo(), ns3::SatBaseEncapsulator::m_decapAddress, ns3::SatBaseEncapsulator::m_encapAddress, m_nextExpectedSeqNo, m_reorderingBuffer, m_rxWaitingTimer, ReassembleAndReceive(), RxWaitingTimerExpired(), and SendAck().
|
private |
Rx waiting timer for a PDU has expired.
sn | Sequence number |
Definition at line 629 of file satellite-generic-stream-encapsulator-arq.cc.
References ns3::SatBaseEncapsulator::m_encapAddress, m_reorderingBuffer, and ReassembleAndReceive().
Referenced by ReceivePdu().
|
private |
Send ACK for a given sequence number.
seqNo | Sequence number |
GSE sends the ACK control message via a callback to SatNetDevice of the GW to the RLE control buffer. The transmission assumptions for the control messages are currently
Definition at line 660 of file satellite-generic-stream-encapsulator-arq.cc.
References ns3::SatBaseEncapsulator::m_ctrlCallback, ns3::SatBaseEncapsulator::m_decapAddress, ns3::SatBaseEncapsulator::m_encapAddress, and ns3::SatBaseEncapsulator::m_flowId.
Referenced by ReceivePdu().
|
private |
ARQ header size in Bytes.
Definition at line 197 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by GetTypeId(), and NotifyTxOpportunity().
|
private |
ARQ window size, i.e.
how many sequential sequence numbers may be in use simultaneously.
Definition at line 192 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by SatGenericStreamEncapsulatorArq(), ConvertSeqNo(), and GetTypeId().
|
private |
Maximum number of retransmissions.
Definition at line 180 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by ArqReTxTimerExpired(), and GetTypeId().
|
private |
Next expected sequence number at the packet reception.
Definition at line 202 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by ConvertSeqNo(), ReassembleAndReceive(), and ReceivePdu().
|
private |
key = sequence number value = GSE packet
Definition at line 213 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by DoDispose(), ReassembleAndReceive(), ReceivePdu(), and RxWaitingTimerExpired().
|
private |
Retransmission timer, i.e.
when to retransmit a packet if a ACK has not been received.
Definition at line 186 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by GetTypeId(), and NotifyTxOpportunity().
|
private |
Definition at line 173 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by ArqReTxTimerExpired(), CleanUp(), DoDispose(), and NotifyTxOpportunity().
|
private |
Definition at line 174 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by ArqReTxTimerExpired(), CleanUp(), GetTxBufferSizeInBytes(), and NotifyTxOpportunity().
|
private |
Waiting time for waiting a certain SN to be received.
Definition at line 207 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by GetTypeId(), and ReceivePdu().
|
private |
Sequence number handler.
Definition at line 167 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by SatGenericStreamEncapsulatorArq(), ~SatGenericStreamEncapsulatorArq(), CleanUp(), DoDispose(), and NotifyTxOpportunity().
|
private |
Transmitted and retransmission context buffer.
Definition at line 172 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by ArqReTxTimerExpired(), CleanUp(), DoDispose(), and NotifyTxOpportunity().
|
private |
Definition at line 175 of file satellite-generic-stream-encapsulator-arq.h.
Referenced by CleanUp(), and NotifyTxOpportunity().