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/random-variable-stream.h"
27 #include "ns3/simulator.h"
28 #include "ns3/yans-wifi-phy.h"
29 #include "ns3/wifi-utils.h"
30 #include "ns3/pointer.h"
31 #include "ns3/double.h"
32 #include "ns3/trace-source-accessor.h"
33 #include "ns3/socket.h"
34 #include "ns3/wifi-net-device.h"
35 #include "ns3/channel-access-manager.h"
36 #include "ns3/mac-tx-middle.h"
37 
38 namespace ns3 {
39 
40 NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
41 
42 NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
43 
44 TypeId
46 {
47  static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
49  .SetGroupName ("Mesh")
50  .AddConstructor<MeshWifiInterfaceMac> ()
51  .AddAttribute ( "BeaconInterval",
52  "Beacon Interval",
53  TimeValue (Seconds (0.5)),
54 
58  )
59  .AddAttribute ( "RandomStart",
60  "Window when beacon generating starts (uniform random) in seconds",
61  TimeValue (Seconds (0.5)),
65  )
66  .AddAttribute ( "BeaconGeneration",
67  "Enable/Disable Beaconing.",
68  BooleanValue (true),
72  )
73  ;
74  return tid;
75 }
77  : m_standard (WIFI_STANDARD_80211a)
78 {
79  NS_LOG_FUNCTION (this);
80 
81  // Let the lower layers know that we are acting as a mesh node
83  m_coefficient = CreateObject<UniformRandomVariable> ();
84 }
86 {
87  NS_LOG_FUNCTION (this);
88 }
89 //-----------------------------------------------------------------------------
90 // WifiMac inherited
91 //-----------------------------------------------------------------------------
92 void
94 {
95  NS_LOG_FUNCTION (this << packet << to << from);
96  ForwardDown (packet, from, to);
97 }
98 void
100 {
101  NS_LOG_FUNCTION (this << packet << to);
102  ForwardDown (packet, GetAddress (), to);
103 }
104 bool
106 {
107  return true;
108 }
109 void
111 {
112  NS_LOG_FUNCTION (this);
114 
115  // The approach taken here is that, from the point of view of a mesh
116  // node, the link is always up, so we immediately invoke the
117  // callback if one is set
118  linkUp ();
119 }
120 void
122 {
123  NS_LOG_FUNCTION (this);
124  m_plugins.clear ();
126 
128 }
129 void
131 {
132  NS_LOG_FUNCTION (this);
134  if (m_beaconEnable)
135  {
136  Time randomStart = Seconds (m_coefficient->GetValue ());
137  // Now start sending beacons after some random delay (to avoid collisions)
140  m_tbtt = Simulator::Now () + randomStart;
141  }
142  else
143  {
144  // stop sending beacons
146  }
147 }
148 
149 int64_t
151 {
152  NS_LOG_FUNCTION (this << stream);
153  int64_t currentStream = stream;
154  m_coefficient->SetStream (currentStream++);
155  for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++)
156  {
157  currentStream += (*i)->AssignStreams (currentStream);
158  }
159  return (currentStream - stream);
160 }
161 
162 //-----------------------------------------------------------------------------
163 // Plugins
164 //-----------------------------------------------------------------------------
165 void
167 {
168  NS_LOG_FUNCTION (this);
169 
170  plugin->SetParent (this);
171  m_plugins.push_back (plugin);
172 }
173 //-----------------------------------------------------------------------------
174 // Switch channels
175 //-----------------------------------------------------------------------------
176 uint16_t
178 {
179  NS_LOG_FUNCTION (this);
180  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
181  return m_phy->GetChannelNumber ();
182 }
183 
184 void
186 {
187  NS_LOG_FUNCTION (this);
188  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
200  m_phy->SetChannelNumber (new_id);
201  // Don't know NAV on new channel
202  m_channelAccessManager->NotifyNavResetNow (Seconds (0));
203 }
204 //-----------------------------------------------------------------------------
205 // Forward frame down
206 //-----------------------------------------------------------------------------
207 void
209 {
210  WifiMacHeader hdr;
212  hdr.SetAddr2 (GetAddress ());
213  hdr.SetAddr3 (to);
214  hdr.SetAddr4 (from);
215  hdr.SetDsFrom ();
216  hdr.SetDsTo ();
217  // Fill QoS fields:
219  hdr.SetQosNoEosp ();
220  hdr.SetQosNoAmsdu ();
221  hdr.SetQosTxopLimit (0);
222  // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
223  hdr.SetAddr1 (Mac48Address ());
224  // Filter packet through all installed plugins
225  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
226  {
227  bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
228  if (drop)
229  {
230  return; // plugin drops frame
231  }
232  }
233  // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
234  NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
235  // Queue frame
236  if (m_stationManager->IsBrandNew (hdr.GetAddr1 ()))
237  {
238  // in adhoc mode, we assume that every destination
239  // supports all the rates we support.
240  for (const auto & mode : m_phy->GetModeList ())
241  {
243  }
245  }
246  // Classify: application may have set a tag, which is removed here
247  AcIndex ac;
248  SocketPriorityTag tag;
249  if (packet->RemovePacketTag (tag))
250  {
251  hdr.SetQosTid (tag.GetPriority ());
252  ac = QosUtilsMapTidToAc (tag.GetPriority ());
253  }
254  else
255  {
256  // No tag found; set to best effort
257  ac = AC_BE;
258  hdr.SetQosTid (0);
259  }
261  m_stats.sentBytes += packet->GetSize ();
262  NS_ASSERT (m_edca.find (ac) != m_edca.end ());
263  m_edca[ac]->Queue (packet, hdr);
264 }
265 void
267 {
268  //Filter management frames:
269  WifiMacHeader header = hdr;
270  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
271  {
272  bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
273  if (drop)
274  {
275  return; // plugin drops frame
276  }
277  }
279  m_stats.sentBytes += packet->GetSize ();
280  if ((m_edca.find (AC_VO) == m_edca.end ()) || (m_edca.find (AC_BK) == m_edca.end ()))
281  {
282  NS_FATAL_ERROR ("Voice or Background queue is not set up!");
283  }
284  /*
285  * When we send a management frame - it is better to enqueue it to
286  * priority queue. But when we send a broadcast management frame,
287  * like PREQ, little MinCw value may cause collisions during
288  * retransmissions (two neighbor stations may choose the same window
289  * size, and two packets will be collided). So, broadcast management
290  * frames go to BK queue.
291  */
292  if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
293  {
294  m_edca[AC_VO]->Queue (packet, header);
295  }
296  else
297  {
298  m_edca[AC_BK]->Queue (packet, header);
299  }
300 }
303 {
304  // set the set of supported rates and make sure that we indicate
305  // the Basic Rate set in this set of supported rates.
306  SupportedRates rates;
307  for (const auto & mode : m_phy->GetModeList ())
308  {
309  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
310  rates.AddSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
311  }
312  // set the basic rates
313  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
314  {
316  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
317  rates.SetBasicRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
318  }
319  return rates;
320 }
321 bool
323 {
324  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
325  {
327  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
328  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1)))
329  {
330  return false;
331  }
332  }
333  return true;
334 }
335 //-----------------------------------------------------------------------------
336 // Beacons
337 //-----------------------------------------------------------------------------
338 void
340 {
341  NS_LOG_FUNCTION (this << interval);
342  m_randomStart = interval;
343 }
344 void
346 {
347  NS_LOG_FUNCTION (this << interval);
348  m_beaconInterval = interval;
349 }
350 Time
352 {
353  return m_beaconInterval;
354 }
355 void
357 {
358  NS_LOG_FUNCTION (this << enable);
359  m_beaconEnable = enable;
360 }
361 bool
363 {
364  return m_beaconSendEvent.IsRunning ();
365 }
366 Time
368 {
369  return m_tbtt;
370 }
371 void
373 {
374  // User of ShiftTbtt () must take care don't shift it to the past
375  NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
376 
377  m_tbtt += shift;
378  // Shift scheduled event
381  this);
382 }
383 void
385 {
388 }
389 void
391 {
392  NS_LOG_FUNCTION (this);
393  NS_LOG_DEBUG (GetAddress () << " is sending beacon");
394 
396 
397  // Form & send beacon
399 
400  // Ask all plugins to add their specific information elements to beacon
401  for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
402  {
403  (*i)->UpdateBeacon (beacon);
404  }
405  m_txop->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
406 
408 }
409 void
411 {
412  const WifiMacHeader* hdr = &mpdu->GetHeader ();
413  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
414  // Process beacon
415  if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
416  {
417  return;
418  }
419  if (hdr->IsBeacon ())
420  {
422  MgtBeaconHeader beacon_hdr;
423 
424  packet->PeekHeader (beacon_hdr);
425 
426  NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
427  << Simulator::Now ().GetMicroSeconds () << " microseconds");
428 
429  // update supported rates
430  if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
431  {
432  SupportedRates rates = beacon_hdr.GetSupportedRates ();
433 
434  for (const auto & mode : m_phy->GetModeList ())
435  {
436  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
437  uint64_t rate = mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1);
438  if (rates.IsSupportedRate (rate))
439  {
440  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
441  if (rates.IsBasicRate (rate))
442  {
444  }
445  }
446  }
447  }
448  }
449  else
450  {
451  m_stats.recvBytes += packet->GetSize ();
453  }
454  // Filter frame through all installed plugins
455  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
456  {
457  bool drop = !((*i)->Receive (packet, *hdr));
458  if (drop)
459  {
460  return; // plugin drops frame
461  }
462  }
463  // Check if QoS tag exists and add it:
464  if (hdr->IsQosData ())
465  {
466  SocketPriorityTag priorityTag;
467  priorityTag.SetPriority (hdr->GetQosTid ());
468  packet->ReplacePacketTag (priorityTag);
469  }
470  // Forward data up
471  if (hdr->IsData ())
472  {
473  ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
474  }
475 
476  // We don't bother invoking RegularWifiMac::Receive() here, because
477  // we've explicitly handled all the frames we care about. This is in
478  // contrast to most classes which derive from RegularWifiMac.
479 }
480 uint32_t
482 {
483  uint32_t metric = 1;
484  if (!m_linkMetricCallback.IsNull ())
485  {
486  metric = m_linkMetricCallback (peerAddress, this);
487  }
488  return metric;
489 }
490 void
492 {
494 }
495 void
497 {
498  m_mpAddress = a;
499 }
502 {
503  return m_mpAddress;
504 }
505 //Statistics:
507  : recvBeacons (0),
508  sentFrames (0),
509  sentBytes (0),
510  recvFrames (0),
511  recvBytes (0)
512 {
513 }
514 void
516 {
517  os << "<Statistics "
519  "rxBeacons=\"" << recvBeacons << "\" "
520  "txFrames=\"" << sentFrames << "\" "
521  "txBytes=\"" << sentBytes << "\" "
522  "rxFrames=\"" << recvFrames << "\" "
523  "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
524 }
525 void
526 MeshWifiInterfaceMac::Report (std::ostream & os) const
527 {
528  os << "<Interface "
529  "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
530  "Channel=\"" << GetFrequencyChannel () << "\" "
531  "Address = \"" << GetAddress () << "\">" << std::endl;
532  m_stats.Print (os);
533  os << "</Interface>" << std::endl;
534 }
535 void
537 {
538  m_stats = Statistics ();
539 }
540 
541 void
543 {
546  m_standard = standard;
547 
548  // We use the single DCF provided by WifiMac for the purpose of
549  // Beacon transmission. For this we need to reconfigure the channel
550  // access parameters slightly, and do so here.
551  m_txop = CreateObject<Txop> ();
553  m_txop->SetWifiMac (this);
555  m_txop->SetMinCw (0);
556  m_txop->SetMaxCw (0);
557  m_txop->SetAifsn (1);
558 }
559 } // namespace ns3
560 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::MeshWifiInterfaceMac::SetLinkUpCallback
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: mesh-wifi-interface-mac.cc:110
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::MeshWifiInterfaceMac::SetLinkMetricCallback
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
Set the link metric callback.
Definition: mesh-wifi-interface-mac.cc:491
ns3::WifiMacHeader::SetQosNoEosp
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
Definition: wifi-mac-header.cc:362
ns3::Packet::ReplacePacketTag
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:970
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#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
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition: wifi-mac-queue-item.cc:66
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::Packet::PeekHeader
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
ns3::WifiMacHeader::IsBeacon
bool IsBeacon(void) const
Return true if the header is a Beacon header.
Definition: wifi-mac-header.cc:705
ns3::WifiMacHeader::IsData
bool IsData(void) const
Return true if the Type is DATA.
Definition: wifi-mac-header.cc:558
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Txop::SetMaxCw
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:173
ns3::Callback< void >
ns3::MeshWifiInterfaceMac::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: mesh-wifi-interface-mac.cc:45
ns3::RegularWifiMac::GetSsid
Ssid GetSsid(void) const override
Definition: regular-wifi-mac.cc:734
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Txop::SetChannelAccessManager
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:122
ns3::WifiMacHeader::SetDsTo
void SetDsTo(void)
Set the To DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:96
ns3::MeshWifiInterfaceMac::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: mesh-wifi-interface-mac.cc:150
ns3::MeshWifiInterfaceMac::GetSupportedRates
SupportedRates GetSupportedRates() const
Definition: mesh-wifi-interface-mac.cc:302
ns3::MeshWifiInterfaceMac::Statistics
Statistics:
Definition: mesh-wifi-interface-mac.h:259
ns3::MeshWifiInterfaceMac::ConfigureStandard
virtual void ConfigureStandard(enum WifiStandard standard)
Finish configuration based on the WifiStandard being provided.
Definition: mesh-wifi-interface-mac.cc:542
ns3::MeshWifiInterfaceMac::SendManagementFrame
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
Definition: mesh-wifi-interface-mac.cc:266
ns3::MeshWifiInterfaceMac::SendBeacon
void SendBeacon()
Send beacon.
Definition: mesh-wifi-interface-mac.cc:390
ns3::MgtProbeResponseHeader::GetSsid
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:202
ns3::MeshWifiInterfaceMac::SetBeaconInterval
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
Definition: mesh-wifi-interface-mac.cc:345
ns3::MeshWifiBeacon::CreateHeader
WifiMacHeader CreateHeader(Mac48Address address, Mac48Address mpAddress)
Create Wifi header for beacon frame.
Definition: mesh-wifi-beacon.cc:56
ns3::WifiPhy::GetChannelNumber
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1199
ns3::MeshWifiInterfaceMac::m_standard
WifiStandard m_standard
Current standard: needed to configure metric.
Definition: mesh-wifi-interface-mac.h:277
ns3::WifiRemoteStationManager::GetNBasicModes
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
Definition: wifi-remote-station-manager.cc:1508
ns3::MeshWifiInterfaceMac::GetMeshPointAddress
Mac48Address GetMeshPointAddress() const
Get the mesh point address.
Definition: mesh-wifi-interface-mac.cc:501
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiMacHeader::GetAddr3
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
Definition: wifi-mac-header.cc:436
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition: wifi-mac-header.cc:424
ns3::WifiMacHeader::SetAddr3
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Definition: wifi-mac-header.cc:120
ns3::MeshWifiInterfaceMac::Statistics::sentFrames
uint32_t sentFrames
sent frames
Definition: mesh-wifi-interface-mac.h:261
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::RegularWifiMac::SetLinkUpCallback
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: regular-wifi-mac.cc:598
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::RegularWifiMac
base class for all MAC-level wifi objects.
Definition: regular-wifi-mac.h:52
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:72
ns3::SupportedRates::SetBasicRate
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
Definition: supported-rates.cc:74
ns3::RegularWifiMac::GetQosSupported
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: regular-wifi-mac.cc:641
ns3::MeshWifiInterfaceMac::m_beaconInterval
Time m_beaconInterval
Beaconing interval.
Definition: mesh-wifi-interface-mac.h:242
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::MeshWifiInterfaceMac::SupportsSendFrom
virtual bool SupportsSendFrom() const
Definition: mesh-wifi-interface-mac.cc:105
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::MeshWifiInterfaceMac::m_linkMetricCallback
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
Definition: mesh-wifi-interface-mac.h:256
ns3::MeshWifiInterfaceMac::m_stats
Statistics m_stats
statistics
Definition: mesh-wifi-interface-mac.h:274
ns3::MeshWifiInterfaceMac::ResetStats
void ResetStats()
Reset statistics function.
Definition: mesh-wifi-interface-mac.cc:536
ns3::MeshWifiBeacon
Beacon is beacon header + list of arbitrary information elements.
Definition: mesh-wifi-beacon.h:41
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
ns3::Txop::SetMinCw
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:161
ns3::RegularWifiMac::GetAddress
Mac48Address GetAddress(void) const override
Definition: regular-wifi-mac.cc:721
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::WifiRemoteStationManager::AddSupportedMode
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...
Definition: wifi-remote-station-manager.cc:335
ns3::SocketPriorityTag::SetPriority
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:842
ns3::SupportedRates::IsSupportedRate
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
Definition: supported-rates.cc:133
ns3::SupportedRates
The Supported Rates Information Element.
Definition: supported-rates.h:96
ns3::Ptr< Packet >
ns3::MeshWifiInterfaceMac::GetBeaconInterval
Time GetBeaconInterval() const
Definition: mesh-wifi-interface-mac.cc:351
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast(void)
Definition: mac48-address.cc:170
ns3::WifiMacHeader::SetQosAckPolicy
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.
Definition: wifi-mac-header.cc:367
ns3::MeshWifiInterfaceMac::Statistics::recvBeacons
uint16_t recvBeacons
receive beacons
Definition: mesh-wifi-interface-mac.h:260
ns3::RegularWifiMac::m_edca
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Definition: regular-wifi-mac.h:241
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::MeshWifiInterfaceMac::Statistics::Print
void Print(std::ostream &os) const
Print statistics.
Definition: mesh-wifi-interface-mac.cc:515
ns3::SocketPriorityTag::GetPriority
uint8_t GetPriority(void) const
Get the tag's priority.
Definition: socket.cc:848
ns3::Time::GetMicroSeconds
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:388
ns3::MeshWifiInterfaceMac::~MeshWifiInterfaceMac
virtual ~MeshWifiInterfaceMac()
D-tor.
Definition: mesh-wifi-interface-mac.cc:85
ns3::Simulator::Cancel
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:268
ns3::MeshWifiInterfaceMac::Statistics::recvFrames
uint32_t recvFrames
receive frames
Definition: mesh-wifi-interface-mac.h:263
ns3::MeshWifiInterfaceMac::Statistics::sentBytes
uint32_t sentBytes
sent bytes
Definition: mesh-wifi-interface-mac.h:262
ns3::QosUtilsMapTidToAc
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:126
ns3::RegularWifiMac::DoDispose
void DoDispose() override
Destructor implementation.
Definition: regular-wifi-mac.cc:83
ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac
MeshWifiInterfaceMac()
C-tor.
Definition: mesh-wifi-interface-mac.cc:76
ns3::ConvertGuardIntervalToNanoSeconds
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Definition: wifi-phy-common.cc:30
ns3::WifiRemoteStationManager::AddBasicMode
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
Definition: wifi-remote-station-manager.cc:1490
ns3::Ssid::IsEqual
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:55
ns3::WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211a
Definition: wifi-standards.h:127
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
ns3::RegularWifiMac::m_txop
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
Definition: regular-wifi-mac.h:233
ns3::MeshWifiInterfaceMac::DoDispose
virtual void DoDispose()
Real d-tor.
Definition: mesh-wifi-interface-mac.cc:121
ns3::AC_BE
@ AC_BE
Best Effort.
Definition: qos-utils.h:73
ns3::WifiMacHeader::NORMAL_ACK
@ NORMAL_ACK
Definition: wifi-mac-header.h:92
ns3::RegularWifiMac::m_stationManager
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
Definition: regular-wifi-mac.h:223
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::AC_BK
@ AC_BK
Background.
Definition: qos-utils.h:75
ns3::WifiMacHeader::IsQosData
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
Definition: wifi-mac-header.cc:565
ns3::MeshWifiBeacon::CreatePacket
Ptr< Packet > CreatePacket()
Create frame = { beacon header + all information elements sorted by ElementId () }.
Definition: mesh-wifi-beacon.cc:47
ns3::MeshWifiInterfaceMac::Statistics::recvBytes
uint32_t recvBytes
receive bytes
Definition: mesh-wifi-interface-mac.h:264
ns3::WifiRemoteStationManager::IsBrandNew
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
Definition: wifi-remote-station-manager.cc:438
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::SupportedRates::IsBasicRate
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
Definition: supported-rates.cc:118
ns3::RegularWifiMac::SetTypeOfStation
void SetTypeOfStation(TypeOfStation type) override
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: regular-wifi-mac.cc:497
ns3::MeshWifiInterfaceMac::GetFrequencyChannel
uint16_t GetFrequencyChannel() const
Current channel Id.
Definition: mesh-wifi-interface-mac.cc:177
ns3::MgtBeaconHeader
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:862
ns3::MeshWifiInterfaceMac::DoInitialize
virtual void DoInitialize()
Initialize() implementation.
Definition: mesh-wifi-interface-mac.cc:130
ns3::WifiMacHeader::SetAddr4
void SetAddr4(Mac48Address address)
Fill the Address 4 field with the given address.
Definition: wifi-mac-header.cc:126
ns3::RegularWifiMac::ForwardUp
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: regular-wifi-mac.cc:795
ns3::WifiPhy::GetDevice
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:783
NS_ABORT_IF
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
ns3::MeshWifiInterfaceMac::Statistics::Statistics
Statistics()
constructor
Definition: mesh-wifi-interface-mac.cc:506
ns3::MeshWifiInterfaceMac::SetBeaconGeneration
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
Definition: mesh-wifi-interface-mac.cc:356
ns3::MeshWifiInterfaceMac::m_randomStart
Time m_randomStart
Maximum delay before first beacon.
Definition: mesh-wifi-interface-mac.h:244
ns3::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition: wifi-mac-header.cc:114
ns3::AC_VO
@ AC_VO
Voice.
Definition: qos-utils.h:79
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition: wifi-mac-header.cc:862
ns3::MeshWifiInterfaceMac::m_beaconSendEvent
EventId m_beaconSendEvent
"Timer" for the next beacon
Definition: mesh-wifi-interface-mac.h:253
ns3::WifiRemoteStationManager::RecordDisassociated
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
Definition: wifi-remote-station-manager.cc:489
ns3::SocketPriorityTag
indicates whether the socket has a priority set.
Definition: socket.h:1309
ns3::RegularWifiMac::ConfigureStandard
void ConfigureStandard(WifiStandard standard) override
Definition: regular-wifi-mac.cc:1145
ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
Definition: mesh-wifi-interface-mac.cc:185
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::Txop::SetWifiMac
virtual void SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:136
ns3::MeshWifiInterfaceMac::ShiftTbtt
void ShiftTbtt(Time shift)
Shift TBTT.
Definition: mesh-wifi-interface-mac.cc:372
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::Packet::Copy
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
ns3::MeshWifiInterfaceMac::m_beaconEnable
bool m_beaconEnable
Beaconing interval.
Definition: mesh-wifi-interface-mac.h:240
ns3::WIFI_MAC_QOSDATA
@ WIFI_MAC_QOSDATA
Definition: wifi-mac-header.h:70
ns3::WifiMacHeader::SetQosTxopLimit
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
Definition: wifi-mac-header.cc:396
ns3::MeshWifiInterfaceMac::GetLinkMetric
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
Definition: mesh-wifi-interface-mac.cc:481
ns3::Packet::RemovePacketTag
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:963
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
ns3::MeshWifiInterfaceMac::m_coefficient
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
Definition: mesh-wifi-interface-mac.h:280
ns3::WifiPhy::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::MeshWifiInterfaceMac::ScheduleNextBeacon
void ScheduleNextBeacon()
Schedule next beacon.
Definition: mesh-wifi-interface-mac.cc:384
ns3::RegularWifiMac::m_txMiddle
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: regular-wifi-mac.h:218
ns3::WifiPhy::GetModeList
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:2015
ns3::RegularWifiMac::m_channelAccessManager
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
Definition: regular-wifi-mac.h:219
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition: wifi-mac-header.cc:132
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::MeshWifiInterfaceMac::m_tbtt
Time m_tbtt
Time for the next frame.
Definition: mesh-wifi-interface-mac.h:246
ns3::MeshWifiInterfaceMac::InstallPlugin
void InstallPlugin(Ptr< MeshWifiInterfaceMacPlugin > plugin)
Install plugin.
Definition: mesh-wifi-interface-mac.cc:166
ns3::MeshWifiInterfaceMac::ForwardDown
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
Definition: mesh-wifi-interface-mac.cc:208
ns3::SupportedRates::AddSupportedRate
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
Definition: supported-rates.cc:59
ns3::RegularWifiMac::m_phy
Ptr< WifiPhy > m_phy
Wifi PHY.
Definition: regular-wifi-mac.h:220
ns3::MeshWifiInterfaceMac::SetMeshPointAddress
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
Definition: mesh-wifi-interface-mac.cc:496
ns3::WifiRemoteStationManager::GetBasicMode
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
Definition: wifi-remote-station-manager.cc:1514
ns3::WifiStandard
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
Definition: wifi-standards.h:126
ns3::WifiMode::GetDataRate
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
ns3::WifiPhy::SetChannelNumber
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1174
ns3::MeshWifiInterfaceMac::Receive
void Receive(Ptr< WifiMacQueueItem > mpdu)
Frame receive handler.
Definition: mesh-wifi-interface-mac.cc:410
ns3::MeshWifiInterfaceMac::SetRandomStartDelay
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
Definition: mesh-wifi-interface-mac.cc:339
ns3::MeshWifiInterfaceMac::Report
void Report(std::ostream &os) const
Report statistics.
Definition: mesh-wifi-interface-mac.cc:526
ns3::Txop::SetTxMiddle
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:129
ns3::MeshWifiInterfaceMacPlugin::SetParent
virtual void SetParent(Ptr< MeshWifiInterfaceMac > parent)=0
Each plugin must be installed on an interface to work.
ns3::MgtProbeResponseHeader::GetSupportedRates
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:214
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition: wifi-mac-header.cc:352
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition: wifi-mac-header.cc:430
ns3::WifiMacHeader::GetAddr4
Mac48Address GetAddr4(void) const
Return the address in the Address 4 field.
Definition: wifi-mac-header.cc:442
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
ns3::Txop::Queue
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:294
ns3::MESH
@ MESH
Definition: wifi-mac.h:45
ns3::WifiMacHeader::SetDsFrom
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:84
ns3::MeshWifiInterfaceMac::Enqueue
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
Definition: mesh-wifi-interface-mac.cc:93
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
ns3::MeshWifiInterfaceMac::GetTbtt
Time GetTbtt() const
Next beacon frame time.
Definition: mesh-wifi-interface-mac.cc:367
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::MeshWifiInterfaceMac::m_mpAddress
Mac48Address m_mpAddress
Mesh point address.
Definition: mesh-wifi-interface-mac.h:250
ns3::MeshWifiInterfaceMac::CheckSupportedRates
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
Definition: mesh-wifi-interface-mac.cc:322
ns3::Txop::SetAifsn
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:247
ns3::MeshWifiInterfaceMac::GetBeaconGeneration
bool GetBeaconGeneration() const
Get current beaconing status.
Definition: mesh-wifi-interface-mac.cc:362
ns3::WifiMacHeader::SetQosNoAmsdu
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
Definition: wifi-mac-header.cc:391
ns3::MeshWifiInterfaceMac
Basic MAC of mesh point Wi-Fi interface.
Definition: mesh-wifi-interface-mac.h:51
ns3::MeshWifiInterfaceMac::m_plugins
PluginList m_plugins
List of all installed plugins.
Definition: mesh-wifi-interface-mac.h:255