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/mac-low.h"
27 #include "ns3/random-variable-stream.h"
28 #include "ns3/simulator.h"
29 #include "ns3/yans-wifi-phy.h"
30 #include "ns3/wifi-utils.h"
31 #include "ns3/pointer.h"
32 #include "ns3/double.h"
33 #include "ns3/trace-source-accessor.h"
34 #include "ns3/socket.h"
35 
36 namespace ns3 {
37 
38 NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
39 
40 NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
41 
42 TypeId
44 {
45  static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
47  .SetGroupName ("Mesh")
48  .AddConstructor<MeshWifiInterfaceMac> ()
49  .AddAttribute ( "BeaconInterval",
50  "Beacon Interval",
51  TimeValue (Seconds (0.5)),
52 
56  )
57  .AddAttribute ( "RandomStart",
58  "Window when beacon generating starts (uniform random) in seconds",
59  TimeValue (Seconds (0.5)),
63  )
64  .AddAttribute ( "BeaconGeneration",
65  "Enable/Disable Beaconing.",
66  BooleanValue (true),
70  )
71  ;
72  return tid;
73 }
76 {
77  NS_LOG_FUNCTION (this);
78 
79  // Let the lower layers know that we are acting as a mesh node
81  m_coefficient = CreateObject<UniformRandomVariable> ();
82 }
84 {
85  NS_LOG_FUNCTION (this);
86 }
87 //-----------------------------------------------------------------------------
88 // WifiMac inherited
89 //-----------------------------------------------------------------------------
90 void
92 {
93  NS_LOG_FUNCTION (this << packet << to << from);
94  ForwardDown (packet, from, to);
95 }
96 void
98 {
99  NS_LOG_FUNCTION (this << packet << to);
100  ForwardDown (packet, m_low->GetAddress (), to);
101 }
102 bool
104 {
105  return true;
106 }
107 void
109 {
110  NS_LOG_FUNCTION (this);
112 
113  // The approach taken here is that, from the point of view of a mesh
114  // node, the link is always up, so we immediately invoke the
115  // callback if one is set
116  linkUp ();
117 }
118 void
120 {
121  NS_LOG_FUNCTION (this);
122  m_plugins.clear ();
124 
126 }
127 void
129 {
130  NS_LOG_FUNCTION (this);
132  if (m_beaconEnable)
133  {
134  Time randomStart = Seconds (m_coefficient->GetValue ());
135  // Now start sending beacons after some random delay (to avoid collisions)
138  m_tbtt = Simulator::Now () + randomStart;
139  }
140  else
141  {
142  // stop sending beacons
144  }
145 }
146 
147 int64_t
149 {
150  NS_LOG_FUNCTION (this << stream);
151  int64_t currentStream = stream;
152  m_coefficient->SetStream (currentStream++);
153  for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++)
154  {
155  currentStream += (*i)->AssignStreams (currentStream);
156  }
157  return (currentStream - stream);
158 }
159 
160 //-----------------------------------------------------------------------------
161 // Plugins
162 //-----------------------------------------------------------------------------
163 void
165 {
166  NS_LOG_FUNCTION (this);
167 
168  plugin->SetParent (this);
169  m_plugins.push_back (plugin);
170 }
171 //-----------------------------------------------------------------------------
172 // Switch channels
173 //-----------------------------------------------------------------------------
174 uint16_t
176 {
177  NS_LOG_FUNCTION (this);
178  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
179 
181  if (phy != 0)
182  {
183  return phy->GetChannelNumber ();
184  }
185  else
186  {
187  return 0;
188  }
189 }
190 void
192 {
193  NS_LOG_FUNCTION (this);
194  NS_ASSERT (m_phy != 0); // need PHY to set/get channel
207  phy->SetChannelNumber (new_id);
208  // Don't know NAV on new channel
210 }
211 //-----------------------------------------------------------------------------
212 // Forward frame down
213 //-----------------------------------------------------------------------------
214 void
216 {
217  // copy packet to allow modifications
218  Ptr<Packet> packet = const_packet->Copy ();
219  WifiMacHeader hdr;
221  hdr.SetAddr2 (GetAddress ());
222  hdr.SetAddr3 (to);
223  hdr.SetAddr4 (from);
224  hdr.SetDsFrom ();
225  hdr.SetDsTo ();
226  // Fill QoS fields:
228  hdr.SetQosNoEosp ();
229  hdr.SetQosNoAmsdu ();
230  hdr.SetQosTxopLimit (0);
231  // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
232  hdr.SetAddr1 (Mac48Address ());
233  // Filter packet through all installed plugins
234  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
235  {
236  bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
237  if (drop)
238  {
239  return; // plugin drops frame
240  }
241  }
242  // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
243  NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
244  // Queue frame
245  if (m_stationManager->IsBrandNew (hdr.GetAddr1 ()))
246  {
247  // in adhoc mode, we assume that every destination
248  // supports all the rates we support.
249  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
250  {
252  }
254  }
255  // Classify: application may have set a tag, which is removed here
256  AcIndex ac;
257  SocketPriorityTag tag;
258  if (packet->RemovePacketTag (tag))
259  {
260  hdr.SetQosTid (tag.GetPriority ());
261  ac = QosUtilsMapTidToAc (tag.GetPriority ());
262  }
263  else
264  {
265  // No tag found; set to best effort
266  ac = AC_BE;
267  hdr.SetQosTid (0);
268  }
270  m_stats.sentBytes += packet->GetSize ();
271  NS_ASSERT (m_edca.find (ac) != m_edca.end ());
272  m_edca[ac]->Queue (packet, hdr);
273 }
274 void
276 {
277  //Filter management frames:
278  WifiMacHeader header = hdr;
279  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
280  {
281  bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
282  if (drop)
283  {
284  return; // plugin drops frame
285  }
286  }
288  m_stats.sentBytes += packet->GetSize ();
289  if ((m_edca.find (AC_VO) == m_edca.end ()) || (m_edca.find (AC_BK) == m_edca.end ()))
290  {
291  NS_FATAL_ERROR ("Voice or Background queue is not set up!");
292  }
293  /*
294  * When we send a management frame - it is better to enqueue it to
295  * priority queue. But when we send a broadcast management frame,
296  * like PREQ, little MinCw value may cause collisions during
297  * retransmissions (two neighbor stations may choose the same window
298  * size, and two packets will be collided). So, broadcast management
299  * frames go to BK queue.
300  */
301  if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
302  {
303  m_edca[AC_VO]->Queue (packet, header);
304  }
305  else
306  {
307  m_edca[AC_BK]->Queue (packet, header);
308  }
309 }
312 {
313  // set the set of supported rates and make sure that we indicate
314  // the Basic Rate set in this set of supported rates.
315  SupportedRates rates;
316  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
317  {
318  WifiMode mode = m_phy->GetMode (i);
320  rates.AddSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
321  }
322  // set the basic rates
323  for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++)
324  {
327  rates.SetBasicRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1));
328  }
329  return rates;
330 }
331 bool
333 {
334  for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
335  {
338  if (!rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1)))
339  {
340  return false;
341  }
342  }
343  return true;
344 }
345 //-----------------------------------------------------------------------------
346 // Beacons
347 //-----------------------------------------------------------------------------
348 void
350 {
351  NS_LOG_FUNCTION (this << interval);
352  m_randomStart = interval;
353 }
354 void
356 {
357  NS_LOG_FUNCTION (this << interval);
358  m_beaconInterval = interval;
359 }
360 Time
362 {
363  return m_beaconInterval;
364 }
365 void
367 {
368  NS_LOG_FUNCTION (this << enable);
369  m_beaconEnable = enable;
370 }
371 bool
373 {
374  return m_beaconSendEvent.IsRunning ();
375 }
376 Time
378 {
379  return m_tbtt;
380 }
381 void
383 {
384  // User of ShiftTbtt () must take care don't shift it to the past
385  NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
386 
387  m_tbtt += shift;
388  // Shift scheduled event
391  this);
392 }
393 void
395 {
398 }
399 void
401 {
402  NS_LOG_FUNCTION (this);
403  NS_LOG_DEBUG (GetAddress () << " is sending beacon");
404 
406 
407  // Form & send beacon
409 
410  // Ask all plugins to add their specific information elements to beacon
411  for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
412  {
413  (*i)->UpdateBeacon (beacon);
414  }
415  m_txop->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
416 
418 }
419 void
421 {
422  // Process beacon
423  if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
424  {
425  return;
426  }
427  if (hdr->IsBeacon ())
428  {
430  MgtBeaconHeader beacon_hdr;
431 
432  packet->PeekHeader (beacon_hdr);
433 
434  NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
435  << Simulator::Now ().GetMicroSeconds () << " microseconds");
436 
437  // update supported rates
438  if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
439  {
440  SupportedRates rates = beacon_hdr.GetSupportedRates ();
441 
442  for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
443  {
444  WifiMode mode = m_phy->GetMode (i);
446  uint64_t rate = mode.GetDataRate (m_phy->GetChannelWidth (), gi, 1);
447  if (rates.IsSupportedRate (rate))
448  {
449  m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
450  if (rates.IsBasicRate (rate))
451  {
453  }
454  }
455  }
456  }
457  }
458  else
459  {
460  m_stats.recvBytes += packet->GetSize ();
462  }
463  // Filter frame through all installed plugins
464  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
465  {
466  bool drop = !((*i)->Receive (packet, *hdr));
467  if (drop)
468  {
469  return; // plugin drops frame
470  }
471  }
472  // Check if QoS tag exists and add it:
473  if (hdr->IsQosData ())
474  {
475  SocketPriorityTag priorityTag;
476  priorityTag.SetPriority (hdr->GetQosTid ());
477  packet->ReplacePacketTag (priorityTag);
478  }
479  // Forward data up
480  if (hdr->IsData ())
481  {
482  ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
483  }
484 
485  // We don't bother invoking RegularWifiMac::Receive() here, because
486  // we've explicitly handled all the frames we care about. This is in
487  // contrast to most classes which derive from RegularWifiMac.
488 }
489 uint32_t
491 {
492  uint32_t metric = 1;
493  if (!m_linkMetricCallback.IsNull ())
494  {
495  metric = m_linkMetricCallback (peerAddress, this);
496  }
497  return metric;
498 }
499 void
501 {
503 }
504 void
506 {
507  m_mpAddress = a;
508 }
511 {
512  return m_mpAddress;
513 }
514 //Statistics:
516  : recvBeacons (0),
517  sentFrames (0),
518  sentBytes (0),
519  recvFrames (0),
520  recvBytes (0)
521 {
522 }
523 void
525 {
526  os << "<Statistics "
528  "rxBeacons=\"" << recvBeacons << "\" "
529  "txFrames=\"" << sentFrames << "\" "
530  "txBytes=\"" << sentBytes << "\" "
531  "rxFrames=\"" << recvFrames << "\" "
532  "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
533 }
534 void
535 MeshWifiInterfaceMac::Report (std::ostream & os) const
536 {
537  os << "<Interface "
538  "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
539  "Channel=\"" << GetFrequencyChannel () << "\" "
540  "Address = \"" << GetAddress () << "\">" << std::endl;
541  m_stats.Print (os);
542  os << "</Interface>" << std::endl;
543 }
544 void
546 {
547  m_stats = Statistics ();
548 }
549 
550 void
552 {
554  m_standard = standard;
555 
556  // We use the single DCF provided by WifiMac for the purpose of
557  // Beacon transmission. For this we need to reconfigure the channel
558  // access parameters slightly, and do so here.
559  m_txop->SetMinCw (0);
560  m_txop->SetMaxCw (0);
561  m_txop->SetAifsn (1);
562 }
565 {
566  return m_standard;
567 }
568 } // namespace ns3
569 
bool IsBeacon(void) const
Return true if the header is a Beacon header.
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:1407
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:220
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:156
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:208
#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:85
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.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
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:202
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:831
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:609
#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&#39;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.
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
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:55
Ssid GetSsid(void) const
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Voice.
Definition: qos-utils.h:46
Best Effort.
Definition: qos-utils.h:40
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 AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
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.
phy
Definition: third.py:86
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
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:42
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:355
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.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
base class for all MAC-level wifi objects.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1381
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:363
AttributeValue implementation for Time.
Definition: nstime.h:1069
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)
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1255
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:866
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:31
Time GetGuardInterval(void) const
Definition: wifi-phy.cc:623
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3501
static Mac48Address GetBroadcast(void)
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:370
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.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void NotifyNavResetNow(Time duration)
Mac48Address GetMeshPointAddress() const
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
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:290
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:1353
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:1070
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&#39;s priority.
Definition: socket.cc:854
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
Beacon is beacon header + list of arbitrary information elements.
static TypeId GetTypeId()
Get the type ID.
virtual void SetLinkUpCallback(Callback< void > linkUp)
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
virtual void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:296
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...
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:175
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:187
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:859
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
Mac48Address GetAddress(void) const
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1007
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.
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.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:257
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.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
void SetPriority(uint8_t priority)
Set the tag&#39;s priority.
Definition: socket.cc:848
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
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:915
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:37
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:841
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.
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3495
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.