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 "wifi-helper.h"
41
42namespace ns3 {
43
44NS_LOG_COMPONENT_DEFINE ("WifiHelper");
45
55static void
58 std::string context,
60 WifiMode mode,
61 WifiPreamble preamble,
62 uint8_t txLevel)
63{
64 NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
65 *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << mode << " " << *p << std::endl;
66}
67
76static void
80 WifiMode mode,
81 WifiPreamble preamble,
82 uint8_t txLevel)
83{
84 NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel);
85 *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << mode << " " << *p << std::endl;
86}
87
97static void
100 std::string context,
102 double snr,
103 WifiMode mode,
104 WifiPreamble preamble)
105{
106 NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble);
107 *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << " " << context << " " << *p << std::endl;
108}
109
118static void
122 double snr,
123 WifiMode mode,
124 WifiPreamble preamble)
125{
126 NS_LOG_FUNCTION (stream << p << snr << mode << preamble);
127 *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << mode << " " << *p << std::endl;
128}
129
131 : m_pcapDlt (PcapHelper::DLT_IEEE802_11)
132{
133 SetPreambleDetectionModel ("ns3::ThresholdPreambleDetectionModel");
134}
135
137{
138}
139
140void
141WifiPhyHelper::Set (std::string name, const AttributeValue &v)
142{
143 m_phy.Set (name, v);
144}
145
146void
148 std::string n0, const AttributeValue &v0,
149 std::string n1, const AttributeValue &v1,
150 std::string n2, const AttributeValue &v2,
151 std::string n3, const AttributeValue &v3,
152 std::string n4, const AttributeValue &v4,
153 std::string n5, const AttributeValue &v5,
154 std::string n6, const AttributeValue &v6,
155 std::string n7, const AttributeValue &v7)
156{
159 m_errorRateModel.Set (n0, v0);
160 m_errorRateModel.Set (n1, v1);
161 m_errorRateModel.Set (n2, v2);
162 m_errorRateModel.Set (n3, v3);
163 m_errorRateModel.Set (n4, v4);
164 m_errorRateModel.Set (n5, v5);
165 m_errorRateModel.Set (n6, v6);
166 m_errorRateModel.Set (n7, v7);
167}
168
169void
171 std::string n0, const AttributeValue &v0,
172 std::string n1, const AttributeValue &v1,
173 std::string n2, const AttributeValue &v2,
174 std::string n3, const AttributeValue &v3,
175 std::string n4, const AttributeValue &v4,
176 std::string n5, const AttributeValue &v5,
177 std::string n6, const AttributeValue &v6,
178 std::string n7, const AttributeValue &v7)
179{
182 m_frameCaptureModel.Set (n0, v0);
183 m_frameCaptureModel.Set (n1, v1);
184 m_frameCaptureModel.Set (n2, v2);
185 m_frameCaptureModel.Set (n3, v3);
186 m_frameCaptureModel.Set (n4, v4);
187 m_frameCaptureModel.Set (n5, v5);
188 m_frameCaptureModel.Set (n6, v6);
189 m_frameCaptureModel.Set (n7, v7);
190}
191
192void
194 std::string n0, const AttributeValue &v0,
195 std::string n1, const AttributeValue &v1,
196 std::string n2, const AttributeValue &v2,
197 std::string n3, const AttributeValue &v3,
198 std::string n4, const AttributeValue &v4,
199 std::string n5, const AttributeValue &v5,
200 std::string n6, const AttributeValue &v6,
201 std::string n7, const AttributeValue &v7)
202{
213}
214
215void
217{
219}
220
221void
224 Ptr<const Packet> packet,
225 uint16_t channelFreqMhz,
226 WifiTxVector txVector,
227 MpduInfo aMpdu,
228 uint16_t staId)
229{
230 uint32_t dlt = file->GetDataLinkType ();
231 switch (dlt)
232 {
234 file->Write (Simulator::Now (), packet);
235 return;
237 {
238 NS_FATAL_ERROR ("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
239 return;
240 }
242 {
243 Ptr<Packet> p = packet->Copy ();
244 RadiotapHeader header;
245 GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId);
246 p->AddHeader (header);
247 file->Write (Simulator::Now (), p);
248 return;
249 }
250 default:
251 NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
252 }
253}
254
255void
258 Ptr<const Packet> packet,
259 uint16_t channelFreqMhz,
260 WifiTxVector txVector,
261 MpduInfo aMpdu,
262 SignalNoiseDbm signalNoise,
263 uint16_t staId)
264{
265 uint32_t dlt = file->GetDataLinkType ();
266 switch (dlt)
267 {
269 file->Write (Simulator::Now (), packet);
270 return;
272 {
273 NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
274 return;
275 }
277 {
278 Ptr<Packet> p = packet->Copy ();
279 RadiotapHeader header;
280 GetRadiotapHeader (header, p, channelFreqMhz, txVector, aMpdu, staId, signalNoise);
281 p->AddHeader (header);
282 file->Write (Simulator::Now (), p);
283 return;
284 }
285 default:
286 NS_ABORT_MSG ("PcapSniffRxEvent(): Unexpected data link type " << dlt);
287 }
288}
289
290void
292 RadiotapHeader &header,
293 Ptr<Packet> packet,
294 uint16_t channelFreqMhz,
295 WifiTxVector txVector,
296 MpduInfo aMpdu,
297 uint16_t staId,
298 SignalNoiseDbm signalNoise)
299{
300 header.SetAntennaSignalPower (signalNoise.signal);
301 header.SetAntennaNoisePower (signalNoise.noise);
302 GetRadiotapHeader (header, packet, channelFreqMhz, txVector, aMpdu, staId);
303}
304
305void
307 RadiotapHeader &header,
308 Ptr<Packet> packet,
309 uint16_t channelFreqMhz,
310 WifiTxVector txVector,
311 MpduInfo aMpdu,
312 uint16_t staId)
313{
314 WifiPreamble preamble = txVector.GetPreambleType ();
315
316 uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
317 header.SetTsft (Simulator::Now ().GetMicroSeconds ());
318
319 //Our capture includes the FCS, so we set the flag to say so.
321
322 if (preamble == WIFI_PREAMBLE_SHORT)
323 {
325 }
326
327 if (txVector.GetGuardInterval () == 400)
328 {
330 }
331
332 header.SetFrameFlags (frameFlags);
333
334 uint64_t rate = 0;
335 if (txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HT
336 && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_VHT
337 && txVector.GetMode (staId).GetModulationClass () != WIFI_MOD_CLASS_HE)
338 {
339 rate = txVector.GetMode (staId).GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss (staId) / 500000;
340 header.SetRate (static_cast<uint8_t> (rate));
341 }
342
343 uint16_t channelFlags = 0;
344 switch (rate)
345 {
346 case 2: //1Mbps
347 case 4: //2Mbps
348 case 10: //5Mbps
349 case 22: //11Mbps
350 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
351 break;
352 default:
353 channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
354 break;
355 }
356
357 if (channelFreqMhz < 2500)
358 {
360 }
361 else
362 {
364 }
365
366 header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
367
368 if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HT)
369 {
370 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
371 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
372
374
376 if (txVector.GetChannelWidth () == 40)
377 {
379 }
380
382 if (txVector.GetGuardInterval () == 400)
383 {
385 }
386
388
390 if (txVector.GetNess () & 0x01) //bit 1
391 {
393 }
394 if (txVector.GetNess () & 0x02) //bit 2
395 {
397 }
398
399 mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; //only BCC is currently supported
400
402 if (txVector.IsStbc ())
403 {
405 }
406
407 header.SetMcsFields (mcsKnown, mcsFlags, txVector.GetMode (staId).GetMcsValue ());
408 }
409
410 if (txVector.IsAggregation ())
411 {
412 uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
414 /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
416 uint32_t extractedLength;
417 packet->RemoveHeader (hdr);
418 extractedLength = hdr.GetLength ();
419 packet = packet->CreateFragment (0, static_cast<uint32_t> (extractedLength));
420 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true && hdr.GetLength () > 0))
421 {
422 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
423 }
424 header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, 1 /*CRC*/);
425 }
426
427 if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_VHT)
428 {
429 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE;
430 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE;
431 uint8_t vhtBandwidth = 0;
432 uint8_t vhtMcsNss[4] = {0,0,0,0};
433 uint8_t vhtCoding = 0;
434 uint8_t vhtGroupId = 0;
435 uint16_t vhtPartialAid = 0;
436
438 if (txVector.IsStbc ())
439 {
441 }
442
444 if (txVector.GetGuardInterval () == 400)
445 {
447 }
448
449 vhtKnown |= RadiotapHeader::VHT_KNOWN_BEAMFORMED; //Beamforming is currently not supported
450
452 //not all bandwidth values are currently supported
453 if (txVector.GetChannelWidth () == 40)
454 {
455 vhtBandwidth = 1;
456 }
457 else if (txVector.GetChannelWidth () == 80)
458 {
459 vhtBandwidth = 4;
460 }
461 else if (txVector.GetChannelWidth () == 160)
462 {
463 vhtBandwidth = 11;
464 }
465
466 //only SU PPDUs are currently supported
467 vhtMcsNss[0] |= (txVector.GetNss (staId) & 0x0f);
468 vhtMcsNss[0] |= ((txVector.GetMode (staId).GetMcsValue () << 4) & 0xf0);
469
470 header.SetVhtFields (vhtKnown, vhtFlags, vhtBandwidth, vhtMcsNss, vhtCoding, vhtGroupId, vhtPartialAid);
471 }
472
473 if (txVector.GetMode (staId).GetModulationClass () == WIFI_MOD_CLASS_HE)
474 {
476 if (preamble == WIFI_PREAMBLE_HE_ER_SU)
477 {
479 }
480 else if (preamble == WIFI_PREAMBLE_HE_MU)
481 {
484 }
485 else if (preamble == WIFI_PREAMBLE_HE_TB)
486 {
488 }
489
490 uint16_t data2 = RadiotapHeader::HE_DATA2_GI_KNOWN;
491 if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
492 {
494 //HeRu indices start at 1 whereas RadioTap starts at 0
495 data2 |= (((txVector.GetHeMuUserInfo (staId).ru.GetIndex () - 1) << 8) & 0x3f00);
496 data2 |= (((!txVector.GetHeMuUserInfo (staId).ru.GetPrimary80MHz ()) << 15) & 0x8000);
497 }
498
499 uint16_t data3 = 0;
500 data3 |= (txVector.GetBssColor () & 0x003f);
501 data3 |= ((txVector.GetMode (staId).GetMcsValue () << 8) & 0x0f00);
502
503 uint16_t data4 = 0;
504 if (preamble == WIFI_PREAMBLE_HE_MU)
505 {
506 data4 |= ((staId << 4) & 0x7ff0);
507 }
508
509 uint16_t data5 = 0;
510 if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
511 {
512 HeRu::RuType ruType = txVector.GetHeMuUserInfo (staId).ru.GetRuType ();
513 switch (ruType)
514 {
515 case HeRu::RU_26_TONE:
517 break;
518 case HeRu::RU_52_TONE:
520 break;
523 break;
526 break;
529 break;
532 break;
535 break;
536 default:
537 NS_ABORT_MSG ("Unexpected RU type");
538 }
539 }
540 else if (txVector.GetChannelWidth () == 40)
541 {
543 }
544 else if (txVector.GetChannelWidth () == 80)
545 {
547 }
548 else if (txVector.GetChannelWidth () == 160)
549 {
551 }
552 if (txVector.GetGuardInterval () == 1600)
553 {
555 }
556 else if (txVector.GetGuardInterval () == 3200)
557 {
559 }
560
561 header.SetHeFields (data1, data2, data3, data4, data5, 0);
562 }
563
564 if (preamble == WIFI_PREAMBLE_HE_MU)
565 {
566 //TODO: fill in fields (everything is set to 0 so far)
567 std::array<uint8_t, 4> ruChannel1, ruChannel2;
568 header.SetHeMuFields (0, 0, ruChannel1, ruChannel2);
569 header.SetHeMuPerUserFields (0, 0, 0, 0);
570 }
571}
572
573void
575{
576 switch (dlt)
577 {
578 case DLT_IEEE802_11:
580 return;
581 case DLT_PRISM_HEADER:
583 return;
586 return;
587 default:
588 NS_ABORT_MSG ("WifiPhyHelper::SetPcapFormat(): Unexpected format");
589 }
590}
591
594{
595 return m_pcapDlt;
596}
597
598void
599WifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
600{
601 NS_LOG_FUNCTION (this << prefix << nd << promiscuous << explicitFilename);
602
603 //All of the Pcap enable functions vector through here including the ones
604 //that are wandering through all of devices on perhaps all of the nodes in
605 //the system. We can only deal with devices of type WifiNetDevice.
607 if (device == 0)
608 {
609 NS_LOG_INFO ("WifiHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WifiNetDevice");
610 return;
611 }
612
613 Ptr<WifiPhy> phy = device->GetPhy ();
614 NS_ABORT_MSG_IF (phy == 0, "WifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
615
616 PcapHelper pcapHelper;
617
618 std::string filename;
619 if (explicitFilename)
620 {
621 filename = prefix;
622 }
623 else
624 {
625 filename = pcapHelper.GetFilenameFromDevice (prefix, device);
626 }
627
628 Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, m_pcapDlt);
629
630 phy->TraceConnectWithoutContext ("MonitorSnifferTx", MakeBoundCallback (&WifiPhyHelper::PcapSniffTxEvent, file));
631 phy->TraceConnectWithoutContext ("MonitorSnifferRx", MakeBoundCallback (&WifiPhyHelper::PcapSniffRxEvent, file));
632}
633
634void
637 std::string prefix,
639 bool explicitFilename)
640{
641 //All of the ASCII enable functions vector through here including the ones
642 //that are wandering through all of devices on perhaps all of the nodes in
643 //the system. We can only deal with devices of type WifiNetDevice.
645 if (device == 0)
646 {
647 NS_LOG_INFO ("WifiHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::WifiNetDevice");
648 return;
649 }
650
651 //Our trace sinks are going to use packet printing, so we have to make sure
652 //that is turned on.
654
655 uint32_t nodeid = nd->GetNode ()->GetId ();
656 uint32_t deviceid = nd->GetIfIndex ();
657 std::ostringstream oss;
658
659 //If we are not provided an OutputStreamWrapper, we are expected to create
660 //one using the usual trace filename conventions and write our traces
661 //without a context since there will be one file per context and therefore
662 //the context would be redundant.
663 if (stream == 0)
664 {
665 //Set up an output stream object to deal with private ofstream copy
666 //constructor and lifetime issues. Let the helper decide the actual
667 //name of the file given the prefix.
668 AsciiTraceHelper asciiTraceHelper;
669
670 std::string filename;
671 if (explicitFilename)
672 {
673 filename = prefix;
674 }
675 else
676 {
677 filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
678 }
679
680 Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
681 //We could go poking through the PHY and the state looking for the
682 //correct trace source, but we can let Config deal with that with
683 //some search cost. Since this is presumably happening at topology
684 //creation time, it doesn't seem much of a price to pay.
685 oss.str ("");
686 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
688
689 oss.str ("");
690 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
692
693 return;
694 }
695
696 //If we are provided an OutputStreamWrapper, we are expected to use it, and
697 //to provide a context. We are free to come up with our own context if we
698 //want, and use the AsciiTraceHelper Hook*WithContext functions, but for
699 //compatibility and simplicity, we just use Config::Connect and let it deal
700 //with coming up with a context.
701 oss.str ("");
702 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk";
704
705 oss.str ("");
706 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx";
708}
709
711{
712}
713
715 : m_standard (WIFI_STANDARD_80211ax),
716 m_selectQueueCallback (&SelectQueueByDSField),
717 m_enableFlowControl (true)
718{
719 SetRemoteStationManager ("ns3::IdealWifiManager");
720}
721
722void
724 std::string n0, const AttributeValue &v0,
725 std::string n1, const AttributeValue &v1,
726 std::string n2, const AttributeValue &v2,
727 std::string n3, const AttributeValue &v3,
728 std::string n4, const AttributeValue &v4,
729 std::string n5, const AttributeValue &v5,
730 std::string n6, const AttributeValue &v6,
731 std::string n7, const AttributeValue &v7)
732{
735 m_stationManager.Set (n0, v0);
736 m_stationManager.Set (n1, v1);
737 m_stationManager.Set (n2, v2);
738 m_stationManager.Set (n3, v3);
739 m_stationManager.Set (n4, v4);
740 m_stationManager.Set (n5, v5);
741 m_stationManager.Set (n6, v6);
742 m_stationManager.Set (n7, v7);
743}
744
745void
747 std::string n0, const AttributeValue &v0,
748 std::string n1, const AttributeValue &v1,
749 std::string n2, const AttributeValue &v2,
750 std::string n3, const AttributeValue &v3,
751 std::string n4, const AttributeValue &v4,
752 std::string n5, const AttributeValue &v5,
753 std::string n6, const AttributeValue &v6,
754 std::string n7, const AttributeValue &v7)
755{
758 m_obssPdAlgorithm.Set (n0, v0);
759 m_obssPdAlgorithm.Set (n1, v1);
760 m_obssPdAlgorithm.Set (n2, v2);
761 m_obssPdAlgorithm.Set (n3, v3);
762 m_obssPdAlgorithm.Set (n4, v4);
763 m_obssPdAlgorithm.Set (n5, v5);
764 m_obssPdAlgorithm.Set (n6, v6);
765 m_obssPdAlgorithm.Set (n7, v7);
766}
767
768void
770{
771 m_standard = standard;
772}
773
774void
776{
777 m_enableFlowControl = false;
778}
779
780void
782{
784}
785
788 const WifiMacHelper &macHelper,
790 NodeContainer::Iterator last) const
791{
793 for (NodeContainer::Iterator i = first; i != last; ++i)
794 {
795 Ptr<Node> node = *i;
796 Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
797 device->SetStandard (m_standard);
799 {
800 NS_FATAL_ERROR ("No standard specified!");
801 return devices;
802 }
804 {
805 Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
806 device->SetHtConfiguration (htConfiguration);
807 }
809 {
810 // Create the VHT Configuration object even if the PHY band is 2.4GHz
811 // (WifiNetDevice::GetVhtConfiguration() checks the PHY band being used).
812 // This approach allows us not to worry about deleting this object when
813 // the PHY band is switched from 5GHz to 2.4GHz and creating this object
814 // when the PHY band is switched from 2.4GHz to 5GHz.
815 Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
816 device->SetVhtConfiguration (vhtConfiguration);
817 }
819 {
820 Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
821 device->SetHeConfiguration (heConfiguration);
822 }
824 Ptr<WifiPhy> phy = phyHelper.Create (node, device);
825 phy->ConfigureStandard (m_standard);
826 device->SetPhy (phy);
827 Ptr<WifiMac> mac = macHelper.Create (device, m_standard);
828 device->SetMac (mac);
829 device->SetRemoteStationManager (manager);
830 node->AddDevice (device);
832 {
834 device->AggregateObject (obssPdAlgorithm);
835 obssPdAlgorithm->ConnectWifiNetDevice (device);
836 }
837 devices.Add (device);
838 NS_LOG_DEBUG ("node=" << node << ", mob=" << node->GetObject<MobilityModel> ());
840 {
842 BooleanValue qosSupported;
844
845 mac->GetAttributeFailSafe ("QosSupported", qosSupported);
846 if (qosSupported.Get ())
847 {
848 ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface> ("NTxQueues",
849 UintegerValue (4));
850 for (auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
851 {
852 Ptr<QosTxop> qosTxop = mac->GetQosTxop (ac);
853 wmq = qosTxop->GetWifiMacQueue ();
854 ndqi->GetTxQueue (static_cast<std::size_t> (ac))->ConnectQueueTraces (wmq);
855 }
856 ndqi->SetSelectQueueCallback (m_selectQueueCallback);
857 }
858 else
859 {
860 ndqi = CreateObject<NetDeviceQueueInterface> ();
861
862 wmq = mac->GetTxop ()->GetWifiMacQueue ();
863 ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
864 }
865 device->AggregateObject (ndqi);
866 }
867 }
868 return devices;
869}
870
873 const WifiMacHelper &macHelper, NodeContainer c) const
874{
875 return Install (phyHelper, macHelper, c.Begin (), c.End ());
876}
877
880 const WifiMacHelper &mac, Ptr<Node> node) const
881{
882 return Install (phy, mac, NodeContainer (node));
883}
884
887 const WifiMacHelper &mac, std::string nodeName) const
888{
889 Ptr<Node> node = Names::Find<Node> (nodeName);
890 return Install (phy, mac, NodeContainer (node));
891}
892
893void
895{
898
899 LogComponentEnable ("AarfWifiManager", LOG_LEVEL_ALL);
900 LogComponentEnable ("AarfcdWifiManager", LOG_LEVEL_ALL);
901 LogComponentEnable ("AdhocWifiMac", LOG_LEVEL_ALL);
902 LogComponentEnable ("AmrrWifiManager", LOG_LEVEL_ALL);
903 LogComponentEnable ("ApWifiMac", LOG_LEVEL_ALL);
904 LogComponentEnable ("AparfWifiManager", LOG_LEVEL_ALL);
905 LogComponentEnable ("ArfWifiManager", LOG_LEVEL_ALL);
906 LogComponentEnable ("BlockAckAgreement", LOG_LEVEL_ALL);
907 LogComponentEnable ("RecipientBlockAckAgreement", LOG_LEVEL_ALL);
908 LogComponentEnable ("BlockAckManager", LOG_LEVEL_ALL);
909 LogComponentEnable ("CaraWifiManager", LOG_LEVEL_ALL);
910 LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
911 LogComponentEnable ("ConstantObssPdAlgorithm", LOG_LEVEL_ALL);
912 LogComponentEnable ("ConstantRateWifiManager", LOG_LEVEL_ALL);
913 LogComponentEnable ("ChannelAccessManager", LOG_LEVEL_ALL);
914 LogComponentEnable ("DsssErrorRateModel", LOG_LEVEL_ALL);
916 LogComponentEnable ("DsssPpdu", LOG_LEVEL_ALL);
917 LogComponentEnable ("ErpOfdmPhy", LOG_LEVEL_ALL);
918 LogComponentEnable ("ErpOfdmPpdu", LOG_LEVEL_ALL);
919 LogComponentEnable ("FrameExchangeManager", LOG_LEVEL_ALL);
920 LogComponentEnable ("HeConfiguration", LOG_LEVEL_ALL);
921 LogComponentEnable ("HeFrameExchangeManager", LOG_LEVEL_ALL);
924 LogComponentEnable ("HtConfiguration", LOG_LEVEL_ALL);
925 LogComponentEnable ("HtFrameExchangeManager", LOG_LEVEL_ALL);
928 LogComponentEnable ("IdealWifiManager", LOG_LEVEL_ALL);
929 LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL);
930 LogComponentEnable ("MacRxMiddle", LOG_LEVEL_ALL);
931 LogComponentEnable ("MacTxMiddle", LOG_LEVEL_ALL);
932 LogComponentEnable ("MinstrelHtWifiManager", LOG_LEVEL_ALL);
933 LogComponentEnable ("MinstrelWifiManager", LOG_LEVEL_ALL);
934 LogComponentEnable ("MpduAggregator", LOG_LEVEL_ALL);
935 LogComponentEnable ("MsduAggregator", LOG_LEVEL_ALL);
936 LogComponentEnable ("MultiUserScheduler", LOG_LEVEL_ALL);
937 LogComponentEnable ("NistErrorRateModel", LOG_LEVEL_ALL);
938 LogComponentEnable ("ObssPdAlgorithm", LOG_LEVEL_ALL);
940 LogComponentEnable ("OnoeWifiManager", LOG_LEVEL_ALL);
941 LogComponentEnable ("OriginatorBlockAckAgreement", LOG_LEVEL_ALL);
942 LogComponentEnable ("OfdmPpdu", LOG_LEVEL_ALL);
943 LogComponentEnable ("ParfWifiManager", LOG_LEVEL_ALL);
944 LogComponentEnable ("PhyEntity", LOG_LEVEL_ALL);
945 LogComponentEnable ("QosFrameExchangeManager", LOG_LEVEL_ALL);
947 LogComponentEnable ("RraaWifiManager", LOG_LEVEL_ALL);
948 LogComponentEnable ("RrMultiUserScheduler", LOG_LEVEL_ALL);
949 LogComponentEnable ("RrpaaWifiManager", LOG_LEVEL_ALL);
950 LogComponentEnable ("SimpleFrameCaptureModel", LOG_LEVEL_ALL);
951 LogComponentEnable ("SpectrumWifiPhy", LOG_LEVEL_ALL);
952 LogComponentEnable ("StaWifiMac", LOG_LEVEL_ALL);
953 LogComponentEnable ("SupportedRates", LOG_LEVEL_ALL);
954 LogComponentEnable ("TableBasedErrorRateModel", LOG_LEVEL_ALL);
955 LogComponentEnable ("ThompsonSamplingWifiManager", LOG_LEVEL_ALL);
956 LogComponentEnable ("ThresholdPreambleDetectionModel", LOG_LEVEL_ALL);
958 LogComponentEnable ("VhtConfiguration", LOG_LEVEL_ALL);
959 LogComponentEnable ("VhtFrameExchangeManager", LOG_LEVEL_ALL);
962 LogComponentEnable ("WifiAckManager", LOG_LEVEL_ALL);
963 LogComponentEnable ("WifiDefaultAckManager", LOG_LEVEL_ALL);
964 LogComponentEnable ("WifiDefaultProtectionManager", LOG_LEVEL_ALL);
966 LogComponentEnable ("WifiMacQueue", LOG_LEVEL_ALL);
967 LogComponentEnable ("WifiMacQueueItem", LOG_LEVEL_ALL);
968 LogComponentEnable ("WifiNetDevice", LOG_LEVEL_ALL);
969 LogComponentEnable ("WifiPhyStateHelper", LOG_LEVEL_ALL);
971 LogComponentEnable ("WifiPhyOperatingChannel", LOG_LEVEL_ALL);
972 LogComponentEnable ("WifiPpdu", LOG_LEVEL_ALL);
973 LogComponentEnable ("WifiProtectionManager", LOG_LEVEL_ALL);
974 LogComponentEnable ("WifiPsdu", LOG_LEVEL_ALL);
975 LogComponentEnable ("WifiRadioEnergyModel", LOG_LEVEL_ALL);
976 LogComponentEnable ("WifiRemoteStationManager", LOG_LEVEL_ALL);
977 LogComponentEnable ("WifiSpectrumPhyInterface", LOG_LEVEL_ALL);
978 LogComponentEnable ("WifiSpectrumSignalParameters", LOG_LEVEL_ALL);
979 LogComponentEnable ("WifiTxCurrentModel", LOG_LEVEL_ALL);
980 LogComponentEnable ("WifiTxParameters", LOG_LEVEL_ALL);
981 LogComponentEnable ("WifiTxTimer", LOG_LEVEL_ALL);
982 LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
983 LogComponentEnable ("YansWifiChannel", LOG_LEVEL_ALL);
984 LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL);
985
986 //From Spectrum
987 LogComponentEnable ("WifiSpectrumValueHelper", LOG_LEVEL_ALL);
988}
989
990int64_t
992{
993 int64_t currentStream = stream;
994 Ptr<NetDevice> netDevice;
995 for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
996 {
997 netDevice = (*i);
998 Ptr<WifiNetDevice> wifi = DynamicCast<WifiNetDevice> (netDevice);
999 if (wifi)
1000 {
1001 //Handle any random numbers in the PHY objects.
1002 currentStream += wifi->GetPhy ()->AssignStreams (currentStream);
1003
1004 //Handle any random numbers in the station managers.
1005 currentStream += wifi->GetRemoteStationManager ()->AssignStreams (currentStream);
1006
1007 //Handle any random numbers in the MAC objects.
1008 Ptr<WifiMac> mac = wifi->GetMac ();
1009 PointerValue ptr;
1010 if (!mac->GetQosSupported ())
1011 {
1012 mac->GetAttribute ("Txop", ptr);
1013 Ptr<Txop> txop = ptr.Get<Txop> ();
1014 currentStream += txop->AssignStreams (currentStream);
1015 }
1016 else
1017 {
1018 mac->GetAttribute ("VO_Txop", ptr);
1019 Ptr<QosTxop> vo_txop = ptr.Get<QosTxop> ();
1020 currentStream += vo_txop->AssignStreams (currentStream);
1021
1022 mac->GetAttribute ("VI_Txop", ptr);
1023 Ptr<QosTxop> vi_txop = ptr.Get<QosTxop> ();
1024 currentStream += vi_txop->AssignStreams (currentStream);
1025
1026 mac->GetAttribute ("BE_Txop", ptr);
1027 Ptr<QosTxop> be_txop = ptr.Get<QosTxop> ();
1028 currentStream += be_txop->AssignStreams (currentStream);
1029
1030 mac->GetAttribute ("BK_Txop", ptr);
1031 Ptr<QosTxop> bk_txop = ptr.Get<QosTxop> ();
1032 currentStream += bk_txop->AssignStreams (currentStream);
1033 }
1034
1035 //if an AP, handle any beacon jitter
1036 Ptr<ApWifiMac> apmac = DynamicCast<ApWifiMac> (mac);
1037 if (apmac)
1038 {
1039 currentStream += apmac->AssignStreams (currentStream);
1040 }
1041 }
1042 }
1043 return (currentStream - stream);
1044}
1045
1046} //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
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
virtual uint32_t GetIfIndex(void) const =0
virtual Ptr< Node > GetNode(void) const =0
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
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.
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
Instantiate subclasses of ns3::Object.
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:710
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:723
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:511
ObjectFactory m_stationManager
station manager
Definition: wifi-helper.h:507
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:781
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:894
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:509
void DisableFlowControl(void)
Disable flow control only if you know what you are doing.
Definition: wifi-helper.cc:775
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:991
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:746
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:769
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:787
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:510
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:402
bool m_enableFlowControl
whether to enable flow control
Definition: wifi-helper.h:512
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:714
create MAC layers for a ns3::WifiNetDevice.
virtual Ptr< WifiMac > Create(Ptr< WifiNetDevice > device, WifiStandard standard) const
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 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:170
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:574
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:635
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:147
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:141
void DisablePreambleDetectionModel()
Disable the preamble detection model.
Definition: wifi-helper.cc:216
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:599
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:311
ObjectFactory m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:238
virtual ~WifiPhyHelper()
Definition: wifi-helper.cc:136
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const =0
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:256
ObjectFactory m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:239
ObjectFactory m_errorRateModel
error rate model
Definition: wifi-helper.h:237
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:222
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:193
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
Definition: wifi-helper.h:173
@ DLT_IEEE802_11
IEEE 802.11 Wireless LAN headers on packets.
Definition: wifi-helper.h:174
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:176
@ DLT_PRISM_HEADER
Include Prism monitor mode information.
Definition: wifi-helper.h:175
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:306
ObjectFactory m_phy
PHY object.
Definition: wifi-helper.h:236
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:593
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:252
@ 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:96
wifi
Definition: third.py:99
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