A Discrete-Event Network Simulator
API
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ns3::BlockAckManager Class Reference

Manages all block ack agreements for an originator station. More...

#include "block-ack-manager.h"

+ Inheritance diagram for ns3::BlockAckManager:

Classes

struct  Item
 A struct for packet, Wifi header, and timestamp. More...
 

Public Types

typedef Callback< void, const WifiMacHeader & > TxFailed
 typedef for a callback to invoke when a packet transmission was failed. More...
 
typedef Callback< void, const WifiMacHeader & > TxOk
 typedef for a callback to invoke when a packet transmission was completed successfully. More...
 

Public Member Functions

 BlockAckManager ()
 
 ~BlockAckManager ()
 
bool AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid) const
 Checks if the packet already exists in the retransmit queue or not if it does then it doesn't add it again. More...
 
void CompleteAmpduExchange (Mac48Address recipient, uint8_t tid)
 
void CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
 
void DestroyAgreement (Mac48Address recipient, uint8_t tid)
 
bool ExistsAgreement (Mac48Address recipient, uint8_t tid) const
 
bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid, OriginatorBlockAckAgreement::State state) const
 
uint32_t GetNBufferedPackets (Mac48Address recipient, uint8_t tid) const
 
Ptr< const PacketGetNextPacket (WifiMacHeader &hdr, bool removePacket)
 
uint32_t GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
 
uint16_t GetSeqNumOfNextRetryPacket (Mac48Address recipient, uint8_t tid) const
 
bool HasBar (Bar &bar)
 Returns true if the BAR is scheduled. More...
 
bool HasPackets (void) const
 Returns true if there are packets that need of retransmission or at least a BAR is scheduled. More...
 
bool NeedBarRetransmission (uint8_t tid, uint16_t seqNumber, Mac48Address recipient)
 This function returns true if the lifetime of the packets a BAR refers to didn't expire yet else it returns false. More...
 
void NotifyAgreementEstablished (Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
 
void NotifyAgreementUnsuccessful (Mac48Address recipient, uint8_t tid)
 
void NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
 
void NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, WifiMacHeader::QosAckPolicy policy)
 
Ptr< const PacketPeekNextPacketByTidAndAddress (WifiMacHeader &hdr, uint8_t tid, Time *timestamp)
 Peek in retransmit queue and get the next packet having address indicated by type equals to addr, and tid equals to tid. More...
 
bool RemovePacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
 Remove a packet after you peek in the queue and get it. More...
 
void SetBlockAckInactivityCallback (Callback< void, Mac48Address, uint8_t, bool > callback)
 Set block ack inactivity callback. More...
 
void SetBlockAckThreshold (uint8_t nPackets)
 
void SetBlockAckType (BlockAckType bAckType)
 
void SetBlockDestinationCallback (Callback< void, Mac48Address, uint8_t > callback)
 Set block destination callback. More...
 
void SetMaxPacketDelay (Time maxDelay)
 
void SetQueue (const Ptr< WifiMacQueue > queue)
 
void SetTxFailedCallback (TxFailed callback)
 
void SetTxMiddle (const Ptr< MacTxMiddle > txMiddle)
 Set the MacTxMiddle. More...
 
void SetTxOkCallback (TxOk callback)
 
void SetUnblockDestinationCallback (Callback< void, Mac48Address, uint8_t > callback)
 Set unblock destination callback. More...
 
void SetWifiRemoteStationManager (const Ptr< WifiRemoteStationManager > manager)
 Set up WifiRemoteStationManager associated with this BlockAckManager. More...
 
void StorePacket (Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp)
 
