Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreement. More...
#include "recipient-block-ack-agreement.h"
Classes | |
struct | Compare |
Comparison functor used to sort the buffered MPDUs. More... | |
Public Member Functions | |
RecipientBlockAckAgreement (Mac48Address originator, bool amsduSupported, uint8_t tid, uint16_t bufferSize, uint16_t timeout, uint16_t startingSeq, bool htSupported) | |
Constructor. | |
~RecipientBlockAckAgreement () override | |
void | FillBlockAckBitmap (CtrlBAckResponseHeader &blockAckHeader, std::size_t index=0) const |
Set the Starting Sequence Number subfield of the Block Ack Starting Sequence Control subfield of the Block Ack frame and fill the block ack bitmap. | |
void | Flush () |
This is called when a Block Ack agreement is destroyed to flush the received packets. | |
void | NotifyReceivedBar (uint16_t startingSequenceNumber) |
Update both the scoreboard and the receive reordering buffer upon reception of a Block Ack Request. | |
void | NotifyReceivedMpdu (Ptr< const WifiMpdu > mpdu) |
Update both the scoreboard and the receive reordering buffer upon reception of the given MPDU. | |
void | SetMacRxMiddle (const Ptr< MacRxMiddle > rxMiddle) |
Set the MAC RX Middle to use. | |
Public Member Functions inherited from ns3::BlockAckAgreement | |
BlockAckAgreement (Mac48Address peer, uint8_t tid) | |
Constructor for BlockAckAgreement with given peer and TID. | |
virtual | ~BlockAckAgreement () |
BlockAckReqType | GetBlockAckReqType () const |
Get the type of the Block Ack Requests sent by the originator of this agreement. | |
BlockAckType | GetBlockAckType () const |
Get the type of the Block Acks sent by the recipient of this agreement. | |
uint16_t | GetBufferSize () const |
Return the buffer size. | |
const std::optional< Mac48Address > & | GetGcrGroupAddress () const |
Get the GCR group address of this agreement if it is a GCR Block Ack agreement. | |
Mac48Address | GetPeer () const |
Return the peer address. | |
virtual uint16_t | GetStartingSequence () const |
Return the starting sequence number. | |
uint16_t | GetStartingSequenceControl () const |
Return the starting sequence control. | |
uint8_t | GetTid () const |
Return the Traffic ID (TID). | |
uint16_t | GetTimeout () const |
Return the timeout. | |
uint16_t | GetWinEnd () const |
Return the last sequence number covered by the ack window. | |
bool | IsAmsduSupported () const |
Check whether A-MSDU is supported. | |
bool | IsHtSupported () const |
Check whether HT is supported. | |
bool | IsImmediateBlockAck () const |
Check whether the current ack policy is immediate BlockAck. | |
void | SetAmsduSupport (bool supported) |
Enable or disable A-MSDU support. | |
void | SetBufferSize (uint16_t bufferSize) |
Set buffer size. | |
void | SetDelayedBlockAck () |
Set block ack policy to delayed Ack. | |
void | SetGcrGroupAddress (const Mac48Address &gcrGroupAddress) |
Set the GCR group address for this agreement. | |
void | SetHtSupported (bool htSupported) |
Enable or disable HT support. | |
void | SetImmediateBlockAck () |
Set block ack policy to immediate Ack. | |
void | SetStartingSequence (uint16_t seq) |
Set starting sequence number. | |
void | SetStartingSequenceControl (uint16_t seq) |
Set starting sequence control. | |
void | SetTimeout (uint16_t timeout) |
Set timeout. | |
Private Types | |
typedef std::pair< uint16_t, uint16_t * > | Key |
The key of a buffered MPDU is the pair (MPDU sequence number, pointer to WinStartB) | |
Private Member Functions | |
void | PassBufferedMpdusUntilFirstLost () |
Pass MSDUs or A-MSDUs up to the next MAC process if they are stored in the buffer in order of increasing value of the Sequence Number subfield starting with the MSDU or A-MSDU that has SN=WinStartB. | |
void | PassBufferedMpdusWithSeqNumberLessThan (uint16_t newWinStartB) |
Pass any complete MSDUs or A-MSDUs stored in the buffer with Sequence Number subfield values that are lower than the new value of WinStartB up to the next MAC process in order of increasing Sequence Number subfield value. | |
Private Attributes | |
std::map< Key, Ptr< const WifiMpdu >, Compare > | m_bufferedMpdus |
buffered MPDUs sorted by Seq Number | |
Ptr< MacRxMiddle > | m_rxMiddle |
the MAC RX Middle on this station | |
BlockAckWindow | m_scoreboard |
recipient's scoreboard | |
std::size_t | m_winSizeB |
size of the receive reordering buffer | |
uint16_t | m_winStartB |
starting SN for the reordering buffer | |
Additional Inherited Members | |
Static Public Member Functions inherited from ns3::BlockAckAgreement | |
static std::size_t | GetDistance (uint16_t seqNumber, uint16_t startingSeqNumber) |
Get the distance between the given starting sequence number and the given sequence number. | |
Protected Attributes inherited from ns3::BlockAckAgreement | |
bool | m_amsduSupported |
Flag whether MSDU aggregation is supported. | |
uint8_t | m_blockAckPolicy |
Type of block ack: immediate or delayed. | |
uint16_t | m_bufferSize |
Buffer size. | |
std::optional< Mac48Address > | m_gcrGroupAddress |
the optional GCR group address | |
bool | m_htSupported |
Flag whether HT is supported. | |
EventId | m_inactivityEvent |
inactivity event | |
Mac48Address | m_peer |
Peer address. | |
uint16_t | m_startingSeq |
Starting sequence control. | |
uint8_t | m_tid |
Traffic ID. | |
uint16_t | m_timeout |
Timeout. | |
uint16_t | m_winEnd |
Ending sequence number. | |
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreement.
Definition at line 28 of file recipient-block-ack-agreement.h.
|
private |
The key of a buffered MPDU is the pair (MPDU sequence number, pointer to WinStartB)
Definition at line 109 of file recipient-block-ack-agreement.h.
ns3::RecipientBlockAckAgreement::RecipientBlockAckAgreement | ( | Mac48Address | originator, |
bool | amsduSupported, | ||
uint8_t | tid, | ||
uint16_t | bufferSize, | ||
uint16_t | timeout, | ||
uint16_t | startingSeq, | ||
bool | htSupported ) |
Constructor.
originator | MAC address |
amsduSupported | whether A-MSDU support is enabled |
tid | Traffic ID |
bufferSize | the buffer size (in number of MPDUs) |
timeout | the timeout value |
startingSeq | the starting sequence number |
htSupported | whether HT support is enabled |
Definition at line 33 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckWindow::Init(), ns3::BlockAckAgreement::m_amsduSupported, ns3::BlockAckAgreement::m_bufferSize, ns3::BlockAckAgreement::m_htSupported, m_scoreboard, ns3::BlockAckAgreement::m_startingSeq, ns3::BlockAckAgreement::m_timeout, m_winSizeB, m_winStartB, NS_LOG_FUNCTION, and timeout.
|
override |
Definition at line 56 of file recipient-block-ack-agreement.cc.
References m_bufferedMpdus, m_rxMiddle, and NS_LOG_FUNCTION_NOARGS.
void ns3::RecipientBlockAckAgreement::FillBlockAckBitmap | ( | CtrlBAckResponseHeader & | blockAckHeader, |
std::size_t | index = 0 ) const |
Set the Starting Sequence Number subfield of the Block Ack Starting Sequence Control subfield of the Block Ack frame and fill the block ack bitmap.
For Multi-STA Block Acks, index identifies the Per AID TID Info subfield whose bitmap has to be filled.
blockAckHeader | the block ack header |
index | the index of the Per AID TID Info subfield (Multi-STA Block Ack only) |
Definition at line 221 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckWindow::At(), ns3::BlockAckWindow::GetWinSize(), ns3::BlockAckWindow::GetWinStart(), ns3::CtrlBAckResponseHeader::IsBasic(), ns3::CtrlBAckResponseHeader::IsCompressed(), ns3::CtrlBAckResponseHeader::IsExtendedCompressed(), ns3::CtrlBAckResponseHeader::IsGcr(), ns3::CtrlBAckResponseHeader::IsMultiSta(), ns3::CtrlBAckResponseHeader::IsMultiTid(), m_scoreboard, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::CtrlBAckResponseHeader::ResetBitmap(), ns3::SEQNO_SPACE_SIZE, ns3::CtrlBAckResponseHeader::SetReceivedPacket(), and ns3::CtrlBAckResponseHeader::SetStartingSequence().
Referenced by ns3::HtFrameExchangeManager::SendBlockAck().
void ns3::RecipientBlockAckAgreement::Flush | ( | ) |
This is called when a Block Ack agreement is destroyed to flush the received packets.
Definition at line 174 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckWindow::GetWinStart(), m_scoreboard, NS_LOG_FUNCTION, PassBufferedMpdusUntilFirstLost(), and PassBufferedMpdusWithSeqNumberLessThan().
void ns3::RecipientBlockAckAgreement::NotifyReceivedBar | ( | uint16_t | startingSequenceNumber | ) |
Update both the scoreboard and the receive reordering buffer upon reception of a Block Ack Request.
startingSequenceNumber | the starting sequence number included in the received Block Ack Request |
Definition at line 182 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckWindow::Advance(), ns3::BlockAckAgreement::GetDistance(), ns3::BlockAckWindow::GetWinSize(), ns3::BlockAckWindow::GetWinStart(), m_scoreboard, m_winStartB, NS_ASSERT, NS_LOG_FUNCTION, PassBufferedMpdusUntilFirstLost(), PassBufferedMpdusWithSeqNumberLessThan(), ns3::BlockAckWindow::Reset(), and ns3::SEQNO_SPACE_HALF_SIZE.
Referenced by BlockAckRecipientBufferTest::DoRun().
Update both the scoreboard and the receive reordering buffer upon reception of the given MPDU.
mpdu | the received MPDU |
Definition at line 114 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckWindow::Advance(), ns3::BlockAckWindow::At(), ns3::BlockAckAgreement::GetDistance(), ns3::BlockAckWindow::GetWinSize(), ns3::BlockAckWindow::GetWinStart(), m_bufferedMpdus, m_scoreboard, m_winSizeB, m_winStartB, NS_LOG_FUNCTION, PassBufferedMpdusUntilFirstLost(), PassBufferedMpdusWithSeqNumberLessThan(), and ns3::SEQNO_SPACE_HALF_SIZE.
Referenced by BlockAckRecipientBufferTest::DoRun().
|
private |
Pass MSDUs or A-MSDUs up to the next MAC process if they are stored in the buffer in order of increasing value of the Sequence Number subfield starting with the MSDU or A-MSDU that has SN=WinStartB.
Set WinStartB to the value of the Sequence Number subfield of the last MSDU or A-MSDU that was passed up to the next MAC process plus one.
Definition at line 71 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckAgreement::GetDistance(), m_bufferedMpdus, m_rxMiddle, m_winStartB, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::SEQNO_SPACE_HALF_SIZE, ns3::SEQNO_SPACE_SIZE, and ns3::WIFI_LINKID_UNDEFINED.
Referenced by Flush(), NotifyReceivedBar(), and NotifyReceivedMpdu().
|
private |
Pass any complete MSDUs or A-MSDUs stored in the buffer with Sequence Number subfield values that are lower than the new value of WinStartB up to the next MAC process in order of increasing Sequence Number subfield value.
newWinStartB | the new value of WinStartB |
Definition at line 92 of file recipient-block-ack-agreement.cc.
References ns3::BlockAckAgreement::GetDistance(), m_bufferedMpdus, m_rxMiddle, m_winStartB, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::SEQNO_SPACE_HALF_SIZE, and ns3::WIFI_LINKID_UNDEFINED.
Referenced by Flush(), NotifyReceivedBar(), and NotifyReceivedMpdu().
void ns3::RecipientBlockAckAgreement::SetMacRxMiddle | ( | const Ptr< MacRxMiddle > | rxMiddle | ) |
Set the MAC RX Middle to use.
rxMiddle | the MAC RX Middle to use |
Definition at line 64 of file recipient-block-ack-agreement.cc.
References m_rxMiddle, and NS_LOG_FUNCTION.
Referenced by ns3::BlockAckManager::CreateRecipientAgreement(), and BlockAckRecipientBufferTest::DoRun().
|
private |
buffered MPDUs sorted by Seq Number
Definition at line 128 of file recipient-block-ack-agreement.h.
Referenced by ~RecipientBlockAckAgreement(), NotifyReceivedMpdu(), PassBufferedMpdusUntilFirstLost(), and PassBufferedMpdusWithSeqNumberLessThan().
|
private |
the MAC RX Middle on this station
Definition at line 129 of file recipient-block-ack-agreement.h.
Referenced by ~RecipientBlockAckAgreement(), PassBufferedMpdusUntilFirstLost(), PassBufferedMpdusWithSeqNumberLessThan(), and SetMacRxMiddle().
|
private |
recipient's scoreboard
Definition at line 124 of file recipient-block-ack-agreement.h.
Referenced by RecipientBlockAckAgreement(), FillBlockAckBitmap(), Flush(), NotifyReceivedBar(), and NotifyReceivedMpdu().
|
private |
size of the receive reordering buffer
Definition at line 126 of file recipient-block-ack-agreement.h.
Referenced by RecipientBlockAckAgreement(), and NotifyReceivedMpdu().
|
private |
starting SN for the reordering buffer
Definition at line 125 of file recipient-block-ack-agreement.h.
Referenced by RecipientBlockAckAgreement(), NotifyReceivedBar(), NotifyReceivedMpdu(), PassBufferedMpdusUntilFirstLost(), and PassBufferedMpdusWithSeqNumberLessThan().