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  // Overridden from Txop
87  bool IsQosTxop (void) const;
89  virtual bool HasFramesToTransmit (void);
90  void NotifyInternalCollision (void);
91  virtual void NotifyChannelAccessed (Time txopDuration);
92  void NotifyChannelReleased (void);
93  void SetDroppedMpduCallback (DroppedMpdu callback);
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;
173  Ptr<const WifiMacQueueItem> PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const;
181  void ScheduleBar (Ptr<const WifiMacQueueItem> bar, bool skipIfNoDataQueued = false);
182 
183  /* Event handlers */
190  void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
197  void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
204  void AddBaResponseTimeout (Mac48Address recipient, uint8_t tid);
211  void ResetBa (Mac48Address recipient, uint8_t tid);
212 
218  void SetAccessCategory (AcIndex ac);
219 
227  void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
228 
232  void CompleteConfig (void);
233 
240  void SetBlockAckThreshold (uint8_t threshold);
246  uint8_t GetBlockAckThreshold (void) const;
247 
253  void SetBlockAckInactivityTimeout (uint16_t timeout);
259  uint16_t GetBlockAckInactivityTimeout (void) const;
272  void SetAddBaResponseTimeout (Time addBaResponseTimeout);
278  Time GetAddBaResponseTimeout (void) const;
285  void SetFailedAddBaTimeout (Time failedAddBaTimeout);
291  Time GetFailedAddBaTimeout (void) const;
292 
300  uint16_t GetNextSequenceNumberFor (const WifiMacHeader *hdr);
308  uint16_t PeekNextSequenceNumberFor (const WifiMacHeader *hdr);
322  Ptr<const WifiMacQueueItem> PeekNextMpdu (uint8_t tid = 8,
340  uint8_t tid = 8,
364  Time availableTime, bool initialFrame,
366 
374 
381 
387  virtual bool IsTxopStarted (void) const;
393  virtual Time GetRemainingTxop (void) const;
394 
395 protected:
396  // Overridden from Txop
397  void DoDispose (void);
398 
399 private:
402 
403  // Overridden from Txop
404  void DoInitialize (void);
405 
415 
430 
432 };
433 
434 } //namespace ns3
435 
436 #endif /* QOS_TXOP_H */
AcIndex m_ac
the access category
Definition: qos-txop.h:416
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:745
virtual void NotifyChannelAccessed(Time txopDuration)
Called by the FrameExchangeManager to notify that channel access has been granted for the given amoun...
Definition: qos-txop.cc:566
void NotifyChannelReleased(void)
Called by the FrameExchangeManager to notify the completion of the transmissions. ...
Definition: qos-txop.cc:584
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:57
Time m_startTxop
the start TXOP time
Definition: qos-txop.h:425
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:700
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
void SetDroppedMpduCallback(DroppedMpdu callback)
Definition: qos-txop.cc:145
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:707
void DoDispose(void)
Destructor implementation.
Definition: qos-txop.cc:112
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:428
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:767
Ptr< QosFrameExchangeManager > m_qosFem
the QoS Frame Exchange Manager
Definition: qos-txop.h:417
friend class AggregationCapableTransmissionListener
allow AggregationCapableTransmissionListener class access
Definition: qos-txop.h:401
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:714
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:773
Ptr< BlockAckManager > m_baManager
the block ack manager
Definition: qos-txop.h:419
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
bool IsQosTxop(void) const
Check for QoS TXOP.
Definition: qos-txop.cc:786
void SetAddBaResponseTimeout(Time addBaResponseTimeout)
Set the timeout to wait for ADDBA response.
Definition: qos-txop.cc:760
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:426
BlockAckType GetBlockAckType(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:478
address
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
an EUI-48 address
Definition: mac48-address.h:43
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ack mechanism.
Definition: qos-txop.cc:692
uint8_t m_blockAckThreshold
the block ack threshold (use BA mechanism if number of packets in queue reaches this value...
Definition: qos-txop.h:420
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this Txop is associated to.
Definition: qos-txop.cc:207
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
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
virtual bool HasFramesToTransmit(void)
Check if the Txop has frames to transmit.
Definition: qos-txop.cc:221
The different BlockAck variants.
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1121
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1242
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:429
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:418
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:167
void CompleteConfig(void)
Complete block ack configuration.
Definition: qos-txop.cc:685
TracedCallback< Time, Time > m_txopTrace
TXOP trace callback.
Definition: qos-txop.h:431
void DoInitialize(void)
Initialize() implementation.
Definition: qos-txop.cc:720
Time m_currentPacketTimestamp
the current packet timestamp
Definition: qos-txop.h:423
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:780
uint16_t m_blockAckInactivityTimeout
the BlockAck inactivity timeout value (in TUs, i.e.
Definition: qos-txop.h:424
void NotifyInternalCollision(void)
Notify the Txop that internal collision has occurred.
Definition: qos-txop.cc:484
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:728
Implements the IEEE 802.11 MAC header.
Time m_addBaResponseTimeout
timeout for ADDBA response
Definition: qos-txop.h:427
virtual bool IsTxopStarted(void) const
Return true if a TXOP has started.
Definition: qos-txop.cc:577
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:64