author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 17 Apr 2008 13:42:25 -0700 | |
changeset 2965 | 4b28e9740e3b |
parent 2602 | d9262bff6df2 |
child 4340 | 8a1b890c99cc |
permissions | -rw-r--r-- |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2004,2005,2006 INRIA |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
21 |
#include "aarf-wifi-manager.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
22 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
23 |
#include "ns3/double.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
24 |
#include "ns3/uinteger.h" |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#define Min(a,b) ((a<b)?a:b) |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
#define Max(a,b) ((a>b)?a:b) |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
namespace ns3 { |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
31 |
NS_OBJECT_ENSURE_REGISTERED (AarfWifiManager); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
32 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
33 |
TypeId |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
34 |
AarfWifiManager::GetTypeId (void) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
35 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
36 |
static TypeId tid = TypeId ("ns3::AarfWifiManager") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
37 |
.SetParent<ArfWifiManager> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
38 |
.AddConstructor<AarfWifiManager> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
39 |
.AddAttribute ("SuccessK", "Multiplication factor for the success threshold in the AARF algorithm.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
40 |
DoubleValue (2.0), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
41 |
MakeDoubleAccessor (&AarfWifiManager::m_successK), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
42 |
MakeDoubleChecker<double> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
43 |
.AddAttribute ("TimerK", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
44 |
"Multiplication factor for the timer threshold in the AARF algorithm.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
45 |
DoubleValue (2.0), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
46 |
MakeDoubleAccessor (&AarfWifiManager::m_timerK), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
47 |
MakeDoubleChecker<double> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
48 |
.AddAttribute ("MaxSuccessThreshold", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
49 |
"Maximum value of the success threshold in the AARF algorithm.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
50 |
UintegerValue (60), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
51 |
MakeUintegerAccessor (&AarfWifiManager::m_maxSuccessThreshold), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
52 |
MakeUintegerChecker<uint32_t> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
53 |
.AddAttribute ("MinTimerThreshold", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
54 |
"The minimum value for the 'timer' threshold in the AARF algorithm.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
55 |
UintegerValue (15), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
56 |
MakeUintegerAccessor (&AarfWifiManager::m_minTimerThreshold), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
57 |
MakeUintegerChecker<uint32_t> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
58 |
.AddAttribute ("MinSuccessThreshold", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
59 |
"The minimum value for the success threshold in the AARF algorithm.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
60 |
UintegerValue (10), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
61 |
MakeUintegerAccessor (&AarfWifiManager::m_minSuccessThreshold), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
62 |
MakeUintegerChecker<uint32_t> ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
63 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
64 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
65 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
66 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
67 |
AarfWifiManager::AarfWifiManager () |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
{} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
69 |
AarfWifiManager::~AarfWifiManager () |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
{} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
71 |
WifiRemoteStation * |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
72 |
AarfWifiManager::CreateStation (void) |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
73 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
74 |
return new AarfWifiRemoteStation (this, m_minTimerThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
75 |
m_minSuccessThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
76 |
m_successK, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
77 |
m_maxSuccessThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
78 |
m_timerK); |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
80 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
84 |
AarfWifiRemoteStation::AarfWifiRemoteStation (Ptr<AarfWifiManager> stations, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
85 |
uint32_t minTimerThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
86 |
uint32_t minSuccessThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
87 |
double successK, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
88 |
uint32_t maxSuccessThreshold, |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
89 |
double timerK) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
90 |
: ArfWifiRemoteStation (stations, minTimerThreshold, minSuccessThreshold), |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
m_successK (successK), |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
m_maxSuccessThreshold (maxSuccessThreshold), |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
m_timerK (timerK) |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
{} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
97 |
AarfWifiRemoteStation::~AarfWifiRemoteStation () |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
{} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
101 |
AarfWifiRemoteStation::ReportRecoveryFailure (void) |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
{ |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
SetSuccessThreshold ((int)(Min (GetSuccessThreshold () * m_successK, |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
m_maxSuccessThreshold))); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
SetTimerTimeout ((int)(Max (GetMinTimerTimeout (), |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
GetSuccessThreshold () * m_timerK))); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
107 |
} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
109 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
110 |
AarfWifiRemoteStation::ReportFailure (void) |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
{ |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
SetTimerTimeout (GetMinTimerTimeout ()); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
SetSuccessThreshold (GetMinSuccessThreshold ()); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
|
1918
fee53ba3f388
port to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1895
diff
changeset
|
116 |
} // namespace ns3 |