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) | |
typedef void(* | AgreementStateTracedCallback) (Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state) |
TracedCallback signature for state changes. | |
typedef Callback< void, Ptr< const WifiMpdu > > | DroppedOldMpdu |
typedef for a callback to invoke when an MPDU is dropped. | |
using | OriginatorAgreementOptConstRef |
optional const reference to OriginatorBlockAckAgreement | |
using | RecipientAgreementOptConstRef |
optional const reference to RecipientBlockAckAgreement | |
typedef Callback< void, Ptr< const WifiMpdu > > | TxFailed |
typedef for a callback to invoke when an MPDU is negatively ack'ed. | |
typedef Callback< void, Ptr< const WifiMpdu > > | TxOk |
typedef for a callback to invoke when an MPDU is successfully ack'ed. | |
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. | |
void | CreateOriginatorAgreement (const MgtAddBaRequestHeader &reqHdr, const Mac48Address &recipient) |
void | CreateRecipientAgreement (const MgtAddBaResponseHeader &respHdr, const Mac48Address &originator, uint16_t startingSeq, 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. | |
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. | |
uint16_t | GetRecipientBufferSize (const Mac48Address &recipient, uint8_t tid) const |
This function returns the buffer size negotiated with the recipient. | |
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. | |
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. | |
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. | |
void | NotifyMissedBlockAck (uint8_t linkId, const Mac48Address &recipient, uint8_t tid) |
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. | |
void | ScheduleBar (const CtrlBAckRequestHeader &reqHdr, const WifiMacHeader &hdr) |
void | SetBlockAckInactivityCallback (Callback< void, Mac48Address, uint8_t, bool > callback) |
Set block ack inactivity callback. | |
void | SetBlockAckThreshold (uint8_t nPackets) |
void | SetBlockDestinationCallback (Callback< void, Mac48Address, uint8_t > callback) |
Set block destination callback. | |
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. | |
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. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Private Types | |
enum | MpduStatus : uint8_t { STAY_INFLIGHT = 0 , TO_RETRANSMIT , ACKNOWLEDGED } |
Enumeration for the statuses of a buffered MPDU. More... | |
using | OriginatorAgreements |
AgreementKey-indexed map of originator block ack agreements. | |
using | OriginatorAgreementsI = OriginatorAgreements::iterator |
typedef for an iterator for Agreements | |
typedef std::list< Ptr< WifiMpdu > > | PacketQueue |
typedef for a list of WifiMpdu. | |
typedef std::list< Ptr< WifiMpdu > >::iterator | PacketQueueI |
typedef for an iterator for PacketQueue. | |
using | RecipientAgreements = std::map<AgreementKey, RecipientBlockAckAgreement> |
AgreementKey-indexed map of recipient block ack agreements. | |
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. | |
void | InactivityTimeout (const Mac48Address &recipient, uint8_t tid) |
Inactivity timeout function. | |
Private Attributes | |
Callback< void, Mac48Address, uint8_t, bool > | m_blockAckInactivityTimeout |
BlockAck inactivity timeout callback. | |
uint8_t | m_blockAckThreshold |
block ack threshold | |
Callback< void, Mac48Address, uint8_t > | m_blockPackets |
block packets callback | |
DroppedOldMpdu | m_droppedOldMpduCallback |
the dropped MPDU callback | |
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. | |
TracedCallback< Time, Mac48Address, uint8_t, OriginatorBlockAckAgreement::State > | m_originatorAgreementState |
The trace source fired when a state transition occurred. | |
Ptr< WifiMacQueue > | m_queue |
queue | |
RecipientAgreements | m_recipientAgreements |
Recipient Block Ack agreements. | |
std::list< AgreementKey > | m_sendBarIfDataQueued |
list of BA agreements for which a BAR shall only be sent if data is queued | |
TxFailed | m_txFailedCallback |
transmit failed callback | |
TxOk | m_txOkCallback |
transmit OK callback | |
Callback< void, Mac48Address, uint8_t > | m_unblockPackets |
unblock packets callback | |
Additional Inherited Members | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Manages all block ack agreements for an originator station.
ns3::BlockAckManager is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
Group: Wifi
Size of this type is 264 bytes (on a 64-bit architecture).
Definition at line 40 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 397 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 358 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 333 of file block-ack-manager.h.
optional const reference to OriginatorBlockAckAgreement
Definition at line 68 of file block-ack-manager.h.
|
private |
AgreementKey-indexed map of originator block ack agreements.
Definition at line 442 of file block-ack-manager.h.
|
private |
typedef for an iterator for Agreements
Definition at line 445 of file block-ack-manager.h.
|
private |
typedef for a list of WifiMpdu.
Definition at line 435 of file block-ack-manager.h.
|
private |
typedef for an iterator for PacketQueue.
Definition at line 439 of file block-ack-manager.h.
optional const reference to RecipientBlockAckAgreement
Definition at line 71 of file block-ack-manager.h.
|
private |
AgreementKey-indexed map of recipient block ack agreements.
Definition at line 448 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 329 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 325 of file block-ack-manager.h.
|
private |
Enumeration for the statuses of a buffered MPDU.
Enumerator | |
---|---|
STAY_INFLIGHT | |
TO_RETRANSMIT | |
ACKNOWLEDGED |
Definition at line 46 of file block-ack-manager.h.
ns3::BlockAckManager::BlockAckManager | ( | ) |
Definition at line 47 of file block-ack-manager.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 52 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 694 of file block-ack-manager.cc.
References m_sendBarIfDataQueued, and NS_LOG_FUNCTION.
void ns3::BlockAckManager::CreateOriginatorAgreement | ( | const MgtAddBaRequestHeader & | reqHdr, |
const Mac48Address & | recipient ) |
reqHdr | Relative Add block ack request (action frame). |
recipient | Address of peer station involved in block ack mechanism. |
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 88 of file block-ack-manager.cc.
References GetAgreementAsOriginator(), ns3::MgtAddBaRequestHeader::GetBufferSize(), ns3::MgtAddBaRequestHeader::GetGcrGroupAddress(), 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::SetGcrGroupAddress(), 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, | ||
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. |
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 190 of file block-ack-manager.cc.
References ns3::MgtAddBaResponseHeader::GetBufferSize(), ns3::MgtAddBaResponseHeader::GetGcrGroupAddress(), ns3::MgtAddBaResponseHeader::GetTid(), ns3::MgtAddBaResponseHeader::GetTimeout(), ns3::MgtAddBaResponseHeader::IsAmsduSupported(), ns3::MgtAddBaResponseHeader::IsImmediateBlockAck(), m_recipientAgreements, NS_LOG_FUNCTION, ns3::BlockAckAgreement::SetDelayedBlockAck(), ns3::BlockAckAgreement::SetGcrGroupAddress(), 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 130 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 224 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 58 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 66 of file block-ack-manager.cc.
References m_originatorAgreements.
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 77 of file block-ack-manager.cc.
References m_recipientAgreements.
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 644 of file block-ack-manager.cc.
References m_originatorAgreements, NS_ASSERT, 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 285 of file block-ack-manager.cc.
References m_originatorAgreements.
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 858 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 846 of file block-ack-manager.cc.
References m_originatorAgreements.
const std::list< BlockAckManager::AgreementKey > & ns3::BlockAckManager::GetSendBarIfDataQueuedList | ( | ) | const |
Definition at line 688 of file block-ack-manager.cc.
References m_sendBarIfDataQueued.
|
static |
Get the type ID.
Definition at line 33 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 303 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, 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 714 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 778 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 541 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::CreateQueue().
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 368 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 420 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 614 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 628 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 395 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 513 of file block-ack-manager.cc.
References HandleInFlightMpdu(), m_originatorAgreements, ns3::Simulator::Now(), NS_LOG_FUNCTION, STAY_INFLIGHT, and TO_RETRANSMIT.
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 738 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 721 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 755 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 707 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 656 of file block-ack-manager.cc.
References ns3::Create(), 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 807 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 296 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 814 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 840 of file block-ack-manager.cc.
References m_droppedOldMpduCallback.
void ns3::BlockAckManager::SetQueue | ( | const Ptr< WifiMacQueue > | queue | ) |
queue | The WifiMacQueue object. |
Definition at line 771 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 834 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 828 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 821 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 238 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 141 of file block-ack-manager.cc.
References ns3::OriginatorBlockAckAgreement::ESTABLISHED, ns3::MgtAddBaResponseHeader::GetBufferSize(), ns3::MgtAddBaResponseHeader::GetGcrGroupAddress(), 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::SetGcrGroupAddress(), ns3::BlockAckAgreement::SetImmediateBlockAck(), ns3::BlockAckAgreement::SetStartingSequence(), ns3::OriginatorBlockAckAgreement::SetState(), ns3::BlockAckAgreement::SetTimeout(), and timeout.
|
private |
BlockAck inactivity timeout callback.
Definition at line 486 of file block-ack-manager.h.
Referenced by InactivityTimeout(), and SetBlockAckInactivityCallback().
|
private |
block ack threshold
Definition at line 483 of file block-ack-manager.h.
Referenced by SetBlockAckThreshold().
|
private |
block packets callback
Definition at line 487 of file block-ack-manager.h.
Referenced by CreateOriginatorAgreement(), and SetBlockDestinationCallback().
|
private |
the dropped MPDU callback
Definition at line 491 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 477 of file block-ack-manager.h.
Referenced by CreateOriginatorAgreement(), DestroyOriginatorAgreement(), DoDispose(), GetAgreementAsOriginator(), GetBlockAckReqHeader(), GetNBufferedPackets(), GetOriginatorStartingSequence(), GetRecipientBufferSize(), NeedBarRetransmission(), NotifyDiscardedMpdu(), NotifyGotAck(), NotifyGotBlockAck(), NotifyMissedAck(), NotifyMissedBlockAck(), NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), NotifyOriginatorAgreementReset(), StorePacket(), and UpdateOriginatorAgreement().
|
private |
The trace source fired when a state transition occurred.
Definition at line 497 of file block-ack-manager.h.
Referenced by CreateOriginatorAgreement(), GetTypeId(), NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), NotifyOriginatorAgreementReset(), and UpdateOriginatorAgreement().
|
private |
queue
Definition at line 484 of file block-ack-manager.h.
Referenced by DoDispose(), HandleInFlightMpdu(), NotifyDiscardedMpdu(), NotifyGotAck(), NotifyGotBlockAck(), ScheduleBar(), and SetQueue().
|
private |
Recipient Block Ack agreements.
Definition at line 478 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 480 of file block-ack-manager.h.
Referenced by AddToSendBarIfDataQueuedList(), GetSendBarIfDataQueuedList(), and RemoveFromSendBarIfDataQueuedList().
|
private |
transmit failed callback
Definition at line 490 of file block-ack-manager.h.
Referenced by NotifyGotBlockAck(), and SetTxFailedCallback().
|
private |
transmit OK callback
Definition at line 489 of file block-ack-manager.h.
Referenced by NotifyGotBlockAck(), and SetTxOkCallback().
|
private |
unblock packets callback
Definition at line 488 of file block-ack-manager.h.
Referenced by NotifyOriginatorAgreementNoReply(), NotifyOriginatorAgreementRejected(), SetUnblockDestinationCallback(), and UpdateOriginatorAgreement().