src/wifi/model/wifi-remote-station-manager.h
changeset 10139 17a71cd49da3
parent 9165 7b219a73b844
child 10218 97da49da2d6c
equal deleted inserted replaced
10138:2f8e35b43d11 10139:17a71cd49da3
    26 #include "ns3/traced-callback.h"
    26 #include "ns3/traced-callback.h"
    27 #include "ns3/packet.h"
    27 #include "ns3/packet.h"
    28 #include "ns3/object.h"
    28 #include "ns3/object.h"
    29 #include "ns3/nstime.h"
    29 #include "ns3/nstime.h"
    30 #include "wifi-mode.h"
    30 #include "wifi-mode.h"
       
    31 #include "wifi-tx-vector.h"
       
    32 #include "ht-capabilities.h"
    31 
    33 
    32 namespace ns3 {
    34 namespace ns3 {
    33 
    35 
    34 struct WifiRemoteStation;
    36 struct WifiRemoteStation;
    35 struct WifiRemoteStationState;
    37 struct WifiRemoteStationState;
    94   uint32_t GetFragmentationThreshold (void) const;
    96   uint32_t GetFragmentationThreshold (void) const;
    95   void SetMaxSsrc (uint32_t maxSsrc);
    97   void SetMaxSsrc (uint32_t maxSsrc);
    96   void SetMaxSlrc (uint32_t maxSlrc);
    98   void SetMaxSlrc (uint32_t maxSlrc);
    97   void SetRtsCtsThreshold (uint32_t threshold);
    99   void SetRtsCtsThreshold (uint32_t threshold);
    98   void SetFragmentationThreshold (uint32_t threshold);
   100   void SetFragmentationThreshold (uint32_t threshold);
       
   101   void AddStationHtCapabilities (Mac48Address from,HtCapabilities     htcapabilities);
       
   102   void SetHtSupported (bool enable);
       
   103   bool HasHtSupported (void) const;
    99 
   104 
   100   // Invoked in a STA upon dis-association
   105   // Invoked in a STA upon dis-association
   101   // or in an AP upon reboot
   106   // or in an AP upon reboot
   102   void Reset (void);
   107   void Reset (void);
   103   // Invoked in a STA upon association to store
   108   // Invoked in a STA upon association to store
   108   void AddBasicMode (WifiMode mode);
   113   void AddBasicMode (WifiMode mode);
   109 
   114 
   110   WifiMode GetDefaultMode (void) const;
   115   WifiMode GetDefaultMode (void) const;
   111   uint32_t GetNBasicModes (void) const;
   116   uint32_t GetNBasicModes (void) const;
   112   WifiMode GetBasicMode (uint32_t i) const;
   117   WifiMode GetBasicMode (uint32_t i) const;
       
   118   bool GetGreenfieldSupported (Mac48Address address) const;
       
   119   void AddBasicMcs (uint8_t mcs);
       
   120 
       
   121   uint8_t GetDefaultMcs (void) const;
       
   122   uint32_t GetNBasicMcs (void) const;
       
   123   uint8_t GetBasicMcs (uint32_t i) const;
       
   124   void AddSupportedMcs (Mac48Address address, uint8_t mcs);
   113 
   125 
   114   WifiMode GetNonUnicastMode (void) const;
   126   WifiMode GetNonUnicastMode (void) const;
   115 
   127 
   116 
   128 
   117   /**
   129   /**
   125    * also supported locally.
   137    * also supported locally.
   126    * The set of supported modes includes
   138    * The set of supported modes includes
   127    * the BSSBasicRateSet.
   139    * the BSSBasicRateSet.
   128    */
   140    */
   129   void AddSupportedMode (Mac48Address address, WifiMode mode);
   141   void AddSupportedMode (Mac48Address address, WifiMode mode);
       
   142   //void  AddBssMembershipParameters(Mac48Address address, uint32_t selector);
   130 
   143 
   131   bool IsBrandNew (Mac48Address address) const;
   144   bool IsBrandNew (Mac48Address address) const;
   132   bool IsAssociated (Mac48Address address) const;
   145   bool IsAssociated (Mac48Address address) const;
   133   bool IsWaitAssocTxOk (Mac48Address address) const;
   146   bool IsWaitAssocTxOk (Mac48Address address) const;
   134   void RecordWaitAssocTxOk (Mac48Address address);
   147   void RecordWaitAssocTxOk (Mac48Address address);
   147    * is set to false, in which case, the tx parameters of the packet are calculated and stored in
   160    * is set to false, in which case, the tx parameters of the packet are calculated and stored in
   148    * the packet as a tag. These tx parameters are later retrieved from GetDadaMode and GetRtsMode.
   161    * the packet as a tag. These tx parameters are later retrieved from GetDadaMode and GetRtsMode.
   149    */
   162    */
   150   void PrepareForQueue (Mac48Address address, const WifiMacHeader *header,
   163   void PrepareForQueue (Mac48Address address, const WifiMacHeader *header,
   151                         Ptr<const Packet> packet, uint32_t fullPacketSize);
   164                         Ptr<const Packet> packet, uint32_t fullPacketSize);
       
   165   
   152   /**
   166   /**
   153    * \param address remote address
   167    * \param address remote address
   154    * \param header MAC header
   168    * \param header MAC header
   155    * \param packet the packet to send
   169    * \param packet the packet to send
   156    * \param fullPacketSize the size of the packet after its 802.11 MAC header has been added.
   170    * \param fullPacketSize the size of the packet after its 802.11 MAC header has been added.
   157    * \returns the transmission mode to use to send this packet
   171    * \returns the transmission mode to use to send this packet
   158    */
   172    */
   159   WifiMode GetDataMode (Mac48Address address, const WifiMacHeader *header,
   173   WifiTxVector GetDataTxVector (Mac48Address address, const WifiMacHeader *header,
   160                         Ptr<const Packet> packet, uint32_t fullPacketSize);
   174                         Ptr<const Packet> packet, uint32_t fullPacketSize);
   161   /**
   175   /**
   162    * \param address remote address
   176    * \param address remote address
   163    * \param header MAC header
   177    * \param header MAC header
   164    * \param packet the packet to send
   178    * \param packet the packet to send
   165    * \returns the transmission mode to use to send the RTS prior to the
   179    * \returns the transmission mode to use to send the RTS prior to the
   166    *          transmission of the data packet itself.
   180    *          transmission of the data packet itself.
   167    */
   181    */
   168   WifiMode GetRtsMode (Mac48Address address, const WifiMacHeader *header,
   182   WifiTxVector GetRtsTxVector (Mac48Address address, const WifiMacHeader *header,
   169                        Ptr<const Packet> packet);
   183                        Ptr<const Packet> packet);
       
   184 
       
   185   WifiTxVector GetCtsToSelfTxVector (const WifiMacHeader *header,
       
   186                        Ptr<const Packet> packet);
       
   187 
       
   188   //Since CTS to Self parameters don't depened on the station it is implemented in wifiremote station manager
       
   189   WifiTxVector DoGetCtsToSelfTxVector (void);
       
   190 
       
   191 
   170   /**
   192   /**
   171    * Should be invoked whenever the RtsTimeout associated to a transmission
   193    * Should be invoked whenever the RtsTimeout associated to a transmission
   172    * attempt expires.
   194    * attempt expires.
   173    */
   195    */
   174   void ReportRtsFailed (Mac48Address address, const WifiMacHeader *header);
   196   void ReportRtsFailed (Mac48Address address, const WifiMacHeader *header);
   218    * \returns true if we want to use an RTS/CTS handshake for this
   240    * \returns true if we want to use an RTS/CTS handshake for this
   219    *          packet before sending it, false otherwise.
   241    *          packet before sending it, false otherwise.
   220    */
   242    */
   221   bool NeedRts (Mac48Address address, const WifiMacHeader *header,
   243   bool NeedRts (Mac48Address address, const WifiMacHeader *header,
   222                 Ptr<const Packet> packet);
   244                 Ptr<const Packet> packet);
       
   245   bool NeedCtsToSelf (WifiTxVector txVector);
       
   246 
   223   /**
   247   /**
   224    * \param address remote address
   248    * \param address remote address
   225    * \param header MAC header
   249    * \param header MAC header
   226    * \param packet the packet to send
   250    * \param packet the packet to send
   227    * \returns true if we want to restart a failed RTS/CTS
   251    * \returns true if we want to restart a failed RTS/CTS
   279    * \param address remote address
   303    * \param address remote address
   280    * \param rtsMode the transmission mode used to send an RTS we just received
   304    * \param rtsMode the transmission mode used to send an RTS we just received
   281    * \returns the transmission mode to use for the CTS to complete the RTS/CTS
   305    * \returns the transmission mode to use for the CTS to complete the RTS/CTS
   282    *          handshake.
   306    *          handshake.
   283    */
   307    */
   284   WifiMode GetCtsMode (Mac48Address address, WifiMode rtsMode);
   308   WifiTxVector GetCtsTxVector (Mac48Address address, WifiMode rtsMode);
   285   /**
   309   /**
   286    * \param address
   310    * \param address
   287    * \param dataMode the transmission mode used to send an ACK we just received
   311    * \param dataMode the transmission mode used to send an ACK we just received
   288    * \returns the transmission mode to use for the ACK to complete the data/ACK
   312    * \returns the transmission mode to use for the ACK to complete the data/ACK
   289    *          handshake.
   313    *          handshake.
   290    */
   314    */
   291   WifiMode GetAckMode (Mac48Address address, WifiMode dataMode);
   315   WifiTxVector GetAckTxVector (Mac48Address address, WifiMode dataMode);
   292 
   316   /**
       
   317    * \param address
       
   318    * \param dataMode the transmission mode used to send an ACK we just received
       
   319    * \returns the transmission mode to use for the ACK to complete the data/ACK
       
   320    *          handshake.
       
   321    */
       
   322   WifiTxVector GetBlockAckTxVector (Mac48Address address, WifiMode dataMode);
       
   323   /**
       
   324    * \returns the default transmission power
       
   325    */ 
       
   326   uint8_t GetDefaultTxPowerLevel (void) const;
       
   327   /**
       
   328    * \param address of the remote station
       
   329    * \returns information regarding the remote station associated with the given address
       
   330    */
   293   WifiRemoteStationInfo GetInfo (Mac48Address address);
   331   WifiRemoteStationInfo GetInfo (Mac48Address address);
   294 protected:
   332   /**
       
   333    * Set the default transmission power level
       
   334    */
       
   335   void SetDefaultTxPowerLevel (uint8_t txPower);
       
   336  /**
       
   337   * \returns the number of transmit antennas supported by the phy layer
       
   338   */
       
   339  uint32_t GetNumberOfTransmitAntennas (void);
       
   340 
       
   341  protected:
   295   virtual void DoDispose (void);
   342   virtual void DoDispose (void);
   296   // for convenience
   343   // for convenience
   297   WifiMode GetSupported (const WifiRemoteStation *station, uint32_t i) const;
   344   WifiMode GetSupported (const WifiRemoteStation *station, uint32_t i) const;
   298   uint32_t GetNSupported (const WifiRemoteStation *station) const;
   345   uint32_t GetNSupported (const WifiRemoteStation *station) const;
       
   346   uint8_t GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const;
       
   347   uint32_t GetNMcsSupported (const WifiRemoteStation *station) const;
       
   348 
       
   349   bool GetShortGuardInterval (const WifiRemoteStation *station) const;
       
   350   bool GetStbc (const WifiRemoteStation *station) const;
       
   351   bool GetGreenfield (const WifiRemoteStation *station) const;
       
   352   uint32_t GetNumberOfReceiveAntennas (const WifiRemoteStation *station) const;
       
   353   uint32_t GetNumberOfTransmitAntennas (const WifiRemoteStation *station) const;
       
   354   uint32_t GetLongRetryCount (const WifiRemoteStation *station) const;
       
   355   uint32_t GetShortRetryCount (const WifiRemoteStation *station) const;
   299 private:
   356 private:
   300   /**
   357   /**
   301    * \param station the station with which we need to communicate
   358    * \param station the station with which we need to communicate
   302    * \param packet the packet to send
   359    * \param packet the packet to send
   303    * \param normally indicates whether the normal 802.11 rts enable mechanism would
   360    * \param normally indicates whether the normal 802.11 rts enable mechanism would
   357   virtual bool IsLowLatency (void) const = 0;
   414   virtual bool IsLowLatency (void) const = 0;
   358   /**
   415   /**
   359    * \return a new station data structure
   416    * \return a new station data structure
   360    */
   417    */
   361   virtual WifiRemoteStation* DoCreateStation (void) const = 0;
   418   virtual WifiRemoteStation* DoCreateStation (void) const = 0;
   362   /**
   419  /**
   363    * \param station the station with which we need to communicate
   420    * \param station the station with which we need to communicate
   364    * \param size size of the packet or fragment we want to send
   421    * \param size size of the packet or fragment we want to send
   365    * \returns the transmission mode to use to send a packet to the station
   422    * \returns the transmission mode to use to send a packet to the station
   366    *
   423    *
   367    * Note: This method is called before sending a unicast packet or a fragment
   424    * Note: This method is called before sending a unicast packet or a fragment
   368    *       of a unicast packet to decide which transmission mode to use.
   425    *       of a unicast packet to decide which transmission mode to use.
   369    */
   426    */
   370   virtual WifiMode DoGetDataMode (WifiRemoteStation *station,
   427   virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station,
   371                                   uint32_t size) = 0;
   428                                   uint32_t size) = 0;
   372   /**
   429   /**
   373    * \param station the station with which we need to communicate
   430    * \param station the station with which we need to communicate
   374    * \returns the transmission mode to use to send an rts to the station
   431    * \returns the transmission mode to use to send an rts to the station
   375    *
   432    *
   376    * Note: This method is called before sending an rts to a station
   433    * Note: This method is called before sending an rts to a station
   377    *       to decide which transmission mode to use for the rts.
   434    *       to decide which transmission mode to use for the rts.
   378    */
   435    */
   379   virtual WifiMode DoGetRtsMode (WifiRemoteStation *station) = 0;
   436   virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station) = 0;
       
   437 
       
   438   
       
   439   /** 
       
   440    * \param address the address of the recipient of the CTS
       
   441    * \param ctsMode the mode to be used for the CTS 
       
   442    * 
       
   443    * \return the power level to be used to send the CTS
       
   444    */
       
   445   virtual uint8_t DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode);
       
   446 
       
   447   /** 
       
   448    * \param address the address of the recipient of the ACK
       
   449    * \param ctsMode the mode to be used for the ACK 
       
   450    * 
       
   451    * \return the power level to be used to send the ACK
       
   452    */  
       
   453   virtual uint8_t DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode);
       
   454 
       
   455   /** 
       
   456    * \param address the address of the recipient of the Block ACK
       
   457    * \param ctsMode the mode to be used for the Block ACK 
       
   458    * 
       
   459    * \return the power level to be used to send the Block ACK
       
   460    */  
       
   461   virtual uint8_t DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode);
       
   462 
       
   463   virtual bool DoGetCtsTxGuardInterval (Mac48Address address, WifiMode ctsMode);
       
   464 
       
   465   virtual uint8_t DoGetCtsTxNss(Mac48Address address, WifiMode ctsMode);
       
   466   virtual uint8_t DoGetCtsTxNess(Mac48Address address, WifiMode ctsMode);
       
   467   virtual bool  DoGetCtsTxStbc(Mac48Address address, WifiMode ctsMode);
       
   468   virtual bool DoGetAckTxGuardInterval(Mac48Address address, WifiMode ackMode);
       
   469   virtual uint8_t DoGetAckTxNss(Mac48Address address, WifiMode ackMode);
       
   470   virtual uint8_t DoGetAckTxNess(Mac48Address address, WifiMode ackMode);
       
   471   virtual bool DoGetAckTxStbc(Mac48Address address, WifiMode ackMode);
       
   472   virtual bool DoGetBlockAckTxGuardInterval(Mac48Address address, WifiMode blockAckMode);
       
   473   virtual uint8_t DoGetBlockAckTxNss(Mac48Address address, WifiMode blockAckMode);
       
   474   virtual uint8_t DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode);
       
   475   virtual bool DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode);
       
   476 
   380   virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0;
   477   virtual void DoReportRtsFailed (WifiRemoteStation *station) = 0;
   381   virtual void DoReportDataFailed (WifiRemoteStation *station) = 0;
   478   virtual void DoReportDataFailed (WifiRemoteStation *station) = 0;
   382   virtual void DoReportRtsOk (WifiRemoteStation *station,
   479   virtual void DoReportRtsOk (WifiRemoteStation *station,
   383                               double ctsSnr, WifiMode ctsMode, double rtsSnr) = 0;
   480                               double ctsSnr, WifiMode ctsMode, double rtsSnr) = 0;
   384   virtual void DoReportDataOk (WifiRemoteStation *station,
   481   virtual void DoReportDataOk (WifiRemoteStation *station,
   411    * set of all transmission rates that may be supported (the
   508    * set of all transmission rates that may be supported (the
   412    * "DeviceRateSet").
   509    * "DeviceRateSet").
   413    */
   510    */
   414   Ptr<WifiPhy> m_wifiPhy;
   511   Ptr<WifiPhy> m_wifiPhy;
   415   WifiMode m_defaultTxMode;
   512   WifiMode m_defaultTxMode;
       
   513   uint8_t m_defaultTxMcs;
   416 
   514 
   417   /**
   515   /**
   418    * This member is the list of WifiMode objects that comprise the
   516    * This member is the list of WifiMode objects that comprise the
   419    * BSSBasicRateSet parameter. This list is constructed through calls
   517    * BSSBasicRateSet parameter. This list is constructed through calls
   420    * to WifiRemoteStationManager::AddBasicMode(), and an API that
   518    * to WifiRemoteStationManager::AddBasicMode(), and an API that
   421    * allows external access to it is available through
   519    * allows external access to it is available through
   422    * WifiRemoteStationManager::GetNBasicModes() and
   520    * WifiRemoteStationManager::GetNBasicModes() and
   423    * WifiRemoteStationManager::GetBasicMode().
   521    * WifiRemoteStationManager::GetBasicMode().
   424    */
   522    */
   425   WifiModeList m_bssBasicRateSet;
   523   WifiModeList m_bssBasicRateSet;
   426 
   524   WifiMcsList m_bssBasicMcsSet;
       
   525 
       
   526   bool m_htSupported;
   427   bool m_isLowLatency;
   527   bool m_isLowLatency;
   428   uint32_t m_maxSsrc;
   528   uint32_t m_maxSsrc;
   429   uint32_t m_maxSlrc;
   529   uint32_t m_maxSlrc;
   430   uint32_t m_rtsCtsThreshold;
   530   uint32_t m_rtsCtsThreshold;
   431   uint32_t m_fragmentationThreshold;
   531   uint32_t m_fragmentationThreshold;
       
   532   uint8_t m_defaultTxPowerLevel;
   432   WifiMode m_nonUnicastMode;
   533   WifiMode m_nonUnicastMode;
   433   double m_avgSlrcCoefficient;
   534   double m_avgSlrcCoefficient;
   434   /**
   535   /**
   435    * The trace source fired when the transmission of a single RTS has failed
   536    * The trace source fired when the transmission of a single RTS has failed
   436    */
   537    */
   470    * allows external access to it is available through
   571    * allows external access to it is available through
   471    * WifiRemoteStationManager::GetNSupported() and
   572    * WifiRemoteStationManager::GetNSupported() and
   472    * WifiRemoteStationManager::GetSupported().
   573    * WifiRemoteStationManager::GetSupported().
   473    */
   574    */
   474   WifiModeList m_operationalRateSet;
   575   WifiModeList m_operationalRateSet;
   475 
   576   WifiMcsList m_operationalMcsSet;
   476   Mac48Address m_address;
   577   Mac48Address m_address;
   477   WifiRemoteStationInfo m_info;
   578   WifiRemoteStationInfo m_info;
       
   579   bool m_shortGuardInterval;
       
   580   uint32_t m_rx;
       
   581   uint32_t m_tx;
       
   582   bool m_stbc;
       
   583   bool m_greenfield;
       
   584 
   478 };
   585 };
   479 
   586 
   480 /**
   587 /**
   481  * \brief hold per-remote-station state.
   588  * \brief hold per-remote-station state.
   482  *
   589  *