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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #include "sta-wifi-mac.h"
24 #include "ns3/log.h"
25 #include "ns3/simulator.h"
26 #include "mac-low.h"
27 
28 /*
29  * The state machine for this STA is:
30  -------------- -----------
31  | Associated | <-------------------- -------> | Refused |
32  -------------- \ / -----------
33  \ \ /
34  \ ----------------- -----------------------------
35  \-> | Beacon Missed | --> | Wait Association Response |
36  ----------------- -----------------------------
37  \ ^
38  \ |
39  \ -----------------------
40  \-> | Wait Probe Response |
41  -----------------------
42  */
43 
44 namespace ns3 {
45 
46 NS_LOG_COMPONENT_DEFINE ("StaWifiMac");
47 
48 NS_OBJECT_ENSURE_REGISTERED (StaWifiMac);
49 
50 TypeId
52 {
53  static TypeId tid = TypeId ("ns3::StaWifiMac")
55  .SetGroupName ("Wifi")
56  .AddConstructor<StaWifiMac> ()
57  .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
58  TimeValue (Seconds (0.05)),
60  MakeTimeChecker ())
61  .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive association request attempts.",
62  TimeValue (Seconds (0.5)),
64  MakeTimeChecker ())
65  .AddAttribute ("MaxMissedBeacons",
66  "Number of beacons which much be consecutively missed before "
67  "we attempt to restart association.",
68  UintegerValue (10),
70  MakeUintegerChecker<uint32_t> ())
71  .AddAttribute ("ActiveProbing",
72  "If true, we send probe requests. If false, we don't."
73  "NOTE: if more than one STA in your simulation is using active probing, "
74  "you should enable it at a different simulation time for each STA, "
75  "otherwise all the STAs will start sending probes at the same time resulting in collisions. "
76  "See bug 1060 for more info.",
77  BooleanValue (false),
80  .AddTraceSource ("Assoc", "Associated with an access point.",
82  "ns3::Mac48Address::TracedCallback")
83  .AddTraceSource ("DeAssoc", "Association with an access point lost.",
85  "ns3::Mac48Address::TracedCallback")
86  ;
87  return tid;
88 }
89 
91  : m_state (BEACON_MISSED),
92  m_probeRequestEvent (),
93  m_assocRequestEvent (),
94  m_beaconWatchdogEnd (Seconds (0))
95 {
96  NS_LOG_FUNCTION (this);
97 
98  //Let the lower layers know that we are acting as a non-AP STA in
99  //an infrastructure BSS.
101 }
102 
104 {
105  NS_LOG_FUNCTION (this);
106 }
107 
108 void
110 {
111  NS_LOG_FUNCTION (this << enable);
112  if (enable)
113  {
115  }
116  else
117  {
119  }
120  m_activeProbing = enable;
121 }
122 
123 bool
125 {
126  return m_activeProbing;
127 }
128 
129 void
131 {
132  NS_LOG_FUNCTION (this << phy);
135 }
136 
137 void
139 {
140  NS_LOG_FUNCTION (this);
141  WifiMacHeader hdr;
144  hdr.SetAddr2 (GetAddress ());
146  hdr.SetDsNotFrom ();
147  hdr.SetDsNotTo ();
148  hdr.SetNoOrder ();
149  Ptr<Packet> packet = Create<Packet> ();
150  MgtProbeRequestHeader probe;
151  probe.SetSsid (GetSsid ());
152  probe.SetSupportedRates (GetSupportedRates ());
154  {
155  probe.SetExtendedCapabilities (GetExtendedCapabilities ());
156  probe.SetHtCapabilities (GetHtCapabilities ());
157  }
159  {
160  probe.SetVhtCapabilities (GetVhtCapabilities ());
161  }
162  if (m_heSupported)
163  {
164  probe.SetHeCapabilities (GetHeCapabilities ());
165  }
166  packet->AddHeader (probe);
167 
168  //The standard is not clear on the correct queue for management
169  //frames if we are a QoS AP. The approach taken here is to always
170  //use the DCF for these regardless of whether we have a QoS
171  //association or not.
172  m_dca->Queue (packet, hdr);
173 
175  {
177  }
180 }
181 
182 void
184 {
185  NS_LOG_FUNCTION (this << GetBssid () << isReassoc);
186  WifiMacHeader hdr;
188  hdr.SetAddr1 (GetBssid ());
189  hdr.SetAddr2 (GetAddress ());
190  hdr.SetAddr3 (GetBssid ());
191  hdr.SetDsNotFrom ();
192  hdr.SetDsNotTo ();
193  hdr.SetNoOrder ();
194  Ptr<Packet> packet = Create<Packet> ();
195  if (!isReassoc)
196  {
197  MgtAssocRequestHeader assoc;
198  assoc.SetSsid (GetSsid ());
200  assoc.SetCapabilities (GetCapabilities ());
202  {
205  }
207  {
209  }
210  if (m_heSupported)
211  {
213  }
214  packet->AddHeader (assoc);
215  }
216  else
217  {
218  MgtReassocRequestHeader reassoc;
219  reassoc.SetCurrentApAddress (GetBssid ());
220  reassoc.SetSsid (GetSsid ());
222  reassoc.SetCapabilities (GetCapabilities ());
224  {
227  }
229  {
231  }
232  if (m_heSupported)
233  {
235  }
236  packet->AddHeader (reassoc);
237  }
238 
239  //The standard is not clear on the correct queue for management
240  //frames if we are a QoS AP. The approach taken here is to always
241  //use the DCF for these regardless of whether we have a QoS
242  //association or not.
243  m_dca->Queue (packet, hdr);
244 
246  {
248  }
251 }
252 
253 void
255 {
256  NS_LOG_FUNCTION (this);
257  switch (m_state)
258  {
259  case ASSOCIATED:
260  return;
261  break;
262  case WAIT_PROBE_RESP:
263  /* we have sent a probe request earlier so we
264  do not need to re-send a probe request immediately.
265  We just need to wait until probe-request-timeout
266  or until we get a probe response
267  */
268  break;
269  case BEACON_MISSED:
270  /* we were associated but we missed a bunch of beacons
271  * so we should assume we are not associated anymore.
272  * We try to initiate a probe request now.
273  */
274  m_linkDown ();
275  if (m_activeProbing)
276  {
278  SendProbeRequest ();
279  }
280  break;
281  case WAIT_ASSOC_RESP:
282  /* we have sent an association request so we do not need to
283  re-send an association request right now. We just need to
284  wait until either assoc-request-timeout or until
285  we get an association response.
286  */
287  break;
288  case REFUSED:
289  /* we have sent an association request and received a negative
290  association response. We wait until someone restarts an
291  association with a given ssid.
292  */
293  break;
294  }
295 }
296 
297 void
299 {
300  NS_LOG_FUNCTION (this);
302  SendAssociationRequest (false);
303 }
304 
305 void
307 {
308  NS_LOG_FUNCTION (this);
310  SendProbeRequest ();
311 }
312 
313 void
315 {
316  NS_LOG_FUNCTION (this);
318  {
320  {
322  }
325  return;
326  }
327  NS_LOG_DEBUG ("beacon missed");
330 }
331 
332 void
334 {
335  NS_LOG_FUNCTION (this << delay);
339  {
340  NS_LOG_DEBUG ("really restart watchdog.");
342  }
343 }
344 
345 bool
347 {
348  return m_state == ASSOCIATED;
349 }
350 
351 bool
353 {
354  return m_state == WAIT_ASSOC_RESP;
355 }
356 
357 void
359 {
360  NS_LOG_FUNCTION (this << packet << to);
361  if (!IsAssociated ())
362  {
363  NotifyTxDrop (packet);
365  return;
366  }
367  WifiMacHeader hdr;
368 
369  //If we are not a QoS AP then we definitely want to use AC_BE to
370  //transmit the packet. A TID of zero will map to AC_BE (through \c
371  //QosUtilsMapTidToAc()), so we use that as our default here.
372  uint8_t tid = 0;
373 
374  //For now, an AP that supports QoS does not support non-QoS
375  //associations, and vice versa. In future the AP model should
376  //support simultaneously associated QoS and non-QoS STAs, at which
377  //point there will need to be per-association QoS state maintained
378  //by the association state machine, and consulted here.
379  if (m_qosSupported)
380  {
383  hdr.SetQosNoEosp ();
384  hdr.SetQosNoAmsdu ();
385  //Transmission of multiple frames in the same TXOP is not
386  //supported for now
387  hdr.SetQosTxopLimit (0);
388 
389  //Fill in the QoS control field in the MAC header
390  tid = QosUtilsGetTidForPacket (packet);
391  //Any value greater than 7 is invalid and likely indicates that
392  //the packet had no QoS tag, so we revert to zero, which'll
393  //mean that AC_BE is used.
394  if (tid > 7)
395  {
396  tid = 0;
397  }
398  hdr.SetQosTid (tid);
399  }
400  else
401  {
402  hdr.SetType (WIFI_MAC_DATA);
403  }
405  {
406  hdr.SetNoOrder ();
407  }
408 
409  hdr.SetAddr1 (GetBssid ());
410  hdr.SetAddr2 (m_low->GetAddress ());
411  hdr.SetAddr3 (to);
412  hdr.SetDsNotFrom ();
413  hdr.SetDsTo ();
414 
415  if (m_qosSupported)
416  {
417  //Sanity check that the TID is valid
418  NS_ASSERT (tid < 8);
419  m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
420  }
421  else
422  {
423  m_dca->Queue (packet, hdr);
424  }
425 }
426 
427 void
429 {
430  NS_LOG_FUNCTION (this << packet << hdr);
431  NS_ASSERT (!hdr->IsCtl ());
432  if (hdr->GetAddr3 () == GetAddress ())
433  {
434  NS_LOG_LOGIC ("packet sent by us.");
435  return;
436  }
437  else if (hdr->GetAddr1 () != GetAddress ()
438  && !hdr->GetAddr1 ().IsGroup ())
439  {
440  NS_LOG_LOGIC ("packet is not for us");
441  NotifyRxDrop (packet);
442  return;
443  }
444  else if (hdr->IsData ())
445  {
446  if (!IsAssociated ())
447  {
448  NS_LOG_LOGIC ("Received data frame while not associated: ignore");
449  NotifyRxDrop (packet);
450  return;
451  }
452  if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
453  {
454  NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
455  NotifyRxDrop (packet);
456  return;
457  }
458  if (hdr->GetAddr2 () != GetBssid ())
459  {
460  NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
461  NotifyRxDrop (packet);
462  return;
463  }
464  if (hdr->IsQosData ())
465  {
466  if (hdr->IsQosAmsdu ())
467  {
468  NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
469  DeaggregateAmsduAndForward (packet, hdr);
470  packet = 0;
471  }
472  else
473  {
474  ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
475  }
476  }
477  else
478  {
479  ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
480  }
481  return;
482  }
483  else if (hdr->IsProbeReq ()
484  || hdr->IsAssocReq ()
485  || hdr->IsReassocReq ())
486  {
487  //This is a frame aimed at an AP, so we can safely ignore it.
488  NotifyRxDrop (packet);
489  return;
490  }
491  else if (hdr->IsBeacon ())
492  {
493  NS_LOG_DEBUG ("Beacon received");
494  MgtBeaconHeader beacon;
495  packet->RemoveHeader (beacon);
496  CapabilityInformation capabilities = beacon.GetCapabilities ();
497  NS_ASSERT (capabilities.IsEss ());
498  bool goodBeacon = false;
499  if (GetSsid ().IsBroadcast ()
500  || beacon.GetSsid ().IsEqual (GetSsid ()))
501  {
502  NS_LOG_LOGIC ("Beacon is for our SSID");
503  goodBeacon = true;
504  }
505  SupportedRates rates = beacon.GetSupportedRates ();
506  bool bssMembershipSelectorMatch = false;
507  for (uint8_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
508  {
509  uint8_t selector = m_phy->GetBssMembershipSelector (i);
510  if (rates.IsBssMembershipSelectorRate (selector))
511  {
512  NS_LOG_LOGIC ("Beacon is matched to our BSS membership selector");
513  bssMembershipSelectorMatch = true;
514  }
515  }
516  if (m_phy->GetNBssMembershipSelectors () > 0 && bssMembershipSelectorMatch == false)
517  {
518  NS_LOG_LOGIC ("No match for BSS membership selector");
519  goodBeacon = false;
520  }
521  if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
522  {
523  NS_LOG_LOGIC ("Beacon is not for us");
524  goodBeacon = false;
525  }
526  if (goodBeacon)
527  {
529  RestartBeaconWatchdog (delay);
530  SetBssid (hdr->GetAddr3 ());
531  SupportedRates rates = beacon.GetSupportedRates ();
532  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
533  {
534  WifiMode mode = m_phy->GetMode (i);
535  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
536  {
537  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
538  }
539  }
540  bool isShortPreambleEnabled = capabilities.IsShortPreamble ();
541  if (m_erpSupported)
542  {
543  ErpInformation erpInformation = beacon.GetErpInformation ();
544  isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
545  if (erpInformation.GetUseProtection () == true)
546  {
548  }
549  else
550  {
552  }
553  if (capabilities.IsShortSlotTime () == true)
554  {
555  //enable short slot time
556  SetSlot (MicroSeconds (9));
557  }
558  else
559  {
560  //disable short slot time
561  SetSlot (MicroSeconds (20));
562  }
563  }
564  if (m_qosSupported)
565  {
566  bool qosSupported = false;
567  EdcaParameterSet edcaParameters = beacon.GetEdcaParameterSet ();
568  if (edcaParameters.IsQosSupported ())
569  {
570  qosSupported = true;
571  //The value of the TXOP Limit field is specified as an unsigned integer, with the least significant octet transmitted first, in units of 32 μs.
572  SetEdcaParameters (AC_BE, edcaParameters.GetBeCWmin (), edcaParameters.GetBeCWmax (), edcaParameters.GetBeAifsn (), 32 * MicroSeconds (edcaParameters.GetBeTXOPLimit ()));
573  SetEdcaParameters (AC_BK, edcaParameters.GetBkCWmin (), edcaParameters.GetBkCWmax (), edcaParameters.GetBkAifsn (), 32 * MicroSeconds (edcaParameters.GetBkTXOPLimit ()));
574  SetEdcaParameters (AC_VI, edcaParameters.GetViCWmin (), edcaParameters.GetViCWmax (), edcaParameters.GetViAifsn (), 32 * MicroSeconds (edcaParameters.GetViTXOPLimit ()));
575  SetEdcaParameters (AC_VO, edcaParameters.GetVoCWmin (), edcaParameters.GetVoCWmax (), edcaParameters.GetVoAifsn (), 32 * MicroSeconds (edcaParameters.GetVoTXOPLimit ()));
576  }
577  m_stationManager->SetQosSupport (hdr->GetAddr2 (), qosSupported);
578  }
579  if (m_htSupported)
580  {
581  HtCapabilities htCapabilities = beacon.GetHtCapabilities ();
582  if (!htCapabilities.IsSupportedMcs (0))
583  {
585  }
586  else
587  {
588  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (), htCapabilities);
589  HtOperation htOperation = beacon.GetHtOperation ();
590  if (htOperation.GetNonGfHtStasPresent ())
591  {
593  }
594  else
595  {
597  }
598  if (!m_vhtSupported && GetRifsSupported () && htOperation.GetRifsMode ())
599  {
601  }
602  else
603  {
605  }
606  }
607  }
608  if (m_vhtSupported)
609  {
610  VhtCapabilities vhtCapabilities = beacon.GetVhtCapabilities ();
611  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
612  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
613  {
614  m_stationManager->AddStationVhtCapabilities (hdr->GetAddr2 (), vhtCapabilities);
615  VhtOperation vhtOperation = beacon.GetVhtOperation ();
616  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
617  {
618  WifiMode mcs = m_phy->GetMcs (i);
619  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities.IsSupportedRxMcs (mcs.GetMcsValue ()))
620  {
621  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
622  }
623  }
624  }
625  }
627  {
628  ExtendedCapabilities extendedCapabilities = beacon.GetExtendedCapabilities ();
629  //TODO: to be completed
630  }
631  if (m_heSupported)
632  {
633  HeCapabilities heCapabilities = beacon.GetHeCapabilities ();
634  //todo: once we support non constant rate managers, we should add checks here whether HE is supported by the peer
635  m_stationManager->AddStationHeCapabilities (hdr->GetAddr2 (), heCapabilities);
636  HeOperation heOperation = beacon.GetHeOperation ();
637  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
638  {
639  WifiMode mcs = m_phy->GetMcs (i);
640  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HE && heCapabilities.IsSupportedRxMcs (mcs.GetMcsValue ()))
641  {
642  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
643  }
644  }
645  }
646  m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
648  }
649  if (goodBeacon && m_state == BEACON_MISSED)
650  {
652  NS_LOG_DEBUG ("Good beacon received: send association request");
653  SendAssociationRequest (false);
654  }
655  return;
656  }
657  else if (hdr->IsProbeResp ())
658  {
659  if (m_state == WAIT_PROBE_RESP)
660  {
661  NS_LOG_DEBUG ("Probe response received");
662  MgtProbeResponseHeader probeResp;
663  packet->RemoveHeader (probeResp);
664  CapabilityInformation capabilities = probeResp.GetCapabilities ();
665  if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
666  {
667  NS_LOG_DEBUG ("Probe response is not for our SSID");
668  return;
669  }
670  SupportedRates rates = probeResp.GetSupportedRates ();
671  for (uint8_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
672  {
673  uint8_t selector = m_phy->GetBssMembershipSelector (i);
674  if (!rates.IsBssMembershipSelectorRate (selector))
675  {
676  NS_LOG_DEBUG ("Supported rates do not fit with the BSS membership selector");
677  return;
678  }
679  }
680  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
681  {
682  WifiMode mode = m_phy->GetMode (i);
683  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
684  {
685  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
686  if (rates.IsBasicRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
687  {
689  }
690  }
691  }
692 
693  bool isShortPreambleEnabled = capabilities.IsShortPreamble ();
694  if (m_erpSupported)
695  {
696  bool isErpAllowed = false;
697  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
698  {
699  WifiMode mode = m_phy->GetMode (i);
701  {
702  isErpAllowed = true;
703  break;
704  }
705  }
706  if (!isErpAllowed)
707  {
708  //disable short slot time and set cwMin to 31
709  SetSlot (MicroSeconds (20));
710  ConfigureContentionWindow (31, 1023);
711  }
712  else
713  {
714  ErpInformation erpInformation = probeResp.GetErpInformation ();
715  isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
717  {
718  //enable short slot time
719  SetSlot (MicroSeconds (9));
720  }
721  else
722  {
723  //disable short slot time
724  SetSlot (MicroSeconds (20));
725  }
726  ConfigureContentionWindow (15, 1023);
727  }
728  }
729  m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
731  SetBssid (hdr->GetAddr3 ());
732  Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
733  RestartBeaconWatchdog (delay);
735  {
737  }
739  SendAssociationRequest (false);
740  }
741  return;
742  }
743  else if (hdr->IsAssocResp () || hdr->IsReassocResp ())
744  {
745  if (m_state == WAIT_ASSOC_RESP)
746  {
747  MgtAssocResponseHeader assocResp;
748  packet->RemoveHeader (assocResp);
750  {
752  }
753  if (assocResp.GetStatusCode ().IsSuccess ())
754  {
756  if (hdr->IsReassocResp ())
757  {
758  NS_LOG_DEBUG ("reassociation done");
759  }
760  else
761  {
762  NS_LOG_DEBUG ("association completed");
763  }
764  CapabilityInformation capabilities = assocResp.GetCapabilities ();
765  SupportedRates rates = assocResp.GetSupportedRates ();
766  bool isShortPreambleEnabled = capabilities.IsShortPreamble ();
767  if (m_erpSupported)
768  {
769  bool isErpAllowed = false;
770  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
771  {
772  WifiMode mode = m_phy->GetMode (i);
774  {
775  isErpAllowed = true;
776  break;
777  }
778  }
779  if (!isErpAllowed)
780  {
781  //disable short slot time and set cwMin to 31
782  SetSlot (MicroSeconds (20));
783  ConfigureContentionWindow (31, 1023);
784  }
785  else
786  {
787  ErpInformation erpInformation = assocResp.GetErpInformation ();
788  isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
790  {
791  //enable short slot time
792  SetSlot (MicroSeconds (9));
793  }
794  else
795  {
796  //disable short slot time
797  SetSlot (MicroSeconds (20));
798  }
799  ConfigureContentionWindow (15, 1023);
800  }
801  }
802  m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
804  if (m_qosSupported)
805  {
806  bool qosSupported = false;
807  EdcaParameterSet edcaParameters = assocResp.GetEdcaParameterSet ();
808  if (edcaParameters.IsQosSupported ())
809  {
810  qosSupported = true;
811  //The value of the TXOP Limit field is specified as an unsigned integer, with the least significant octet transmitted first, in units of 32 μs.
812  SetEdcaParameters (AC_BE, edcaParameters.GetBeCWmin (), edcaParameters.GetBeCWmax (), edcaParameters.GetBeAifsn (), 32 * MicroSeconds (edcaParameters.GetBeTXOPLimit ()));
813  SetEdcaParameters (AC_BK, edcaParameters.GetBkCWmin (), edcaParameters.GetBkCWmax (), edcaParameters.GetBkAifsn (), 32 * MicroSeconds (edcaParameters.GetBkTXOPLimit ()));
814  SetEdcaParameters (AC_VI, edcaParameters.GetViCWmin (), edcaParameters.GetViCWmax (), edcaParameters.GetViAifsn (), 32 * MicroSeconds (edcaParameters.GetViTXOPLimit ()));
815  SetEdcaParameters (AC_VO, edcaParameters.GetVoCWmin (), edcaParameters.GetVoCWmax (), edcaParameters.GetVoAifsn (), 32 * MicroSeconds (edcaParameters.GetVoTXOPLimit ()));
816  }
817  m_stationManager->SetQosSupport (hdr->GetAddr2 (), qosSupported);
818  }
819  if (m_htSupported)
820  {
821  HtCapabilities htCapabilities = assocResp.GetHtCapabilities ();
822  if (!htCapabilities.IsSupportedMcs (0))
823  {
825  }
826  else
827  {
828  m_stationManager->AddStationHtCapabilities (hdr->GetAddr2 (), htCapabilities);
829  HtOperation htOperation = assocResp.GetHtOperation ();
830  if (htOperation.GetNonGfHtStasPresent ())
831  {
833  }
834  else
835  {
837  }
838  if (!m_vhtSupported && GetRifsSupported () && htOperation.GetRifsMode ())
839  {
841  }
842  else
843  {
845  }
846  }
847  }
848  if (m_vhtSupported)
849  {
850  VhtCapabilities vhtCapabilities = assocResp.GetVhtCapabilities ();
851  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
852  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
853  {
854  m_stationManager->AddStationVhtCapabilities (hdr->GetAddr2 (), vhtCapabilities);
855  VhtOperation vhtOperation = assocResp.GetVhtOperation ();
856  }
857  }
858  if (m_heSupported)
859  {
860  HeCapabilities hecapabilities = assocResp.GetHeCapabilities ();
861  //todo: once we support non constant rate managers, we should add checks here whether HE is supported by the peer
862  m_stationManager->AddStationHeCapabilities (hdr->GetAddr2 (), hecapabilities);
863  HeOperation heOperation = assocResp.GetHeOperation ();
864  }
865  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
866  {
867  WifiMode mode = m_phy->GetMode (i);
868  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
869  {
870  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
871  if (rates.IsBasicRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
872  {
874  }
875  }
876  }
877  if (m_htSupported)
878  {
879  HtCapabilities htCapabilities = assocResp.GetHtCapabilities ();
880  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
881  {
882  WifiMode mcs = m_phy->GetMcs (i);
883  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
884  {
885  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
886  //here should add a control to add basic MCS when it is implemented
887  }
888  }
889  }
890  if (m_vhtSupported)
891  {
892  VhtCapabilities vhtcapabilities = assocResp.GetVhtCapabilities ();
893  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
894  {
895  WifiMode mcs = m_phy->GetMcs (i);
896  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtcapabilities.IsSupportedRxMcs (mcs.GetMcsValue ()))
897  {
898  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
899  //here should add a control to add basic MCS when it is implemented
900  }
901  }
902  }
904  {
905  ExtendedCapabilities extendedCapabilities = assocResp.GetExtendedCapabilities ();
906  //TODO: to be completed
907  }
908  if (m_heSupported)
909  {
910  HeCapabilities heCapabilities = assocResp.GetHeCapabilities ();
911  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
912  {
913  WifiMode mcs = m_phy->GetMcs (i);
914  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HE && heCapabilities.IsSupportedRxMcs (mcs.GetMcsValue ()))
915  {
916  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
917  //here should add a control to add basic MCS when it is implemented
918  }
919  }
920  }
921  if (!m_linkUp.IsNull ())
922  {
923  m_linkUp ();
924  }
925  }
926  else
927  {
928  NS_LOG_DEBUG ("association refused");
929  SetState (REFUSED);
930  }
931  }
932  return;
933  }
934 
935  //Invoke the receive handler of our parent class to deal with any
936  //other frames. Specifically, this will handle Block Ack-related
937  //Management Action frames.
938  RegularWifiMac::Receive (packet, hdr);
939 }
940 
943 {
944  SupportedRates rates;
946  {
947  for (uint8_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
948  {
950  }
951  }
952  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
953  {
954  WifiMode mode = m_phy->GetMode (i);
955  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth ());
956  NS_LOG_DEBUG ("Adding supported rate of " << modeDataRate);
957  rates.AddSupportedRate (modeDataRate);
958  }
959  return rates;
960 }
961 
964 {
965  CapabilityInformation capabilities;
968  return capabilities;
969 }
970 
971 void
973 {
974  if (value == ASSOCIATED
975  && m_state != ASSOCIATED)
976  {
977  m_assocLogger (GetBssid ());
978  }
979  else if (value != ASSOCIATED
980  && m_state == ASSOCIATED)
981  {
983  }
984  m_state = value;
985 }
986 
987 void
988 StaWifiMac::SetEdcaParameters (AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
989 {
990  Ptr<EdcaTxopN> edca = m_edca.find (ac)->second;
991  edca->SetMinCw (cwMin);
992  edca->SetMaxCw (cwMax);
993  edca->SetAifsn (aifsn);
994  edca->SetTxopLimit (txopLimit);
995 }
996 
997 void
999 {
1000  NS_LOG_FUNCTION (this);
1001  if (IsAssociated ())
1002  {
1003  NS_LOG_DEBUG ("PHY capabilities changed: send reassociation request");
1005  SendAssociationRequest (true);
1006  }
1007 }
1008 
1009 } //namespace ns3
uint8_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
Definition: wifi-phy.cc:1337
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition: simulator.cc:258
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:710
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:280
void SetWifiPhy(const Ptr< WifiPhy > phy)
TracedCallback< Mac48Address > m_deAssocLogger
deassoc logger
Definition: sta-wifi-mac.h:192
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:102
Time m_assocRequestTimeout
assoc request timeout
Definition: sta-wifi-mac.h:183
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:218
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
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:48
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:536
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:54
AttributeValue implementation for Boolean.
Definition: boolean.h:36
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:930
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:206
bool IsReassocResp(void) const
Return true if the header is a Reassociation Response header.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
void SetType(WifiMacType type)
Set Type/Subtype values with the correct values depending on the given type.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void SetEdcaParameters(AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: dca-txop.cc:174
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
uint64_t GetBeaconIntervalUs(void) const
Return the beacon interval in microseconds unit.
Definition: mgt-headers.cc:212
void SetState(MacState value)
Set the current MAC state.
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:84
Time m_probeRequestTimeout
probe request timeout
Definition: sta-wifi-mac.h:182
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.
uint8_t GetVoAifsn(void) const
Return the AC_VO AIFSN field in the EdcaParameterSet information element.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
The Extended Capabilities Information ElementThis class knows how to serialise and deserialise the Ex...
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
Definition: vht-operation.h:37
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
Callback< void > m_linkUp
Callback when a link is up.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
#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...
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:560
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:518
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:704
bool IsBroadcast(void) const
Check if the SSID is broadcast.
Definition: ssid.cc:72
void SetSlot(Time slotTime)
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:283
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:52
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:65
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:978
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...
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
Definition: wifi-phy.cc:3582
TracedCallback< Mac48Address > m_assocLogger
assoc logger
Definition: sta-wifi-mac.h:191
EventId m_assocRequestEvent
assoc request event
Definition: sta-wifi-mac.h:185
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
VHT PHY (Clause 22)
Definition: wifi-mode.h:60
Ptr< WifiPhy > m_phy
Wifi PHY.
uint32_t GetVoCWmin(void) const
Return the AC_VO CWmin field in the EdcaParameterSet information element.
bool IsCtl(void) const
Return true if the Type is Control.
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:55
void SetHeCapabilities(HeCapabilities hecapabilities)
Set the HE capabilities.
Definition: mgt-headers.cc:584
Ssid GetSsid(void) const
Video.
Definition: qos-utils.h:45
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Voice.
Definition: qos-utils.h:47
Best Effort.
Definition: qos-utils.h:41
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
bool IsQosAmsdu(void) const
Check if the A-MSDU present bit is set in the QoS control field.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
bool IsProbeResp(void) const
Return true if the header is a Probe Response header.
Capability information.
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...
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:524
ErpInformation GetErpInformation(void) const
Return the ERP information.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:54
uint8_t GetNonGfHtStasPresent(void) const
Return the non GF HT STAs present.
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:446
uint16_t GetBeTXOPLimit(void) const
Return the AC_BE TXOP Limit field in the EdcaParameterSet information element.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:278
void SetBssid(Mac48Address bssid)
void SendProbeRequest(void)
Forward a probe request packet to the DCF.
Background.
Definition: qos-utils.h:43
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
base class for all MAC-level wifi objects.
bool IsReassocReq(void) const
Return true if the header is a Reassociation Request header.
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:758
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...
tuple phy
Definition: third.py:86
uint8_t IsQosSupported(void) const
Is QOS supported function.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
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.
#define max(a, b)
Definition: 80211b.c:45
uint16_t GetBkTXOPLimit(void) const
Return the AC_BK TXOP Limit field in the EdcaParameterSet information element.
uint32_t GetViCWmin(void) const
Return the AC_VI CWmin field in the EdcaParameterSet information element.
AttributeValue implementation for Time.
Definition: nstime.h:1069
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:71
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
ErpInformation GetErpInformation(void) const
Return the ERP information.
Definition: mgt-headers.cc:356
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:746
The IEEE 802.11ac VHT Capabilities.
MacState m_state
MAC state.
Definition: sta-wifi-mac.h:181
void SetExtendedCapabilities(ExtendedCapabilities extendedcapabilities)
Set the Extended Capabilities.
Definition: mgt-headers.cc:548
uint32_t GetBeCWmin(void) const
Return the AC_BE CWmin field in the EdcaParameterSet information element.
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:265
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.
uint8_t GetBarkerPreambleMode(void) const
Return the Barker_Preamble_Mode field in the ErpInformation information element.
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:143
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htcapabilities)
Records HT capabilities of the remote station.
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3576
uint16_t GetVoTXOPLimit(void) const
Return the AC_VO TXOP Limit field in the EdcaParameterSet information element.
HT PHY (Clause 20)
Definition: wifi-mode.h:58
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:465
static Mac48Address GetBroadcast(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:365
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities hecapabilities)
Records HE capabilities of the remote station.
void SetCapabilitiesChangedCallback(Callback< void > callback)
Definition: wifi-phy.cc:430
bool m_heSupported
This Boolean is set true iff this WifiMac is to model 802.11ax.
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set.
uint32_t GetViCWmax(void) const
Return the AC_VI CWmax field in the EdcaParameterSet information element.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
VhtOperation GetVhtOperation(void) const
Return the VHT operation.
Definition: mgt-headers.cc:990
SupportedRates GetSupportedRates(void)
Return the supported rates.
Definition: mgt-headers.cc:906
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
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
maximum missed beacons
Definition: sta-wifi-mac.h:188
void SetAifsn(uint32_t aifsn)
Set the number of slots that make up an AIFS.
Definition: dca-txop.cc:181
uint8_t GetRifsMode(void) const
Return the RIFS mode.
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
Definition: wifi-phy.cc:3588
EventId m_beaconWatchdog
beacon watchdog
Definition: sta-wifi-mac.h:186
void AddBssMembershipSelectorRate(uint32_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
virtual ~StaWifiMac()
bool IsToDs(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:242
void PhyCapabilitiesChanged(void)
Indicate that PHY capabilities have changed.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:942
The EDCA Parameter SetThis class knows how to serialise and deserialise the EDCA Parameter Set...
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
bool IsGroup(void) const
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
uint32_t GetBeCWmax(void) const
Return the AC_BE CWmax field in the EdcaParameterSet information element.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
static TypeId GetTypeId(void)
Get the type ID.
Definition: sta-wifi-mac.cc:51
HeOperation GetHeOperation(void) const
Return the HE operation.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:254
an EUI-48 address
Definition: mac48-address.h:43
uint16_t GetViTXOPLimit(void) const
Return the AC_VI TXOP Limit field in the EdcaParameterSet information element.
HtOperation GetHtOperation(void) const
Return the HT operation.
Definition: mgt-headers.cc:966
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:572
uint8_t GetViAifsn(void) const
Return the AC_VI AIFSN field in the EdcaParameterSet information element.
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current STA.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1564
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:1070
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
void SetHeCapabilities(HeCapabilities hecapabilities)
Set the HE capabilities.
Definition: mgt-headers.cc:770
uint32_t GetBkCWmin(void) const
Return the AC_BK CWmin field in the EdcaParameterSet information element.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint32_t GetBkCWmax(void) const
Return the AC_BK CWmax field in the EdcaParameterSet information element.
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:507
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 and reassociation response.
Definition: mgt-headers.h:317
Mac48Address GetBssid(void) const
uint8_t GetBssMembershipSelector(uint8_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1343
uint8_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1280
uint32_t GetVoCWmax(void) const
Return the AC_VO CWmax field in the EdcaParameterSet information element.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: dca-txop.cc:167
bool IsShortSlotTime(void) const
Check if the short slot time in the capability information field is set to 1.
bool IsEss(void) const
Check if the Extended Service Set (ESS) bit in the capability information field is set to 1...
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: dca-txop.cc:188
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...
void SetCurrentApAddress(Mac48Address currentApAddr)
Set the address of the current access point.
Definition: mgt-headers.cc:800
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set.
Definition: mgt-headers.cc:368
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
Mac48Address GetAddress(void) const
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1007
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
VhtOperation GetVhtOperation(void) const
Return the VHT operation.
Definition: mgt-headers.cc:290
bool IsSupportedRxMcs(uint8_t mcs) const
Is reeive MCS supported.
HtOperation GetHtOperation(void) const
Return the HT operation.
Definition: mgt-headers.cc:266
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
void SetUseGreenfieldProtection(bool enable)
Enable or disable protection for stations that do not support HT greenfield format.
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.
bool IsFromDs(void) const
uint8_t GetBeAifsn(void) const
Return the AC_BE AIFSN field in the EdcaParameterSet information element.
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
uint8_t GetBkAifsn(void) const
Return the AC_BK AIFSN field in the EdcaParameterSet information element.
bool IsSupportedRxMcs(uint8_t mcs) const
Get the is receive MCS 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:1023
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:230
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:39
HeOperation GetHeOperation(void) const
Return the HE operation.
Definition: mgt-headers.cc:314
bool GetShortSlotTimeSupported(void) const
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Time m_beaconWatchdogEnd
beacon watchdog end
Definition: sta-wifi-mac.h:187
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:722
bool GetRifsSupported(void) const
bool m_activeProbing
active probing
Definition: sta-wifi-mac.h:189
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:487
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
EventId m_probeRequestEvent
probe request event
Definition: sta-wifi-mac.h:184
void SetShortPreambleEnabled(bool enable)
Enable or disable short PLCP preambles.
The HE Operation Information ElementThis class knows how to serialise and deserialise the HE Operatio...
Definition: he-operation.h:37
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:611
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
uint16_t GetRxHighestSupportedLgiDataRate() const
Get the receive highest supported LGI data rate.
bool GetShortPlcpPreambleSupported(void) const
Return whether short PLCP preamble is supported.
Definition: wifi-phy.cc:648
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
uint8_t GetUseProtection(void) const
Return the Use_Protection field in the ErpInformation information element.
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
Definition: mgt-headers.cc:302
bool IsAssociated(void) const
Return whether we are associated with an AP.
The IEEE 802.11ax HE Capabilities.
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
void SetExtendedCapabilities(ExtendedCapabilities extendedcapabilities)
Set the Extended Capabilities.
Definition: mgt-headers.cc:734
a unique identifier for an interface.
Definition: type-id.h:58
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the suppported MCS by a destination.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:827
HE PHY (Clause 26)
Definition: wifi-mode.h:62
void SetRifsPermitted(bool allow)
Permit or prohibit RIFS.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtcapabilities)
Records VHT capabilities of the remote station.
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3570
Implement the header for management frames of type reassociation request.
Definition: mgt-headers.h:179
StatusCode GetStatusCode(void)
Return the status code.
Definition: mgt-headers.cc:900
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
bool IsBssMembershipSelectorRate(uint32_t bs) const
Check if the given rate is a BSS membership selector value.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:954
The Wifi MAC high model for a non-AP STA in a BSS.
Definition: sta-wifi-mac.h:39
bool IsShortPreamble(void) const
Check if the short preamble bit in the capability information field is set to 1.
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.