src/devices/wifi/arf-wifi-manager.h
changeset 2524 db72c0e7743e
parent 2269 06c660ffc070
child 2784 49006cbbfac7
equal deleted inserted replaced
2523:58182a1561cc 2524:db72c0e7743e
       
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2005,2006 INRIA
       
     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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    19  */
       
    20 #ifndef ARF_WIFI_MANAGER_H
       
    21 #define ARF_WIFI_MANAGER_H
       
    22 
       
    23 #include "wifi-remote-station-manager.h"
       
    24 
       
    25 namespace ns3 {
       
    26 
       
    27 /**
       
    28  * \brief ARF Rate control algorithm
       
    29  *
       
    30  * This class implements the so-called ARF algorithm which was
       
    31  * initially described in <i>WaveLAN-II: A High-performance wireless 
       
    32  * LAN for the unlicensed band</i>, by A. Kamerman and L. Monteban. in
       
    33  * Bell Lab Technical Journal, pages 118-133, Summer 1997.
       
    34  *
       
    35  * This implementation differs from the initial description in that it
       
    36  * uses a packet-based timer rather than a time-based timer as described 
       
    37  * in XXX (I cannot find back the original paper which described how
       
    38  * the time-based timer could be easily replaced with a packet-based 
       
    39  * timer.)
       
    40  */
       
    41 class ArfWifiManager : public WifiRemoteStationManager
       
    42 {
       
    43 public:
       
    44   static TypeId GetTypeId (void);
       
    45   ArfWifiManager ();
       
    46   virtual ~ArfWifiManager ();
       
    47 
       
    48 private:
       
    49   virtual class WifiRemoteStation *CreateStation (void);
       
    50   uint32_t m_timerThreshold;
       
    51   uint32_t m_successThreshold;
       
    52 };
       
    53 
       
    54 
       
    55 class ArfWifiRemoteStation : public WifiRemoteStation
       
    56 {
       
    57 public:
       
    58   ArfWifiRemoteStation (Ptr<ArfWifiManager> stations,
       
    59                         int minTimerTimeout,
       
    60                         int minSuccessThreshold);
       
    61   virtual ~ArfWifiRemoteStation ();
       
    62 
       
    63   virtual void ReportRxOk (double rxSnr, WifiMode txMode);
       
    64   virtual void ReportRtsFailed (void);
       
    65   virtual void ReportDataFailed (void);
       
    66   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
       
    67   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
       
    68   virtual void ReportFinalRtsFailed (void);
       
    69   virtual void ReportFinalDataFailed (void);
       
    70 
       
    71 private:
       
    72   virtual Ptr<WifiRemoteStationManager> GetManager (void) const;
       
    73   virtual WifiMode DoGetDataMode (uint32_t size);
       
    74   virtual WifiMode DoGetRtsMode (void);
       
    75 
       
    76   uint32_t m_timer;
       
    77   uint32_t m_success;
       
    78   uint32_t m_failed;
       
    79   bool m_recovery;
       
    80   uint32_t m_retry;
       
    81   
       
    82   uint32_t m_timerTimeout;
       
    83   uint32_t m_successThreshold;
       
    84 
       
    85   uint32_t m_rate;
       
    86   
       
    87   uint32_t m_minTimerTimeout;
       
    88   uint32_t m_minSuccessThreshold;
       
    89 
       
    90   Ptr<ArfWifiManager> m_stations;
       
    91   
       
    92 private:
       
    93   // overriden by AarfMacStation.
       
    94   virtual void ReportRecoveryFailure (void);
       
    95   virtual void ReportFailure (void);
       
    96 
       
    97   uint32_t GetMaxRate (void);
       
    98   uint32_t GetMinRate (void);
       
    99 
       
   100   bool NeedRecoveryFallback (void);
       
   101   bool NeedNormalFallback (void);
       
   102   
       
   103 protected:
       
   104   // called by AarfMacStation.
       
   105   uint32_t GetMinTimerTimeout (void);
       
   106   uint32_t GetMinSuccessThreshold (void);
       
   107   
       
   108   uint32_t GetTimerTimeout (void);
       
   109   uint32_t GetSuccessThreshold (void);
       
   110   
       
   111   void SetTimerTimeout (uint32_t timerTimeout);
       
   112   void SetSuccessThreshold (uint32_t successThreshold);
       
   113 };
       
   114 
       
   115 } // namespace ns3
       
   116 
       
   117 #endif /* ARF_WIFI_MANAGER_H */