A Discrete-Event Network Simulator
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2006, 2009 INRIA
4 * Copyright (c) 2009 MIRKO BANCHI
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20 * Mirko Banchi <mk.banchi@gmail.com>
21 */
23#ifndef QOS_TXOP_H
24#define QOS_TXOP_H
26#include "ns3/traced-value.h"
27#include "block-ack-manager.h"
28#include "txop.h"
29#include "qos-utils.h"
31namespace ns3 {
33class QosBlockedDestinations;
34class MgtAddBaResponseHeader;
35class MgtDelBaHeader;
36class AggregationCapableTransmissionListener;
37class WifiTxVector;
38class QosFrameExchangeManager;
39class WifiTxParameters;
71class QosTxop : public Txop
78 static TypeId GetTypeId (void);
87 virtual ~QosTxop ();
89 bool IsQosTxop (void) 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;
100 AcIndex GetAccessCategory (void) const;
107 bool UseExplicitBarAfterMissedBlockAck (void) const;
124 bool GetBaAgreementEstablished (Mac48Address address, uint8_t tid) const;
134 uint16_t GetBaBufferSize (Mac48Address address, uint8_t tid) const;
145 uint16_t GetBaStartingSequence (Mac48Address address, uint8_t tid) const;
154 BlockAckReqType GetBlockAckReqType (Mac48Address recipient, uint8_t tid) const;
163 BlockAckType GetBlockAckType (Mac48Address recipient, uint8_t tid) const;
174 Ptr<const WifiMpdu> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
182 void ScheduleBar (Ptr<const WifiMpdu> bar, bool skipIfNoDataQueued = false);
184 /* Event handlers */
191 void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
198 void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
205 void AddBaResponseTimeout (Mac48Address recipient, uint8_t tid);
212 void ResetBa (Mac48Address recipient, uint8_t tid);
220 void SetBlockAckThreshold (uint8_t threshold);
226 uint8_t GetBlockAckThreshold (void) const;
239 uint16_t GetBlockAckInactivityTimeout (void) const;
246 void CompleteMpduTx (Ptr<WifiMpdu> mpdu);
252 void SetAddBaResponseTimeout (Time addBaResponseTimeout);
258 Time GetAddBaResponseTimeout (void) const;
265 void SetFailedAddBaTimeout (Time failedAddBaTimeout);
271 Time GetFailedAddBaTimeout (void) const;
280 uint16_t GetNextSequenceNumberFor (const WifiMacHeader *hdr);
288 uint16_t PeekNextSequenceNumberFor (const WifiMacHeader *hdr);
305 Ptr<WifiMpdu> PeekNextMpdu (uint8_t linkId, uint8_t tid = 8,
307 Ptr<WifiMpdu> item = nullptr);
327 Ptr<WifiMpdu> GetNextMpdu (uint8_t linkId, Ptr<WifiMpdu> peekedItem,
328 WifiTxParameters& txParams, Time availableTime, bool initialFrame);
336 void AssignSequenceNumber (Ptr<WifiMpdu> mpdu) const;
346 uint8_t GetQosQueueSize (uint8_t tid, Mac48Address receiver) const;
354 virtual bool IsTxopStarted (uint8_t linkId) const;
361 virtual Time GetRemainingTxop (uint8_t linkId) const;
370 void SetMuCwMin (uint16_t cwMin, uint8_t linkId);
378 void SetMuCwMax (uint16_t cwMax, uint8_t linkId);
386 void SetMuAifsn (uint8_t aifsn, uint8_t linkId);
393 void SetMuEdcaTimer (Time timer, uint8_t linkId);
399 void StartMuEdcaTimerNow (uint8_t linkId);
406 bool MuEdcaTimerRunning (uint8_t linkId) const;
414 bool EdcaDisabled (uint8_t linkId) const;
423 uint32_t GetMinCw (uint8_t linkId) const override;
432 uint32_t GetMaxCw (uint8_t linkId) const override;
441 uint8_t GetAifsn (uint8_t linkId) const override;
450 {
452 virtual ~QosLinkEntity () = default;
458 uint8_t muAifsn {0};
461 };
463 void DoDispose (void) override;
471 QosLinkEntity& GetLink (uint8_t linkId) const;
477 std::unique_ptr<LinkEntity> CreateLinkEntity (void) const override;
501 typedef TracedCallback<Time /* start time */, Time /* duration */, uint8_t /* link ID*/> TxopTracedCallback;
506} //namespace ns3
508#endif /* QOS_TXOP_H */
an EUI-48 address
Definition: mac48-address.h:44
static Mac48Address GetBroadcast(void)
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1616
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1737
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:501
QosTxop(AcIndex ac=AC_UNDEF)
Definition: qos-txop.cc:93
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value.
Definition: qos-txop.h:492
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:497
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:322
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:156
bool IsQosTxop(void) const override
Check for QoS TXOP.
Definition: qos-txop.cc:720
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:205
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:662
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:255
Ptr< const WifiMpdu > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:267
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:163
void ScheduleBar(Ptr< const WifiMpdu > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:289
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:197
void DoDispose(void) override
Destructor implementation.
Definition: qos-txop.cc:112
void StartMuEdcaTimerNow(uint8_t linkId)
Start the MU EDCA Timer for the given link.
Definition: qos-txop.cc:184
void NotifyChannelReleased(uint8_t linkId) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:549
std::unique_ptr< LinkEntity > CreateLinkEntity(void) const override
Create a LinkEntity object.
Definition: qos-txop.cc:125
virtual ~QosTxop()
Definition: qos-txop.cc:106
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:649
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:316
TxopTracedCallback m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:503
virtual Time GetRemainingTxop(uint8_t linkId) const
Return the remaining duration in the current TXOP on the given link.
Definition: qos-txop.cc:564
AcIndex m_ac
the access category
Definition: qos-txop.h:489
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:148
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response
Definition: qos-txop.h:498
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:714
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:170
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:475
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:137
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:249
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:679
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:701
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:524
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:656
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:506
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:243
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:295
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:707
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:495
AcIndex GetAccessCategory(void) const
Get the access category of this object.
Definition: qos-txop.cc:726
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:354
QosLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: qos-txop.cc:131
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:580
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:440
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:634
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:328
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:615
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:642
BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:518
void CompleteMpduTx(Ptr< WifiMpdu > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:623
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:694
static TypeId GetTypeId(void)
Get the type ID.
Definition: qos-txop.cc:53
bool HasFramesToTransmit(uint8_t linkId) override
Check if the Txop has frames to transmit over the given link.
Definition: qos-txop.cc:301
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:261
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:490
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:496
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:530
void SetMuEdcaTimer(Time timer, uint8_t linkId)
Set the MU EDCA Timer for the given link.
Definition: qos-txop.cc:177
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:491
virtual bool IsTxopStarted(uint8_t linkId) const
Return true if a TXOP has started on the given link.
Definition: qos-txop.cc:541
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
Forward calls to a chain of Callback.
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:67
uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: txop.cc:409
uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: txop.cc:386
uint8_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: txop.cc:432
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,...
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:73
Total number of ACs.
Definition: qos-utils.h:87
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.