A Discrete-Event Network Simulator
API
ns3::BlockAckWindow Class Reference

Block ack window. More...

#include "block-ack-window.h"

+ Collaboration diagram for ns3::BlockAckWindow:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BlockAckWindow()

ns3::BlockAckWindow::BlockAckWindow ( )

Constructor.

Definition at line 31 of file block-ack-window.cc.

Member Function Documentation

◆ Advance()

void ns3::BlockAckWindow::Advance ( std::size_t  count)

Advance the current winStart by the given number of positions.

Parameters
countthe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ At() [1/2]

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.

Parameters
distancethe given distance
Returns
a reference to the element in the window having the given distance from the current winStart

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().

+ Here is the caller graph for this function:

◆ At() [2/2]

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.

Parameters
distancethe given distance
Returns
a const reference to the element in the window having the given distance from the current winStart

Definition at line 79 of file block-ack-window.cc.

References m_head, m_window, and NS_ASSERT.

◆ GetWinEnd()

uint16_t ns3::BlockAckWindow::GetWinEnd ( ) const

Get the current winEnd value.

Returns
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().

+ Here is the caller graph for this function:

◆ GetWinSize()

◆ GetWinStart()

◆ Init()

void ns3::BlockAckWindow::Init ( uint16_t  winStart,
uint16_t  winSize 
)

Initialize the window with the given starting sequence number and size.

Parameters
winStartthe window start
winSizethe 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().

+ Here is the caller graph for this function:

◆ Reset()

void ns3::BlockAckWindow::Reset ( uint16_t  winStart)

Reset the window by clearing all the elements and setting winStart to the given value.

Parameters
winStartthe window start

Definition at line 47 of file block-ack-window.cc.

References Init(), and m_window.

Referenced by Advance(), and ns3::RecipientBlockAckAgreement::NotifyReceivedBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_head

std::size_t ns3::BlockAckWindow::m_head
private

index of winStart in the vector

Definition at line 126 of file block-ack-window.h.

Referenced by Advance(), At(), and Init().

◆ m_window

std::vector<bool> ns3::BlockAckWindow::m_window
private

window

Definition at line 125 of file block-ack-window.h.

Referenced by Advance(), At(), GetWinEnd(), GetWinSize(), Init(), and Reset().

◆ m_winStart

uint16_t ns3::BlockAckWindow::m_winStart
private

window start (sequence number)

Definition at line 124 of file block-ack-window.h.

Referenced by Advance(), GetWinEnd(), GetWinStart(), and Init().


The documentation for this class was generated from the following files: