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/minstrel-wifi-manager.h"
25 #include "ns3/minstrel-ht-wifi-manager.h"
26 #include "ns3/ap-wifi-mac.h"
27 #include "ns3/ampdu-subframe-header.h"
28 #include "ns3/mobility-model.h"
29 #include "ns3/log.h"
30 #include "ns3/pointer.h"
31 #include "ns3/radiotap-header.h"
32 #include "ns3/config.h"
33 #include "ns3/names.h"
34 #include "ns3/net-device-queue-interface.h"
35 #include "ns3/wifi-mac-queue.h"
36 #include "ns3/qos-utils.h"
37 #include "ns3/ht-configuration.h"
38 #include "ns3/vht-configuration.h"
39 #include "ns3/he-configuration.h"
40 #include "ns3/obss-pd-algorithm.h"
41 #include "ns3/wifi-ack-policy-selector.h"
42 #include "wifi-helper.h"
43 
44 namespace ns3 {
45 
46 NS_LOG_COMPONENT_DEFINE ("WifiHelper");
47 
57 static void
60  std::string context,
62  WifiMode mode,
63  WifiPreamble preamble,
64  uint8_t txLevel)
65 {
66  NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
67  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << mode << " " << *p << std::endl;
68 }
69 
78 static void
82  WifiMode mode,
83  WifiPreamble preamble,
84  uint8_t txLevel)
85 {
86  NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel);
87  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << mode << " " << *p << std::endl;
88 }
89 
99 static void
102  std::string context,
104  double snr,
105  WifiMode mode,
106  WifiPreamble preamble)
107 {
108  NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble);
109  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << "" << context << " " << *p << std::endl;
110 }
111 
120 static void
124  double snr,
125  WifiMode mode,
126  WifiPreamble preamble)
127 {
128  NS_LOG_FUNCTION (stream << p << snr << mode << preamble);
129  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << " " << *p << std::endl;
130 }
131 
133  : m_pcapDlt (PcapHelper::DLT_IEEE802_11)
134 {
135  SetPreambleDetectionModel ("ns3::ThresholdPreambleDetectionModel");
136 }
137 
139 {
140 }
141 
142 void
143 WifiPhyHelper::Set (std::string name, const AttributeValue &v)
144 {
145  m_phy.Set (name, v);
146 }
147 
148 void
150  std::string n0, const AttributeValue &v0,
151  std::string n1, const AttributeValue &v1,
152  std::string n2, const AttributeValue &v2,
153  std::string n3, const AttributeValue &v3,
154  std::string n4, const AttributeValue &v4,
155  std::string n5, const AttributeValue &v5,
156  std::string n6, const AttributeValue &v6,
157  std::string n7, const AttributeValue &v7)
158 {
161  m_errorRateModel.Set (n0, v0);
162  m_errorRateModel.Set (n1, v1);
163  m_errorRateModel.Set (n2, v2);
164  m_errorRateModel.Set (n3, v3);
165  m_errorRateModel.Set (n4, v4);
166  m_errorRateModel.Set (n5, v5);
167  m_errorRateModel.Set (n6, v6);
168  m_errorRateModel.Set (n7, v7);
169 }
170 
171 void
173  std::string n0, const AttributeValue &v0,
174  std::string n1, const AttributeValue &v1,
175  std::string n2, const AttributeValue &v2,
176  std::string n3, const AttributeValue &v3,
177  std::string n4, const AttributeValue &v4,
178  std::string n5, const AttributeValue &v5,
179  std::string n6, const AttributeValue &v6,
180  std::string n7, const AttributeValue &v7)
181 {
184  m_frameCaptureModel.Set (n0, v0);
185  m_frameCaptureModel.Set (n1, v1);
186  m_frameCaptureModel.Set (n2, v2);
187  m_frameCaptureModel.Set (n3, v3);
188  m_frameCaptureModel.Set (n4, v4);
189  m_frameCaptureModel.Set (n5, v5);
190  m_frameCaptureModel.Set (n6, v6);
191  m_frameCaptureModel.Set (n7, v7);
192 }
193 
194 void
196  std::string n0, const AttributeValue &v0,
197  std::string n1, const AttributeValue &v1,
198  std::string n2, const AttributeValue &v2,
199  std::string n3, const AttributeValue &v3,
200  std::string n4, const AttributeValue &v4,
201  std::string n5, const AttributeValue &v5,
202  std::string n6, const AttributeValue &v6,
203  std::string n7, const AttributeValue &v7)
204 {
207  m_preambleDetectionModel.Set (n0, v0);
208  m_preambleDetectionModel.Set (n1, v1);
209  m_preambleDetectionModel.Set (n2, v2);
210  m_preambleDetectionModel.Set (n3, v3);
211  m_preambleDetectionModel.Set (n4, v4);
212  m_preambleDetectionModel.Set (n5, v5);
213  m_preambleDetectionModel.Set (n6, v6);
214  m_preambleDetectionModel.Set (n7, v7);
215 }
216 
217 void
219 {
221 }
222 
223 void
226  Ptr<const Packet> packet,
227  uint16_t channelFreqMhz,
228  WifiTxVector txVector,
229  MpduInfo aMpdu,
230  uint16_t staId)
231 {
232  uint32_t dlt = file->GetDataLinkType ();
233  switch (dlt)
234  {
236  file->Write (Simulator::Now (), packet);
237  return;
239  {
240  NS_FATAL_ERROR ("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
241  return;
242  }
244  {
245  Ptr<Packet> p = packet->Copy ();
246  RadiotapHeader header;
247  GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId);
248  p->AddHeader (header);
249  file->Write (Simulator::Now (), p);
250  return;
251  }
252  default:
253  NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
254  }
255 }
256 
257 void
260  Ptr<const Packet> packet,
261  uint16_t channelFreqMhz,
262  WifiTxVector txVector,
263  MpduInfo aMpdu,
264  SignalNoiseDbm signalNoise,
265  uint16_t staId)
266 {
267  uint32_t dlt = file->GetDataLinkType ();
268  switch (dlt)
269  {
271  file->Write (Simulator::Now (), packet);
272  return;
274  {
275  NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
276  return;
277  }
279  {
280  Ptr<Packet> p = packet->Copy ();
281  RadiotapHeader header;
282  GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId, signalNoise);
283  p->AddHeader (header);
284  file->Write (Simulator::Now (), p);
285  return;
286  }
287  default:
288  NS_ABORT_MSG ("PcapSniffRxEvent(): Unexpected data link type " << dlt);
289  }
290 }
291 
292 void
294  RadiotapHeader &header,
295  Ptr<Packet> packet,
296  uint16_t channelFreqMhz,
297  WifiTxVector txVector,
298  MpduInfo aMpdu,
299  uint16_t staId,
300  SignalNoiseDbm signalNoise)
301 {
302  header.SetAntennaSignalPower (signalNoise.signal);
303  header.SetAntennaNoisePower (signalNoise.noise);
304  GetRadiotapHeader (header, packet, channelFreqMhz, txVector, aMpdu, staId);
305 }
306 
307 void
309  RadiotapHeader &header,
310  Ptr<Packet> packet,
311  uint16_t channelFreqMhz,
312  WifiTxVector txVector,
313  MpduInfo aMpdu,
314  uint16_t staId)
315 {
316  WifiPreamble preamble = txVector.GetPreambleType ();
317 
318  uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
319  header.SetTsft (Simulator::Now ().GetMicroSeconds ());
320 
321  //Our capture includes the FCS, so we set the flag to say so.
323 
324  if (preamble == WIFI_PREAMBLE_SHORT)
325  {
327  }
328 
329  if (txVector.GetGuardInterval () == 400)
330  {
332  }
333 
334  header.SetFrameFlags (frameFlags);
335 
336  uint64_t rate = 0;
337  if (txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HT
338  && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_VHT
339  && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HE)
340  {
341  rate = txVector.GetMode (staId).GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss (staId) / 500000;
342  header.SetRate (static_cast<uint8_t> (rate));
343  }
344 
345  uint16_t channelFlags = 0;
346  switch (rate)
347  {
348  case 2: //1Mbps
349  case 4: //2Mbps
350  case 10: //5Mbps
351  case 22: //11Mbps
352  channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
353  break;
354  default:
355  channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
356  break;
357  }
358 
359  if (channelFreqMhz < 2500)
360  {
362  }
363  else
364  {
366  }
367 
368  header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
369 
370  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HT)
371  {
372  uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
373  uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
374 
376 
378  if (txVector.GetChannelWidth () == 40)
379  {
381  }
382 
384  if (txVector.GetGuardInterval () == 400)
385  {
387  }
388 
390  if (preamble == WIFI_PREAMBLE_HT_GF)
391  {
393  }
394 
395  mcsKnown |= RadiotapHeader::MCS_KNOWN_NESS;
396  if (txVector.GetNess () & 0x01) //bit 1
397  {
399  }
400  if (txVector.GetNess () & 0x02) //bit 2
401  {
403  }
404 
405  mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; //only BCC is currently supported
406 
407  mcsKnown |= RadiotapHeader::MCS_KNOWN_STBC;
408  if (txVector.IsStbc ())
409  {
411  }
412 
413  header.SetMcsFields (mcsKnown, mcsFlags, txVector.GetMode (staId).GetMcsValue ());
414  }
415 
416  if (txVector.IsAggregation ())
417  {
418  uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
419  ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
420  /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
422  uint32_t extractedLength;
423  packet->RemoveHeader (hdr);
424  extractedLength = hdr.GetLength ();
425  packet = packet->CreateFragment (0, static_cast<uint32_t> (extractedLength));
426  if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true && hdr.GetLength () > 0))
427  {
428  ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
429  }
430  header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, 1 /*CRC*/);
431  }
432 
433  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_VHT)
434  {
435  uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE;
436  uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE;
437  uint8_t vhtBandwidth = 0;
438  uint8_t vhtMcsNss[4] = {0,0,0,0};
439  uint8_t vhtCoding = 0;
440  uint8_t vhtGroupId = 0;
441  uint16_t vhtPartialAid = 0;
442 
443  vhtKnown |= RadiotapHeader::VHT_KNOWN_STBC;
444  if (txVector.IsStbc ())
445  {
446  vhtFlags |= RadiotapHeader::VHT_FLAGS_STBC;
447  }
448 
450  if (txVector.GetGuardInterval () == 400)
451  {
453  }
454 
455  vhtKnown |= RadiotapHeader::VHT_KNOWN_BEAMFORMED; //Beamforming is currently not supported
456 
458  //not all bandwidth values are currently supported
459  if (txVector.GetChannelWidth () == 40)
460  {
461  vhtBandwidth = 1;
462  }
463  else if (txVector.GetChannelWidth () == 80)
464  {
465  vhtBandwidth = 4;
466  }
467  else if (txVector.GetChannelWidth () == 160)
468  {
469  vhtBandwidth = 11;
470  }
471 
472  //only SU PPDUs are currently supported
473  vhtMcsNss[0] |= (txVector.GetNss (staId) & 0x0f);
474  vhtMcsNss[0] |= ((txVector.GetMode (staId).GetMcsValue () << 4) & 0xf0);
475 
476  header.SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
477  }
478 
479  if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HE)
480  {
482  if (preamble == WIFI_PREAMBLE_HE_ER_SU)
483  {
485  }
486  else if (preamble == WIFI_PREAMBLE_HE_MU)
487  {
490  }
491  else if (preamble == WIFI_PREAMBLE_HE_TB)
492  {
494  }
495 
496  uint16_t data2 = RadiotapHeader::HE_DATA2_GI_KNOWN;
497  if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
498  {
500  //HeRu indices start at 1 whereas RadioTap starts at 0
501  data2 |= (((txVector.GetHeMuUserInfo (staId).ru.index - 1) << 8) & 0x3f00);
502  data2 |= (((!txVector.GetHeMuUserInfo (staId).ru.primary80MHz) << 15) & 0x8000);
503  }
504 
505  uint16_t data3 = 0;
506  data3 |= (txVector.GetBssColor () & 0x003f);
507  data3 |= ((txVector.GetMode (staId).GetMcsValue () << 8) & 0x0f00);
508 
509  uint16_t data4 = 0;
510  if (preamble == WIFI_PREAMBLE_HE_MU)
511  {
512  data4 |= ((staId << 4) & 0x7ff0);
513  }
514 
515  uint16_t data5 = 0;
516  if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
517  {
518  HeRu::RuType ruType = txVector.GetHeMuUserInfo (staId).ru.ruType;
519  switch (ruType)
520  {
521  case HeRu::RU_26_TONE:
523  break;
524  case HeRu::RU_52_TONE:
526  break;
527  case HeRu::RU_106_TONE:
529  break;
530  case HeRu::RU_242_TONE:
532  break;
533  case HeRu::RU_484_TONE:
535  break;
536  case HeRu::RU_996_TONE:
538  break;
539  case HeRu::RU_2x996_TONE:
541  break;
542  default:
543  NS_ABORT_MSG ("Unexpected RU type");
544  }
545  }
546  else if (txVector.GetChannelWidth () == 40)
547  {
549  }
550  else if (txVector.GetChannelWidth () == 80)
551  {
553  }
554  else if (txVector.GetChannelWidth () == 160)
555  {
557  }
558  if (txVector.GetGuardInterval () == 1600)
559  {
561  }
562  else if (txVector.GetGuardInterval () == 3200)
563  {
565  }
566 
567  header.SetHeFields (data1, data2, data3, data4, data5, 0);
568  }
569 
570  if (preamble == WIFI_PREAMBLE_HE_MU)
571  {
572  //TODO: fill in fields (everything is set to 0 so far)
573  std::array<uint8_t, 4> ruChannel1, ruChannel2;
574  header.SetHeMuFields (0, 0, ruChannel1, ruChannel2);
575  header.SetHeMuPerUserFields (0, 0, 0, 0);
576  }
577 }
578 
579 void
581 {
582  switch (dlt)
583  {
584  case DLT_IEEE802_11:
586  return;
587  case DLT_PRISM_HEADER:
589  return;
592  return;
593  default:
594  NS_ABORT_MSG ("WifiPhyHelper::SetPcapFormat(): Unexpected format");
595  }
596 }
597 
600 {
601  return m_pcapDlt;
602 }
603 
604 void
605 WifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
606 {
607  NS_LOG_FUNCTION (this << prefix << nd << promiscuous << explicitFilename);
608 
609  //All of the Pcap enable functions vector through here including the ones
610  //that are wandering through all of devices on perhaps all of the nodes in
611  //the system. We can only deal with devices of type WifiNetDevice.
612  Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
613  if (device == 0)
614  {
615  NS_LOG_INFO ("WifiHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WifiNetDevice");
616  return;
617  }
618 
619  Ptr<WifiPhy> phy = device->GetPhy ();
620  NS_ABORT_MSG_IF (phy == 0, "WifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
621 
622  PcapHelper pcapHelper;
623 
624  std::string filename;
625  if (explicitFilename)
626  {
627  filename = prefix;
628  }
629  else
630  {
631  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
632  }
633 
634  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, m_pcapDlt);
635 
636  phy->TraceConnectWithoutContext ("MonitorSnifferTx", MakeBoundCallback (&WifiPhyHelper::PcapSniffTxEvent, file));
637  phy->TraceConnectWithoutContext ("MonitorSnifferRx", MakeBoundCallback (&WifiPhyHelper::PcapSniffRxEvent, file));
638 }
639 
640 void
643  std::string prefix,
644  Ptr<NetDevice> nd,
645  bool explicitFilename)
646 {
647  //All of the ASCII enable functions vector through here including the ones
648  //that are wandering through all of devices on perhaps all of the nodes in
649  //the system. We can only deal with devices of type WifiNetDevice.
650  Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> ();
651  if (device == 0)
652  {
653  NS_LOG_INFO ("WifiHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::WifiNetDevice");
654  return;
655  }
656 
657  //Our trace sinks are going to use packet printing, so we have to make sure
658  //that is turned on.
660 
661  uint32_t nodeid = nd->GetNode ()->GetId ();
662  uint32_t deviceid = nd->GetIfIndex ();
663  std::ostringstream oss;
664 
665  //If we are not provided an OutputStreamWrapper, we are expected to create
666  //one using the usual trace filename conventions and write our traces
667  //without a context since there will be one file per context and therefore
668  //the context would be redundant.
669  if (stream == 0)
670  {
671  //Set up an output stream object to deal with private ofstream copy
672  //constructor and lifetime issues. Let the helper decide the actual
673  //name of the file given the prefix.
674  AsciiTraceHelper asciiTraceHelper;
675 
676  std::string filename;
677  if (explicitFilename)
678  {
679  filename = prefix;
680  }
681  else
682  {
683  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
684  }
685 
686  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
687  //We could go poking through the PHY and the state looking for the
688  //correct trace source, but we can let Config deal with that with
689  //some search cost. Since this is presumably happening at topology
690  //creation time, it doesn't seem much of a price to pay.
691  oss.str ("");
692  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
694 
695  oss.str ("");
696  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
698 
699  return;
700  }
701 
702  //If we are provided an OutputStreamWrapper, we are expected to use it, and
703  //to provide a context. We are free to come up with our own context if we
704  //want, and use the AsciiTraceHelper Hook*WithContext functions, but for
705  //compatibility and simplicity, we just use Config::Connect and let it deal
706  //with coming up with a context.
707  oss.str ("");
708  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
710 
711  oss.str ("");
712  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
714 }
715 
717 {
718 }
719 
721  : m_standard (WIFI_STANDARD_80211a),
722  m_selectQueueCallback (&SelectQueueByDSField)
723 {
724  SetRemoteStationManager ("ns3::ArfWifiManager");
725  SetAckPolicySelectorForAc (AC_BE, "ns3::ConstantWifiAckPolicySelector");
726  SetAckPolicySelectorForAc (AC_BK, "ns3::ConstantWifiAckPolicySelector");
727  SetAckPolicySelectorForAc (AC_VI, "ns3::ConstantWifiAckPolicySelector");
728  SetAckPolicySelectorForAc (AC_VO, "ns3::ConstantWifiAckPolicySelector");
729 }
730 
731 void
733  std::string n0, const AttributeValue &v0,
734  std::string n1, const AttributeValue &v1,
735  std::string n2, const AttributeValue &v2,
736  std::string n3, const AttributeValue &v3,
737  std::string n4, const AttributeValue &v4,
738  std::string n5, const AttributeValue &v5,
739  std::string n6, const AttributeValue &v6,
740  std::string n7, const AttributeValue &v7)
741 {
744  m_stationManager.Set (n0, v0);
745  m_stationManager.Set (n1, v1);
746  m_stationManager.Set (n2, v2);
747  m_stationManager.Set (n3, v3);
748  m_stationManager.Set (n4, v4);
749  m_stationManager.Set (n5, v5);
750  m_stationManager.Set (n6, v6);
751  m_stationManager.Set (n7, v7);
752 }
753 
754 void
756  std::string n0, const AttributeValue &v0,
757  std::string n1, const AttributeValue &v1,
758  std::string n2, const AttributeValue &v2,
759  std::string n3, const AttributeValue &v3,
760  std::string n4, const AttributeValue &v4,
761  std::string n5, const AttributeValue &v5,
762  std::string n6, const AttributeValue &v6,
763  std::string n7, const AttributeValue &v7)
764 {
767  m_obssPdAlgorithm.Set (n0, v0);
768  m_obssPdAlgorithm.Set (n1, v1);
769  m_obssPdAlgorithm.Set (n2, v2);
770  m_obssPdAlgorithm.Set (n3, v3);
771  m_obssPdAlgorithm.Set (n4, v4);
772  m_obssPdAlgorithm.Set (n5, v5);
773  m_obssPdAlgorithm.Set (n6, v6);
774  m_obssPdAlgorithm.Set (n7, v7);
775 }
776 
777 void
779  std::string n0, const AttributeValue &v0,
780  std::string n1, const AttributeValue &v1,
781  std::string n2, const AttributeValue &v2,
782  std::string n3, const AttributeValue &v3,
783  std::string n4, const AttributeValue &v4,
784  std::string n5, const AttributeValue &v5,
785  std::string n6, const AttributeValue &v6,
786  std::string n7, const AttributeValue &v7)
787 {
789  m_ackPolicySelector[ac].SetTypeId (type);
790  m_ackPolicySelector[ac].Set (n0, v0);
791  m_ackPolicySelector[ac].Set (n1, v1);
792  m_ackPolicySelector[ac].Set (n2, v2);
793  m_ackPolicySelector[ac].Set (n3, v3);
794  m_ackPolicySelector[ac].Set (n4, v4);
795  m_ackPolicySelector[ac].Set (n5, v5);
796  m_ackPolicySelector[ac].Set (n6, v6);
797  m_ackPolicySelector[ac].Set (n7, v7);
798 }
799 
800 void
802 {
803  m_standard = standard;
804 }
805 
806 // NS_DEPRECATED_3_32
807 void
809 {
810  switch (standard)
811  {
814  return;
817  return;
820  return;
823  return;
824  // remove the next value from WifiPhyStandard when deprecation ends
827  return;
828  // remove the next value from WifiPhyStandard when deprecation ends
831  return;
834  return;
835  default:
836  NS_FATAL_ERROR ("Unsupported value of WifiPhyStandard");
837  }
838 }
839 
840 void
842 {
844 }
845 
848  const WifiMacHelper &macHelper,
850  NodeContainer::Iterator last) const
851 {
853  for (NodeContainer::Iterator i = first; i != last; ++i)
854  {
855  Ptr<Node> node = *i;
856  Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
857  auto it = wifiStandards.find (m_standard);
858  if (it == wifiStandards.end ())
859  {
860  NS_FATAL_ERROR ("Selected standard is not defined!");
861  return devices;
862  }
863  if (it->second.phyStandard >= WIFI_PHY_STANDARD_80211n)
864  {
865  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
866  device->SetHtConfiguration (htConfiguration);
867  }
868  if ((it->second.phyStandard >= WIFI_PHY_STANDARD_80211ac) && (it->second.phyBand != WIFI_PHY_BAND_2_4GHZ))
869  {
870  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
871  device->SetVhtConfiguration (vhtConfiguration);
872  }
873  if (it->second.phyStandard >= WIFI_PHY_STANDARD_80211ax)
874  {
875  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
876  device->SetHeConfiguration (heConfiguration);
877  }
879  Ptr<WifiMac> mac = macHelper.Create (device);
880  Ptr<WifiPhy> phy = phyHelper.Create (node, device);
881  mac->SetAddress (Mac48Address::Allocate ());
882  mac->ConfigureStandard (m_standard);
883  phy->ConfigureStandardAndBand (it->second.phyStandard, it->second.phyBand);
884  device->SetMac (mac);
885  device->SetPhy (phy);
886  device->SetRemoteStationManager (manager);
887  node->AddDevice (device);
888  if ((it->second.phyStandard >= WIFI_PHY_STANDARD_80211ax) && (m_obssPdAlgorithm.IsTypeIdSet ()))
889  {
891  device->AggregateObject (obssPdAlgorithm);
892  obssPdAlgorithm->ConnectWifiNetDevice (device);
893  }
894  devices.Add (device);
895  NS_LOG_DEBUG ("node=" << node << ", mob=" << node->GetObject<MobilityModel> ());
896  // Aggregate a NetDeviceQueueInterface object if a RegularWifiMac is installed
897  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac);
898  if (rmac)
899  {
901  BooleanValue qosSupported;
902  PointerValue ptr;
903  Ptr<WifiMacQueue> wmq;
904  Ptr<WifiAckPolicySelector> ackSelector;
905 
906  rmac->GetAttributeFailSafe ("QosSupported", qosSupported);
907  if (qosSupported.Get ())
908  {
909  ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface> ("NTxQueues",
910  UintegerValue (4));
911 
912  rmac->GetAttributeFailSafe ("BE_Txop", ptr);
914  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
915  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
916  wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
917  ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
918 
919  rmac->GetAttributeFailSafe ("BK_Txop", ptr);
921  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
922  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
923  wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
924  ndqi->GetTxQueue (1)->ConnectQueueTraces (wmq);
925 
926  rmac->GetAttributeFailSafe ("VI_Txop", ptr);
928  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
929  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
930  wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
931  ndqi->GetTxQueue (2)->ConnectQueueTraces (wmq);
932 
933  rmac->GetAttributeFailSafe ("VO_Txop", ptr);
935  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
936  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
937  wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
938  ndqi->GetTxQueue (3)->ConnectQueueTraces (wmq);
939  ndqi->SetSelectQueueCallback (m_selectQueueCallback);
940  }
941  else
942  {
943  ndqi = CreateObject<NetDeviceQueueInterface> ();
944 
945  rmac->GetAttributeFailSafe ("Txop", ptr);
946  wmq = ptr.Get<Txop> ()->GetWifiMacQueue ();
947  ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
948  }
949  device->AggregateObject (ndqi);
950  }
951  }
952  return devices;
953 }
954 
957  const WifiMacHelper &macHelper, NodeContainer c) const
958 {
959  return Install (phyHelper, macHelper, c.Begin (), c.End ());
960 }
961 
964  const WifiMacHelper &mac, Ptr<Node> node) const
965 {
966  return Install (phy, mac, NodeContainer (node));
967 }
968 
971  const WifiMacHelper &mac, std::string nodeName) const
972 {
973  Ptr<Node> node = Names::Find<Node> (nodeName);
974  return Install (phy, mac, NodeContainer (node));
975 }
976 
977 void
979 {
982 
983  LogComponentEnable ("AarfWifiManager", LOG_LEVEL_ALL);
984  LogComponentEnable ("AarfcdWifiManager", LOG_LEVEL_ALL);
985  LogComponentEnable ("AdhocWifiMac", LOG_LEVEL_ALL);
986  LogComponentEnable ("AmrrWifiManager", LOG_LEVEL_ALL);
987  LogComponentEnable ("ApWifiMac", LOG_LEVEL_ALL);
988  LogComponentEnable ("AparfWifiManager", LOG_LEVEL_ALL);
989  LogComponentEnable ("ArfWifiManager", LOG_LEVEL_ALL);
990  LogComponentEnable ("BlockAckAgreement", LOG_LEVEL_ALL);
991  LogComponentEnable ("BlockAckCache", LOG_LEVEL_ALL);
992  LogComponentEnable ("BlockAckManager", LOG_LEVEL_ALL);
993  LogComponentEnable ("CaraWifiManager", LOG_LEVEL_ALL);
994  LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
995  LogComponentEnable ("ConstantObssPdAlgorithm", LOG_LEVEL_ALL);
996  LogComponentEnable ("ConstantRateWifiManager", LOG_LEVEL_ALL);
997  LogComponentEnable ("ConstantWifiAckPolicySelector", LOG_LEVEL_ALL);
998  LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
999  LogComponentEnable ("DsssErrorRateModel", LOG_LEVEL_ALL);
1000  LogComponentEnable ("HeConfiguration", LOG_LEVEL_ALL);
1001  LogComponentEnable ("HtConfiguration", LOG_LEVEL_ALL);
1002  LogComponentEnable ("IdealWifiManager", LOG_LEVEL_ALL);
1003  LogComponentEnable ("InfrastructureWifiMac", LOG_LEVEL_ALL);
1004  LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL);
1005  LogComponentEnable ("MacLow", LOG_LEVEL_ALL);
1006  LogComponentEnable ("MacRxMiddle", LOG_LEVEL_ALL);
1007  LogComponentEnable ("MacTxMiddle", LOG_LEVEL_ALL);
1008  LogComponentEnable ("MinstrelHtWifiManager", LOG_LEVEL_ALL);
1009  LogComponentEnable ("MinstrelWifiManager", LOG_LEVEL_ALL);
1010  LogComponentEnable ("MpduAggregator", LOG_LEVEL_ALL);
1011  LogComponentEnable ("MsduAggregator", LOG_LEVEL_ALL);
1012  LogComponentEnable ("NistErrorRateModel", LOG_LEVEL_ALL);
1013  LogComponentEnable ("ObssPdAlgorithm", LOG_LEVEL_ALL);
1014  LogComponentEnable ("OnoeWifiManager", LOG_LEVEL_ALL);
1015  LogComponentEnable ("OriginatorBlockAckAgreement", LOG_LEVEL_ALL);
1016  LogComponentEnable ("ParfWifiManager", LOG_LEVEL_ALL);
1017  LogComponentEnable ("QosTxop", LOG_LEVEL_ALL);
1018  LogComponentEnable ("RegularWifiMac", LOG_LEVEL_ALL);
1019  LogComponentEnable ("RraaWifiManager", LOG_LEVEL_ALL);
1020  LogComponentEnable ("RrpaaWifiManager", LOG_LEVEL_ALL);
1021  LogComponentEnable ("SimpleFrameCaptureModel", LOG_LEVEL_ALL);
1022  LogComponentEnable ("SpectrumWifiPhy", LOG_LEVEL_ALL);
1023  LogComponentEnable ("StaWifiMac", LOG_LEVEL_ALL);
1024  LogComponentEnable ("SupportedRates", LOG_LEVEL_ALL);
1025  LogComponentEnable ("TableBasedErrorRateModel", LOG_LEVEL_ALL);
1026  LogComponentEnable ("ThresholdPreambleDetectionModel", LOG_LEVEL_ALL);
1028  LogComponentEnable ("VhtConfiguration", LOG_LEVEL_ALL);
1029  LogComponentEnable ("WifiAckPolicySelector", LOG_LEVEL_ALL);
1030  LogComponentEnable ("WifiMac", LOG_LEVEL_ALL);
1031  LogComponentEnable ("WifiMacQueue", LOG_LEVEL_ALL);
1032  LogComponentEnable ("WifiMacQueueItem", LOG_LEVEL_ALL);
1033  LogComponentEnable ("WifiNetDevice", LOG_LEVEL_ALL);
1034  LogComponentEnable ("WifiPhyStateHelper", LOG_LEVEL_ALL);
1035  LogComponentEnable ("WifiPhy", LOG_LEVEL_ALL);
1036  LogComponentEnable ("WifiPpdu", LOG_LEVEL_ALL);
1037  LogComponentEnable ("WifiPsdu", LOG_LEVEL_ALL);
1038  LogComponentEnable ("WifiRadioEnergyModel", LOG_LEVEL_ALL);
1039  LogComponentEnable ("WifiRemoteStationManager", LOG_LEVEL_ALL);
1040  LogComponentEnable ("WifiSpectrumPhyInterface", LOG_LEVEL_ALL);
1041  LogComponentEnable ("WifiSpectrumSignalParameters", LOG_LEVEL_ALL);
1042  LogComponentEnable ("WifiTxCurrentModel", LOG_LEVEL_ALL);
1043  LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
1044  LogComponentEnable ("YansWifiChannel", LOG_LEVEL_ALL);
1045  LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL);
1046 
1047  //From Spectrum
1048  LogComponentEnable ("WifiSpectrumValueHelper", LOG_LEVEL_ALL);
1049 }
1050 
1051 int64_t
1053 {
1054  int64_t currentStream = stream;
1055  Ptr<NetDevice> netDevice;
1056  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
1057  {
1058  netDevice = (*i);
1059  Ptr<WifiNetDevice> wifi = DynamicCast<WifiNetDevice> (netDevice);
1060  if (wifi)
1061  {
1062  //Handle any random numbers in the PHY objects.
1063  currentStream += wifi->GetPhy ()->AssignStreams (currentStream);
1064 
1065  //Handle any random numbers in the station managers.
1066  Ptr<WifiRemoteStationManager> manager = wifi->GetRemoteStationManager ();
1067  Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager);
1068  if (minstrel)
1069  {
1070  currentStream += minstrel->AssignStreams (currentStream);
1071  }
1072 
1073  Ptr<MinstrelHtWifiManager> minstrelHt = DynamicCast<MinstrelHtWifiManager> (manager);
1074  if (minstrelHt)
1075  {
1076  currentStream += minstrelHt->AssignStreams (currentStream);
1077  }
1078 
1079  //Handle any random numbers in the MAC objects.
1080  Ptr<WifiMac> mac = wifi->GetMac ();
1081  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac);
1082  if (rmac)
1083  {
1084  PointerValue ptr;
1085  rmac->GetAttribute ("Txop", ptr);
1086  Ptr<Txop> txop = ptr.Get<Txop> ();
1087  currentStream += txop->AssignStreams (currentStream);
1088 
1089  rmac->GetAttribute ("VO_Txop", ptr);
1090  Ptr<QosTxop> vo_txop = ptr.Get<QosTxop> ();
1091  currentStream += vo_txop->AssignStreams (currentStream);
1092 
1093  rmac->GetAttribute ("VI_Txop", ptr);
1094  Ptr<QosTxop> vi_txop = ptr.Get<QosTxop> ();
1095  currentStream += vi_txop->AssignStreams (currentStream);
1096 
1097  rmac->GetAttribute ("BE_Txop", ptr);
1098  Ptr<QosTxop> be_txop = ptr.Get<QosTxop> ();
1099  currentStream += be_txop->AssignStreams (currentStream);
1100 
1101  rmac->GetAttribute ("BK_Txop", ptr);
1102  Ptr<QosTxop> bk_txop = ptr.Get<QosTxop> ();
1103  currentStream += bk_txop->AssignStreams (currentStream);
1104 
1105  //if an AP, handle any beacon jitter
1106  Ptr<ApWifiMac> apmac = DynamicCast<ApWifiMac> (rmac);
1107  if (apmac)
1108  {
1109  currentStream += apmac->AssignStreams (currentStream);
1110  }
1111  }
1112  }
1113  }
1114  return (currentStream - stream);
1115 }
1116 
1117 } //namespace ns3
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:138
ERP-OFDM PHY (Clause 19, Section 19.5)
MpduInfo structure.
Definition: wifi-phy.h:126
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
Frame used short guard interval (HT)
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:143
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 SetPreambleDetectionModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:195
double signal
in dBm
Definition: wifi-phy.h:121
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
RuType ruType
RU type.
Definition: he-ru.h:67
Prefix all trace prints with simulation node.
Definition: log.h:120
Manage ASCII trace files for device models.
Definition: trace-helper.h:161
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Ptr< T > Get(void) const
Definition: pointer.h:201
HT PHY for the 5 GHz band (clause 20)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Beamformed known/applicable (this flag should be set to zero for MU PPDUs).
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:847
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:110
void SetObssPdAlgorithm(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:755
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:732
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Radiotap header implementation.
virtual ~WifiHelper()
Definition: wifi-helper.cc:716
Hold a value for an Attribute.
Definition: attribute.h:68
Manage pcap files for device models.
Definition: trace-helper.h:38
create PHY objects
Definition: wifi-helper.h:46
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:315
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:92
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
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
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
bool primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:66
OBSS PD algorithm interfaceThis object provides the interface for all OBSS_PD algorithms and is desig...
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
bool IsStbc(void) const
Check if STBC is used or not.
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:89
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
uint8_t GetNess(void) const
uint16_t GetGuardInterval(void) const
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we&#39;ll use to write the traced bits. ...
HT PHY for the 2.4 GHz band (clause 20)
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference...
VHT PHY (Clause 22)
Definition: wifi-mode.h:62
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.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:241
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...
HeMuUserInfo GetHeMuUserInfo(uint16_t staId) const
Get the HE MU user-specific transmission information for the given STA-ID.
Frame sent/received with short preamble.
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
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
Video.
Definition: qos-utils.h:45
Voice.
Definition: qos-utils.h:47
Best Effort.
Definition: qos-utils.h:41
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:720
const std::map< WifiStandard, WifiStandardInfo > wifiStandards
map a given standard configured by the user to the corresponding WifiStandardInfo ...
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ASCII trace output on the indicated net device.
Definition: wifi-helper.cc:641
phy
Definition: third.py:93
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:243
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...
WifiPreamble GetPreambleType(void) const
DataLinkType
This enumeration holds the data link types that will be written to the pcap file. ...
Definition: trace-helper.h:50
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:32
Keep track of the current position and velocity of an object.
Background.
Definition: qos-utils.h:43
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
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
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
bool GetEof(void) const
Return the EOF field.
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetMac(const Ptr< WifiMac > mac)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: txop.cc:332
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
This frame is the last subframe.
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:224
Hold an unsigned integer type.
Definition: uinteger.h:44
void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags)
Set the transmit/receive channel frequency and flags.
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
Ness - bit 0 (LSB) of Number of extension spatial streams.
void SetFrameCaptureModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:172
Headers for A-MPDU subframes.
HT PHY (Clause 20)
Definition: wifi-mode.h:60
void SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4, uint16_t data5, uint16_t data6)
Set the HE fields.
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 ...
Hold together all Wifi-related objects.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:899
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:564
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:599
hold a list of per-remote-station state.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:480
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:918
Include Prism monitor mode information.
Definition: wifi-helper.h:179
void SetFrameFlags(uint8_t flags)
Set the frame flags of the transmitted or received frame.
bool Get(void) const
Definition: boolean.cc:51
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
Ptr< WifiPhy > GetPhy(void) const
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
double f(double x, void *params)
Definition: 80211b.c:70
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:385
Prefix all trace prints with simulation time.
Definition: log.h:119
OFDM PHY (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:164
Ness data - bit 1 (MSB) of Number of extension spatial streams.
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: wifi-helper.h:561
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:801
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:563
void SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs)
Set the MCS fields.
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:560
create MAC layers for a ns3::WifiNetDevice.
HeRu::RuSpec ru
RU specification.
Ness known (Number of extension spatial streams)
The 2.4 GHz band.
Definition: wifi-phy-band.h:33
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:580
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:149
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId.
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:605
void SetHeMuPerUserFields(uint16_t per_user_1, uint16_t per_user_2, uint8_t perUserPosition, uint8_t perUserKnown)
Set the HE MU per user fields.
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:240
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device) const
Space-time block coding (1 if all spatial streams of all users have STBC, 0 otherwise).
wifi
Definition: third.py:96
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:308
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.
Instantiate subclasses of ns3::Object.
void SetPhy(const Ptr< WifiPhy > phy)
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:258
Set if all spatial streams of all users have space-time block coding.
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:978
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:841
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
SignalNoiseDbm structure.
Definition: wifi-phy.h:119
uint32_t mpduRefNumber
MPDU ref number.
Definition: wifi-phy.h:129
uint8_t GetBssColor(void) const
Get the BSS color.
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:178
std::size_t index
index (starting at 1)
Definition: he-ru.h:68
uint16_t GetLength(void) const
Return the length field.
Last subframe is known (should be set for all subframes in an A-MPDU)
Print everything.
Definition: log.h:116
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:242
double noise
in dBm
Definition: wifi-phy.h:122
Spatial Reuse 2 known (HE TRIG PPDU format), STA-ID known (HE MU PPDU format)
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:439
uint16_t GetChannelWidth(void) const
Default: 20 MHz, long guard interval, mixed HT format and BCC FEC type.
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:176
devices
Definition: first.py:39
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:218
WifiAckPolicySelector is in charge of selecting the acknowledgment policy for PSDUs containing QoS Da...
Definition: first.py:1
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:562
MpduType type
type
Definition: wifi-phy.h:128
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:458
void SetAckPolicySelectorForAc(AcIndex ac, std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:778
void SetAmpduStatus(uint32_t referenceNumber, uint16_t flags, uint8_t crc)
Set the A-MPDU status fields.
a unique identifier for an interface.
Definition: type-id.h:58
Include Radiotap link layer information.
Definition: wifi-helper.h:180
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:47
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
HE PHY (Clause 26)
Definition: wifi-mode.h:64
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:127
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference...
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:66
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:68