author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Tue, 02 Sep 2008 12:00:11 -0700 | |
changeset 3596 | 6c39b712a535 |
parent 3517 | 5ba130a7f519 |
child 3597 | fe35e5be4b78 |
permissions | -rw-r--r-- |
1948 | 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
20 |
||
21 |
#include "ns3/packet.h" |
|
22 |
#include "ns3/simulator.h" |
|
23 |
#include "ns3/assert.h" |
|
2012
54dd9789c670
enable logging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2009
diff
changeset
|
24 |
#include "ns3/log.h" |
2156
754a843db672
improve log output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2090
diff
changeset
|
25 |
#include "ns3/node.h" |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
26 |
#include "ns3/uinteger.h" |
1948 | 27 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
28 |
#include "nqsta-wifi-mac.h" |
1948 | 29 |
#include "wifi-mac-header.h" |
30 |
#include "mgt-headers.h" |
|
31 |
#include "wifi-phy.h" |
|
32 |
#include "dca-txop.h" |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
33 |
#include "mac-low.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
34 |
#include "dcf-manager.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
35 |
#include "mac-rx-middle.h" |
1948 | 36 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
37 |
NS_LOG_COMPONENT_DEFINE ("NqstaWifiMac"); |
1948 | 38 |
|
39 |
/* |
|
40 |
* The state machine for this NQSTA is: |
|
3210
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
41 |
-------------- ----------- |
1948 | 42 |
| Associated | <-------------------- -------> | Refused | |
3210
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
43 |
-------------- \ / ----------- |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
44 |
\ \ / |
1948 | 45 |
\ ----------------- ----------------------------- |
46 |
\-> | Beacon Missed | --> | Wait Association Response | |
|
3210
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
47 |
----------------- ----------------------------- |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
48 |
\ ^ |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
49 |
\ | |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
50 |
\ ----------------------- |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
51 |
\-> | Wait Probe Response | |
5c73c36a3350
Re-format the NQSTA state machine diagram so that it displays correctly with a fixed width font.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3206
diff
changeset
|
52 |
----------------------- |
1948 | 53 |
*/ |
54 |
||
55 |
namespace ns3 { |
|
56 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
57 |
NS_OBJECT_ENSURE_REGISTERED (NqstaWifiMac); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
58 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
59 |
TypeId |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
60 |
NqstaWifiMac::GetTypeId (void) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
61 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
62 |
static TypeId tid = TypeId ("ns3::NqstaWifiMac") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
63 |
.SetParent<WifiMac> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
64 |
.AddConstructor<NqstaWifiMac> () |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
65 |
.AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.", |
3206
231895d89769
Change default WiFi ProbeRequestTimeout to 50 ms; closes bug #199.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2989
diff
changeset
|
66 |
TimeValue (Seconds (0.05)), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
67 |
MakeTimeAccessor (&NqstaWifiMac::m_probeRequestTimeout), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
68 |
MakeTimeChecker ()) |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
69 |
.AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
70 |
TimeValue (Seconds (0.5)), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
71 |
MakeTimeAccessor (&NqstaWifiMac::m_assocRequestTimeout), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
72 |
MakeTimeChecker ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
73 |
.AddAttribute ("MaxMissedBeacons", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
74 |
"Number of beacons which much be consecutively missed before " |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
75 |
"we attempt to restart association.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
76 |
UintegerValue (10), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
77 |
MakeUintegerAccessor (&NqstaWifiMac::m_maxMissedBeacons), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
78 |
MakeUintegerChecker<uint32_t> ()) |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
79 |
.AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
80 |
BooleanValue (false), |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
81 |
MakeBooleanAccessor (&NqstaWifiMac::SetActiveProbing), |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
82 |
MakeBooleanChecker ()) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
83 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
84 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
85 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
86 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
87 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
88 |
NqstaWifiMac::NqstaWifiMac () |
1948 | 89 |
: m_state (BEACON_MISSED), |
90 |
m_probeRequestEvent (), |
|
91 |
m_assocRequestEvent (), |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
92 |
m_beaconWatchdogEnd (Seconds (0.0)) |
1948 | 93 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
94 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
95 |
m_rxMiddle = new MacRxMiddle (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
96 |
m_rxMiddle->SetForwardCallback (MakeCallback (&NqstaWifiMac::Receive, this)); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
97 |
|
2617
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
98 |
m_low = CreateObject<MacLow> (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
99 |
m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
100 |
m_low->SetMac (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
101 |
|
2617
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
102 |
m_dcfManager = new DcfManager (); |
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
103 |
m_dcfManager->SetupLowListener (m_low); |
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
104 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
105 |
m_dca = CreateObject<DcaTxop> (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
106 |
m_dca->SetLow (m_low); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
107 |
m_dca->SetManager (m_dcfManager); |
1948 | 108 |
} |
109 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
110 |
NqstaWifiMac::~NqstaWifiMac () |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
111 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
112 |
NS_LOG_FUNCTION (this); |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
113 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
114 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
115 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
116 |
NqstaWifiMac::DoDispose (void) |
2054
ba8e810bae4c
derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2012
diff
changeset
|
117 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
118 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
119 |
delete m_rxMiddle; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
120 |
delete m_dcfManager; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
121 |
m_rxMiddle = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
122 |
m_low = 0; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
123 |
m_dcfManager = 0; |
2054
ba8e810bae4c
derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2012
diff
changeset
|
124 |
m_phy = 0; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
125 |
m_dca = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
126 |
WifiMac::DoDispose (); |
2054
ba8e810bae4c
derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2012
diff
changeset
|
127 |
} |
1948 | 128 |
|
129 |
void |
|
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
130 |
NqstaWifiMac::SetSlot (Time slotTime) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
131 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
132 |
NS_LOG_FUNCTION (this << slotTime); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
133 |
m_dcfManager->SetSlot (slotTime); |
2686 | 134 |
m_slot = slotTime; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
135 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
136 |
void |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
137 |
NqstaWifiMac::SetSifs (Time sifs) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
138 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
139 |
NS_LOG_FUNCTION (this << sifs); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
140 |
m_dcfManager->SetSifs (sifs); |
2686 | 141 |
m_sifs = sifs; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
142 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
143 |
void |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
144 |
NqstaWifiMac::SetEifsNoDifs (Time eifsNoDifs) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
145 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
146 |
NS_LOG_FUNCTION (this << eifsNoDifs); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
147 |
m_dcfManager->SetEifsNoDifs (eifsNoDifs); |
2686 | 148 |
m_eifsNoDifs = eifsNoDifs; |
149 |
} |
|
3596
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
150 |
void |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
151 |
NqstaWifiMac::SetAckTimeout (Time ackTimeout) |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
152 |
{ |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
153 |
m_low->SetAckTimeout (ackTimeout); |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
154 |
} |
2686 | 155 |
Time |
156 |
NqstaWifiMac::GetSlot (void) const |
|
157 |
{ |
|
158 |
return m_slot; |
|
159 |
} |
|
160 |
Time |
|
161 |
NqstaWifiMac::GetSifs (void) const |
|
162 |
{ |
|
163 |
return m_sifs; |
|
164 |
} |
|
165 |
Time |
|
166 |
NqstaWifiMac::GetEifsNoDifs (void) const |
|
167 |
{ |
|
168 |
return m_eifsNoDifs; |
|
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
169 |
} |
3596
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
170 |
Time |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
171 |
NqstaWifiMac::GetAckTimeout (void) const |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
172 |
{ |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
173 |
return m_low->GetAckTimeout (); |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
174 |
} |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
175 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
176 |
NqstaWifiMac::SetWifiPhy (Ptr<WifiPhy> phy) |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
177 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
178 |
m_phy = phy; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
179 |
m_dcfManager->SetupPhyListener (phy); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
180 |
m_low->SetPhy (phy); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
181 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
182 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
183 |
NqstaWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
184 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
185 |
m_stationManager = stationManager; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
186 |
m_dca->SetWifiRemoteStationManager (stationManager); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
187 |
m_low->SetWifiRemoteStationManager (stationManager); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
188 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
189 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
190 |
NqstaWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, const Mac48Address &> upCallback) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
191 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
192 |
m_forwardUp = upCallback; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
193 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
194 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
195 |
NqstaWifiMac::SetLinkUpCallback (Callback<void> linkUp) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
196 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
197 |
m_linkUp = linkUp; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
198 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
199 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
200 |
NqstaWifiMac::SetLinkDownCallback (Callback<void> linkDown) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
201 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
202 |
m_linkDown = linkDown; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
203 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
204 |
Mac48Address |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
205 |
NqstaWifiMac::GetAddress (void) const |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
206 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
207 |
return m_address; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
208 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
209 |
Ssid |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
210 |
NqstaWifiMac::GetSsid (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
211 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
212 |
return m_ssid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
213 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
214 |
Mac48Address |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
215 |
NqstaWifiMac::GetBssid (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
216 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
217 |
return m_bssid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
218 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
219 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
220 |
NqstaWifiMac::SetAddress (Mac48Address address) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
221 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
222 |
NS_LOG_FUNCTION (this << address); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
223 |
m_address = address; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
224 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
225 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
226 |
NqstaWifiMac::SetSsid (Ssid ssid) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
227 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
228 |
NS_LOG_FUNCTION (this << ssid); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
229 |
m_ssid = ssid; |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
230 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
231 |
|
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
232 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
233 |
NqstaWifiMac::SetMaxMissedBeacons (uint32_t missed) |
1948 | 234 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
235 |
NS_LOG_FUNCTION (this << missed); |
1948 | 236 |
m_maxMissedBeacons = missed; |
237 |
} |
|
238 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
239 |
NqstaWifiMac::SetProbeRequestTimeout (Time timeout) |
1948 | 240 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
241 |
NS_LOG_FUNCTION (this << timeout); |
1948 | 242 |
m_probeRequestTimeout = timeout; |
243 |
} |
|
244 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
245 |
NqstaWifiMac::SetAssocRequestTimeout (Time timeout) |
1948 | 246 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
247 |
NS_LOG_FUNCTION (this << timeout); |
1948 | 248 |
m_assocRequestTimeout = timeout; |
249 |
} |
|
250 |
||
251 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
252 |
NqstaWifiMac::StartActiveAssociation (void) |
1948 | 253 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
254 |
NS_LOG_FUNCTION (this); |
1948 | 255 |
TryToEnsureAssociated (); |
256 |
} |
|
257 |
||
258 |
Mac48Address |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
259 |
NqstaWifiMac::GetBroadcastBssid (void) |
1948 | 260 |
{ |
261 |
return Mac48Address::GetBroadcast (); |
|
262 |
} |
|
263 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
264 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
265 |
NqstaWifiMac::SetBssid (Mac48Address bssid) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
266 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
267 |
NS_LOG_FUNCTION (this << bssid); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
268 |
m_bssid = bssid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
269 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
270 |
void |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
271 |
NqstaWifiMac::SetActiveProbing (bool enable) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
272 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
273 |
NS_LOG_FUNCTION (this << enable); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
274 |
if (enable) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
275 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
276 |
TryToEnsureAssociated (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
277 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
278 |
else |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
279 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
280 |
m_probeRequestEvent.Cancel (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
281 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
282 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
283 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
284 |
NqstaWifiMac::ForwardUp (Ptr<Packet> packet, const Mac48Address &address) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
285 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
286 |
NS_LOG_FUNCTION (this << packet << address); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
287 |
m_forwardUp (packet, address); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
288 |
} |
1948 | 289 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
290 |
NqstaWifiMac::SendProbeRequest (void) |
1948 | 291 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
292 |
NS_LOG_FUNCTION (this); |
1948 | 293 |
WifiMacHeader hdr; |
294 |
hdr.SetProbeReq (); |
|
295 |
hdr.SetAddr1 (GetBroadcastBssid ()); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
296 |
hdr.SetAddr2 (GetAddress ()); |
1948 | 297 |
hdr.SetAddr3 (GetBroadcastBssid ()); |
298 |
hdr.SetDsNotFrom (); |
|
299 |
hdr.SetDsNotTo (); |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
300 |
Ptr<Packet> packet = Create<Packet> (); |
1948 | 301 |
MgtProbeRequestHeader probe; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
302 |
probe.SetSsid (GetSsid ()); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
303 |
probe.SetSupportedRates (GetSupportedRates ()); |
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
304 |
packet->AddHeader (probe); |
1948 | 305 |
|
306 |
m_dca->Queue (packet, hdr); |
|
307 |
||
308 |
m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout, |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
309 |
&NqstaWifiMac::ProbeRequestTimeout, this); |
1948 | 310 |
} |
311 |
||
312 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
313 |
NqstaWifiMac::SendAssociationRequest (void) |
1948 | 314 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
315 |
NS_LOG_FUNCTION (this << GetBssid ()); |
1948 | 316 |
WifiMacHeader hdr; |
317 |
hdr.SetAssocReq (); |
|
318 |
hdr.SetAddr1 (GetBssid ()); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
319 |
hdr.SetAddr2 (GetAddress ()); |
1948 | 320 |
hdr.SetAddr3 (GetBssid ()); |
321 |
hdr.SetDsNotFrom (); |
|
322 |
hdr.SetDsNotTo (); |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
323 |
Ptr<Packet> packet = Create<Packet> (); |
1948 | 324 |
MgtAssocRequestHeader assoc; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
325 |
assoc.SetSsid (GetSsid ()); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
326 |
assoc.SetSupportedRates (GetSupportedRates ()); |
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
327 |
packet->AddHeader (assoc); |
1948 | 328 |
|
329 |
m_dca->Queue (packet, hdr); |
|
330 |
||
331 |
m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout, |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
332 |
&NqstaWifiMac::AssocRequestTimeout, this); |
1948 | 333 |
} |
334 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
335 |
NqstaWifiMac::TryToEnsureAssociated (void) |
1948 | 336 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
337 |
NS_LOG_FUNCTION (this); |
1948 | 338 |
switch (m_state) { |
339 |
case ASSOCIATED: |
|
340 |
return; |
|
341 |
break; |
|
342 |
case WAIT_PROBE_RESP: |
|
343 |
/* we have sent a probe request earlier so we |
|
344 |
do not need to re-send a probe request immediately. |
|
345 |
We just need to wait until probe-request-timeout |
|
346 |
or until we get a probe response |
|
347 |
*/ |
|
348 |
break; |
|
349 |
case BEACON_MISSED: |
|
350 |
/* we were associated but we missed a bunch of beacons |
|
351 |
* so we should assume we are not associated anymore. |
|
352 |
* We try to initiate a probe request now. |
|
353 |
*/ |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
354 |
m_linkDown (); |
1948 | 355 |
m_state = WAIT_PROBE_RESP; |
356 |
SendProbeRequest (); |
|
357 |
break; |
|
358 |
case WAIT_ASSOC_RESP: |
|
359 |
/* we have sent an assoc request so we do not need to |
|
360 |
re-send an assoc request right now. We just need to |
|
361 |
wait until either assoc-request-timeout or until |
|
362 |
we get an assoc response. |
|
363 |
*/ |
|
364 |
break; |
|
365 |
case REFUSED: |
|
366 |
/* we have sent an assoc request and received a negative |
|
367 |
assoc resp. We wait until someone restarts an |
|
368 |
association with a given ssid. |
|
369 |
*/ |
|
370 |
break; |
|
371 |
} |
|
372 |
} |
|
373 |
||
374 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
375 |
NqstaWifiMac::AssocRequestTimeout (void) |
1948 | 376 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
377 |
NS_LOG_FUNCTION (this); |
1948 | 378 |
m_state = WAIT_ASSOC_RESP; |
379 |
SendAssociationRequest (); |
|
380 |
} |
|
381 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
382 |
NqstaWifiMac::ProbeRequestTimeout (void) |
1948 | 383 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
384 |
NS_LOG_FUNCTION (this); |
1948 | 385 |
m_state = WAIT_PROBE_RESP; |
386 |
SendProbeRequest (); |
|
387 |
} |
|
388 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
389 |
NqstaWifiMac::MissedBeacons (void) |
1948 | 390 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
391 |
NS_LOG_FUNCTION (this); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
392 |
if (m_beaconWatchdogEnd > Simulator::Now ()) |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
393 |
{ |
2090
3622fda1717b
calculate the delay, not -delay.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2054
diff
changeset
|
394 |
m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
395 |
&NqstaWifiMac::MissedBeacons, this); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
396 |
return; |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
397 |
} |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
398 |
NS_LOG_DEBUG ("beacon missed"); |
1948 | 399 |
m_state = BEACON_MISSED; |
2156
754a843db672
improve log output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2090
diff
changeset
|
400 |
TryToEnsureAssociated (); |
1948 | 401 |
} |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
402 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
403 |
NqstaWifiMac::RestartBeaconWatchdog (Time delay) |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
404 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
405 |
NS_LOG_FUNCTION (this << delay); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
406 |
m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd); |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
407 |
if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay && |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
408 |
m_beaconWatchdog.IsExpired ()) |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
409 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
410 |
NS_LOG_DEBUG ("really restart watchdog."); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
411 |
m_beaconWatchdog = Simulator::Schedule (delay, &NqstaWifiMac::MissedBeacons, this); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
412 |
} |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
413 |
} |
1948 | 414 |
bool |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
415 |
NqstaWifiMac::IsAssociated (void) |
1948 | 416 |
{ |
417 |
return (m_state == ASSOCIATED)?true:false; |
|
418 |
} |
|
419 |
||
420 |
void |
|
3517
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
421 |
NqstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from) |
1948 | 422 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
423 |
NS_LOG_FUNCTION (this << packet << to); |
1948 | 424 |
if (!IsAssociated ()) |
425 |
{ |
|
426 |
TryToEnsureAssociated (); |
|
427 |
return; |
|
428 |
} |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
429 |
//NS_LOG_DEBUG ("enqueue size="<<packet->GetSize ()<<", to="<<to); |
1948 | 430 |
WifiMacHeader hdr; |
431 |
hdr.SetTypeData (); |
|
432 |
hdr.SetAddr1 (GetBssid ()); |
|
3517
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
433 |
hdr.SetAddr2 (from); |
1948 | 434 |
hdr.SetAddr3 (to); |
435 |
hdr.SetDsNotFrom (); |
|
436 |
hdr.SetDsTo (); |
|
437 |
m_dca->Queue (packet, hdr); |
|
438 |
} |
|
439 |
||
440 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
441 |
NqstaWifiMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr) |
1948 | 442 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
443 |
NS_LOG_FUNCTION (this << packet << hdr); |
1948 | 444 |
NS_ASSERT (!hdr->IsCtl ()); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
445 |
if (hdr->GetAddr1 () != GetAddress () && |
1948 | 446 |
!hdr->GetAddr1 ().IsBroadcast ()) |
447 |
{ |
|
448 |
// packet is not for us |
|
449 |
} |
|
450 |
else if (hdr->IsData ()) |
|
451 |
{ |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
452 |
ForwardUp (packet, hdr->GetAddr2 ()); |
1948 | 453 |
} |
454 |
else if (hdr->IsProbeReq () || |
|
455 |
hdr->IsAssocReq ()) |
|
456 |
{ |
|
457 |
/* this is a frame aimed at an AP. |
|
458 |
* so we can safely ignore it. |
|
459 |
*/ |
|
460 |
} |
|
461 |
else if (hdr->IsBeacon ()) |
|
462 |
{ |
|
463 |
MgtBeaconHeader beacon; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
464 |
packet->RemoveHeader (beacon); |
1948 | 465 |
bool goodBeacon = false; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
466 |
if (GetSsid ().IsBroadcast () || |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
467 |
beacon.GetSsid ().IsEqual (GetSsid ())) |
1948 | 468 |
{ |
469 |
Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons); |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
470 |
RestartBeaconWatchdog (delay); |
1948 | 471 |
goodBeacon = true; |
472 |
} |
|
473 |
if (goodBeacon) |
|
474 |
{ |
|
475 |
SetBssid (hdr->GetAddr3 ()); |
|
476 |
} |
|
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
477 |
if (goodBeacon && m_state == BEACON_MISSED) |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
478 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
479 |
m_state = WAIT_ASSOC_RESP; |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
480 |
SendAssociationRequest (); |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
481 |
} |
1948 | 482 |
} |
483 |
else if (hdr->IsProbeResp ()) |
|
484 |
{ |
|
485 |
if (m_state == WAIT_PROBE_RESP) |
|
486 |
{ |
|
487 |
MgtProbeResponseHeader probeResp; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
488 |
packet->RemoveHeader (probeResp); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
489 |
if (!probeResp.GetSsid ().IsEqual (GetSsid ())) |
1948 | 490 |
{ |
491 |
//not a probe resp for our ssid. |
|
492 |
return; |
|
493 |
} |
|
494 |
SetBssid (hdr->GetAddr3 ()); |
|
495 |
Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons); |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
496 |
RestartBeaconWatchdog (delay); |
1948 | 497 |
if (m_probeRequestEvent.IsRunning ()) |
498 |
{ |
|
499 |
m_probeRequestEvent.Cancel (); |
|
500 |
} |
|
501 |
m_state = WAIT_ASSOC_RESP; |
|
502 |
SendAssociationRequest (); |
|
503 |
} |
|
504 |
} |
|
505 |
else if (hdr->IsAssocResp ()) |
|
506 |
{ |
|
507 |
if (m_state == WAIT_ASSOC_RESP) |
|
508 |
{ |
|
509 |
MgtAssocResponseHeader assocResp; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
510 |
packet->RemoveHeader (assocResp); |
1948 | 511 |
if (m_assocRequestEvent.IsRunning ()) |
512 |
{ |
|
513 |
m_assocRequestEvent.Cancel (); |
|
514 |
} |
|
515 |
if (assocResp.GetStatusCode ().IsSuccess ()) |
|
516 |
{ |
|
517 |
m_state = ASSOCIATED; |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
518 |
NS_LOG_DEBUG ("assoc completed"); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
519 |
SupportedRates rates = assocResp.GetSupportedRates (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
520 |
WifiRemoteStation *ap = m_stationManager->Lookup (hdr->GetAddr2 ()); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
521 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
522 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
523 |
WifiMode mode = m_phy->GetMode (i); |
2164
6e347fdbfa4a
avoid confusion between code and uncoded rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2159
diff
changeset
|
524 |
if (rates.IsSupportedRate (mode.GetDataRate ())) |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
525 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
526 |
ap->AddSupportedMode (mode); |
2164
6e347fdbfa4a
avoid confusion between code and uncoded rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2159
diff
changeset
|
527 |
if (rates.IsBasicRate (mode.GetDataRate ())) |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
528 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
529 |
m_stationManager->AddBasicMode (mode); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
530 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
531 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
532 |
} |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
533 |
if (!m_linkUp.IsNull ()) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
534 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
535 |
m_linkUp (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
536 |
} |
1948 | 537 |
} |
538 |
else |
|
539 |
{ |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
540 |
NS_LOG_DEBUG ("assoc refused"); |
1948 | 541 |
m_state = REFUSED; |
542 |
} |
|
543 |
} |
|
544 |
} |
|
545 |
} |
|
546 |
||
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
547 |
SupportedRates |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
548 |
NqstaWifiMac::GetSupportedRates (void) const |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
549 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
550 |
SupportedRates rates; |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
551 |
for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
552 |
{ |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
553 |
WifiMode mode = m_phy->GetMode (i); |
2164
6e347fdbfa4a
avoid confusion between code and uncoded rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2159
diff
changeset
|
554 |
rates.AddSupportedRate (mode.GetDataRate ()); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
555 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
556 |
return rates; |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
557 |
} |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
558 |
|
1948 | 559 |
} // namespace ns3 |