94 std::set<std::size_t> distances;
95 for (
const auto seqN : seqNumbers)
100 for (std::size_t i = 0; i <
m_txWindow.GetWinSize(); ++i)
102 if (distances.contains(i))
127 uint16_t mpduSeqNumber = mpdu->GetHeader().GetSequenceNumber();
140 std::size_t count = distance -
m_txWindow.GetWinSize() + 1;
145 "Transmitted MPDU beyond current transmit window. New starting sequence number: "
153 uint16_t mpduSeqNumber = mpdu->GetHeader().GetSequenceNumber();
176 uint16_t mpduSeqNumber = mpdu->GetHeader().GetSequenceNumber();
188 NS_LOG_DEBUG(
"Discarded MPDU within current transmit window. New starting sequence number: "
BlockAckAgreement(Mac48Address peer, uint8_t tid)
Constructor for BlockAckAgreement with given peer and TID.
uint16_t m_startingSeq
Starting sequence control.
uint16_t m_bufferSize
Buffer size.
static std::size_t GetDistance(uint16_t seqNumber, uint16_t startingSeqNumber)
Get the distance between the given starting sequence number and the given sequence number.
void NotifyDiscardedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window beyond the MPDU that has been reported to be discarded.
uint16_t GetStartingSequence() const override
Return the starting sequence number of the transmit window, if a transmit window has been initialized...
BlockAckWindow m_txWindow
originator's transmit window
void NotifyTransmittedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet...
void NotifyAckedMpdu(Ptr< const WifiMpdu > mpdu)
Record that the given MPDU has been acknowledged and advance the transmit window if possible.
bool IsPending() const
Check if the current state of this agreement is PENDING.
bool IsReset() const
Check if the current state of this agreement is RESET.
void AdvanceTxWindow()
Advance the transmit window so that the starting sequence number is the nearest unacknowledged MPDU.
OriginatorBlockAckAgreement(Mac48Address recipient, uint8_t tid)
Constructor.
bool IsEstablished() const
Check if the current state of this agreement is ESTABLISHED.
void SetState(State state)
Set the current state.
bool AllAckedMpdusInTxWindow(const std::set< uint16_t > &seqNumbers) const
Check whether all the MPDUs in the TX window other than the given ones have been already acknowledged...
State
Represents the state for this agreement.
std::size_t GetDistance(uint16_t seqNumber) const
Get the distance between the current starting sequence number and the given sequence number.
~OriginatorBlockAckAgreement() override
bool IsNoReply() const
Check if the current state of this agreement is NO_REPLY.
bool IsRejected() const
Check if the current state of this agreement is REJECTED.
void InitTxWindow()
Initialize the originator's transmit window by setting its size and starting sequence number equal to...
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint16_t SEQNO_SPACE_HALF_SIZE
Size of the half the space of sequence numbers (used to determine old packets)