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 "ap-wifi-mac.h"
24 #include "ns3/log.h"
25 #include "ns3/simulator.h"
26 #include "ns3/string.h"
27 #include "ns3/pointer.h"
28 #include "mac-low.h"
29 #include "mac-tx-middle.h"
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("ApWifiMac");
34 
35 NS_OBJECT_ENSURE_REGISTERED (ApWifiMac);
36 
37 TypeId
39 {
40  static TypeId tid = TypeId ("ns3::ApWifiMac")
42  .SetGroupName ("Wifi")
43  .AddConstructor<ApWifiMac> ()
44  .AddAttribute ("BeaconInterval",
45  "Delay between two beacons",
46  TimeValue (MicroSeconds (102400)),
49  MakeTimeChecker ())
50  .AddAttribute ("BeaconJitter",
51  "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
52  "to be distributed between 0 and the BeaconInterval.",
53  StringValue ("ns3::UniformRandomVariable"),
55  MakePointerChecker<UniformRandomVariable> ())
56  .AddAttribute ("EnableBeaconJitter",
57  "If beacons are enabled, whether to jitter the initial send event.",
58  BooleanValue (true),
61  .AddAttribute ("BeaconGeneration",
62  "Whether or not beacons are generated.",
63  BooleanValue (true),
67  .AddAttribute ("EnableNonErpProtection", "Whether or not protection mechanism should be used when non-ERP STAs are present within the BSS."
68  "This parameter is only used when ERP is supported by the AP.",
69  BooleanValue (true),
72  .AddAttribute ("RifsMode", "If non-HT STAs are detected, whether to force RIFS to be disabled within the BSS."
73  "This parameter is only used when HT is supported by the AP.",
74  BooleanValue (true),
77  ;
78  return tid;
79 }
80 
82  : m_enableBeaconGeneration (false)
83 {
84  NS_LOG_FUNCTION (this);
85  m_beaconDca = CreateObject<DcaTxop> ();
86  m_beaconDca->SetAifsn (1);
87  m_beaconDca->SetMinCw (0);
88  m_beaconDca->SetMaxCw (0);
89  m_beaconDca->SetLow (m_low);
90  m_beaconDca->SetManager (m_dcfManager);
91  m_beaconDca->SetTxMiddle (m_txMiddle);
92 
93  //Let the lower layers know that we are acting as an AP.
95 }
96 
98 {
99  NS_LOG_FUNCTION (this);
100  m_staList.clear ();
101  m_nonErpStations.clear ();
102  m_nonHtStations.clear ();
103 }
104 
105 void
107 {
108  NS_LOG_FUNCTION (this);
109  m_beaconDca->Dispose ();
110  m_beaconDca = 0;
111  m_enableBeaconGeneration = false;
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION (this << address);
120  //As an AP, our MAC address is also the BSSID. Hence we are
121  //overriding this function and setting both in our parent class.
122  RegularWifiMac::SetAddress (address);
123  RegularWifiMac::SetBssid (address);
124 }
125 
126 void
128 {
129  NS_LOG_FUNCTION (this << enable);
130  if (!enable)
131  {
133  }
134  else if (enable && !m_enableBeaconGeneration)
135  {
137  }
138  m_enableBeaconGeneration = enable;
139 }
140 
141 bool
143 {
144  NS_LOG_FUNCTION (this);
146 }
147 
148 Time
150 {
151  NS_LOG_FUNCTION (this);
152  return m_beaconInterval;
153 }
154 
155 void
157 {
158  NS_LOG_FUNCTION (this << stationManager);
159  m_beaconDca->SetWifiRemoteStationManager (stationManager);
161 }
162 
163 void
165 {
166  NS_LOG_FUNCTION (this << &linkUp);
168 
169  //The approach taken here is that, from the point of view of an AP,
170  //the link is always up, so we immediately invoke the callback if
171  //one is set
172  linkUp ();
173 }
174 
175 void
177 {
178  NS_LOG_FUNCTION (this << interval);
179  if ((interval.GetMicroSeconds () % 1024) != 0)
180  {
181  NS_LOG_WARN ("beacon interval should be multiple of 1024us (802.11 time unit), see IEEE Std. 802.11-2012");
182  }
183  m_beaconInterval = interval;
184 }
185 
186 int64_t
187 ApWifiMac::AssignStreams (int64_t stream)
188 {
189  NS_LOG_FUNCTION (this << stream);
190  m_beaconJitter->SetStream (stream);
191  return 1;
192 }
193 
194 bool
196 {
197  if (m_nonErpStations.size () != 0)
198  {
199  return false;
200  }
201  if (m_erpSupported == true && GetShortSlotTimeSupported () == true)
202  {
203  for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
204  {
205  if (m_stationManager->GetShortSlotTimeSupported (i->second) == false)
206  {
207  return false;
208  }
209  }
210  return true;
211  }
212  return false;
213 }
214 
215 bool
217 {
219  {
220  for (std::list<Mac48Address>::const_iterator i = m_nonErpStations.begin (); i != m_nonErpStations.end (); i++)
221  {
222  if (m_stationManager->GetShortPreambleSupported (*i) == false)
223  {
224  return false;
225  }
226  }
227  return true;
228  }
229  return false;
230 }
231 
232 bool
234 {
235  bool isNonGfHtStasPresent = false;
236  for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
237  {
238  if (m_stationManager->GetGreenfieldSupported (i->second) == false)
239  {
240  isNonGfHtStasPresent = true;
241  break;
242  }
243  }
244  m_stationManager->SetUseGreenfieldProtection (isNonGfHtStasPresent);
245  return isNonGfHtStasPresent;
246 }
247 
248 uint8_t
250 {
251  uint8_t channelWidth = m_phy->GetChannelWidth ();
252  for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
253  {
254  if (m_stationManager->GetVhtSupported (i->second))
255  {
256  if (m_stationManager->GetChannelWidthSupported (i->second) < channelWidth)
257  {
258  channelWidth = m_stationManager->GetChannelWidthSupported (i->second);
259  }
260  }
261  }
262  return channelWidth;
263 }
264 
265 void
267  Mac48Address to)
268 {
269  NS_LOG_FUNCTION (this << packet << from << to);
270  //If we are not a QoS AP then we definitely want to use AC_BE to
271  //transmit the packet. A TID of zero will map to AC_BE (through \c
272  //QosUtilsMapTidToAc()), so we use that as our default here.
273  uint8_t tid = 0;
274 
275  //If we are a QoS AP then we attempt to get a TID for this packet
276  if (m_qosSupported)
277  {
278  tid = QosUtilsGetTidForPacket (packet);
279  //Any value greater than 7 is invalid and likely indicates that
280  //the packet had no QoS tag, so we revert to zero, which'll
281  //mean that AC_BE is used.
282  if (tid > 7)
283  {
284  tid = 0;
285  }
286  }
287 
288  ForwardDown (packet, from, to, tid);
289 }
290 
291 void
293  Mac48Address to, uint8_t tid)
294 {
295  NS_LOG_FUNCTION (this << packet << from << to << +tid);
296  WifiMacHeader hdr;
297 
298  //For now, an AP that supports QoS does not support non-QoS
299  //associations, and vice versa. In future the AP model should
300  //support simultaneously associated QoS and non-QoS STAs, at which
301  //point there will need to be per-association QoS state maintained
302  //by the association state machine, and consulted here.
303  if (m_qosSupported)
304  {
307  hdr.SetQosNoEosp ();
308  hdr.SetQosNoAmsdu ();
309  //Transmission of multiple frames in the same Polled TXOP is not supported for now
310  hdr.SetQosTxopLimit (0);
311  //Fill in the QoS control field in the MAC header
312  hdr.SetQosTid (tid);
313  }
314  else
315  {
316  hdr.SetType (WIFI_MAC_DATA);
317  }
318 
320  {
321  hdr.SetNoOrder ();
322  }
323  hdr.SetAddr1 (to);
324  hdr.SetAddr2 (GetAddress ());
325  hdr.SetAddr3 (from);
326  hdr.SetDsFrom ();
327  hdr.SetDsNotTo ();
328 
329  if (m_qosSupported)
330  {
331  //Sanity check that the TID is valid
332  NS_ASSERT (tid < 8);
333  m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
334  }
335  else
336  {
337  m_dca->Queue (packet, hdr);
338  }
339 }
340 
341 void
343 {
344  NS_LOG_FUNCTION (this << packet << to << from);
345  if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
346  {
347  ForwardDown (packet, from, to);
348  }
349  else
350  {
351  NotifyTxDrop (packet);
352  }
353 }
354 
355 void
357 {
358  NS_LOG_FUNCTION (this << packet << to);
359  //We're sending this packet with a from address that is our own. We
360  //get that address from the lower MAC and make use of the
361  //from-spoofing Enqueue() method to avoid duplicated code.
362  Enqueue (packet, to, m_low->GetAddress ());
363 }
364 
365 bool
367 {
368  NS_LOG_FUNCTION (this);
369  return true;
370 }
371 
374 {
375  NS_LOG_FUNCTION (this);
376  SupportedRates rates;
377  //If it is an HT-AP or VHT-AP or HE-AP, then add the BSSMembershipSelectorSet
378  //The standard says that the BSSMembershipSelectorSet
379  //must have its MSB set to 1 (must be treated as a Basic Rate)
380  //Also the standard mentioned that at least 1 element should be included in the SupportedRates the rest can be in the ExtendedSupportedRates
382  {
383  for (uint8_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
384  {
386  }
387  }
388  //
389  //Send the set of supported rates and make sure that we indicate
390  //the Basic Rate set in this set of supported rates.
391  for (uint8_t i = 0; i < m_phy->GetNModes (); i++)
392  {
393  WifiMode mode = m_phy->GetMode (i);
394  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth ());
395  NS_LOG_DEBUG ("Adding supported rate of " << modeDataRate);
396  rates.AddSupportedRate (modeDataRate);
397  //Add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
398  //here we choose to add the mandatory rates to the BSSBasicRateSet,
399  //except for 802.11b where we assume that only the non HR-DSSS rates are part of the BSSBasicRateSet
400  if (mode.IsMandatory () && (mode.GetModulationClass () != WIFI_MOD_CLASS_HR_DSSS))
401  {
402  NS_LOG_DEBUG ("Adding basic mode " << mode.GetUniqueName ());
404  }
405  }
406  //set the basic rates
407  for (uint8_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
408  {
410  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth ());
411  NS_LOG_DEBUG ("Setting basic rate " << mode.GetUniqueName ());
412  rates.SetBasicRate (modeDataRate);
413  }
414 
415  return rates;
416 }
417 
420 {
421  NS_LOG_FUNCTION (this);
422  DsssParameterSet dsssParameters;
423  if (m_dsssSupported)
424  {
425  dsssParameters.SetDsssSupported (1);
426  dsssParameters.SetCurrentChannel (m_phy->GetChannelNumber ());
427  }
428  return dsssParameters;
429 }
430 
433 {
434  NS_LOG_FUNCTION (this);
435  CapabilityInformation capabilities;
436  capabilities.SetShortPreamble (GetShortPreambleEnabled ());
437  capabilities.SetShortSlotTime (GetShortSlotTimeEnabled ());
438  capabilities.SetEss ();
439  return capabilities;
440 }
441 
444 {
445  NS_LOG_FUNCTION (this);
446  ErpInformation information;
447  information.SetErpSupported (1);
448  if (m_erpSupported)
449  {
450  information.SetNonErpPresent (!m_nonErpStations.empty ());
451  information.SetUseProtection (GetUseNonErpProtection ());
453  {
454  information.SetBarkerPreambleMode (0);
455  }
456  else
457  {
458  information.SetBarkerPreambleMode (1);
459  }
460  }
461  return information;
462 }
463 
466 {
467  NS_LOG_FUNCTION (this);
468  EdcaParameterSet edcaParameters;
469  if (m_qosSupported)
470  {
471  edcaParameters.SetQosSupported (1);
472  Ptr<EdcaTxopN> edca;
473  Time txopLimit;
474 
475  edca = m_edca.find (AC_BE)->second;
476  txopLimit = edca->GetTxopLimit ();
477  edcaParameters.SetBeAci (0);
478  edcaParameters.SetBeCWmin (edca->GetMinCw ());
479  edcaParameters.SetBeCWmax (edca->GetMaxCw ());
480  edcaParameters.SetBeAifsn (edca->GetAifsn ());
481  edcaParameters.SetBeTXOPLimit (txopLimit.GetMicroSeconds () / 32);
482  edcaParameters.SetBeAcm (0);
483 
484  edca = m_edca.find (AC_BK)->second;
485  txopLimit = edca->GetTxopLimit ();
486  edcaParameters.SetBkAci (1);
487  edcaParameters.SetBkCWmin (edca->GetMinCw ());
488  edcaParameters.SetBkCWmax (edca->GetMaxCw ());
489  edcaParameters.SetBkAifsn (edca->GetAifsn ());
490  edcaParameters.SetBkTXOPLimit (txopLimit.GetMicroSeconds () / 32);
491  edcaParameters.SetBkAcm (0);
492 
493  edca = m_edca.find (AC_VI)->second;
494  txopLimit = edca->GetTxopLimit ();
495  edcaParameters.SetViAci (2);
496  edcaParameters.SetViCWmin (edca->GetMinCw ());
497  edcaParameters.SetViCWmax (edca->GetMaxCw ());
498  edcaParameters.SetViAifsn (edca->GetAifsn ());
499  edcaParameters.SetViTXOPLimit (txopLimit.GetMicroSeconds () / 32);
500  edcaParameters.SetViAcm (0);
501 
502  edca = m_edca.find (AC_VO)->second;
503  txopLimit = edca->GetTxopLimit ();
504  edcaParameters.SetVoAci (3);
505  edcaParameters.SetVoCWmin (edca->GetMinCw ());
506  edcaParameters.SetVoCWmax (edca->GetMaxCw ());
507  edcaParameters.SetVoAifsn (edca->GetAifsn ());
508  edcaParameters.SetVoTXOPLimit (txopLimit.GetMicroSeconds () / 32);
509  edcaParameters.SetVoAcm (0);
510 
511  edcaParameters.SetQosInfo (0);
512  }
513  return edcaParameters;
514 }
515 
518 {
519  NS_LOG_FUNCTION (this);
520  HtOperation operation;
521  if (m_htSupported)
522  {
523  operation.SetHtSupported (1);
524  operation.SetRifsMode (GetRifsMode ());
526  if (m_phy->GetChannelWidth () > 20)
527  {
528  operation.SetSecondaryChannelOffset (1);
529  operation.SetStaChannelWidth (1);
530  }
531  if (m_nonHtStations.empty ())
532  {
533  operation.SetHtProtection (NO_PROTECTION);
534  }
535  else
536  {
538  }
539  uint64_t maxSupportedRate = 0; //in bit/s
540  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
541  {
542  WifiMode mcs = m_phy->GetMcs (i);
544  {
545  continue;
546  }
547  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
548  NS_ASSERT (nss > 0 && nss < 5);
549  uint64_t dataRate = mcs.GetDataRate (m_phy->GetChannelWidth (), m_phy->GetShortGuardInterval () ? 400 : 800, nss);
550  if (dataRate > maxSupportedRate)
551  {
552  maxSupportedRate = dataRate;
553  NS_LOG_DEBUG ("Updating maxSupportedRate to " << maxSupportedRate);
554  }
555  }
556  uint8_t maxSpatialStream = m_phy->GetMaxSupportedTxSpatialStreams ();
557  uint8_t nMcs = m_phy->GetNMcs ();
558  for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
559  {
560  if (m_stationManager->GetHtSupported (i->second))
561  {
562  uint64_t maxSupportedRateByHtSta = 0; //in bit/s
563  for (uint8_t j = 0; j < (std::min (nMcs, m_stationManager->GetNMcsSupported (i->second))); j++)
564  {
565  WifiMode mcs = m_phy->GetMcs (j);
567  {
568  continue;
569  }
570  uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
571  NS_ASSERT (nss > 0 && nss < 5);
572  uint64_t dataRate = mcs.GetDataRate (m_stationManager->GetChannelWidthSupported (i->second), m_stationManager->GetShortGuardInterval (i->second) ? 400 : 800, nss);
573  if (dataRate > maxSupportedRateByHtSta)
574  {
575  maxSupportedRateByHtSta = dataRate;
576  }
577  }
578  if (maxSupportedRateByHtSta < maxSupportedRate)
579  {
580  maxSupportedRate = maxSupportedRateByHtSta;
581  }
582  if (m_stationManager->GetNMcsSupported (i->second) < nMcs)
583  {
584  nMcs = m_stationManager->GetNMcsSupported (i->second);
585  }
586  if (m_stationManager->GetNumberOfSupportedStreams (i->second) < maxSpatialStream)
587  {
588  maxSpatialStream = m_stationManager->GetNumberOfSupportedStreams (i->second);
589  }
590  }
591  }
592  operation.SetRxHighestSupportedDataRate (maxSupportedRate / 1e6); //in Mbit/s
593  operation.SetTxMcsSetDefined (nMcs > 0);
594  operation.SetTxMaxNSpatialStreams (maxSpatialStream);
595  //To be filled in once supported
596  operation.SetObssNonHtStasPresent (0);
597  operation.SetDualBeacon (0);
598  operation.SetDualCtsProtection (0);
599  operation.SetStbcBeacon (0);
600  operation.SetLSigTxopProtectionFullSupport (0);
601  operation.SetPcoActive (0);
602  operation.SetPhase (0);
603  operation.SetRxMcsBitmask (0);
604  operation.SetTxRxMcsSetUnequal (0);
605  operation.SetTxUnequalModulation (0);
606  }
607  return operation;
608 }
609 
612 {
613  NS_LOG_FUNCTION (this);
614  VhtOperation operation;
615  if (m_vhtSupported)
616  {
617  operation.SetVhtSupported (1);
618  uint8_t channelWidth = GetVhtOperationalChannelWidth ();
619  if (channelWidth == 160)
620  {
621  operation.SetChannelWidth (2);
622  }
623  else if (channelWidth == 80)
624  {
625  operation.SetChannelWidth (1);
626  }
627  else
628  {
629  operation.SetChannelWidth (0);
630  }
631  for (uint8_t nss = 1; nss <= 8; nss++)
632  {
633  uint8_t maxMcs;
634  if (nss <= m_phy->GetMaxSupportedRxSpatialStreams ())
635  {
636  maxMcs = 9; //TBD: hardcode to 9 for now since we assume all MCS values are supported
637  }
638  else
639  {
640  maxMcs = 0;
641  }
642  operation.SetMaxVhtMcsPerNss (nss, maxMcs);
643  }
644  }
645  return operation;
646 }
647 
650 {
651  NS_LOG_FUNCTION (this);
652  HeOperation operation;
653  if (m_heSupported)
654  {
655  operation.SetHeSupported (1);
656  for (uint8_t nss = 1; nss <= m_phy->GetMaxSupportedRxSpatialStreams (); nss++)
657  {
658  operation.SetMaxHeMcsPerNss (nss, 11); //TBD: hardcode to 11 for now since we assume all MCS values are supported
659  }
660  }
661  return operation;
662 }
663 
664 void
666 {
667  NS_LOG_FUNCTION (this << to);
668  WifiMacHeader hdr;
670  hdr.SetAddr1 (to);
671  hdr.SetAddr2 (GetAddress ());
672  hdr.SetAddr3 (GetAddress ());
673  hdr.SetDsNotFrom ();
674  hdr.SetDsNotTo ();
675  hdr.SetNoOrder ();
676  Ptr<Packet> packet = Create<Packet> ();
678  probe.SetSsid (GetSsid ());
679  probe.SetSupportedRates (GetSupportedRates ());
680  probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
681  probe.SetCapabilities (GetCapabilities ());
684  if (m_dsssSupported)
685  {
686  probe.SetDsssParameterSet (GetDsssParameterSet ());
687  }
688  if (m_erpSupported)
689  {
690  probe.SetErpInformation (GetErpInformation ());
691  }
692  if (m_qosSupported)
693  {
694  probe.SetEdcaParameterSet (GetEdcaParameterSet ());
695  }
697  {
698  probe.SetExtendedCapabilities (GetExtendedCapabilities ());
699  probe.SetHtCapabilities (GetHtCapabilities ());
700  probe.SetHtOperation (GetHtOperation ());
701  }
703  {
704  probe.SetVhtCapabilities (GetVhtCapabilities ());
705  probe.SetVhtOperation (GetVhtOperation ());
706  }
707  if (m_heSupported)
708  {
709  probe.SetHeCapabilities (GetHeCapabilities ());
710  probe.SetHeOperation (GetHeOperation ());
711  }
712  packet->AddHeader (probe);
713 
714  //The standard is not clear on the correct queue for management
715  //frames if we are a QoS AP. The approach taken here is to always
716  //use the DCF for these regardless of whether we have a QoS
717  //association or not.
718  m_dca->Queue (packet, hdr);
719 }
720 
721 void
722 ApWifiMac::SendAssocResp (Mac48Address to, bool success, bool isReassoc)
723 {
724  NS_LOG_FUNCTION (this << to << success << isReassoc);
725  WifiMacHeader hdr;
727  hdr.SetAddr1 (to);
728  hdr.SetAddr2 (GetAddress ());
729  hdr.SetAddr3 (GetAddress ());
730  hdr.SetDsNotFrom ();
731  hdr.SetDsNotTo ();
732  hdr.SetNoOrder ();
733  Ptr<Packet> packet = Create<Packet> ();
735  StatusCode code;
736  if (success)
737  {
738  code.SetSuccess ();
739  uint16_t aid;
740  bool found = false;
741  if (isReassoc)
742  {
743  for (std::map<uint16_t, Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); ++i)
744  {
745  if (i->second == to)
746  {
747  aid = i->first;
748  found = true;
749  break;
750  }
751  }
752  }
753  if (!found)
754  {
755  aid = GetNextAssociationId ();
756  m_staList.insert (std::make_pair (aid, to));
757  }
758  assoc.SetAssociationId (aid);
759  }
760  else
761  {
762  code.SetFailure ();
763  }
764  assoc.SetSupportedRates (GetSupportedRates ());
765  assoc.SetStatusCode (code);
766  assoc.SetCapabilities (GetCapabilities ());
767  if (m_erpSupported)
768  {
769  assoc.SetErpInformation (GetErpInformation ());
770  }
771  if (m_qosSupported)
772  {
773  assoc.SetEdcaParameterSet (GetEdcaParameterSet ());
774  }
776  {
777  assoc.SetExtendedCapabilities (GetExtendedCapabilities ());
778  assoc.SetHtCapabilities (GetHtCapabilities ());
779  assoc.SetHtOperation (GetHtOperation ());
780  }
782  {
783  assoc.SetVhtCapabilities (GetVhtCapabilities ());
784  assoc.SetVhtOperation (GetVhtOperation ());
785  }
786  if (m_heSupported)
787  {
788  assoc.SetHeCapabilities (GetHeCapabilities ());
789  assoc.SetHeOperation (GetHeOperation ());
790  }
791  packet->AddHeader (assoc);
792 
793  //The standard is not clear on the correct queue for management
794  //frames if we are a QoS AP. The approach taken here is to always
795  //use the DCF for these regardless of whether we have a QoS
796  //association or not.
797  m_dca->Queue (packet, hdr);
798 }
799 
800 void
802 {
803  NS_LOG_FUNCTION (this);
804  WifiMacHeader hdr;
807  hdr.SetAddr2 (GetAddress ());
808  hdr.SetAddr3 (GetAddress ());
809  hdr.SetDsNotFrom ();
810  hdr.SetDsNotTo ();
811  hdr.SetNoOrder ();
812  Ptr<Packet> packet = Create<Packet> ();
813  MgtBeaconHeader beacon;
814  beacon.SetSsid (GetSsid ());
815  beacon.SetSupportedRates (GetSupportedRates ());
816  beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
817  beacon.SetCapabilities (GetCapabilities ());
820  if (m_dsssSupported)
821  {
822  beacon.SetDsssParameterSet (GetDsssParameterSet ());
823  }
824  if (m_erpSupported)
825  {
826  beacon.SetErpInformation (GetErpInformation ());
827  }
828  if (m_qosSupported)
829  {
830  beacon.SetEdcaParameterSet (GetEdcaParameterSet ());
831  }
833  {
834  beacon.SetExtendedCapabilities (GetExtendedCapabilities ());
835  beacon.SetHtCapabilities (GetHtCapabilities ());
836  beacon.SetHtOperation (GetHtOperation ());
837  }
839  {
840  beacon.SetVhtCapabilities (GetVhtCapabilities ());
841  beacon.SetVhtOperation (GetVhtOperation ());
842  }
843  if (m_heSupported)
844  {
845  beacon.SetHeCapabilities (GetHeCapabilities ());
846  beacon.SetHeOperation (GetHeOperation ());
847  }
848  packet->AddHeader (beacon);
849 
850  //The beacon has it's own special queue, so we load it in there
851  m_beaconDca->Queue (packet, hdr);
853 
854  //If a STA that does not support Short Slot Time associates,
855  //the AP shall use long slot time beginning at the first Beacon
856  //subsequent to the association of the long slot time STA.
857  if (m_erpSupported)
858  {
859  if (GetShortSlotTimeEnabled () == true)
860  {
861  //Enable short slot time
862  SetSlot (MicroSeconds (9));
863  }
864  else
865  {
866  //Disable short slot time
867  SetSlot (MicroSeconds (20));
868  }
869  }
870 }
871 
872 void
874 {
875  NS_LOG_FUNCTION (this);
876  RegularWifiMac::TxOk (hdr);
877  if ((hdr.IsAssocResp () || hdr.IsReassocResp ())
879  {
880  NS_LOG_DEBUG ("associated with sta=" << hdr.GetAddr1 ());
882  }
883 }
884 
885 void
887 {
888  NS_LOG_FUNCTION (this);
890 
891  if ((hdr.IsAssocResp () || hdr.IsReassocResp ())
893  {
894  NS_LOG_DEBUG ("association failed with sta=" << hdr.GetAddr1 ());
896  }
897 }
898 
899 void
901 {
902  NS_LOG_FUNCTION (this << packet << hdr);
903  Mac48Address from = hdr->GetAddr2 ();
904  if (hdr->IsData ())
905  {
906  Mac48Address bssid = hdr->GetAddr1 ();
907  if (!hdr->IsFromDs ()
908  && hdr->IsToDs ()
909  && bssid == GetAddress ()
910  && m_stationManager->IsAssociated (from))
911  {
912  Mac48Address to = hdr->GetAddr3 ();
913  if (to == GetAddress ())
914  {
915  NS_LOG_DEBUG ("frame for me from=" << from);
916  if (hdr->IsQosData ())
917  {
918  if (hdr->IsQosAmsdu ())
919  {
920  NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ());
921  DeaggregateAmsduAndForward (packet, hdr);
922  packet = 0;
923  }
924  else
925  {
926  ForwardUp (packet, from, bssid);
927  }
928  }
929  else
930  {
931  ForwardUp (packet, from, bssid);
932  }
933  }
934  else if (to.IsGroup ()
936  {
937  NS_LOG_DEBUG ("forwarding frame from=" << from << ", to=" << to);
938  Ptr<Packet> copy = packet->Copy ();
939 
940  //If the frame we are forwarding is of type QoS Data,
941  //then we need to preserve the UP in the QoS control
942  //header...
943  if (hdr->IsQosData ())
944  {
945  ForwardDown (packet, from, to, hdr->GetQosTid ());
946  }
947  else
948  {
949  ForwardDown (packet, from, to);
950  }
951  ForwardUp (copy, from, to);
952  }
953  else
954  {
955  ForwardUp (packet, from, to);
956  }
957  }
958  else if (hdr->IsFromDs ()
959  && hdr->IsToDs ())
960  {
961  //this is an AP-to-AP frame
962  //we ignore for now.
963  NotifyRxDrop (packet);
964  }
965  else
966  {
967  //we can ignore these frames since
968  //they are not targeted at the AP
969  NotifyRxDrop (packet);
970  }
971  return;
972  }
973  else if (hdr->IsMgt ())
974  {
975  if (hdr->IsProbeReq ())
976  {
977  NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
978  NS_LOG_DEBUG ("Probe request received from " << from << ": send probe response");
979  SendProbeResp (from);
980  return;
981  }
982  else if (hdr->GetAddr1 () == GetAddress ())
983  {
984  if (hdr->IsAssocReq ())
985  {
986  NS_LOG_DEBUG ("Association request received from " << from);
987  //first, verify that the the station's supported
988  //rate set is compatible with our Basic Rate set
989  MgtAssocRequestHeader assocReq;
990  packet->RemoveHeader (assocReq);
991  CapabilityInformation capabilities = assocReq.GetCapabilities ();
993  SupportedRates rates = assocReq.GetSupportedRates ();
994  bool problem = false;
995  bool isHtStation = false;
996  bool isOfdmStation = false;
997  bool isErpStation = false;
998  bool isDsssStation = false;
999  for (uint8_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
1000  {
1002  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1003  {
1005  {
1006  isDsssStation = false;
1007  }
1008  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1009  {
1010  isErpStation = false;
1011  }
1012  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
1013  {
1014  isOfdmStation = false;
1015  }
1016  if (isDsssStation == false && isErpStation == false && isOfdmStation == false)
1017  {
1018  problem = true;
1019  break;
1020  }
1021  }
1022  else
1023  {
1025  {
1026  isDsssStation = true;
1027  }
1028  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1029  {
1030  isErpStation = true;
1031  }
1032  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
1033  {
1034  isOfdmStation = true;
1035  }
1036  }
1037  }
1038  m_stationManager->AddSupportedErpSlotTime (from, capabilities.IsShortSlotTime () && isErpStation);
1039  if (m_htSupported)
1040  {
1041  //check whether the HT STA supports all MCSs in Basic MCS Set
1042  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
1043  if (htcapabilities.IsSupportedMcs (0))
1044  {
1045  isHtStation = true;
1046  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1047  {
1049  if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1050  {
1051  problem = true;
1052  break;
1053  }
1054  }
1055  }
1056  }
1057  if (m_vhtSupported)
1058  {
1059  //check whether the VHT STA supports all MCSs in Basic MCS Set
1060  VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
1061  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
1062  {
1063  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1064  {
1066  if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1067  {
1068  problem = true;
1069  break;
1070  }
1071  }
1072  }
1073  }
1074  if (m_heSupported)
1075  {
1076  //check whether the HE STA supports all MCSs in Basic MCS Set
1077  HeCapabilities hecapabilities = assocReq.GetHeCapabilities ();
1078  if (hecapabilities.GetSupportedMcsAndNss () != 0)
1079  {
1080  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1081  {
1083  if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1084  {
1085  problem = true;
1086  break;
1087  }
1088  }
1089  }
1090  }
1091  if (problem)
1092  {
1093  NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send association response with an error status");
1094  SendAssocResp (hdr->GetAddr2 (), false, false);
1095  }
1096  else
1097  {
1098  NS_LOG_DEBUG ("The Basic Rate set modes are supported by the station");
1099  //record all its supported modes in its associated WifiRemoteStation
1100  for (uint8_t j = 0; j < m_phy->GetNModes (); j++)
1101  {
1102  WifiMode mode = m_phy->GetMode (j);
1103  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1104  {
1105  m_stationManager->AddSupportedMode (from, mode);
1106  }
1107  }
1108  if (m_htSupported)
1109  {
1110  HtCapabilities htCapabilities = assocReq.GetHtCapabilities ();
1111  if (htCapabilities.IsSupportedMcs (0))
1112  {
1113  m_stationManager->AddStationHtCapabilities (from, htCapabilities);
1114  }
1115  }
1116  if (m_vhtSupported)
1117  {
1118  VhtCapabilities vhtCapabilities = assocReq.GetVhtCapabilities ();
1119  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
1120  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
1121  {
1122  m_stationManager->AddStationVhtCapabilities (from, vhtCapabilities);
1123  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
1124  {
1125  WifiMode mcs = m_phy->GetMcs (i);
1126  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1127  {
1128  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1129  //here should add a control to add basic MCS when it is implemented
1130  }
1131  }
1132  }
1133  }
1135  {
1136  ExtendedCapabilities extendedCapabilities = assocReq.GetExtendedCapabilities ();
1137  //TODO: to be completed
1138  }
1139  if (m_heSupported)
1140  {
1141  HeCapabilities heCapabilities = assocReq.GetHeCapabilities ();
1142  //todo: once we support non constant rate managers, we should add checks here whether HE is supported by the peer
1143  m_stationManager->AddStationHeCapabilities (from, heCapabilities);
1144  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
1145  {
1146  WifiMode mcs = m_phy->GetMcs (i);
1147  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HE && heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1148  {
1149  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1150  //here should add a control to add basic MCS when it is implemented
1151  }
1152  }
1153  }
1155  if (!isHtStation)
1156  {
1157  m_nonHtStations.push_back (hdr->GetAddr2 ());
1158  m_nonHtStations.unique ();
1159  }
1160  if (!isErpStation && isDsssStation)
1161  {
1162  m_nonErpStations.push_back (hdr->GetAddr2 ());
1163  m_nonErpStations.unique ();
1164  }
1165  NS_LOG_DEBUG ("Send association response with success status");
1166  SendAssocResp (hdr->GetAddr2 (), true, false);
1167  }
1168  return;
1169  }
1170  else if (hdr->IsReassocReq ())
1171  {
1172  NS_LOG_DEBUG ("Reassociation request received from " << from);
1173  //first, verify that the the station's supported
1174  //rate set is compatible with our Basic Rate set
1175  MgtReassocRequestHeader reassocReq;
1176  packet->RemoveHeader (reassocReq);
1177  CapabilityInformation capabilities = reassocReq.GetCapabilities ();
1179  SupportedRates rates = reassocReq.GetSupportedRates ();
1180  bool problem = false;
1181  bool isHtStation = false;
1182  bool isOfdmStation = false;
1183  bool isErpStation = false;
1184  bool isDsssStation = false;
1185  for (uint8_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
1186  {
1188  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1189  {
1191  {
1192  isDsssStation = false;
1193  }
1194  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1195  {
1196  isErpStation = false;
1197  }
1198  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
1199  {
1200  isOfdmStation = false;
1201  }
1202  if (isDsssStation == false && isErpStation == false && isOfdmStation == false)
1203  {
1204  problem = true;
1205  break;
1206  }
1207  }
1208  else
1209  {
1211  {
1212  isDsssStation = true;
1213  }
1214  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
1215  {
1216  isErpStation = true;
1217  }
1218  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
1219  {
1220  isOfdmStation = true;
1221  }
1222  }
1223  }
1224  m_stationManager->AddSupportedErpSlotTime (from, capabilities.IsShortSlotTime () && isErpStation);
1225  if (m_htSupported)
1226  {
1227  //check whether the HT STA supports all MCSs in Basic MCS Set
1228  HtCapabilities htcapabilities = reassocReq.GetHtCapabilities ();
1229  if (htcapabilities.IsSupportedMcs (0))
1230  {
1231  isHtStation = true;
1232  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1233  {
1235  if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
1236  {
1237  problem = true;
1238  break;
1239  }
1240  }
1241  }
1242  }
1243  if (m_vhtSupported)
1244  {
1245  //check whether the VHT STA supports all MCSs in Basic MCS Set
1246  VhtCapabilities vhtcapabilities = reassocReq.GetVhtCapabilities ();
1247  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
1248  {
1249  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1250  {
1252  if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1253  {
1254  problem = true;
1255  break;
1256  }
1257  }
1258  }
1259  }
1260  if (m_heSupported)
1261  {
1262  //check whether the HE STA supports all MCSs in Basic MCS Set
1263  HeCapabilities hecapabilities = reassocReq.GetHeCapabilities ();
1264  if (hecapabilities.GetSupportedMcsAndNss () != 0)
1265  {
1266  for (uint8_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
1267  {
1269  if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1270  {
1271  problem = true;
1272  break;
1273  }
1274  }
1275  }
1276  }
1277  if (problem)
1278  {
1279  NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send reassociation response with an error status");
1280  SendAssocResp (hdr->GetAddr2 (), false, true);
1281  }
1282  else
1283  {
1284  NS_LOG_DEBUG ("The Basic Rate set modes are supported by the station");
1285  //update all its supported modes in its associated WifiRemoteStation
1286  for (uint8_t j = 0; j < m_phy->GetNModes (); j++)
1287  {
1288  WifiMode mode = m_phy->GetMode (j);
1289  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth ())))
1290  {
1291  m_stationManager->AddSupportedMode (from, mode);
1292  }
1293  }
1294  if (m_htSupported)
1295  {
1296  HtCapabilities htCapabilities = reassocReq.GetHtCapabilities ();
1297  if (htCapabilities.IsSupportedMcs (0))
1298  {
1299  m_stationManager->AddStationHtCapabilities (from, htCapabilities);
1300  }
1301  }
1302  if (m_vhtSupported)
1303  {
1304  VhtCapabilities vhtCapabilities = reassocReq.GetVhtCapabilities ();
1305  //we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used to check whether it supports VHT
1306  if (vhtCapabilities.GetRxHighestSupportedLgiDataRate () > 0)
1307  {
1308  m_stationManager->AddStationVhtCapabilities (from, vhtCapabilities);
1309  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
1310  {
1311  WifiMode mcs = m_phy->GetMcs (i);
1312  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1313  {
1314  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1315  //here should add a control to add basic MCS when it is implemented
1316  }
1317  }
1318  }
1319  }
1321  {
1322  ExtendedCapabilities extendedCapabilities = reassocReq.GetExtendedCapabilities ();
1323  //TODO: to be completed
1324  }
1325  if (m_heSupported)
1326  {
1327  HeCapabilities heCapabilities = reassocReq.GetHeCapabilities ();
1328  //todo: once we support non constant rate managers, we should add checks here whether HE is supported by the peer
1329  m_stationManager->AddStationHeCapabilities (from, heCapabilities);
1330  for (uint8_t i = 0; i < m_phy->GetNMcs (); i++)
1331  {
1332  WifiMode mcs = m_phy->GetMcs (i);
1333  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HE && heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
1334  {
1335  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
1336  //here should add a control to add basic MCS when it is implemented
1337  }
1338  }
1339  }
1341  if (!isHtStation)
1342  {
1343  m_nonHtStations.push_back (hdr->GetAddr2 ());
1344  m_nonHtStations.unique ();
1345  }
1346  if (!isErpStation && isDsssStation)
1347  {
1348  m_nonErpStations.push_back (hdr->GetAddr2 ());
1349  m_nonErpStations.unique ();
1350  }
1351  NS_LOG_DEBUG ("Send reassociation response with success status");
1352  SendAssocResp (hdr->GetAddr2 (), true, true);
1353  }
1354  return;
1355  }
1356  else if (hdr->IsDisassociation ())
1357  {
1358  NS_LOG_DEBUG ("Disassociation received from " << from);
1360  for (std::map<uint16_t, Mac48Address>::const_iterator j = m_staList.begin (); j != m_staList.end (); j++)
1361  {
1362  if (j->second == from)
1363  {
1364  m_staList.erase (j);
1365  break;
1366  }
1367  }
1368  for (std::list<Mac48Address>::const_iterator j = m_nonErpStations.begin (); j != m_nonErpStations.end (); j++)
1369  {
1370  if ((*j) == from)
1371  {
1372  m_nonErpStations.erase (j);
1373  break;
1374  }
1375  }
1376  for (std::list<Mac48Address>::const_iterator j = m_nonHtStations.begin (); j != m_nonHtStations.end (); j++)
1377  {
1378  if ((*j) == from)
1379  {
1380  m_nonHtStations.erase (j);
1381  break;
1382  }
1383  }
1384  return;
1385  }
1386  }
1387  }
1388 
1389  //Invoke the receive handler of our parent class to deal with any
1390  //other frames. Specifically, this will handle Block Ack-related
1391  //Management Action frames.
1392  RegularWifiMac::Receive (packet, hdr);
1393 }
1394 
1395 void
1397 {
1398  NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
1400  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
1401  i != packets.end (); ++i)
1402  {
1403  if ((*i).second.GetDestinationAddr () == GetAddress ())
1404  {
1405  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
1406  (*i).second.GetDestinationAddr ());
1407  }
1408  else
1409  {
1410  Mac48Address from = (*i).second.GetSourceAddr ();
1411  Mac48Address to = (*i).second.GetDestinationAddr ();
1412  NS_LOG_DEBUG ("forwarding QoS frame from=" << from << ", to=" << to);
1413  ForwardDown ((*i).first, from, to, hdr->GetQosTid ());
1414  }
1415  }
1416 }
1417 
1418 void
1420 {
1421  NS_LOG_FUNCTION (this);
1422  m_beaconDca->Initialize ();
1423  m_beaconEvent.Cancel ();
1425  {
1427  {
1428  int64_t jitter = m_beaconJitter->GetValue (0, m_beaconInterval.GetMicroSeconds ());
1429  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time " << jitter << " microseconds");
1431  }
1432  else
1433  {
1434  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time 0");
1436  }
1437  }
1439 }
1440 
1441 bool
1443 {
1444  bool useProtection = !m_nonErpStations.empty () && m_enableNonErpProtection;
1445  m_stationManager->SetUseNonErpProtection (useProtection);
1446  return useProtection;
1447 }
1448 
1449 bool
1451 {
1452  bool rifsMode = false;
1453  if (m_htSupported && !m_vhtSupported) //RIFS mode is forbidden for VHT
1454  {
1455  if (m_nonHtStations.empty () || !m_disableRifs)
1456  {
1457  rifsMode = true;
1458  }
1459  }
1460  if (GetRifsSupported () && rifsMode)
1461  {
1463  }
1464  else
1465  {
1467  }
1468  return rifsMode;
1469 }
1470 
1471 uint16_t
1473 {
1474  //Return the first free AID value between 1 and 2007
1475  for (uint16_t nextAid = 1; nextAid <= 2007; nextAid++)
1476  {
1477  if (m_staList.find (nextAid) == m_staList.end ())
1478  {
1479  return nextAid;
1480  }
1481  }
1482  NS_ASSERT_MSG (false, "No free association ID available!");
1483  return 0;
1484 }
1485 
1486 } //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
void SetRxHighestSupportedDataRate(uint16_t maxsupportedrate)
Set the receive highest supported data rate.
void DoInitialize(void)
Initialize() implementation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
Ptr< DcfManager > m_dcfManager
DCF manager (access to channel)
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:465
uint32_t GetVhtCapabilitiesInfo() const
Return the VHT Capabilties Info field in the VHT Capabilities information element.
bool GetVhtSupported(Mac48Address address) const
Return whether the station supports VHT or not.
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1482
uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: dca-txop.cc:201
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:305
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:176
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
void SetErpSupported(uint8_t erpSupported)
Set the ERP supported field.
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:728
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
bool IsSupportedTxMcs(uint8_t mcs) const
Get the is transmit MCS supported.
bool GetShortGuardInterval(Mac48Address address) const
Return whether the station supports HT/VHT short guard interval.
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
void SetHeSupported(uint8_t hesupported)
Set the HE supported information element.
Definition: he-operation.cc:47
void SetViAcm(uint8_t acm)
Set the AC_VI ACM field in the EdcaParameterSet information element.
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 SetStream(int64_t stream)
Specifies the stream number for the RngStream.
bool GetGreenfieldSupported(Mac48Address address) const
Return whether the station supports Greenfield or not.
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:54
AttributeValue implementation for Boolean.
Definition: boolean.h:36
void SetViCWmin(uint32_t cwMin)
Set the AC_VI CWmin field in the EdcaParameterSet information element.
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 ...
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
bool m_disableRifs
Flag whether to force RIFS to be disabled within the BSS If non-HT STAs are detected.
Definition: ap-wifi-mac.h:309
void SetBeAcm(uint8_t acm)
Set the AC_BE ACM field in the EdcaParameterSet information element.
Hold variables of type string.
Definition: string.h:41
#define min(a, b)
Definition: 80211b.c:44
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:187
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:788
void RecordWaitAssocTxOk(Mac48Address address)
Records that we are waiting for an ACK for the association response we sent.
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:419
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
void SetTxMaxNSpatialStreams(uint8_t maxtxspatialstreams)
Set the transmit maximum number spatial streams.
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.
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1331
WifiMode GetBasicMcs(uint8_t i) const
Return the MCS at the given list index.
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
void SetSecondaryChannelOffset(uint8_t secondarychanneloffset)
Set the secondary channel offset.
Definition: ht-operation.cc:87
#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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
bool IsAssocReq(void) const
Return true if the header is an Association Request header.
void SetVoAifsn(uint8_t aifsn)
Set the AC_VO AIFSN field in the EdcaParameterSet information element.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:821
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
DeaggregatedMsdusCI typedef.
bool IsBroadcast(void) const
void SetSlot(Time slotTime)
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:621
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:283
void SetVoTXOPLimit(uint16_t txop)
Set the AC_VO TXOP Limit field in the EdcaParameterSet information element.
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:52
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:207
void SetPhase(uint8_t pcophase)
Set the PCO phase.
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
uint8_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:249
bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:366
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.
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
Definition: ap-wifi-mac.h:299
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:48
void SetHtProtection(uint8_t htprotection)
Set the HT protection.
uint16_t GetNextAssociationId(void)
Ssid GetSsid(void) const
void SetVoCWmin(uint32_t cwMin)
Set the AC_VO CWmin field in the EdcaParameterSet information element.
Video.
Definition: qos-utils.h:45
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.
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 IsMandatory(void) const
Definition: wifi-mode.cc:458
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.
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.
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
void SetStaChannelWidth(uint8_t stachannelwidth)
Set the STA channel width.
Definition: ht-operation.cc:93
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:649
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:301
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:722
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:156
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:356
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void SetVhtSupported(uint8_t vhtsupported)
Set the VHT supported information element.
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:602
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:91
void SetViAifsn(uint8_t aifsn)
Set the AC_VI AIFSN field in the EdcaParameterSet information element.
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Background.
Definition: qos-utils.h:43
void SetDualBeacon(uint8_t dualbeacon)
Set the dual beacon.
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dca-txop.cc:213
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
Definition: mgt-headers.cc:776
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
void SetTxUnequalModulation(uint8_t txunequalmodulation)
Set the transmit unequal modulation.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
base class for all MAC-level wifi objects.
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
bool IsReassocReq(void) const
Return true if the header is a Reassociation Request header.
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
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:220
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.
void SetBeTXOPLimit(uint16_t txop)
Set the AC_BE TXOP Limit field in the EdcaParameterSet information element.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:363
void SetEss(void)
Set the Extended Service Set (ESS) bit in the capability information field.
AttributeValue implementation for Time.
Definition: nstime.h:1069
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:542
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
void SetVoCWmax(uint32_t cwMax)
Set the AC_VO CWmax field in the EdcaParameterSet information element.
The IEEE 802.11ac VHT Capabilities.
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:38
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.
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:266
void SetBeCWmin(uint32_t cwMin)
Set the AC_BE CWmin field in the EdcaParameterSet information element.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:554
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 GetRifsMode(void) const
Return whether RIFS is allowed in the BSS.
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:143
bool GetShortPreambleEnabled(void) const
Determine whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:216
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.
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:308
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
void SetAddress(Mac48Address address)
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
HT PHY (Clause 20)
Definition: wifi-mode.h:58
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:465
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:450
static Mac48Address GetBroadcast(void)
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:302
uint8_t GetChannelWidthSupported(Mac48Address address) const
Return the channel width supported by the station.
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:365
void SetRxMcsBitmask(uint8_t index)
Set the receive MCS bitmask.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities hecapabilities)
Records HE capabilities of the remote station.
bool IsMgt(void) const
Return true if the Type is Management.
bool m_heSupported
This Boolean is set true iff this WifiMac is to model 802.11ax.
uint16_t GetSupportedMcsAndNss() const
Return the MCS and NSS field in the HE Capabilities information element.
void SetCurrentChannel(uint8_t currentChannel)
Set the Current Channel field in the DsssParameterSet information element.
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:517
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
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...
Definition: ap-wifi-mac.cc:900
void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
Status code for association response.
Definition: status-code.h:31
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
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:320
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
void SetLinkUpCallback(Callback< void > linkUp)
void AddBssMembershipSelectorRate(uint32_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:164
virtual void DoDispose()
Destructor implementation.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:578
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
bool IsToDs(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsDisassociation(void) const
Return true if the header is a Disassociation header.
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.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
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.
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.
void SetTxRxMcsSetUnequal(uint8_t txrxmcssetunequal)
Set the transmit / receive MCS set unequal.
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 IsAssociated(Mac48Address address) const
Return whether the station associated.
void SetDsssSupported(uint8_t DsssSupported)
Set DSSS supported.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1564
void SetBkTXOPLimit(uint16_t txop)
Set the AC_BK TXOP Limit field in the EdcaParameterSet information element.
void SetStbcBeacon(uint8_t stbcbeacon)
Set the STBC beacon.
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
void SetBeAci(uint8_t aci)
Set the AC_BE ACI field in the EdcaParameterSet information element.
bool IsNonGfHtStasPresent(void) const
Determine whether non-Greenfield HT stations are present or not.
Definition: ap-wifi-mac.cc:233
bool GetBeaconGeneration(void) const
Return whether the AP is generating beacons.
Definition: ap-wifi-mac.cc:142
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities.
Definition: mgt-headers.cc:740
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:43
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void SetBkAci(uint8_t aci)
Set the AC_BK ACI field in the EdcaParameterSet information element.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1313
void SetVoAcm(uint8_t acm)
Set the AC_VO ACM field in the EdcaParameterSet information element.
void SetDualCtsProtection(uint8_t dualctsprotection)
Set the dual CTS protection.
void AddSupportedPlcpPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PLCP preamble is supported by the station.
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:317
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
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:665
uint8_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1280
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:373
void SetPcoActive(uint8_t pcoactive)
Set the PCO active.
bool IsShortSlotTime(void) const
Check if the short slot time in the capability information field is set to 1.
void SetBkCWmax(uint32_t cwMax)
Set the AC_BK CWmax field in the EdcaParameterSet information element.
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
bool GetShortSlotTimeSupported(Mac48Address address) const
Return whether the station supports short ERP slot time or not.
uint8_t GetNBasicMcs(void) const
Return the number of basic MCS index.
void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:886
void SetNonGfHtStasPresent(uint8_t nongfhtstaspresent)
Set the non GF HT STAs present.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:764
bool IsData(void) const
Return true if the Type is DATA.
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:801
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
void SetBkCWmin(uint32_t cwMin)
Set the AC_BK CWmin field in the EdcaParameterSet information element.
void AddSupportedErpSlotTime(Mac48Address address, bool isShortSlotTimeSupported)
Record whether the short ERP slot time is supported by the station.
void SetViTXOPLimit(uint16_t txop)
Set the AC_VI TXOP Limit field in the EdcaParameterSet information element.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
void DoDispose(void)
Destructor implementation.
Definition: ap-wifi-mac.cc:106
void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:117
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:443
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
Mac48Address GetAddress(void) const
OFDM PHY (Clause 17)
Definition: wifi-mode.h:56
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:303
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:432
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
Time m_beaconInterval
Interval between beacons.
Definition: ap-wifi-mac.h:300
bool IsSupportedTxMcs(uint8_t mcs) const
Is transmit MCS supported.
void SetUseGreenfieldProtection(bool enable)
Enable or disable protection for stations that do not support HT greenfield format.
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:306
void SetObssNonHtStasPresent(uint8_t obssnonhtstaspresent)
Set the OBSS non HT STAs present.
virtual void DoInitialize()
Initialize() implementation.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:752
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:97
bool IsFromDs(void) const
void SetLSigTxopProtectionFullSupport(uint8_t lsigtxopprotectionfullsupport)
Set the LSIG TXOP protection full support.
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
void SetRifsMode(uint8_t rifsmode)
Set the RIFS mode.
Definition: ht-operation.cc:99
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
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...
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:304
bool GetHtSupported(Mac48Address address) const
Return whether the station supports HT or not.
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:149
bool GetShortSlotTimeSupported(void) const
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
tuple address
Definition: first.py:37
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:873
bool GetRifsSupported(void) const
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:487
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PLCP 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:37
void SetHtSupported(uint8_t htsupported)
Set the HT Supported.
Definition: ht-operation.cc:67
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.
void SetTxMcsSetDefined(uint8_t txmcssetdefined)
Set the transmit MCS set defined.
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
std::list< Mac48Address > m_nonHtStations
List of all non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:307
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:195
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
void SetNonErpPresent(uint8_t nonErpPresent)
Set the Non_Erp_Present field in the ErpInformation information element.
The IEEE 802.11ax HE Capabilities.
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:611
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:566
uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: dca-txop.cc:195
a unique identifier for an interface.
Definition: type-id.h:58
bool m_dsssSupported
This Boolean is set true iff this WifiMac is to model 802.11b.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:827
void SetViCWmax(uint32_t cwMax)
Set the AC_VI CWmax field in the EdcaParameterSet information element.
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities.
Definition: mgt-headers.cc:590
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
HE PHY (Clause 26)
Definition: wifi-mode.h:62
void SetRifsPermitted(bool allow)
Permit or prohibit RIFS.
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
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtcapabilities)
Records VHT capabilities of the remote station.
Implements the IEEE 802.11 MAC header.
DSSS PHY (Clause 15)
Definition: wifi-mode.h:46
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetBkAcm(uint8_t acm)
Set the AC_BK ACM field in the EdcaParameterSet information element.
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
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:127
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.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
bool GetShortPreambleSupported(Mac48Address address) const
Return whether the station supports short PLCP preamble or not.
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.