src/devices/wifi/edca-txop-n.h
changeset 6068 a2127017ecb4
parent 6065 0f012e7d9128
parent 5965 4e64e751be07
child 6080 41ee42654550
equal deleted inserted replaced
6067:ccbdc2b19ea5 6068:a2127017ecb4
    29 #include "wifi-mode.h"
    29 #include "wifi-mode.h"
    30 #include "wifi-mac.h"
    30 #include "wifi-mac.h"
    31 #include "wifi-mac-header.h"
    31 #include "wifi-mac-header.h"
    32 #include "qos-utils.h"
    32 #include "qos-utils.h"
    33 #include "dcf.h"
    33 #include "dcf.h"
       
    34 #include "ctrl-headers.h"
    34 
    35 
    35 #include <map>
    36 #include <map>
    36 #include <list>
    37 #include <list>
    37 
    38 
    38 namespace ns3 {
    39 namespace ns3 {
    42 class MacLow;
    43 class MacLow;
    43 class MacTxMiddle;
    44 class MacTxMiddle;
    44 class WifiMacParameters;
    45 class WifiMacParameters;
    45 class WifiMacQueue;
    46 class WifiMacQueue;
    46 class RandomStream;
    47 class RandomStream;
       
    48 class QosBlockedDestinations;
    47 class MsduAggregator;
    49 class MsduAggregator;
       
    50 class MgtAddBaResponseHeader;
       
    51 class BlockAckManager;
       
    52 class MgtDelBaHeader;
       
    53 
    48 
    54 
    49 /* This queue contains packets for a particular access class.
    55 /* This queue contains packets for a particular access class.
    50  * possibles access classes are:
    56  * possibles access classes are:
    51  *   
    57  *   
    52  *   -AC_VO : voice, tid = 6,7         ^
    58  *   -AC_VO : voice, tid = 6,7         ^
   108 
   114 
   109   /*event handlers*/
   115   /*event handlers*/
   110   void GotCts (double snr, WifiMode txMode);
   116   void GotCts (double snr, WifiMode txMode);
   111   void MissedCts (void);
   117   void MissedCts (void);
   112   void GotAck (double snr, WifiMode txMode);
   118   void GotAck (double snr, WifiMode txMode);
       
   119   void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient);
       
   120   void MissedBlockAck (void);
       
   121   void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
       
   122   void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
   113   void MissedAck (void);
   123   void MissedAck (void);
   114   void StartNext (void);
   124   void StartNext (void);
   115   void Cancel (void);
   125   void Cancel (void);
   116 
   126 
   117   void RestartAccessIfNeeded (void);
   127   void RestartAccessIfNeeded (void);
   125   uint32_t GetFragmentOffset (void);
   135   uint32_t GetFragmentOffset (void);
   126   bool IsLastFragment (void) const;
   136   bool IsLastFragment (void) const;
   127   void NextFragment (void);
   137   void NextFragment (void);
   128   Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
   138   Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
   129   
   139   
       
   140   void SetAccessClass (enum AccessClass ac);
   130   void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
   141   void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
   131   void SetMsduAggregator (Ptr<MsduAggregator> aggr);
   142   void SetMsduAggregator (Ptr<MsduAggregator> aggr);
       
   143   void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
       
   144   void CompleteConfig (void);
       
   145   void SetBlockAckThreshold (uint8_t threshold);
       
   146   uint8_t GetBlockAckThreshold (void) const;
       
   147   void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
   132 
   148 
   133 private:
   149 private:
   134   /**
   150   /**
   135    * This functions are used only to correctly set addresses in a-msdu subframe.
   151    * This functions are used only to correctly set addresses in a-msdu subframe.
   136    * If aggregating sta is a STA (in an infrastructured network):
   152    * If aggregating sta is a STA (in an infrastructured network):
   142    */
   158    */
   143   Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr);
   159   Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr);
   144   Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr);
   160   Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr);
   145   EdcaTxopN &operator = (const EdcaTxopN &);
   161   EdcaTxopN &operator = (const EdcaTxopN &);
   146   EdcaTxopN (const EdcaTxopN &);
   162   EdcaTxopN (const EdcaTxopN &);
   147   
   163 
       
   164   /* If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame
       
   165    * is sent to destination in order to setup a block ack.
       
   166    */
       
   167   bool SetupBlockAckIfNeeded ();
       
   168   /* Sends an ADDBARequest to establish a block ack agreement with sta
       
   169    * addressed by <i>recipient</i> for tid <i>tid</i>.
       
   170    */
       
   171   void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq,
       
   172                          uint16_t timeout, bool immediateBAck);
       
   173   /* After that all packets, for which a block ack agreement was established, have been
       
   174    * transmitted, we have to send a block ack request.
       
   175    */
       
   176   void SendBlockAckRequest (const struct Bar &bar);
       
   177   /* For now is typically invoked to complete transmission of a packets sent with ack policy
       
   178    * Block Ack: the packet is buffered and dcf is reset.
       
   179    */
       
   180   void CompleteTx (void);
       
   181   /* Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
       
   182    * if an established block ack agreement exists with the receiver.
       
   183    */
       
   184   void VerifyBlockAck (void);
       
   185   
       
   186   AccessClass m_ac;
   148   class Dcf;
   187   class Dcf;
   149   class TransmissionListener;
   188   class TransmissionListener;
       
   189   class BlockAckEventListener;
   150   friend class Dcf;
   190   friend class Dcf;
   151   friend class TransmissionListener;
   191   friend class TransmissionListener;
   152   Dcf *m_dcf;
   192   Dcf *m_dcf;
   153   DcfManager *m_manager;
   193   DcfManager *m_manager;
   154   Ptr<WifiMacQueue> m_queue;
   194   Ptr<WifiMacQueue> m_queue;
   155   TxOk m_txOkCallback;
   195   TxOk m_txOkCallback;
   156   TxFailed m_txFailedCallback;
   196   TxFailed m_txFailedCallback;
   157   Ptr<MacLow> m_low;
   197   Ptr<MacLow> m_low;
   158   MacTxMiddle *m_txMiddle;
   198   MacTxMiddle *m_txMiddle;
   159   TransmissionListener *m_transmissionListener;
   199   TransmissionListener *m_transmissionListener;
       
   200   BlockAckEventListener *m_blockAckListener;
   160   RandomStream *m_rng;
   201   RandomStream *m_rng;
   161   Ptr<WifiRemoteStationManager> m_stationManager;
   202   Ptr<WifiRemoteStationManager> m_stationManager;
   162   uint8_t m_fragmentNumber;
   203   uint8_t m_fragmentNumber;
   163   
   204   
   164   /* current packet could be a simple MSDU or, if an aggregator for this queue is
   205   /* current packet could be a simple MSDU or, if an aggregator for this queue is
   167   Ptr<const Packet> m_currentPacket;
   208   Ptr<const Packet> m_currentPacket;
   168   
   209   
   169   WifiMacHeader m_currentHdr;
   210   WifiMacHeader m_currentHdr;
   170   Ptr<MsduAggregator> m_aggregator;
   211   Ptr<MsduAggregator> m_aggregator;
   171   TypeOfStation m_typeOfStation;
   212   TypeOfStation m_typeOfStation;
       
   213   QosBlockedDestinations *m_qosBlockedDestinations;
       
   214   BlockAckManager *m_baManager;
       
   215   /*
       
   216    * Represents the minimun number of packets for use of block ack.
       
   217    */
       
   218   uint8_t m_blockAckThreshold;
       
   219   enum BlockAckType m_blockAckType;
       
   220   Time m_currentPacketTimestamp;
       
   221   uint16_t m_blockAckInactivityTimeout;
   172 };
   222 };
   173 
   223 
   174 }  //namespace ns3
   224 }  //namespace ns3
   175 
   225 
   176 #endif /* EDCA_TXOP_N_H */
   226 #endif /* EDCA_TXOP_N_H */