9#ifndef BLOCK_ACK_MANAGER_H
10#define BLOCK_ACK_MANAGER_H
20#include "ns3/nstime.h"
21#include "ns3/object.h"
22#include "ns3/traced-callback.h"
70 std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement>>;
73 std::optional<std::reference_wrapper<const RecipientBlockAckAgreement>>;
87 std::optional<Mac48Address> gcrGroupAddr = std::nullopt)
const;
101 std::optional<Mac48Address> gcrGroupAddr = std::nullopt)
const;
122 std::optional<Mac48Address> gcrGroupAddr);
132 uint16_t startingSeq);
152 uint16_t startingSeq,
163 std::optional<Mac48Address> gcrGroupAddr);
222 const std::set<uint8_t>& tids,
266 uint16_t startingSeq,
267 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
296 std::optional<Mac48Address> gcrGroupAddr);
308 std::optional<Mac48Address> gcrGroupAddr);
319 std::optional<Mac48Address> gcrGroupAddr);
463 std::optional<Mac48Address> gcrGroupAddr = std::nullopt)
const;
560 std::optional<Mac48Address> gcrGroupAddr);
571 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
584 std::multimap<AgreementKey, std::pair<OriginatorBlockAckAgreement, PacketQueue>>;
607 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
619 std::optional<Mac48Address> gcrGroupAddr = std::nullopt)
const;
631 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
643 std::optional<Mac48Address> gcrGroupAddr = std::nullopt)
const;
std::optional< std::pair< uint16_t, uint16_t > > NotifyGotGcrBlockAck(uint8_t linkId, const CtrlBAckResponseHeader &blockAck, const Mac48Address &recipient, const GcrManager::GcrMembers &members)
void SetTxFailedCallback(TxFailed callback)
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef (MAC address and TID)
void UpdateOriginatorAgreement(const MgtAddBaResponseHeader &respHdr, const Mac48Address &recipient, uint16_t startingSeq)
Callback< void, Mac48Address, uint8_t > m_unblockPackets
unblock packets callback
OriginatorAgreements::iterator OriginatorAgreementsI
An iterator for originator block ack agreements.
void SetQueue(const Ptr< WifiMacQueue > queue)
void SetTxOkCallback(TxOk callback)
std::map< Mac48Address, CtrlBAckResponseHeader > GcrBlockAcks
List of received GCR BlockAck frames indexed by originator.
OriginatorAgreementsI GetOriginatorBaAgreement(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
CtrlBAckRequestHeader GetBlockAckReqHeader(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
void NotifyOriginatorAgreementNoReply(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
uint8_t m_blockAckThreshold
block ack threshold
void NotifyLastGcrUrTx(Ptr< const WifiMpdu > mpdu, const GcrManager::GcrMembers &recipients)
Notify the block ack manager about the last groupcast MPDU transmitted with the GCR-UR service.
RecipientAgreements m_recipientAgreements
Recipient Block Ack agreements.
~BlockAckManager() override
static TypeId GetTypeId()
Get the type ID.
TracedCallback< Time, Mac48Address, uint8_t, OriginatorBlockAckAgreement::State > m_originatorAgreementState
The trace source fired when a state transition occurred.
void SetBlockAckThreshold(uint8_t nPackets)
DroppedOldMpdu m_droppedOldMpduCallback
the dropped MPDU callback
std::list< Ptr< WifiMpdu > > PacketQueue
typedef for a list of WifiMpdu.
void SetDroppedOldMpduCallback(DroppedOldMpdu callback)
std::multimap< AgreementKey, RecipientBlockAckAgreement > RecipientAgreements
AgreementKey-indexed map of recipient block ack agreements.
TxFailed m_txFailedCallback
transmit failed callback
void SetUnblockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
Set unblock destination callback.
std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > > OriginatorAgreementOptConstRef
optional const reference to OriginatorBlockAckAgreement
Ptr< WifiMacQueue > m_queue
queue
RecipientAgreements::iterator RecipientAgreementsI
An iterator for recipient block ack agreements.
uint16_t GetRecipientBufferSize(const Mac48Address &recipient, uint8_t tid) const
This function returns the buffer size negotiated with the recipient.
void NotifyOriginatorAgreementRejected(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
void CreateOriginatorAgreement(const MgtAddBaRequestHeader &reqHdr, const Mac48Address &recipient)
void CreateRecipientAgreement(const MgtAddBaResponseHeader &respHdr, const Mac48Address &originator, uint16_t startingSeq, Ptr< MacRxMiddle > rxMiddle)
Callback< void, Mac48Address, uint8_t, bool, std::optional< Mac48Address > > m_blockAckInactivityTimeout
BlockAck inactivity timeout callback.
OriginatorAgreements::const_iterator OriginatorAgreementsCI
A const iterator for originator block ack agreements.
void DestroyOriginatorAgreement(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
bool NeedGcrBarRetransmission(const Mac48Address &gcrGroupAddress, const Mac48Address &recipient, uint8_t tid) const
This function returns true if a GCR block ack agreement is established with the given recipient,...
void NotifyMissedBlockAck(uint8_t linkId, const Mac48Address &recipient, uint8_t tid)
OriginatorAgreements m_originatorAgreements
This data structure contains, for each originator block ack agreement (recipient, TID),...
void StorePacket(Ptr< WifiMpdu > mpdu)
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 s...
BlockAckManager & operator=(const BlockAckManager &)=delete
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 sen...
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 i...
void NotifyDiscardedMpdu(Ptr< const WifiMpdu > mpdu)
bool IsGcrAgreementEstablished(const Mac48Address &gcrGroupAddress, uint8_t tid, const GcrManager::GcrMembers &members) const
Check if a GCR Block Ack agreement has been successfully established with all members of the group.
void NotifyGotMpdu(Ptr< const WifiMpdu > mpdu)
void HandleDiscardedMpdu(Ptr< const WifiMpdu > mpdu, OriginatorAgreementsI iter)
Handle discarded MPDU by making the transmit window advance beyond the discarded frame.
Callback< void, Ptr< const WifiMpdu > > TxFailed
typedef for a callback to invoke when an MPDU is negatively ack'ed.
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 g...
Callback< void, Ptr< const WifiMpdu > > TxOk
typedef for a callback to invoke when an MPDU is successfully ack'ed.
void SetBlockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
Set block destination callback.
void NotifyOriginatorAgreementReset(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
std::list< AgreementKey > m_sendBarIfDataQueued
list of BA agreements for which a BAR shall only be sent if data is queued
void DestroyRecipientAgreement(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
Destroy a recipient Block Ack agreement.
uint32_t GetNBufferedPackets(const Mac48Address &recipient, uint8_t tid) const
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.
std::list< Ptr< WifiMpdu > >::iterator PacketQueueI
typedef for an iterator for PacketQueue.
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool, std::optional< Mac48Address > > callback)
Set block ack inactivity callback.
OriginatorAgreementOptConstRef GetAgreementAsOriginator(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
RecipientAgreements::const_iterator RecipientAgreementsCI
A const iterator for recipient block ack agreements.
uint16_t GetOriginatorStartingSequence(const Mac48Address &recipient, uint8_t tid) const
This function returns the starting sequence number of the transmit window.
void NotifyGotBlockAckRequest(const Mac48Address &originator, uint8_t tid, uint16_t startingSeq, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
uint16_t GetGcrStartingSequence(const Mac48Address &groupAddress, uint8_t tid) const
This function returns the starting sequence number of the transmit window for a given GCR Block Ack a...
BlockAckManager(const BlockAckManager &)=delete
Callback< void, Ptr< const WifiMpdu > > DroppedOldMpdu
typedef for a callback to invoke when an MPDU is dropped.
uint16_t GetGcrBufferSize(const Mac48Address &groupAddress, uint8_t tid) const
This function returns the minimum buffer size from ADDBA Response frames sent by all members of a gro...
TxOk m_txOkCallback
transmit OK callback
MpduStatus
Enumeration for the statuses of a buffered MPDU.
void(* AgreementStateTracedCallback)(Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
TracedCallback signature for state changes.
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 DoDispose() override
Destructor implementation.
std::multimap< AgreementKey, std::pair< OriginatorBlockAckAgreement, PacketQueue > > OriginatorAgreements
AgreementKey-indexed map of originator block ack agreements.
std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > > RecipientAgreementOptConstRef
optional const reference to RecipientBlockAckAgreement
void ScheduleBar(const CtrlBAckRequestHeader &reqHdr, const WifiMacHeader &hdr)
void InactivityTimeout(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
Inactivity timeout function for a Block Ack agreement.
Callback< void, Mac48Address, uint8_t > m_blockPackets
block packets callback
void DoStorePacket(Ptr< WifiMpdu > mpdu, const Mac48Address &recipient, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
void StoreGcrPacket(Ptr< WifiMpdu > mpdu, const GcrManager::GcrMembers &members)
RecipientAgreementsI GetRecipientBaAgreement(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
RecipientAgreementOptConstRef GetAgreementAsRecipient(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
const std::list< AgreementKey > & GetSendBarIfDataQueuedList() const
std::map< Mac48Address, GcrBlockAcks > m_gcrBlockAcks
received GCR Block ACKs
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 ...
std::unordered_set< Mac48Address, WifiAddressHash > GcrMembers
MAC addresses of member STAs of a GCR group.
This class handles duplicate detection and recomposition of fragments.
State
Represents the state for this agreement.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
This queue implements the timeout procedure described in (Section 9.19.2.6 "Retransmit procedures" pa...
Every class exported by the ns3 library is enclosed in the ns3 namespace.