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