Block ack window. More...
#include "block-ack-window.h"
Public Member Functions | |
BlockAckWindow () | |
Constructor. More... | |
void | Advance (std::size_t count) |
Advance the current winStart by the given number of positions. More... | |
std::vector< bool >::reference | At (std::size_t distance) |
Get a reference to the element in the window having the given distance from the current winStart. More... | |
std::vector< bool >::const_reference | At (std::size_t distance) const |
Get a const reference to the element in the window having the given distance from the current winStart. More... | |
uint16_t | GetWinEnd () const |
Get the current winEnd value. More... | |
std::size_t | GetWinSize () const |
Get the window size. More... | |
uint16_t | GetWinStart () const |
Get the current winStart value. More... | |
void | Init (uint16_t winStart, uint16_t winSize) |
Initialize the window with the given starting sequence number and size. More... | |
void | Reset (uint16_t winStart) |
Reset the window by clearing all the elements and setting winStart to the given value. More... | |
Private Attributes | |
std::size_t | m_head |
index of winStart in the vector More... | |
std::vector< bool > | m_window |
window More... | |
uint16_t | m_winStart |
window start (sequence number) More... | |
Block ack window.
This class provides the basic functionalities of a window sliding over a bitmap: accessing any element in the bitmap and moving the window forward a given number of positions. This class can be used to implement both an originator's window and a recipient's window.
The window is implemented as a vector of bool and managed as a circular queue. The window is moved forward by advancing the head of the queue and clearing the elements that become part of the tail of the queue. Hence, no element is required to be shifted when the window moves forward.
Example:
|0|1|1|0|1|1|1|0|1|1|1|1|1|1|1|0| ^ | HEAD
After moving the window forward three positions:
|0|1|1|0|1|1|1|0|1|1|0|0|0|1|1|0| ^ | HEAD
Definition at line 57 of file block-ack-window.h.
ns3::BlockAckWindow::BlockAckWindow | ( | ) |
Constructor.
Definition at line 31 of file block-ack-window.cc.
void ns3::BlockAckWindow::Advance | ( | std::size_t | count | ) |
Advance the current winStart by the given number of positions.
count | the number of positions the current winStart must be advanced by |
Definition at line 87 of file block-ack-window.cc.
References m_head, m_window, m_winStart, NS_LOG_FUNCTION, Reset(), and ns3::SEQNO_SPACE_SIZE.
Referenced by ns3::OriginatorBlockAckAgreement::AdvanceTxWindow(), ns3::OriginatorBlockAckAgreement::NotifyDiscardedMpdu(), ns3::RecipientBlockAckAgreement::NotifyReceivedBar(), ns3::RecipientBlockAckAgreement::NotifyReceivedMpdu(), and ns3::OriginatorBlockAckAgreement::NotifyTransmittedMpdu().
std::vector< bool >::reference ns3::BlockAckWindow::At | ( | std::size_t | distance | ) |
Get a reference to the element in the window having the given distance from the current winStart.
Note that the given distance must be less than the window size.
distance | the given distance |
Definition at line 71 of file block-ack-window.cc.
References m_head, m_window, and NS_ASSERT.
Referenced by ns3::OriginatorBlockAckAgreement::AdvanceTxWindow(), OriginatorBlockAckWindowTest::DoRun(), ns3::RecipientBlockAckAgreement::FillBlockAckBitmap(), ns3::OriginatorBlockAckAgreement::NotifyAckedMpdu(), and ns3::RecipientBlockAckAgreement::NotifyReceivedMpdu().
std::vector< bool >::const_reference ns3::BlockAckWindow::At | ( | std::size_t | distance | ) | const |
Get a const reference to the element in the window having the given distance from the current winStart.
Note that the given distance must be less than the window size.
distance | the given distance |
Definition at line 79 of file block-ack-window.cc.
uint16_t ns3::BlockAckWindow::GetWinEnd | ( | ) | const |
Get the current winEnd value.
Definition at line 59 of file block-ack-window.cc.
References m_window, m_winStart, and ns3::SEQNO_SPACE_SIZE.
Referenced by OriginatorBlockAckWindowTest::DoRun().
std::size_t ns3::BlockAckWindow::GetWinSize | ( | ) | const |
Get the window size.
Definition at line 65 of file block-ack-window.cc.
References m_window.
Referenced by OriginatorBlockAckWindowTest::DoRun(), ns3::RecipientBlockAckAgreement::FillBlockAckBitmap(), ns3::OriginatorBlockAckAgreement::GetStartingSequence(), ns3::RecipientBlockAckAgreement::NotifyReceivedBar(), ns3::RecipientBlockAckAgreement::NotifyReceivedMpdu(), and ns3::OriginatorBlockAckAgreement::NotifyTransmittedMpdu().
uint16_t ns3::BlockAckWindow::GetWinStart | ( | ) | const |
Get the current winStart value.
Definition at line 53 of file block-ack-window.cc.
References m_winStart.
Referenced by OriginatorBlockAckWindowTest::DoRun(), ns3::RecipientBlockAckAgreement::FillBlockAckBitmap(), ns3::RecipientBlockAckAgreement::Flush(), ns3::OriginatorBlockAckAgreement::GetDistance(), ns3::OriginatorBlockAckAgreement::GetStartingSequence(), ns3::OriginatorBlockAckAgreement::NotifyAckedMpdu(), ns3::OriginatorBlockAckAgreement::NotifyDiscardedMpdu(), ns3::RecipientBlockAckAgreement::NotifyReceivedBar(), ns3::RecipientBlockAckAgreement::NotifyReceivedMpdu(), and ns3::OriginatorBlockAckAgreement::NotifyTransmittedMpdu().
void ns3::BlockAckWindow::Init | ( | uint16_t | winStart, |
uint16_t | winSize | ||
) |
Initialize the window with the given starting sequence number and size.
winStart | the window start |
winSize | the window size |
Definition at line 38 of file block-ack-window.cc.
References m_head, m_window, m_winStart, and NS_LOG_FUNCTION.
Referenced by ns3::RecipientBlockAckAgreement::RecipientBlockAckAgreement(), ns3::OriginatorBlockAckAgreement::InitTxWindow(), and Reset().
void ns3::BlockAckWindow::Reset | ( | uint16_t | winStart | ) |
Reset the window by clearing all the elements and setting winStart to the given value.
winStart | the window start |
Definition at line 47 of file block-ack-window.cc.
References Init(), and m_window.
Referenced by Advance(), and ns3::RecipientBlockAckAgreement::NotifyReceivedBar().
|
private |
index of winStart in the vector
Definition at line 126 of file block-ack-window.h.
|
private |
window
Definition at line 125 of file block-ack-window.h.
Referenced by Advance(), At(), GetWinEnd(), GetWinSize(), Init(), and Reset().
|
private |
window start (sequence number)
Definition at line 124 of file block-ack-window.h.
Referenced by Advance(), GetWinEnd(), GetWinStart(), and Init().