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

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

#include "block-ack-manager.h"

+ Inheritance diagram for ns3::BlockAckManager:
+ Collaboration diagram for ns3::BlockAckManager:

Public Types

using AgreementKey = std::pair< Mac48Address, uint8_t >
 agreement key typedef (MAC address and TID) More...
 
typedef void(* AgreementStateTracedCallback) (Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
 TracedCallback signature for state changes. More...
 
typedef Callback< void, Ptr< const WifiMpdu > > DroppedOldMpdu
 typedef for a callback to invoke when an MPDU is dropped. More...
 
using OriginatorAgreementOptConstRef = std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > >
 optional const reference to OriginatorBlockAckAgreement More...
 
using RecipientAgreementOptConstRef = std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > >
 optional const reference to RecipientBlockAckAgreement More...
 
typedef Callback< void, Ptr< const WifiMpdu > > TxFailed
 typedef for a callback to invoke when an MPDU is negatively ack'ed. More...
 
typedef Callback< void, Ptr< const WifiMpdu > > TxOk
 typedef for a callback to invoke when an MPDU is successfully ack'ed. More...
 

Public Member Functions

 BlockAckManager ()
 
 BlockAckManager (const BlockAckManager &)=delete
 
 ~BlockAckManager () override
 
void AddToSendBarIfDataQueuedList (const Mac48Address &recipient, uint8_t tid)
 Add the given (recipient, TID) pair to the list of BA agreements for which a BAR shall only be sent if there are queued data frames belonging to those agreements. More...
 
void CreateOriginatorAgreement (const MgtAddBaRequestHeader &reqHdr, const Mac48Address &recipient, bool htSupported=true)
 
void CreateRecipientAgreement (const MgtAddBaResponseHeader &respHdr, const Mac48Address &originator, uint16_t startingSeq, bool htSupported, Ptr< MacRxMiddle > rxMiddle)
 
void DestroyOriginatorAgreement (const Mac48Address &recipient, uint8_t tid)
 
void DestroyRecipientAgreement (const Mac48Address &originator, uint8_t tid)
 Destroy a recipient Block Ack agreement. More...
 
OriginatorAgreementOptConstRef GetAgreementAsOriginator (const Mac48Address &recipient, uint8_t tid) const
 
RecipientAgreementOptConstRef GetAgreementAsRecipient (const Mac48Address &originator, uint8_t tid) const
 
CtrlBAckRequestHeader GetBlockAckReqHeader (const Mac48Address &recipient, uint8_t tid) const
 
uint32_t GetNBufferedPackets (const Mac48Address &recipient, uint8_t tid) const
 
uint16_t GetOriginatorStartingSequence (const Mac48Address &recipient, uint8_t tid) const
 This function returns the starting sequence number of the transmit window. More...
 
uint16_t GetRecipientBufferSize (const Mac48Address &recipient, uint8_t tid) const
 This function returns the buffer size negotiated with the recipient. More...
 
const std::list< AgreementKey > & GetSendBarIfDataQueuedList () const
 
bool NeedBarRetransmission (uint8_t tid, const Mac48Address &recipient)
 This function returns true if a block ack agreement is established with the given recipient for the given TID and there is at least an outstanding MPDU for such agreement whose lifetime is not expired. More...
 
void NotifyDiscardedMpdu (Ptr< const WifiMpdu > mpdu)
 
void NotifyGotAck (uint8_t linkId, Ptr< const WifiMpdu > mpdu)
 Invoked upon receipt of an Ack frame on the given link after the transmission of a QoS data frame sent under an established block ack agreement. More...
 
std::pair< uint16_t, uint16_t > NotifyGotBlockAck (uint8_t linkId, const CtrlBAckResponseHeader &blockAck, const Mac48Address &recipient, const std::set< uint8_t > &tids, size_t index=0)
 
void NotifyGotBlockAckRequest (const Mac48Address &originator, uint8_t tid, uint16_t startingSeq)
 
void NotifyGotMpdu (Ptr< const WifiMpdu > mpdu)
 
void NotifyMissedAck (uint8_t linkId, Ptr< WifiMpdu > mpdu)
 Invoked upon missed reception of an Ack frame on the given link after the transmission of a QoS data frame sent under an established block ack agreement. More...
 
void NotifyMissedBlockAck (uint8_t linkId, const Mac48Address &recipient, uint8_t tid)
 
void NotifyOriginatorAgreementEstablished (const Mac48Address &recipient, uint8_t tid, uint16_t startingSeq)
 
void NotifyOriginatorAgreementNoReply (const Mac48Address &recipient, uint8_t tid)
 
void NotifyOriginatorAgreementRejected (const Mac48Address &recipient, uint8_t tid)
 
void NotifyOriginatorAgreementReset (const Mac48Address &recipient, uint8_t tid)
 
BlockAckManageroperator= (const BlockAckManager &)=delete
 
void RemoveFromSendBarIfDataQueuedList (const Mac48Address &recipient, uint8_t tid)
 Remove the given (recipient, TID) pair from the list of BA agreements for which a BAR shall only be sent if there are queued data frames belonging to those agreements. More...
 
void ScheduleBar (const CtrlBAckRequestHeader &reqHdr, const WifiMacHeader &hdr)
 
void SetBlockAckInactivityCallback (Callback< void, Mac48Address, uint8_t, bool > callback)
 Set block ack inactivity callback. More...
 
void SetBlockAckThreshold (uint8_t nPackets)
 
void SetBlockDestinationCallback (Callback< void, Mac48Address, uint8_t > callback)
 Set block destination callback. More...
 
void SetDroppedOldMpduCallback (DroppedOldMpdu callback)
 
void SetQueue (const Ptr< WifiMacQueue > queue)
 
void SetTxFailedCallback (TxFailed callback)
 
void SetTxOkCallback (TxOk callback)
 
void SetUnblockDestinationCallback (Callback< void, Mac48Address, uint8_t > callback)
 Set unblock destination callback. More...
 
void StorePacket (Ptr< WifiMpdu > mpdu)
 
void UpdateOriginatorAgreement (const MgtAddBaResponseHeader &respHdr, const Mac48Address &recipient, uint16_t startingSeq)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
 ~Object () override
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose ()
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one. More...
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized () 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[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () 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 errors. 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 ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID. More...
 

Protected Member Functions

void DoDispose () override
 Destructor implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize ()
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate ()
 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 ()
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Types

enum  MpduStatus : uint8_t { STAY_INFLIGHT = 0 , TO_RETRANSMIT , ACKNOWLEDGED }
 Enumeration for the statuses of a buffered MPDU. More...
 
using OriginatorAgreements = std::map< AgreementKey, std::pair< OriginatorBlockAckAgreement, PacketQueue > >
 AgreementKey-indexed map of originator block ack agreements. More...
 
using OriginatorAgreementsI = OriginatorAgreements::iterator
 typedef for an iterator for Agreements More...
 
typedef std::list< Ptr< WifiMpdu > > PacketQueue
 typedef for a list of WifiMpdu. More...
 
typedef std::list< Ptr< WifiMpdu > >::iterator PacketQueueI
 typedef for an iterator for PacketQueue. More...
 
using RecipientAgreements = std::map< AgreementKey, RecipientBlockAckAgreement >
 AgreementKey-indexed map of recipient block ack agreements. More...
 

Private Member Functions

PacketQueueI HandleInFlightMpdu (uint8_t linkId, PacketQueueI mpduIt, MpduStatus status, const OriginatorAgreementsI &it, const Time &now)
 Handle the given in flight MPDU based on its given status. More...
 
void InactivityTimeout (const Mac48Address &recipient, uint8_t tid)
 Inactivity timeout function. More...
 

Private Attributes

Callback< void, Mac48Address, uint8_t, bool > m_blockAckInactivityTimeout
 BlockAck inactivity timeout callback. More...
 
uint8_t m_blockAckThreshold
 block ack threshold More...
 
Callback< void, Mac48Address, uint8_t > m_blockPackets
 block packets callback More...
 
DroppedOldMpdu m_droppedOldMpduCallback
 the dropped MPDU callback More...
 
OriginatorAgreements m_originatorAgreements
 This data structure contains, for each originator block ack agreement (recipient, TID), a set of packets for which an ack by block ack is requested. More...
 
TracedCallback< Time, Mac48Address, uint8_t, OriginatorBlockAckAgreement::Statem_originatorAgreementState
 The trace source fired when a state transition occurred. More...
 
Ptr< WifiMacQueuem_queue
 queue More...
 
RecipientAgreements m_recipientAgreements
 Recipient Block Ack agreements. More...
 
std::list< AgreementKeym_sendBarIfDataQueued
 list of BA agreements for which a BAR shall only be sent if data is queued More...
 
TxFailed m_txFailedCallback
 transmit failed callback More...
 
TxOk m_txOkCallback
 transmit OK callback More...
 
Callback< void, Mac48Address, uint8_t > m_unblockPackets
 unblock packets callback More...
 

Additional Inherited Members

Detailed Description

Manages all block ack agreements for an originator station.

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

Member Typedef Documentation

◆ AgreementKey

using ns3::BlockAckManager::AgreementKey = std::pair<Mac48Address, uint8_t>

agreement key typedef (MAC address and TID)

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

◆ AgreementStateTracedCallback

typedef void(* ns3::BlockAckManager::AgreementStateTracedCallback) (Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)

TracedCallback signature for state changes.

Parameters
[in]nowTime when the state changed.
[in]recipientMAC address of the recipient.
[in]tidthe TID.
[in]stateThe state.

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

◆ DroppedOldMpdu

typedef for a callback to invoke when an MPDU is dropped.

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

◆ OriginatorAgreementOptConstRef

using ns3::BlockAckManager::OriginatorAgreementOptConstRef = std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement> >

optional const reference to OriginatorBlockAckAgreement

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

◆ OriginatorAgreements

AgreementKey-indexed map of originator block ack agreements.

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

◆ OriginatorAgreementsI

using ns3::BlockAckManager::OriginatorAgreementsI = OriginatorAgreements::iterator
private

typedef for an iterator for Agreements

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

◆ PacketQueue

typedef for a list of WifiMpdu.

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

◆ PacketQueueI

typedef for an iterator for PacketQueue.

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

◆ RecipientAgreementOptConstRef

using ns3::BlockAckManager::RecipientAgreementOptConstRef = std::optional<std::reference_wrapper<const RecipientBlockAckAgreement> >

optional const reference to RecipientBlockAckAgreement

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

◆ RecipientAgreements

AgreementKey-indexed map of recipient block ack agreements.

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

◆ TxFailed

typedef for a callback to invoke when an MPDU is negatively ack'ed.

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

◆ TxOk

typedef for a callback to invoke when an MPDU is successfully ack'ed.

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

Member Enumeration Documentation

◆ MpduStatus

enum ns3::BlockAckManager::MpduStatus : uint8_t
private

Enumeration for the statuses of a buffered MPDU.

Enumerator
STAY_INFLIGHT 
TO_RETRANSMIT 
ACKNOWLEDGED 

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

Constructor & Destructor Documentation

◆ BlockAckManager() [1/2]

ns3::BlockAckManager::BlockAckManager ( )

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

References NS_LOG_FUNCTION.

◆ ~BlockAckManager()

ns3::BlockAckManager::~BlockAckManager ( )
override

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

References NS_LOG_FUNCTION.

◆ BlockAckManager() [2/2]

ns3::BlockAckManager::BlockAckManager ( const BlockAckManager )
delete

Member Function Documentation

◆ AddToSendBarIfDataQueuedList()

void ns3::BlockAckManager::AddToSendBarIfDataQueuedList ( const Mac48Address recipient,
uint8_t  tid 
)

Add the given (recipient, TID) pair to the list of BA agreements for which a BAR shall only be sent if there are queued data frames belonging to those agreements.

Parameters
recipientthe recipient
tidthe TID

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

References m_sendBarIfDataQueued, and NS_LOG_FUNCTION.

◆ CreateOriginatorAgreement()

void ns3::BlockAckManager::CreateOriginatorAgreement ( const MgtAddBaRequestHeader reqHdr,
const Mac48Address recipient,
bool  htSupported = true 
)

◆ CreateRecipientAgreement()

void ns3::BlockAckManager::CreateRecipientAgreement ( const MgtAddBaResponseHeader respHdr,
const Mac48Address originator,
uint16_t  startingSeq,
bool  htSupported,
Ptr< MacRxMiddle rxMiddle 
)
Parameters
respHdrAdd block ack response from originator (action frame).
originatorAddress of peer station involved in block ack mechanism.
startingSeqSequence number of the first MPDU of all packets for which block ack was negotiated.
htSupportedwhether HT support is enabled
rxMiddlethe MAC RX Middle on this station

This function is typically invoked only by ns3::WifiMac when the STA (which may be non-AP in ESS, or in an IBSS) has received an ADDBA Request frame and is transmitting an ADDBA Response frame. At this point the frame exchange manager must allocate buffers to collect all correctly received packets belonging to the category for which block ack was negotiated.

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

References ns3::MgtAddBaResponseHeader::GetBufferSize(), ns3::MgtAddBaResponseHeader::GetTid(), ns3::MgtAddBaResponseHeader::GetTimeout(), ns3::MgtAddBaResponseHeader::IsAmsduSupported(), ns3::MgtAddBaResponseHeader::IsImmediateBlockAck(), m_recipientAgreements, NS_LOG_FUNCTION, ns3::BlockAckAgreement::SetDelayedBlockAck(), ns3::BlockAckAgreement::SetImmediateBlockAck(), and ns3::RecipientBlockAckAgreement::SetMacRxMiddle().

+ Here is the call graph for this function:

◆ DestroyOriginatorAgreement()

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

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

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

References m_originatorAgreements, and NS_LOG_FUNCTION.

◆ DestroyRecipientAgreement()

void ns3::BlockAckManager::DestroyRecipientAgreement ( const Mac48Address originator,
uint8_t  tid 
)

Destroy a recipient Block Ack agreement.

Parameters
originatorthe originator MAC address
tidthe TID associated with the Block Ack agreement

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

References m_recipientAgreements, and NS_LOG_FUNCTION.

◆ DoDispose()

void ns3::BlockAckManager::DoDispose ( void  )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

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

References m_originatorAgreements, m_queue, and NS_LOG_FUNCTION.

◆ GetAgreementAsOriginator()

BlockAckManager::OriginatorAgreementOptConstRef ns3::BlockAckManager::GetAgreementAsOriginator ( const Mac48Address recipient,
uint8_t  tid 
) const
Parameters
recipientMAC address of the recipient
tidTraffic ID
Returns
a const reference to the block ack agreement with the given recipient, if it exists

Check if we are the originator of an existing block ack agreement with the given recipient.

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

References m_originatorAgreements, and NS_LOG_FUNCTION.

Referenced by CreateOriginatorAgreement().

+ Here is the caller graph for this function:

◆ GetAgreementAsRecipient()

BlockAckManager::RecipientAgreementOptConstRef ns3::BlockAckManager::GetAgreementAsRecipient ( const Mac48Address originator,
uint8_t  tid 
) const
Parameters
originatorMAC address of the originator
tidTraffic ID
Returns
a const reference to the block ack agreement with the given originator, if it exists

Check if we are the recipient of an existing block ack agreement with the given originator.

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

References m_recipientAgreements, and NS_LOG_FUNCTION.

◆ GetBlockAckReqHeader()

CtrlBAckRequestHeader ns3::BlockAckManager::GetBlockAckReqHeader ( const Mac48Address recipient,
uint8_t  tid 
) const
Parameters
recipientthe recipient
tidthe TID
Returns
the BlockAckRequest header for the established BA agreement

Get the BlockAckRequest header for the established BA agreement (recipient,tid).

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

References m_originatorAgreements, NS_ASSERT, NS_LOG_FUNCTION, ns3::CtrlBAckRequestHeader::SetStartingSequence(), ns3::CtrlBAckRequestHeader::SetTidInfo(), and ns3::CtrlBAckRequestHeader::SetType().

Referenced by NotifyDiscardedMpdu().

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

◆ GetNBufferedPackets()

uint32_t ns3::BlockAckManager::GetNBufferedPackets ( const 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 the number of packets buffered for a specified agreement. This methods doesn't return the number of buffered MPDUs but the number of buffered MSDUs.

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

References m_originatorAgreements, and NS_LOG_FUNCTION.

◆ GetOriginatorStartingSequence()

uint16_t ns3::BlockAckManager::GetOriginatorStartingSequence ( const Mac48Address recipient,
uint8_t  tid 
) const

This function returns the starting sequence number of the transmit window.

Parameters
tidTraffic ID
recipientMAC address of the recipient
Returns
the starting sequence number of the transmit window (WinStartO)

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

References m_originatorAgreements.

◆ GetRecipientBufferSize()

uint16_t ns3::BlockAckManager::GetRecipientBufferSize ( const Mac48Address recipient,
uint8_t  tid 
) const

This function returns the buffer size negotiated with the recipient.

Parameters
tidTraffic ID
recipientMAC address of the recipient
Returns
the buffer size negotiated with the recipient

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

References m_originatorAgreements.

◆ GetSendBarIfDataQueuedList()

const std::list< BlockAckManager::AgreementKey > & ns3::BlockAckManager::GetSendBarIfDataQueuedList ( ) const
Returns
the list of BA agreements (identified by the recipient and TID pair) for which a BAR shall only be sent if there are queued data frames belonging to those agreements

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

References m_sendBarIfDataQueued.

◆ GetTypeId()

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

Get the type ID.

Returns
the object TypeId

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

References m_originatorAgreementState, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ HandleInFlightMpdu()

BlockAckManager::PacketQueueI ns3::BlockAckManager::HandleInFlightMpdu ( uint8_t  linkId,
PacketQueueI  mpduIt,
MpduStatus  status,
const OriginatorAgreementsI it,
const Time now 
)
private

Handle the given in flight MPDU based on its given status.

If the status is ACKNOWLEDGED, the MPDU is removed from both the EDCA queue and the queue of in flight MPDUs. If the status is TO_RETRANSMIT, the MPDU is only removed from the queue of in flight MPDUs. Note that the MPDU is removed from both queues (independently of the status) if the MPDU is not stored in the EDCA queue, is an old packet or its lifetime expired.

Parameters
linkIdthe ID of the link on which the MPDU has been transmitted
mpduItan iterator pointing to the MPDU in the queue of in flight MPDUs
statusthe status of the in flight MPDU
ititerator pointing to the Block Ack agreement
nowthe current time
Returns
an iterator pointing to the next MPDU in the queue of in flight MPDUs

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

References ACKNOWLEDGED, ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetQosTid(), ns3::WifiMacHeader::GetSequenceNumber(), ns3::Callback< R, UArgs >::IsNull(), ns3::WifiMacHeader::IsQosData(), m_droppedOldMpduCallback, m_queue, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, prev, ns3::SEQNO_SPACE_HALF_SIZE, STAY_INFLIGHT, and TO_RETRANSMIT.

Referenced by NeedBarRetransmission(), NotifyGotAck(), NotifyGotBlockAck(), NotifyMissedAck(), and NotifyMissedBlockAck().

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

◆ InactivityTimeout()

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

Inactivity timeout function.

Parameters
recipientthe recipient MAC address
tidTraffic ID

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

References m_blockAckInactivityTimeout, and NS_LOG_FUNCTION.

Referenced by NotifyGotBlockAck(), and UpdateOriginatorAgreement().

+ Here is the caller graph for this function:

◆ NeedBarRetransmission()

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

This function returns true if a block ack agreement is established with the given recipient for the given TID and there is at least an outstanding MPDU for such agreement whose lifetime is not expired.

Parameters
tidTraffic ID
recipientMAC address of the recipient
Returns
true if BAR retransmission needed

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

References HandleInFlightMpdu(), m_originatorAgreements, ns3::Simulator::Now(), ns3::SINGLE_LINK_OP_ID, and STAY_INFLIGHT.

+ Here is the call graph for this function:

◆ NotifyDiscardedMpdu()

void ns3::BlockAckManager::NotifyDiscardedMpdu ( Ptr< const WifiMpdu mpdu)
Parameters
mpduthe discarded frame

Notify the block ack manager that an MPDU has been discarded, e.g., because the MSDU lifetime expired. If there is an established block ack agreement, make the transmit window advance beyond the discarded frame. This also involves (i) the removal of frames that consequently become old from the retransmit queue and from the queue of the block ack agreement, and (ii) the scheduling of a BlockAckRequest.

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

References GetBlockAckReqHeader(), ns3::Callback< R, UArgs >::IsNull(), m_droppedOldMpduCallback, m_originatorAgreements, m_queue, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::QosUtilsIsOldPacket(), ScheduleBar(), ns3::SEQNO_SPACE_HALF_SIZE, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetNoMoreFragments(), ns3::WifiMacHeader::SetNoRetry(), ns3::WifiMacHeader::SetType(), and ns3::WIFI_MAC_CTL_BACKREQ.

Referenced by ns3::QosTxop::QosTxop().

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

◆ NotifyGotAck()

void ns3::BlockAckManager::NotifyGotAck ( uint8_t  linkId,
Ptr< const WifiMpdu mpdu 
)

Invoked upon receipt of an Ack frame on the given link after the transmission of a QoS data frame sent under an established block ack agreement.

Remove the acknowledged frame from the outstanding packets and update the starting sequence number of the transmit window, if needed.

Parameters
linkIdthe ID of the given link
mpduThe acknowledged MPDU.

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

References ACKNOWLEDGED, HandleInFlightMpdu(), m_originatorAgreements, m_queue, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyGotBlockAck()

std::pair< uint16_t, uint16_t > ns3::BlockAckManager::NotifyGotBlockAck ( uint8_t  linkId,
const CtrlBAckResponseHeader blockAck,
const Mac48Address recipient,
const std::set< uint8_t > &  tids,
size_t  index = 0 
)
Parameters
linkIdthe ID of the given link
blockAckThe received BlockAck frame.
recipientSender of BlockAck frame.
tidsthe set of TIDs the acknowledged MPDUs belong to
indexthe index of the Per AID TID Info subfield, in case of Multi-STA Block Ack, or 0, otherwise
Returns
a pair of values indicating the number of successfully received MPDUs and the number of failed MPDUs

Invoked upon receipt of a BlockAck frame on the given link. 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. Note that tids is only used if blockAck is a Multi-STA Block Ack using All-ack context.

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

References ACKNOWLEDGED, ns3::CtrlBAckResponseHeader::GetAckType(), ns3::CtrlBAckResponseHeader::GetTidInfo(), HandleInFlightMpdu(), InactivityTimeout(), ns3::CtrlBAckResponseHeader::IsBasic(), ns3::CtrlBAckResponseHeader::IsCompressed(), ns3::CtrlBAckResponseHeader::IsExtendedCompressed(), ns3::CtrlBAckResponseHeader::IsMultiSta(), ns3::CtrlBAckResponseHeader::IsMultiTid(), ns3::Callback< R, UArgs >::IsNull(), ns3::CtrlBAckResponseHeader::IsPacketReceived(), m_originatorAgreements, m_queue, m_txFailedCallback, m_txOkCallback, ns3::MicroSeconds(), ns3::Simulator::Now(), NS_ABORT_MSG_IF, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), STAY_INFLIGHT, timeout, and TO_RETRANSMIT.

+ Here is the call graph for this function:

◆ NotifyGotBlockAckRequest()

void ns3::BlockAckManager::NotifyGotBlockAckRequest ( const Mac48Address originator,
uint8_t  tid,
uint16_t  startingSeq 
)
Parameters
originatorMAC address of the sender of the Block Ack Request
tidTraffic ID
startingSeqthe starting sequence number in the Block Ack Request

Perform required actions upon receiving a Block Ack Request frame.

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

References m_recipientAgreements, and NS_LOG_FUNCTION.

◆ NotifyGotMpdu()

void ns3::BlockAckManager::NotifyGotMpdu ( Ptr< const WifiMpdu mpdu)
Parameters
mpduthe received MPDU

Perform required actions upon receiving an MPDU.

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

References m_recipientAgreements, NS_ASSERT, and NS_LOG_FUNCTION.

◆ NotifyMissedAck()

void ns3::BlockAckManager::NotifyMissedAck ( uint8_t  linkId,
Ptr< WifiMpdu mpdu 
)

Invoked upon missed reception of an Ack frame on the given link after the transmission of a QoS data frame sent under an established block ack agreement.

Remove the acknowledged frame from the outstanding packets and insert it in the retransmission queue.

Parameters
linkIdthe ID of the given link
mpduThe unacknowledged MPDU.

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

References HandleInFlightMpdu(), m_originatorAgreements, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, and TO_RETRANSMIT.

+ Here is the call graph for this function:

◆ NotifyMissedBlockAck()

void ns3::BlockAckManager::NotifyMissedBlockAck ( uint8_t  linkId,
const Mac48Address recipient,
uint8_t  tid 
)
Parameters
linkIdthe ID of the given link
recipientSender of the expected BlockAck frame.
tidTraffic ID.

Invoked upon missed reception of a block ack frame on the given link. Typically, this function is called by ns3::QosTxop object. Performs a check on which MPDUs, previously sent with ack policy set to Block Ack, should be placed in the retransmission queue.

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

References HandleInFlightMpdu(), m_originatorAgreements, ns3::Simulator::Now(), NS_LOG_FUNCTION, STAY_INFLIGHT, and TO_RETRANSMIT.

+ Here is the call graph for this function:

◆ NotifyOriginatorAgreementEstablished()

void ns3::BlockAckManager::NotifyOriginatorAgreementEstablished ( const 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 originator agreement in established state and updates number of packets and starting sequence field. Invoked typically after a block ack refresh.

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

References ns3::OriginatorBlockAckAgreement::ESTABLISHED, m_originatorAgreements, m_originatorAgreementState, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyOriginatorAgreementNoReply()

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

Marks an originator agreement after not receiving response to ADDBA request. During this state any packets in queue will be transmitted using normal MPDU. This also unblocks recipient address.

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

References m_originatorAgreements, m_originatorAgreementState, m_unblockPackets, ns3::OriginatorBlockAckAgreement::NO_REPLY, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ NotifyOriginatorAgreementRejected()

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

Marks an originator agreement as rejected. 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 746 of file block-ack-manager.cc.

References m_originatorAgreements, m_originatorAgreementState, m_unblockPackets, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, and ns3::OriginatorBlockAckAgreement::REJECTED.

+ Here is the call graph for this function:

◆ NotifyOriginatorAgreementReset()

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

Set Originator BA agreement to a transitory state to reset it after not receiving response to ADDBA request.

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

References m_originatorAgreements, m_originatorAgreementState, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, and ns3::OriginatorBlockAckAgreement::RESET.

+ Here is the call graph for this function:

◆ operator=()

BlockAckManager& ns3::BlockAckManager::operator= ( const BlockAckManager )
delete

◆ RemoveFromSendBarIfDataQueuedList()

void ns3::BlockAckManager::RemoveFromSendBarIfDataQueuedList ( const Mac48Address recipient,
uint8_t  tid 
)

Remove the given (recipient, TID) pair from the list of BA agreements for which a BAR shall only be sent if there are queued data frames belonging to those agreements.

Parameters
recipientthe recipient
tidthe TID

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

References m_sendBarIfDataQueued, and NS_LOG_FUNCTION.

◆ ScheduleBar()

void ns3::BlockAckManager::ScheduleBar ( const CtrlBAckRequestHeader reqHdr,
const WifiMacHeader hdr 
)
Parameters
reqHdrthe BlockAckRequest header
hdrthe 802.11 MAC header

Enqueue the given BlockAckRequest into the queue storing the next BAR frames to transmit. If a BAR for the same recipient and TID is already present in the queue, it is replaced by the new one. If the given BAR is retransmitted, it is placed at the head of the queue, otherwise at the tail.

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

References ns3::WifiMacHeader::GetAddr1(), ns3::CtrlBAckRequestHeader::GetTidInfo(), m_queue, NS_LOG_FUNCTION, ns3::WIFI_CTL_QUEUE, and ns3::WIFI_UNICAST.

Referenced by NotifyDiscardedMpdu().

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

◆ 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 832 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 BlockAck 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 298 of file block-ack-manager.cc.

References m_blockAckThreshold, 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 839 of file block-ack-manager.cc.

References m_blockPackets, and NS_LOG_FUNCTION.

◆ SetDroppedOldMpduCallback()

void ns3::BlockAckManager::SetDroppedOldMpduCallback ( DroppedOldMpdu  callback)
Parameters
callbackthe callback to invoke when an old MPDU is dropped

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

References m_droppedOldMpduCallback.

◆ SetQueue()

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

Definition at line 796 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 unsuccessfuly.

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

References m_txFailedCallback.

◆ SetTxOkCallback()

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

Definition at line 853 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 846 of file block-ack-manager.cc.

References m_unblockPackets, and NS_LOG_FUNCTION.

◆ StorePacket()

void ns3::BlockAckManager::StorePacket ( Ptr< WifiMpdu mpdu)
Parameters
mpduMPDU to store.

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

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

References m_originatorAgreements, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::SEQNO_SPACE_HALF_SIZE.

◆ UpdateOriginatorAgreement()

Member Data Documentation

◆ m_blockAckInactivityTimeout

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

BlockAck inactivity timeout callback.

Definition at line 512 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 509 of file block-ack-manager.h.

Referenced by SetBlockAckThreshold().

◆ m_blockPackets

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

block packets callback

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

Referenced by CreateOriginatorAgreement(), and SetBlockDestinationCallback().

◆ m_droppedOldMpduCallback

DroppedOldMpdu ns3::BlockAckManager::m_droppedOldMpduCallback
private

the dropped MPDU callback

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

Referenced by HandleInFlightMpdu(), NotifyDiscardedMpdu(), and SetDroppedOldMpduCallback().

◆ m_originatorAgreements

OriginatorAgreements ns3::BlockAckManager::m_originatorAgreements
private

This data structure contains, for each originator 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 BlockAck frame is erased from this data structure. Pushed back in retransmission queue otherwise.

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

Referenced by CreateOriginatorAgreement(), DestroyOriginatorAgreement(), DoDispose(), GetAgreementAsOriginator(), GetBlockAckReqHeader(), GetNBufferedPackets(), GetOriginatorStartingSequence(), GetRecipientBufferSize(), NeedBarRetransmission(), NotifyDiscardedMpdu(), NotifyGotAck(), NotifyGotBlockAck(), NotifyMissedAck(), NotifyMissedBlockAck(), NotifyOriginatorAgreementEstablished(), NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), NotifyOriginatorAgreementReset(), StorePacket(), and UpdateOriginatorAgreement().

◆ m_originatorAgreementState

◆ m_queue

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

◆ m_recipientAgreements

RecipientAgreements ns3::BlockAckManager::m_recipientAgreements
private

◆ m_sendBarIfDataQueued

std::list<AgreementKey> ns3::BlockAckManager::m_sendBarIfDataQueued
private

list of BA agreements for which a BAR shall only be sent if data is queued

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

Referenced by AddToSendBarIfDataQueuedList(), GetSendBarIfDataQueuedList(), and RemoveFromSendBarIfDataQueuedList().

◆ m_txFailedCallback

TxFailed ns3::BlockAckManager::m_txFailedCallback
private

transmit failed callback

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

Referenced by NotifyGotBlockAck(), and SetTxFailedCallback().

◆ m_txOkCallback

TxOk ns3::BlockAckManager::m_txOkCallback
private

transmit OK callback

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

Referenced by NotifyGotBlockAck(), and SetTxOkCallback().

◆ m_unblockPackets

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

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