author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 17 Apr 2009 09:59:54 +0200 | |
changeset 4340 | 8a1b890c99cc |
parent 2965 | 4b28e9740e3b |
child 6065 | 0f012e7d9128 |
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 |
{ |
4340 | 74 |
return new AarfWifiRemoteStation (this); |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
|
4340 | 80 |
AarfWifiRemoteStation::AarfWifiRemoteStation (Ptr<AarfWifiManager> manager) |
81 |
: ArfWifiRemoteStation (manager), |
|
82 |
m_manager (manager) |
|
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
{} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
86 |
AarfWifiRemoteStation::~AarfWifiRemoteStation () |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
{} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
|
4340 | 89 |
Ptr<WifiRemoteStationManager> |
90 |
AarfWifiRemoteStation::GetManager (void) const |
|
91 |
{ |
|
92 |
return m_manager; |
|
93 |
} |
|
94 |
||
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
96 |
AarfWifiRemoteStation::ReportRecoveryFailure (void) |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
{ |
4340 | 98 |
SetSuccessThreshold ((int)(Min (GetSuccessThreshold () * m_manager->m_successK, |
99 |
m_manager->m_maxSuccessThreshold))); |
|
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
SetTimerTimeout ((int)(Max (GetMinTimerTimeout (), |
4340 | 101 |
GetSuccessThreshold () * m_manager->m_timerK))); |
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 |
|
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2004
diff
changeset
|
105 |
AarfWifiRemoteStation::ReportFailure (void) |
1895
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
{ |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
107 |
SetTimerTimeout (GetMinTimerTimeout ()); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
SetSuccessThreshold (GetMinSuccessThreshold ()); |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
109 |
} |
6c2d6a5631bc
add more files to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
110 |
|
1918
fee53ba3f388
port to new MacStation API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1895
diff
changeset
|
111 |
} // namespace ns3 |