A Discrete-Event Network Simulator
API
mesh-wifi-interface-mac.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Kirill Andreev <andreev@iitp.ru>
19  * Pavel Boyko <boyko@iitp.ru>
20  */
21 
22 #include "ns3/mesh-wifi-interface-mac.h"
23 #include "ns3/mesh-wifi-beacon.h"
24 #include "ns3/log.h"
25 #include "ns3/boolean.h"
26 #include "ns3/wifi-phy.h"
27 #include "ns3/dcf-manager.h"
28 #include "ns3/mac-rx-middle.h"
29 #include "ns3/mac-low.h"
30 #include "ns3/dca-txop.h"
31 #include "ns3/random-variable-stream.h"
32 #include "ns3/simulator.h"
33 #include "ns3/yans-wifi-phy.h"
34 #include "ns3/wifi-utils.h"
35 #include "ns3/pointer.h"
36 #include "ns3/double.h"
37 #include "ns3/trace-source-accessor.h"
38 #include "ns3/socket.h"
39 
40 namespace ns3 {
41 
42 NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
43 
44 NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
45 
46 TypeId
48 {
49  static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
51  .SetGroupName ("Mesh")
52  .AddConstructor<MeshWifiInterfaceMac> ()
53  .AddAttribute ( "BeaconInterval",
54  "Beacon Interval",
55  TimeValue (Seconds (0.5)),
56 
60  )
61  .AddAttribute ( "RandomStart",
62  "Window when beacon generating starts (uniform random) in seconds",
63  TimeValue (Seconds (0.5)),
67  )
68  .AddAttribute ( "BeaconGeneration",
69  "Enable/Disable Beaconing.",
70  BooleanValue (true),
74  )
75  ;
76  return tid;
77 }
79  : m_standard (WIFI_PHY_STANDARD_80211a)
80 {
81  NS_LOG_FUNCTION (this);
82 
83  // Let the lower layers know that we are acting as a mesh node
85  m_coefficient = CreateObject<UniformRandomVariable> ();
86 }
88 {
89  NS_LOG_FUNCTION (this);
90 }
91 //-----------------------------------------------------------------------------
92 // WifiMac inherited
93 //-----------------------------------------------------------------------------
94 void
96 {
97  NS_LOG_FUNCTION (this << packet << to << from);
98  ForwardDown (packet, from, to);
99 }
100 void
102 {
103  NS_LOG_FUNCTION (this << packet << to);
104  ForwardDown (packet, m_low->GetAddress (), to);
105 }
106 bool
108 {
109  return true;
110 }
111 void
113 {
114  NS_LOG_FUNCTION (this);
116 
117  // The approach taken here is that, from the point of view of a mesh
118  // node, the link is always up, so we immediately invoke the
119  // callback if one is set
120  linkUp ();
121 }
122 void
124 {
125  NS_LOG_FUNCTION (this);
126  m_plugins.clear ();
128 
130 }
131 void
133 {
134  NS_LOG_FUNCTION (this);
136  if (m_beaconEnable)
137  {
138  Time randomStart = Seconds (m_coefficient->GetValue ());
139  // Now start sending beacons after some random delay (to avoid collisions)
142  m_tbtt = Simulator::Now () + randomStart;
143  }
144  else
145  {
146  // stop sending beacons
148  }
149 }
150 
151 int64_t
153 {
154  NS_LOG_FUNCTION (this << stream);
155  int64_t currentStream = stream;
156  m_coefficient->SetStream (currentStream++);
157  for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++)
158  {
159  currentStream += (*i)->AssignStreams (currentStream);
160  }
161  return (currentStream - stream);
162 }
163 
164 //-----------------------------------------------------------------------------
165 // Plugins
166 //-----------------------------------------------------------------------------
167 void
169 {
170  NS_LOG_FUNCTION (this);
171 
172  plugin->SetParent (this);
173  m_plugins.push_back (plugin);
174 }
175 //-----------------------------------------------------------------------------
176 // Switch channels
177 //-----------------------------------------------------------------------------
178 uint16_t
180 {
181  NS_LOG_FUNCTION (this);
182  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
183 
185  if (phy != 0)
186  {
187  return phy->GetChannelNumber ();
188  }
189  else
190  {
191  return 0;
192  }
193 }
194 void
196 {
197  NS_LOG_FUNCTION (this);
198  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
211  phy->SetChannelNumber (new_id);
212  // Don't know NAV on new channel
214 }
215 //-----------------------------------------------------------------------------
216 // Forward frame down
217 //-----------------------------------------------------------------------------
218 void
220 {
221  // copy packet to allow modifications
222  Ptr<Packet> packet = const_packet->Copy ();
223  WifiMacHeader hdr;
225  hdr.SetAddr2 (GetAddress ());
226  hdr.SetAddr3 (to);
227  hdr.SetAddr4 (from);
228  hdr.SetDsFrom ();
229  hdr.SetDsTo ();
230  // Fill QoS fields:
232  hdr.SetQosNoEosp ();
233  hdr.SetQosNoAmsdu ();
234  hdr.SetQosTxopLimit (0);
235  // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
236  hdr.SetAddr1 (Mac48Address ());
237  // Filter packet through all installed plugins
238  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
239  {
240  bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
241  if (drop)
242  {
243  return; // plugin drops frame
244  }
245  }
246  // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
247  NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
248  // Queue frame
249  if (m_stationManager->IsBrandNew (hdr.GetAddr1 ()))
250  {
251  // in adhoc mode, we assume that every destination
252  // supports all the rates we support.
253  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
254  {
256  }
258  }
259  // Classify: application may have set a tag, which is removed here
260  AcIndex ac;
261  SocketPriorityTag tag;
262  if (packet->RemovePacketTag (tag))
263  {
264  hdr.SetQosTid (tag.GetPriority ());
265  ac = QosUtilsMapTidToAc (tag.GetPriority ());
266  }
267  else
268  {
269  // No tag found; set to best effort
270  ac = AC_BE;
271  hdr.SetQosTid (0);
272  }
274  m_stats.sentBytes += packet->GetSize ();
275  NS_ASSERT (m_edca.find (ac) != m_edca.end ());
276  m_edca[ac]->Queue (packet, hdr);
277 }
278 void
280 {
281  //Filter management frames:
282  WifiMacHeader header = hdr;
283  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
284  {
285  bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
286  if (drop)
287  {
288  return; // plugin drops frame
289  }
290  }
292  m_stats.sentBytes += packet->GetSize ();
293  if ((m_edca.find (AC_VO) == m_edca.end ()) || (m_edca.find (AC_BK) == m_edca.end ()))
294  {
295  NS_FATAL_ERROR ("Voice or Background queue is not set up!");
296  }
297  /*
298  * When we send a management frame - it is better to enqueue it to
299  * priority queue. But when we send a broadcast management frame,
300  * like PREQ, little MinCw value may cause collisions during
301  * retransmissions (two neighbor stations may choose the same window
302  * size, and two packets will be collided). So, broadcast management
303  * frames go to BK queue.
304  */
305  if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
306  {
307  m_edca[AC_VO]->Queue (packet, header);
308  }
309  else
310  {
311  m_edca[AC_BK]->Queue (packet, header);
312  }
313 }
316 {
317  // set the set of supported rates and make sure that we indicate
318  // the Basic Rate set in this set of supported rates.
319  SupportedRates rates;
320  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
321  {
322  WifiMode mode = m_phy->GetMode (i);
324  rates.AddSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
325  }
326  // set the basic rates
327  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
328  {
331  rates.SetBasicRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
332  }
333  return rates;
334 }
335 bool
337 {
338  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
339  {
342  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1)))
343  {
344  return false;
345  }
346  }
347  return true;
348 }
349 //-----------------------------------------------------------------------------
350 // Beacons
351 //-----------------------------------------------------------------------------
352 void
354 {
355  NS_LOG_FUNCTION (this << interval);
356  m_randomStart = interval;
357 }
358 void
360 {
361  NS_LOG_FUNCTION (this << interval);
362  m_beaconInterval = interval;
363 }
364 Time
366 {
367  return m_beaconInterval;
368 }
369 void
371 {
372  NS_LOG_FUNCTION (this << enable);
373  m_beaconEnable = enable;
374 }
375 bool
377 {
378  return m_beaconSendEvent.IsRunning ();
379 }
380 Time
382 {
383  return m_tbtt;
384 }
385 void
387 {
388  // User of ShiftTbtt () must take care don't shift it to the past
389  NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
390 
391  m_tbtt += shift;
392  // Shift scheduled event
395  this);
396 }
397 void
399 {
402 }
403 void
405 {
406  NS_LOG_FUNCTION (this);
407  NS_LOG_DEBUG (GetAddress () << " is sending beacon");
408 
410 
411  // Form & send beacon
413 
414  // Ask all plugins to add their specific information elements to beacon
415  for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
416  {
417  (*i)->UpdateBeacon (beacon);
418  }
419  m_dca->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
420 
422 }
423 void
425 {
426  // Process beacon
427  if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
428  {
429  return;
430  }
431  if (hdr->IsBeacon ())
432  {
434  MgtBeaconHeader beacon_hdr;
435 
436  packet->PeekHeader (beacon_hdr);
437 
438  NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
439  << Simulator::Now ().GetMicroSeconds () << " microseconds");
440 
441  // update supported rates
442  if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
443  {
444  SupportedRates rates = beacon_hdr.GetSupportedRates ();
445 
446  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
447  {
448  WifiMode mode = m_phy->GetMode (i);
450  uint64_t rate = mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1);
451  if (rates.IsSupportedRate (rate))
452  {
453  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
454  if (rates.IsBasicRate (rate))
455  {
457  }
458  }
459  }
460  }
461  }
462  else
463  {
464  m_stats.recvBytes += packet->GetSize ();
466  }
467  // Filter frame through all installed plugins
468  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
469  {
470  bool drop = !((*i)->Receive (packet, *hdr));
471  if (drop)
472  {
473  return; // plugin drops frame
474  }
475  }
476  // Check if QoS tag exists and add it:
477  if (hdr->IsQosData ())
478  {
479  SocketPriorityTag priorityTag;
480  priorityTag.SetPriority (hdr->GetQosTid ());
481  packet->ReplacePacketTag (priorityTag);
482  }
483  // Forward data up
484  if (hdr->IsData ())
485  {
486  ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
487  }
488 
489  // We don't bother invoking RegularWifiMac::Receive() here, because
490  // we've explicitly handled all the frames we care about. This is in
491  // contrast to most classes which derive from RegularWifiMac.
492 }
493 uint32_t
495 {
496  uint32_t metric = 1;
497  if (!m_linkMetricCallback.IsNull ())
498  {
499  metric = m_linkMetricCallback (peerAddress, this);
500  }
501  return metric;
502 }
503 void
505 {
507 }
508 void
510 {
511  m_mpAddress = a;
512 }
515 {
516  return m_mpAddress;
517 }
518 //Statistics:
520  : recvBeacons (0),
521  sentFrames (0),
522  sentBytes (0),
523  recvFrames (0),
524  recvBytes (0)
525 {
526 }
527 void
529 {
530  os << "<Statistics "
532  "rxBeacons=\"" << recvBeacons << "\" "
533  "txFrames=\"" << sentFrames << "\" "
534  "txBytes=\"" << sentBytes << "\" "
535  "rxFrames=\"" << recvFrames << "\" "
536  "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
537 }
538 void
539 MeshWifiInterfaceMac::Report (std::ostream & os) const
540 {
541  os << "<Interface "
542  "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
543  "Channel=\"" << GetFrequencyChannel () << "\" "
544  "Address = \"" << GetAddress () << "\">" << std::endl;
545  m_stats.Print (os);
546  os << "</Interface>" << std::endl;
547 }
548 void
550 {
551  m_stats = Statistics ();
552 }
553 
554 void
556 {
558  m_standard = standard;
559 
560  // We use the single DCF provided by WifiMac for the purpose of
561  // Beacon transmission. For this we need to reconfigure the channel
562  // access parameters slightly, and do so here.
563  m_dca->SetMinCw (0);
564  m_dca->SetMaxCw (0);
565  m_dca->SetAifsn (1);
566 }
569 {
570  return m_standard;
571 }
572 } // namespace ns3
573 
bool IsBeacon(void) const
Return true if the header is a Beacon header.
Ptr< DcfManager > m_dcfManager
DCF manager (access to channel)
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1496
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:197
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:185
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
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
bool m_beaconEnable
whether beaconing is enabled
SupportedRates GetSupportedRates() const
WifiPhyStandard GetPhyStandard() const
Get phy standard in use.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval)
Convert the guard interval to nanoseconds based on the wifimode.
Definition: wifi-utils.cc:60
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
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.
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
virtual void DoDispose()
Real d-tor.
Mac48Address GetAddr4(void) const
Return the address in the Address 4 field.
#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 SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:796
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:637
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:346
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:65
Ptr< WifiPhy > m_phy
Wifi PHY.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:72
Ssid GetSsid(void) const
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Voice.
Definition: qos-utils.h:47
Best Effort.
Definition: qos-utils.h:41
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
WifiPhyStandard m_standard
Current PHY standard: needed to configure metric.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
Time GetTbtt() const
Next beacon frame time.
void ResetStats()
Reset statistics.
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
void NotifyNavResetNow(Time duration)
Definition: dcf-manager.cc:701
void ScheduleNextBeacon()
Schedule next beacon.
virtual void DoInitialize()
Initialize() implementation.
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Background.
Definition: qos-utils.h:43
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:341
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
base class for all MAC-level wifi objects.
tuple phy
Definition: third.py:86
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.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:349
AttributeValue implementation for Time.
Definition: nstime.h:1055
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 SetAddr4(Mac48Address address)
Fill the Address 4 field with the given address.
void FinishConfigureStandard(WifiPhyStandard standard)
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:143
WifiMode GetBasicMode(uint32_t i) const
Return a basic mode from the set of basic modes.
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:828
indicates whether the socket has a priority set.
Definition: socket.h:1303
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
Time GetGuardInterval(void) const
Definition: wifi-phy.cc:651
static Mac48Address GetBroadcast(void)
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:529
uint16_t GetFrequencyChannel() const
Current channel Id.
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)
Finish configuration based on the WifiPhyStandard being provided.
bool GetBeaconGeneration() const
Get current beaconing status.
uint32_t GetLinkMetric(Mac48Address peerAddress)
PluginList m_plugins
List of all installed plugins.
uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3541
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
Mac48Address GetMeshPointAddress() const
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.
virtual bool SupportsSendFrom() const
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:277
Mac48Address m_mpAddress
Mesh point address.
void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
802.11 PHY layer modelThis PHY implements a model of 802.11a.
Definition: yans-wifi-phy.h:47
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...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
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...
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Time m_beaconInterval
Beaconing interval.
an EUI-48 address
Definition: mac48-address.h:43
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1442
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:1056
void Receive(Ptr< Packet > packet, WifiMacHeader const *hdr)
Frame receive handler.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
Time m_randomStart
Maximum delay before first beacon.
uint8_t GetPriority(void) const
Get the tag's priority.
Definition: socket.cc:854
Beacon is beacon header + list of arbitrary information elements.
static TypeId GetTypeId()
Get the type ID.
virtual void SetLinkUpCallback(Callback< void > linkUp)
uint8_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1304
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
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.
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
bool IsData(void) const
Return true if the Type is DATA.
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
void InstallPlugin(Ptr< MeshWifiInterfaceMacPlugin > plugin)
Install plugin.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:821
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
Mac48Address GetAddress(void) const
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:993
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
void Report(std::ostream &) const
Statistics:
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
void SetDsTo(void)
Set the To DS bit in the Frame Control field.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
EventId m_beaconSendEvent
"Timer" for the next beacon
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
void Print(std::ostream &os) const
Print statistics.
Time m_tbtt
Time for the next frame.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void ShiftTbtt(Time shift)
Shift TBTT.
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.
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:848
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
Basic MAC of mesh point Wi-Fi interface.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:602
virtual void SetParent(Ptr< MeshWifiInterfaceMac > parent)=0
Each plugin must be installed on an interface to work.
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3547
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.