A Discrete-Event Network Simulator
API
ap-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 "ns3/log.h"
24 #include "ns3/packet.h"
25 #include "ns3/simulator.h"
26 #include "ns3/pointer.h"
27 #include "ns3/string.h"
28 #include "ns3/random-variable-stream.h"
29 #include "ap-wifi-mac.h"
30 #include "channel-access-manager.h"
31 #include "mac-tx-middle.h"
32 #include "mac-rx-middle.h"
33 #include "mgt-headers.h"
34 #include "msdu-aggregator.h"
35 #include "amsdu-subframe-header.h"
36 #include "wifi-phy.h"
37 #include "wifi-net-device.h"
38 #include "ns3/ht-configuration.h"
39 #include "ns3/he-configuration.h"
40 
41 namespace ns3 {
42 
43 NS_LOG_COMPONENT_DEFINE ("ApWifiMac");
44 
45 NS_OBJECT_ENSURE_REGISTERED (ApWifiMac);
46 
47 TypeId
49 {
50  static TypeId tid = TypeId ("ns3::ApWifiMac")
52  .SetGroupName ("Wifi")
53  .AddConstructor<ApWifiMac> ()
54  .AddAttribute ("BeaconInterval",
55  "Delay between two beacons",
56  TimeValue (MicroSeconds (102400)),
59  MakeTimeChecker ())
60  .AddAttribute ("BeaconJitter",
61  "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
62  "to be distributed between 0 and the BeaconInterval.",
63  StringValue ("ns3::UniformRandomVariable"),
65  MakePointerChecker<UniformRandomVariable> ())
66  .AddAttribute ("EnableBeaconJitter",
67  "If beacons are enabled, whether to jitter the initial send event.",
68  BooleanValue (true),
71  .AddAttribute ("BeaconGeneration",
72  "Whether or not beacons are generated.",
73  BooleanValue (true),
76  .AddAttribute ("EnableNonErpProtection", "Whether or not protection mechanism should be used when non-ERP STAs are present within the BSS."
77  "This parameter is only used when ERP is supported by the AP.",
78  BooleanValue (true),
81  .AddAttribute ("BsrLifetime",
82  "Lifetime of Buffer Status Reports received from stations.",
83  TimeValue (MilliSeconds (20)),
85  MakeTimeChecker ())
86  .AddTraceSource ("AssociatedSta",
87  "A station associated with this access point.",
89  "ns3::ApWifiMac::AssociationCallback")
90  .AddTraceSource ("DeAssociatedSta",
91  "A station lost association with this access point.",
93  "ns3::ApWifiMac::AssociationCallback")
94  ;
95  return tid;
96 }
97 
99  : m_enableBeaconGeneration (false),
100  m_numNonErpStations (0),
101  m_numNonHtStations (0),
102  m_shortSlotTimeEnabled (false),
103  m_shortPreambleEnabled (false)
104 {
105  NS_LOG_FUNCTION (this);
106  m_beaconTxop = CreateObject<Txop> ();
107  m_beaconTxop->SetAifsn (1);
108  m_beaconTxop->SetMinCw (0);
109  m_beaconTxop->SetMaxCw (0);
112 
113  //Let the lower layers know that we are acting as an AP.
115 }
116 
118 {
119  NS_LOG_FUNCTION (this);
120  m_staList.clear ();
121  m_addressIdMap.clear ();
122 }
123 
124 void
126 {
127  NS_LOG_FUNCTION (this);
128  m_beaconTxop->Dispose ();
129  m_beaconTxop = 0;
130  m_enableBeaconGeneration = false;
133 }
134 
135 void
137 {
138  NS_LOG_FUNCTION (this << address);
139  //As an AP, our MAC address is also the BSSID. Hence we are
140  //overriding this function and setting both in our parent class.
143 }
144 
145 void
147 {
148  NS_LOG_FUNCTION (this << enable);
149  if (!enable)
150  {
152  }
153  else if (enable && !m_enableBeaconGeneration)
154  {
156  }
157  m_enableBeaconGeneration = enable;
158 }
159 
160 Time
162 {
163  NS_LOG_FUNCTION (this);
164  return m_beaconInterval;
165 }
166 
167 void
169 {
170  NS_LOG_FUNCTION (this << stationManager);
171  m_beaconTxop->SetWifiRemoteStationManager (stationManager);
173 }
174 
175 void
177 {
178  NS_LOG_FUNCTION (this << &linkUp);
180 
181  //The approach taken here is that, from the point of view of an AP,
182  //the link is always up, so we immediately invoke the callback if
183  //one is set
184  linkUp ();
185 }
186 
187 void
189 {
190  NS_LOG_FUNCTION (this << interval);
191  if ((interval.GetMicroSeconds () % 1024) != 0)
192  {
193  NS_FATAL_ERROR ("beacon interval should be multiple of 1024us (802.11 time unit), see IEEE Std. 802.11-2012");
194  }
195  if (interval.GetMicroSeconds () > (1024 * 65535))
196  {
197  NS_FATAL_ERROR ("beacon interval should be smaller then or equal to 65535 * 1024us (802.11 time unit)");
198  }
199  m_beaconInterval = interval;
200 }
201 
202 int64_t
203 ApWifiMac::AssignStreams (int64_t stream)
204 {
205  NS_LOG_FUNCTION (this << stream);
206  m_beaconJitter->SetStream (stream);
207  return 1;
208 }
209 
210 void
212 {
213  NS_LOG_FUNCTION (this);
215  {
216  for (const auto& sta : m_staList)
217  {
218  if (!m_stationManager->GetShortSlotTimeSupported (sta.second))
219  {
220  m_shortSlotTimeEnabled = false;
221  return;
222  }
223  }
224  m_shortSlotTimeEnabled = true;
225  }
226  else
227  {
228  m_shortSlotTimeEnabled = false;
229  }
230 }
231 
232 void
234 {
235  NS_LOG_FUNCTION (this);
237  {
238  for (const auto& sta : m_staList)
239  {
240  if (!m_stationManager->GetErpOfdmSupported (sta.second) ||
242  {
243  m_shortPreambleEnabled = false;
244  return;
245  }
246  }
247  m_shortPreambleEnabled = true;
248  }
249  else
250  {
251  m_shortPreambleEnabled = false;
252  }
253 }
254 
255 uint16_t
257 {
258  uint16_t channelWidth = m_phy->GetChannelWidth ();
259  for (const auto& sta : m_staList)
260  {
261  if (m_stationManager->GetVhtSupported (sta.second))
262  {
263  if (m_stationManager->GetChannelWidthSupported (sta.second) < channelWidth)
264  {
265  channelWidth = m_stationManager->GetChannelWidthSupported (sta.second);
266  }
267  }
268  }
269  return channelWidth;
270 }
271 
272 void
274  Mac48Address to)
275 {
276  NS_LOG_FUNCTION (this << packet << from << to);
277  //If we are not a QoS AP then we definitely want to use AC_BE to
278  //transmit the packet. A TID of zero will map to AC_BE (through \c
279  //QosUtilsMapTidToAc()), so we use that as our default here.
280  uint8_t tid = 0;
281 
282  //If we are a QoS AP then we attempt to get a TID for this packet
283  if (GetQosSupported ())
284  {
285  tid = QosUtilsGetTidForPacket (packet);
286  //Any value greater than 7 is invalid and likely indicates that
287  //the packet had no QoS tag, so we revert to zero, which'll
288  //mean that AC_BE is used.
289  if (tid > 7)
290  {
291  tid = 0;
292  }
293  }
294 
295  ForwardDown (packet, from, to, tid);
296 }
297 
298 void
300  Mac48Address to, uint8_t tid)
301 {
302  NS_LOG_FUNCTION (this << packet << from << to << +tid);
303  WifiMacHeader hdr;
304 
305  //For now, an AP that supports QoS does not support non-QoS
306  //associations, and vice versa. In future the AP model should
307  //support simultaneously associated QoS and non-QoS STAs, at which
308  //point there will need to be per-association QoS state maintained
309  //by the association state machine, and consulted here.
310  if (GetQosSupported ())
311  {
314  hdr.SetQosNoEosp ();
315  hdr.SetQosNoAmsdu ();
316  //Transmission of multiple frames in the same Polled TXOP is not supported for now
317  hdr.SetQosTxopLimit (0);
318  //Fill in the QoS control field in the MAC header
319  hdr.SetQosTid (tid);
320  }
321  else
322  {
323  hdr.SetType (WIFI_MAC_DATA);
324  }
325 
326  if (GetQosSupported ())
327  {
328  hdr.SetNoOrder (); // explicitly set to 0 for the time being since HT control field is not yet implemented (set it to 1 when implemented)
329  }
330  hdr.SetAddr1 (to);
331  hdr.SetAddr2 (GetAddress ());
332  hdr.SetAddr3 (from);
333  hdr.SetDsFrom ();
334  hdr.SetDsNotTo ();
335 
336  if (GetQosSupported ())
337  {
338  //Sanity check that the TID is valid
339  NS_ASSERT (tid < 8);
340  m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
341  }
342  else
343  {
344  m_txop->Queue (packet, hdr);
345  }
346 }
347 
348 void
350 {
351  NS_LOG_FUNCTION (this << packet << to << from);
352  if (to.IsGroup () || m_stationManager->IsAssociated (to))
353  {
354  ForwardDown (packet, from, to);
355  }
356  else
357  {
358  NotifyTxDrop (packet);
359  }
360 }
361 
362 void
364 {
365  NS_LOG_FUNCTION (this << packet << to);
366  //We're sending this packet with a from address that is our own. We
367  //get that address from the lower MAC and make use of the
368  //from-spoofing Enqueue() method to avoid duplicated code.
369  Enqueue (packet, to, GetAddress ());
370 }
371 
372 bool
374 {
375  NS_LOG_FUNCTION (this);
376  return true;
377 }
378 
381 {
382  NS_LOG_FUNCTION (this);
383  SupportedRates rates;
384  //Send the set of supported rates and make sure that we indicate
385  //the Basic Rate set in this set of supported rates.
386  for (const auto & mode : m_phy->GetModeList ())
387  {
388  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth ());
389  NS_LOG_DEBUG ("Adding supported rate of " << modeDataRate);
390  rates.AddSupportedRate (modeDataRate);
391  //Add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
392  //here we choose to add the mandatory rates to the BSSBasicRateSet,
393  //except for 802.11b where we assume that only the non HR-DSSS rates are part of the BSSBasicRateSet
394  if (mode.IsMandatory () && (mode.GetModulationClass () != WIFI_MOD_CLASS_HR_DSSS))
395  {
396  NS_LOG_DEBUG ("Adding basic mode " << mode.GetUniqueName ());
398  }
399  }
400  //set the basic rates
401  for (uint8_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
402  {
404  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth ());
405  NS_LOG_DEBUG ("Setting basic rate " << mode.GetUniqueName ());
406  rates.SetBasicRate (modeDataRate);
407  }
408  //If it is a HT AP, then add the BSSMembershipSelectorSet
409  //The standard says that the BSSMembershipSelectorSet
410  //must have its MSB set to 1 (must be treated as a Basic Rate)
411  //Also the standard mentioned that at least 1 element should be included in the SupportedRates the rest can be in the ExtendedSupportedRates
412  if (GetHtSupported ())
413  {
414  for (const auto & selector : m_phy->GetBssMembershipSelectorList ())
415  {
416  rates.AddBssMembershipSelectorRate (selector);
417  }
418  }
419  return rates;
420 }
421 
424 {
425  NS_LOG_FUNCTION (this);
426  DsssParameterSet dsssParameters;
427  if (GetDsssSupported ())
428  {
429  dsssParameters.SetDsssSupported (1);
430  dsssParameters.SetCurrentChannel (m_phy->GetChannelNumber ());
431  }
432  return dsssParameters;
433 }
434 
437 {
438  NS_LOG_FUNCTION (this);
439  CapabilityInformation capabilities;
442  capabilities.SetEss ();
443  return capabilities;
444 }
445 
448 {
449  NS_LOG_FUNCTION (this);
450  ErpInformation information;
451  information.SetErpSupported (1);
452  if (GetErpSupported ())
453  {
454  information.SetNonErpPresent (m_numNonErpStations > 0);
455  information.SetUseProtection (GetUseNonErpProtection ());
457  {
458  information.SetBarkerPreambleMode (0);
459  }
460  else
461  {
462  information.SetBarkerPreambleMode (1);
463  }
464  }
465  return information;
466 }
467 
470 {
471  NS_LOG_FUNCTION (this);
472  EdcaParameterSet edcaParameters;
473  if (GetQosSupported ())
474  {
475  edcaParameters.SetQosSupported (1);
476  Ptr<QosTxop> edca;
477  Time txopLimit;
478 
479  edca = m_edca.find (AC_BE)->second;
480  txopLimit = edca->GetTxopLimit ();
481  edcaParameters.SetBeAci (0);
482  edcaParameters.SetBeCWmin (edca->GetMinCw ());
483  edcaParameters.SetBeCWmax (edca->GetMaxCw ());
484  edcaParameters.SetBeAifsn (edca->GetAifsn ());
485  edcaParameters.SetBeTxopLimit (static_cast<uint16_t> (txopLimit.GetMicroSeconds () / 32));
486 
487  edca = m_edca.find (AC_BK)->second;
488  txopLimit = edca->GetTxopLimit ();
489  edcaParameters.SetBkAci (1);
490  edcaParameters.SetBkCWmin (edca->GetMinCw ());
491  edcaParameters.SetBkCWmax (edca->GetMaxCw ());
492  edcaParameters.SetBkAifsn (edca->GetAifsn ());
493  edcaParameters.SetBkTxopLimit (static_cast<uint16_t> (txopLimit.GetMicroSeconds () / 32));
494 
495  edca = m_edca.find (AC_VI)->second;
496  txopLimit = edca->GetTxopLimit ();
497  edcaParameters.SetViAci (2);
498  edcaParameters.SetViCWmin (edca->GetMinCw ());
499  edcaParameters.SetViCWmax (edca->GetMaxCw ());
500  edcaParameters.SetViAifsn (edca->GetAifsn ());
501  edcaParameters.SetViTxopLimit (static_cast<uint16_t> (txopLimit.GetMicroSeconds () / 32));
502 
503  edca = m_edca.find (AC_VO)->second;
504  txopLimit = edca->GetTxopLimit ();
505  edcaParameters.SetVoAci (3);
506  edcaParameters.SetVoCWmin (edca->GetMinCw ());
507  edcaParameters.SetVoCWmax (edca->GetMaxCw ());
508  edcaParameters.SetVoAifsn (edca->GetAifsn ());
509  edcaParameters.SetVoTxopLimit (static_cast<uint16_t> (txopLimit.GetMicroSeconds () / 32));
510 
511  edcaParameters.SetQosInfo (0);
512  }
513  return edcaParameters;
514 }
515 
518 {
519  NS_LOG_FUNCTION (this);
520  HtOperation operation;
521  if (GetHtSupported ())
522  {
523  operation.SetHtSupported (1);
524  operation.SetPrimaryChannel (m_phy->GetChannelNumber ());
525  operation.SetRifsMode (false);
526  operation.SetNonGfHtStasPresent (true);
527  if (m_phy->GetChannelWidth () > 20)
528  {
529  operation.SetSecondaryChannelOffset (1);
530  operation.SetStaChannelWidth (1);
531  }
532  if (m_numNonHtStations == 0)
533  {
534  operation.SetHtProtection (NO_PROTECTION);
535  }
536  else
537  {
539  }
540  uint64_t maxSupportedRate = 0; //in bit/s
541  for (const auto & mcs : m_phy->GetMcsList (WIFI_MOD_CLASS_HT))
542  {
543  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
544  NS_ASSERT (nss > 0 && nss < 5);
545  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), GetHtConfiguration ()->GetShortGuardIntervalSupported () ? 400 : 800, nss);
546  if (dataRate > maxSupportedRate)
547  {
548  maxSupportedRate = dataRate;
549  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
550  }
551  }
552  uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams ();
553  auto mcsList = m_phy->GetMcsList (WIFI_MOD_CLASS_HT);
554  uint8_t nMcs = mcsList.size ();
555  for (const auto& sta : m_staList)
556  {
557  if (m_stationManager->GetHtSupported (sta.second))
558  {
559  uint64_t maxSupportedRateByHtSta = 0; //in bit/s
560  auto itMcs = mcsList.begin ();
561  for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (sta.second))); j++)
562  {
563  WifiMode mcs = *itMcs++;
564  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
565  NS_ASSERT (nss > 0 && nss < 5);
566  uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (sta.second),
567  m_stationManager->GetShortGuardIntervalSupported (sta.second) ? 400 : 800, nss);
568  if (dataRate > maxSupportedRateByHtSta)
569  {
570  maxSupportedRateByHtSta = dataRate;
571  }
572  }
573  if (maxSupportedRateByHtSta < maxSupportedRate)
574  {
575  maxSupportedRate = maxSupportedRateByHtSta;
576  }
577  if (m_stationManager->GetNMcsSupported (sta.second) < nMcs)
578  {
579  nMcs = m_stationManager->GetNMcsSupported (sta.second);
580  }
581  if (m_stationManager->GetNumberOfSupportedStreams (sta.second) < maxSpatialStream)
582  {
583  maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (sta.second);
584  }
585  }
586  }
587  operation.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupportedRate / 1e6)); //in Mbit/s
588  operation.SetTxMcsSetDefined (nMcs > 0);
589  operation.SetTxMaxNSpatialStreams (maxSpatialStream);
590  //To be filled in once supported
591  operation.SetObssNonHtStasPresent (0);
592  operation.SetDualBeacon (0);
593  operation.SetDualCtsProtection (0);
594  operation.SetStbcBeacon (0);
595  operation.SetLSigTxopProtectionFullSupport (0);
596  operation.SetPcoActive (0);
597  operation.SetPhase (0);
598  operation.SetRxMcsBitmask (0);
599  operation.SetTxRxMcsSetUnequal (0);
600  operation.SetTxUnequalModulation (0);
601  }
602  return operation;
603 }
604 
607 {
608  NS_LOG_FUNCTION (this);
609  VhtOperation operation;
610  if (GetVhtSupported ())
611  {
612  operation.SetVhtSupported (1);
613  uint16_t channelWidth = GetVhtOperationalChannelWidth ();
614  if (channelWidth == 160)
615  {
616  operation.SetChannelWidth (2);
617  }
618  else if (channelWidth == 80)
619  {
620  operation.SetChannelWidth (1);
621  }
622  else
623  {
624  operation.SetChannelWidth (0);
625  }
626  uint8_t maxSpatialStream = m_phy->GetMaxSupportedRxSpatialStreams ();
627  for (const auto& sta : m_staList)
628  {
629  if (m_stationManager->GetVhtSupported (sta.second))
630  {
631  if (m_stationManager->GetNumberOfSupportedStreams (sta.second) < maxSpatialStream)
632  {
633  maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (sta.second);
634  }
635  }
636  }
637  for (uint8_t nss = 1; nss <= maxSpatialStream; nss++)
638  {
639  uint8_t maxMcs = 9; //TBD: hardcode to 9 for now since we assume all MCS values are supported
640  operation.SetMaxVhtMcsPerNss (nss, maxMcs);
641  }
642  }
643  return operation;
644 }
645 
648 {
649  NS_LOG_FUNCTION (this);
650  HeOperation operation;
651  if (GetHeSupported ())
652  {
653  operation.SetHeSupported (1);
654  uint8_t maxSpatialStream = m_phy->GetMaxSupportedRxSpatialStreams ();
655  for (const auto& sta : m_staList)
656  {
657  if (m_stationManager->GetHeSupported (sta.second))
658  {
659  if (m_stationManager->GetNumberOfSupportedStreams (sta.second) < maxSpatialStream)
660  {
661  maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (sta.second);
662  }
663  }
664  }
665  for (uint8_t nss = 1; nss <= maxSpatialStream; nss++)
666  {
667  operation.SetMaxHeMcsPerNss (nss, 11); //TBD: hardcode to 11 for now since we assume all MCS values are supported
668  }
669  operation.SetBssColor (GetHeConfiguration ()->GetBssColor ());
670  }
671  return operation;
672 }
673 
674 void
676 {
677  NS_LOG_FUNCTION (this << to);
678  WifiMacHeader hdr;
680  hdr.SetAddr1 (to);
681  hdr.SetAddr2 (GetAddress ());
682  hdr.SetAddr3 (GetAddress ());
683  hdr.SetDsNotFrom ();
684  hdr.SetDsNotTo ();
685  Ptr<Packet> packet = Create<Packet> ();
687  probe.SetSsid (GetSsid ());
688  probe.SetSupportedRates (GetSupportedRates ());
689  probe.SetBeaconIntervalUs (GetBeaconInterval ().GetMicroSeconds ());
690  probe.SetCapabilities (GetCapabilities ());
693  if (GetDsssSupported ())
694  {
695  probe.SetDsssParameterSet (GetDsssParameterSet ());
696  }
697  if (GetErpSupported ())
698  {
699  probe.SetErpInformation (GetErpInformation ());
700  }
701  if (GetQosSupported ())
702  {
703  probe.SetEdcaParameterSet (GetEdcaParameterSet ());
704  }
705  if (GetHtSupported ())
706  {
707  probe.SetExtendedCapabilities (GetExtendedCapabilities ());
708  probe.SetHtCapabilities (GetHtCapabilities ());
709  probe.SetHtOperation (GetHtOperation ());
710  }
711  if (GetVhtSupported ())
712  {
713  probe.SetVhtCapabilities (GetVhtCapabilities ());
714  probe.SetVhtOperation (GetVhtOperation ());
715  }
716  if (GetHeSupported ())
717  {
718  probe.SetHeCapabilities (GetHeCapabilities ());
719  probe.SetHeOperation (GetHeOperation ());
720  }
721  packet->AddHeader (probe);
722 
723  //The standard is not clear on the correct queue for management
724  //frames if we are a QoS AP. The approach taken here is to always
725  //use the DCF for these regardless of whether we have a QoS
726  //association or not.
727  m_txop->Queue (packet, hdr);
728 }
729 
730 void
731 ApWifiMac::SendAssocResp (Mac48Address to, bool success, bool isReassoc)
732 {
733  NS_LOG_FUNCTION (this << to << success << isReassoc);
734  WifiMacHeader hdr;
736  hdr.SetAddr1 (to);
737  hdr.SetAddr2 (GetAddress ());
738  hdr.SetAddr3 (GetAddress ());
739  hdr.SetDsNotFrom ();
740  hdr.SetDsNotTo ();
741  Ptr<Packet> packet = Create<Packet> ();
743  StatusCode code;
744  if (success)
745  {
746  code.SetSuccess ();
747  uint16_t aid = 0;
748  bool found = false;
749  if (isReassoc)
750  {
751  for (const auto& sta : m_staList)
752  {
753  if (sta.second == to)
754  {
755  aid = sta.first;
756  found = true;
757  break;
758  }
759  }
760  }
761  if (!found)
762  {
763  aid = GetNextAssociationId ();
764  m_staList.insert (std::make_pair (aid, to));
765  m_assocLogger (aid, to);
766  m_addressIdMap.insert (std::make_pair (to, aid));
768  {
770  }
771  if (!m_stationManager->GetHtSupported (to))
772  {
774  }
777  }
778  assoc.SetAssociationId (aid);
779  }
780  else
781  {
782  code.SetFailure ();
783  }
784  assoc.SetSupportedRates (GetSupportedRates ());
785  assoc.SetStatusCode (code);
786  assoc.SetCapabilities (GetCapabilities ());
787  if (GetErpSupported ())
788  {
789  assoc.SetErpInformation (GetErpInformation ());
790  }
791  if (GetQosSupported ())
792  {
793  assoc.SetEdcaParameterSet (GetEdcaParameterSet ());
794  }
795  if (GetHtSupported ())
796  {
797  assoc.SetExtendedCapabilities (GetExtendedCapabilities ());
798  assoc.SetHtCapabilities (GetHtCapabilities ());
799  assoc.SetHtOperation (GetHtOperation ());
800  }
801  if (GetVhtSupported ())
802  {
803  assoc.SetVhtCapabilities (GetVhtCapabilities ());
804  assoc.SetVhtOperation (GetVhtOperation ());
805  }
806  if (GetHeSupported ())
807  {
808  assoc.SetHeCapabilities (GetHeCapabilities ());
809  assoc.SetHeOperation (GetHeOperation ());
810  }
811  packet->AddHeader (assoc);
812 
813  //The standard is not clear on the correct queue for management
814  //frames if we are a QoS AP. The approach taken here is to always
815  //use the DCF for these regardless of whether we have a QoS
816  //association or not.
817  m_txop->Queue (packet, hdr);
818 }
819 
820 void
822 {
823  NS_LOG_FUNCTION (this);
824  WifiMacHeader hdr;
827  hdr.SetAddr2 (GetAddress ());
828  hdr.SetAddr3 (GetAddress ());
829  hdr.SetDsNotFrom ();
830  hdr.SetDsNotTo ();
831  Ptr<Packet> packet = Create<Packet> ();
832  MgtBeaconHeader beacon;
833  beacon.SetSsid (GetSsid ());
834  beacon.SetSupportedRates (GetSupportedRates ());
835  beacon.SetBeaconIntervalUs (GetBeaconInterval ().GetMicroSeconds ());
836  beacon.SetCapabilities (GetCapabilities ());
839  if (GetDsssSupported ())
840  {
841  beacon.SetDsssParameterSet (GetDsssParameterSet ());
842  }
843  if (GetErpSupported ())
844  {
845  beacon.SetErpInformation (GetErpInformation ());
846  }
847  if (GetQosSupported ())
848  {
849  beacon.SetEdcaParameterSet (GetEdcaParameterSet ());
850  }
851  if (GetHtSupported ())
852  {
853  beacon.SetExtendedCapabilities (GetExtendedCapabilities ());
854  beacon.SetHtCapabilities (GetHtCapabilities ());
855  beacon.SetHtOperation (GetHtOperation ());
856  }
857  if (GetVhtSupported ())
858  {
859  beacon.SetVhtCapabilities (GetVhtCapabilities ());
860  beacon.SetVhtOperation (GetVhtOperation ());
861  }
862  if (GetHeSupported ())
863  {
864  beacon.SetHeCapabilities (GetHeCapabilities ());
865  beacon.SetHeOperation (GetHeOperation ());
866  }
867  packet->AddHeader (beacon);
868 
869  //The beacon has it's own special queue, so we load it in there
870  m_beaconTxop->Queue (packet, hdr);
872 
873  //If a STA that does not support Short Slot Time associates,
874  //the AP shall use long slot time beginning at the first Beacon
875  //subsequent to the association of the long slot time STA.
876  if (GetErpSupported ())
877  {
879  {
880  //Enable short slot time
881  m_phy->SetSlot (MicroSeconds (9));
882  }
883  else
884  {
885  //Disable short slot time
886  m_phy->SetSlot (MicroSeconds (20));
887  }
888  }
889 }
890 
891 void
893 {
894  NS_LOG_FUNCTION (this << *mpdu);
895  const WifiMacHeader& hdr = mpdu->GetHeader ();
896  if ((hdr.IsAssocResp () || hdr.IsReassocResp ())
898  {
899  NS_LOG_DEBUG ("associated with sta=" << hdr.GetAddr1 ());
901  }
902 }
903 
904 void
905 ApWifiMac::TxFailed (uint8_t timeoutReason, Ptr<const WifiMacQueueItem> mpdu, const WifiTxVector& txVector)
906 {
907  NS_LOG_FUNCTION (this << +timeoutReason << *mpdu << txVector);
908  const WifiMacHeader& hdr = mpdu->GetHeader ();
909 
910  if ((hdr.IsAssocResp () || hdr.IsReassocResp ())
912  {
913  NS_LOG_DEBUG ("association failed with sta=" << hdr.GetAddr1 ());
915  }
916 }
917 
918 void
920 {
921  NS_LOG_FUNCTION (this << *mpdu);
922  const WifiMacHeader* hdr = &mpdu->GetHeader ();
923  Ptr<const Packet> packet = mpdu->GetPacket ();
924  Mac48Address from = hdr->GetAddr2 ();
925  if (hdr->IsData ())
926  {
927  Mac48Address bssid = hdr->GetAddr1 ();
928  if (!hdr->IsFromDs ()
929  && hdr->IsToDs ()
930  && bssid == GetAddress ()
931  && m_stationManager->IsAssociated (from))
932  {
933  Mac48Address to = hdr->GetAddr3 ();
934  if (to == GetAddress ())
935  {
936  NS_LOG_DEBUG ("frame for me from=" << from);
937  if (hdr->IsQosData ())
938  {
939  if (hdr->IsQosAmsdu ())
940  {
941  NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ());
943  packet = 0;
944  }
945  else
946  {
947  ForwardUp (packet, from, bssid);
948  }
949  }
950  else if (hdr->HasData ())
951  {
952  ForwardUp (packet, from, bssid);
953  }
954  }
955  else if (to.IsGroup ()
957  {
958  NS_LOG_DEBUG ("forwarding frame from=" << from << ", to=" << to);
959  Ptr<Packet> copy = packet->Copy ();
960 
961  //If the frame we are forwarding is of type QoS Data,
962  //then we need to preserve the UP in the QoS control
963  //header...
964  if (hdr->IsQosData ())
965  {
966  ForwardDown (copy, from, to, hdr->GetQosTid ());
967  }
968  else
969  {
970  ForwardDown (copy, from, to);
971  }
972  ForwardUp (packet, from, to);
973  }
974  else
975  {
976  ForwardUp (packet, from, to);
977  }
978  }
979  else if (hdr->IsFromDs ()
980  && hdr->IsToDs ())
981  {
982  //this is an AP-to-AP frame
983  //we ignore for now.
984  NotifyRxDrop (packet);
985  }
986  else
987  {
988  //we can ignore these frames since
989  //they are not targeted at the AP
990  NotifyRxDrop (packet);
991  }
992  return;
993  }
994  else if (hdr->IsMgt ())
995  {
996  if (hdr->IsProbeReq ())
997  {
998  NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
999  MgtProbeRequestHeader probeRequestHeader;
1000  packet->PeekHeader (probeRequestHeader);
1001  Ssid ssid = probeRequestHeader.GetSsid ();
1002  if (ssid == GetSsid () || ssid.IsBroadcast ())
1003  {
1004  NS_LOG_DEBUG ("Probe request received from " << from << ": send probe response");
1005  SendProbeResp (from);
1006  }
1007  return;
1008  }
1009  else if (hdr->GetAddr1 () == GetAddress ())
1010  {
1011  if (hdr->IsAssocReq ())
1012  {
1013  NS_LOG_DEBUG ("Association request received from " << from);
1014  //first, verify that the the station's supported
1015  //rate set is compatible with our Basic Rate set
1016  MgtAssocRequestHeader assocReq;
1017  packet->PeekHeader (assocReq);
1018  CapabilityInformation capabilities = assocReq.GetCapabilities ();
1019  m_stationManager->AddSupportedPhyPreamble (from, capabilities.IsShortPreamble ());
1020  SupportedRates rates = assocReq.GetSupportedRates ();
1021  bool problem = false;
1022  if (rates.GetNRates () == 0)
1023  {
1024  problem = true;
1025  }
1026  if (GetHtSupported ())
1027  {
1028  //check whether the HT STA supports all MCSs in Basic MCS Set
1029  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
1030  if (htcapabilities.IsSupportedMcs (0))
1031  {
1032  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1033  {
1035  if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1036  {
1037  problem = true;
1038  break;
1039  }
1040  }
1041  }
1042  }
1043  if (GetVhtSupported ())
1044  {
1045  //check whether the VHT STA supports all MCSs in Basic MCS Set
1046  VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
1047  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
1048  {
1049  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1050  {
1052  if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1053  {
1054  problem = true;
1055  break;
1056  }
1057  }
1058  }
1059  }
1060  if (GetHeSupported ())
1061  {
1062  //check whether the HE STA supports all MCSs in Basic MCS Set
1063  HeCapabilities hecapabilities = assocReq.GetHeCapabilities ();
1064  if (hecapabilities.GetSupportedMcsAndNss () != 0)
1065  {
1066  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1067  {
1069  if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1070  {
1071  problem = true;
1072  break;
1073  }
1074  }
1075  }
1076  }
1077  if (problem)
1078  {
1079  NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send association response with an error status");
1080  SendAssocResp (hdr->GetAddr2 (), false, false);
1081  }
1082  else
1083  {
1084  NS_LOG_DEBUG ("The Basic Rate set modes are supported by the station");
1085  //record all its supported modes in its associated WifiRemoteStation
1086  for (const auto & mode : m_phy->GetModeList ())
1087  {
1088  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1089  {
1090  m_stationManager->AddSupportedMode (from, mode);
1091  }
1092  }
1093  if (GetErpSupported () && m_stationManager->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ())
1094  {
1096  }
1097  if (GetHtSupported ())
1098  {
1099  HtCapabilities htCapabilities = assocReq.GetHtCapabilities ();
1100  if (htCapabilities.IsSupportedMcs (0))
1101  {
1102  m_stationManager->AddStationHtCapabilities (from, htCapabilities);
1103  }
1104  }
1105  if (GetVhtSupported ())
1106  {
1107  VhtCapabilities vhtCapabilities = assocReq.GetVhtCapabilities ();
1108  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
1109  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
1110  {
1111  m_stationManager->AddStationVhtCapabilities (from, vhtCapabilities);
1112  for (const auto & mcs : m_phy->GetMcsList (WIFI_MOD_CLASS_VHT))
1113  {
1114  if (vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1115  {
1116  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1117  //here should add a control to add basic MCS when it is implemented
1118  }
1119  }
1120  }
1121  }
1122  if (GetHtSupported ())
1123  {
1124  ExtendedCapabilities extendedCapabilities = assocReq.GetExtendedCapabilities ();
1125  //TODO: to be completed
1126  }
1127  if (GetHeSupported ())
1128  {
1129  HeCapabilities heCapabilities = assocReq.GetHeCapabilities ();
1130  if (heCapabilities.GetSupportedMcsAndNss () != 0)
1131  {
1132  m_stationManager->AddStationHeCapabilities (from, heCapabilities);
1133  for (const auto & mcs : m_phy->GetMcsList (WIFI_MOD_CLASS_HE))
1134  {
1135  if (heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1136  {
1137  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1138  //here should add a control to add basic MCS when it is implemented
1139  }
1140  }
1141  }
1142  }
1144  NS_LOG_DEBUG ("Send association response with success status");
1145  SendAssocResp (hdr->GetAddr2 (), true, false);
1146  }
1147  return;
1148  }
1149  else if (hdr->IsReassocReq ())
1150  {
1151  NS_LOG_DEBUG ("Reassociation request received from " << from);
1152  //first, verify that the the station's supported
1153  //rate set is compatible with our Basic Rate set
1154  MgtReassocRequestHeader reassocReq;
1155  packet->PeekHeader (reassocReq);
1156  CapabilityInformation capabilities = reassocReq.GetCapabilities ();
1157  m_stationManager->AddSupportedPhyPreamble (from, capabilities.IsShortPreamble ());
1158  SupportedRates rates = reassocReq.GetSupportedRates ();
1159  bool problem = false;
1160  if (rates.GetNRates () == 0)
1161  {
1162  problem = true;
1163  }
1164  if (GetHtSupported ())
1165  {
1166  //check whether the HT STA supports all MCSs in Basic MCS Set
1167  HtCapabilities htcapabilities = reassocReq.GetHtCapabilities ();
1168  if (htcapabilities.IsSupportedMcs (0))
1169  {
1170  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1171  {
1173  if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1174  {
1175  problem = true;
1176  break;
1177  }
1178  }
1179  }
1180  }
1181  if (GetVhtSupported ())
1182  {
1183  //check whether the VHT STA supports all MCSs in Basic MCS Set
1184  VhtCapabilities vhtcapabilities = reassocReq.GetVhtCapabilities ();
1185  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
1186  {
1187  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1188  {
1190  if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1191  {
1192  problem = true;
1193  break;
1194  }
1195  }
1196  }
1197  }
1198  if (GetHeSupported ())
1199  {
1200  //check whether the HE STA supports all MCSs in Basic MCS Set
1201  HeCapabilities hecapabilities = reassocReq.GetHeCapabilities ();
1202  if (hecapabilities.GetSupportedMcsAndNss () != 0)
1203  {
1204  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1205  {
1207  if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1208  {
1209  problem = true;
1210  break;
1211  }
1212  }
1213  }
1214  }
1215  if (problem)
1216  {
1217  NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send reassociation response with an error status");
1218  SendAssocResp (hdr->GetAddr2 (), false, true);
1219  }
1220  else
1221  {
1222  NS_LOG_DEBUG ("The Basic Rate set modes are supported by the station");
1223  //update all its supported modes in its associated WifiRemoteStation
1224  for (const auto & mode : m_phy->GetModeList ())
1225  {
1226  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1227  {
1228  m_stationManager->AddSupportedMode (from, mode);
1229  }
1230  }
1231  if (GetErpSupported () && m_stationManager->GetErpOfdmSupported (from) && capabilities.IsShortSlotTime ())
1232  {
1234  }
1235  if (GetHtSupported ())
1236  {
1237  HtCapabilities htCapabilities = reassocReq.GetHtCapabilities ();
1238  if (htCapabilities.IsSupportedMcs (0))
1239  {
1240  m_stationManager->AddStationHtCapabilities (from, htCapabilities);
1241  }
1242  }
1243  if (GetVhtSupported ())
1244  {
1245  VhtCapabilities vhtCapabilities = reassocReq.GetVhtCapabilities ();
1246  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
1247  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
1248  {
1249  m_stationManager->AddStationVhtCapabilities (from, vhtCapabilities);
1250  for (const auto & mcs : m_phy->GetMcsList (WIFI_MOD_CLASS_VHT))
1251  {
1252  if (vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1253  {
1254  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1255  //here should add a control to add basic MCS when it is implemented
1256  }
1257  }
1258  }
1259  }
1260  if (GetHtSupported ())
1261  {
1262  ExtendedCapabilities extendedCapabilities = reassocReq.GetExtendedCapabilities ();
1263  //TODO: to be completed
1264  }
1265  if (GetHeSupported ())
1266  {
1267  HeCapabilities heCapabilities = reassocReq.GetHeCapabilities ();
1268  if (heCapabilities.GetSupportedMcsAndNss () != 0)
1269  {
1270  m_stationManager->AddStationHeCapabilities (from, heCapabilities);
1271  for (const auto & mcs : m_phy->GetMcsList (WIFI_MOD_CLASS_HE))
1272  {
1273  if (heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1274  {
1275  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1276  //here should add a control to add basic MCS when it is implemented
1277  }
1278  }
1279  }
1280  }
1282  NS_LOG_DEBUG ("Send reassociation response with success status");
1283  SendAssocResp (hdr->GetAddr2 (), true, true);
1284  }
1285  return;
1286  }
1287  else if (hdr->IsDisassociation ())
1288  {
1289  NS_LOG_DEBUG ("Disassociation received from " << from);
1291  for (auto it = m_staList.begin (); it != m_staList.end (); ++it)
1292  {
1293  if (it->second == from)
1294  {
1295  m_staList.erase (it);
1296  m_deAssocLogger (it->first, it->second);
1297  m_addressIdMap.erase (from);
1299  {
1301  }
1302  if (!m_stationManager->GetHtSupported (from))
1303  {
1305  }
1308  break;
1309  }
1310  }
1311  return;
1312  }
1313  }
1314  }
1315 
1316  //Invoke the receive handler of our parent class to deal with any
1317  //other frames. Specifically, this will handle Block Ack-related
1318  //Management Action frames.
1319  RegularWifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
1320 }
1321 
1322 void
1324 {
1325  NS_LOG_FUNCTION (this << *mpdu);
1326  for (auto& i : *PeekPointer (mpdu))
1327  {
1328  if (i.second.GetDestinationAddr () == GetAddress ())
1329  {
1330  ForwardUp (i.first, i.second.GetSourceAddr (),
1331  i.second.GetDestinationAddr ());
1332  }
1333  else
1334  {
1335  Mac48Address from = i.second.GetSourceAddr ();
1336  Mac48Address to = i.second.GetDestinationAddr ();
1337  NS_LOG_DEBUG ("forwarding QoS frame from=" << from << ", to=" << to);
1338  ForwardDown (i.first->Copy (), from, to, mpdu->GetHeader ().GetQosTid ());
1339  }
1340  }
1341 }
1342 
1343 void
1345 {
1346  NS_LOG_FUNCTION (this);
1348  m_beaconEvent.Cancel ();
1350  {
1352  {
1353  Time jitter = MicroSeconds (static_cast<int64_t> (m_beaconJitter->GetValue (0, 1) * (GetBeaconInterval ().GetMicroSeconds ())));
1354  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time " << jitter);
1356  }
1357  else
1358  {
1359  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time 0");
1361  }
1362  }
1364  NS_ABORT_IF (!TraceConnectWithoutContext ("MpduResponseTimeout", MakeCallback (&ApWifiMac::TxFailed, this)));
1368 }
1369 
1370 bool
1372 {
1373  bool useProtection = (m_numNonErpStations > 0) && m_enableNonErpProtection;
1374  m_stationManager->SetUseNonErpProtection (useProtection);
1375  return useProtection;
1376 }
1377 
1378 uint16_t
1380 {
1381  //Return the first free AID value between 1 and 2007
1382  for (uint16_t nextAid = 1; nextAid <= 2007; nextAid++)
1383  {
1384  if (m_staList.find (nextAid) == m_staList.end ())
1385  {
1386  return nextAid;
1387  }
1388  }
1389  NS_FATAL_ERROR ("No free association ID available!");
1390  return 0;
1391 }
1392 
1393 const std::map<uint16_t, Mac48Address>&
1395 {
1396  return m_staList;
1397 }
1398 
1399 uint16_t
1401 {
1402  auto it = m_addressIdMap.find (addr);
1403 
1404  if (it == m_addressIdMap.end ())
1405  {
1406  return SU_STA_ID;
1407  }
1408  return it->second;
1409 }
1410 
1411 uint8_t
1413 {
1414  auto it = m_bufferStatus.find (WifiAddressTidPair (address, tid));
1415  if (it == m_bufferStatus.end ()
1416  || it->second.timestamp + m_bsrLifetime < Simulator::Now ())
1417  {
1418  return 255;
1419  }
1420  return it->second.value;
1421 }
1422 
1423 void
1425 {
1426  if (size == 255)
1427  {
1428  // no point in storing an unspecified size
1429  m_bufferStatus.erase (WifiAddressTidPair (address, tid));
1430  }
1431  else
1432  {
1434  }
1435 }
1436 
1437 uint8_t
1439 {
1440  uint8_t maxSize = 0;
1441  bool found = false;
1442 
1443  for (uint8_t tid = 0; tid < 8; tid++)
1444  {
1445  uint8_t size = GetBufferStatus (tid, address);
1446  if (size != 255)
1447  {
1448  maxSize = std::max (maxSize, size);
1449  found = true;
1450  }
1451  }
1452 
1453  if (found)
1454  {
1455  return maxSize;
1456  }
1457  return 255;
1458 }
1459 
1460 } //namespace ns3
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
Definition: ap-wifi-mac.cc:363
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
void SetPcoActive(uint8_t pcoActive)
Set the PCO active.
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:786
std::pair< Mac48Address, uint8_t > WifiAddressTidPair
(MAC address, TID) pair
Definition: qos-utils.h:32
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
bool IsDisassociation(void) const
Return true if the header is a Disassociation header.
std::map< uint16_t, Mac48Address > m_staList
Map of all stations currently associated to the AP with their association ID.
Definition: ap-wifi-mac.h:309
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:188
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:198
void SetErpSupported(uint8_t erpSupported)
Set the ERP supported field.
bool IsBroadcast(void) const
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
void SetStbcBeacon(uint8_t stbcBeacon)
Set the STBC beacon.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:738
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 SetQosSupported(uint8_t qosSupported)
Set QOS supported function.
void SetLinkUpCallback(Callback< void > linkUp) override
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
void SetViCWmin(uint32_t cwMin)
Set the AC_VI CWmin field in the EdcaParameterSet information element.
bool GetHeSupported() const
Return whether the device supports HE.
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:273
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:380
void SetMaxVhtMcsPerNss(uint8_t nss, uint8_t maxVhtMcs)
Set the Basic VHT-MCS and NSS field in the VHT Operation information element by specifying the tuple ...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:469
uint8_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: txop.cc:268
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PHY preamble or not.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:647
Hold variables of type string.
Definition: string.h:41
#define min(a, b)
Definition: 80211b.c:42
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:136
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: ap-wifi-mac.cc:203
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
Definition: ap-wifi-mac.h:336
bool GetQosSupported() const
Return whether the device supports QoS.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
uint16_t GetSupportedMcsAndNss() const
Return the MCS and NSS field in the HE Capabilities information element.
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:85
void SetVoAci(uint8_t aci)
Set the AC_VO ACI field in the EdcaParameterSet information element.
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
void SetPhase(uint8_t pcoPhase)
Set the PCO phase.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
void SetLSigTxopProtectionFullSupport(uint8_t lSigTxopProtectionFullSupport)
Set the LSIG TXOP protection full support.
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2004
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:315
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:118
void SetRxHighestSupportedDataRate(uint16_t maxSupportedRate)
Set the receive highest supported data rate.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
uint16_t m_numNonHtStations
Number of non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:313
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
bool IsSupportedTxMcs(uint8_t mcs) const
Returns true if transmit MCS is supported.
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:35
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
#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
void SetQosInfo(uint8_t qosInfo)
Set the QoS Info field in the EdcaParameterSet information element.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:411
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
void SetNonGfHtStasPresent(uint8_t nonGfHtStasPresent)
Set the non GF HT STAs present.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:916
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:312
void SetVoAifsn(uint8_t aifsn)
Set the AC_VO AIFSN field in the EdcaParameterSet information element.
void AddSupportedPhyPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PHY preamble is supported by the station.
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
Definition: mgt-headers.cc:774
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:121
uint16_t GetAssociationId(Mac48Address addr) const
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:50
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:211
void SetTxMaxNSpatialStreams(uint8_t maxTxSpatialStreams)
Set the transmit maximum number spatial streams.
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:161
const std::map< uint16_t, Mac48Address > & GetStaList(void) const
Get a const reference to the map of associated stations.
void SetHeSupported(uint8_t heSupported)
Set the HE supported information element.
Definition: he-operation.cc:53
Ptr< WifiPhy > m_phy
Wifi PHY.
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:256
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
uint16_t GetNextAssociationId(void)
std::list< WifiMode > GetMcsList(void) const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition: wifi-phy.cc:2053
uint8_t GetNBasicMcs(void) const
Return the number of basic MCS index.
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:726
void SetVoCWmin(uint32_t cwMin)
Set the AC_VO CWmin field in the EdcaParameterSet information element.
uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: txop.cc:256
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
void SetBarkerPreambleMode(uint8_t barkerPreambleMode)
Set the Barker_Preamble_Mode field in the ErpInformation information element.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:47
uint16_t GetRxHighestSupportedLgiDataRate() const
Get the receive highest supported LGI data rate.
void SetTxMcsSetDefined(uint8_t txMcsSetDefined)
Set the transmit MCS set defined.
virtual void Receive(Ptr< WifiMacQueueItem > mpdu)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
bool GetShortSlotTimeSupported(void) const override
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:551
Capability information.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
void SetDualCtsProtection(uint8_t dualCtsProtection)
Set the dual CTS protection.
bool GetDsssSupported() const
Return whether the device supports DSSS.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:152
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:304
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:731
HR/DSSS (Clause 16)
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void SetBssid(Mac48Address bssid)
void SetMaxHeMcsPerNss(uint8_t nss, uint8_t maxHeMcs)
Set the Basic HE-MCS and NSS field in the HE Operation information element by specifying the tuple (n...
Definition: he-operation.cc:97
void SetViAifsn(uint8_t aifsn)
Set the AC_VI AIFSN field in the EdcaParameterSet information element.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
void SetHtProtection(uint8_t htProtection)
Set the HT protection.
base class for all MAC-level wifi objects.
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:184
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
bool GetErpSupported() const
Return whether the device supports ERP.
Video.
Definition: qos-utils.h:77
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:227
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:575
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetBufferStatus(uint8_t tid, Mac48Address address, uint8_t size)
Store the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the s...
#define max(a, b)
Definition: 80211b.c:43
bool SupportsSendFrom(void) const override
Definition: ap-wifi-mac.cc:373
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:588
void SetEss(void)
Set the Extended Service Set (ESS) bit in the capability information field.
AttributeValue implementation for Time.
Definition: nstime.h:1353
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
bool IsQosAmsdu(void) const
Check if the A-MSDU present bit is set in the QoS control field.
uint8_t GetMaxBufferStatus(Mac48Address address) const
Return the maximum among the values of the Queue Size subfield of the last QoS Data or QoS Null frame...
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
bool GetVhtSupported() const
Return whether the device supports VHT.
void SetVoCWmax(uint32_t cwMax)
Set the AC_VO CWmax field in the EdcaParameterSet information element.
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
The IEEE 802.11ac VHT Capabilities.
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:48
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:436
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:103
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:317
void SetBeCWmin(uint32_t cwMin)
Set the AC_BE CWmin field in the EdcaParameterSet information element.
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:606
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
Definition: ap-wifi-mac.cc:168
ssid
Definition: third.py:100
void SetViAci(uint8_t aci)
Set the AC_VI ACI field in the EdcaParameterSet information element.
void RecordGotAssocTxFailed(Mac48Address address)
Records that we missed an ACK for the association response we sent.
bool IsFromDs(void) const
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:599
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:176
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
bool m_enableNonErpProtection
Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS...
Definition: ap-wifi-mac.h:316
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:126
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
void SetHtSupported(uint8_t htSupported)
Set the HT Supported.
Definition: ht-operation.cc:67
void SetVhtSupported(uint8_t vhtSupported)
Set the VHT supported information element.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
void DoDispose() override
Destructor implementation.
Best Effort.
Definition: qos-utils.h:73
static Mac48Address GetBroadcast(void)
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:306
bool GetErpOfdmSupported(const Mac48Address &address) const
Return whether the station supports ERP OFDM or not.
void SetViTxopLimit(uint16_t txop)
Set the AC_VI TXOP Limit field in the EdcaParameterSet information element.
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:303
std::list< uint8_t > GetBssMembershipSelectorList(void) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1427
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
void SetAddress(Mac48Address address) override
void SetCurrentChannel(uint8_t currentChannel)
Set the Current Channel field in the DsssParameterSet information element.
void Receive(Ptr< WifiMacQueueItem > mpdu) override
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: ap-wifi-mac.cc:919
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:122
bool IsAssocReq(void) const
Return true if the header is an Association Request header.
void TxFailed(uint8_t timeoutReason, Ptr< const WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:905
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:388
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Status code for association response.
Definition: status-code.h:31
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:316
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
Definition: mgt-headers.cc:587
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
void SetTxUnequalModulation(uint8_t txUnequalModulation)
Set the transmit unequal modulation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsData(void) const
Return true if the Type is DATA.
address
Definition: first.py:44
void SetDsssSupported(uint8_t dsssSupported)
Set DSSS supported.
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...
Background.
Definition: qos-utils.h:75
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:892
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: txop.cc:262
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:539
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
void SetUseProtection(uint8_t useProtection)
Set the Use_Protection field in the ErpInformation information element.
bool GetShortPhyPreambleSupported(void) const
Return whether short PHY preamble is supported.
Definition: wifi-phy.cc:771
bool IsProbeReq(void) const
Return true if the header is a Probe Request header.
an EUI-48 address
Definition: mac48-address.h:43
void SetBkAifsn(uint8_t aifsn)
Set the AC_BK AIFSN field in the EdcaParameterSet information element.
bool GetDsssSupported(const Mac48Address &address) const
Return whether the station supports DSSS or not.
bool IsSupportedTxMcs(uint8_t mcs) const
Is RX MCS supported.
bool IsShortPreamble(void) const
Check if the short preamble bit in the capability information field is set to 1.
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:314
void SetTypeOfStation(TypeOfStation type) override
This method is invoked by a subclass to specify what type of station it is implementing.
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:1354
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1199
void SetBeAci(uint8_t aci)
Set the AC_BE ACI field in the EdcaParameterSet information element.
void SetRifsMode(uint8_t rifsMode)
Set the RIFS mode.
Definition: ht-operation.cc:99
void UpdateShortPreambleEnabled(void)
Update whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:233
bool IsGroup(void) const
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
Wi-Fi AP state machineHandle association, dis-association and authentication, of STAs within an infra...
Definition: ap-wifi-mac.h:48
void SetBkAci(uint8_t aci)
Set the AC_BK ACI field in the EdcaParameterSet information element.
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:423
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:517
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:514
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:447
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:318
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:675
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
Voice.
Definition: qos-utils.h:79
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
void SetBkCWmax(uint32_t cwMax)
Set the AC_BK CWmax field in the EdcaParameterSet information element.
void SetBkTxopLimit(uint16_t txop)
Set the AC_BK TXOP Limit field in the EdcaParameterSet information element.
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
bool IsMgt(void) const
Return true if the Type is Management.
void SetObssNonHtStasPresent(uint8_t obssNonHtStasPresent)
Set the OBSS non HT STAs present.
void SetBssColor(uint8_t bssColor)
Set the BSS color.
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:821
void SetTxRxMcsSetUnequal(uint8_t txRxMcsSetUnequal)
Set the transmit / receive MCS set unequal.
void DoInitialize() override
Initialize() implementation.
void SetBkCWmin(uint32_t cwMin)
Set the AC_BK CWmin field in the EdcaParameterSet information element.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:157
uint32_t GetVhtCapabilitiesInfo() const
Return the VHT Capabilities Info field in the VHT Capabilities information element.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:169
bool GetHtSupported() const
Return whether the device supports HT.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:762
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:125
void SetStaChannelWidth(uint8_t staChannelWidth)
Set the STA channel width.
Definition: ht-operation.cc:93
Ssid GetSsid(void) const override
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:307
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
bool IsReassocReq(void) const
Return true if the header is a Reassociation Request header.
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:305
void SetVoTxopLimit(uint16_t txop)
Set the AC_VO TXOP Limit field in the EdcaParameterSet information element.
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:325
void SetDualBeacon(uint8_t dualBeacon)
Set the dual beacon.
void DoInitialize(void) override
Initialize() implementation.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:117
uint8_t GetBufferStatus(uint8_t tid, Mac48Address address) const
Return the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the ...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Mac48Address GetAddress(void) const override
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this Txop is associated to.
Definition: txop.cc:132
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
void SetNoOrder(void)
Unset order bit in the frame control field.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
uint8_t GetNRates(void) const
Return the number of supported rates.
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:308
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:241
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:125
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:563
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
void SetBeCWmax(uint32_t cwMax)
Set the AC_BE CWmax field in the EdcaParameterSet information element.
The HE Operation Information ElementThis class knows how to serialise and deserialise the HE Operatio...
Definition: he-operation.h:35
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Definition: ap-wifi-mac.h:335
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:618
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.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void SetBeAifsn(uint8_t aifsn)
Set the AC_BE AIFSN field in the EdcaParameterSet information element.
void SetFailure(void)
Set success bit to 1 (failure).
Definition: status-code.cc:36
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
void SetNonErpPresent(uint8_t nonErpPresent)
Set the Non_Erp_Present field in the ErpInformation information element.
The IEEE 802.11ax HE Capabilities.
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:137
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:288
void SetBeTxopLimit(uint16_t txop)
Set the AC_BE TXOP Limit field in the EdcaParameterSet information element.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1403
a unique identifier for an interface.
Definition: type-id.h:58
void SetPrimaryChannel(uint8_t ctrl)
Set the Primary Channel field in the HT Operation information element.
Definition: ht-operation.cc:81
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
#define SU_STA_ID
Definition: wifi-mode.h:32
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:834
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
void SetViCWmax(uint32_t cwMax)
Set the AC_VI CWmax field in the EdcaParameterSet information element.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
bool IsShortSlotTime(void) const
Check if the short slot time in the capability information field is set to 1.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
void RecordGotAssocTxOk(Mac48Address address)
Records that we got an ACK for the association response we sent.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Implements the IEEE 802.11 MAC header.
uint16_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
Implement the header for management frames of type reassociation request.
Definition: mgt-headers.h:180
bool IsToDs(void) const
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:750
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1421
bool IsReassocResp(void) const
Return true if the header is a Reassociation Response header.
std::unordered_map< Mac48Address, uint16_t, WifiAddressHash > m_addressIdMap
Maps MAC addresses of associated stations to their association ID.
Definition: ap-wifi-mac.h:311
bool HasData(void) const
Return true if the header type is DATA and is not DATA_NULL.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:146
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
void SetSecondaryChannelOffset(uint8_t secondaryChannelOffset)
Set the secondary channel offset.
Definition: ht-operation.cc:87
void SetChannelWidth(uint8_t channelWidth)
Set the Channel Width field in the VHT Operation information element.
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: txop.cc:274
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.