src/wifi/model/parf-wifi-manager.h
changeset 11153 324c767aefdd
child 11450 9f4ae69f12b7
equal deleted inserted replaced
11152:613c316c7c18 11153:324c767aefdd
       
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2014 Universidad de la República - Uruguay
       
     4  *
       
     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
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Matias Richart <mrichart@fing.edu.uy>
       
    19  */
       
    20 
       
    21 #ifndef PARF_WIFI_MANAGER_H
       
    22 #define PARF_WIFI_MANAGER_H
       
    23 
       
    24 #include "wifi-remote-station-manager.h"
       
    25 
       
    26 namespace ns3 {
       
    27 
       
    28 struct ParfWifiRemoteStation;
       
    29 /**
       
    30  * \ingroup wifi
       
    31  * PARF Rate control algorithm
       
    32  *
       
    33  * This class implements the PARF algorithm as described in
       
    34  * <i>Self-management in chaotic wireless deployments</i>, by
       
    35  * Akella, A.; Judd, G.; Seshan, S. and Steenkiste, P. in
       
    36  * Wireless Networks, Kluwer Academic Publishers, 2007, 13, 737-755
       
    37  * http://www.cs.odu.edu/~nadeem/classes/cs795-WNS-S13/papers/enter-006.pdf
       
    38  *
       
    39  */
       
    40 class ParfWifiManager : public WifiRemoteStationManager
       
    41 {
       
    42 public:
       
    43   /**
       
    44    * Register this type.
       
    45    * \return The object TypeId.
       
    46    */
       
    47   static TypeId GetTypeId (void);
       
    48   ParfWifiManager ();
       
    49   virtual ~ParfWifiManager ();
       
    50 
       
    51   virtual void SetupPhy (Ptr<WifiPhy> phy);
       
    52 
       
    53   /**
       
    54    * TracedCallback signature for power change events.
       
    55    *
       
    56    * \param [in] power The new power.
       
    57    * \param [in] address The remote station MAC address.
       
    58    */
       
    59   typedef void (*PowerChangeTracedCallback)(const uint8_t power, const Mac48Address remoteAddress);
       
    60 
       
    61   /**
       
    62    * TracedCallback signature for rate change events.
       
    63    *
       
    64    * \param [in] rate The new rate.
       
    65    * \param [in] address The remote station MAC address.
       
    66    */
       
    67   typedef void (*RateChangeTracedCallback)(const uint32_t rate, const Mac48Address remoteAddress);
       
    68 
       
    69 private:
       
    70   // overriden from base class
       
    71   virtual WifiRemoteStation * DoCreateStation (void) const;
       
    72   virtual void DoReportRxOk (WifiRemoteStation *station,
       
    73                              double rxSnr, WifiMode txMode);
       
    74   virtual void DoReportRtsFailed (WifiRemoteStation *station);
       
    75   virtual void DoReportDataFailed (WifiRemoteStation *station);
       
    76   virtual void DoReportRtsOk (WifiRemoteStation *station,
       
    77                               double ctsSnr, WifiMode ctsMode, double rtsSnr);
       
    78   virtual void DoReportDataOk (WifiRemoteStation *station,
       
    79                                double ackSnr, WifiMode ackMode, double dataSnr);
       
    80   virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
       
    81   virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
       
    82   virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
       
    83   virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
       
    84   virtual bool IsLowLatency (void) const;
       
    85 
       
    86   /** Check for initializations.
       
    87    *
       
    88    * \param station The remote station.
       
    89    */
       
    90   void CheckInit (ParfWifiRemoteStation *station);
       
    91 
       
    92 
       
    93   uint32_t m_attemptThreshold; //!< The minimum number of transmission attempts to try a new power or rate. The 'timer' threshold in the ARF algorithm.
       
    94   uint32_t m_successThreshold; //!< The minimum number of successful transmissions to try a new power or rate.
       
    95   /**
       
    96    * Number of power levels.
       
    97    * In contrast to rate, power levels do not depend on the remote station.
       
    98    * The levels depend only on the physical layer of the device.
       
    99    */
       
   100   uint32_t m_nPower;
       
   101 
       
   102   /**
       
   103    * The trace source fired when the transmission power changes....
       
   104    */
       
   105   TracedCallback<uint8_t, Mac48Address> m_powerChange;
       
   106   /**
       
   107    * The trace source fired when the transmission rate changes.
       
   108    */
       
   109   TracedCallback<uint32_t, Mac48Address> m_rateChange;
       
   110 
       
   111 };
       
   112 
       
   113 } // namespace ns3
       
   114 
       
   115 #endif /* PARF_WIFI_MANAGER_H */