A Discrete-Event Network Simulator
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
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"
31 namespace ns3 {
33 class QosBlockedDestinations;
34 class MgtAddBaResponseHeader;
35 class MgtDelBaHeader;
36 class AggregationCapableTransmissionListener;
37 class WifiTxVector;
38 class QosFrameExchangeManager;
39 class WifiTxParameters;
74 class QosTxop : public Txop
75 {
76 public:
81  static TypeId GetTypeId (void);
83  QosTxop ();
84  virtual ~QosTxop ();
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;
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 WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
182  void ScheduleBar (Ptr<const WifiMacQueueItem> 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);
219  void SetAccessCategory (AcIndex ac);
228  void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
236  void SetBlockAckThreshold (uint8_t threshold);
242  uint8_t GetBlockAckThreshold (void) const;
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;
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,
383  virtual bool IsTxopStarted (void) const;
389  virtual Time GetRemainingTxop (void) const;
391 protected:
392  void DoDispose (void) override;
394 private:
398  void DoInitialize (void) override;
426 };
428 } //namespace ns3
430 #endif /* QOS_TXOP_H */
AcIndex m_ac
the access category
Definition: qos-txop.h:410
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:201
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
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:738
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager) override
Set WifiRemoteStationsManager this Txop is associated to.
Definition: qos-txop.cc:207
void DoDispose(void) override
Destructor implementation.
Definition: qos-txop.cc:112
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:70
Time m_startTxop
the start TXOP time
Definition: qos-txop.h:419
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:74
Information needed to remove an MSDU from the queue.
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:155
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:693
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:173
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:666
virtual ~QosTxop()
Definition: qos-txop.cc:106
ns3::Time timeout
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.
Definition: qos-txop.cc:598
void SetAccessCategory(AcIndex ac)
Set the access category of this EDCAF.
Definition: qos-txop.cc:612
The different BlockAckRequest variants.
static TypeId GetTypeId(void)
Get the type ID.
Definition: qos-txop.cc:54
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:700
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:215
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:422
bool IsQosTxop(void) const override
Check for QoS TXOP.
Definition: qos-txop.cc:779
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
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:760
Ptr< QosFrameExchangeManager > m_qosFem
the QoS Frame Exchange Manager
Definition: qos-txop.h:411
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:396
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:707
void SetQosFrameExchangeManager(const Ptr< QosFrameExchangeManager > qosFem)
Set the Frame Exchange Manager associated with this QoS STA.
Definition: qos-txop.cc:138
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:766
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:413
void DoInitialize(void) override
Initialize() implementation.
Definition: qos-txop.cc:713
static Mac48Address GetBroadcast(void)
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:631
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:239
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: qos-txop.cc:619
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 SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:753
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time m_txopDuration
the duration of a TXOP
Definition: qos-txop.h:420
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:478
Definition: first.py:44
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 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
an EUI-48 address
Definition: mac48-address.h:43
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:145
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:685
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
AcIndex GetAccessCategory(void) const override
Get the access category.
Definition: qos-txop.cc:785
BlockAckReqType GetBlockAckReqType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:472
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
bool HasFramesToTransmit(void) override
Check if the Txop has frames to transmit.
Definition: qos-txop.cc:221
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
The different BlockAck variants.
void NotifyChannelReleased(void) override
Called by the FrameExchangeManager to notify the completion of the transmissions. ...
Definition: qos-txop.cc:584
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1122
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1243
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:161
bool m_useExplicitBarAfterMissedBlockAck
flag whether explicit BlockAckRequest should be sent upon missed BlockAck Response ...
Definition: qos-txop.h:423
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:179
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism...
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:412
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:167
TracedCallback< Time, Time > m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:425
Time m_currentPacketTimestamp
the current packet timestamp
Definition: qos-txop.h:417
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
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:773
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:418
a unique identifier for an interface.
Definition: type-id.h:58
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:721
Implements the IEEE 802.11 MAC header.
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:421
virtual bool IsTxopStarted(void) const
Return true if a TXOP has started.
Definition: qos-txop.cc:577
void NotifyInternalCollision(void) override
Notify the Txop that internal collision has occurred.
Definition: qos-txop.cc:484
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:65