00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2003,2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef ONOE_WIFI_MANAGER_H 00021 #define ONOE_WIFI_MANAGER_H 00022 00023 #include "wifi-remote-station-manager.h" 00024 #include "ns3/nstime.h" 00025 00026 namespace ns3 { 00027 00028 /** 00029 * \brief an implementation of rate control algorithm developed 00030 * by Atsushi Onoe 00031 * 00032 * This algorithm is well known because it has been used as the default 00033 * rate control algorithm for the madwifi driver. I am not aware of 00034 * any publication or reference about this algorithm beyond the madwifi 00035 * source code. 00036 */ 00037 class OnoeWifiManager : public WifiRemoteStationManager 00038 { 00039 public: 00040 static TypeId GetTypeId (void); 00041 00042 OnoeWifiManager (); 00043 00044 private: 00045 friend class OnoeWifiRemoteStation; 00046 virtual WifiRemoteStation *CreateStation (void); 00047 00048 Time m_updatePeriod; 00049 uint32_t m_addCreditThreshold; 00050 uint32_t m_raiseThreshold; 00051 }; 00052 00053 class OnoeWifiRemoteStation : public WifiRemoteStation 00054 { 00055 public: 00056 OnoeWifiRemoteStation (Ptr<OnoeWifiManager> stations); 00057 00058 virtual ~OnoeWifiRemoteStation (); 00059 00060 protected: 00061 virtual void DoReportRxOk (double rxSnr, WifiMode txMode); 00062 virtual void DoReportRtsFailed (void); 00063 virtual void DoReportDataFailed (void); 00064 virtual void DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr); 00065 virtual void DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr); 00066 virtual void DoReportFinalRtsFailed (void); 00067 virtual void DoReportFinalDataFailed (void); 00068 00069 private: 00070 virtual Ptr<WifiRemoteStationManager> GetManager (void) const; 00071 virtual WifiMode DoGetDataMode (uint32_t size); 00072 virtual WifiMode DoGetRtsMode (void); 00073 00074 void UpdateRetry (void); 00075 void UpdateMode (void); 00076 00077 Ptr<OnoeWifiManager> m_stations; 00078 Time m_nextModeUpdate; 00079 uint32_t m_shortRetry; 00080 uint32_t m_longRetry; 00081 uint32_t m_tx_ok; 00082 uint32_t m_tx_err; 00083 uint32_t m_tx_retr; 00084 uint32_t m_tx_upper; 00085 uint32_t m_txrate; 00086 }; 00087 00088 } // namespace ns3 00089 00090 #endif /* ONOE_WIFI_MANAGER_H */