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  bool HasFramesToTransmit (void) override;
89  void NotifyChannelAccessed (Time txopDuration) override;
90  void NotifyChannelReleased (void) override;
91  void SetDroppedMpduCallback (DroppedMpdu callback) override;
92 
99 
105  bool UseExplicitBarAfterMissedBlockAck (void) const;
106 
122  bool GetBaAgreementEstablished (Mac48Address address, uint8_t tid) const;
132  uint16_t GetBaBufferSize (Mac48Address address, uint8_t tid) const;
143  uint16_t GetBaStartingSequence (Mac48Address address, uint8_t tid) const;
152  BlockAckReqType GetBlockAckReqType (Mac48Address recipient, uint8_t tid) const;
161  BlockAckType GetBlockAckType (Mac48Address recipient, uint8_t tid) const;
172  Ptr<const WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
180  void ScheduleBar (Ptr<const WifiMacQueueItem> bar, bool skipIfNoDataQueued = false);
181 
182  /* Event handlers */
189  void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
196  void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
203  void AddBaResponseTimeout (Mac48Address recipient, uint8_t tid);
210  void ResetBa (Mac48Address recipient, uint8_t tid);
211 
217  void SetAccessCategory (AcIndex ac);
218 
226  void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
227 
234  void SetBlockAckThreshold (uint8_t threshold);
240  uint8_t GetBlockAckThreshold (void) const;
241 
247  void SetBlockAckInactivityTimeout (uint16_t timeout);
253  uint16_t GetBlockAckInactivityTimeout (void) const;
266  void SetAddBaResponseTimeout (Time addBaResponseTimeout);
272  Time GetAddBaResponseTimeout (void) const;
279  void SetFailedAddBaTimeout (Time failedAddBaTimeout);
285  Time GetFailedAddBaTimeout (void) const;
286 
294  uint16_t GetNextSequenceNumberFor (const WifiMacHeader *hdr);
302  uint16_t PeekNextSequenceNumberFor (const WifiMacHeader *hdr);
316  Ptr<const WifiMacQueueItem> PeekNextMpdu (uint8_t tid = 8,
334  uint8_t tid = 8,
358  Time availableTime, bool initialFrame,
360 
368 
377  uint8_t GetQosQueueSize (uint8_t tid, Mac48Address receiver) const;
378 
384  virtual bool IsTxopStarted (void) const;
390  virtual Time GetRemainingTxop (void) const;
391 
392 protected:
393  void DoDispose (void) override;
394 
395 private:
398 
399  void DoInitialize (void) override;
400 
410 
425 
427 };
428 
429 } //namespace ns3
430 
431 #endif /* QOS_TXOP_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::QosTxop::m_baManager
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:414
ns3::QosTxop::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: qos-txop.cc:111
ns3::Callback< void, WifiMacDropReason, Ptr< const WifiMacQueueItem > >
ns3::QosTxop::GetBaBufferSize
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:161
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:424
qos-utils.h
ns3::QosTxop::m_qosBlockedDestinations
Ptr< QosBlockedDestinations > m_qosBlockedDestinations
the QoS blocked destinations
Definition: qos-txop.h:413
ns3::QosTxop::GetBlockAckThreshold
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:604
ns3::QosTxop::~QosTxop
virtual ~QosTxop()
Definition: qos-txop.cc:105
ns3::QosTxop::GetBaAgreementEstablished
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:155
ns3::QosTxop::GotAddBaResponse
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Event handler when an ADDBA response is received.
Definition: qos-txop.cc:535
ns3::QosTxop::GetBaManager
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:149
ns3::QosTxop::GotDelBaFrame
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Event handler when a DELBA frame is received.
Definition: qos-txop.cc:570
ns3::QosTxop::SetBlockAckInactivityTimeout
void SetBlockAckInactivityTimeout(uint16_t timeout)
Set the BlockAck inactivity timeout.
Definition: qos-txop.cc:597
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:231
ns3::QosTxop::UseExplicitBarAfterMissedBlockAck
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:201
ns3::QosTxop::GetNextMpdu
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:345
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::QosTxop::GetNextSequenceNumberFor
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: qos-txop.cc:225
ns3::QosTxop::PeekNextMpdu
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:263
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:121
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:625
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:470
ns3::QosTxop::SetDroppedMpduCallback
void SetDroppedMpduCallback(DroppedMpdu callback) override
Definition: qos-txop.cc:139
ns3::QosTxop::GetBlockAckInactivityTimeout
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:611
ns3::QosTxop::SetQosFrameExchangeManager
void SetQosFrameExchangeManager(const Ptr< QosFrameExchangeManager > qosFem)
Set the Frame Exchange Manager associated with this QoS STA.
Definition: qos-txop.cc:132
ns3::QosTxop::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: qos-txop.cc:617
ns3::QosTxop::SetBlockAckThreshold
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:589
ns3::QosTxop::QosTxop
QosTxop()
Definition: qos-txop.cc:93
ns3::QosTxop::GetBaStartingSequence
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:167
ns3::QosTxop::SetAccessCategory
void SetAccessCategory(AcIndex ac)
Set the access category of this EDCAF.
Definition: qos-txop.cc:516
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:458
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:397
ns3::BlockAckReqType
The different BlockAckRequest variants.
Definition: block-ack-type.h:75
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:446
ns3::QosTxop::ResetBa
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:642
ns3::QosTxop::m_failedAddBaTimeout
Time m_failedAddBaTimeout
timeout after failed BA agreement
Definition: qos-txop.h:423
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:207
ns3::QosTxop::m_qosFem
Ptr< QosFrameExchangeManager > m_qosFem
the QoS Frame Exchange Manager
Definition: qos-txop.h:412
ns3::QosTxop::SetFailedAddBaTimeout
void SetFailedAddBaTimeout(Time failedAddBaTimeout)
Set the timeout for failed BA agreement.
Definition: qos-txop.cc:670
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:523
ns3::QosTxop::m_blockAckInactivityTimeout
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:419
ns3::QosTxop::GetAddBaResponseTimeout
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:664
ns3::QosTxop
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:75
ns3::QosTxop::m_txopDuration
Time m_txopDuration
the duration of a TXOP
Definition: qos-txop.h:421
ns3::MgtAddBaResponseHeader
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1123
ns3::WifiMacQueueItem::QueueIteratorPair
Information needed to remove an MSDU from the queue.
Definition: wifi-mac-queue-item.h:147
ns3::QosTxop::PrepareBlockAckRequest
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:173
ns3::QosTxop::SetAddBaResponseTimeout
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:657
ns3::QosTxop::m_currentPacketTimestamp
Time m_currentPacketTimestamp
the current packet timestamp
Definition: qos-txop.h:418
ns3::QosTxop::m_addBaResponseTimeout
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:422
ns3::MgtDelBaHeader
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1244
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:237
ns3::QosTxop::m_ac
AcIndex m_ac
the access category
Definition: qos-txop.h:411
ns3::QosTxop::NotifyChannelReleased
void NotifyChannelReleased(void) override
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: qos-txop.cc:488
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::ScheduleBar
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:195
ns3::QosTxop::m_startTxop
Time m_startTxop
the start TXOP time
Definition: qos-txop.h:420
ns3::TracedCallback< Time, Time >
ns3::QosTxop::GetBlockAckType
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:464
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:415
ns3::QosTxop::GetAccessCategory
AcIndex GetAccessCategory(void) const override
Get the access category.
Definition: qos-txop.cc:689
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:578
ns3::QosTxop::IsQosTxop
bool IsQosTxop(void) const override
Check for QoS TXOP.
Definition: qos-txop.cc:683
ns3::QosTxop::IsTxopStarted
virtual bool IsTxopStarted(void) const
Return true if a TXOP has started.
Definition: qos-txop.cc:481
ns3::QosTxop::GetFailedAddBaTimeout
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:677
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:426
ns3::QosTxop::GetRemainingTxop
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.
Definition: qos-txop.cc:502
ns3::Txop
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:66