A Discrete-Event Network Simulator
API
qos-txop.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
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
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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  */
22 
23 #ifndef QOS_TXOP_H
24 #define QOS_TXOP_H
25 
26 #include "ns3/traced-value.h"
27 #include "block-ack-manager.h"
28 #include "txop.h"
29 #include "qos-utils.h"
30 
31 namespace ns3 {
32 
33 class QosBlockedDestinations;
34 class MgtAddBaResponseHeader;
35 class MgtDelBaHeader;
36 class AggregationCapableTransmissionListener;
37 class WifiTxVector;
38 class QosFrameExchangeManager;
39 class WifiTxParameters;
40 
71 class QosTxop : public Txop
72 {
73 public:
78  static TypeId GetTypeId (void);
79 
85  QosTxop (AcIndex ac = AC_UNDEF);
86 
87  virtual ~QosTxop ();
88 
89  bool IsQosTxop (void) const override;
90  bool HasFramesToTransmit (void) override;
91  void NotifyChannelAccessed (Time txopDuration) override;
92  void NotifyChannelReleased (void) override;
93  void SetDroppedMpduCallback (DroppedMpdu callback) override;
94 
101 
107  AcIndex GetAccessCategory (void) const;
108 
114  bool UseExplicitBarAfterMissedBlockAck (void) const;
115 
131  bool GetBaAgreementEstablished (Mac48Address address, uint8_t tid) const;
141  uint16_t GetBaBufferSize (Mac48Address address, uint8_t tid) const;
152  uint16_t GetBaStartingSequence (Mac48Address address, uint8_t tid) const;
161  BlockAckReqType GetBlockAckReqType (Mac48Address recipient, uint8_t tid) const;
170  BlockAckType GetBlockAckType (Mac48Address recipient, uint8_t tid) const;
181  Ptr<const WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
189  void ScheduleBar (Ptr<const WifiMacQueueItem> bar, bool skipIfNoDataQueued = false);
190 
191  /* Event handlers */
198  void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
205  void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
212  void AddBaResponseTimeout (Mac48Address recipient, uint8_t tid);
219  void ResetBa (Mac48Address recipient, uint8_t tid);
220 
228  void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
229 
236  void SetBlockAckThreshold (uint8_t threshold);
242  uint8_t GetBlockAckThreshold (void) const;
243 
249  void SetBlockAckInactivityTimeout (uint16_t timeout);
255  uint16_t GetBlockAckInactivityTimeout (void) const;
268  void SetAddBaResponseTimeout (Time addBaResponseTimeout);
274  Time GetAddBaResponseTimeout (void) const;
281  void SetFailedAddBaTimeout (Time failedAddBaTimeout);
287  Time GetFailedAddBaTimeout (void) const;
288 
296  uint16_t GetNextSequenceNumberFor (const WifiMacHeader *hdr);
304  uint16_t PeekNextSequenceNumberFor (const WifiMacHeader *hdr);
319  Ptr<const WifiMacQueueItem> PeekNextMpdu (uint8_t tid = 8,
321  Ptr<const WifiMacQueueItem> item = nullptr);
341  Time availableTime, bool initialFrame);
342 
350 
359  uint8_t GetQosQueueSize (uint8_t tid, Mac48Address receiver) const;
360 
366  virtual bool IsTxopStarted (void) const;
372  virtual Time GetRemainingTxop (void) const;
373 
380  void SetMuCwMin (uint16_t cwMin);
387  void SetMuCwMax (uint16_t cwMax);
394  void SetMuAifsn (uint8_t aifsn);
400  void SetMuEdcaTimer (Time timer);
404  void StartMuEdcaTimerNow (void);
410  bool MuEdcaTimerRunning (void) const;
417  bool EdcaDisabled (void) const;
425  uint32_t GetMinCw (void) const override;
433  uint32_t GetMaxCw (void) const override;
441  uint8_t GetAifsn (void) const override;
442 
443 protected:
444  void DoDispose (void) override;
445 
446 private:
449 
450  void DoInitialize (void) override;
451 
461 
476 
477  uint32_t m_muCwMin;
478  uint32_t m_muCwMax;
479  uint8_t m_muAifsn;
482 
484 };
485 
486 } //namespace ns3
487 
488 #endif /* QOS_TXOP_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::QosTxop::QosTxop
QosTxop(AcIndex ac=AC_UNDEF)
Constructor.
Definition: qos-txop.cc:93
ns3::QosTxop::m_baManager
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:465
ns3::QosTxop::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: qos-txop.cc:119
ns3::Callback< void, WifiMacDropReason, Ptr< const WifiMacQueueItem > >
ns3::QosTxop::GetBaBufferSize
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:255
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::QosTxop::m_useExplicitBarAfterMissedBlockAck
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response
Definition: qos-txop.h:475
qos-utils.h
ns3::QosTxop::m_qosBlockedDestinations
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:464
ns3::QosTxop::GetBlockAckThreshold
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:654
ns3::QosTxop::m_muCwMax
uint32_t m_muCwMax
the MU CW maximum
Definition: qos-txop.h:478
ns3::QosTxop::~QosTxop
virtual ~QosTxop()
Definition: qos-txop.cc:113
ns3::QosTxop::GetBaAgreementEstablished
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:249
ns3::QosTxop::GotAddBaResponse
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:585
ns3::QosTxop::GetBaManager
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:243
ns3::QosTxop::GotDelBaFrame
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:620
ns3::QosTxop::SetBlockAckInactivityTimeout
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:647
ns3::QosTxop::PeekNextSequenceNumberFor
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:325
ns3::QosTxop::UseExplicitBarAfterMissedBlockAck
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:295
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::QosTxop::m_muAifsn
uint8_t m_muAifsn
the MU AIFSN
Definition: qos-txop.h:479
ns3::QosTxop::GetNextSequenceNumberFor
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:319
ns3::QosTxop::GetQosQueueSize
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:133
ns3::WifiTxParameters
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
Definition: wifi-tx-parameters.h:45
ns3::QosTxop::AddBaResponseTimeout
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:675
txop.h
ns3::QosTxop::NotifyChannelAccessed
void NotifyChannelAccessed(Time txopDuration) override
Called by the FrameExchangeManager to notify that channel access has been granted for the given amoun...
Definition: qos-txop.cc:527
ns3::QosTxop::SetDroppedMpduCallback
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:150
ns3::QosTxop::GetBlockAckInactivityTimeout
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:661
ns3::QosTxop::SetQosFrameExchangeManager
void SetQosFrameExchangeManager(const Ptr< QosFrameExchangeManager > qosFem)
Set the Frame Exchange Manager associated with this QoS STA.
Definition: qos-txop.cc:143
ns3::QosTxop::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: qos-txop.cc:667
ns3::QosTxop::SetBlockAckThreshold
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:639
ns3::QosTxop::GetBaStartingSequence
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:261
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::QosTxop::GetBlockAckReqType
BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:515
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast(void)
Definition: mac48-address.cc:170
ns3::QosTxop::AggregationCapableTransmissionListener
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:448
ns3::QosTxop::SetMuCwMin
void SetMuCwMin(uint16_t cwMin)
Set the minimum contention window size to use while the MU EDCA Timer is running.
Definition: qos-txop.cc:158
ns3::QosTxop::GetAccessCategory
AcIndex GetAccessCategory(void) const
Get the access category of this object.
Definition: qos-txop.cc:739
ns3::QosTxop::SetMuEdcaTimer
void SetMuEdcaTimer(Time timer)
Set the MU EDCA Timer.
Definition: qos-txop.cc:179
ns3::BlockAckReqType
The different BlockAckRequest variants.
Definition: block-ack-type.h:75
ns3::QosTxop::m_muEdcaTimerStartTime
Time m_muEdcaTimerStartTime
last start time of the MU EDCA Timer
Definition: qos-txop.h:481
ns3::QosTxop::GetAifsn
uint8_t GetAifsn(void) const override
Return the number of slots that make up an AIFS according to the EDCA Parameter Set or the MU EDCA Pa...
Definition: qos-txop.cc:233
ns3::QosTxop::AssignSequenceNumber
void AssignSequenceNumber(Ptr< WifiMacQueueItem > 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:503
ns3::QosTxop::ResetBa
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:692
ns3::QosTxop::m_failedAddBaTimeout
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:474
ns3::AC_UNDEF
@ AC_UNDEF
Total number of ACs.
Definition: qos-utils.h:85
ns3::BlockAckType
The different BlockAck variants.
Definition: block-ack-type.h:34
ns3::QosTxop::HasFramesToTransmit
bool HasFramesToTransmit(void) override
Check if the Txop has frames to transmit.
Definition: qos-txop.cc:301
ns3::QosTxop::m_qosFem
Ptr< QosFrameExchangeManager > m_qosFem
the QoS Frame Exchange Manager
Definition: qos-txop.h:463
ns3::QosTxop::SetFailedAddBaTimeout
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:720
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::QosTxop::PushFront
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: qos-txop.cc:573
ns3::QosTxop::m_blockAckInactivityTimeout
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:470
ns3::QosTxop::GetAddBaResponseTimeout
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:714
ns3::QosTxop
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:72
ns3::QosTxop::m_txopDuration
Time m_txopDuration
the duration of a TXOP
Definition: qos-txop.h:472
ns3::MgtAddBaResponseHeader
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1150
ns3::QosTxop::PrepareBlockAckRequest
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:267
ns3::QosTxop::SetAddBaResponseTimeout
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:707
ns3::QosTxop::m_currentPacketTimestamp
Time m_currentPacketTimestamp
the current packet timestamp
Definition: qos-txop.h:469
ns3::QosTxop::m_addBaResponseTimeout
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:473
ns3::MgtDelBaHeader
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1271
ns3::QosTxop::GetMinCw
uint32_t GetMinCw(void) const override
Return the minimum contention window size from the EDCA Parameter Set or the MU EDCA Parameter Set,...
Definition: qos-txop.cc:211
timeout
ns3::Time timeout
Definition: openflow-switch.cc:52
ns3::QosTxop::IsQosOldPacket
bool IsQosOldPacket(Ptr< const WifiMacQueueItem > mpdu)
Check if the given MPDU is to be considered old according to the current starting sequence number of ...
Definition: qos-txop.cc:331
ns3::QosTxop::m_ac
AcIndex m_ac
the access category
Definition: qos-txop.h:462
ns3::QosTxop::m_muCwMin
uint32_t m_muCwMin
the MU CW minimum
Definition: qos-txop.h:477
ns3::QosTxop::NotifyChannelReleased
void NotifyChannelReleased(void) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:545
ns3::QosTxop::GetMaxCw
uint32_t GetMaxCw(void) const override
Return the maximum contention window size from the EDCA Parameter Set or the MU EDCA Parameter Set,...
Definition: qos-txop.cc:222
ns3::QosTxop::m_muEdcaTimer
Time m_muEdcaTimer
the MU EDCA Timer
Definition: qos-txop.h:480
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::QosTxop::StartMuEdcaTimerNow
void StartMuEdcaTimerNow(void)
Start the MU EDCA Timer.
Definition: qos-txop.cc:186
ns3::QosTxop::ScheduleBar
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:289
ns3::QosTxop::m_startTxop
Time m_startTxop
the start TXOP time
Definition: qos-txop.h:471
ns3::QosTxop::GetNextMpdu
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:437
ns3::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMacQueueItem > item=nullptr)
Peek the next frame to transmit to the given receiver and of the given TID from the EDCA queue.
Definition: qos-txop.cc:357
ns3::TracedCallback< Time, Time >
ns3::QosTxop::EdcaDisabled
bool EdcaDisabled(void) const
Return true if the EDCA is disabled (the MU EDCA Timer is running and the MU AIFSN is zero),...
Definition: qos-txop.cc:205
ns3::QosTxop::GetBlockAckType
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:521
ns3::QosTxop::m_blockAckThreshold
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value.
Definition: qos-txop.h:466
ns3::QosTxop::MuEdcaTimerRunning
bool MuEdcaTimerRunning(void) const
Return true if the MU EDCA Timer is running, false otherwise.
Definition: qos-txop.cc:198
block-ack-manager.h
ns3::QosTxop::CompleteMpduTx
void CompleteMpduTx(Ptr< WifiMacQueueItem > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:628
ns3::QosTxop::IsQosTxop
bool IsQosTxop(void) const override
Check for QoS TXOP.
Definition: qos-txop.cc:733
ns3::QosTxop::SetMuAifsn
void SetMuAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS while the MU EDCA Timer is running.
Definition: qos-txop.cc:172
ns3::QosTxop::SetMuCwMax
void SetMuCwMax(uint16_t cwMax)
Set the maximum contention window size to use while the MU EDCA Timer is running.
Definition: qos-txop.cc:165
ns3::QosTxop::IsTxopStarted
virtual bool IsTxopStarted(void) const
Return true if a TXOP has started.
Definition: qos-txop.cc:538
ns3::QosTxop::GetFailedAddBaTimeout
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:727
ns3::QosTxop::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: qos-txop.cc:53
ns3::QosTxop::m_txopTrace
TracedCallback< Time, Time > m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:483
ns3::QosTxop::GetRemainingTxop
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.
Definition: qos-txop.cc:559
ns3::Txop
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:65