Manages all block ack agreements for an originator station. More...
#include "block-ack-manager.h"
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) |
BlockAckManager & | operator= (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< Object > | GetObject () 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< Object > | GetObject (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... | |
SimpleRefCount & | operator= (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::State > | m_originatorAgreementState |
The trace source fired when a state transition occurred. More... | |
Ptr< WifiMacQueue > | m_queue |
queue More... | |
RecipientAgreements | m_recipientAgreements |
Recipient Block Ack agreements. More... | |
std::list< AgreementKey > | m_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 | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Manages all block ack agreements for an originator station.
Definition at line 51 of file block-ack-manager.h.
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.
typedef void(* ns3::BlockAckManager::AgreementStateTracedCallback) (Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state) |
TracedCallback signature for state changes.
[in] | now | Time when the state changed. |
[in] | recipient | MAC address of the recipient. |
[in] | tid | the TID. |
[in] | state | The state. |
Definition at line 384 of file block-ack-manager.h.
typedef Callback<void, Ptr<const WifiMpdu> > ns3::BlockAckManager::DroppedOldMpdu |
typedef for a callback to invoke when an MPDU is dropped.
Definition at line 359 of file block-ack-manager.h.
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.
|
private |
AgreementKey-indexed map of originator block ack agreements.
Definition at line 468 of file block-ack-manager.h.
|
private |
typedef for an iterator for Agreements
Definition at line 471 of file block-ack-manager.h.
|
private |
typedef for a list of WifiMpdu.
Definition at line 461 of file block-ack-manager.h.
|
private |
typedef for an iterator for PacketQueue.
Definition at line 465 of file block-ack-manager.h.
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.
|
private |
AgreementKey-indexed map of recipient block ack agreements.
Definition at line 474 of file block-ack-manager.h.
typedef Callback<void, Ptr<const WifiMpdu> > ns3::BlockAckManager::TxFailed |
typedef for a callback to invoke when an MPDU is negatively ack'ed.
Definition at line 355 of file block-ack-manager.h.
typedef Callback<void, Ptr<const WifiMpdu> > ns3::BlockAckManager::TxOk |
typedef for a callback to invoke when an MPDU is successfully ack'ed.
Definition at line 351 of file block-ack-manager.h.
|
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.
ns3::BlockAckManager::BlockAckManager | ( | ) |
Definition at line 58 of file block-ack-manager.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 63 of file block-ack-manager.cc.
References NS_LOG_FUNCTION.
|
delete |
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.
recipient | the recipient |
tid | the TID |
Definition at line 700 of file block-ack-manager.cc.
References m_sendBarIfDataQueued, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::CreateOriginatorAgreement | ( | const MgtAddBaRequestHeader & | reqHdr, |
const Mac48Address & | recipient, | ||
bool | htSupported = true |
||
) |
reqHdr | Relative Add block ack request (action frame). |
recipient | Address of peer station involved in block ack mechanism. |
htSupported | Whether both originator and recipient support HT |
Creates a new originator 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 101 of file block-ack-manager.cc.
References GetAgreementAsOriginator(), ns3::MgtAddBaRequestHeader::GetBufferSize(), ns3::MgtAddBaRequestHeader::GetStartingSequence(), ns3::MgtAddBaRequestHeader::GetTid(), ns3::MgtAddBaRequestHeader::GetTimeout(), ns3::MgtAddBaRequestHeader::IsAmsduSupported(), ns3::MgtAddBaRequestHeader::IsImmediateBlockAck(), m_blockPackets, m_originatorAgreements, m_originatorAgreementState, ns3::Simulator::Now(), NS_ASSERT_MSG, NS_LOG_FUNCTION, ns3::OriginatorBlockAckAgreement::PENDING, ns3::BlockAckAgreement::SetAmsduSupport(), ns3::BlockAckAgreement::SetBufferSize(), ns3::BlockAckAgreement::SetDelayedBlockAck(), ns3::BlockAckAgreement::SetHtSupported(), ns3::BlockAckAgreement::SetImmediateBlockAck(), ns3::BlockAckAgreement::SetStartingSequence(), ns3::OriginatorBlockAckAgreement::SetState(), and ns3::BlockAckAgreement::SetTimeout().
void ns3::BlockAckManager::CreateRecipientAgreement | ( | const MgtAddBaResponseHeader & | respHdr, |
const Mac48Address & | originator, | ||
uint16_t | startingSeq, | ||
bool | htSupported, | ||
Ptr< MacRxMiddle > | rxMiddle | ||
) |
respHdr | Add block ack response from originator (action frame). |
originator | Address of peer station involved in block ack mechanism. |
startingSeq | Sequence number of the first MPDU of all packets for which block ack was negotiated. |
htSupported | whether HT support is enabled |
rxMiddle | the 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().
void ns3::BlockAckManager::DestroyOriginatorAgreement | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) |
recipient | Address of peer station involved in block ack mechanism. |
tid | 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 139 of file block-ack-manager.cc.
References m_originatorAgreements, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::DestroyRecipientAgreement | ( | const Mac48Address & | originator, |
uint8_t | tid | ||
) |
Destroy a recipient Block Ack agreement.
originator | the originator MAC address |
tid | the TID associated with the Block Ack agreement |
Definition at line 225 of file block-ack-manager.cc.
References m_recipientAgreements, and NS_LOG_FUNCTION.
|
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.
BlockAckManager::OriginatorAgreementOptConstRef ns3::BlockAckManager::GetAgreementAsOriginator | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) | const |
recipient | MAC address of the recipient |
tid | Traffic ID |
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().
BlockAckManager::RecipientAgreementOptConstRef ns3::BlockAckManager::GetAgreementAsRecipient | ( | const Mac48Address & | originator, |
uint8_t | tid | ||
) | const |
originator | MAC address of the originator |
tid | Traffic ID |
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.
CtrlBAckRequestHeader ns3::BlockAckManager::GetBlockAckReqHeader | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) | const |
recipient | the recipient |
tid | the TID |
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().
uint32_t ns3::BlockAckManager::GetNBufferedPackets | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) | const |
recipient | Address of peer station involved in block ack mechanism. |
tid | Traffic ID. |
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.
uint16_t ns3::BlockAckManager::GetOriginatorStartingSequence | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) | const |
This function returns the starting sequence number of the transmit window.
tid | Traffic ID |
recipient | MAC address of the recipient |
Definition at line 883 of file block-ack-manager.cc.
References m_originatorAgreements.
uint16_t ns3::BlockAckManager::GetRecipientBufferSize | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) | const |
This function returns the buffer size negotiated with the recipient.
tid | Traffic ID |
recipient | MAC address of the recipient |
Definition at line 871 of file block-ack-manager.cc.
References m_originatorAgreements.
const std::list< BlockAckManager::AgreementKey > & ns3::BlockAckManager::GetSendBarIfDataQueuedList | ( | ) | const |
Definition at line 694 of file block-ack-manager.cc.
References m_sendBarIfDataQueued.
|
static |
Get the type ID.
Definition at line 44 of file block-ack-manager.cc.
References m_originatorAgreementState, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
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.
linkId | the ID of the link on which the MPDU has been transmitted |
mpduIt | an iterator pointing to the MPDU in the queue of in flight MPDUs |
status | the status of the in flight MPDU |
it | iterator pointing to the Block Ack agreement |
now | the current time |
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().
|
private |
Inactivity timeout function.
recipient | the recipient MAC address |
tid | Traffic ID |
Definition at line 720 of file block-ack-manager.cc.
References m_blockAckInactivityTimeout, and NS_LOG_FUNCTION.
Referenced by NotifyGotBlockAck(), and UpdateOriginatorAgreement().
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.
tid | Traffic ID |
recipient | MAC address of the recipient |
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.
mpdu | the 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().
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.
linkId | the ID of the given link |
mpdu | The 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.
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 |
||
) |
linkId | the ID of the given link |
blockAck | The received BlockAck frame. |
recipient | Sender of BlockAck frame. |
tids | the set of TIDs the acknowledged MPDUs belong to |
index | the index of the Per AID TID Info subfield, in case of Multi-STA Block Ack, or 0, otherwise |
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.
void ns3::BlockAckManager::NotifyGotBlockAckRequest | ( | const Mac48Address & | originator, |
uint8_t | tid, | ||
uint16_t | startingSeq | ||
) |
originator | MAC address of the sender of the Block Ack Request |
tid | Traffic ID |
startingSeq | the 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.
mpdu | the 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.
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.
linkId | the ID of the given link |
mpdu | The 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.
void ns3::BlockAckManager::NotifyMissedBlockAck | ( | uint8_t | linkId, |
const Mac48Address & | recipient, | ||
uint8_t | tid | ||
) |
linkId | the ID of the given link |
recipient | Sender of the expected BlockAck frame. |
tid | Traffic 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.
void ns3::BlockAckManager::NotifyOriginatorAgreementEstablished | ( | const Mac48Address & | recipient, |
uint8_t | tid, | ||
uint16_t | startingSeq | ||
) |
recipient | Address of peer station involved in block ack mechanism. |
tid | Traffic ID of transmitted packet. |
startingSeq | starting 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.
void ns3::BlockAckManager::NotifyOriginatorAgreementNoReply | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) |
recipient | Address of peer station involved in block ack mechanism. |
tid | Traffic 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.
void ns3::BlockAckManager::NotifyOriginatorAgreementRejected | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) |
recipient | Address of peer station involved in block ack mechanism. |
tid | Traffic 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.
void ns3::BlockAckManager::NotifyOriginatorAgreementReset | ( | const Mac48Address & | recipient, |
uint8_t | tid | ||
) |
recipient | Address of peer station involved in block ack mechanism. |
tid | Traffic 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.
|
delete |
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.
recipient | the recipient |
tid | the TID |
Definition at line 713 of file block-ack-manager.cc.
References m_sendBarIfDataQueued, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::ScheduleBar | ( | const CtrlBAckRequestHeader & | reqHdr, |
const WifiMacHeader & | hdr | ||
) |
reqHdr | the BlockAckRequest header |
hdr | the 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().
void ns3::BlockAckManager::SetBlockAckInactivityCallback | ( | Callback< void, Mac48Address, uint8_t, bool > | callback | ) |
Set block ack inactivity callback.
callback | the block ack inactivity callback function |
Definition at line 832 of file block-ack-manager.cc.
References m_blockAckInactivityTimeout, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::SetBlockAckThreshold | ( | uint8_t | nPackets | ) |
nPackets | Minimum 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.
void ns3::BlockAckManager::SetBlockDestinationCallback | ( | Callback< void, Mac48Address, uint8_t > | callback | ) |
Set block destination callback.
callback | the block destination callback |
Definition at line 839 of file block-ack-manager.cc.
References m_blockPackets, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::SetDroppedOldMpduCallback | ( | DroppedOldMpdu | callback | ) |
callback | the callback to invoke when an old MPDU is dropped |
Definition at line 865 of file block-ack-manager.cc.
References m_droppedOldMpduCallback.
void ns3::BlockAckManager::SetQueue | ( | const Ptr< WifiMacQueue > | queue | ) |
queue | The WifiMacQueue object. |
Definition at line 796 of file block-ack-manager.cc.
References m_queue, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::SetTxFailedCallback | ( | TxFailed | callback | ) |
callback | the callback to invoke when a packet transmission was completed unsuccessfuly. |
Definition at line 859 of file block-ack-manager.cc.
References m_txFailedCallback.
void ns3::BlockAckManager::SetTxOkCallback | ( | TxOk | callback | ) |
callback | the callback to invoke when a packet transmission was completed successfully. |
Definition at line 853 of file block-ack-manager.cc.
References m_txOkCallback.
void ns3::BlockAckManager::SetUnblockDestinationCallback | ( | Callback< void, Mac48Address, uint8_t > | callback | ) |
Set unblock destination callback.
callback | the unblock destination callback |
Definition at line 846 of file block-ack-manager.cc.
References m_unblockPackets, and NS_LOG_FUNCTION.
mpdu | MPDU 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.
void ns3::BlockAckManager::UpdateOriginatorAgreement | ( | const MgtAddBaResponseHeader & | respHdr, |
const Mac48Address & | recipient, | ||
uint16_t | startingSeq | ||
) |
respHdr | Relative Add block ack response (action frame). |
recipient | Address of peer station involved in block ack mechanism. |
startingSeq | the updated starting sequence number |
Invoked upon receipt of a ADDBA response frame from recipient.
Definition at line 150 of file block-ack-manager.cc.
References ns3::OriginatorBlockAckAgreement::ESTABLISHED, ns3::MgtAddBaResponseHeader::GetBufferSize(), ns3::MgtAddBaResponseHeader::GetTid(), ns3::BlockAckAgreement::GetTimeout(), ns3::MgtAddBaResponseHeader::GetTimeout(), InactivityTimeout(), ns3::OriginatorBlockAckAgreement::InitTxWindow(), ns3::MgtAddBaResponseHeader::IsAmsduSupported(), ns3::MgtAddBaResponseHeader::IsImmediateBlockAck(), ns3::BlockAckAgreement::m_inactivityEvent, m_originatorAgreements, m_originatorAgreementState, m_unblockPackets, ns3::MicroSeconds(), ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::BlockAckAgreement::SetAmsduSupport(), ns3::BlockAckAgreement::SetBufferSize(), ns3::BlockAckAgreement::SetDelayedBlockAck(), ns3::BlockAckAgreement::SetImmediateBlockAck(), ns3::BlockAckAgreement::SetStartingSequence(), ns3::OriginatorBlockAckAgreement::SetState(), ns3::BlockAckAgreement::SetTimeout(), and timeout.
|
private |
BlockAck inactivity timeout callback.
Definition at line 512 of file block-ack-manager.h.
Referenced by InactivityTimeout(), and SetBlockAckInactivityCallback().
|
private |
block ack threshold
Definition at line 509 of file block-ack-manager.h.
Referenced by SetBlockAckThreshold().
|
private |
block packets callback
Definition at line 513 of file block-ack-manager.h.
Referenced by CreateOriginatorAgreement(), and SetBlockDestinationCallback().
|
private |
the dropped MPDU callback
Definition at line 517 of file block-ack-manager.h.
Referenced by HandleInFlightMpdu(), NotifyDiscardedMpdu(), and SetDroppedOldMpduCallback().
|
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().
|
private |
The trace source fired when a state transition occurred.
Definition at line 523 of file block-ack-manager.h.
Referenced by CreateOriginatorAgreement(), GetTypeId(), NotifyOriginatorAgreementEstablished(), NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), NotifyOriginatorAgreementReset(), and UpdateOriginatorAgreement().
|
private |
queue
Definition at line 510 of file block-ack-manager.h.
Referenced by DoDispose(), HandleInFlightMpdu(), NotifyDiscardedMpdu(), NotifyGotAck(), NotifyGotBlockAck(), ScheduleBar(), and SetQueue().
|
private |
Recipient Block Ack agreements.
Definition at line 504 of file block-ack-manager.h.
Referenced by CreateRecipientAgreement(), DestroyRecipientAgreement(), GetAgreementAsRecipient(), NotifyGotBlockAckRequest(), and NotifyGotMpdu().
|
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().
|
private |
transmit failed callback
Definition at line 516 of file block-ack-manager.h.
Referenced by NotifyGotBlockAck(), and SetTxFailedCallback().
|
private |
transmit OK callback
Definition at line 515 of file block-ack-manager.h.
Referenced by NotifyGotBlockAck(), and SetTxOkCallback().
|
private |
unblock packets callback
Definition at line 514 of file block-ack-manager.h.
Referenced by NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), SetUnblockDestinationCallback(), and UpdateOriginatorAgreement().