Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack for an originator station. More...
#include "originator-block-ack-agreement.h"
Public Types | |
enum | State { PENDING , ESTABLISHED , NO_REPLY , RESET , REJECTED } |
Represents the state for this agreement. More... | |
Public Member Functions | |
OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid) | |
Constructor. | |
~OriginatorBlockAckAgreement () override | |
bool | AllAckedMpdusInTxWindow (const std::set< uint16_t > &seqNumbers) const |
Check whether all the MPDUs in the TX window other than the given ones have been already acknowledged. | |
std::size_t | GetDistance (uint16_t seqNumber) const |
Get the distance between the current starting sequence number and the given sequence number. | |
uint16_t | GetStartingSequence () const override |
Return the starting sequence number of the transmit window, if a transmit window has been initialized. | |
void | InitTxWindow () |
Initialize the originator's transmit window by setting its size and starting sequence number equal to the values stored by the BlockAckAgreement base class. | |
bool | IsEstablished () const |
Check if the current state of this agreement is ESTABLISHED. | |
bool | IsNoReply () const |
Check if the current state of this agreement is NO_REPLY. | |
bool | IsPending () const |
Check if the current state of this agreement is PENDING. | |
bool | IsRejected () const |
Check if the current state of this agreement is REJECTED. | |
bool | IsReset () const |
Check if the current state of this agreement is RESET. | |
void | NotifyAckedMpdu (Ptr< const WifiMpdu > mpdu) |
Record that the given MPDU has been acknowledged and advance the transmit window if possible. | |
void | NotifyDiscardedMpdu (Ptr< const WifiMpdu > mpdu) |
Advance the transmit window beyond the MPDU that has been reported to be discarded. | |
void | NotifyTransmittedMpdu (Ptr< const WifiMpdu > mpdu) |
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet and is beyond the current transmit window. | |
void | SetState (State state) |
Set the current state. | |
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. | |
Mac48Address | GetPeer () const |
Return the peer address. | |
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 | 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 Member Functions | |
void | AdvanceTxWindow () |
Advance the transmit window so that the starting sequence number is the nearest unacknowledged MPDU. | |
Private Attributes | |
State | m_state |
state | |
BlockAckWindow | m_txWindow |
originator's transmit window | |
Friends | |
class | ::OriginatorBlockAckWindowTest |
allow OriginatorBlockAckWindowTest class access | |
class | BlockAckManager |
allow BlockAckManager class access | |
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 | |
uint8_t | 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. | |
uint8_t | 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 state and information about transmitted MPDUs with Ack Policy set to Block Ack for an originator station.
The state diagram is as follows:
/------------\ send ADDBARequest ---------------- | START |------------------>| PENDING |------- \------------/ ---------------- \ ^ receive / | \ | ADDBAResponse / | \ | (failure) v | \ | --------------- | ---------------------> ---------------- | | REJECTED | | receive ADDBAResponse (success) | ESTABLISHED | | --------------- | no --------------------> ---------------- | receive ^ | ADDBAResponse / | ADDBAResponse \ | / | (failure) \ v / | ---------------- / |-------------------------| NO_REPLY |--------- Reset after timeout ----------------
See also OriginatorBlockAckAgreement::State
Definition at line 55 of file originator-block-ack-agreement.h.
Represents the state for this agreement.
PENDING: If an agreement is in PENDING state it means that an ADDBARequest frame was sent to recipient in order to setup the block ack and the originator is waiting for the relative ADDBAResponse frame.
ESTABLISHED: The block ack is active and all packets relative to this agreement are transmitted with Ack Policy set to Block Ack.
NO_REPLY No reply after an ADDBA request. In this state the originator will send the rest of packets in queue using normal MPDU.
RESET A transient state to mark the agreement for reinitialization after failed ADDBA request. Since it is a temporary state, it is not included in the state diagram above. In this state the next transmission will be treated as if the BA agreement is not created yet.
REJECTED (not used for now): The agreement's state becomes REJECTED if an ADDBAResponse frame is received from recipient and the Status Code field is set to failure. State enumeration
Enumerator | |
---|---|
PENDING | |
ESTABLISHED | |
NO_REPLY | |
RESET | |
REJECTED |
Definition at line 98 of file originator-block-ack-agreement.h.
ns3::OriginatorBlockAckAgreement::OriginatorBlockAckAgreement | ( | Mac48Address | recipient, |
uint8_t | tid ) |
Constructor.
recipient | MAC address |
tid | Traffic ID |
Definition at line 22 of file originator-block-ack-agreement.cc.
|
override |
Definition at line 28 of file originator-block-ack-agreement.cc.
|
private |
Advance the transmit window so that the starting sequence number is the nearest unacknowledged MPDU.
Definition at line 116 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::Advance(), ns3::BlockAckWindow::At(), and m_txWindow.
Referenced by NotifyAckedMpdu(), NotifyDiscardedMpdu(), and NotifyTransmittedMpdu().
bool ns3::OriginatorBlockAckAgreement::AllAckedMpdusInTxWindow | ( | const std::set< uint16_t > & | seqNumbers | ) | const |
Check whether all the MPDUs in the TX window other than the given ones have been already acknowledged.
seqNumbers | the sequence numbers of the given MPDUs |
Definition at line 92 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::At(), GetDistance(), ns3::BlockAckWindow::GetWinSize(), m_txWindow, and NS_LOG_INFO.
std::size_t ns3::OriginatorBlockAckAgreement::GetDistance | ( | uint16_t | seqNumber | ) | const |
Get the distance between the current starting sequence number and the given sequence number.
seqNumber | the given sequence number |
Definition at line 80 of file originator-block-ack-agreement.cc.
References ns3::BlockAckAgreement::GetDistance(), ns3::BlockAckWindow::GetWinStart(), and m_txWindow.
Referenced by AllAckedMpdusInTxWindow(), NotifyAckedMpdu(), NotifyDiscardedMpdu(), and NotifyTransmittedMpdu().
|
overridevirtual |
Return the starting sequence number of the transmit window, if a transmit window has been initialized.
Otherwise, return the starting sequence number stored by the BlockAckAgreement base class.
Reimplemented from ns3::BlockAckAgreement.
Definition at line 69 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::GetWinSize(), ns3::BlockAckWindow::GetWinStart(), ns3::BlockAckAgreement::m_startingSeq, and m_txWindow.
Referenced by OriginatorBlockAckWindowTest::DoRun().
void ns3::OriginatorBlockAckAgreement::InitTxWindow | ( | ) |
Initialize the originator's transmit window by setting its size and starting sequence number equal to the values stored by the BlockAckAgreement base class.
Definition at line 86 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::Init(), ns3::BlockAckAgreement::m_bufferSize, ns3::BlockAckAgreement::m_startingSeq, and m_txWindow.
Referenced by OriginatorBlockAckWindowTest::DoRun(), and ns3::BlockAckManager::UpdateOriginatorAgreement().
bool ns3::OriginatorBlockAckAgreement::IsEstablished | ( | ) | const |
Check if the current state of this agreement is ESTABLISHED.
Definition at line 45 of file originator-block-ack-agreement.cc.
References ESTABLISHED, and m_state.
bool ns3::OriginatorBlockAckAgreement::IsNoReply | ( | ) | const |
Check if the current state of this agreement is NO_REPLY.
Definition at line 57 of file originator-block-ack-agreement.cc.
bool ns3::OriginatorBlockAckAgreement::IsPending | ( | ) | const |
Check if the current state of this agreement is PENDING.
Definition at line 39 of file originator-block-ack-agreement.cc.
bool ns3::OriginatorBlockAckAgreement::IsRejected | ( | ) | const |
Check if the current state of this agreement is REJECTED.
Definition at line 51 of file originator-block-ack-agreement.cc.
bool ns3::OriginatorBlockAckAgreement::IsReset | ( | ) | const |
Check if the current state of this agreement is RESET.
Definition at line 63 of file originator-block-ack-agreement.cc.
Record that the given MPDU has been acknowledged and advance the transmit window if possible.
mpdu | the acknowledged MPDU |
Definition at line 151 of file originator-block-ack-agreement.cc.
References AdvanceTxWindow(), ns3::BlockAckWindow::At(), GetDistance(), ns3::BlockAckWindow::GetWinStart(), m_txWindow, NS_LOG_DEBUG, and ns3::SEQNO_SPACE_HALF_SIZE.
Referenced by OriginatorBlockAckWindowTest::DoRun().
Advance the transmit window beyond the MPDU that has been reported to be discarded.
mpdu | the discarded MPDU |
Definition at line 174 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::Advance(), AdvanceTxWindow(), GetDistance(), ns3::BlockAckWindow::GetWinStart(), m_txWindow, NS_LOG_DEBUG, and ns3::SEQNO_SPACE_HALF_SIZE.
Referenced by OriginatorBlockAckWindowTest::DoRun().
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet and is beyond the current transmit window.
mpdu | the transmitted MPDU |
Definition at line 125 of file originator-block-ack-agreement.cc.
References ns3::BlockAckWindow::Advance(), AdvanceTxWindow(), GetDistance(), ns3::BlockAckWindow::GetWinSize(), ns3::BlockAckWindow::GetWinStart(), m_txWindow, NS_LOG_DEBUG, and ns3::SEQNO_SPACE_HALF_SIZE.
Referenced by OriginatorBlockAckWindowTest::DoRun().
void ns3::OriginatorBlockAckAgreement::SetState | ( | State | state | ) |
Set the current state.
state | to set |
Definition at line 33 of file originator-block-ack-agreement.cc.
References m_state.
Referenced by ns3::BlockAckManager::CreateOriginatorAgreement(), and ns3::BlockAckManager::UpdateOriginatorAgreement().
|
friend |
allow OriginatorBlockAckWindowTest class access
Definition at line 60 of file originator-block-ack-agreement.h.
|
friend |
allow BlockAckManager class access
Definition at line 58 of file originator-block-ack-agreement.h.
|
private |
state
Definition at line 212 of file originator-block-ack-agreement.h.
Referenced by IsEstablished(), IsNoReply(), IsPending(), IsRejected(), IsReset(), and SetState().
|
private |
originator's transmit window
Definition at line 213 of file originator-block-ack-agreement.h.
Referenced by AdvanceTxWindow(), AllAckedMpdusInTxWindow(), OriginatorBlockAckWindowTest::DoRun(), GetDistance(), GetStartingSequence(), InitTxWindow(), NotifyAckedMpdu(), NotifyDiscardedMpdu(), and NotifyTransmittedMpdu().