Block ack window. More...
#include "block-ack-window.h"
Public Member Functions | |
BlockAckWindow () | |
Constructor. | |
void | Advance (std::size_t count) |
Advance the current winStart by the given number of positions. | |
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. | |
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. | |
uint16_t | GetWinEnd () const |
Get the current winEnd value. | |
std::size_t | GetWinSize () const |
Get the window size. | |
uint16_t | GetWinStart () const |
Get the current winStart value. | |
void | Init (uint16_t winStart, uint16_t winSize) |
Initialize the window with the given starting sequence number and size. | |
void | Reset (uint16_t winStart) |
Reset the window by clearing all the elements and setting winStart to the given value. | |
Private Attributes | |
std::size_t | m_head |
index of winStart in the vector | |
std::vector< bool > | m_window |
window | |
uint16_t | m_winStart |
window start (sequence number) | |
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 46 of file block-ack-window.h.
ns3::BlockAckWindow::BlockAckWindow | ( | ) |
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 76 of file block-ack-window.cc.
References m_head, m_window, m_winStart, NS_LOG_FUNCTION, Reset(), and ns3::SEQNO_SPACE_SIZE.
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 60 of file block-ack-window.cc.
References m_head, m_window, and NS_ASSERT.
Referenced by OriginatorBlockAckWindowTest::DoRun().
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 68 of file block-ack-window.cc.
uint16_t ns3::BlockAckWindow::GetWinEnd | ( | ) | const |
Get the current winEnd value.
Definition at line 48 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 54 of file block-ack-window.cc.
References m_window.
Referenced by OriginatorBlockAckWindowTest::DoRun().
uint16_t ns3::BlockAckWindow::GetWinStart | ( | ) | const |
Get the current winStart value.
Definition at line 42 of file block-ack-window.cc.
References m_winStart.
Referenced by OriginatorBlockAckWindowTest::DoRun().
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 27 of file block-ack-window.cc.
References m_head, m_window, m_winStart, and NS_LOG_FUNCTION.
Referenced by 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 36 of file block-ack-window.cc.
References Init(), and m_window.
Referenced by Advance().
|
private |
index of winStart in the vector
Definition at line 115 of file block-ack-window.h.
Referenced by BlockAckWindow(), Advance(), At(), At(), and Init().
|
private |
window
Definition at line 114 of file block-ack-window.h.
Referenced by Advance(), At(), At(), GetWinEnd(), GetWinSize(), Init(), and Reset().
|
private |
window start (sequence number)
Definition at line 113 of file block-ack-window.h.
Referenced by BlockAckWindow(), Advance(), GetWinEnd(), GetWinStart(), and Init().