A Discrete-Event Network Simulator
API
wifi-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #include "ns3/wifi-net-device.h"
24 #include "ns3/ap-wifi-mac.h"
25 #include "ns3/ampdu-subframe-header.h"
26 #include "ns3/mobility-model.h"
27 #include "ns3/log.h"
28 #include "ns3/pointer.h"
29 #include "ns3/radiotap-header.h"
30 #include "ns3/config.h"
31 #include "ns3/names.h"
32 #include "ns3/net-device-queue-interface.h"
33 #include "ns3/wifi-mac-queue.h"
34 #include "ns3/qos-utils.h"
35 #include "ns3/qos-txop.h"
36 #include "ns3/ht-configuration.h"
37 #include "ns3/vht-configuration.h"
38 #include "ns3/he-configuration.h"
39 #include "ns3/obss-pd-algorithm.h"
40 #include "ns3/wifi-mac-trailer.h"
41 #include "wifi-helper.h"
42 
43 namespace ns3 {
44 
45 NS_LOG_COMPONENT_DEFINE ("WifiHelper");
46 
56 static void
59  std::string context,
61  WifiMode mode,
62  WifiPreamble preamble,
63  uint8_t txLevel)
64 {
65  NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
66  auto pCopy = p->Copy ();
67  WifiMacTrailer fcs;
68  pCopy->RemoveTrailer (fcs);
69  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << mode << " " << *pCopy << " " << fcs << std::endl;
70 }
71 
80 static void
84  WifiMode mode,
85  WifiPreamble preamble,
86  uint8_t txLevel)
87 {
88  NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel);
89  auto pCopy = p->Copy ();
90  WifiMacTrailer fcs;
91  pCopy->RemoveTrailer (fcs);
92  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << mode << " " << *pCopy << " " << fcs << std::endl;
93 }
94 
104 static void
107  std::string context,
109  double snr,
110  WifiMode mode,
111  WifiPreamble preamble)
112 {
113  NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble);
114  auto pCopy = p->Copy ();
115  WifiMacTrailer fcs;
116  pCopy->RemoveTrailer (fcs);
117  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << " " << context << " " << *pCopy << " " << fcs << std::endl;
118 }
119 
128 static void
132  double snr,
133  WifiMode mode,
134  WifiPreamble preamble)
135 {
136  NS_LOG_FUNCTION (stream << p << snr << mode << preamble);
137  auto pCopy = p->Copy ();
138  WifiMacTrailer fcs;
139  pCopy->RemoveTrailer (fcs);
140  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << " " << *pCopy << " " << fcs << std::endl;
141 }
142 
144  : m_pcapDlt (PcapHelper::DLT_IEEE802_11)
145 {
146  SetPreambleDetectionModel ("ns3::ThresholdPreambleDetectionModel");
147 }
148 
150 {
151 }
152 
153 void
154 WifiPhyHelper::Set (std::string name, const AttributeValue &v)
155 {
156  m_phy.Set (name, v);
157 }
158 
159 void
161 {
163 }
164 
165 void
168  Ptr<const Packet> packet,
169  uint16_t channelFreqMhz,
170  WifiTxVector txVector,
171  MpduInfo aMpdu,
172  uint16_t staId)
173 {
174  uint32_t dlt = file->GetDataLinkType ();
175  switch (dlt)
176  {
178  file->Write (Simulator::Now (), packet);
179  return;
181  {
182  NS_FATAL_ERROR ("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
183  return;
184  }
186  {
187  Ptr<Packet> p = packet->Copy ();
188  RadiotapHeader header;
189  GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId);
190  p->AddHeader (header);
191  file->Write (Simulator::Now (), p);
192  return;
193  }
194  default:
195  NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
196  }
197 }
198 
199 void
202  Ptr<const Packet> packet,
203  uint16_t channelFreqMhz,
204  WifiTxVector txVector,
205  MpduInfo aMpdu,
206  SignalNoiseDbm signalNoise,
207  uint16_t staId)
208 {
209  uint32_t dlt = file->GetDataLinkType ();
210  switch (dlt)
211  {
213  file->Write (Simulator::Now (), packet);
214  return;
216  {
217  NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
218  return;
219  }
221  {
222  Ptr<Packet> p = packet->Copy ();
223  RadiotapHeader header;
224  GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId, signalNoise);
225  p->AddHeader (header);
226  file->Write (Simulator::Now (), p);
227  return;
228  }
229  default:
230  NS_ABORT_MSG ("PcapSniffRxEvent(): Unexpected data link type " << dlt);
231  }
232 }
233 
234 void
236  RadiotapHeader &header,
237  Ptr<Packet> packet,
238  uint16_t channelFreqMhz,
239  WifiTxVector txVector,
240  MpduInfo aMpdu,
241  uint16_t staId,
242  SignalNoiseDbm signalNoise)
243 {
244  header.SetAntennaSignalPower (signalNoise.signal);
245  header.SetAntennaNoisePower (signalNoise.noise);
246  GetRadiotapHeader (header, packet, channelFreqMhz, txVector, aMpdu, staId);
247 }
248 
249 void
251  RadiotapHeader &header,
252  Ptr<Packet> packet,
253  uint16_t channelFreqMhz,
254  WifiTxVector txVector,
255  MpduInfo aMpdu,
256  uint16_t staId)
257 {
258  WifiPreamble preamble = txVector.GetPreambleType ();
259 
260  uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
261  header.SetTsft (Simulator::Now ().GetMicroSeconds ());
262 
263  //Our capture includes the FCS, so we set the flag to say so.
265 
266  if (preamble == WIFI_PREAMBLE_SHORT)
267  {
269  }
270 
271  if (txVector.GetGuardInterval () == 400)
272  {
274  }
275 
276  header.SetFrameFlags (frameFlags);
277 
278  uint64_t rate = 0;
279  if (txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HT
280  && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_VHT
281  && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HE)
282  {
283  rate = txVector.GetMode (staId).GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss (staId) / 500000;
284  header.SetRate (static_cast<uint8_t> (rate));
285  }
286 
287  uint16_t channelFlags = 0;
288  switch (rate)
289  {
290  case 2: //1Mbps
291  case 4: //2Mbps
292  case 10: //5Mbps
293  case 22: //11Mbps
294  channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
295  break;
296  default:
297  channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
298  break;
299  }
300 
301  if (channelFreqMhz < 2500)
302  {
304  }
305  else
306  {
308  }
309 
310  header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
311 
312  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HT)
313  {
314  uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
315  uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
316 
318 
320  if (txVector.GetChannelWidth () == 40)
321  {
323  }
324 
326  if (txVector.GetGuardInterval () == 400)
327  {
329  }
330 
332 
333  mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS;
334  if (txVector.GetNess () & 0x01) //bit 1
335  {
337  }
338  if (txVector.GetNess () & 0x02) //bit 2
339  {
341  }
342 
343  mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; //only BCC is currently supported
344 
345  mcsKnown |= RadiotapHeader::MCS_KNOWN_STBC;
346  if (txVector.IsStbc ())
347  {
349  }
350 
351  header.SetMcsFields (mcsKnown, mcsFlags, txVector.GetMode (staId).GetMcsValue ());
352  }
353 
354  if (txVector.IsAggregation ())
355  {
356  uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
357  ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
358  /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
360  uint32_t extractedLength;
361  packet->RemoveHeader (hdr);
362  extractedLength = hdr.GetLength ();
363  packet = packet->CreateFragment (0, static_cast<uint32_t> (extractedLength));
364  if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true && hdr.GetLength () > 0))
365  {
366  ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
367  }
368  header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, 1 /*CRC*/);
369  }
370 
371  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_VHT)
372  {
373  uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE;
374  uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE;
375  uint8_t vhtBandwidth = 0;
376  uint8_t vhtMcsNss[4] = {0,0,0,0};
377  uint8_t vhtCoding = 0;
378  uint8_t vhtGroupId = 0;
379  uint16_t vhtPartialAid = 0;
380 
381  vhtKnown |= RadiotapHeader::VHT_KNOWN_STBC;
382  if (txVector.IsStbc ())
383  {
384  vhtFlags |= RadiotapHeader::VHT_FLAGS_STBC;
385  }
386 
388  if (txVector.GetGuardInterval () == 400)
389  {
391  }
392 
393  vhtKnown |= RadiotapHeader::VHT_KNOWN_BEAMFORMED; //Beamforming is currently not supported
394 
396  //not all bandwidth values are currently supported
397  if (txVector.GetChannelWidth () == 40)
398  {
399  vhtBandwidth = 1;
400  }
401  else if (txVector.GetChannelWidth () == 80)
402  {
403  vhtBandwidth = 4;
404  }
405  else if (txVector.GetChannelWidth () == 160)
406  {
407  vhtBandwidth = 11;
408  }
409 
410  //only SU PPDUs are currently supported
411  vhtMcsNss[0] |= (txVector.GetNss (staId) & 0x0f);
412  vhtMcsNss[0] |= ((txVector.GetMode (staId).GetMcsValue () << 4) & 0xf0);
413 
414  header.SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
415  }
416 
417  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HE)
418  {
420  if (preamble == WIFI_PREAMBLE_HE_ER_SU)
421  {
423  }
424  else if (preamble == WIFI_PREAMBLE_HE_MU)
425  {
428  }
429  else if (preamble == WIFI_PREAMBLE_HE_TB)
430  {
432  }
433 
434  uint16_t data2 = RadiotapHeader::HE_DATA2_GI_KNOWN;
435  if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
436  {
438  //HeRu indices start at 1 whereas RadioTap starts at 0
439  data2 |= (((txVector.GetHeMuUserInfo (staId).ru.GetIndex () - 1) << 8) & 0x3f00);
440  data2 |= (((!txVector.GetHeMuUserInfo (staId).ru.GetPrimary80MHz ()) << 15) & 0x8000);
441  }
442 
443  uint16_t data3 = 0;
444  data3 |= (txVector.GetBssColor () & 0x003f);
445  data3 |= ((txVector.GetMode (staId).GetMcsValue () << 8) & 0x0f00);
446 
447  uint16_t data4 = 0;
448  if (preamble == WIFI_PREAMBLE_HE_MU)
449  {
450  data4 |= ((staId << 4) & 0x7ff0);
451  }
452 
453  uint16_t data5 = 0;
454  if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
455  {
456  HeRu::RuType ruType = txVector.GetHeMuUserInfo (staId).ru.GetRuType ();
457  switch (ruType)
458  {
459  case HeRu::RU_26_TONE:
461  break;
462  case HeRu::RU_52_TONE:
464  break;
465  case HeRu::RU_106_TONE:
467  break;
468  case HeRu::RU_242_TONE:
470  break;
471  case HeRu::RU_484_TONE:
473  break;
474  case HeRu::RU_996_TONE:
476  break;
477  case HeRu::RU_2x996_TONE:
479  break;
480  default:
481  NS_ABORT_MSG ("Unexpected RU type");
482  }
483  }
484  else if (txVector.GetChannelWidth () == 40)
485  {
487  }
488  else if (txVector.GetChannelWidth () == 80)
489  {
491  }
492  else if (txVector.GetChannelWidth () == 160)
493  {
495  }
496  if (txVector.GetGuardInterval () == 1600)
497  {
499  }
500  else if (txVector.GetGuardInterval () == 3200)
501  {
503  }
504 
505  header.SetHeFields (data1, data2, data3, data4, data5, 0);
506  }
507 
508  if (preamble == WIFI_PREAMBLE_HE_MU)
509  {
510  //TODO: fill in fields (everything is set to 0 so far)
511  std::array<uint8_t, 4> ruChannel1, ruChannel2;
512  header.SetHeMuFields (0, 0, ruChannel1, ruChannel2);
513  header.SetHeMuPerUserFields (0, 0, 0, 0);
514  }
515 }
516 
517 void
519 {
520  switch (dlt)
521  {
522  case DLT_IEEE802_11:
524  return;
525  case DLT_PRISM_HEADER:
527  return;
530  return;
531  default:
532  NS_ABORT_MSG ("WifiPhyHelper::SetPcapFormat(): Unexpected format");
533  }
534 }
535 
538 {
539  return m_pcapDlt;
540 }
541 
542 void
543 WifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
544 {
545  NS_LOG_FUNCTION (this << prefix << nd << promiscuous << explicitFilename);
546 
547  //All of the Pcap enable functions vector through here including the ones
548  //that are wandering through all of devices on perhaps all of the nodes in
549  //the system. We can only deal with devices of type WifiNetDevice.
550  Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
551  if (device == 0)
552  {
553  NS_LOG_INFO ("WifiHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WifiNetDevice");
554  return;
555  }
556 
557  Ptr<WifiPhy> phy = device->GetPhy ();
558  NS_ABORT_MSG_IF (phy == 0, "WifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
559 
560  PcapHelper pcapHelper;
561 
562  std::string filename;
563  if (explicitFilename)
564  {
565  filename = prefix;
566  }
567  else
568  {
569  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
570  }
571 
572  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, m_pcapDlt);
573 
574  phy->TraceConnectWithoutContext ("MonitorSnifferTx", MakeBoundCallback (&WifiPhyHelper::PcapSniffTxEvent, file));
575  phy->TraceConnectWithoutContext ("MonitorSnifferRx", MakeBoundCallback (&WifiPhyHelper::PcapSniffRxEvent, file));
576 }
577 
578 void
581  std::string prefix,
582  Ptr<NetDevice> nd,
583  bool explicitFilename)
584 {
585  //All of the ASCII enable functions vector through here including the ones
586  //that are wandering through all of devices on perhaps all of the nodes in
587  //the system. We can only deal with devices of type WifiNetDevice.
588  Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
589  if (device == 0)
590  {
591  NS_LOG_INFO ("WifiHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::WifiNetDevice");
592  return;
593  }
594 
595  //Our trace sinks are going to use packet printing, so we have to make sure
596  //that is turned on.
598 
599  uint32_t nodeid = nd->GetNode ()->GetId ();
600  uint32_t deviceid = nd->GetIfIndex ();
601  std::ostringstream oss;
602 
603  //If we are not provided an OutputStreamWrapper, we are expected to create
604  //one using the usual trace filename conventions and write our traces
605  //without a context since there will be one file per context and therefore
606  //the context would be redundant.
607  if (stream == 0)
608  {
609  //Set up an output stream object to deal with private ofstream copy
610  //constructor and lifetime issues. Let the helper decide the actual
611  //name of the file given the prefix.
612  AsciiTraceHelper asciiTraceHelper;
613 
614  std::string filename;
615  if (explicitFilename)
616  {
617  filename = prefix;
618  }
619  else
620  {
621  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
622  }
623 
624  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
625  //We could go poking through the PHY and the state looking for the
626  //correct trace source, but we can let Config deal with that with
627  //some search cost. Since this is presumably happening at topology
628  //creation time, it doesn't seem much of a price to pay.
629  oss.str ("");
630  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
632 
633  oss.str ("");
634  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
636 
637  return;
638  }
639 
640  //If we are provided an OutputStreamWrapper, we are expected to use it, and
641  //to provide a context. We are free to come up with our own context if we
642  //want, and use the AsciiTraceHelper Hook*WithContext functions, but for
643  //compatibility and simplicity, we just use Config::Connect and let it deal
644  //with coming up with a context.
645  oss.str ("");
646  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
648 
649  oss.str ("");
650  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
652 }
653 
655 {
656 }
657 
659  : m_standard (WIFI_STANDARD_80211ax),
660  m_selectQueueCallback (&SelectQueueByDSField),
661  m_enableFlowControl (true)
662 {
663  SetRemoteStationManager ("ns3::IdealWifiManager");
664 }
665 
666 void
668 {
669  m_standard = standard;
670 }
671 
672 void
674 {
675  m_enableFlowControl = false;
676 }
677 
678 void
680 {
682 }
683 
686  const WifiMacHelper &macHelper,
688  NodeContainer::Iterator last) const
689 {
691  for (NodeContainer::Iterator i = first; i != last; ++i)
692  {
693  Ptr<Node> node = *i;
694  Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
695  device->SetStandard (m_standard);
697  {
698  NS_FATAL_ERROR ("No standard specified!");
699  return devices;
700  }
702  {
703  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
704  device->SetHtConfiguration (htConfiguration);
705  }
707  {
708  // Create the VHT Configuration object even if the PHY band is 2.4GHz
709  // (WifiNetDevice::GetVhtConfiguration() checks the PHY band being used).
710  // This approach allows us not to worry about deleting this object when
711  // the PHY band is switched from 5GHz to 2.4GHz and creating this object
712  // when the PHY band is switched from 2.4GHz to 5GHz.
713  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
714  device->SetVhtConfiguration (vhtConfiguration);
715  }
717  {
718  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
719  device->SetHeConfiguration (heConfiguration);
720  }
722  Ptr<WifiPhy> phy = phyHelper.Create (node, device);
723  phy->ConfigureStandard (m_standard);
724  device->SetPhy (phy);
725  Ptr<WifiMac> mac = macHelper.Create (device, m_standard);
726  device->SetMac (mac);
727  device->SetRemoteStationManager (manager);
728  node->AddDevice (device);
730  {
732  device->AggregateObject (obssPdAlgorithm);
733  obssPdAlgorithm->ConnectWifiNetDevice (device);
734  }
735  devices.Add (device);
736  NS_LOG_DEBUG ("node=" << node << ", mob=" << node->GetObject<MobilityModel> ());
738  {
740  BooleanValue qosSupported;
741  Ptr<WifiMacQueue> wmq;
742 
743  mac->GetAttributeFailSafe ("QosSupported", qosSupported);
744  if (qosSupported.Get ())
745  {
746  ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface> ("NTxQueues",
747  UintegerValue (4));
748  for (auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
749  {
750  Ptr<QosTxop> qosTxop = mac->GetQosTxop (ac);
751  wmq = qosTxop->GetWifiMacQueue ();
752  ndqi->GetTxQueue (static_cast<std::size_t> (ac))->ConnectQueueTraces (wmq);
753  }
754  ndqi->SetSelectQueueCallback (m_selectQueueCallback);
755  }
756  else
757  {
758  ndqi = CreateObject<NetDeviceQueueInterface> ();
759 
760  wmq = mac->GetTxop ()->GetWifiMacQueue ();
761  ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
762  }
763  device->AggregateObject (ndqi);
764  }
765  }
766  return devices;
767 }
768 
771  const WifiMacHelper &macHelper, NodeContainer c) const
772 {
773  return Install (phyHelper, macHelper, c.Begin (), c.End ());
774 }
775 
778  const WifiMacHelper &mac, Ptr<Node> node) const
779 {
780  return Install (phy, mac, NodeContainer (node));
781 }
782 
785  const WifiMacHelper &mac, std::string nodeName) const
786 {
787  Ptr<Node> node = Names::Find<Node> (nodeName);
788  return Install (phy, mac, NodeContainer (node));
789 }
790 
791 void
793 {
796 
797  LogComponentEnable ("AarfWifiManager", LOG_LEVEL_ALL);
798  LogComponentEnable ("AarfcdWifiManager", LOG_LEVEL_ALL);
799  LogComponentEnable ("AdhocWifiMac", LOG_LEVEL_ALL);
800  LogComponentEnable ("AmrrWifiManager", LOG_LEVEL_ALL);
801  LogComponentEnable ("ApWifiMac", LOG_LEVEL_ALL);
802  LogComponentEnable ("AparfWifiManager", LOG_LEVEL_ALL);
803  LogComponentEnable ("ArfWifiManager", LOG_LEVEL_ALL);
804  LogComponentEnable ("BlockAckAgreement", LOG_LEVEL_ALL);
805  LogComponentEnable ("RecipientBlockAckAgreement", LOG_LEVEL_ALL);
806  LogComponentEnable ("BlockAckManager", LOG_LEVEL_ALL);
807  LogComponentEnable ("CaraWifiManager", LOG_LEVEL_ALL);
808  LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
809  LogComponentEnable ("ConstantObssPdAlgorithm", LOG_LEVEL_ALL);
810  LogComponentEnable ("ConstantRateWifiManager", LOG_LEVEL_ALL);
811  LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
812  LogComponentEnable ("DsssErrorRateModel", LOG_LEVEL_ALL);
813  LogComponentEnable ("DsssPhy", LOG_LEVEL_ALL);
814  LogComponentEnable ("DsssPpdu", LOG_LEVEL_ALL);
815  LogComponentEnable ("ErpOfdmPhy", LOG_LEVEL_ALL);
816  LogComponentEnable ("ErpOfdmPpdu", LOG_LEVEL_ALL);
817  LogComponentEnable ("FrameExchangeManager", LOG_LEVEL_ALL);
818  LogComponentEnable ("HeConfiguration", LOG_LEVEL_ALL);
819  LogComponentEnable ("HeFrameExchangeManager", LOG_LEVEL_ALL);
821  LogComponentEnable ("HePpdu", LOG_LEVEL_ALL);
822  LogComponentEnable ("HtConfiguration", LOG_LEVEL_ALL);
823  LogComponentEnable ("HtFrameExchangeManager", LOG_LEVEL_ALL);
825  LogComponentEnable ("HtPpdu", LOG_LEVEL_ALL);
826  LogComponentEnable ("IdealWifiManager", LOG_LEVEL_ALL);
827  LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL);
828  LogComponentEnable ("MacRxMiddle", LOG_LEVEL_ALL);
829  LogComponentEnable ("MacTxMiddle", LOG_LEVEL_ALL);
830  LogComponentEnable ("MinstrelHtWifiManager", LOG_LEVEL_ALL);
831  LogComponentEnable ("MinstrelWifiManager", LOG_LEVEL_ALL);
832  LogComponentEnable ("MpduAggregator", LOG_LEVEL_ALL);
833  LogComponentEnable ("MsduAggregator", LOG_LEVEL_ALL);
834  LogComponentEnable ("MultiUserScheduler", LOG_LEVEL_ALL);
835  LogComponentEnable ("NistErrorRateModel", LOG_LEVEL_ALL);
836  LogComponentEnable ("ObssPdAlgorithm", LOG_LEVEL_ALL);
837  LogComponentEnable ("OfdmPhy", LOG_LEVEL_ALL);
838  LogComponentEnable ("OnoeWifiManager", LOG_LEVEL_ALL);
839  LogComponentEnable ("OriginatorBlockAckAgreement", LOG_LEVEL_ALL);
840  LogComponentEnable ("OfdmPpdu", LOG_LEVEL_ALL);
841  LogComponentEnable ("ParfWifiManager", LOG_LEVEL_ALL);
842  LogComponentEnable ("PhyEntity", LOG_LEVEL_ALL);
843  LogComponentEnable ("QosFrameExchangeManager", LOG_LEVEL_ALL);
844  LogComponentEnable ("QosTxop", LOG_LEVEL_ALL);
845  LogComponentEnable ("RraaWifiManager", LOG_LEVEL_ALL);
846  LogComponentEnable ("RrMultiUserScheduler", LOG_LEVEL_ALL);
847  LogComponentEnable ("RrpaaWifiManager", LOG_LEVEL_ALL);
848  LogComponentEnable ("SimpleFrameCaptureModel", LOG_LEVEL_ALL);
849  LogComponentEnable ("SpectrumWifiPhy", LOG_LEVEL_ALL);
850  LogComponentEnable ("StaWifiMac", LOG_LEVEL_ALL);
851  LogComponentEnable ("SupportedRates", LOG_LEVEL_ALL);
852  LogComponentEnable ("TableBasedErrorRateModel", LOG_LEVEL_ALL);
853  LogComponentEnable ("ThompsonSamplingWifiManager", LOG_LEVEL_ALL);
854  LogComponentEnable ("ThresholdPreambleDetectionModel", LOG_LEVEL_ALL);
856  LogComponentEnable ("VhtConfiguration", LOG_LEVEL_ALL);
857  LogComponentEnable ("VhtFrameExchangeManager", LOG_LEVEL_ALL);
858  LogComponentEnable ("VhtPhy", LOG_LEVEL_ALL);
859  LogComponentEnable ("VhtPpdu", LOG_LEVEL_ALL);
860  LogComponentEnable ("WifiAckManager", LOG_LEVEL_ALL);
861  LogComponentEnable ("WifiDefaultAckManager", LOG_LEVEL_ALL);
862  LogComponentEnable ("WifiDefaultProtectionManager", LOG_LEVEL_ALL);
863  LogComponentEnable ("WifiMac", LOG_LEVEL_ALL);
864  LogComponentEnable ("WifiMacQueue", LOG_LEVEL_ALL);
865  LogComponentEnable ("WifiMacQueueItem", LOG_LEVEL_ALL);
866  LogComponentEnable ("WifiNetDevice", LOG_LEVEL_ALL);
867  LogComponentEnable ("WifiPhyStateHelper", LOG_LEVEL_ALL);
868  LogComponentEnable ("WifiPhy", LOG_LEVEL_ALL);
869  LogComponentEnable ("WifiPhyOperatingChannel", LOG_LEVEL_ALL);
870  LogComponentEnable ("WifiPpdu", LOG_LEVEL_ALL);
871  LogComponentEnable ("WifiProtectionManager", LOG_LEVEL_ALL);
872  LogComponentEnable ("WifiPsdu", LOG_LEVEL_ALL);
873  LogComponentEnable ("WifiRadioEnergyModel", LOG_LEVEL_ALL);
874  LogComponentEnable ("WifiRemoteStationManager", LOG_LEVEL_ALL);
875  LogComponentEnable ("WifiSpectrumPhyInterface", LOG_LEVEL_ALL);
876  LogComponentEnable ("WifiSpectrumSignalParameters", LOG_LEVEL_ALL);
877  LogComponentEnable ("WifiTxCurrentModel", LOG_LEVEL_ALL);
878  LogComponentEnable ("WifiTxParameters", LOG_LEVEL_ALL);
879  LogComponentEnable ("WifiTxTimer", LOG_LEVEL_ALL);
880  LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
881  LogComponentEnable ("YansWifiChannel", LOG_LEVEL_ALL);
882  LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL);
883 
884  //From Spectrum
885  LogComponentEnable ("WifiSpectrumValueHelper", LOG_LEVEL_ALL);
886 }
887 
888 int64_t
890 {
891  int64_t currentStream = stream;
892  Ptr<NetDevice> netDevice;
893  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
894  {
895  netDevice = (*i);
896  Ptr<WifiNetDevice> wifi = DynamicCast<WifiNetDevice> (netDevice);
897  if (wifi)
898  {
899  //Handle any random numbers in the PHY objects.
900  currentStream += wifi->GetPhy ()->AssignStreams (currentStream);
901 
902  //Handle any random numbers in the station managers.
903  currentStream += wifi->GetRemoteStationManager ()->AssignStreams (currentStream);
904 
905  //Handle any random numbers in the MAC objects.
906  Ptr<WifiMac> mac = wifi->GetMac ();
907  PointerValue ptr;
908  if (!mac->GetQosSupported ())
909  {
910  mac->GetAttribute ("Txop", ptr);
911  Ptr<Txop> txop = ptr.Get<Txop> ();
912  currentStream += txop->AssignStreams (currentStream);
913  }
914  else
915  {
916  mac->GetAttribute ("VO_Txop", ptr);
917  Ptr<QosTxop> vo_txop = ptr.Get<QosTxop> ();
918  currentStream += vo_txop->AssignStreams (currentStream);
919 
920  mac->GetAttribute ("VI_Txop", ptr);
921  Ptr<QosTxop> vi_txop = ptr.Get<QosTxop> ();
922  currentStream += vi_txop->AssignStreams (currentStream);
923 
924  mac->GetAttribute ("BE_Txop", ptr);
925  Ptr<QosTxop> be_txop = ptr.Get<QosTxop> ();
926  currentStream += be_txop->AssignStreams (currentStream);
927 
928  mac->GetAttribute ("BK_Txop", ptr);
929  Ptr<QosTxop> bk_txop = ptr.Get<QosTxop> ();
930  currentStream += bk_txop->AssignStreams (currentStream);
931  }
932 
933  //if an AP, handle any beacon jitter
934  Ptr<ApWifiMac> apmac = DynamicCast<ApWifiMac> (mac);
935  if (apmac)
936  {
937  currentStream += apmac->AssignStreams (currentStream);
938  }
939  }
940  }
941  return (currentStream - stream);
942 }
943 
944 } //namespace ns3
double f(double x, void *params)
Definition: 80211b.c:70
Headers for A-MPDU subframes.
bool GetEof(void) const
Return the EOF field.
uint16_t GetLength(void) const
Return the length field.
Manage ASCII trace files for device models.
Definition: trace-helper.h:163
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the ascii trace helper figure out a reasonable filename to use for an ascii trace file associated...
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Hold a value for an Attribute.
Definition: attribute.h:69
AttributeValue implementation for Boolean.
Definition: boolean.h:37
bool Get(void) const
Definition: boolean.cc:51
RuType GetRuType(void) const
Get the RU type.
Definition: he-ru.cc:167
bool GetPrimary80MHz(void) const
Get the primary 80 MHz flag.
Definition: he-ru.cc:181
std::size_t GetIndex(void) const
Get the RU index.
Definition: he-ru.cc:174
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:42
@ RU_26_TONE
Definition: he-ru.h:43
@ RU_484_TONE
Definition: he-ru.h:47
@ RU_996_TONE
Definition: he-ru.h:48
@ RU_106_TONE
Definition: he-ru.h:45
@ RU_52_TONE
Definition: he-ru.h:44
@ RU_242_TONE
Definition: he-ru.h:46
@ RU_2x996_TONE
Definition: he-ru.h:49
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
virtual Ptr< Node > GetNode(void) const =0
virtual uint32_t GetIfIndex(void) const =0
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
uint32_t GetId(void) const
Definition: node.cc:109
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
OBSS PD algorithm interface.
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
Definition: packet.cc:227
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
Manage pcap files for device models.
Definition: trace-helper.h:39
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the pcap helper figure out a reasonable filename to use for a pcap file associated with a device.
Definition: trace-helper.cc:80
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file.
Definition: trace-helper.cc:49
DataLinkType
This enumeration holds the data link types that will be written to the pcap file.
Definition: trace-helper.h:50
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Ptr< T > Get(void) const
Definition: pointer.h:201
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:72
Radiotap header implementation.
void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs)
Set the MCS fields.
@ CHANNEL_FLAG_OFDM
OFDM channel.
@ CHANNEL_FLAG_CCK
CCK channel.
@ CHANNEL_FLAG_SPECTRUM_5GHZ
5 GHz spectrum channel
@ CHANNEL_FLAG_SPECTRUM_2GHZ
2 GHz spectrum channel
@ VHT_KNOWN_NONE
No flags set.
@ VHT_KNOWN_BANDWIDTH
Bandwidth known.
@ VHT_KNOWN_STBC
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
@ VHT_KNOWN_GUARD_INTERVAL
Guard interval.
@ VHT_KNOWN_BEAMFORMED
Beamformed known/applicable (this flag should be set to zero for MU PPDUs).
void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags)
Set the transmit/receive channel frequency and flags.
@ FRAME_FLAG_SHORT_PREAMBLE
Frame sent/received with short preamble.
@ FRAME_FLAG_SHORT_GUARD
Frame used short guard interval (HT)
@ FRAME_FLAG_FCS_INCLUDED
Frame includes FCS.
@ FRAME_FLAG_NONE
No flags set.
@ HE_DATA2_GI_KNOWN
GI known.
@ HE_DATA2_RU_OFFSET_KNOWN
RU allocation offset known.
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
void SetVhtFields(uint16_t known, uint8_t flags, uint8_t bandwidth, uint8_t mcs_nss[4], uint8_t coding, uint8_t group_id, uint16_t partial_aid)
Set the VHT fields.
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference.
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
@ VHT_FLAGS_NONE
No flags set.
@ VHT_FLAGS_STBC
Set if all spatial streams of all users have space-time block coding.
@ VHT_FLAGS_GUARD_INTERVAL
Short guard interval.
void SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4, uint16_t data5, uint16_t data6)
Set the HE fields.
@ MCS_FLAGS_NESS_BIT_0
Ness - bit 0 (LSB) of Number of extension spatial streams.
@ MCS_FLAGS_NONE
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
@ MCS_FLAGS_STBC_STREAMS
STBC enabled.
@ MCS_FLAGS_GUARD_INTERVAL
Short guard interval.
@ HE_DATA1_FORMAT_TRIG
HE TRIG PPDU format.
@ HE_DATA1_FORMAT_MU
HE MU PPDU format.
@ HE_DATA1_BSS_COLOR_KNOWN
BSS Color known.
@ HE_DATA1_FORMAT_EXT_SU
HE EXT SU PPDU format.
@ HE_DATA1_DATA_MCS_KNOWN
data MCS known
@ HE_DATA1_SPTL_REUSE2_KNOWN
Spatial Reuse 2 known (HE TRIG PPDU format), STA-ID known (HE MU PPDU format)
@ HE_DATA1_BW_RU_ALLOC_KNOWN
data BW/RU allocation known
void SetAmpduStatus(uint32_t referenceNumber, uint16_t flags, uint8_t crc)
Set the A-MPDU status fields.
void SetHeMuPerUserFields(uint16_t perUser1, uint16_t perUser2, uint8_t perUserPosition, uint8_t perUserKnown)
Set the HE MU per user fields.
@ A_MPDU_STATUS_NONE
No flags set.
@ A_MPDU_STATUS_LAST_KNOWN
Last subframe is known (should be set for all subframes in an A-MPDU)
@ A_MPDU_STATUS_LAST
This frame is the last subframe.
@ MCS_KNOWN_FEC_TYPE
FEC type.
@ MCS_KNOWN_GUARD_INTERVAL
Guard interval.
@ MCS_KNOWN_NONE
No flags set.
@ MCS_KNOWN_BANDWIDTH
Bandwidth.
@ MCS_KNOWN_NESS_BIT_1
Ness data - bit 1 (MSB) of Number of extension spatial streams.
@ MCS_KNOWN_HT_FORMAT
HT format.
@ MCS_KNOWN_NESS
Ness known (Number of extension spatial streams)
@ MCS_KNOWN_INDEX
MCS index known.
@ MCS_KNOWN_STBC
STBC known.
void SetHeMuFields(uint16_t flags1, uint16_t flags2, const std::array< uint8_t, 4 > &ruChannel1, const std::array< uint8_t, 4 > &ruChannel2)
Set the HE MU fields.
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference.
@ HE_DATA5_DATA_BW_RU_ALLOC_26T
26-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_484T
484-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_40MHZ
40 MHz data Bandwidth
@ HE_DATA5_DATA_BW_RU_ALLOC_2x996T
2x996-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_242T
242-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_52T
52-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_160MHZ
160 MHz data Bandwidth
@ HE_DATA5_DATA_BW_RU_ALLOC_106T
106-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_996T
996-tone RU allocation
@ HE_DATA5_DATA_BW_RU_ALLOC_80MHZ
80 MHz data Bandwidth
void SetFrameFlags(uint8_t flags)
Set the frame flags of the transmitted or received frame.
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:65
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: txop.cc:309
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:154
a unique identifier for an interface.
Definition: type-id.h:59
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual ~WifiHelper()
Definition: wifi-helper.cc:654
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
Definition: wifi-helper.h:464
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:418
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:414
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:679
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:792
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:416
void DisableFlowControl(void)
Disable flow control only if you know what you are doing.
Definition: wifi-helper.cc:673
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
Definition: wifi-helper.cc:889
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:667
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:685
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:417
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:309
bool m_enableFlowControl
whether to enable flow control
Definition: wifi-helper.h:419
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:658
create MAC layers for a ns3::WifiNetDevice.
virtual Ptr< WifiMac > Create(Ptr< WifiNetDevice > device, WifiStandard standard) const
Implements the IEEE 802.11 MAC trailer.
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:177
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:114
Hold together all Wifi-related objects.
void SetMac(const Ptr< WifiMac > mac)
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Ptr< WifiPhy > GetPhy(void) const
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
void SetStandard(WifiStandard standard)
Set the Wifi standard.
void SetPhy(const Ptr< WifiPhy > phy)
create PHY objects
Definition: wifi-helper.h:48
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:518
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ASCII trace output on the indicated net device.
Definition: wifi-helper.cc:579
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:154
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:160
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:543
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:262
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:149
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId=SU_STA_ID)
Definition: wifi-helper.cc:200
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:190
void SetPreambleDetectionModel(std::string type, Args &&... args)
Helper function used to set the preamble detection model.
Definition: wifi-helper.h:456
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId=SU_STA_ID)
Definition: wifi-helper.cc:166
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const =0
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:123
@ DLT_IEEE802_11
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:124
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:126
@ DLT_PRISM_HEADER
Include Prism monitor mode information.
Definition: wifi-helper.h:125
static void GetRadiotapHeader(RadiotapHeader &header, Ptr< Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId)
Get the Radiotap header for a transmitted packet.
Definition: wifi-helper.cc:250
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:186
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:537
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint8_t GetBssColor(void) const
Get the BSS color.
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
uint8_t GetNess(void) const
HeMuUserInfo GetHeMuUserInfo(uint16_t staId) const
Get the HE MU user-specific transmission information for the given STA-ID.
WifiPreamble GetPreambleType(void) const
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
uint16_t GetChannelWidth(void) const
bool IsStbc(void) const
Check if STBC is used or not.
uint16_t GetGuardInterval(void) const
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:253
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_STANDARD_80211ac
@ WIFI_PREAMBLE_HE_ER_SU
@ WIFI_PREAMBLE_HE_TB
@ WIFI_PREAMBLE_HE_MU
@ WIFI_PREAMBLE_SHORT
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ AC_BE
Best Effort.
Definition: qos-utils.h:73
@ AC_VO
Voice.
Definition: qos-utils.h:79
@ AC_VI
Video.
Definition: qos-utils.h:77
@ AC_BK
Background.
Definition: qos-utils.h:75
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
Definition: first.py:1
devices
Definition: first.py:39
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink with context.
Definition: wave-helper.cc:88
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink without context.
Definition: wave-helper.cc:109
@ LOG_LEVEL_ALL
Print everything.
Definition: log.h:116
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition: log.h:119
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition: log.h:120
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink with context.
Definition: wave-helper.cc:46
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:385
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink without context.
Definition: wave-helper.cc:67
mac
Definition: third.py:99
wifi
Definition: third.py:96
phy
Definition: third.py:93
HeRu::RuSpec ru
RU specification.
MpduInfo structure.
Definition: phy-entity.h:60
MpduType type
type of MPDU
Definition: phy-entity.h:61
uint32_t mpduRefNumber
MPDU ref number.
Definition: phy-entity.h:62
SignalNoiseDbm structure.
Definition: phy-entity.h:53
double noise
noise power in dBm
Definition: phy-entity.h:55
double signal
signal strength in dBm
Definition: phy-entity.h:54