src/devices/wifi/mac-low.h
changeset 5964 8a59a619c30e
parent 5958 dd0accd82659
child 6068 a2127017ecb4
equal deleted inserted replaced
5963:5f82c5a7068e 5964:8a59a619c30e
    37 #include "ns3/mac48-address.h"
    37 #include "ns3/mac48-address.h"
    38 #include "ns3/callback.h"
    38 #include "ns3/callback.h"
    39 #include "ns3/event-id.h"
    39 #include "ns3/event-id.h"
    40 #include "ns3/packet.h"
    40 #include "ns3/packet.h"
    41 #include "ns3/nstime.h"
    41 #include "ns3/nstime.h"
       
    42 #include "qos-utils.h"
    42 
    43 
    43 namespace ns3 {
    44 namespace ns3 {
    44 
    45 
    45 class WifiPhy;
    46 class WifiPhy;
    46 class WifiMac;
    47 class WifiMac;
       
    48 class EdcaTxopN;
    47 
    49 
    48 /**
    50 /**
    49  * \brief listen to events coming from ns3::MacLow.
    51  * \brief listen to events coming from ns3::MacLow.
    50  */
    52  */
    51 class MacLowTransmissionListener {
    53 class MacLowTransmissionListener {
   143   virtual void NavReset (Time duration) = 0;
   145   virtual void NavReset (Time duration) = 0;
   144   virtual void AckTimeoutStart (Time duration) = 0;
   146   virtual void AckTimeoutStart (Time duration) = 0;
   145   virtual void AckTimeoutReset () = 0;
   147   virtual void AckTimeoutReset () = 0;
   146   virtual void CtsTimeoutStart (Time duration) = 0;
   148   virtual void CtsTimeoutStart (Time duration) = 0;
   147   virtual void CtsTimeoutReset () = 0;
   149   virtual void CtsTimeoutReset () = 0;
       
   150 };
       
   151 
       
   152 /**
       
   153  * \brief listen for block ack events.
       
   154  */
       
   155 class MacLowBlockAckEventListener {
       
   156 public:
       
   157   MacLowBlockAckEventListener ();
       
   158   virtual ~MacLowBlockAckEventListener ();
       
   159   /**
       
   160    * Typically is called in order to notify EdcaTxopN that a block ack inactivity
       
   161    * timeout occurs for the block ack agreement identified by the pair <i>originator</i>, <i>tid</i>.
       
   162    * 
       
   163    * Rx station maintains an inactivity timer for each block ack
       
   164    * agreement. Timer is reset when a frame with ack policy block ack
       
   165    * or a block ack request are received. When this timer reaches zero
       
   166    * this method is called and a delba frame is scheduled for transmission.
       
   167    */
       
   168   virtual void BlockAckInactivityTimeout (Mac48Address originator, uint8_t tid) = 0;
   148 };
   169 };
   149 
   170 
   150 /**
   171 /**
   151  * \brief control how a packet is transmitted.
   172  * \brief control how a packet is transmitted.
   152  *
   173  *
   449    * Checks if exists an established block ack agreement with <i>originator</i>
   470    * Checks if exists an established block ack agreement with <i>originator</i>
   450    * for tid <i>tid</i>. If the agreement exists, tears down it. This function is typically
   471    * for tid <i>tid</i>. If the agreement exists, tears down it. This function is typically
   451    * invoked when a DELBA frame is received from <i>originator</i>.
   472    * invoked when a DELBA frame is received from <i>originator</i>.
   452    */
   473    */
   453   void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid);
   474   void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid);
       
   475   /**
       
   476    * \param ac Access class managed by the queue.
       
   477    * \param listener The listener for the queue.
       
   478    *
       
   479    * The lifetime of the registered listener is typically equal to the lifetime of the queue
       
   480    * associated to this AC.
       
   481    */
       
   482   void RegisterBlockAckListenerForAc (enum AccessClass ac, MacLowBlockAckEventListener *listener);
   454 private:
   483 private:
   455   void CancelAllEvents (void);
   484   void CancelAllEvents (void);
   456   uint32_t GetAckSize (void) const;
   485   uint32_t GetAckSize (void) const;
   457   uint32_t GetBlockAckSize (enum BlockAckType type) const;
   486   uint32_t GetBlockAckSize (enum BlockAckType type) const;
   458   uint32_t GetRtsSize (void) const;
   487   uint32_t GetRtsSize (void) const;
   538   /*
   567   /*
   539    * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
   568    * This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
   540    */
   569    */
   541   void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
   570   void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
   542                              Time duration, WifiMode blockAckReqTxMode);
   571                              Time duration, WifiMode blockAckReqTxMode);
       
   572   /*
       
   573    * Every time that a block ack request or a packet with ack policy equals to <i>block ack</i>
       
   574    * are received, if a relative block ack agreement exists and the value of inactivity timeout
       
   575    * is not 0, the timer is reset.
       
   576    * see section 11.5.3 in IEEE802.11e for more details.
       
   577    */
       
   578   void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement);
   543 
   579 
   544   void SetupPhyMacLowListener (Ptr<WifiPhy> phy); 
   580   void SetupPhyMacLowListener (Ptr<WifiPhy> phy); 
   545 
   581 
   546   Ptr<WifiPhy> m_phy;
   582   Ptr<WifiPhy> m_phy;
   547   Ptr<WifiRemoteStationManager> m_stationManager;
   583   Ptr<WifiRemoteStationManager> m_stationManager;
   593 
   629 
   594   typedef std::map<AgreementKey, AgreementValue> Agreements;
   630   typedef std::map<AgreementKey, AgreementValue> Agreements;
   595   typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI;
   631   typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI;
   596 
   632 
   597   Agreements m_bAckAgreements;
   633   Agreements m_bAckAgreements;
       
   634   
       
   635   typedef std::map<AccessClass, MacLowBlockAckEventListener*> QueueListeners;
       
   636   QueueListeners m_edcaListeners;
   598 };
   637 };
   599 
   638 
   600 } // namespace ns3
   639 } // namespace ns3
   601 
   640 
   602 #endif /* MAC_LOW_H */
   641 #endif /* MAC_LOW_H */