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