A Discrete-Event Network Simulator
API
qos-txop.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006, 2009 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 * Mirko Banchi <mk.banchi@gmail.com>
20 */
21
22#ifndef QOS_TXOP_H
23#define QOS_TXOP_H
24
25#include "block-ack-manager.h"
26#include "qos-utils.h"
27#include "txop.h"
28
29#include "ns3/traced-value.h"
30
31namespace ns3
32{
33
34class QosBlockedDestinations;
35class MgtAddBaResponseHeader;
36class MgtDelBaHeader;
37class AggregationCapableTransmissionListener;
38class WifiTxVector;
39class QosFrameExchangeManager;
40class WifiTxParameters;
41
72class QosTxop : public Txop
73{
74 public:
79 static TypeId GetTypeId();
80
87
88 ~QosTxop() override;
89
90 bool IsQosTxop() const override;
91 bool HasFramesToTransmit(uint8_t linkId) override;
92 void NotifyChannelAccessed(uint8_t linkId, Time txopDuration) override;
93 void NotifyChannelReleased(uint8_t linkId) override;
94 void SetDroppedMpduCallback(DroppedMpdu callback) override;
95
102
109
125 bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const;
135 uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const;
146 uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const;
155 BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const;
164 BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const;
175 Ptr<const WifiMpdu> PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const;
183 void ScheduleBar(Ptr<const WifiMpdu> bar, bool skipIfNoDataQueued = false);
184
185 /* Event handlers */
192 void GotAddBaResponse(const MgtAddBaResponseHeader* respHdr, Mac48Address recipient);
199 void GotDelBaFrame(const MgtDelBaHeader* delBaHdr, Mac48Address recipient);
206 void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid);
213 void ResetBa(Mac48Address recipient, uint8_t tid);
214
221 void SetBlockAckThreshold(uint8_t threshold);
227 uint8_t GetBlockAckThreshold() const;
228
240 uint16_t GetBlockAckInactivityTimeout() const;
247 void CompleteMpduTx(Ptr<WifiMpdu> mpdu);
253 void SetAddBaResponseTimeout(Time addBaResponseTimeout);
266 void SetFailedAddBaTimeout(Time failedAddBaTimeout);
273
281 uint16_t GetNextSequenceNumberFor(const WifiMacHeader* hdr);
290 uint16_t PeekNextSequenceNumberFor(const WifiMacHeader* hdr);
307 Ptr<WifiMpdu> PeekNextMpdu(uint8_t linkId,
308 uint8_t tid = 8,
310 Ptr<WifiMpdu> item = nullptr);
330 Ptr<WifiMpdu> GetNextMpdu(uint8_t linkId,
331 Ptr<WifiMpdu> peekedItem,
332 WifiTxParameters& txParams,
333 Time availableTime,
334 bool initialFrame);
335
342 void AssignSequenceNumber(Ptr<WifiMpdu> mpdu) const;
343
352 uint8_t GetQosQueueSize(uint8_t tid, Mac48Address receiver) const;
353
360 virtual bool IsTxopStarted(uint8_t linkId) const;
367 virtual Time GetRemainingTxop(uint8_t linkId) const;
368
376 void SetMuCwMin(uint16_t cwMin, uint8_t linkId);
384 void SetMuCwMax(uint16_t cwMax, uint8_t linkId);
392 void SetMuAifsn(uint8_t aifsn, uint8_t linkId);
399 void SetMuEdcaTimer(Time timer, uint8_t linkId);
405 void StartMuEdcaTimerNow(uint8_t linkId);
412 bool MuEdcaTimerRunning(uint8_t linkId) const;
420 bool EdcaDisabled(uint8_t linkId) const;
429 uint32_t GetMinCw(uint8_t linkId) const override;
438 uint32_t GetMaxCw(uint8_t linkId) const override;
447 uint8_t GetAifsn(uint8_t linkId) const override;
448
449 protected:
456 {
458 ~QosLinkEntity() override = default;
459
464 uint8_t muAifsn{0};
467 };
468
469 void DoDispose() override;
470
477 QosLinkEntity& GetLink(uint8_t linkId) const;
478
479 private:
482
483 std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
484
494
508
510 typedef TracedCallback<Time /* start time */, Time /* duration */, uint8_t /* link ID*/>
512
514};
515
516} // namespace ns3
517
518#endif /* QOS_TXOP_H */
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address GetBroadcast()
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1607
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1726
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:73
TracedCallback< Time, Time, uint8_t > TxopTracedCallback
TracedCallback for TXOP trace typedef.
Definition: qos-txop.h:511
QosTxop(AcIndex ac=AC_UNDEF)
Constructor.
Definition: qos-txop.cc:100
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
Definition: qos-txop.cc:136
~QosTxop() override
Definition: qos-txop.cc:117
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value.
Definition: qos-txop.h:498
Ptr< BlockAckManager > GetBaManager()
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:255
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:505
uint16_t PeekNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the Traffic ID and destination, but do not pick it (i....
Definition: qos-txop.cc:336
void SetMuCwMin(uint16_t cwMin, uint8_t linkId)
Set the minimum contention window size to use while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:167
bool UseExplicitBarAfterMissedBlockAck() const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:309
bool EdcaDisabled(uint8_t linkId) const
Return true if the EDCA is disabled (the MU EDCA Timer is running and the MU AIFSN is zero) for the g...
Definition: qos-txop.cc:217
Time GetAddBaResponseTimeout() const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:722
AcIndex GetAccessCategory() const
Get the access category of this object.
Definition: qos-txop.cc:747
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:680
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:269
Ptr< const WifiMpdu > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:281
void DoDispose() override
Destructor implementation.
Definition: qos-txop.cc:123
void SetMuCwMax(uint16_t cwMax, uint8_t linkId)
Set the maximum contention window size to use while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:174
void ScheduleBar(Ptr< const WifiMpdu > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:303
bool MuEdcaTimerRunning(uint8_t linkId) const
Return true if the MU EDCA Timer is running for the given link, false otherwise.
Definition: qos-txop.cc:208
void StartMuEdcaTimerNow(uint8_t linkId)
Start the MU EDCA Timer for the given link.
Definition: qos-txop.cc:195
uint8_t GetBlockAckThreshold() const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:667
void NotifyChannelReleased(uint8_t linkId) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:566
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:330
uint16_t GetBlockAckInactivityTimeout() const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:674
TxopTracedCallback m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:513
virtual Time GetRemainingTxop(uint8_t linkId) const
Return the remaining duration in the current TXOP on the given link.
Definition: qos-txop.cc:581
AcIndex m_ac
the access category
Definition: qos-txop.h:495
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:159
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response
Definition: qos-txop.h:506
void SetMuAifsn(uint8_t aifsn, uint8_t linkId)
Set the number of slots that make up an AIFS while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:181
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:481
uint8_t GetQosQueueSize(uint8_t tid, Mac48Address receiver) const
Get the value for the Queue Size subfield of the QoS Control field of a QoS data frame of the given T...
Definition: qos-txop.cc:148
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:261
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:698
Time GetFailedAddBaTimeout() const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:735
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:541
static TypeId GetTypeId()
Get the type ID.
Definition: qos-txop.cc:59
void AssignSequenceNumber(Ptr< WifiMpdu > mpdu) const
Assign a sequence number to the given MPDU, if it is not a fragment and it is not a retransmitted fra...
Definition: qos-txop.cc:523
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:728
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:502
Ptr< WifiMpdu > PeekNextMpdu(uint8_t linkId, uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< WifiMpdu > item=nullptr)
Peek the next frame to transmit on the given link to the given receiver and of the given TID from the...
Definition: qos-txop.cc:368
QosLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: qos-txop.cc:142
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:597
Ptr< WifiMpdu > GetNextMpdu(uint8_t linkId, Ptr< WifiMpdu > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit on the given link starting from the MPDU that has been previously peeke...
Definition: qos-txop.cc:454
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:652
bool IsQosOldPacket(Ptr< const WifiMpdu > mpdu)
Check if the given MPDU is to be considered old according to the current starting sequence number of ...
Definition: qos-txop.cc:342
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:633
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:660
BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:535
void CompleteMpduTx(Ptr< WifiMpdu > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:641
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:715
bool HasFramesToTransmit(uint8_t linkId) override
Check if the Txop has frames to transmit over the given link.
Definition: qos-txop.cc:315
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:275
bool IsQosTxop() const override
Check for QoS TXOP.
Definition: qos-txop.cc:741
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:496
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:504
void NotifyChannelAccessed(uint8_t linkId, Time txopDuration) override
Called by the FrameExchangeManager to notify that channel access has been granted on the given link f...
Definition: qos-txop.cc:547
void SetMuEdcaTimer(Time timer, uint8_t linkId)
Set the MU EDCA Timer for the given link.
Definition: qos-txop.cc:188
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:497
virtual bool IsTxopStarted(uint8_t linkId) const
Return true if a TXOP has started on the given link.
Definition: qos-txop.cc:558
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:71
uint32_t GetMinCw() const
Return the minimum contention window size.
Definition: txop.cc:404
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition: txop.cc:450
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition: txop.cc:427
a unique identifier for an interface.
Definition: type-id.h:60
Implements the IEEE 802.11 MAC header.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:88
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout
The different BlockAckRequest variants.
The different BlockAck variants.