A Discrete-Event Network Simulator
API
sta-wifi-mac.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #include "sta-wifi-mac.h"
23 
24 #include "ns3/log.h"
25 #include "ns3/simulator.h"
26 #include "ns3/string.h"
27 #include "ns3/pointer.h"
28 #include "ns3/boolean.h"
29 #include "ns3/trace-source-accessor.h"
30 
31 #include "qos-tag.h"
32 #include "mac-low.h"
33 #include "dcf-manager.h"
34 #include "mac-rx-middle.h"
35 #include "mac-tx-middle.h"
36 #include "wifi-mac-header.h"
37 #include "msdu-aggregator.h"
38 #include "amsdu-subframe-header.h"
39 #include "mgt-headers.h"
40 #include "ht-capabilities.h"
41 
42 /*
43  * The state machine for this STA is:
44  -------------- -----------
45  | Associated | <-------------------- -------> | Refused |
46  -------------- \ / -----------
47  \ \ /
48  \ ----------------- -----------------------------
49  \-> | Beacon Missed | --> | Wait Association Response |
50  ----------------- -----------------------------
51  \ ^
52  \ |
53  \ -----------------------
54  \-> | Wait Probe Response |
55  -----------------------
56  */
57 
58 namespace ns3 {
59 
60 NS_LOG_COMPONENT_DEFINE ("StaWifiMac");
61 
62 NS_OBJECT_ENSURE_REGISTERED (StaWifiMac);
63 
64 TypeId
66 {
67  static TypeId tid = TypeId ("ns3::StaWifiMac")
69  .AddConstructor<StaWifiMac> ()
70  .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
71  TimeValue (Seconds (0.05)),
73  MakeTimeChecker ())
74  .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.",
75  TimeValue (Seconds (0.5)),
77  MakeTimeChecker ())
78  .AddAttribute ("MaxMissedBeacons",
79  "Number of beacons which much be consecutively missed before "
80  "we attempt to restart association.",
81  UintegerValue (10),
83  MakeUintegerChecker<uint32_t> ())
84  .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't. NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.",
85  BooleanValue (false),
88  .AddTraceSource ("Assoc", "Associated with an access point.",
90  "ns3::Mac48Address::TracedCallback")
91  .AddTraceSource ("DeAssoc", "Association with an access point lost.",
93  "ns3::Mac48Address::TracedCallback")
94  ;
95  return tid;
96 }
97 
99  : m_state (BEACON_MISSED),
100  m_probeRequestEvent (),
101  m_assocRequestEvent (),
102  m_beaconWatchdogEnd (Seconds (0.0))
103 {
104  NS_LOG_FUNCTION (this);
105 
106  // Let the lower layers know that we are acting as a non-AP STA in
107  // an infrastructure BSS.
109 }
110 
112 {
113  NS_LOG_FUNCTION (this);
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION (this << missed);
120  m_maxMissedBeacons = missed;
121 }
122 
123 void
125 {
126  NS_LOG_FUNCTION (this << timeout);
128 }
129 
130 void
132 {
133  NS_LOG_FUNCTION (this << timeout);
135 }
136 
137 void
139 {
140  NS_LOG_FUNCTION (this);
142 }
143 
144 void
146 {
147  NS_LOG_FUNCTION (this << enable);
148  if (enable)
149  {
151  }
152  else
153  {
155  }
156  m_activeProbing = enable;
157 }
158 
160 {
161  return m_activeProbing;
162 }
163 
164 void
166 {
167  NS_LOG_FUNCTION (this);
168  WifiMacHeader hdr;
169  hdr.SetProbeReq ();
171  hdr.SetAddr2 (GetAddress ());
173  hdr.SetDsNotFrom ();
174  hdr.SetDsNotTo ();
175  Ptr<Packet> packet = Create<Packet> ();
176  MgtProbeRequestHeader probe;
177  probe.SetSsid (GetSsid ());
178  probe.SetSupportedRates (GetSupportedRates ());
179  if (m_htSupported)
180  {
181  probe.SetHtCapabilities (GetHtCapabilities());
182  hdr.SetNoOrder();
183  }
184 
185  packet->AddHeader (probe);
186 
187  // The standard is not clear on the correct queue for management
188  // frames if we are a QoS AP. The approach taken here is to always
189  // use the DCF for these regardless of whether we have a QoS
190  // association or not.
191  m_dca->Queue (packet, hdr);
192 
194  {
196  }
199 }
200 
201 void
203 {
204  NS_LOG_FUNCTION (this << GetBssid ());
205  WifiMacHeader hdr;
206  hdr.SetAssocReq ();
207  hdr.SetAddr1 (GetBssid ());
208  hdr.SetAddr2 (GetAddress ());
209  hdr.SetAddr3 (GetBssid ());
210  hdr.SetDsNotFrom ();
211  hdr.SetDsNotTo ();
212  Ptr<Packet> packet = Create<Packet> ();
213  MgtAssocRequestHeader assoc;
214  assoc.SetSsid (GetSsid ());
215  assoc.SetSupportedRates (GetSupportedRates ());
216  if (m_htSupported)
217  {
218  assoc.SetHtCapabilities (GetHtCapabilities());
219  hdr.SetNoOrder();
220  }
221 
222  packet->AddHeader (assoc);
223 
224  // The standard is not clear on the correct queue for management
225  // frames if we are a QoS AP. The approach taken here is to always
226  // use the DCF for these regardless of whether we have a QoS
227  // association or not.
228  m_dca->Queue (packet, hdr);
229 
231  {
233  }
236 }
237 
238 void
240 {
241  NS_LOG_FUNCTION (this);
242  switch (m_state)
243  {
244  case ASSOCIATED:
245  return;
246  break;
247  case WAIT_PROBE_RESP:
248  /* we have sent a probe request earlier so we
249  do not need to re-send a probe request immediately.
250  We just need to wait until probe-request-timeout
251  or until we get a probe response
252  */
253  break;
254  case BEACON_MISSED:
255  /* we were associated but we missed a bunch of beacons
256  * so we should assume we are not associated anymore.
257  * We try to initiate a probe request now.
258  */
259  m_linkDown ();
260  if (m_activeProbing)
261  {
263  SendProbeRequest ();
264  }
265  break;
266  case WAIT_ASSOC_RESP:
267  /* we have sent an assoc request so we do not need to
268  re-send an assoc request right now. We just need to
269  wait until either assoc-request-timeout or until
270  we get an assoc response.
271  */
272  break;
273  case REFUSED:
274  /* we have sent an assoc request and received a negative
275  assoc resp. We wait until someone restarts an
276  association with a given ssid.
277  */
278  break;
279  }
280 }
281 
282 void
284 {
285  NS_LOG_FUNCTION (this);
288 }
289 
290 void
292 {
293  NS_LOG_FUNCTION (this);
295  SendProbeRequest ();
296 }
297 
298 void
300 {
301  NS_LOG_FUNCTION (this);
303  {
305  {
307  }
310  return;
311  }
312  NS_LOG_DEBUG ("beacon missed");
315 }
316 
317 void
319 {
320  NS_LOG_FUNCTION (this << delay);
321  m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
324  {
325  NS_LOG_DEBUG ("really restart watchdog.");
327  }
328 }
329 
330 bool
332 {
333  return m_state == ASSOCIATED;
334 }
335 
336 bool
338 {
339  return m_state == WAIT_ASSOC_RESP;
340 }
341 
342 void
344 {
345  NS_LOG_FUNCTION (this << packet << to);
346  if (!IsAssociated ())
347  {
348  NotifyTxDrop (packet);
350  return;
351  }
352  WifiMacHeader hdr;
353 
354  // If we are not a QoS AP then we definitely want to use AC_BE to
355  // transmit the packet. A TID of zero will map to AC_BE (through \c
356  // QosUtilsMapTidToAc()), so we use that as our default here.
357  uint8_t tid = 0;
358 
359  // For now, an AP that supports QoS does not support non-QoS
360  // associations, and vice versa. In future the AP model should
361  // support simultaneously associated QoS and non-QoS STAs, at which
362  // point there will need to be per-association QoS state maintained
363  // by the association state machine, and consulted here.
364  if (m_qosSupported)
365  {
368  hdr.SetQosNoEosp ();
369  hdr.SetQosNoAmsdu ();
370  // Transmission of multiple frames in the same TXOP is not
371  // supported for now
372  hdr.SetQosTxopLimit (0);
373 
374  // Fill in the QoS control field in the MAC header
375  tid = QosUtilsGetTidForPacket (packet);
376  // Any value greater than 7 is invalid and likely indicates that
377  // the packet had no QoS tag, so we revert to zero, which'll
378  // mean that AC_BE is used.
379  if (tid >= 7)
380  {
381  tid = 0;
382  }
383  hdr.SetQosTid (tid);
384  }
385  else
386  {
387  hdr.SetTypeData ();
388  }
389 if (m_htSupported)
390  {
391  hdr.SetNoOrder();
392  }
393 
394  hdr.SetAddr1 (GetBssid ());
395  hdr.SetAddr2 (m_low->GetAddress ());
396  hdr.SetAddr3 (to);
397  hdr.SetDsNotFrom ();
398  hdr.SetDsTo ();
399 
400  if (m_qosSupported)
401  {
402  // Sanity check that the TID is valid
403  NS_ASSERT (tid < 8);
404  m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
405  }
406  else
407  {
408  m_dca->Queue (packet, hdr);
409  }
410 }
411 
412 void
414 {
415  NS_LOG_FUNCTION (this << packet << hdr);
416  NS_ASSERT (!hdr->IsCtl ());
417  if (hdr->GetAddr3 () == GetAddress ())
418  {
419  NS_LOG_LOGIC ("packet sent by us.");
420  return;
421  }
422  else if (hdr->GetAddr1 () != GetAddress ()
423  && !hdr->GetAddr1 ().IsGroup ())
424  {
425  NS_LOG_LOGIC ("packet is not for us");
426  NotifyRxDrop (packet);
427  return;
428  }
429  else if (hdr->IsData ())
430  {
431  if (!IsAssociated ())
432  {
433  NS_LOG_LOGIC ("Received data frame while not associated: ignore");
434  NotifyRxDrop (packet);
435  return;
436  }
437  if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
438  {
439  NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
440  NotifyRxDrop (packet);
441  return;
442  }
443  if (hdr->GetAddr2 () != GetBssid ())
444  {
445  NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
446  NotifyRxDrop (packet);
447  return;
448  }
449 
450  if (hdr->IsQosData ())
451  {
452  if (hdr->IsQosAmsdu ())
453  {
454  NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
455  DeaggregateAmsduAndForward (packet, hdr);
456  packet = 0;
457  }
458  else
459  {
460  ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
461  }
462  }
463  else
464  {
465  ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
466  }
467  return;
468  }
469  else if (hdr->IsProbeReq ()
470  || hdr->IsAssocReq ())
471  {
472  // This is a frame aimed at an AP, so we can safely ignore it.
473  NotifyRxDrop (packet);
474  return;
475  }
476  else if (hdr->IsBeacon ())
477  {
478  MgtBeaconHeader beacon;
479  packet->RemoveHeader (beacon);
480  bool goodBeacon = false;
481  if (GetSsid ().IsBroadcast ()
482  || beacon.GetSsid ().IsEqual (GetSsid ()))
483  {
484  goodBeacon = true;
485  }
486  SupportedRates rates = beacon.GetSupportedRates ();
487  for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
488  {
489  uint32_t selector = m_phy->GetBssMembershipSelector (i);
490  if (!rates.IsSupportedRate (selector))
491  {
492  goodBeacon = false;
493  }
494  }
495  if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
496  {
497  goodBeacon = false;
498  }
499  if (goodBeacon)
500  {
502  RestartBeaconWatchdog (delay);
503  SetBssid (hdr->GetAddr3 ());
504  }
505  if (goodBeacon && m_state == BEACON_MISSED)
506  {
509  }
510  return;
511  }
512  else if (hdr->IsProbeResp ())
513  {
514  if (m_state == WAIT_PROBE_RESP)
515  {
516  MgtProbeResponseHeader probeResp;
517  packet->RemoveHeader (probeResp);
518  if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
519  {
520  //not a probe resp for our ssid.
521  return;
522  }
523  SupportedRates rates = probeResp.GetSupportedRates ();
524  for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
525  {
526  uint32_t selector = m_phy->GetBssMembershipSelector (i);
527  if (!rates.IsSupportedRate (selector))
528  {
529  return;
530  }
531  }
532  SetBssid (hdr->GetAddr3 ());
533  Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
534  RestartBeaconWatchdog (delay);
536  {
538  }
541  }
542  return;
543  }
544  else if (hdr->IsAssocResp ())
545  {
546  if (m_state == WAIT_ASSOC_RESP)
547  {
548  MgtAssocResponseHeader assocResp;
549  packet->RemoveHeader (assocResp);
551  {
553  }
554  if (assocResp.GetStatusCode ().IsSuccess ())
555  {
557  NS_LOG_DEBUG ("assoc completed");
558  SupportedRates rates = assocResp.GetSupportedRates ();
559  if (m_htSupported)
560  {
561  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
562  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (),htcapabilities);
563  }
564 
565  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
566  {
567  WifiMode mode = m_phy->GetMode (i);
568  if (rates.IsSupportedRate (mode.GetDataRate ()))
569  {
570  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
571  if (rates.IsBasicRate (mode.GetDataRate ()))
572  {
573  m_stationManager->AddBasicMode (mode);
574  }
575  }
576  }
577  if(m_htSupported)
578  {
579  HtCapabilities htcapabilities = assocResp.GetHtCapabilities ();
580  for (uint32_t i = 0; i < m_phy->GetNMcs(); i++)
581  {
582  uint8_t mcs=m_phy->GetMcs(i);
583  if (htcapabilities.IsSupportedMcs (mcs))
584  {
585  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
586  //here should add a control to add basic MCS when it is implemented
587  }
588  }
589  }
590  if (!m_linkUp.IsNull ())
591  {
592  m_linkUp ();
593  }
594  }
595  else
596  {
597  NS_LOG_DEBUG ("assoc refused");
598  SetState (REFUSED);
599  }
600  }
601  return;
602  }
603 
604  // Invoke the receive handler of our parent class to deal with any
605  // other frames. Specifically, this will handle Block Ack-related
606  // Management Action frames.
607  RegularWifiMac::Receive (packet, hdr);
608 }
609 
612 {
613  SupportedRates rates;
614  if(m_htSupported)
615  {
616  for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors(); i++)
617  {
619  }
620  }
621  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
622  {
623  WifiMode mode = m_phy->GetMode (i);
624  rates.AddSupportedRate (mode.GetDataRate ());
625  }
626  return rates;
627 }
630 {
631  HtCapabilities capabilities;
632  capabilities.SetHtSupported(1);
633  capabilities.SetLdpc (m_phy->GetLdpc());
635  capabilities.SetGreenfield (m_phy->GetGreenfield());
636 for (uint8_t i =0 ; i < m_phy->GetNMcs();i++)
637  {
638  capabilities.SetRxMcsBitmask(m_phy->GetMcs(i));
639  }
640  return capabilities;
641 }
642 void
644 {
645  if (value == ASSOCIATED
646  && m_state != ASSOCIATED)
647  {
648  m_assocLogger (GetBssid ());
649  }
650  else if (value != ASSOCIATED
651  && m_state == ASSOCIATED)
652  {
654  }
655  m_state = value;
656 }
657 
658 } // namespace ns3
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition: simulator.cc:232
bool IsWaitAssocResp(void) const
Return whether we are waiting for an association response from an AP.
bool IsBeacon(void) const
Return true if the header is a Beacon header.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:268
TracedCallback< Mac48Address > m_deAssocLogger
Definition: sta-wifi-mac.h:193
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
Time m_assocRequestTimeout
Definition: sta-wifi-mac.h:184
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:149
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Implement the header for management frames of type association request.
Definition: mgt-headers.h:40
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetQosAckPolicy(enum QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
AttributeValue implementation for Boolean.
Definition: boolean.h:34
void SendAssociationRequest(void)
Forward an association request packet to the DCF.
void SetGreenfield(uint8_t greenfield)
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:139
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
void SetProbeReq(void)
Set Type/Subtype values for a probe request header.
void SetHtSupported(uint8_t htsupported)
virtual uint32_t GetNModes(void) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
uint64_t GetBeaconIntervalUs(void) const
Return the beacon interval in microseconds unit.
Definition: mgt-headers.cc:144
void SetRxMcsBitmask(uint8_t index)
void AssocRequestTimeout(void)
This method is called after the association timeout occurred.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:81
Time m_probeRequestTimeout
Definition: sta-wifi-mac.h:183
void SetProbeRequestTimeout(Time timeout)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
virtual uint8_t GetNMcs(void) const =0
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1072
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
Callback< void > m_linkUp
Callback when a link is up.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
bool IsAssocReq(void) const
Return true if the header is an Association Request header.
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:269
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:274
virtual bool GetLdpc(void) const =0
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:65
virtual uint8_t GetMcs(uint8_t mcs) const =0
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
TracedCallback< Mac48Address > m_assocLogger
Definition: sta-wifi-mac.h:192
EventId m_assocRequestEvent
Definition: sta-wifi-mac.h:186
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
Ptr< WifiPhy > m_phy
Wifi PHY.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:819
bool IsCtl(void) const
Return true if the Type is Control.
ns3::Time timeout
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:69
virtual Ssid GetSsid(void) const
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
bool IsQosAmsdu(void) const
Check if the A-MSDU present bit is set in the QoS control field.
bool IsProbeResp(void) const
Return true if the header is a Probe Response header.
void SetAssocRequestTimeout(Time timeout)
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:60
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:439
virtual void SetBssid(Mac48Address bssid)
void SendProbeRequest(void)
Forward a probe request packet to the DCF.
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
base class for all MAC-level wifi objects.
void ProbeRequestTimeout(void)
This method is called after the probe request timeout occurred.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
void SetShortGuardInterval20(uint8_t shortguardinterval)
AttributeValue implementation for Time.
Definition: nstime.h:921
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:90
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:256
bool IsProbeReq(void) const
Return true if the header is a Probe Request header.
Hold an unsigned integer type.
Definition: uinteger.h:44
void MissedBeacons(void)
This method is called after we have not received a beacon from the AP.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:27
static Mac48Address GetBroadcast(void)
bool IsSupportedMcs(uint8_t mcs)
virtual bool GetGuardInterval(void) const =0
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void SetState(enum MacState value)
Set the current MAC state.
void SetAssocReq(void)
Set Type/Subtype values for an association request header.
virtual uint32_t GetNBssMembershipSelectors(void) const =0
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
SupportedRates GetSupportedRates(void)
Return the supported rates.
Definition: mgt-headers.cc:386
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the current AP.
Callback< void > m_linkDown
Callback when a link is down.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
bool IsBasicRate(uint32_t bs) const
Check if the given rate is a basic rate.
uint32_t m_maxMissedBeacons
Definition: sta-wifi-mac.h:189
void StartActiveAssociation(void)
Start an active association sequence immediately.
void SetMaxMissedBeacons(uint32_t missed)
EventId m_beaconWatchdog
Definition: sta-wifi-mac.h:187
virtual ~StaWifiMac()
bool IsToDs(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsGroup(void) const
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const =0
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
static TypeId GetTypeId(void)
Definition: sta-wifi-mac.cc:65
an EUI-48 address
Definition: mac48-address.h:43
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:980
void TryToEnsureAssociated(void)
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: nstime.h:922
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:180
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
void SetActiveProbing(bool enable)
Enable or disable active probing.
Implement the header for management frames of type association response.
Definition: mgt-headers.h:116
virtual Mac48Address GetBssid(void) const
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
bool IsData(void) const
Return true if the Type is DATA.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
virtual Mac48Address GetAddress(void) const
void SetTypeData(void)
Set Type/Subtype values for a data packet with no subtype equal to 0.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:859
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
bool IsSuccess(void) const
Return whether the status code is success.
Definition: status-code.cc:42
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
void SetDsTo(void)
Set the To DS bit in the Frame Control field.
void SetLdpc(uint8_t ldpc)
bool IsFromDs(void) const
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
void SetNoOrder(void)
Unset order bit in the frame control field.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:875
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:39
void SetType(enum WifiMacType type)
Set Type/Subtype values with the correct values depending on the given type.
enum MacState m_state
Definition: sta-wifi-mac.h:182
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Time m_beaconWatchdogEnd
Definition: sta-wifi-mac.h:188
EventId m_probeRequestEvent
Definition: sta-wifi-mac.h:185
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:239
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
bool IsAssociated(void) const
Return whether we are associated with an AP.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:59
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
a unique identifier for an interface.
Definition: type-id.h:51
uint64_t GetDataRate(void) const
Definition: wifi-mode.cc:79
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:321
virtual bool GetGreenfield(void) const =0
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:253
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
StatusCode GetStatusCode(void)
Return the status code.
Definition: mgt-headers.cc:381
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:407