bool SwitchToBlockAckIfNeeded (Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
 
void UpdateAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Types

typedef std::map< std::pair< Mac48Address, uint8_t >, std::pair< OriginatorBlockAckAgreement, PacketQueue > > Agreements
 typedef for a map between MAC address and block ACK agreement. More...
 
typedef std::map< std::pair< Mac48Address, uint8_t >, std::pair< OriginatorBlockAckAgreement, PacketQueue > >::const_iterator AgreementsCI
 typedef for a const iterator for Agreements. More...
 
typedef std::map< std::pair< Mac48Address, uint8_t >, std::pair< OriginatorBlockAckAgreement, PacketQueue > >::iterator AgreementsI
 typedef for an iterator for Agreements. More...
 
typedef std::list< ItemPacketQueue
 typedef for a list of Item struct. More...
 
typedef std::list< Item >::const_iterator PacketQueueCI
 typedef for a const iterator for PacketQueue. More...
 
typedef std::list< Item >::iterator PacketQueueI
 typedef for an iterator for PacketQueue. More...
 

Private Member Functions

 BlockAckManager (const BlockAckManager &)
 type conversion operator More...
 
void CleanupBuffers (void)
 This method removes packets whose lifetime was exceeded. More...
 
void InactivityTimeout (Mac48Address recipient, uint8_t tid)
 Inactivity timeout function. More...
 
void InsertInRetryQueue (PacketQueueI item)
 
BlockAckManageroperator= (const BlockAckManager &block)
 assignment operator More...
 
void RemoveFromRetryQueue (Mac48Address address, uint8_t tid, uint16_t seq)
 Remove items from retransmission queue. More...
 
Ptr< PacketScheduleBlockAckReqIfNeeded (Mac48Address recipient, uint8_t tid)
 

Private Attributes

Mac48Address m_address
 address More...
 
Agreements m_agreements
 This data structure contains, for each block ack agreement (recipient, tid), a set of packets for which an ack by block ack is requested. More...
 
std::list< Barm_bars
 list of BARs More...
 
Callback< void, Mac48Address, uint8_t, bool > m_blockAckInactivityTimeout
 block ack inactivity timeout callback More...
 
uint8_t m_blockAckThreshold
 block ack threshold More...
 
BlockAckType m_blockAckType
 block ack type More...
 
Callback< void, Mac48Address, uint8_t > m_blockPackets
 block packets callback More...
 
Time m_maxDelay
 maximum delay More...
 
Ptr< WifiMacQueuem_queue
 queue More...
 
std::list< PacketQueueIm_retryPackets
 This list contains all iterators to stored packets that need to be retransmitted. More...
 
Ptr< WifiRemoteStationManagerm_stationManager
 the station manager More...
 
TxFailed m_txFailedCallback
 transmit failed callback More...
 
Ptr< MacTxMiddlem_txMiddle
 the MacTxMiddle More...
 
TxOk m_txOkCallback
 transmit ok callback More...
 
Callback< void, Mac48Address, uint8_t > m_unblockPackets
 unblock packets callback More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

Manages all block ack agreements for an originator station.


Introspection did not find any typical Config paths.


No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 192 bytes (on a 64-bit architecture).

Definition at line 73 of file block-ack-manager.h.

Member Typedef Documentation

◆ Agreements

typedef std::map<std::pair<Mac48Address, uint8_t>, std::pair<OriginatorBlockAckAgreement, PacketQueue> > ns3::BlockAckManager::Agreements
private

typedef for a map between MAC address and block ACK agreement.

Definition at line 429 of file block-ack-manager.h.

◆ AgreementsCI

typedef std::map<std::pair<Mac48Address, uint8_t>, std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator ns3::BlockAckManager::AgreementsCI
private

typedef for a const iterator for Agreements.

Definition at line 439 of file block-ack-manager.h.

◆ AgreementsI

typedef std::map<std::pair<Mac48Address, uint8_t>, std::pair<OriginatorBlockAckAgreement, PacketQueue> >::iterator ns3::BlockAckManager::AgreementsI
private

typedef for an iterator for Agreements.

Definition at line 434 of file block-ack-manager.h.

◆ PacketQueue

typedef for a list of Item struct.

Definition at line 412 of file block-ack-manager.h.

◆ PacketQueueCI

typedef std::list<Item>::const_iterator ns3::BlockAckManager::PacketQueueCI
private

typedef for a const iterator for PacketQueue.

Definition at line 424 of file block-ack-manager.h.

◆ PacketQueueI

typedef for an iterator for PacketQueue.

Definition at line 420 of file block-ack-manager.h.

◆ TxFailed

typedef for a callback to invoke when a packet transmission was failed.

Definition at line 374 of file block-ack-manager.h.

◆ TxOk

typedef for a callback to invoke when a packet transmission was completed successfully.

Definition at line 369 of file block-ack-manager.h.

Constructor & Destructor Documentation

◆ BlockAckManager() [1/2]

ns3::BlockAckManager::BlockAckManager ( const BlockAckManager )
private

type conversion operator

◆ BlockAckManager() [2/2]

ns3::BlockAckManager::BlockAckManager ( )

Definition at line 70 of file block-ack-manager.cc.

References NS_LOG_FUNCTION.

◆ ~BlockAckManager()

ns3::BlockAckManager::~BlockAckManager ( )

Definition at line 75 of file block-ack-manager.cc.

References m_agreements, m_queue, m_retryPackets, and NS_LOG_FUNCTION.

Member Function Documentation

◆ AlreadyExists()

bool ns3::BlockAckManager::AlreadyExists ( uint16_t  currentSeq,
Mac48Address  recipient,
uint8_t  tid 
) const

Checks if the packet already exists in the retransmit queue or not if it does then it doesn't add it again.

Parameters
currentSeqthe current sequence
recipientthe destination address
tidthe Traffic ID
Returns
true if the packet already exists

Definition at line 516 of file block-ack-manager.cc.

References m_retryPackets, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by NotifyGotBlockAck().

◆ CleanupBuffers()

void ns3::BlockAckManager::CleanupBuffers ( void  )
private

This method removes packets whose lifetime was exceeded.

Definition at line 828 of file block-ack-manager.cc.

References m_agreements, m_maxDelay, ns3::Simulator::Now(), NS_LOG_FUNCTION, and RemoveFromRetryQueue().

Referenced by GetNextPacket(), NeedBarRetransmission(), and PeekNextPacketByTidAndAddress().

◆ CompleteAmpduExchange()

void ns3::BlockAckManager::CompleteAmpduExchange ( Mac48Address  recipient,
uint8_t  tid 
)
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID of transmitted packet.

This method to set the number of packets waiting for blockAck = 0 since the receiver will send the blockAck right away

Definition at line 244 of file block-ack-manager.cc.

References ns3::OriginatorBlockAckAgreement::CompleteExchange(), m_agreements, and NS_ASSERT.

◆ CreateAgreement()

void ns3::BlockAckManager::CreateAgreement ( const MgtAddBaRequestHeader reqHdr,
Mac48Address  recipient 
)
Parameters
reqHdrRelative Add block ack request (action frame).
recipientAddress of peer station involved in block ack mechanism.

Creates a new block ack agreement in pending state. When a ADDBA response with a successful status code is received, the relative agreement becomes established.

Definition at line 117 of file block-ack-manager.cc.

References ns3::MgtAddBaRequestHeader::GetStartingSequence(), ns3::MgtAddBaRequestHeader::GetTid(), ns3::MgtAddBaRequestHeader::GetTimeout(), ns3::WifiRemoteStationManager::HasHtSupported(), ns3::MgtAddBaRequestHeader::IsAmsduSupported(), ns3::MgtAddBaRequestHeader::IsImmediateBlockAck(), m_agreements, m_blockPackets, m_stationManager, NS_LOG_FUNCTION, ns3::OriginatorBlockAckAgreement::PENDING, and ns3::BlockAckAgreement::SetStartingSequence().

◆ DestroyAgreement()

void ns3::BlockAckManager::DestroyAgreement ( Mac48Address  recipient,
uint8_t  tid 
)
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTid Traffic id of transmitted packet.

Invoked when a recipient reject a block ack agreement or when a Delba frame is Received/Transmitted.

Definition at line 146 of file block-ack-manager.cc.

References m_agreements, m_bars, m_retryPackets, and NS_LOG_FUNCTION.

◆ ExistsAgreement()

bool ns3::BlockAckManager::ExistsAgreement ( Mac48Address  recipient,
uint8_t  tid 
) const
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID.
Returns
true if a block ack agreement exists, false otherwise

Checks if a block ack agreement exists with station addressed by recipient for tid tid.

Definition at line 84 of file block-ack-manager.cc.

References m_agreements, and NS_LOG_FUNCTION.

Referenced by GetNRetryNeededPackets(), and SwitchToBlockAckIfNeeded().

◆ ExistsAgreementInState()

bool ns3::BlockAckManager::ExistsAgreementInState ( Mac48Address  recipient,
uint8_t  tid,
OriginatorBlockAckAgreement::State  state 
) const
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID.
stateThe state for block ack agreement
Returns
true if a block ack agreement exists, false otherwise

Checks if a block ack agreement with a state equals to state exists with station addressed by recipient for tid tid.

Definition at line 91 of file block-ack-manager.cc.

References ns3::OriginatorBlockAckAgreement::ESTABLISHED, ns3::OriginatorBlockAckAgreement::INACTIVE, m_agreements, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::OriginatorBlockAckAgreement::PENDING, and ns3::OriginatorBlockAckAgreement::UNSUCCESSFUL.

Referenced by GetNextPacket(), NotifyGotBlockAck(), PeekNextPacketByTidAndAddress(), and SwitchToBlockAckIfNeeded().

◆ GetNBufferedPackets()

uint32_t ns3::BlockAckManager::GetNBufferedPackets ( Mac48Address  recipient,
uint8_t  tid 
) const
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID.
Returns
the number of packets buffered for a specified agreement

Returns number of packets buffered for a specified agreement. This methods doesn't return number of buffered MPDUs but number of buffered MSDUs.

Definition at line 443 of file block-ack-manager.cc.

References m_agreements, and NS_LOG_FUNCTION.

Referenced by SwitchToBlockAckIfNeeded().

◆ GetNextPacket()

Ptr< const Packet > ns3::BlockAckManager::GetNextPacket ( WifiMacHeader hdr,
bool  removePacket 
)
Parameters
hdr802.11 header of returned packet (if exists).
removePacketflag to indicate whether the packet should be removed from the queue.
Returns
the packet

This methods returns a packet (if exists) indicated as not received in corresponding block ack bitmap.

Definition at line 253 of file block-ack-manager.cc.

References ns3::WifiMacHeader::BLOCK_ACK, CleanupBuffers(), ns3::Packet::Copy(), ns3::OriginatorBlockAckAgreement::ESTABLISHED, ExistsAgreementInState(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetQosTid(), ns3::WifiMacHeader::GetSequenceNumber(), ns3::WifiMacHeader::IsQosData(), m_agreements, m_retryPackets, ns3::WifiMacHeader::NORMAL_ACK, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::QosUtilsIsOldPacket(), ns3::WifiMacHeader::SetQosAckPolicy(), ns3::WifiMacHeader::SetRetry(), and SwitchToBlockAckIfNeeded().

◆ GetNRetryNeededPackets()

uint32_t ns3::BlockAckManager::GetNRetryNeededPackets ( Mac48Address  recipient,
uint8_t  tid 
) const
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID.
Returns
the number of packets for a specific agreement that need retransmission

Returns number of packets for a specific agreement that need retransmission. This method doesn't return number of MPDUs that need retransmission but number of MSDUs.

Definition at line 467 of file block-ack-manager.cc.

References ExistsAgreement(), m_retryPackets, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by NotifyMpduTransmission(), and ScheduleBlockAckReqIfNeeded().

◆ GetSeqNumOfNextRetryPacket()

uint16_t ns3::BlockAckManager::GetSeqNumOfNextRetryPacket ( Mac48Address  recipient,
uint8_t  tid 
) const
Parameters
recipientthe destination address
tidthe Traffic ID
Returns
the sequence number of the next retry packet for a specific agreement

Returns the sequence number of the next retry packet for a specific agreement. If there are no packets that need retransmission for the specified agreement or the agreement doesn't exist the function returns 4096;

Definition at line 894 of file block-ack-manager.cc.

References m_retryPackets, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by NotifyMpduTransmission().

◆ GetTypeId()

TypeId ns3::BlockAckManager::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 60 of file block-ack-manager.cc.

References ns3::TypeId::SetParent().

◆ HasBar()

bool ns3::BlockAckManager::HasBar ( Bar bar)

Returns true if the BAR is scheduled.

Returns false otherwise.

Parameters
bar
Returns
true if a BAR is scheduled, false otherwise

Definition at line 423 of file block-ack-manager.cc.

References m_bars, and NS_LOG_FUNCTION.

◆ HasPackets()

bool ns3::BlockAckManager::HasPackets ( void  ) const

Returns true if there are packets that need of retransmission or at least a BAR is scheduled.

Returns false otherwise.

Returns
true if there are packets that need of retransmission or at least a BAR is scheduled, false otherwise

Definition at line 436 of file block-ack-manager.cc.

References m_bars, m_retryPackets, and NS_LOG_FUNCTION.

◆ InactivityTimeout()

void ns3::BlockAckManager::InactivityTimeout ( Mac48Address  recipient,
uint8_t  tid 
)
private

Inactivity timeout function.

Parameters
recipientthe recipient MAC address
tidTraffic ID

Definition at line 696 of file block-ack-manager.cc.

References m_blockAckInactivityTimeout, and NS_LOG_FUNCTION.

Referenced by NotifyGotBlockAck(), and UpdateAgreement().

◆ InsertInRetryQueue()

void ns3::BlockAckManager::InsertInRetryQueue ( PacketQueueI  item)
private
Parameters
itemInsert item in retransmission queue. This method ensures packets are retransmitted in the correct order.

Definition at line 926 of file block-ack-manager.cc.

References m_retryPackets, and NS_LOG_INFO.

Referenced by NotifyGotBlockAck().

◆ NeedBarRetransmission()

bool ns3::BlockAckManager::NeedBarRetransmission ( uint8_t  tid,
uint16_t  seqNumber,
Mac48Address  recipient 
)

This function returns true if the lifetime of the packets a BAR refers to didn't expire yet else it returns false.

If it return false then the BAR will be discarded (i.e. will not be re-transmitted)

Parameters
tidTraffic ID
seqNumbersequence number
recipientMAC address
Returns
true if BAR retransmission needed

Definition at line 777 of file block-ack-manager.cc.

References CleanupBuffers(), m_agreements, and NS_ASSERT.

◆ NotifyAgreementEstablished()

void ns3::BlockAckManager::NotifyAgreementEstablished ( Mac48Address  recipient,
uint8_t  tid,
uint16_t  startingSeq 
)
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID of transmitted packet.
startingSeqstarting sequence field

Puts corresponding agreement in established state and updates number of packets and starting sequence field. Invoked typically after a block ack refresh.

Definition at line 703 of file block-ack-manager.cc.

References ns3::OriginatorBlockAckAgreement::ESTABLISHED, m_agreements, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by SwitchToBlockAckIfNeeded().

◆ NotifyAgreementUnsuccessful()

void ns3::BlockAckManager::NotifyAgreementUnsuccessful ( Mac48Address  recipient,
uint8_t  tid 
)
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID of transmitted packet.

Marks an agreement as unsuccessful. This happens if recipient station reject block ack setup by an ADDBA Response frame with a failure status code. For now we assume that every QoS station accepts a block ack setup.

Definition at line 713 of file block-ack-manager.cc.

References m_agreements, NS_ASSERT, NS_LOG_FUNCTION, and ns3::OriginatorBlockAckAgreement::UNSUCCESSFUL.

◆ NotifyGotBlockAck()

void ns3::BlockAckManager::NotifyGotBlockAck ( const CtrlBAckResponseHeader blockAck,
Mac48Address  recipient,
double  rxSnr,
WifiMode  txMode,
double  dataSnr 
)
Parameters
blockAckThe received block ack frame.
recipientSender of block ack frame.
rxSnrreceived SNR of the block ack frame itself
txModemode of block ack frame.
dataSnrdata SNR reported by remote station

Invoked upon receipt of a block ack frame. Typically, this function, is called by ns3::QosTxop object. Performs a check on which MPDUs, previously sent with ack policy set to Block Ack, were correctly received by the recipient. An acknowledged MPDU is removed from the buffer, retransmitted otherwise.

Definition at line 536 of file block-ack-manager.cc.

References AlreadyExists(), ns3::OriginatorBlockAckAgreement::ESTABLISHED, ExistsAgreementInState(), ns3::MacTxMiddle::GetNextSeqNumberByTidAndAddress(), ns3::CtrlBAckResponseHeader::GetTidInfo(), ns3::WifiMode::GetUniqueName(), InactivityTimeout(), InsertInRetryQueue(), ns3::CtrlBAckResponseHeader::IsBasic(), ns3::CtrlBAckResponseHeader::IsCompressed(), ns3::CtrlBAckResponseHeader::IsFragmentReceived(), ns3::CtrlBAckResponseHeader::IsMultiTid(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), ns3::CtrlBAckResponseHeader::IsPacketReceived(), m_agreements, m_stationManager, m_txFailedCallback, m_txMiddle, m_txOkCallback, ns3::MicroSeconds(), NS_FATAL_ERROR, NS_LOG_FUNCTION, RemoveFromRetryQueue(), ns3::WifiRemoteStationManager::ReportAmpduTxStatus(), ns3::Simulator::Schedule(), SwitchToBlockAckIfNeeded(), and timeout.

◆ NotifyMpduTransmission()

void ns3::BlockAckManager::NotifyMpduTransmission ( Mac48Address  recipient,
uint8_t  tid,
uint16_t  nextSeqNumber,
WifiMacHeader::QosAckPolicy  policy 
)
Parameters
recipientAddress of peer station involved in block ack mechanism.
tidTraffic ID of transmitted packet.
nextSeqNumberSequence number of the next packet that would be trasmitted by QosTxop.
policyack policy of the transmitted packet.

This method is typically invoked by ns3::QosTxop object every time that a MPDU with ack policy subfield in Qos Control field set to Block Ack is transmitted. The nextSeqNumber parameter is used to block transmission of packets that are out of bitmap.

Definition at line 725 of file block-ack-manager.cc.

References ns3::WifiMacHeader::BLOCK_ACK, GetNRetryNeededPackets(), GetSeqNumOfNextRetryPacket(), m_agreements, m_bars, NS_ASSERT, NS_LOG_FUNCTION, and ScheduleBlockAckReqIfNeeded().

◆ operator=()

BlockAckManager& ns3::BlockAckManager::operator= ( const BlockAckManager block)
private

assignment operator

Parameters
blockBlockAckManager to assign
Returns
the assigned BlockAckManager

◆ PeekNextPacketByTidAndAddress()

Ptr< const Packet > ns3::BlockAckManager::PeekNextPacketByTidAndAddress ( WifiMacHeader hdr,
uint8_t  tid,
Time timestamp 
)

Peek in retransmit queue and get the next packet having address indicated by type equals to addr, and tid equals to tid.

This method doesn't remove the packet from this queue.

Parameters
hdrwifi mac header
tidTraffic ID
timestamptimestamp
Returns
Ptr<const Packet>

Definition at line 339 of file block-ack-manager.cc.

References ns3::WifiMacHeader::BLOCK_ACK, CleanupBuffers(), ns3::Packet::Copy(), ns3::OriginatorBlockAckAgreement::ESTABLISHED, ExistsAgreementInState(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetSequenceNumber(), m_agreements, m_retryPackets, ns3::WifiMacHeader::NORMAL_ACK, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::QosUtilsIsOldPacket(), ns3::WifiMacHeader::SetQosAckPolicy(), ns3::WifiMacHeader::SetRetry(), and SwitchToBlockAckIfNeeded().

◆ RemoveFromRetryQueue()

void ns3::BlockAckManager::RemoveFromRetryQueue ( Mac48Address  address,
uint8_t  tid,
uint16_t  seq 
)
private

Remove items from retransmission queue.

This method should be called when packets are acknowledged.

Parameters
addressrecipient mac address of the packet to be removed
tidTraffic ID of the packet to be removed
seqsequence number of the packet to be removed

Definition at line 808 of file block-ack-manager.cc.

References first::address, and m_retryPackets.

Referenced by CleanupBuffers(), and NotifyGotBlockAck().

◆ RemovePacket()

bool ns3::BlockAckManager::RemovePacket ( uint8_t  tid,
Mac48Address  recipient,
uint16_t  seqnumber 
)

Remove a packet after you peek in the queue and get it.

Parameters
tidthe Traffic ID
recipientthe destination address
seqnumbersequence number
Returns
true if a packet was removed

Definition at line 399 of file block-ack-manager.cc.

References ns3::WifiMacHeader::GetSequenceNumber(), m_agreements, m_retryPackets, NS_FATAL_ERROR, and NS_LOG_DEBUG.

◆ ScheduleBlockAckReqIfNeeded()

Ptr< Packet > ns3::BlockAckManager::ScheduleBlockAckReqIfNeeded ( Mac48Address  recipient,
uint8_t  tid 
)
private
Parameters
recipient
tid
Returns
a packet

Checks if all packets, for which a block ack agreement was established or refreshed, have been transmitted. If yes, adds a pair in m_bAckReqs to indicate that at next channel access a block ack request (for established agreement recipient,tid) is needed.

Definition at line 655 of file block-ack-manager.cc.

References ns3::Packet::AddHeader(), ns3::BASIC_BLOCK_ACK, ns3::OriginatorBlockAckAgreement::CompleteExchange(), ns3::COMPRESSED_BLOCK_ACK, GetNRetryNeededPackets(), ns3::BlockAckAgreement::GetStartingSequence(), ns3::BlockAckAgreement::GetTid(), m_agreements, m_blockAckType, m_queue, ns3::MULTI_TID_BLOCK_ACK, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::CtrlBAckRequestHeader::SetStartingSequence(), ns3::CtrlBAckRequestHeader::SetTidInfo(), and ns3::CtrlBAckRequestHeader::SetType().

Referenced by NotifyMpduTransmission().

◆ SetBlockAckInactivityCallback()

void ns3::BlockAckManager::SetBlockAckInactivityCallback ( Callback< void, Mac48Address, uint8_t, bool >  callback)

Set block ack inactivity callback.

Parameters
callbackthe block ack inactivity callback function

Definition at line 866 of file block-ack-manager.cc.

References m_blockAckInactivityTimeout, and NS_LOG_FUNCTION.

◆ SetBlockAckThreshold()

void ns3::BlockAckManager::SetBlockAckThreshold ( uint8_t  nPackets)
Parameters
nPacketsMinimum number of packets for use of block ack.

Upon receipt of a block ack frame, if total number of packets (packets in WifiMacQueue and buffered packets) is greater of nPackets, they are transmitted using block ack mechanism.

Definition at line 502 of file block-ack-manager.cc.

References m_blockAckThreshold, and NS_LOG_FUNCTION.

◆ SetBlockAckType()

void ns3::BlockAckManager::SetBlockAckType ( BlockAckType  bAckType)
Parameters
bAckTypeType of block ack

See ctrl-headers.h for more details.

Definition at line 648 of file block-ack-manager.cc.

References m_blockAckType, and NS_LOG_FUNCTION.

◆ SetBlockDestinationCallback()

void ns3::BlockAckManager::SetBlockDestinationCallback ( Callback< void, Mac48Address, uint8_t >  callback)

Set block destination callback.

Parameters
callbackthe block destination callback

Definition at line 873 of file block-ack-manager.cc.

References m_blockPackets, and NS_LOG_FUNCTION.

◆ SetMaxPacketDelay()

void ns3::BlockAckManager::SetMaxPacketDelay ( Time  maxDelay)
Parameters
maxDelayMax delay for a buffered packet.

This method is always called by ns3::WifiMacQueue object and sets max delay equals to ns3:WifiMacQueue delay value.

Definition at line 859 of file block-ack-manager.cc.

References m_maxDelay, and NS_LOG_FUNCTION.

◆ SetQueue()

void ns3::BlockAckManager::SetQueue ( const Ptr< WifiMacQueue queue)
Parameters
queueThe WifiMacQueue object.

Definition at line 753 of file block-ack-manager.cc.

References m_queue, and NS_LOG_FUNCTION.

◆ SetTxFailedCallback()

void ns3::BlockAckManager::SetTxFailedCallback ( TxFailed  callback)
Parameters
callbackthe callback to invoke when a packet transmission was completed unsuccessfully.

Definition at line 920 of file block-ack-manager.cc.

References m_txFailedCallback.

◆ SetTxMiddle()

void ns3::BlockAckManager::SetTxMiddle ( const Ptr< MacTxMiddle txMiddle)

Set the MacTxMiddle.

Parameters
txMiddlethe MacTxMiddle

Definition at line 887 of file block-ack-manager.cc.

References m_txMiddle, and NS_LOG_FUNCTION.

◆ SetTxOkCallback()

void ns3::BlockAckManager::SetTxOkCallback ( TxOk  callback)
Parameters
callbackthe callback to invoke when a packet transmission was completed successfully.

Definition at line 914 of file block-ack-manager.cc.

References m_txOkCallback.

◆ SetUnblockDestinationCallback()

void ns3::BlockAckManager::SetUnblockDestinationCallback ( Callback< void, Mac48Address, uint8_t >  callback)

Set unblock destination callback.

Parameters
callbackthe unblock destination callback

Definition at line 880 of file block-ack-manager.cc.

References m_unblockPackets, and NS_LOG_FUNCTION.

◆ SetWifiRemoteStationManager()

void ns3::BlockAckManager::SetWifiRemoteStationManager ( const Ptr< WifiRemoteStationManager manager)

Set up WifiRemoteStationManager associated with this BlockAckManager.

Parameters
managerWifiRemoteStationManager associated with this BlockAckManager

Definition at line 509 of file block-ack-manager.cc.

References m_stationManager, and NS_LOG_FUNCTION.

◆ StorePacket()

void ns3::BlockAckManager::StorePacket ( Ptr< const Packet packet,
const WifiMacHeader hdr,
Time  tStamp 
)
Parameters
packetPacket to store.
hdr802.11 header for packet.
tStamptime stamp for packet

Stores packet for a possible future retransmission. Retransmission occurs if the packet, in a block ack frame, is indicated by recipient as not received.

Definition at line 213 of file block-ack-manager.cc.

References ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetQosTid(), ns3::WifiMacHeader::GetSequenceNumber(), ns3::WifiMacHeader::IsQosData(), m_agreements, NS_ASSERT, and NS_LOG_FUNCTION.

◆ SwitchToBlockAckIfNeeded()

bool ns3::BlockAckManager::SwitchToBlockAckIfNeeded ( Mac48Address  recipient,
uint8_t  tid,
uint16_t  startingSeq 
)
Parameters
recipientthe destination address
tidthe Traffic ID
startingSeq
Returns
true if there are packets in the queue that could be sent under block ACK, false otherwise

Checks if there are in the queue other packets that could be send under block ack. If yes adds these packets in current block ack exchange. However, number of packets exchanged in the current block ack, will not exceed the value of BufferSize in the corresponding OriginatorBlockAckAgreement object.

Definition at line 760 of file block-ack-manager.cc.

References ExistsAgreement(), ExistsAgreementInState(), GetNBufferedPackets(), m_blockAckThreshold, m_queue, NotifyAgreementEstablished(), NS_ASSERT, NS_LOG_FUNCTION, ns3::OriginatorBlockAckAgreement::PENDING, and ns3::OriginatorBlockAckAgreement::UNSUCCESSFUL.

Referenced by GetNextPacket(), NotifyGotBlockAck(), and PeekNextPacketByTidAndAddress().

◆ UpdateAgreement()

void ns3::BlockAckManager::UpdateAgreement ( const MgtAddBaResponseHeader respHdr,
Mac48Address  recipient 
)

Member Data Documentation

◆ m_address

Mac48Address ns3::BlockAckManager::m_address
private

address

Definition at line 499 of file block-ack-manager.h.

◆ m_agreements

Agreements ns3::BlockAckManager::m_agreements
private

This data structure contains, for each block ack agreement (recipient, tid), a set of packets for which an ack by block ack is requested.

Every packet or fragment indicated as correctly received in block ack frame is erased from this data structure. Pushed back in retransmission queue otherwise.

Definition at line 485 of file block-ack-manager.h.

Referenced by CleanupBuffers(), CompleteAmpduExchange(), CreateAgreement(), DestroyAgreement(), ExistsAgreement(), ExistsAgreementInState(), GetNBufferedPackets(), GetNextPacket(), NeedBarRetransmission(), NotifyAgreementEstablished(), NotifyAgreementUnsuccessful(), NotifyGotBlockAck(), NotifyMpduTransmission(), PeekNextPacketByTidAndAddress(), RemovePacket(), ScheduleBlockAckReqIfNeeded(), StorePacket(), UpdateAgreement(), and ~BlockAckManager().

◆ m_bars

std::list<Bar> ns3::BlockAckManager::m_bars
private

list of BARs

Definition at line 493 of file block-ack-manager.h.

Referenced by DestroyAgreement(), HasBar(), HasPackets(), and NotifyMpduTransmission().

◆ m_blockAckInactivityTimeout

Callback<void, Mac48Address, uint8_t, bool> ns3::BlockAckManager::m_blockAckInactivityTimeout
private

block ack inactivity timeout callback

Definition at line 501 of file block-ack-manager.h.

Referenced by InactivityTimeout(), and SetBlockAckInactivityCallback().

◆ m_blockAckThreshold

uint8_t ns3::BlockAckManager::m_blockAckThreshold
private

block ack threshold

Definition at line 495 of file block-ack-manager.h.

Referenced by SetBlockAckThreshold(), and SwitchToBlockAckIfNeeded().

◆ m_blockAckType

BlockAckType ns3::BlockAckManager::m_blockAckType
private

block ack type

Definition at line 496 of file block-ack-manager.h.

Referenced by ScheduleBlockAckReqIfNeeded(), and SetBlockAckType().

◆ m_blockPackets

Callback<void, Mac48Address, uint8_t> ns3::BlockAckManager::m_blockPackets
private

block packets callback

Definition at line 502 of file block-ack-manager.h.

Referenced by CreateAgreement(), and SetBlockDestinationCallback().

◆ m_maxDelay

Time ns3::BlockAckManager::m_maxDelay
private

maximum delay

Definition at line 497 of file block-ack-manager.h.

Referenced by CleanupBuffers(), and SetMaxPacketDelay().

◆ m_queue

Ptr<WifiMacQueue> ns3::BlockAckManager::m_queue
private

◆ m_retryPackets

std::list<PacketQueueI> ns3::BlockAckManager::m_retryPackets
private

This list contains all iterators to stored packets that need to be retransmitted.

A packet needs retransmission if it's indicated as not correctly received in a block ack frame.

Definition at line 492 of file block-ack-manager.h.

Referenced by AlreadyExists(), DestroyAgreement(), GetNextPacket(), GetNRetryNeededPackets(), GetSeqNumOfNextRetryPacket(), HasPackets(), InsertInRetryQueue(), PeekNextPacketByTidAndAddress(), RemoveFromRetryQueue(), RemovePacket(), and ~BlockAckManager().

◆ m_stationManager

Ptr<WifiRemoteStationManager> ns3::BlockAckManager::m_stationManager
private

the station manager

Definition at line 506 of file block-ack-manager.h.

Referenced by CreateAgreement(), NotifyGotBlockAck(), and SetWifiRemoteStationManager().

◆ m_txFailedCallback

TxFailed ns3::BlockAckManager::m_txFailedCallback
private

transmit failed callback

Definition at line 505 of file block-ack-manager.h.

Referenced by NotifyGotBlockAck(), and SetTxFailedCallback().

◆ m_txMiddle

Ptr<MacTxMiddle> ns3::BlockAckManager::m_txMiddle
private

the MacTxMiddle

Definition at line 498 of file block-ack-manager.h.

Referenced by NotifyGotBlockAck(), and SetTxMiddle().

◆ m_txOkCallback

TxOk ns3::BlockAckManager::m_txOkCallback
private

transmit ok callback

Definition at line 504 of file block-ack-manager.h.

Referenced by NotifyGotBlockAck(), and SetTxOkCallback().

◆ m_unblockPackets

Callback<void, Mac48Address, uint8_t> ns3::BlockAckManager::m_unblockPackets
private

unblock packets callback

Definition at line 503 of file block-ack-manager.h.

Referenced by SetUnblockDestinationCallback(), and UpdateAgreement().


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