author | Federico Maguolo <maguolof@dei.unipd.it> |
Fri, 28 Mar 2008 12:14:02 -0700 | |
changeset 2784 | 49006cbbfac7 |
parent 2544 | 2e6e1a6e0d94 |
child 6065 | 0f012e7d9128 |
permissions | -rw-r--r-- |
2351 | 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: Federico Maguolo <maguolof@dei.unipd.it> |
|
19 |
*/ |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
20 |
#ifndef RRAA_WIFI_MANAGER_H |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
21 |
#define RRAA_WIFI_MANAGER_H |
2351 | 22 |
|
23 |
#include "ns3/nstime.h" |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
24 |
#include "wifi-remote-station-manager.h" |
2351 | 25 |
|
26 |
namespace ns3 { |
|
27 |
||
28 |
struct ThresholdsItem { |
|
29 |
uint32_t datarate; |
|
30 |
double pori; |
|
31 |
double pmtl; |
|
32 |
uint32_t ewnd; |
|
33 |
}; |
|
34 |
||
35 |
typedef std::vector<ThresholdsItem> Thresholds; |
|
36 |
||
37 |
/** |
|
38 |
* \brief Robust Rate Adaptation Algorithm |
|
39 |
* |
|
40 |
* This is an implementation of RRAA as described in |
|
41 |
* "Robust rate adaptation for 802.11 wireless networks" |
|
42 |
* by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and, |
|
43 |
* "Vaduvur Bharghavan" published in Mobicom 06. |
|
44 |
*/ |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
45 |
class RraaWifiManager : public WifiRemoteStationManager |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
46 |
{ |
2351 | 47 |
public: |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
48 |
static TypeId GetTypeId (void); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
49 |
|
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
50 |
RraaWifiManager (); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
51 |
virtual ~RraaWifiManager (); |
2351 | 52 |
bool OnlyBasic (void); |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
53 |
Time GetTimeout (void) const; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
54 |
ThresholdsItem GetThresholds (WifiMode mode) const; |
2351 | 55 |
private: |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
56 |
virtual class WifiRemoteStation *CreateStation (void); |
2351 | 57 |
bool m_basic; |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
58 |
Time m_timeout; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
59 |
uint32_t m_ewndfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
60 |
uint32_t m_ewndfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
61 |
uint32_t m_ewndfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
62 |
uint32_t m_ewndfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
63 |
uint32_t m_ewndfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
64 |
uint32_t m_ewndfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
65 |
uint32_t m_ewndfor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
66 |
uint32_t m_ewndfor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
67 |
double m_porifor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
68 |
double m_porifor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
69 |
double m_porifor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
70 |
double m_porifor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
71 |
double m_porifor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
72 |
double m_porifor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
73 |
double m_porifor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
74 |
double m_pmtlfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
75 |
double m_pmtlfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
76 |
double m_pmtlfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
77 |
double m_pmtlfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
78 |
double m_pmtlfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
79 |
double m_pmtlfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
80 |
double m_pmtlfor9; |
2351 | 81 |
}; |
82 |
||
83 |
||
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
84 |
class RraaWifiRemoteStation : public WifiRemoteStation |
2351 | 85 |
{ |
86 |
public: |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
87 |
RraaWifiRemoteStation (Ptr<RraaWifiManager> stations); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
88 |
virtual ~RraaWifiRemoteStation (); |
2351 | 89 |
|
90 |
virtual bool NeedRts (Ptr<const Packet> packet); |
|
2784
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
91 |
protected: |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
92 |
virtual void DoReportRxOk (double rxSnr, WifiMode txMode); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
93 |
virtual void DoReportRtsFailed (void); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
94 |
virtual void DoReportDataFailed (void); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
95 |
virtual void DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
96 |
virtual void DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
97 |
virtual void DoReportFinalRtsFailed (void); |
49006cbbfac7
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents:
2544
diff
changeset
|
98 |
virtual void DoReportFinalDataFailed (void); |
2351 | 99 |
|
100 |
private: |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
101 |
virtual Ptr<WifiRemoteStationManager> GetManager (void) const; |
2351 | 102 |
virtual WifiMode DoGetDataMode (uint32_t size); |
103 |
virtual WifiMode DoGetRtsMode (void); |
|
104 |
uint32_t GetMaxRate (void); |
|
105 |
uint32_t GetMinRate (void); |
|
106 |
ThresholdsItem GetThresholds (uint32_t rate); |
|
107 |
void CheckTimeout (void); |
|
108 |
void RunBasicAlgorithm (void); |
|
109 |
void ARts (void); |
|
110 |
void ResetCountersBasic (void); |
|
111 |
||
112 |
uint32_t m_counter; |
|
113 |
uint32_t m_failed; |
|
114 |
uint32_t m_rtsWnd; |
|
115 |
uint32_t m_rtsCounter; |
|
116 |
Time m_lastReset; |
|
117 |
bool m_rtsOn; |
|
118 |
bool m_lastFrameFail; |
|
119 |
bool m_initialized; |
|
120 |
||
121 |
uint32_t m_rate; |
|
122 |
||
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
123 |
Ptr<RraaWifiManager> m_stations; |
2351 | 124 |
}; |
125 |
||
126 |
} // namespace ns3 |
|
127 |
||
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
128 |
#endif /* RRAA_WIFI_MANAGER_H */ |