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 
74 class QosTxop : public Txop
75 {
76 public:
81  static TypeId GetTypeId (void);
82 
83  QosTxop ();
84  virtual ~QosTxop ();
85 
86  bool IsQosTxop (void) const override;
87  AcIndex GetAccessCategory (void) const override;
88  void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager) override;
89  bool HasFramesToTransmit (void) override;
90  void NotifyInternalCollision (void) override;
91  void NotifyChannelAccessed (Time txopDuration) override;
92  void NotifyChannelReleased (void) override;
93  void SetDroppedMpduCallback (DroppedMpdu callback) override;
94 
101 
107  bool UseExplicitBarAfterMissedBlockAck (void) const;
108 
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 WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
182  void ScheduleBar (Ptr<const WifiMacQueueItem> bar, bool skipIfNoDataQueued = false);
183 
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);
213 
219  void SetAccessCategory (AcIndex ac);
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);
318  Ptr<const WifiMacQueueItem> PeekNextMpdu (uint8_t tid = 8,
336  uint8_t tid = 8,
360  Time availableTime, bool initialFrame,
362 
370 
377 
383  virtual bool IsTxopStarted (void) const;
389  virtual Time GetRemainingTxop (void) const;
390 
391 protected:
392  void DoDispose (void) override;
393 
394 private:
397 
398  void DoInitialize (void) override;
399 
409 
424 
426 };
427 
428 } //namespace ns3
429 
430 #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:1123
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1244
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:75
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value.
Definition: qos-txop.h:414
TracedCallback< Time, Time > m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:425
virtual bool IsTxopStarted(void) const
Return true if a TXOP has started.
Definition: qos-txop.cc:577
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:422
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:245
void SetQosFrameExchangeManager(const Ptr< QosFrameExchangeManager > qosFem)
Set the Frame Exchange Manager associated with this QoS STA.
Definition: qos-txop.cc:138
bool IsQosTxop(void) const override
Check for QoS TXOP.
Definition: qos-txop.cc:779
void DoInitialize(void) override
Initialize() implementation.
Definition: qos-txop.cc:713
void SetAccessCategory(AcIndex ac)
Set the access category of this EDCAF.
Definition: qos-txop.cc:612
Time m_startTxop
the start TXOP time
Definition: qos-txop.h:419
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:566
void NotifyChannelReleased(void) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:584
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:460
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:721
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
Definition: qos-txop.cc:277
void SetQosQueueSize(Ptr< WifiMacQueueItem > mpdu)
Set the Queue Size subfield of the QoS Control field of the given QoS data frame.
Definition: qos-txop.cc:122
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:167
Time m_txopDuration
the duration of a TXOP
Definition: qos-txop.h:420
void DoDispose(void) override
Destructor implementation.
Definition: qos-txop.cc:112
bool HasFramesToTransmit(void) override
Check if the Txop has frames to transmit.
Definition: qos-txop.cc:221
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.
Definition: qos-txop.cc:598
virtual ~QosTxop()
Definition: qos-txop.cc:106
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:251
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:700
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:239
AcIndex m_ac
the access category
Definition: qos-txop.h:410
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:145
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response
Definition: qos-txop.h:423
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:773
void CompleteMpduTx(Ptr< WifiMacQueueItem > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:674
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager) override
Set WifiRemoteStationsManager this Txop is associated to.
Definition: qos-txop.cc:207
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:396
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:179
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:161
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:738
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: qos-txop.cc:619
void NotifyInternalCollision(void) override
Notify the Txop that internal collision has occurred.
Definition: qos-txop.cc:484
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:760
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:478
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:707
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:155
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:215
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:766
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:418
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:631
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:685
Time m_currentPacketTimestamp
the current packet timestamp
Definition: qos-txop.h:417
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:666
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:693
BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:472
AcIndex GetAccessCategory(void) const override
Get the access category.
Definition: qos-txop.cc:785
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:753
static TypeId GetTypeId(void)
Get the type ID.
Definition: qos-txop.cc:54
Ptr< QosFrameExchangeManager > m_qosFem
the QoS Frame Exchange Manager
Definition: qos-txop.h:411
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:173
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:412
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:421
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::QueueIteratorPair &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:359
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:201
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:413
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:66
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:71
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout
The different BlockAckRequest variants.
The different BlockAck variants.
Information needed to remove an MSDU from the queue.