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/assert.h"
25 #include "ns3/log.h"
26 #include "ns3/simulator.h"
27 #include "ns3/string.h"
28 #include "ns3/pointer.h"
29 #include "ns3/boolean.h"
30 #include "wifi-phy.h"
31 #include "dcf-manager.h"
32 #include "mac-rx-middle.h"
33 #include "mac-tx-middle.h"
34 #include "mgt-headers.h"
35 #include "mac-low.h"
36 #include "amsdu-subframe-header.h"
37 #include "msdu-aggregator.h"
38 
39 namespace ns3 {
40 
41 NS_LOG_COMPONENT_DEFINE ("ApWifiMac");
42 
43 NS_OBJECT_ENSURE_REGISTERED (ApWifiMac);
44 
45 TypeId
47 {
48  static TypeId tid = TypeId ("ns3::ApWifiMac")
50  .SetGroupName ("Wifi")
51  .AddConstructor<ApWifiMac> ()
52  .AddAttribute ("BeaconInterval",
53  "Delay between two beacons",
54  TimeValue (MicroSeconds (102400)),
57  MakeTimeChecker ())
58  .AddAttribute ("BeaconJitter",
59  "A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
60  "to be distributed between 0 and the BeaconInterval.",
61  StringValue ("ns3::UniformRandomVariable"),
63  MakePointerChecker<UniformRandomVariable> ())
64  .AddAttribute ("EnableBeaconJitter",
65  "If beacons are enabled, whether to jitter the initial send event.",
66  BooleanValue (false),
69  .AddAttribute ("BeaconGeneration",
70  "Whether or not beacons are generated.",
71  BooleanValue (true),
75  .AddAttribute ("EnableNonErpProtection", "Whether or not protection mechanism should be used when non-ERP STAs are present within the BSS."
76  "This parameter is only used when ERP is supported by the AP.",
77  BooleanValue (true),
80  ;
81  return tid;
82 }
83 
85 {
86  NS_LOG_FUNCTION (this);
87  m_beaconDca = CreateObject<DcaTxop> ();
88  m_beaconDca->SetAifsn (1);
89  m_beaconDca->SetMinCw (0);
90  m_beaconDca->SetMaxCw (0);
91  m_beaconDca->SetLow (m_low);
92  m_beaconDca->SetManager (m_dcfManager);
93  m_beaconDca->SetTxMiddle (m_txMiddle);
94 
95  //Let the lower layers know that we are acting as an AP.
97 
99 }
100 
102 {
103  NS_LOG_FUNCTION (this);
104  m_staList.clear();
105  m_nonErpStations.clear ();
106  m_nonHtStations.clear ();
107 }
108 
109 void
111 {
112  NS_LOG_FUNCTION (this);
113  m_beaconDca = 0;
114  m_enableBeaconGeneration = false;
117 }
118 
119 void
121 {
122  NS_LOG_FUNCTION (this << address);
123  //As an AP, our MAC address is also the BSSID. Hence we are
124  //overriding this function and setting both in our parent class.
125  RegularWifiMac::SetAddress (address);
126  RegularWifiMac::SetBssid (address);
127 }
128 
129 void
131 {
132  NS_LOG_FUNCTION (this << enable);
133  if (!enable)
134  {
136  }
137  else if (enable && !m_enableBeaconGeneration)
138  {
140  }
141  m_enableBeaconGeneration = enable;
142 }
143 
144 bool
146 {
147  NS_LOG_FUNCTION (this);
149 }
150 
151 Time
153 {
154  NS_LOG_FUNCTION (this);
155  return m_beaconInterval;
156 }
157 
158 void
160 {
161  NS_LOG_FUNCTION (this << stationManager);
162  m_beaconDca->SetWifiRemoteStationManager (stationManager);
164 }
165 
166 void
168 {
169  NS_LOG_FUNCTION (this << &linkUp);
171 
172  //The approach taken here is that, from the point of view of an AP,
173  //the link is always up, so we immediately invoke the callback if
174  //one is set
175  linkUp ();
176 }
177 
178 void
180 {
181  NS_LOG_FUNCTION (this << interval);
182  if ((interval.GetMicroSeconds () % 1024) != 0)
183  {
184  NS_LOG_WARN ("beacon interval should be multiple of 1024us (802.11 time unit), see IEEE Std. 802.11-2012");
185  }
186  m_beaconInterval = interval;
187 }
188 
189 void
191 {
192  NS_LOG_FUNCTION (this);
193  SendOneBeacon ();
194 }
195 
196 int64_t
197 ApWifiMac::AssignStreams (int64_t stream)
198 {
199  NS_LOG_FUNCTION (this << stream);
200  m_beaconJitter->SetStream (stream);
201  return 1;
202 }
203 
204 bool
206 {
207  if (m_nonErpStations.size () != 0)
208  {
209  return false;
210  }
211  if (m_erpSupported == true && GetShortSlotTimeSupported () == true)
212  {
213  for (std::list<Mac48Address>::const_iterator i = m_staList.begin (); i != m_staList.end (); i++)
214  {
215  if (m_stationManager->GetShortSlotTimeSupported (*i) == false)
216  {
217  return false;
218  }
219  }
220  return true;
221  }
222  return false;
223 }
224 
225 bool
227 {
229  {
230  for (std::list<Mac48Address>::const_iterator i = m_nonErpStations.begin (); i != m_nonErpStations.end (); i++)
231  {
232  if (m_stationManager->GetShortPreambleSupported (*i) == false)
233  {
234  return false;
235  }
236  }
237  return true;
238  }
239  return false;
240 }
241 
242 void
244  Mac48Address to)
245 {
246  NS_LOG_FUNCTION (this << packet << from << to);
247  //If we are not a QoS AP then we definitely want to use AC_BE to
248  //transmit the packet. A TID of zero will map to AC_BE (through \c
249  //QosUtilsMapTidToAc()), so we use that as our default here.
250  uint8_t tid = 0;
251 
252  //If we are a QoS AP then we attempt to get a TID for this packet
253  if (m_qosSupported)
254  {
255  tid = QosUtilsGetTidForPacket (packet);
256  //Any value greater than 7 is invalid and likely indicates that
257  //the packet had no QoS tag, so we revert to zero, which'll
258  //mean that AC_BE is used.
259  if (tid > 7)
260  {
261  tid = 0;
262  }
263  }
264 
265  ForwardDown (packet, from, to, tid);
266 }
267 
268 void
270  Mac48Address to, uint8_t tid)
271 {
272  NS_LOG_FUNCTION (this << packet << from << to << static_cast<uint32_t> (tid));
273  WifiMacHeader hdr;
274 
275  //For now, an AP that supports QoS does not support non-QoS
276  //associations, and vice versa. In future the AP model should
277  //support simultaneously associated QoS and non-QoS STAs, at which
278  //point there will need to be per-association QoS state maintained
279  //by the association state machine, and consulted here.
280  if (m_qosSupported)
281  {
284  hdr.SetQosNoEosp ();
285  hdr.SetQosNoAmsdu ();
286  //Transmission of multiple frames in the same Polled TXOP is not supported for now
287  hdr.SetQosTxopLimit (0);
288  //Fill in the QoS control field in the MAC header
289  hdr.SetQosTid (tid);
290  }
291  else
292  {
293  hdr.SetTypeData ();
294  }
295 
297  {
298  hdr.SetNoOrder ();
299  }
300  hdr.SetAddr1 (to);
301  hdr.SetAddr2 (GetAddress ());
302  hdr.SetAddr3 (from);
303  hdr.SetDsFrom ();
304  hdr.SetDsNotTo ();
305 
306  if (m_qosSupported)
307  {
308  //Sanity check that the TID is valid
309  NS_ASSERT (tid < 8);
310  m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
311  }
312  else
313  {
314  m_dca->Queue (packet, hdr);
315  }
316 }
317 
318 void
320 {
321  NS_LOG_FUNCTION (this << packet << to << from);
322  if (to.IsBroadcast () || m_stationManager->IsAssociated (to))
323  {
324  ForwardDown (packet, from, to);
325  }
326 }
327 
328 void
330 {
331  NS_LOG_FUNCTION (this << packet << to);
332  //We're sending this packet with a from address that is our own. We
333  //get that address from the lower MAC and make use of the
334  //from-spoofing Enqueue() method to avoid duplicated code.
335  Enqueue (packet, to, m_low->GetAddress ());
336 }
337 
338 bool
340 {
341  NS_LOG_FUNCTION (this);
342  return true;
343 }
344 
347 {
348  NS_LOG_FUNCTION (this);
349  SupportedRates rates;
350  //If it is an HT-AP or VHT-AP, then add the BSSMembershipSelectorSet
351  //The standard says that the BSSMembershipSelectorSet
352  //must have its MSB set to 1 (must be treated as a Basic Rate)
353  //Also the standard mentioned that at least 1 element should be included in the SupportedRates the rest can be in the ExtendedSupportedRates
355  {
356  for (uint32_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)
357  {
359  }
360  }
361  //
362  uint8_t nss = 1; // Number of spatial streams is 1 for non-MIMO modes
363  //Send the set of supported rates and make sure that we indicate
364  //the Basic Rate set in this set of supported rates.
365  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
366  {
367  WifiMode mode = m_phy->GetMode (i);
368  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth (), false, nss);
369  NS_LOG_DEBUG ("Adding supported rate of " << modeDataRate);
370  rates.AddSupportedRate (modeDataRate);
371  //Add rates that are part of the BSSBasicRateSet (manufacturer dependent!)
372  //here we choose to add the mandatory rates to the BSSBasicRateSet,
373  //except for 802.11b where we assume that only the non HR-DSSS rates are part of the BSSBasicRateSet
374  if (mode.IsMandatory () && (mode.GetModulationClass () != WIFI_MOD_CLASS_HR_DSSS))
375  {
376  NS_LOG_DEBUG ("Adding basic mode " << mode.GetUniqueName ());
378  }
379  }
380  //set the basic rates
381  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
382  {
384  uint64_t modeDataRate = mode.GetDataRate (m_phy->GetChannelWidth (), false, nss);
385  NS_LOG_DEBUG ("Setting basic rate " << mode.GetUniqueName ());
386  rates.SetBasicRate (modeDataRate);
387  }
388 
389  return rates;
390 }
391 
394 {
395  DsssParameterSet dsssParameters;
396  if (m_dsssSupported)
397  {
398  dsssParameters.SetDsssSupported (1);
399  dsssParameters.SetCurrentChannel (m_phy->GetChannelNumber ());
400  }
401  return dsssParameters;
402 }
403 
406 {
407  CapabilityInformation capabilities;
408  capabilities.SetShortPreamble (GetShortPreambleEnabled ());
409  capabilities.SetShortSlotTime (GetShortSlotTimeEnabled ());
410  return capabilities;
411 }
412 
415 {
416  ErpInformation information;
417  information.SetErpSupported (1);
418  if (m_erpSupported)
419  {
420  information.SetNonErpPresent (!m_nonErpStations.empty ());
421  information.SetUseProtection (GetUseNonErpProtection ());
423  {
424  information.SetBarkerPreambleMode (0);
425  }
426  else
427  {
428  information.SetBarkerPreambleMode (1);
429  }
430  }
431  return information;
432 }
433 
436 {
437  EdcaParameterSet edcaParameters;
438  edcaParameters.SetQosSupported (1);
439  if (m_qosSupported)
440  {
441  Ptr<EdcaTxopN> edca;
442  Time txopLimit;
443 
444  edca = m_edca.find (AC_BE)->second;
445  txopLimit = edca->GetTxopLimit ();
446  edcaParameters.SetBeAci(0);
447  edcaParameters.SetBeCWmin(edca->GetMinCw ());
448  edcaParameters.SetBeCWmax(edca->GetMaxCw ());
449  edcaParameters.SetBeAifsn(edca->GetAifsn ());
450  edcaParameters.SetBeTXOPLimit(txopLimit.GetMicroSeconds () / 32);
451 
452  edca = m_edca.find (AC_BK)->second;
453  txopLimit = edca->GetTxopLimit ();
454  edcaParameters.SetBkAci(1);
455  edcaParameters.SetBkCWmin(edca->GetMinCw ());
456  edcaParameters.SetBkCWmax(edca->GetMaxCw ());
457  edcaParameters.SetBkAifsn(edca->GetAifsn ());
458  edcaParameters.SetBkTXOPLimit(txopLimit.GetMicroSeconds () / 32);
459 
460  edca = m_edca.find (AC_VI)->second;
461  txopLimit = edca->GetTxopLimit ();
462  edcaParameters.SetViAci(2);
463  edcaParameters.SetViCWmin(edca->GetMinCw ());
464  edcaParameters.SetViCWmax(edca->GetMaxCw ());
465  edcaParameters.SetViAifsn(edca->GetAifsn ());
466  edcaParameters.SetViTXOPLimit(txopLimit.GetMicroSeconds () / 32);
467 
468  edca = m_edca.find (AC_VO)->second;
469  txopLimit = edca->GetTxopLimit ();
470  edcaParameters.SetVoAci(3);
471  edcaParameters.SetVoCWmin(edca->GetMinCw ());
472  edcaParameters.SetVoCWmax(edca->GetMaxCw ());
473  edcaParameters.SetVoAifsn(edca->GetAifsn ());
474  edcaParameters.SetVoTXOPLimit(txopLimit.GetMicroSeconds () / 32);
475  }
476  return edcaParameters;
477 }
478 
481 {
482  HtOperations operations;
483  operations.SetHtSupported (1);
484  if (m_htSupported)
485  {
486  if (!m_nonHtStations.empty ())
487  {
489  }
490  else
491  {
492  operations.SetHtProtection (NO_PROTECTION);
493  }
494  }
495  return operations;
496 }
497 
498 void
500 {
501  NS_LOG_FUNCTION (this << to);
502  WifiMacHeader hdr;
503  hdr.SetProbeResp ();
504  hdr.SetAddr1 (to);
505  hdr.SetAddr2 (GetAddress ());
506  hdr.SetAddr3 (GetAddress ());
507  hdr.SetDsNotFrom ();
508  hdr.SetDsNotTo ();
509  Ptr<Packet> packet = Create<Packet> ();
511  probe.SetSsid (GetSsid ());
512  probe.SetSupportedRates (GetSupportedRates ());
513  probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
514  probe.SetCapabilities (GetCapabilities ());
517  if (m_dsssSupported)
518  {
519  probe.SetDsssParameterSet (GetDsssParameterSet ());
520  }
521  if (m_erpSupported)
522  {
523  probe.SetErpInformation (GetErpInformation ());
524  }
525  if (m_qosSupported)
526  {
527  probe.SetEdcaParameterSet (GetEdcaParameterSet ());
528  }
530  {
531  probe.SetHtCapabilities (GetHtCapabilities ());
532  probe.SetHtOperations (GetHtOperations ());
533  hdr.SetNoOrder ();
534  }
535  if (m_vhtSupported)
536  {
537  probe.SetVhtCapabilities (GetVhtCapabilities ());
538  }
539  packet->AddHeader (probe);
540 
541  //The standard is not clear on the correct queue for management
542  //frames if we are a QoS AP. The approach taken here is to always
543  //use the DCF for these regardless of whether we have a QoS
544  //association or not.
545  m_dca->Queue (packet, hdr);
546 }
547 
548 void
550 {
551  NS_LOG_FUNCTION (this << to << success);
552  WifiMacHeader hdr;
553  hdr.SetAssocResp ();
554  hdr.SetAddr1 (to);
555  hdr.SetAddr2 (GetAddress ());
556  hdr.SetAddr3 (GetAddress ());
557  hdr.SetDsNotFrom ();
558  hdr.SetDsNotTo ();
559  Ptr<Packet> packet = Create<Packet> ();
561  StatusCode code;
562  if (success)
563  {
564  code.SetSuccess ();
565  m_staList.push_back (to);
566  }
567  else
568  {
569  code.SetFailure ();
570  }
571  assoc.SetSupportedRates (GetSupportedRates ());
572  assoc.SetStatusCode (code);
573  assoc.SetCapabilities (GetCapabilities ());
574  if (m_erpSupported)
575  {
576  assoc.SetErpInformation (GetErpInformation ());
577  }
578  if (m_qosSupported)
579  {
580  assoc.SetEdcaParameterSet (GetEdcaParameterSet ());
581  }
583  {
584  assoc.SetHtCapabilities (GetHtCapabilities ());
585  assoc.SetHtOperations (GetHtOperations ());
586  hdr.SetNoOrder ();
587  }
588  if (m_vhtSupported)
589  {
590  assoc.SetVhtCapabilities (GetVhtCapabilities ());
591  }
592  packet->AddHeader (assoc);
593 
594  //The standard is not clear on the correct queue for management
595  //frames if we are a QoS AP. The approach taken here is to always
596  //use the DCF for these regardless of whether we have a QoS
597  //association or not.
598  m_dca->Queue (packet, hdr);
599 }
600 
601 void
603 {
604  NS_LOG_FUNCTION (this);
605  WifiMacHeader hdr;
606  hdr.SetBeacon ();
608  hdr.SetAddr2 (GetAddress ());
609  hdr.SetAddr3 (GetAddress ());
610  hdr.SetDsNotFrom ();
611  hdr.SetDsNotTo ();
612  Ptr<Packet> packet = Create<Packet> ();
613  MgtBeaconHeader beacon;
614  beacon.SetSsid (GetSsid ());
615  beacon.SetSupportedRates (GetSupportedRates ());
616  beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ());
617  beacon.SetCapabilities (GetCapabilities ());
620  if (m_dsssSupported)
621  {
622  beacon.SetDsssParameterSet (GetDsssParameterSet ());
623  }
624  if (m_erpSupported)
625  {
626  beacon.SetErpInformation (GetErpInformation ());
627  }
628  if (m_qosSupported)
629  {
630  beacon.SetEdcaParameterSet (GetEdcaParameterSet ());
631  }
633  {
634  beacon.SetHtCapabilities (GetHtCapabilities ());
635  beacon.SetHtOperations (GetHtOperations ());
636  hdr.SetNoOrder ();
637  }
638  if (m_vhtSupported)
639  {
640  beacon.SetVhtCapabilities (GetVhtCapabilities ());
641  }
642  packet->AddHeader (beacon);
643 
644  //The beacon has it's own special queue, so we load it in there
645  m_beaconDca->Queue (packet, hdr);
647 
648  //If a STA that does not support Short Slot Time associates,
649  //the AP shall use long slot time beginning at the first Beacon
650  //subsequent to the association of the long slot time STA.
651  if (m_erpSupported)
652  {
653  if (GetShortSlotTimeEnabled () == true)
654  {
655  //Enable short slot time
656  SetSlot (MicroSeconds (9));
657  }
658  else
659  {
660  //Disable short slot time
661  SetSlot (MicroSeconds (20));
662  }
663  }
664 }
665 
666 void
668 {
669  NS_LOG_FUNCTION (this);
670  RegularWifiMac::TxOk (hdr);
671 
672  if (hdr.IsAssocResp ()
674  {
675  NS_LOG_DEBUG ("associated with sta=" << hdr.GetAddr1 ());
677  }
678 }
679 
680 void
682 {
683  NS_LOG_FUNCTION (this);
685 
686  if (hdr.IsAssocResp ()
688  {
689  NS_LOG_DEBUG ("assoc failed with sta=" << hdr.GetAddr1 ());
691  }
692 }
693 
694 void
696 {
697  NS_LOG_FUNCTION (this << packet << hdr);
698 
699  Mac48Address from = hdr->GetAddr2 ();
700 
701  if (hdr->IsData ())
702  {
703  Mac48Address bssid = hdr->GetAddr1 ();
704  if (!hdr->IsFromDs ()
705  && hdr->IsToDs ()
706  && bssid == GetAddress ()
707  && m_stationManager->IsAssociated (from))
708  {
709  Mac48Address to = hdr->GetAddr3 ();
710  if (to == GetAddress ())
711  {
712  NS_LOG_DEBUG ("frame for me from=" << from);
713  if (hdr->IsQosData ())
714  {
715  if (hdr->IsQosAmsdu ())
716  {
717  NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ());
718  DeaggregateAmsduAndForward (packet, hdr);
719  packet = 0;
720  }
721  else
722  {
723  ForwardUp (packet, from, bssid);
724  }
725  }
726  else
727  {
728  ForwardUp (packet, from, bssid);
729  }
730  }
731  else if (to.IsGroup ()
733  {
734  NS_LOG_DEBUG ("forwarding frame from=" << from << ", to=" << to);
735  Ptr<Packet> copy = packet->Copy ();
736 
737  //If the frame we are forwarding is of type QoS Data,
738  //then we need to preserve the UP in the QoS control
739  //header...
740  if (hdr->IsQosData ())
741  {
742  ForwardDown (packet, from, to, hdr->GetQosTid ());
743  }
744  else
745  {
746  ForwardDown (packet, from, to);
747  }
748  ForwardUp (copy, from, to);
749  }
750  else
751  {
752  ForwardUp (packet, from, to);
753  }
754  }
755  else if (hdr->IsFromDs ()
756  && hdr->IsToDs ())
757  {
758  //this is an AP-to-AP frame
759  //we ignore for now.
760  NotifyRxDrop (packet);
761  }
762  else
763  {
764  //we can ignore these frames since
765  //they are not targeted at the AP
766  NotifyRxDrop (packet);
767  }
768  return;
769  }
770  else if (hdr->IsMgt ())
771  {
772  if (hdr->IsProbeReq ())
773  {
774  NS_ASSERT (hdr->GetAddr1 ().IsBroadcast ());
775  SendProbeResp (from);
776  return;
777  }
778  else if (hdr->GetAddr1 () == GetAddress ())
779  {
780  if (hdr->IsAssocReq ())
781  {
782  //first, verify that the the station's supported
783  //rate set is compatible with our Basic Rate set
784  MgtAssocRequestHeader assocReq;
785  packet->RemoveHeader (assocReq);
786  CapabilityInformation capabilities = assocReq.GetCapabilities ();
788  SupportedRates rates = assocReq.GetSupportedRates ();
789  bool problem = false;
790  bool isHtStation = false;
791  bool isOfdmStation = false;
792  bool isErpStation = false;
793  bool isDsssStation = false;
794  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
795  {
797  uint8_t nss = 1; // Assume 1 spatial stream in basic mode
798  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), false, nss)))
799  {
801  {
802  isDsssStation = false;
803  }
804  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
805  {
806  isErpStation = false;
807  }
808  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
809  {
810  isOfdmStation = false;
811  }
812  if (isDsssStation == false && isErpStation == false && isOfdmStation == false)
813  {
814  problem = true;
815  break;
816  }
817  }
818  else
819  {
821  {
822  isDsssStation = true;
823  }
824  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM)
825  {
826  isErpStation = true;
827  }
828  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
829  {
830  isOfdmStation = true;
831  }
832  }
833  }
834  m_stationManager->AddSupportedErpSlotTime (from, capabilities.IsShortSlotTime () && isErpStation);
835  if (m_htSupported)
836  {
837  //check whether the HT STA supports all MCSs in Basic MCS Set
838  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
839  if (htcapabilities.GetHtCapabilitiesInfo () != 0)
840  {
841  isHtStation = true;
842  for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
843  {
845  if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
846  {
847  problem = true;
848  break;
849  }
850  }
851  }
852  }
853  if (m_vhtSupported)
854  {
855  //check whether the VHT STA supports all MCSs in Basic MCS Set
856  VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
857  if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
858  {
859  for (uint32_t i = 0; i < m_stationManager->GetNBasicMcs (); i++)
860  {
862  if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
863  {
864  problem = true;
865  break;
866  }
867  }
868  }
869  }
870  if (problem)
871  {
872  //One of the Basic Rate set mode is not
873  //supported by the station. So, we return an assoc
874  //response with an error status.
875  SendAssocResp (hdr->GetAddr2 (), false);
876  }
877  else
878  {
879  //station supports all rates in Basic Rate Set.
880  //record all its supported modes in its associated WifiRemoteStation
881  for (uint32_t j = 0; j < m_phy->GetNModes (); j++)
882  {
883  WifiMode mode = m_phy->GetMode (j);
884  uint8_t nss = 1; // Assume 1 spatial stream in basic mode
885  if (rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), false, nss)))
886  {
887  m_stationManager->AddSupportedMode (from, mode);
888  }
889  }
890  if (m_htSupported)
891  {
892  HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
893  m_stationManager->AddStationHtCapabilities (from, htcapabilities);
894  for (uint32_t j = 0; j < m_phy->GetNMcs (); j++)
895  {
896  WifiMode mcs = m_phy->GetMcs (j);
897  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
898  {
899  m_stationManager->AddSupportedMcs (from, mcs);
900  }
901  }
902  }
903  if (m_vhtSupported)
904  {
905  VhtCapabilities vhtCapabilities = assocReq.GetVhtCapabilities ();
906  m_stationManager->AddStationVhtCapabilities (from, vhtCapabilities);
907  for (uint32_t i = 0; i < m_phy->GetNMcs (); i++)
908  {
909  WifiMode mcs = m_phy->GetMcs (i);
910  if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
911  {
912  m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
913  //here should add a control to add basic MCS when it is implemented
914  }
915  }
916  }
918  if (!isHtStation)
919  {
920  m_nonHtStations.push_back (hdr->GetAddr2 ());
921  }
922  if (!isErpStation && isDsssStation)
923  {
924  m_nonErpStations.push_back (hdr->GetAddr2 ());
925  }
926  // send assoc response with success status.
927  SendAssocResp (hdr->GetAddr2 (), true);
928  }
929  return;
930  }
931  else if (hdr->IsDisassociation ())
932  {
934  for (std::list<Mac48Address>::iterator i = m_staList.begin (); i != m_staList.end (); i++)
935  {
936  if ((*i) == from)
937  {
938  m_staList.erase (i);
939  break;
940  }
941  }
942  for (std::list<Mac48Address>::iterator j = m_nonErpStations.begin (); j != m_nonErpStations.end (); j++)
943  {
944  if ((*j) == from)
945  {
946  m_nonErpStations.erase (j);
947  break;
948  }
949  }
950  for (std::list<Mac48Address>::iterator j = m_nonHtStations.begin (); j != m_nonHtStations.end (); j++)
951  {
952  if ((*j) == from)
953  {
954  m_nonHtStations.erase (j);
955  break;
956  }
957  }
958  return;
959  }
960  }
961  }
962 
963  //Invoke the receive handler of our parent class to deal with any
964  //other frames. Specifically, this will handle Block Ack-related
965  //Management Action frames.
966  RegularWifiMac::Receive (packet, hdr);
967 }
968 
969 void
971  const WifiMacHeader *hdr)
972 {
973  NS_LOG_FUNCTION (this << aggregatedPacket << hdr);
975  MsduAggregator::Deaggregate (aggregatedPacket);
976 
977  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
978  i != packets.end (); ++i)
979  {
980  if ((*i).second.GetDestinationAddr () == GetAddress ())
981  {
982  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
983  (*i).second.GetDestinationAddr ());
984  }
985  else
986  {
987  Mac48Address from = (*i).second.GetSourceAddr ();
988  Mac48Address to = (*i).second.GetDestinationAddr ();
989  NS_LOG_DEBUG ("forwarding QoS frame from=" << from << ", to=" << to);
990  ForwardDown ((*i).first, from, to, hdr->GetQosTid ());
991  }
992  }
993 }
994 
995 void
997 {
998  NS_LOG_FUNCTION (this);
999  m_beaconDca->Initialize ();
1000  m_beaconEvent.Cancel ();
1002  {
1004  {
1005  int64_t jitter = m_beaconJitter->GetValue (0, m_beaconInterval.GetMicroSeconds ());
1006  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time " << jitter << " microseconds");
1008  }
1009  else
1010  {
1011  NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress () << " at time 0");
1013  }
1014  }
1016 }
1017 
1018 bool
1020 {
1021  bool useProtection = !m_nonErpStations.empty () && m_enableNonErpProtection;
1022  m_stationManager->SetUseNonErpProtection (useProtection);
1023  return useProtection;
1024 }
1025 
1026 } //namespace ns3
HtOperations GetHtOperations(void) const
Return the HT operations of the current AP.
Definition: ap-wifi-mac.cc:480
virtual void DoInitialize(void)
Initialize() implementation.
Definition: ap-wifi-mac.cc:996
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:268
The HT Operations Information ElementThis class knows how to serialise and deserialise the HT Operati...
Definition: ht-operations.h:54
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:435
uint32_t GetVhtCapabilitiesInfo() const
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:179
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
void SetErpSupported(uint8_t erpSupported)
virtual uint32_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
Definition: wifi-phy.cc:1200
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
bool IsSupportedTxMcs(uint8_t mcs) const
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
Implement the header for management frames of type association request.
Definition: mgt-headers.h:46
#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)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
void SetQosAckPolicy(enum QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
ERP-OFDM PHY (19.5)
Definition: wifi-mode.h:58
AttributeValue implementation for Boolean.
Definition: boolean.h:34
void SetBkCWmin(uint8_t cwMin)
Set the AC_BK CWmin field in the EdcaParameterSet information element.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Hold variables of type string.
Definition: string.h:41
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:197
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:393
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:81
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.
enum WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:379
#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
MacTxMiddle * m_txMiddle
TX middle (aggregation etc.)
#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:792
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
bool IsBroadcast(void) const
void SetSlot(Time slotTime)
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:284
void SetVoTXOPLimit(uint16_t txop)
Set the AC_VO TXOP Limit field in the EdcaParameterSet information element.
virtual 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:2862
void SendAssocResp(Mac48Address to, bool success)
Forward an association response packet to the DCF.
Definition: ap-wifi-mac.cc:549
virtual bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:339
bool IsAssocResp(void) const
Return true if the header is an Association Response header.
VHT PHY (Clause 22)
Definition: wifi-mode.h:64
Ptr< WifiPhy > m_phy
Wifi PHY.
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
Definition: ap-wifi-mac.h:261
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:52
void SetProbeResp(void)
Set Type/Subtype values for a probe response header.
virtual Ssid GetSsid(void) const
virtual Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: edca-txop-n.cc:441
Video.
Definition: qos-utils.h:43
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:45
Best Effort.
Definition: qos-utils.h:39
void SetHtProtection(uint8_t htprotection)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
bool IsMandatory(void) const
Definition: wifi-mode.cc:350
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 capability of the device.
Capability information.
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1206
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...
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: edca-txop-n.cc:434
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:62
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
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:263
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:329
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:481
virtual void SetBssid(Mac48Address bssid)
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:41
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:159
base class for all MAC-level wifi objects.
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:32
virtual uint16_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1329
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:1238
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:349
void SetBeacon(void)
Set Type/Subtype values for a beacon header.
AttributeValue implementation for Time.
Definition: nstime.h:957
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:445
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
The IEEE 802.11ac VHT Capabilities.
static TypeId GetTypeId(void)
Definition: ap-wifi-mac.cc:46
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:243
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.
WifiMode GetBasicMode(uint32_t i) const
Return a basic mode from the set of basic modes.
bool GetShortPreambleEnabled(void) const
Determine whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:226
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:270
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
virtual void SetAddress(Mac48Address address)
void SetBeCWmax(uint8_t cwMax)
Set the AC_BE CWmax field in the EdcaParameterSet information element.
HT PHY (Clause 20)
Definition: wifi-mode.h:62
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:357
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:342
static Mac48Address GetBroadcast(void)
void SetBeCWmin(uint8_t cwMin)
Set the AC_BE CWmin field in the EdcaParameterSet information element.
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:264
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:627
void SetViCWmin(uint8_t cwMin)
Set the AC_VI CWmin field in the EdcaParameterSet information element.
virtual uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:2850
bool IsMgt(void) const
Return true if the Type is Management.
void SetCurrentChannel(uint8_t currentChannel)
Set the Current Channel field in the DsssParameterSet information element.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
uint32_t GetNBasicMcs(void) const
Return the number of basic MCS index.
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the device.
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
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...
Definition: ap-wifi-mac.cc:695
virtual 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...
Definition: ap-wifi-mac.cc:970
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
std::list< Mac48Address > m_staList
List of all stations currently associated to the AP.
Definition: ap-wifi-mac.h:267
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
Status code for association response.
Definition: status-code.h:33
virtual 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:2868
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:237
bool IsWaitAssocTxOk(Mac48Address address) const
Return whether we are waiting for an ACK for the association response we sent.
virtual uint32_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1157
virtual uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: edca-txop-n.cc:420
virtual 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.
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:167
virtual void DoDispose()
Destructor implementation.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:469
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
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
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
DcfManager * m_dcfManager
DCF manager (access to channel)
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 SetHtSupported(uint8_t htsupported)
an EUI-48 address
Definition: mac48-address.h:43
WifiMode GetBasicMcs(uint32_t i) const
Return the MCS at the given list index.
void SetBkAifsn(uint8_t aifsn)
Set the AC_BK AIFSN field in the EdcaParameterSet information element.
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
Definition: wifi-mode.cc:109
bool IsAssociated(Mac48Address address) const
Return whether the station associated.
void SetDsssSupported(uint8_t DsssSupported)
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1401
void SetBkTXOPLimit(uint16_t txop)
Set the AC_BK TXOP Limit field in the EdcaParameterSet information element.
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:958
void SetBeAci(uint8_t aci)
Set the AC_BE ACI field in the EdcaParameterSet information element.
bool GetBeaconGeneration(void) const
Return whether the AP is generating beacons.
Definition: ap-wifi-mac.cc:145
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:47
void SetBkAci(uint8_t aci)
Set the AC_BK ACI field in the EdcaParameterSet information element.
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 response.
Definition: mgt-headers.h:151
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:499
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
void SetAssocResp(void)
Set Type/Subtype values for an association response header.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:346
uint16_t GetHtCapabilitiesInfo(void) const
bool IsShortSlotTime(void) const
Check if the short slot time in the capability information field is set to 1.
uint32_t GetNBasicModes(void) const
Return the number of basic modes we support.
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.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:681
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:602
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
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:228
virtual void DoDispose(void)
Destructor implementation.
Definition: ap-wifi-mac.cc:110
virtual void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:120
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:414
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
virtual Mac48Address GetAddress(void) const
void SetTypeData(void)
Set Type/Subtype values for a data packet with no subtype equal to 0.
OFDM PHY (Clause 17)
Definition: wifi-mode.h:60
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:265
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:405
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
Time m_beaconInterval
Interval between beacons.
Definition: ap-wifi-mac.h:262
void SetVoCWmin(uint8_t cwMin)
Set the AC_VO CWmin field in the EdcaParameterSet information element.
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:268
virtual void DoInitialize()
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:101
bool IsFromDs(void) const
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
virtual uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: edca-txop-n.cc:427
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:911
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
void SetType(enum WifiMacType type)
Set Type/Subtype values with the correct values depending on the given type.
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:266
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:152
void SetVoCWmax(uint8_t cwMax)
Set the AC_VO CWmax field in the EdcaParameterSet information element.
virtual 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.
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:667
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.
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:361
void SetBkCWmax(uint8_t cwMax)
Set the AC_BK CWmax field in the EdcaParameterSet information element.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
virtual bool GetShortPlcpPreambleSupported(void) const
Return whether short PLCP preamble is supported.
Definition: wifi-phy.cc:592
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
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:38
std::list< Mac48Address > m_nonHtStations
List of all non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:269
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:205
void SetNonErpPresent(uint8_t nonErpPresent)
Set the Non_Erp_Present field in the ErpInformation information element.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:457
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:904
void StartBeaconing(void)
Start beacon transmission immediately.
Definition: ap-wifi-mac.cc:190
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:525
void SetViCWmax(uint8_t cwMax)
Set the AC_VI CWmax field in the EdcaParameterSet information element.
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:257
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:50
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:130
virtual WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:2856
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.