author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 25 Feb 2010 14:17:21 +0100 | |
changeset 6068 | a2127017ecb4 |
parent 6065 | 0f012e7d9128 |
parent 5906 | 509b5089a081 |
child 6080 | 41ee42654550 |
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" |
6065 | 27 |
#include "ns3/boolean.h" |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
28 |
#include "ns3/trace-source-accessor.h" |
1948 | 29 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
30 |
#include "nqsta-wifi-mac.h" |
1948 | 31 |
#include "wifi-mac-header.h" |
32 |
#include "mgt-headers.h" |
|
33 |
#include "wifi-phy.h" |
|
34 |
#include "dca-txop.h" |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
35 |
#include "mac-low.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
36 |
#include "dcf-manager.h" |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
37 |
#include "mac-rx-middle.h" |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
38 |
#include "wifi-mac-trailer.h" |
4209
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
39 |
#include "ns3/trace-source-accessor.h" |
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
40 |
#include "ns3/pointer.h" |
1948 | 41 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
42 |
NS_LOG_COMPONENT_DEFINE ("NqstaWifiMac"); |
1948 | 43 |
|
4003
49a08376f196
bug 405: add more context to wifi logging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3921
diff
changeset
|
44 |
#undef NS_LOG_APPEND_CONTEXT |
49a08376f196
bug 405: add more context to wifi logging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3921
diff
changeset
|
45 |
#define NS_LOG_APPEND_CONTEXT if (m_low != 0) {std::clog << "[mac=" << m_low->GetAddress () << "] ";} |
49a08376f196
bug 405: add more context to wifi logging
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3921
diff
changeset
|
46 |
|
1948 | 47 |
/* |
48 |
* 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
|
49 |
-------------- ----------- |
1948 | 50 |
| 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
|
51 |
-------------- \ / ----------- |
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 |
\-> | 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
|
55 |
----------------- ----------------------------- |
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
|
56 |
\ ^ |
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
|
57 |
\ | |
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
|
58 |
\ ----------------------- |
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
|
59 |
\-> | 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
|
60 |
----------------------- |
1948 | 61 |
*/ |
62 |
||
63 |
namespace ns3 { |
|
64 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
65 |
NS_OBJECT_ENSURE_REGISTERED (NqstaWifiMac); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
66 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
67 |
TypeId |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
68 |
NqstaWifiMac::GetTypeId (void) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
69 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2528
diff
changeset
|
70 |
static TypeId tid = TypeId ("ns3::NqstaWifiMac") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
71 |
.SetParent<WifiMac> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
72 |
.AddConstructor<NqstaWifiMac> () |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
73 |
.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
|
74 |
TimeValue (Seconds (0.05)), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
75 |
MakeTimeAccessor (&NqstaWifiMac::m_probeRequestTimeout), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
76 |
MakeTimeChecker ()) |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
77 |
.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
|
78 |
TimeValue (Seconds (0.5)), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
79 |
MakeTimeAccessor (&NqstaWifiMac::m_assocRequestTimeout), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
80 |
MakeTimeChecker ()) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
81 |
.AddAttribute ("MaxMissedBeacons", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
82 |
"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
|
83 |
"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
|
84 |
UintegerValue (10), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
85 |
MakeUintegerAccessor (&NqstaWifiMac::m_maxMissedBeacons), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
86 |
MakeUintegerChecker<uint32_t> ()) |
3212
0c00342d6a73
improve attribute documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3210
diff
changeset
|
87 |
.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
|
88 |
BooleanValue (false), |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
89 |
MakeBooleanAccessor (&NqstaWifiMac::SetActiveProbing), |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
90 |
MakeBooleanChecker ()) |
4209
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
91 |
.AddAttribute ("DcaTxop", "The DcaTxop object", |
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
92 |
PointerValue (), |
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
93 |
MakePointerAccessor (&NqstaWifiMac::GetDcaTxop), |
4209
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
94 |
MakePointerChecker<DcaTxop> ()) |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
95 |
.AddTraceSource ("Assoc", "Associated with an access point.", |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
96 |
MakeTraceSourceAccessor (&NqstaWifiMac::m_assocLogger)) |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
97 |
.AddTraceSource ("DeAssoc", "Association with an access point lost.", |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
98 |
MakeTraceSourceAccessor (&NqstaWifiMac::m_deAssocLogger)) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
99 |
; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
100 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
101 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
102 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
103 |
NqstaWifiMac::NqstaWifiMac () |
1948 | 104 |
: m_state (BEACON_MISSED), |
105 |
m_probeRequestEvent (), |
|
106 |
m_assocRequestEvent (), |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
107 |
m_beaconWatchdogEnd (Seconds (0.0)) |
1948 | 108 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
109 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
110 |
m_rxMiddle = new MacRxMiddle (); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
111 |
m_rxMiddle->SetForwardCallback (MakeCallback (&NqstaWifiMac::Receive, this)); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
112 |
|
2617
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
113 |
m_low = CreateObject<MacLow> (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
114 |
m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
115 |
|
2617
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
116 |
m_dcfManager = new DcfManager (); |
0ecb3a9422e4
avoid double-frees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
117 |
m_dcfManager->SetupLowListener (m_low); |
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
118 |
|
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
119 |
m_dca = CreateObject<DcaTxop> (); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
120 |
m_dca->SetLow (m_low); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
121 |
m_dca->SetManager (m_dcfManager); |
1948 | 122 |
} |
123 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
124 |
NqstaWifiMac::~NqstaWifiMac () |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
125 |
{ |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
126 |
NS_LOG_FUNCTION (this); |
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
127 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
128 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
129 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
130 |
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
|
131 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
132 |
NS_LOG_FUNCTION (this); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
133 |
delete m_rxMiddle; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
134 |
delete m_dcfManager; |
4687
02bf728f7e39
bug 381: Wifi crashes on shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4609
diff
changeset
|
135 |
m_low->Dispose (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
136 |
m_rxMiddle = 0; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
137 |
m_low = 0; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
138 |
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
|
139 |
m_phy = 0; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
140 |
m_dca = 0; |
4406 | 141 |
m_stationManager = 0; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
142 |
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
|
143 |
} |
1948 | 144 |
|
145 |
void |
|
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
146 |
NqstaWifiMac::SetSlot (Time slotTime) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
147 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
148 |
NS_LOG_FUNCTION (this << slotTime); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
149 |
m_dcfManager->SetSlot (slotTime); |
3599
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
150 |
m_low->SetSlotTime (slotTime); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
151 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
152 |
void |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
153 |
NqstaWifiMac::SetSifs (Time sifs) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
154 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
155 |
NS_LOG_FUNCTION (this << sifs); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
156 |
m_dcfManager->SetSifs (sifs); |
3598
7b209b3b6af2
move sifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3597
diff
changeset
|
157 |
m_low->SetSifs (sifs); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
158 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
159 |
void |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
160 |
NqstaWifiMac::SetEifsNoDifs (Time eifsNoDifs) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
161 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
162 |
NS_LOG_FUNCTION (this << eifsNoDifs); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
163 |
m_dcfManager->SetEifsNoDifs (eifsNoDifs); |
2686 | 164 |
} |
3596
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
165 |
void |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
166 |
NqstaWifiMac::SetAckTimeout (Time ackTimeout) |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
167 |
{ |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
168 |
m_low->SetAckTimeout (ackTimeout); |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
169 |
} |
3597
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
170 |
void |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
171 |
NqstaWifiMac::SetCtsTimeout (Time ctsTimeout) |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
172 |
{ |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
173 |
m_low->SetCtsTimeout (ctsTimeout); |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
174 |
} |
3599
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
175 |
void |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
176 |
NqstaWifiMac::SetPifs (Time pifs) |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
177 |
{ |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
178 |
m_low->SetPifs (pifs); |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
179 |
} |
2686 | 180 |
Time |
181 |
NqstaWifiMac::GetSlot (void) const |
|
182 |
{ |
|
3599
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
183 |
return m_low->GetSlotTime (); |
2686 | 184 |
} |
185 |
Time |
|
186 |
NqstaWifiMac::GetSifs (void) const |
|
187 |
{ |
|
3598
7b209b3b6af2
move sifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3597
diff
changeset
|
188 |
return m_low->GetSifs (); |
2686 | 189 |
} |
190 |
Time |
|
191 |
NqstaWifiMac::GetEifsNoDifs (void) const |
|
192 |
{ |
|
4461
ab9b58d664d7
move GetEifsNoDifs to DcfManager
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4406
diff
changeset
|
193 |
return m_dcfManager->GetEifsNoDifs (); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
194 |
} |
3596
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
195 |
Time |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
196 |
NqstaWifiMac::GetAckTimeout (void) const |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
197 |
{ |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
198 |
return m_low->GetAckTimeout (); |
6c39b712a535
move Address and ack timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3517
diff
changeset
|
199 |
} |
3597
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
200 |
Time |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
201 |
NqstaWifiMac::GetCtsTimeout (void) const |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
202 |
{ |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
203 |
return m_low->GetCtsTimeout (); |
fe35e5be4b78
move cts timeout down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3596
diff
changeset
|
204 |
} |
3599
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
205 |
Time |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
206 |
NqstaWifiMac::GetPifs (void) const |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
207 |
{ |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
208 |
return m_low->GetPifs (); |
721bd46c15f8
move slot and pifs down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3598
diff
changeset
|
209 |
} |
4209
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
210 |
Ptr<DcaTxop> |
4406 | 211 |
NqstaWifiMac::GetDcaTxop(void) const |
4209
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
212 |
{ |
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
213 |
return m_dca; |
42c89b271a69
bug 500: make DcaTxop accessible through an attribute.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4079
diff
changeset
|
214 |
} |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
215 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
216 |
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
|
217 |
{ |
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
|
218 |
m_phy = phy; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
219 |
m_dcfManager->SetupPhyListener (phy); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
220 |
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
|
221 |
} |
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
|
222 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
223 |
NqstaWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) |
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 |
m_stationManager = stationManager; |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
226 |
m_dca->SetWifiRemoteStationManager (stationManager); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
227 |
m_low->SetWifiRemoteStationManager (stationManager); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
228 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
229 |
void |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
230 |
NqstaWifiMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
231 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
232 |
m_forwardUp = upCallback; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
233 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
234 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
235 |
NqstaWifiMac::SetLinkUpCallback (Callback<void> linkUp) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
236 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
237 |
m_linkUp = linkUp; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
238 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
239 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
240 |
NqstaWifiMac::SetLinkDownCallback (Callback<void> linkDown) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
241 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
242 |
m_linkDown = linkDown; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
243 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
244 |
Mac48Address |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
245 |
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
|
246 |
{ |
3606
eb9b8020bd68
make sure to propagation the address down to the MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3604
diff
changeset
|
247 |
return m_low->GetAddress (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
248 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
249 |
Ssid |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
250 |
NqstaWifiMac::GetSsid (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
251 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
252 |
return m_ssid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
253 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
254 |
Mac48Address |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
255 |
NqstaWifiMac::GetBssid (void) const |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
256 |
{ |
3600
5888dfe3f245
move GetBssid down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3599
diff
changeset
|
257 |
return m_low->GetBssid (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
258 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
259 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
260 |
NqstaWifiMac::SetAddress (Mac48Address address) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
261 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
262 |
NS_LOG_FUNCTION (this << address); |
3606
eb9b8020bd68
make sure to propagation the address down to the MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3604
diff
changeset
|
263 |
m_low->SetAddress (address); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
264 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
265 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
266 |
NqstaWifiMac::SetSsid (Ssid ssid) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
267 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
268 |
NS_LOG_FUNCTION (this << ssid); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
269 |
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
|
270 |
} |
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
|
271 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
272 |
NqstaWifiMac::SetMaxMissedBeacons (uint32_t missed) |
1948 | 273 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
274 |
NS_LOG_FUNCTION (this << missed); |
1948 | 275 |
m_maxMissedBeacons = missed; |
276 |
} |
|
277 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
278 |
NqstaWifiMac::SetProbeRequestTimeout (Time timeout) |
1948 | 279 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
280 |
NS_LOG_FUNCTION (this << timeout); |
1948 | 281 |
m_probeRequestTimeout = timeout; |
282 |
} |
|
283 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
284 |
NqstaWifiMac::SetAssocRequestTimeout (Time timeout) |
1948 | 285 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
286 |
NS_LOG_FUNCTION (this << timeout); |
1948 | 287 |
m_assocRequestTimeout = timeout; |
288 |
} |
|
289 |
||
290 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
291 |
NqstaWifiMac::StartActiveAssociation (void) |
1948 | 292 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
293 |
NS_LOG_FUNCTION (this); |
1948 | 294 |
TryToEnsureAssociated (); |
295 |
} |
|
296 |
||
297 |
Mac48Address |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
298 |
NqstaWifiMac::GetBroadcastBssid (void) |
1948 | 299 |
{ |
300 |
return Mac48Address::GetBroadcast (); |
|
301 |
} |
|
302 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
303 |
void |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
304 |
NqstaWifiMac::SetBssid (Mac48Address bssid) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
305 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
306 |
NS_LOG_FUNCTION (this << bssid); |
3600
5888dfe3f245
move GetBssid down to MacLow
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3599
diff
changeset
|
307 |
m_low->SetBssid (bssid); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
308 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
309 |
void |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
310 |
NqstaWifiMac::SetActiveProbing (bool enable) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
311 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
312 |
NS_LOG_FUNCTION (this << enable); |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
313 |
if (enable) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
314 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
315 |
TryToEnsureAssociated (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
316 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
317 |
else |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
318 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
319 |
m_probeRequestEvent.Cancel (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
320 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
321 |
} |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
322 |
void |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
323 |
NqstaWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
324 |
{ |
3604
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
325 |
NS_LOG_FUNCTION (this << packet << from << to); |
a84d99890289
implement promisc mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3603
diff
changeset
|
326 |
m_forwardUp (packet, from, to); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
327 |
} |
1948 | 328 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
329 |
NqstaWifiMac::SendProbeRequest (void) |
1948 | 330 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
331 |
NS_LOG_FUNCTION (this); |
1948 | 332 |
WifiMacHeader hdr; |
333 |
hdr.SetProbeReq (); |
|
334 |
hdr.SetAddr1 (GetBroadcastBssid ()); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
335 |
hdr.SetAddr2 (GetAddress ()); |
1948 | 336 |
hdr.SetAddr3 (GetBroadcastBssid ()); |
337 |
hdr.SetDsNotFrom (); |
|
338 |
hdr.SetDsNotTo (); |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
339 |
Ptr<Packet> packet = Create<Packet> (); |
1948 | 340 |
MgtProbeRequestHeader probe; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
341 |
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
|
342 |
probe.SetSupportedRates (GetSupportedRates ()); |
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
343 |
packet->AddHeader (probe); |
1948 | 344 |
|
345 |
m_dca->Queue (packet, hdr); |
|
346 |
||
347 |
m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout, |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
348 |
&NqstaWifiMac::ProbeRequestTimeout, this); |
1948 | 349 |
} |
350 |
||
351 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
352 |
NqstaWifiMac::SendAssociationRequest (void) |
1948 | 353 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
354 |
NS_LOG_FUNCTION (this << GetBssid ()); |
1948 | 355 |
WifiMacHeader hdr; |
356 |
hdr.SetAssocReq (); |
|
357 |
hdr.SetAddr1 (GetBssid ()); |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
358 |
hdr.SetAddr2 (GetAddress ()); |
1948 | 359 |
hdr.SetAddr3 (GetBssid ()); |
360 |
hdr.SetDsNotFrom (); |
|
361 |
hdr.SetDsNotTo (); |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
362 |
Ptr<Packet> packet = Create<Packet> (); |
1948 | 363 |
MgtAssocRequestHeader assoc; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
364 |
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
|
365 |
assoc.SetSupportedRates (GetSupportedRates ()); |
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
366 |
packet->AddHeader (assoc); |
1948 | 367 |
|
368 |
m_dca->Queue (packet, hdr); |
|
369 |
||
370 |
m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout, |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
371 |
&NqstaWifiMac::AssocRequestTimeout, this); |
1948 | 372 |
} |
373 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
374 |
NqstaWifiMac::TryToEnsureAssociated (void) |
1948 | 375 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
376 |
NS_LOG_FUNCTION (this); |
1948 | 377 |
switch (m_state) { |
378 |
case ASSOCIATED: |
|
379 |
return; |
|
380 |
break; |
|
381 |
case WAIT_PROBE_RESP: |
|
382 |
/* we have sent a probe request earlier so we |
|
383 |
do not need to re-send a probe request immediately. |
|
384 |
We just need to wait until probe-request-timeout |
|
385 |
or until we get a probe response |
|
386 |
*/ |
|
387 |
break; |
|
388 |
case BEACON_MISSED: |
|
389 |
/* we were associated but we missed a bunch of beacons |
|
390 |
* so we should assume we are not associated anymore. |
|
391 |
* We try to initiate a probe request now. |
|
392 |
*/ |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
393 |
m_linkDown (); |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
394 |
SetState (WAIT_PROBE_RESP); |
1948 | 395 |
SendProbeRequest (); |
396 |
break; |
|
397 |
case WAIT_ASSOC_RESP: |
|
398 |
/* we have sent an assoc request so we do not need to |
|
399 |
re-send an assoc request right now. We just need to |
|
400 |
wait until either assoc-request-timeout or until |
|
401 |
we get an assoc response. |
|
402 |
*/ |
|
403 |
break; |
|
404 |
case REFUSED: |
|
405 |
/* we have sent an assoc request and received a negative |
|
406 |
assoc resp. We wait until someone restarts an |
|
407 |
association with a given ssid. |
|
408 |
*/ |
|
409 |
break; |
|
410 |
} |
|
411 |
} |
|
412 |
||
413 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
414 |
NqstaWifiMac::AssocRequestTimeout (void) |
1948 | 415 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
416 |
NS_LOG_FUNCTION (this); |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
417 |
SetState (WAIT_ASSOC_RESP); |
1948 | 418 |
SendAssociationRequest (); |
419 |
} |
|
420 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
421 |
NqstaWifiMac::ProbeRequestTimeout (void) |
1948 | 422 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
423 |
NS_LOG_FUNCTION (this); |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
424 |
SetState (WAIT_PROBE_RESP); |
1948 | 425 |
SendProbeRequest (); |
426 |
} |
|
427 |
void |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
428 |
NqstaWifiMac::MissedBeacons (void) |
1948 | 429 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
430 |
NS_LOG_FUNCTION (this); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
431 |
if (m_beaconWatchdogEnd > Simulator::Now ()) |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
432 |
{ |
2090
3622fda1717b
calculate the delay, not -delay.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2054
diff
changeset
|
433 |
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
|
434 |
&NqstaWifiMac::MissedBeacons, this); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
435 |
return; |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
436 |
} |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
437 |
NS_LOG_DEBUG ("beacon missed"); |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
438 |
SetState (BEACON_MISSED); |
2156
754a843db672
improve log output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2090
diff
changeset
|
439 |
TryToEnsureAssociated (); |
1948 | 440 |
} |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
441 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
442 |
NqstaWifiMac::RestartBeaconWatchdog (Time delay) |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
443 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
444 |
NS_LOG_FUNCTION (this << delay); |
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
445 |
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
|
446 |
if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay && |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
447 |
m_beaconWatchdog.IsExpired ()) |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
448 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
449 |
NS_LOG_DEBUG ("really restart watchdog."); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
450 |
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
|
451 |
} |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1951
diff
changeset
|
452 |
} |
1948 | 453 |
bool |
4609
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
454 |
NqstaWifiMac::IsAssociated (void) const |
1948 | 455 |
{ |
4609
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
456 |
return m_state == ASSOCIATED; |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
457 |
} |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
458 |
|
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
459 |
bool |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
460 |
NqstaWifiMac::IsWaitAssocResp (void) const |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
461 |
{ |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
462 |
return m_state == WAIT_ASSOC_RESP; |
1948 | 463 |
} |
464 |
||
465 |
void |
|
3517
5ba130a7f519
implement WifiNetDevice::SendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3212
diff
changeset
|
466 |
NqstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from) |
1948 | 467 |
{ |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
468 |
NS_FATAL_ERROR ("Qsta does not support SendTo"); |
3602
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
469 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
470 |
|
3602
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
471 |
void |
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
472 |
NqstaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to) |
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
473 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
474 |
NS_LOG_FUNCTION (this << packet << to); |
1948 | 475 |
if (!IsAssociated ()) |
476 |
{ |
|
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
477 |
NotifyTxDrop (packet); |
1948 | 478 |
TryToEnsureAssociated (); |
479 |
return; |
|
480 |
} |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
481 |
//NS_LOG_DEBUG ("enqueue size="<<packet->GetSize ()<<", to="<<to); |
1948 | 482 |
WifiMacHeader hdr; |
483 |
hdr.SetTypeData (); |
|
484 |
hdr.SetAddr1 (GetBssid ()); |
|
3602
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
485 |
hdr.SetAddr2 (m_low->GetAddress ()); |
1948 | 486 |
hdr.SetAddr3 (to); |
487 |
hdr.SetDsNotFrom (); |
|
488 |
hdr.SetDsTo (); |
|
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
489 |
|
1948 | 490 |
m_dca->Queue (packet, hdr); |
491 |
} |
|
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
492 |
|
3603
da21b3e410b6
implement SupportsSendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3602
diff
changeset
|
493 |
bool |
da21b3e410b6
implement SupportsSendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3602
diff
changeset
|
494 |
NqstaWifiMac::SupportsSendFrom (void) const |
da21b3e410b6
implement SupportsSendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3602
diff
changeset
|
495 |
{ |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
496 |
// |
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
497 |
// The 802.11 MAC protocol has no way to support bridging outside of |
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
498 |
// infrastructure mode |
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
499 |
// |
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
500 |
return false; |
3603
da21b3e410b6
implement SupportsSendFrom
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3602
diff
changeset
|
501 |
} |
3602
e8e41feee205
implement SendFrom correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3600
diff
changeset
|
502 |
|
1948 | 503 |
|
504 |
void |
|
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
4720
diff
changeset
|
505 |
NqstaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr) |
1948 | 506 |
{ |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
507 |
NS_LOG_FUNCTION (this << packet << hdr); |
1948 | 508 |
NS_ASSERT (!hdr->IsCtl ()); |
4079
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
509 |
if (hdr->GetAddr3 () == GetAddress ()) |
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
510 |
{ |
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
511 |
NS_LOG_LOGIC ("packet sent by us."); |
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
512 |
} |
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
513 |
else if (hdr->GetAddr1 () != GetAddress () && |
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
514 |
!hdr->GetAddr1 ().IsGroup ()) |
1948 | 515 |
{ |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
516 |
NS_LOG_LOGIC ("packet is not for us"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
517 |
NotifyRxDrop (packet); |
1948 | 518 |
} |
519 |
else if (hdr->IsData ()) |
|
520 |
{ |
|
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
521 |
if (!IsAssociated ()) |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
522 |
{ |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
523 |
NS_LOG_LOGIC ("Received data frame while not associated: ignore"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
524 |
NotifyRxDrop (packet); |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
525 |
return; |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
526 |
} |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
527 |
if (!(hdr->IsFromDs () && !hdr->IsToDs ())) |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
528 |
{ |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
529 |
NS_LOG_LOGIC ("Received data frame not from the DS: ignore"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
530 |
NotifyRxDrop (packet); |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
531 |
return; |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
532 |
} |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
533 |
if (hdr->GetAddr2 () != GetBssid ()) |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
534 |
{ |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
535 |
NS_LOG_LOGIC ("Received data frame not from the the BSS we are associated with: ignore"); |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
536 |
NotifyRxDrop (packet); |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
537 |
return; |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
538 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4212
diff
changeset
|
539 |
|
4079
210d64d11998
add wifi multicast support. Based on patch by Mauchle Fabian.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4003
diff
changeset
|
540 |
ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ()); |
1948 | 541 |
} |
542 |
else if (hdr->IsProbeReq () || |
|
543 |
hdr->IsAssocReq ()) |
|
544 |
{ |
|
545 |
/* this is a frame aimed at an AP. |
|
546 |
* so we can safely ignore it. |
|
547 |
*/ |
|
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
548 |
NotifyRxDrop (packet); |
1948 | 549 |
} |
550 |
else if (hdr->IsBeacon ()) |
|
551 |
{ |
|
552 |
MgtBeaconHeader beacon; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
553 |
packet->RemoveHeader (beacon); |
1948 | 554 |
bool goodBeacon = false; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
555 |
if (GetSsid ().IsBroadcast () || |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
556 |
beacon.GetSsid ().IsEqual (GetSsid ())) |
1948 | 557 |
{ |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
558 |
goodBeacon = true; |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
559 |
} |
4609
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
560 |
if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ()) |
3921
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
561 |
{ |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
562 |
goodBeacon = false; |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
563 |
} |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
564 |
if (goodBeacon) |
ee1f01c019f4
[Bug 398] NqstaWifiMac does not filter received frames by BSSID
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3751
diff
changeset
|
565 |
{ |
1948 | 566 |
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
|
567 |
RestartBeaconWatchdog (delay); |
1948 | 568 |
SetBssid (hdr->GetAddr3 ()); |
569 |
} |
|
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
|
570 |
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
|
571 |
{ |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
572 |
SetState (WAIT_ASSOC_RESP); |
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
|
573 |
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
|
574 |
} |
4406 | 575 |
} |
1948 | 576 |
else if (hdr->IsProbeResp ()) |
577 |
{ |
|
578 |
if (m_state == WAIT_PROBE_RESP) |
|
579 |
{ |
|
580 |
MgtProbeResponseHeader probeResp; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
581 |
packet->RemoveHeader (probeResp); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
582 |
if (!probeResp.GetSsid ().IsEqual (GetSsid ())) |
1948 | 583 |
{ |
584 |
//not a probe resp for our ssid. |
|
585 |
return; |
|
586 |
} |
|
587 |
SetBssid (hdr->GetAddr3 ()); |
|
588 |
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
|
589 |
RestartBeaconWatchdog (delay); |
1948 | 590 |
if (m_probeRequestEvent.IsRunning ()) |
591 |
{ |
|
592 |
m_probeRequestEvent.Cancel (); |
|
593 |
} |
|
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
594 |
SetState (WAIT_ASSOC_RESP); |
1948 | 595 |
SendAssociationRequest (); |
596 |
} |
|
597 |
} |
|
598 |
else if (hdr->IsAssocResp ()) |
|
599 |
{ |
|
600 |
if (m_state == WAIT_ASSOC_RESP) |
|
601 |
{ |
|
602 |
MgtAssocResponseHeader assocResp; |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2156
diff
changeset
|
603 |
packet->RemoveHeader (assocResp); |
1948 | 604 |
if (m_assocRequestEvent.IsRunning ()) |
605 |
{ |
|
606 |
m_assocRequestEvent.Cancel (); |
|
607 |
} |
|
608 |
if (assocResp.GetStatusCode ().IsSuccess ()) |
|
609 |
{ |
|
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
610 |
SetState (ASSOCIATED); |
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
611 |
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
|
612 |
SupportedRates rates = assocResp.GetSupportedRates (); |
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
|
613 |
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
|
614 |
{ |
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
|
615 |
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
|
616 |
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
|
617 |
{ |
6065 | 618 |
m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode); |
2164
6e347fdbfa4a
avoid confusion between code and uncoded rates.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2159
diff
changeset
|
619 |
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
|
620 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
621 |
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
|
622 |
} |
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
|
623 |
} |
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
|
624 |
} |
2528
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
625 |
if (!m_linkUp.IsNull ()) |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
626 |
{ |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
627 |
m_linkUp (); |
a527ec47b756
avoid crashing AP wifi sample
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
628 |
} |
1948 | 629 |
} |
630 |
else |
|
631 |
{ |
|
2985
fa0747c4ad5e
use function logging macros
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2686
diff
changeset
|
632 |
NS_LOG_DEBUG ("assoc refused"); |
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
633 |
SetState (REFUSED); |
1948 | 634 |
} |
635 |
} |
|
636 |
} |
|
637 |
} |
|
638 |
||
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
|
639 |
SupportedRates |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2350
diff
changeset
|
640 |
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
|
641 |
{ |
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
|
642 |
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
|
643 |
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
|
644 |
{ |
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
|
645 |
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
|
646 |
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
|
647 |
} |
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
|
648 |
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
|
649 |
} |
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
|
650 |
|
4212
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
651 |
void |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
652 |
NqstaWifiMac::SetState (MacState value) |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
653 |
{ |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
654 |
if (value == ASSOCIATED && |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
655 |
m_state != ASSOCIATED) |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
656 |
{ |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
657 |
m_assocLogger (GetBssid ()); |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
658 |
} |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
659 |
else if (value != ASSOCIATED && |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
660 |
m_state == ASSOCIATED) |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
661 |
{ |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
662 |
m_deAssocLogger (GetBssid ()); |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
663 |
} |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
664 |
m_state = value; |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
665 |
} |
a21c19c4cd81
bug 487: add association/disassociation hooks in Nqsta.
Francesco Malandrino <francesco.malandrino@gmail.com>
parents:
4209
diff
changeset
|
666 |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
667 |
void |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
668 |
NqstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
669 |
{ |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
670 |
switch (standard) |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
671 |
{ |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
672 |
case WIFI_PHY_STANDARD_holland: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
673 |
// fall through |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
674 |
case WIFI_PHY_STANDARD_80211_10Mhz: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
675 |
// fall through |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
676 |
case WIFI_PHY_STANDARD_80211_5Mhz: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
677 |
// fall through |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
678 |
case WIFI_PHY_STANDARD_80211a: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
679 |
ConfigureDcf (m_dca, 15, 1023, AC_BE_NQOS); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
680 |
break; |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
681 |
case WIFI_PHY_STANDARD_80211b: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
682 |
ConfigureDcf (m_dca, 31, 1023, AC_BE_NQOS); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
683 |
break; |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
684 |
default: |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
685 |
NS_ASSERT (false); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
686 |
break; |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
687 |
} |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4687
diff
changeset
|
688 |
} |
5906
509b5089a081
Revert bug 706 fix because it breaks the regression testing
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
5903
diff
changeset
|
689 |
|
1948 | 690 |
} // namespace ns3 |