src/devices/wifi/onoe-mac-stations.h
changeset 2545 7a38029a2e5b
parent 2544 2e6e1a6e0d94
child 2546 3fc951966b1b
equal deleted inserted replaced
2544:2e6e1a6e0d94 2545:7a38029a2e5b
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2003,2007 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 ONOE_MAC_STATIONS_H
       
    21 #define ONOE_MAC_STATIONS_H
       
    22 
       
    23 #include "wifi-remote-station-manager.h"
       
    24 #include "ns3/nstime.h"
       
    25 
       
    26 namespace ns3 {
       
    27 
       
    28 class OnoeWifiManager : public WifiRemoteStationManager
       
    29 {
       
    30 public:
       
    31   OnoeWifiManager ();
       
    32 
       
    33 private:
       
    34   friend class OnoeWifiRemoteStation;
       
    35   virtual WifiRemoteStation *CreateStation (void);
       
    36 
       
    37   Time m_updatePeriod;
       
    38   uint32_t m_addCreditThreshold;
       
    39   uint32_t m_raiseThreshold;
       
    40 };
       
    41 
       
    42 /**
       
    43  * \brief an implementation of rate control algorithm developed 
       
    44  *        by Atsushi Onoe
       
    45  *
       
    46  * This algorithm is well known because it has been used as the default
       
    47  * rate control algorithm for the madwifi driver. I am not aware of
       
    48  * any publication or reference about this algorithm beyond the madwifi
       
    49  * source code.
       
    50  */
       
    51 class OnoeWifiRemoteStation : public WifiRemoteStation
       
    52 {
       
    53 public:
       
    54   OnoeWifiRemoteStation (OnoeWifiManager *stations);
       
    55 
       
    56   virtual ~OnoeWifiRemoteStation ();
       
    57 
       
    58   virtual void ReportRxOk (double rxSnr, WifiMode txMode);
       
    59   virtual void ReportRtsFailed (void);
       
    60   virtual void ReportDataFailed (void);
       
    61   virtual void ReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
       
    62   virtual void ReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
       
    63   virtual void ReportFinalRtsFailed (void);
       
    64   virtual void ReportFinalDataFailed (void);
       
    65 
       
    66 private:
       
    67   virtual OnoeWifiManager *GetStations (void) const;
       
    68   virtual WifiMode DoGetDataMode (uint32_t size);
       
    69   virtual WifiMode DoGetRtsMode (void);
       
    70 
       
    71   void UpdateRetry (void);
       
    72   void UpdateMode (void);
       
    73 
       
    74   OnoeWifiManager *m_stations;
       
    75   Time m_nextModeUpdate;
       
    76   uint32_t m_shortRetry;
       
    77   uint32_t m_longRetry;
       
    78   uint32_t m_tx_ok;
       
    79   uint32_t m_tx_err;
       
    80   uint32_t m_tx_retr;
       
    81   uint32_t m_tx_upper;
       
    82   uint32_t m_txrate;
       
    83 };
       
    84 
       
    85 } // namespace ns3
       
    86 
       
    87 #endif /* ONOE_MAC_STATIONS_H */