A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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 MgtAddBaResponseHeader;
35class MgtDelBaHeader;
36class AggregationCapableTransmissionListener;
37class WifiTxVector;
38class QosFrameExchangeManager;
39class WifiTxParameters;
40
71class QosTxop : public Txop
72{
73 public:
78 static TypeId GetTypeId();
79
86
87 ~QosTxop() override;
88
89 bool IsQosTxop() const override;
90 bool HasFramesToTransmit(uint8_t linkId) override;
91 void NotifyChannelAccessed(uint8_t linkId, Time txopDuration) override;
92 void NotifyChannelReleased(uint8_t linkId) override;
93 void SetDroppedMpduCallback(DroppedMpdu callback) override;
94
101
108
124 uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const;
135 uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const;
146 std::pair<CtrlBAckRequestHeader, WifiMacHeader> PrepareBlockAckRequest(Mac48Address recipient,
147 uint8_t tid) const;
148
149 /* Event handlers */
156 void GotAddBaResponse(const MgtAddBaResponseHeader& respHdr, Mac48Address recipient);
163 void GotDelBaFrame(const MgtDelBaHeader* delBaHdr, Mac48Address recipient);
171 void NotifyOriginatorAgreementNoReply(const Mac48Address& recipient, uint8_t tid);
178 void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid);
185 void ResetBa(Mac48Address recipient, uint8_t tid);
186
193 void SetBlockAckThreshold(uint8_t threshold);
199 uint8_t GetBlockAckThreshold() const;
200
212 uint16_t GetBlockAckInactivityTimeout() const;
219 void CompleteMpduTx(Ptr<WifiMpdu> mpdu);
225 void SetAddBaResponseTimeout(Time addBaResponseTimeout);
238 void SetFailedAddBaTimeout(Time failedAddBaTimeout);
245
253 uint16_t GetNextSequenceNumberFor(const WifiMacHeader* hdr);
262 uint16_t PeekNextSequenceNumberFor(const WifiMacHeader* hdr);
279 Ptr<WifiMpdu> PeekNextMpdu(uint8_t linkId,
280 uint8_t tid = 8,
282 Ptr<const WifiMpdu> mpdu = nullptr);
302 Ptr<WifiMpdu> GetNextMpdu(uint8_t linkId,
303 Ptr<WifiMpdu> peekedItem,
304 WifiTxParameters& txParams,
305 Time availableTime,
306 bool initialFrame);
307
314 void AssignSequenceNumber(Ptr<WifiMpdu> mpdu) const;
315
324 uint8_t GetQosQueueSize(uint8_t tid, Mac48Address receiver) const;
325
332 virtual bool IsTxopStarted(uint8_t linkId) const;
339 virtual Time GetRemainingTxop(uint8_t linkId) const;
340
348 void SetMuCwMin(uint16_t cwMin, uint8_t linkId);
356 void SetMuCwMax(uint16_t cwMax, uint8_t linkId);
364 void SetMuAifsn(uint8_t aifsn, uint8_t linkId);
371 void SetMuEdcaTimer(Time timer, uint8_t linkId);
377 void StartMuEdcaTimerNow(uint8_t linkId);
384 bool MuEdcaTimerRunning(uint8_t linkId) const;
392 bool EdcaDisabled(uint8_t linkId) const;
401 uint32_t GetMinCw(uint8_t linkId) const override;
410 uint32_t GetMaxCw(uint8_t linkId) const override;
419 uint8_t GetAifsn(uint8_t linkId) const override;
420
421 protected:
428 {
430 ~QosLinkEntity() override = default;
431
436 uint8_t muAifsn{0};
439 };
440
441 void DoDispose() override;
442
449 QosLinkEntity& GetLink(uint8_t linkId) const;
450
451 private:
454
455 std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
456
466
482
484 typedef TracedCallback<Time /* start time */, Time /* duration */, uint8_t /* link ID*/>
486
488};
489
490} // namespace ns3
491
492#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:926
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1045
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:72
TracedCallback< Time, Time, uint8_t > TxopTracedCallback
TracedCallback for TXOP trace typedef.
Definition: qos-txop.h:485
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
Definition: qos-txop.cc:154
~QosTxop() override
Definition: qos-txop.cc:136
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value.
Definition: qos-txop.h:469
Ptr< BlockAckManager > GetBaManager()
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:273
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:476
Ptr< WifiMpdu > PeekNextMpdu(uint8_t linkId, uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMpdu > mpdu=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:365
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:337
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:185
bool UseExplicitBarAfterMissedBlockAck() const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:314
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:235
Time GetAddBaResponseTimeout() const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:749
AcIndex GetAccessCategory() const
Get the access category of this object.
Definition: qos-txop.cc:774
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:714
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:279
void DoDispose() override
Destructor implementation.
Definition: qos-txop.cc:142
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:192
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:226
void StartMuEdcaTimerNow(uint8_t linkId)
Start the MU EDCA Timer for the given link.
Definition: qos-txop.cc:213
uint8_t GetBlockAckThreshold() const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:701
void NotifyChannelReleased(uint8_t linkId) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:584
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:331
uint16_t GetBlockAckInactivityTimeout() const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:708
TxopTracedCallback m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:487
virtual Time GetRemainingTxop(uint8_t linkId) const
Return the remaining duration in the current TXOP on the given link.
Definition: qos-txop.cc:599
AcIndex m_ac
the access category
Definition: qos-txop.h:467
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:177
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response
Definition: qos-txop.h:477
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:199
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:453
void NotifyOriginatorAgreementNoReply(const Mac48Address &recipient, uint8_t tid)
Take action upon notification of ADDBA_REQUEST frame being discarded (likely due to exceeded max retr...
Definition: qos-txop.cc:658
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:166
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:727
Time GetFailedAddBaTimeout() const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:762
void GotAddBaResponse(const MgtAddBaResponseHeader &respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:615
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:551
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:755
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:473
QosLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: qos-txop.cc:160
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:482
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:686
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:343
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:650
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:694
uint8_t m_nMaxInflights
the maximum number of links on which an MPDU can be in-flight at the same time
Definition: qos-txop.h:479
void CompleteMpduTx(Ptr< WifiMpdu > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:672
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:742
std::pair< CtrlBAckRequestHeader, WifiMacHeader > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:291
bool HasFramesToTransmit(uint8_t linkId) override
Check if the Txop has frames to transmit over the given link.
Definition: qos-txop.cc:320
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:285
bool IsQosTxop() const override
Check for QoS TXOP.
Definition: qos-txop.cc:768
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:475
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:565
void SetMuEdcaTimer(Time timer, uint8_t linkId)
Set the MU EDCA Timer for the given link.
Definition: qos-txop.cc:206
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:468
virtual bool IsTxopStarted(uint8_t linkId) const
Return true if a TXOP has started on the given link.
Definition: qos-txop.cc:576
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:400
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
Definition: txop.cc:446
uint32_t GetMaxCw() const
Return the maximum contention window size.
Definition: txop.cc:423
a unique identifier for an interface.
Definition: type-id.h:59
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:72
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:86
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout