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 
37 namespace ns3 {
38 
39 NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
40 
41 NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
42 
43 TypeId
45 {
46  static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
48  .SetGroupName ("Mesh")
49  .AddConstructor<MeshWifiInterfaceMac> ()
50  .AddAttribute ( "BeaconInterval",
51  "Beacon Interval",
52  TimeValue (Seconds (0.5)),
53 
57  )
58  .AddAttribute ( "RandomStart",
59  "Window when beacon generating starts (uniform random) in seconds",
60  TimeValue (Seconds (0.5)),
64  )
65  .AddAttribute ( "BeaconGeneration",
66  "Enable/Disable Beaconing.",
67  BooleanValue (true),
71  )
72  ;
73  return tid;
74 }
76  : m_standard (WIFI_STANDARD_80211a)
77 {
78  NS_LOG_FUNCTION (this);
79 
80  // Let the lower layers know that we are acting as a mesh node
82  m_coefficient = CreateObject<UniformRandomVariable> ();
83 }
85 {
86  NS_LOG_FUNCTION (this);
87 }
88 //-----------------------------------------------------------------------------
89 // WifiMac inherited
90 //-----------------------------------------------------------------------------
91 void
93 {
94  NS_LOG_FUNCTION (this << packet << to << from);
95  ForwardDown (packet, from, to);
96 }
97 void
99 {
100  NS_LOG_FUNCTION (this << packet << to);
101  ForwardDown (packet, GetAddress (), to);
102 }
103 bool
105 {
106  return true;
107 }
108 void
110 {
111  NS_LOG_FUNCTION (this);
113 
114  // The approach taken here is that, from the point of view of a mesh
115  // node, the link is always up, so we immediately invoke the
116  // callback if one is set
117  linkUp ();
118 }
119 void
121 {
122  NS_LOG_FUNCTION (this);
123  m_plugins.clear ();
125 
127 }
128 void
130 {
131  NS_LOG_FUNCTION (this);
133  if (m_beaconEnable)
134  {
135  Time randomStart = Seconds (m_coefficient->GetValue ());
136  // Now start sending beacons after some random delay (to avoid collisions)
139  m_tbtt = Simulator::Now () + randomStart;
140  }
141  else
142  {
143  // stop sending beacons
145  }
146 }
147 
148 int64_t
150 {
151  NS_LOG_FUNCTION (this << stream);
152  int64_t currentStream = stream;
153  m_coefficient->SetStream (currentStream++);
154  for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++)
155  {
156  currentStream += (*i)->AssignStreams (currentStream);
157  }
158  return (currentStream - stream);
159 }
160 
161 //-----------------------------------------------------------------------------
162 // Plugins
163 //-----------------------------------------------------------------------------
164 void
166 {
167  NS_LOG_FUNCTION (this);
168 
169  plugin->SetParent (this);
170  m_plugins.push_back (plugin);
171 }
172 //-----------------------------------------------------------------------------
173 // Switch channels
174 //-----------------------------------------------------------------------------
175 uint16_t
177 {
178  NS_LOG_FUNCTION (this);
179  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
180  return m_phy->GetChannelNumber ();
181 }
182 
183 void
185 {
186  NS_LOG_FUNCTION (this);
187  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
199  m_phy->SetChannelNumber (new_id);
200  // Don't know NAV on new channel
201  m_channelAccessManager->NotifyNavResetNow (Seconds (0));
202 }
203 //-----------------------------------------------------------------------------
204 // Forward frame down
205 //-----------------------------------------------------------------------------
206 void
208 {
209  WifiMacHeader hdr;
211  hdr.SetAddr2 (GetAddress ());
212  hdr.SetAddr3 (to);
213  hdr.SetAddr4 (from);
214  hdr.SetDsFrom ();
215  hdr.SetDsTo ();
216  // Fill QoS fields:
218  hdr.SetQosNoEosp ();
219  hdr.SetQosNoAmsdu ();
220  hdr.SetQosTxopLimit (0);
221  // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
222  hdr.SetAddr1 (Mac48Address ());
223  // Filter packet through all installed plugins
224  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
225  {
226  bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
227  if (drop)
228  {
229  return; // plugin drops frame
230  }
231  }
232  // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
233  NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
234  // Queue frame
235  if (m_stationManager->IsBrandNew (hdr.GetAddr1 ()))
236  {
237  // in adhoc mode, we assume that every destination
238  // supports all the rates we support.
239  for (const auto & mode : m_phy->GetModeList ())
240  {
242  }
244  }
245  // Classify: application may have set a tag, which is removed here
246  AcIndex ac;
247  SocketPriorityTag tag;
248  if (packet->RemovePacketTag (tag))
249  {
250  hdr.SetQosTid (tag.GetPriority ());
251  ac = QosUtilsMapTidToAc (tag.GetPriority ());
252  }
253  else
254  {
255  // No tag found; set to best effort
256  ac = AC_BE;
257  hdr.SetQosTid (0);
258  }
260  m_stats.sentBytes += packet->GetSize ();
261  NS_ASSERT (m_edca.find (ac) != m_edca.end ());
262  m_edca[ac]->Queue (packet, hdr);
263 }
264 void
266 {
267  //Filter management frames:
268  WifiMacHeader header = hdr;
269  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
270  {
271  bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
272  if (drop)
273  {
274  return; // plugin drops frame
275  }
276  }
278  m_stats.sentBytes += packet->GetSize ();
279  if ((m_edca.find (AC_VO) == m_edca.end ()) || (m_edca.find (AC_BK) == m_edca.end ()))
280  {
281  NS_FATAL_ERROR ("Voice or Background queue is not set up!");
282  }
283  /*
284  * When we send a management frame - it is better to enqueue it to
285  * priority queue. But when we send a broadcast management frame,
286  * like PREQ, little MinCw value may cause collisions during
287  * retransmissions (two neighbor stations may choose the same window
288  * size, and two packets will be collided). So, broadcast management
289  * frames go to BK queue.
290  */
291  if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
292  {
293  m_edca[AC_VO]->Queue (packet, header);
294  }
295  else
296  {
297  m_edca[AC_BK]->Queue (packet, header);
298  }
299 }
302 {
303  // set the set of supported rates and make sure that we indicate
304  // the Basic Rate set in this set of supported rates.
305  SupportedRates rates;
306  for (const auto & mode : m_phy->GetModeList ())
307  {
308  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
309  rates.AddSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
310  }
311  // set the basic rates
312  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
313  {
315  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
316  rates.SetBasicRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
317  }
318  return rates;
319 }
320 bool
322 {
323  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
324  {
326  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
327  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1)))
328  {
329  return false;
330  }
331  }
332  return true;
333 }
334 //-----------------------------------------------------------------------------
335 // Beacons
336 //-----------------------------------------------------------------------------
337 void
339 {
340  NS_LOG_FUNCTION (this << interval);
341  m_randomStart = interval;
342 }
343 void
345 {
346  NS_LOG_FUNCTION (this << interval);
347  m_beaconInterval = interval;
348 }
349 Time
351 {
352  return m_beaconInterval;
353 }
354 void
356 {
357  NS_LOG_FUNCTION (this << enable);
358  m_beaconEnable = enable;
359 }
360 bool
362 {
363  return m_beaconSendEvent.IsRunning ();
364 }
365 Time
367 {
368  return m_tbtt;
369 }
370 void
372 {
373  // User of ShiftTbtt () must take care don't shift it to the past
374  NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
375 
376  m_tbtt += shift;
377  // Shift scheduled event
380  this);
381 }
382 void
384 {
387 }
388 void
390 {
391  NS_LOG_FUNCTION (this);
392  NS_LOG_DEBUG (GetAddress () << " is sending beacon");
393 
395 
396  // Form & send beacon
398 
399  // Ask all plugins to add their specific information elements to beacon
400  for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
401  {
402  (*i)->UpdateBeacon (beacon);
403  }
404  m_txop->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
405 
407 }
408 void
410 {
411  const WifiMacHeader* hdr = &mpdu->GetHeader ();
412  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
413  // Process beacon
414  if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
415  {
416  return;
417  }
418  if (hdr->IsBeacon ())
419  {
421  MgtBeaconHeader beacon_hdr;
422 
423  packet->PeekHeader (beacon_hdr);
424 
425  NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
426  << Simulator::Now ().GetMicroSeconds () << " microseconds");
427 
428  // update supported rates
429  if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
430  {
431  SupportedRates rates = beacon_hdr.GetSupportedRates ();
432 
433  for (const auto & mode : m_phy->GetModeList ())
434  {
435  uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_phy->GetDevice ()));
436  uint64_t rate = mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1);
437  if (rates.IsSupportedRate (rate))
438  {
439  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
440  if (rates.IsBasicRate (rate))
441  {
443  }
444  }
445  }
446  }
447  }
448  else
449  {
450  m_stats.recvBytes += packet->GetSize ();
452  }
453  // Filter frame through all installed plugins
454  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
455  {
456  bool drop = !((*i)->Receive (packet, *hdr));
457  if (drop)
458  {
459  return; // plugin drops frame
460  }
461  }
462  // Check if QoS tag exists and add it:
463  if (hdr->IsQosData ())
464  {
465  SocketPriorityTag priorityTag;
466  priorityTag.SetPriority (hdr->GetQosTid ());
467  packet->ReplacePacketTag (priorityTag);
468  }
469  // Forward data up
470  if (hdr->IsData ())
471  {
472  ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
473  }
474 
475  // We don't bother invoking RegularWifiMac::Receive() here, because
476  // we've explicitly handled all the frames we care about. This is in
477  // contrast to most classes which derive from RegularWifiMac.
478 }
479 uint32_t
481 {
482  uint32_t metric = 1;
483  if (!m_linkMetricCallback.IsNull ())
484  {
485  metric = m_linkMetricCallback (peerAddress, this);
486  }
487  return metric;
488 }
489 void
491 {
493 }
494 void
496 {
497  m_mpAddress = a;
498 }
501 {
502  return m_mpAddress;
503 }
504 //Statistics:
506  : recvBeacons (0),
507  sentFrames (0),
508  sentBytes (0),
509  recvFrames (0),
510  recvBytes (0)
511 {
512 }
513 void
515 {
516  os << "<Statistics "
518  "rxBeacons=\"" << recvBeacons << "\" "
519  "txFrames=\"" << sentFrames << "\" "
520  "txBytes=\"" << sentBytes << "\" "
521  "rxFrames=\"" << recvFrames << "\" "
522  "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
523 }
524 void
525 MeshWifiInterfaceMac::Report (std::ostream & os) const
526 {
527  os << "<Interface "
528  "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
529  "Channel=\"" << GetFrequencyChannel () << "\" "
530  "Address = \"" << GetAddress () << "\">" << std::endl;
531  m_stats.Print (os);
532  os << "</Interface>" << std::endl;
533 }
534 void
536 {
537  m_stats = Statistics ();
538 }
539 
540 void
542 {
543  SetQosSupported (true); // a mesh station is a QoS station
545  m_standard = standard;
546 
547  // We use the single DCF provided by WifiMac for the purpose of
548  // Beacon transmission. For this we need to reconfigure the channel
549  // access parameters slightly, and do so here.
550  m_txop->SetMinCw (0);
551  m_txop->SetMaxCw (0);
552  m_txop->SetAifsn (1);
553 }
554 } // namespace ns3
555 
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:109
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:490
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:57
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:168
ns3::Callback< void >
ns3::MeshWifiInterfaceMac::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: mesh-wifi-interface-mac.cc:44
ns3::RegularWifiMac::GetSsid
Ssid GetSsid(void) const override
Definition: regular-wifi-mac.cc:685
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::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:149
ns3::MeshWifiInterfaceMac::GetSupportedRates
SupportedRates GetSupportedRates() const
Definition: mesh-wifi-interface-mac.cc:301
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:541
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:265
ns3::MeshWifiInterfaceMac::SendBeacon
void SendBeacon()
Send beacon.
Definition: mesh-wifi-interface-mac.cc:389
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:344
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:500
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:571
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:51
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:63
ns3::SupportedRates::SetBasicRate
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
Definition: supported-rates.cc:74
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:104
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:535
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:156
ns3::RegularWifiMac::GetAddress
Mac48Address GetAddress(void) const override
Definition: regular-wifi-mac.cc:672
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:350
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:233
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:514
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:84
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:94
ns3::MeshWifiInterfaceMac::MeshWifiInterfaceMac
MeshWifiInterfaceMac()
C-tor.
Definition: mesh-wifi-interface-mac.cc:75
ns3::ConvertGuardIntervalToNanoSeconds
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Definition: wifi-utils.cc:59
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:225
ns3::MeshWifiInterfaceMac::DoDispose
virtual void DoDispose()
Real d-tor.
Definition: mesh-wifi-interface-mac.cc:120
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:215
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:482
ns3::MeshWifiInterfaceMac::GetFrequencyChannel
uint16_t GetFrequencyChannel() const
Current channel Id.
Definition: mesh-wifi-interface-mac.cc:176
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:129
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:746
ns3::WifiPhy::GetDevice
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:783
ns3::MeshWifiInterfaceMac::Statistics::Statistics
Statistics()
constructor
Definition: mesh-wifi-interface-mac.cc:505
ns3::MeshWifiInterfaceMac::SetBeaconGeneration
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
Definition: mesh-wifi-interface-mac.cc:355
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::RegularWifiMac::SetQosSupported
virtual void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
Definition: regular-wifi-mac.cc:585
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:1095
ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
Definition: mesh-wifi-interface-mac.cc:184
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::MeshWifiInterfaceMac::ShiftTbtt
void ShiftTbtt(Time shift)
Shift TBTT.
Definition: mesh-wifi-interface-mac.cc:371
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:480
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:383
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:211
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:165
ns3::MeshWifiInterfaceMac::ForwardDown
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
Definition: mesh-wifi-interface-mac.cc:207
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:212
ns3::MeshWifiInterfaceMac::SetMeshPointAddress
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
Definition: mesh-wifi-interface-mac.cc:495
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:409
ns3::MeshWifiInterfaceMac::SetRandomStartDelay
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
Definition: mesh-wifi-interface-mac.cc:338
ns3::MeshWifiInterfaceMac::Report
void Report(std::ostream &os) const
Report statistics.
Definition: mesh-wifi-interface-mac.cc:525
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:289
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:92
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:366
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:321
ns3::Txop::SetAifsn
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:242
ns3::MeshWifiInterfaceMac::GetBeaconGeneration
bool GetBeaconGeneration() const
Get current beaconing status.
Definition: mesh-wifi-interface-mac.cc:361
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