src/wifi/model/wifi-remote-station-manager.h
changeset 7141 072fb225b714
parent 7139 79dd02ed46ec
child 7385 10beb0e53130
equal deleted inserted replaced
7140:d203296efb63 7141:072fb225b714
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
     2 /*
     2 /*
     3  * Copyright (c) 2005,2006,2007 INRIA
     3  * Copyright (c) 2005,2006,2007 INRIA
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License version 2 as 
     6  * it under the terms of the GNU General Public License version 2 as
     7  * published by the Free Software Foundation;
     7  * published by the Free Software Foundation;
     8  *
     8  *
     9  * This program is distributed in the hope that it will be useful,
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    94   uint32_t GetFragmentationThreshold (void) const;
    94   uint32_t GetFragmentationThreshold (void) const;
    95   void SetMaxSsrc (uint32_t maxSsrc);
    95   void SetMaxSsrc (uint32_t maxSsrc);
    96   void SetMaxSlrc (uint32_t maxSlrc);
    96   void SetMaxSlrc (uint32_t maxSlrc);
    97   void SetRtsCtsThreshold (uint32_t threshold);
    97   void SetRtsCtsThreshold (uint32_t threshold);
    98   void SetFragmentationThreshold (uint32_t threshold);
    98   void SetFragmentationThreshold (uint32_t threshold);
    99   
    99 
   100   // Invoked in a STA upon dis-association
   100   // Invoked in a STA upon dis-association
   101   // or in an AP upon reboot
   101   // or in an AP upon reboot
   102   void Reset (void);
   102   void Reset (void);
   103   // Invoked in a STA upon association to store
   103   // Invoked in a STA upon association to store
   104   // the set of rates which belong to the 
   104   // the set of rates which belong to the
   105   // BSSBasicRateSet of the associated AP
   105   // BSSBasicRateSet of the associated AP
   106   // and which are supported locally.
   106   // and which are supported locally.
   107   // Invoked in an AP to configure the BSSBasicRateSet
   107   // Invoked in an AP to configure the BSSBasicRateSet
   108   void AddBasicMode (WifiMode mode);
   108   void AddBasicMode (WifiMode mode);
   109 
   109 
   118    * Invoked in an AP upon disassociation of a
   118    * Invoked in an AP upon disassociation of a
   119    * specific STA.
   119    * specific STA.
   120    */
   120    */
   121   void Reset (Mac48Address address);
   121   void Reset (Mac48Address address);
   122   /**
   122   /**
   123    * Invoked in a STA or AP to store the set of 
   123    * Invoked in a STA or AP to store the set of
   124    * modes supported by a destination which is
   124    * modes supported by a destination which is
   125    * also supported locally.
   125    * also supported locally.
   126    * The set of supported modes includes
   126    * The set of supported modes includes
   127    * the BSSBasicRateSet.
   127    * the BSSBasicRateSet.
   128    */
   128    */
   176    * Should be invoked whenever the AckTimeout associated to a transmission
   176    * Should be invoked whenever the AckTimeout associated to a transmission
   177    * attempt expires.
   177    * attempt expires.
   178    */
   178    */
   179   void ReportDataFailed (Mac48Address address, const WifiMacHeader *header);
   179   void ReportDataFailed (Mac48Address address, const WifiMacHeader *header);
   180   /**
   180   /**
   181    * Should be invoked whenever we receive the Cts associated to an RTS 
   181    * Should be invoked whenever we receive the Cts associated to an RTS
   182    * we just sent.
   182    * we just sent.
   183    */
   183    */
   184   void ReportRtsOk (Mac48Address address, const WifiMacHeader *header,
   184   void ReportRtsOk (Mac48Address address, const WifiMacHeader *header,
   185                     double ctsSnr, WifiMode ctsMode, double rtsSnr);
   185                     double ctsSnr, WifiMode ctsMode, double rtsSnr);
   186   /**
   186   /**
   188    * we just sent.
   188    * we just sent.
   189    */
   189    */
   190   void ReportDataOk (Mac48Address address, const WifiMacHeader *header,
   190   void ReportDataOk (Mac48Address address, const WifiMacHeader *header,
   191                      double ackSnr, WifiMode ackMode, double dataSnr);
   191                      double ackSnr, WifiMode ackMode, double dataSnr);
   192   /**
   192   /**
   193    * Should be invoked after calling ReportRtsFailed if 
   193    * Should be invoked after calling ReportRtsFailed if
   194    * NeedRtsRetransmission returns false
   194    * NeedRtsRetransmission returns false
   195    */
   195    */
   196   void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header);
   196   void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header);
   197   /**
   197   /**
   198    * Should be invoked after calling ReportDataFailed if 
   198    * Should be invoked after calling ReportDataFailed if
   199    * NeedDataRetransmission returns false
   199    * NeedDataRetransmission returns false
   200    */
   200    */
   201   void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header);
   201   void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header);
   202 
   202 
   203   /**
   203   /**
   222                 Ptr<const Packet> packet);
   222                 Ptr<const Packet> packet);
   223   /**
   223   /**
   224    * \param address remote address
   224    * \param address remote address
   225    * \param header MAC header
   225    * \param header MAC header
   226    * \param packet the packet to send
   226    * \param packet the packet to send
   227    * \returns true if we want to restart a failed RTS/CTS 
   227    * \returns true if we want to restart a failed RTS/CTS
   228    *          handshake, false otherwise.
   228    *          handshake, false otherwise.
   229    */
   229    */
   230   bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header,
   230   bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header,
   231                               Ptr<const Packet> packet);
   231                               Ptr<const Packet> packet);
   232   /**
   232   /**
   233    * \param address remote address
   233    * \param address remote address
   234    * \param header MAC header
   234    * \param header MAC header
   235    * \param packet the packet to send
   235    * \param packet the packet to send
   236    * \returns true if we want to resend a packet 
   236    * \returns true if we want to resend a packet
   237    *          after a failed transmission attempt, false otherwise.
   237    *          after a failed transmission attempt, false otherwise.
   238    */
   238    */
   239   bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header,
   239   bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header,
   240                                Ptr<const Packet> packet);
   240                                Ptr<const Packet> packet);
   241 
   241 
   244    * \param header MAC header
   244    * \param header MAC header
   245    * \param packet the packet to send
   245    * \param packet the packet to send
   246    * \returns true if this packet should be fragmented, false otherwise.
   246    * \returns true if this packet should be fragmented, false otherwise.
   247    */
   247    */
   248   bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header,
   248   bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header,
   249                                   Ptr<const Packet> packet);
   249                           Ptr<const Packet> packet);
   250   /**
   250   /**
   251    * \param address remote address
   251    * \param address remote address
   252    * \param header MAC header
   252    * \param header MAC header
   253    * \param packet the packet to send
   253    * \param packet the packet to send
   254    * \param fragmentNumber the fragment index of the next fragment to send (starts at zero).
   254    * \param fragmentNumber the fragment index of the next fragment to send (starts at zero).
   305    * \returns true if we want to use an RTS/CTS handshake for this
   305    * \returns true if we want to use an RTS/CTS handshake for this
   306    *          packet before sending it, false otherwise.
   306    *          packet before sending it, false otherwise.
   307    *
   307    *
   308    * Note: This method is called before a unicast packet is sent on the medium.
   308    * Note: This method is called before a unicast packet is sent on the medium.
   309    */
   309    */
   310   virtual bool DoNeedRts (WifiRemoteStation *station, 
   310   virtual bool DoNeedRts (WifiRemoteStation *station,
   311                           Ptr<const Packet> packet, bool normally);
   311                           Ptr<const Packet> packet, bool normally);
   312   /**
   312   /**
   313    * \param station the station with which we need to communicate
   313    * \param station the station with which we need to communicate
   314    * \param packet the packet to send
   314    * \param packet the packet to send
   315    * \param normally indicates whether the normal 802.11 rts enable mechanism would
   315    * \param normally indicates whether the normal 802.11 rts enable mechanism would
   316    *        request that the rts is retransmitted or not.
   316    *        request that the rts is retransmitted or not.
   317    * \returns true if we want to restart a failed RTS/CTS 
   317    * \returns true if we want to restart a failed RTS/CTS
   318    *          handshake, false otherwise.
   318    *          handshake, false otherwise.
   319    *
   319    *
   320    * Note: This method is called after an rts/cts handshake has been attempted
   320    * Note: This method is called after an rts/cts handshake has been attempted
   321    *       and has failed.
   321    *       and has failed.
   322    */
   322    */
   323   virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station, 
   323   virtual bool DoNeedRtsRetransmission (WifiRemoteStation *station,
   324                                         Ptr<const Packet> packet, bool normally);
   324                                         Ptr<const Packet> packet, bool normally);
   325   /**
   325   /**
   326    * \param station the station with which we need to communicate
   326    * \param station the station with which we need to communicate
   327    * \param packet the packet to send
   327    * \param packet the packet to send
   328    * \param normally indicates whether the normal 802.11 data retransmission mechanism
   328    * \param normally indicates whether the normal 802.11 data retransmission mechanism
   329    *        would request that the data is retransmitted or not.
   329    *        would request that the data is retransmitted or not.
   330    * \returns true if we want to resend a packet 
   330    * \returns true if we want to resend a packet
   331    *          after a failed transmission attempt, false otherwise.
   331    *          after a failed transmission attempt, false otherwise.
   332    *
   332    *
   333    * Note: This method is called after a unicast packet transmission has been attempted
   333    * Note: This method is called after a unicast packet transmission has been attempted
   334    *       and has failed.
   334    *       and has failed.
   335    */
   335    */
   336   virtual bool DoNeedDataRetransmission (WifiRemoteStation *station, 
   336   virtual bool DoNeedDataRetransmission (WifiRemoteStation *station,
   337                                          Ptr<const Packet> packet, bool normally);
   337                                          Ptr<const Packet> packet, bool normally);
   338 
   338 
   339   /**
   339   /**
   340    * \param station the station with which we need to communicate
   340    * \param station the station with which we need to communicate
   341    * \param packet the packet to send
   341    * \param packet the packet to send
   343    *        would request that the data packet is fragmented or not.
   343    *        would request that the data packet is fragmented or not.
   344    * \returns true if this packet should be fragmented, false otherwise.
   344    * \returns true if this packet should be fragmented, false otherwise.
   345    *
   345    *
   346    * Note: This method is called before sending a unicast packet.
   346    * Note: This method is called before sending a unicast packet.
   347    */
   347    */
   348   virtual bool DoNeedFragmentation (WifiRemoteStation *station, 
   348   virtual bool DoNeedFragmentation (WifiRemoteStation *station,
   349                                     Ptr<const Packet> packet, bool normally);
   349                                     Ptr<const Packet> packet, bool normally);
   350   /**
   350   /**
   351    * \returns whether this manager is a manager designed to work in low-latency
   351    * \returns whether this manager is a manager designed to work in low-latency
   352    *          environments.
   352    *          environments.
   353    *
   353    *
   356    */
   356    */
   357   virtual bool IsLowLatency (void) const = 0;
   357   virtual bool IsLowLatency (void) const = 0;
   358   /**
   358   /**
   359    * \return a new station data structure
   359    * \return a new station data structure
   360    */
   360    */
   361   virtual WifiRemoteStation *DoCreateStation (void) const = 0;
   361   virtual WifiRemoteStation* DoCreateStation (void) const = 0;
   362   /**
   362   /**
   363    * \param station the station with which we need to communicate
   363    * \param station the station with which we need to communicate
   364    * \param size size of the packet or fragment we want to send
   364    * \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
   365    * \returns the transmission mode to use to send a packet to the station
   366    *
   366    *
   386   virtual void DoReportFinalRtsFailed (WifiRemoteStation *station) = 0;
   386   virtual void DoReportFinalRtsFailed (WifiRemoteStation *station) = 0;
   387   virtual void DoReportFinalDataFailed (WifiRemoteStation *station) = 0;
   387   virtual void DoReportFinalDataFailed (WifiRemoteStation *station) = 0;
   388   virtual void DoReportRxOk (WifiRemoteStation *station,
   388   virtual void DoReportRxOk (WifiRemoteStation *station,
   389                              double rxSnr, WifiMode txMode) = 0;
   389                              double rxSnr, WifiMode txMode) = 0;
   390 
   390 
   391   WifiRemoteStationState *LookupState (Mac48Address address) const;
   391   WifiRemoteStationState* LookupState (Mac48Address address) const;
   392   WifiRemoteStation *Lookup (Mac48Address address, uint8_t tid) const;
   392   WifiRemoteStation* Lookup (Mac48Address address, uint8_t tid) const;
   393   /// Find a remote station by its remote address and TID taken from MAC header
   393   /// Find a remote station by its remote address and TID taken from MAC header
   394   WifiRemoteStation *Lookup (Mac48Address address, const WifiMacHeader *header) const;
   394   WifiRemoteStation* Lookup (Mac48Address address, const WifiMacHeader *header) const;
   395   WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
   395   WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode);
   396   uint32_t GetNFragments (Ptr<const Packet> packet);
   396   uint32_t GetNFragments (Ptr<const Packet> packet);
   397 
   397 
   398   typedef std::vector <WifiRemoteStation *> Stations;
   398   typedef std::vector <WifiRemoteStation *> Stations;
   399   typedef std::vector <WifiRemoteStationState *> StationStates;
   399   typedef std::vector <WifiRemoteStationState *> StationStates;
   431   /**
   431   /**
   432    * The trace source fired when the transmission of a single RTS has failed
   432    * The trace source fired when the transmission of a single RTS has failed
   433    */
   433    */
   434   TracedCallback<Mac48Address> m_macTxRtsFailed;
   434   TracedCallback<Mac48Address> m_macTxRtsFailed;
   435   /**
   435   /**
   436    * The trace source fired when the transmission of a single data packet has failed 
   436    * The trace source fired when the transmission of a single data packet has failed
   437    */
   437    */
   438   TracedCallback<Mac48Address> m_macTxDataFailed;
   438   TracedCallback<Mac48Address> m_macTxDataFailed;
   439   /**
   439   /**
   440    * The trace source fired when the transmission of a RTS has
   440    * The trace source fired when the transmission of a RTS has
   441    * exceeded the maximum number of attempts
   441    * exceeded the maximum number of attempts
   449 
   449 
   450 };
   450 };
   451 
   451 
   452 struct WifiRemoteStationState
   452 struct WifiRemoteStationState
   453 {
   453 {
   454   enum 
   454   enum
   455     {
   455   {
   456       BRAND_NEW,
   456     BRAND_NEW,
   457       DISASSOC,
   457     DISASSOC,
   458       WAIT_ASSOC_TX_OK,
   458     WAIT_ASSOC_TX_OK,
   459       GOT_ASSOC_TX_OK
   459     GOT_ASSOC_TX_OK
   460     } m_state;
   460   } m_state;
   461 
   461 
   462   /**
   462   /**
   463    * This member is the list of WifiMode objects that comprise the
   463    * This member is the list of WifiMode objects that comprise the
   464    * OperationalRateSet parameter for this remote station. This list
   464    * OperationalRateSet parameter for this remote station. This list
   465    * is constructed through calls to
   465    * is constructed through calls to
   489   uint32_t m_slrc;
   489   uint32_t m_slrc;
   490   uint8_t m_tid;
   490   uint8_t m_tid;
   491 };
   491 };
   492 
   492 
   493 
   493 
   494 } // namespace ns3 
   494 } // namespace ns3
   495 
   495 
   496 #endif /* WIFI_REMOTE_STATION_MANAGER_H */
   496 #endif /* WIFI_REMOTE_STATION_MANAGER_H */