A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 * Mirko Banchi <mk.banchi@gmail.com>
20 */
21
22#include "wifi-helper.h"
23
24#include "ns3/ampdu-subframe-header.h"
25#include "ns3/ap-wifi-mac.h"
26#include "ns3/config.h"
27#include "ns3/eht-configuration.h"
28#include "ns3/he-configuration.h"
29#include "ns3/ht-configuration.h"
30#include "ns3/log.h"
31#include "ns3/mobility-model.h"
32#include "ns3/names.h"
33#include "ns3/net-device-queue-interface.h"
34#include "ns3/obss-pd-algorithm.h"
35#include "ns3/pointer.h"
36#include "ns3/qos-txop.h"
37#include "ns3/qos-utils.h"
38#include "ns3/radiotap-header.h"
39#include "ns3/sta-wifi-mac.h"
40#include "ns3/vht-configuration.h"
41#include "ns3/wifi-mac-queue.h"
42#include "ns3/wifi-mac-trailer.h"
43#include "ns3/wifi-net-device.h"
44
45namespace ns3
46{
47
48NS_LOG_COMPONENT_DEFINE("WifiHelper");
49
59static void
61 std::string context,
63 WifiMode mode,
64 WifiPreamble preamble,
65 uint8_t txLevel)
66{
67 NS_LOG_FUNCTION(stream << context << p << mode << preamble << txLevel);
68 auto pCopy = p->Copy();
70 pCopy->RemoveTrailer(fcs);
71 *stream->GetStream() << "t " << Simulator::Now().GetSeconds() << " " << context << " " << mode
72 << " " << *pCopy << " " << fcs << std::endl;
73}
74
83static void
86 WifiMode mode,
87 WifiPreamble preamble,
88 uint8_t txLevel)
89{
90 NS_LOG_FUNCTION(stream << p << mode << preamble << txLevel);
91 auto pCopy = p->Copy();
93 pCopy->RemoveTrailer(fcs);
94 *stream->GetStream() << "t " << Simulator::Now().GetSeconds() << " " << mode << " " << *pCopy
95 << " " << fcs << std::endl;
96}
97
107static void
109 std::string context,
111 double snr,
112 WifiMode mode,
113 WifiPreamble preamble)
114{
115 NS_LOG_FUNCTION(stream << context << p << snr << mode << preamble);
116 auto pCopy = p->Copy();
117 WifiMacTrailer fcs;
118 pCopy->RemoveTrailer(fcs);
119 *stream->GetStream() << "r " << Simulator::Now().GetSeconds() << " " << mode << " " << context
120 << " " << *pCopy << " " << fcs << std::endl;
121}
122
131static void
134 double snr,
135 WifiMode mode,
136 WifiPreamble preamble)
137{
138 NS_LOG_FUNCTION(stream << p << snr << mode << preamble);
139 auto pCopy = p->Copy();
140 WifiMacTrailer fcs;
141 pCopy->RemoveTrailer(fcs);
142 *stream->GetStream() << "r " << Simulator::Now().GetSeconds() << " " << mode << " " << *pCopy
143 << " " << fcs << std::endl;
144}
145
147 : m_pcapDlt(PcapHelper::DLT_IEEE802_11)
148{
149 NS_ABORT_IF(nLinks == 0);
150 m_phys.resize(nLinks);
151 m_errorRateModel.resize(nLinks);
152 m_frameCaptureModel.resize(nLinks);
153 m_preambleDetectionModel.resize(nLinks);
154
155 SetPreambleDetectionModel("ns3::ThresholdPreambleDetectionModel");
156}
157
159{
160}
161
162void
163WifiPhyHelper::Set(std::string name, const AttributeValue& v)
164{
165 for (auto& phy : m_phys)
166 {
167 phy.Set(name, v);
168 }
169}
170
171void
172WifiPhyHelper::Set(uint8_t linkId, std::string name, const AttributeValue& v)
173{
174 m_phys.at(linkId).Set(name, v);
175}
176
177void
179{
180 for (auto& preambleDetectionModel : m_preambleDetectionModel)
181 {
182 preambleDetectionModel.SetTypeId(TypeId());
183 }
184}
185
186void
188 Ptr<const Packet> packet,
189 uint16_t channelFreqMhz,
190 WifiTxVector txVector,
191 MpduInfo aMpdu,
192 uint16_t staId)
193{
194 uint32_t dlt = file->GetDataLinkType();
195 switch (dlt)
196 {
198 file->Write(Simulator::Now(), packet);
199 return;
201 NS_FATAL_ERROR("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
202 return;
203 }
205 Ptr<Packet> p = packet->Copy();
206 RadiotapHeader header;
207 GetRadiotapHeader(header, p, channelFreqMhz, txVector, aMpdu, staId);
208 p->AddHeader(header);
209 file->Write(Simulator::Now(), p);
210 return;
211 }
212 default:
213 NS_ABORT_MSG("PcapSniffTxEvent(): Unexpected data link type " << dlt);
214 }
215}
216
217void
219 Ptr<const Packet> packet,
220 uint16_t channelFreqMhz,
221 WifiTxVector txVector,
222 MpduInfo aMpdu,
223 SignalNoiseDbm signalNoise,
224 uint16_t staId)
225{
226 uint32_t dlt = file->GetDataLinkType();
227 switch (dlt)
228 {
230 file->Write(Simulator::Now(), packet);
231 return;
233 NS_FATAL_ERROR("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
234 return;
235 }
237 Ptr<Packet> p = packet->Copy();
238 RadiotapHeader header;
239 GetRadiotapHeader(header, p, channelFreqMhz, txVector, aMpdu, staId, signalNoise);
240 p->AddHeader(header);
241 file->Write(Simulator::Now(), p);
242 return;
243 }
244 default:
245 NS_ABORT_MSG("PcapSniffRxEvent(): Unexpected data link type " << dlt);
246 }
247}
248
249void
251 Ptr<Packet> packet,
252 uint16_t channelFreqMhz,
253 WifiTxVector txVector,
254 MpduInfo aMpdu,
255 uint16_t staId,
256 SignalNoiseDbm signalNoise)
257{
258 header.SetAntennaSignalPower(signalNoise.signal);
259 header.SetAntennaNoisePower(signalNoise.noise);
260 GetRadiotapHeader(header, packet, channelFreqMhz, txVector, aMpdu, staId);
261}
262
263void
265 Ptr<Packet> packet,
266 uint16_t channelFreqMhz,
267 WifiTxVector txVector,
268 MpduInfo aMpdu,
269 uint16_t staId)
270{
271 WifiPreamble preamble = txVector.GetPreambleType();
272
273 uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
274 header.SetTsft(Simulator::Now().GetMicroSeconds());
275
276 // Our capture includes the FCS, so we set the flag to say so.
278
279 if (preamble == WIFI_PREAMBLE_SHORT)
280 {
282 }
283
284 if (txVector.GetGuardInterval() == 400)
285 {
287 }
288
289 header.SetFrameFlags(frameFlags);
290
291 uint64_t rate = 0;
292 if (txVector.GetMode(staId).GetModulationClass() != WIFI_MOD_CLASS_HT &&
293 txVector.GetMode(staId).GetModulationClass() != WIFI_MOD_CLASS_VHT &&
294 txVector.GetMode(staId).GetModulationClass() != WIFI_MOD_CLASS_HE)
295 {
296 rate = txVector.GetMode(staId).GetDataRate(txVector.GetChannelWidth(),
297 txVector.GetGuardInterval(),
298 1) *
299 txVector.GetNss(staId) / 500000;
300 header.SetRate(static_cast<uint8_t>(rate));
301 }
302
303 uint16_t channelFlags = 0;
304 switch (rate)
305 {
306 case 2: // 1Mbps
307 case 4: // 2Mbps
308 case 10: // 5Mbps
309 case 22: // 11Mbps
310 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
311 break;
312 default:
313 channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
314 break;
315 }
316
317 if (channelFreqMhz < 2500)
318 {
320 }
321 else
322 {
324 }
325
326 header.SetChannelFrequencyAndFlags(channelFreqMhz, channelFlags);
327
328 if (txVector.GetMode(staId).GetModulationClass() == WIFI_MOD_CLASS_HT)
329 {
330 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE;
331 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE;
332
334
336 if (txVector.GetChannelWidth() == 40)
337 {
339 }
340
342 if (txVector.GetGuardInterval() == 400)
343 {
345 }
346
348
350 if (txVector.GetNess() & 0x01) // bit 1
351 {
353 }
354 if (txVector.GetNess() & 0x02) // bit 2
355 {
357 }
358
359 mcsKnown |= RadiotapHeader::MCS_KNOWN_FEC_TYPE; // only BCC is currently supported
360
362 if (txVector.IsStbc())
363 {
365 }
366
367 header.SetMcsFields(mcsKnown, mcsFlags, txVector.GetMode(staId).GetMcsValue());
368 }
369
370 if (txVector.IsAggregation())
371 {
372 uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
374 /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
376 uint32_t extractedLength;
377 packet->RemoveHeader(hdr);
378 extractedLength = hdr.GetLength();
379 packet = packet->CreateFragment(0, static_cast<uint32_t>(extractedLength));
380 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof() && hdr.GetLength() > 0))
381 {
382 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
383 }
384 header.SetAmpduStatus(aMpdu.mpduRefNumber, ampduStatusFlags, 1 /*CRC*/);
385 }
386
387 if (txVector.GetMode(staId).GetModulationClass() == WIFI_MOD_CLASS_VHT)
388 {
389 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE;
390 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE;
391 uint8_t vhtBandwidth = 0;
392 uint8_t vhtMcsNss[4] = {0, 0, 0, 0};
393 uint8_t vhtCoding = 0;
394 uint8_t vhtGroupId = 0;
395 uint16_t vhtPartialAid = 0;
396
398 if (txVector.IsStbc())
399 {
401 }
402
404 if (txVector.GetGuardInterval() == 400)
405 {
407 }
408
409 vhtKnown |= RadiotapHeader::VHT_KNOWN_BEAMFORMED; // Beamforming is currently not supported
410
412 // not all bandwidth values are currently supported
413 if (txVector.GetChannelWidth() == 40)
414 {
415 vhtBandwidth = 1;
416 }
417 else if (txVector.GetChannelWidth() == 80)
418 {
419 vhtBandwidth = 4;
420 }
421 else if (txVector.GetChannelWidth() == 160)
422 {
423 vhtBandwidth = 11;
424 }
425
426 // only SU PPDUs are currently supported
427 vhtMcsNss[0] |= (txVector.GetNss(staId) & 0x0f);
428 vhtMcsNss[0] |= ((txVector.GetMode(staId).GetMcsValue() << 4) & 0xf0);
429
430 header.SetVhtFields(vhtKnown,
431 vhtFlags,
432 vhtBandwidth,
433 vhtMcsNss,
434 vhtCoding,
435 vhtGroupId,
436 vhtPartialAid);
437 }
438
439 if (txVector.GetMode(staId).GetModulationClass() == WIFI_MOD_CLASS_HE)
440 {
444 if (preamble == WIFI_PREAMBLE_HE_ER_SU)
445 {
447 }
448 else if (preamble == WIFI_PREAMBLE_HE_MU)
449 {
452 }
453 else if (preamble == WIFI_PREAMBLE_HE_TB)
454 {
456 }
457
458 uint16_t data2 = RadiotapHeader::HE_DATA2_GI_KNOWN;
459 if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
460 {
462 // HeRu indices start at 1 whereas RadioTap starts at 0
463 data2 |= (((txVector.GetHeMuUserInfo(staId).ru.GetIndex() - 1) << 8) & 0x3f00);
464 data2 |= (((!txVector.GetHeMuUserInfo(staId).ru.GetPrimary80MHz()) << 15) & 0x8000);
465 }
466
467 uint16_t data3 = 0;
468 data3 |= (txVector.GetBssColor() & 0x003f);
469 data3 |= ((txVector.GetMode(staId).GetMcsValue() << 8) & 0x0f00);
470
471 uint16_t data4 = 0;
472 if (preamble == WIFI_PREAMBLE_HE_MU)
473 {
474 data4 |= ((staId << 4) & 0x7ff0);
475 }
476
477 uint16_t data5 = 0;
478 if (preamble == WIFI_PREAMBLE_HE_MU || preamble == WIFI_PREAMBLE_HE_TB)
479 {
480 HeRu::RuType ruType = txVector.GetHeMuUserInfo(staId).ru.GetRuType();
481 switch (ruType)
482 {
483 case HeRu::RU_26_TONE:
485 break;
486 case HeRu::RU_52_TONE:
488 break;
491 break;
494 break;
497 break;
500 break;
503 break;
504 default:
505 NS_ABORT_MSG("Unexpected RU type");
506 }
507 }
508 else if (txVector.GetChannelWidth() == 40)
509 {
511 }
512 else if (txVector.GetChannelWidth() == 80)
513 {
515 }
516 else if (txVector.GetChannelWidth() == 160)
517 {
519 }
520 if (txVector.GetGuardInterval() == 1600)
521 {
523 }
524 else if (txVector.GetGuardInterval() == 3200)
525 {
527 }
528
529 header.SetHeFields(data1, data2, data3, data4, data5, 0);
530 }
531
532 if (preamble == WIFI_PREAMBLE_HE_MU)
533 {
534 // TODO: fill in fields (everything is set to 0 so far)
535 std::array<uint8_t, 4> ruChannel1;
536 std::array<uint8_t, 4> ruChannel2;
537 header.SetHeMuFields(0, 0, ruChannel1, ruChannel2);
538 header.SetHeMuPerUserFields(0, 0, 0, 0);
539 }
540}
541
542void
544{
545 switch (dlt)
546 {
547 case DLT_IEEE802_11:
549 return;
550 case DLT_PRISM_HEADER:
552 return;
555 return;
556 default:
557 NS_ABORT_MSG("WifiPhyHelper::SetPcapFormat(): Unexpected format");
558 }
559}
560
563{
564 return m_pcapDlt;
565}
566
567void
570 bool promiscuous,
571 bool explicitFilename)
572{
573 NS_LOG_FUNCTION(this << prefix << nd << promiscuous << explicitFilename);
574
575 // All of the Pcap enable functions vector through here including the ones
576 // that are wandering through all of devices on perhaps all of the nodes in
577 // the system. We can only deal with devices of type WifiNetDevice.
578 Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice>();
579 if (!device)
580 {
581 NS_LOG_INFO("WifiHelper::EnablePcapInternal(): Device "
582 << &device << " not of type ns3::WifiNetDevice");
583 return;
584 }
585
586 NS_ABORT_MSG_IF(device->GetPhys().empty(),
587 "WifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set");
588
589 PcapHelper pcapHelper;
590
591 std::string filename;
592 if (explicitFilename)
593 {
594 filename = prefix;
595 }
596 else
597 {
598 filename = pcapHelper.GetFilenameFromDevice(prefix, device);
599 }
600
601 uint8_t linkId = 0;
602 // find the last point in the filename
603 auto pos = filename.find_last_of('.');
604 // if not found, set pos to filename size
605 pos = (pos == std::string::npos) ? filename.size() : pos;
606
607 for (auto& phy : device->GetPhys())
608 {
609 std::string tmp = filename;
610 if (device->GetNPhys() > 1)
611 {
612 // insert LinkId only for multi-link devices
613 tmp.insert(pos, "-" + std::to_string(linkId++));
614 }
615 auto file = pcapHelper.CreateFile(tmp, std::ios::out, m_pcapDlt);
616 phy->TraceConnectWithoutContext("MonitorSnifferTx",
618 phy->TraceConnectWithoutContext("MonitorSnifferRx",
620 }
621}
622
623void
625 std::string prefix,
627 bool explicitFilename)
628{
629 // All of the ASCII enable functions vector through here including the ones
630 // that are wandering through all of devices on perhaps all of the nodes in
631 // the system. We can only deal with devices of type WifiNetDevice.
632 Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice>();
633 if (!device)
634 {
635 NS_LOG_INFO("WifiHelper::EnableAsciiInternal(): Device "
636 << device << " not of type ns3::WifiNetDevice");
637 return;
638 }
639
640 // Our trace sinks are going to use packet printing, so we have to make sure
641 // that is turned on.
643
644 uint32_t nodeid = nd->GetNode()->GetId();
645 uint32_t deviceid = nd->GetIfIndex();
646 std::ostringstream oss;
647
648 // If we are not provided an OutputStreamWrapper, we are expected to create
649 // one using the usual trace filename conventions and write our traces
650 // without a context since there will be one file per context and therefore
651 // the context would be redundant.
652 if (!stream)
653 {
654 // Set up an output stream object to deal with private ofstream copy
655 // constructor and lifetime issues. Let the helper decide the actual
656 // name of the file given the prefix.
657 AsciiTraceHelper asciiTraceHelper;
658
659 std::string filename;
660 if (explicitFilename)
661 {
662 filename = prefix;
663 }
664 else
665 {
666 filename = asciiTraceHelper.GetFilenameFromDevice(prefix, device);
667 }
668
669 // find the last point in the filename
670 auto pos = filename.find_last_of('.');
671 // if not found, set pos to filename size
672 pos = (pos == std::string::npos) ? filename.size() : pos;
673
674 for (uint8_t linkId = 0; linkId < device->GetNPhys(); linkId++)
675 {
676 std::string tmp = filename;
677 if (device->GetNPhys() > 1)
678 {
679 // insert LinkId only for multi-link devices
680 tmp.insert(pos, "-" + std::to_string(linkId));
681 }
682 auto theStream = asciiTraceHelper.CreateFileStream(tmp);
683 // We could go poking through the PHY and the state looking for the
684 // correct trace source, but we can let Config deal with that with
685 // some search cost. Since this is presumably happening at topology
686 // creation time, it doesn't seem much of a price to pay.
687 oss.str("");
688 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid
689 << "/$ns3::WifiNetDevice/Phys/" << +linkId << "/State/RxOk";
691 oss.str(),
693
694 oss.str("");
695 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid
696 << "/$ns3::WifiNetDevice/Phys/" << +linkId << "/State/Tx";
698 oss.str(),
700 }
701
702 return;
703 }
704
705 // If we are provided an OutputStreamWrapper, we are expected to use it, and
706 // to provide a context. We are free to come up with our own context if we
707 // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
708 // compatibility and simplicity, we just use Config::Connect and let it deal
709 // with coming up with a context.
710 oss.str("");
711 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid
712 << "/$ns3::WifiNetDevice/Phy/State/RxOk";
714
715 oss.str("");
716 oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid
717 << "/$ns3::WifiNetDevice/Phy/State/Tx";
719}
720
722{
723}
724
726 : m_standard(WIFI_STANDARD_80211ax),
727 m_selectQueueCallback(&SelectQueueByDSField),
728 m_enableFlowControl(true)
729{
730 SetRemoteStationManager("ns3::IdealWifiManager");
731 m_htConfig.SetTypeId("ns3::HtConfiguration");
732 m_vhtConfig.SetTypeId("ns3::VhtConfiguration");
733 m_heConfig.SetTypeId("ns3::HeConfiguration");
734 m_ehtConfig.SetTypeId("ns3::EhtConfiguration");
735}
736
737void
739{
740 m_standard = standard;
741}
742
743void
745{
746 m_enableFlowControl = false;
747}
748
749void
751{
753}
754
757 const WifiMacHelper& macHelper,
759 NodeContainer::Iterator last) const
760{
761 NetDeviceContainer devices;
762 for (auto i = first; i != last; ++i)
763 {
764 Ptr<Node> node = *i;
765 Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice>();
766 node->AddDevice(device);
767 device->SetStandard(m_standard);
769 {
770 NS_FATAL_ERROR("No standard specified!");
771 return devices;
772 }
774 {
775 auto htConfiguration = m_htConfig.Create<HtConfiguration>();
776 device->SetHtConfiguration(htConfiguration);
777 }
779 {
780 // Create the VHT Configuration object even if the PHY band is 2.4GHz
781 // (WifiNetDevice::GetVhtConfiguration() checks the PHY band being used).
782 // This approach allows us not to worry about deleting this object when
783 // the PHY band is switched from 5GHz to 2.4GHz and creating this object
784 // when the PHY band is switched from 2.4GHz to 5GHz.
785 auto vhtConfiguration = m_vhtConfig.Create<VhtConfiguration>();
786 device->SetVhtConfiguration(vhtConfiguration);
787 }
789 {
790 auto heConfiguration = m_heConfig.Create<HeConfiguration>();
791 device->SetHeConfiguration(heConfiguration);
792 }
794 {
795 auto ehtConfiguration = m_ehtConfig.Create<EhtConfiguration>();
796 device->SetEhtConfiguration(ehtConfiguration);
797 }
798 std::vector<Ptr<WifiRemoteStationManager>> managers;
799 std::vector<Ptr<WifiPhy>> phys = phyHelper.Create(node, device);
800 device->SetPhys(phys);
801 // if only one remote station manager model was provided, replicate it for all the links
802 auto stationManagers = m_stationManager;
803 if (stationManagers.size() == 1 && phys.size() > 1)
804 {
805 stationManagers.resize(phys.size(), stationManagers[0]);
806 }
807 NS_ABORT_MSG_IF(stationManagers.size() != phys.size(),
808 "Number of station manager models ("
809 << stationManagers.size() << ") does not match the number of links ("
810 << phys.size() << ")");
811 for (std::size_t i = 0; i < phys.size(); i++)
812 {
813 phys[i]->ConfigureStandard(m_standard);
814 managers.push_back(stationManagers[i].Create<WifiRemoteStationManager>());
815 }
816 device->SetRemoteStationManagers(managers);
817 Ptr<WifiMac> mac = macHelper.Create(device, m_standard);
819 {
821 device->AggregateObject(obssPdAlgorithm);
822 obssPdAlgorithm->ConnectWifiNetDevice(device);
823 }
824 devices.Add(device);
825 NS_LOG_DEBUG("node=" << node << ", mob=" << node->GetObject<MobilityModel>());
827 {
829 BooleanValue qosSupported;
831
832 mac->GetAttributeFailSafe("QosSupported", qosSupported);
833 if (qosSupported.Get())
834 {
835 ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface>("NTxQueues",
836 UintegerValue(4));
837 for (auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
838 {
839 Ptr<QosTxop> qosTxop = mac->GetQosTxop(ac);
840 wmq = qosTxop->GetWifiMacQueue();
841 ndqi->GetTxQueue(static_cast<std::size_t>(ac))->ConnectQueueTraces(wmq);
842 }
843 ndqi->SetSelectQueueCallback(m_selectQueueCallback);
844 }
845 else
846 {
847 ndqi = CreateObject<NetDeviceQueueInterface>();
848
849 wmq = mac->GetTxop()->GetWifiMacQueue();
850 ndqi->GetTxQueue(0)->ConnectQueueTraces(wmq);
851 }
852 device->AggregateObject(ndqi);
853 }
854 }
855 return devices;
856}
857
860 const WifiMacHelper& macHelper,
861 NodeContainer c) const
862{
863 return Install(phyHelper, macHelper, c.Begin(), c.End());
864}
865
867WifiHelper::Install(const WifiPhyHelper& phy, const WifiMacHelper& mac, Ptr<Node> node) const
868{
869 return Install(phy, mac, NodeContainer(node));
870}
871
873WifiHelper::Install(const WifiPhyHelper& phy, const WifiMacHelper& mac, std::string nodeName) const
874{
875 Ptr<Node> node = Names::Find<Node>(nodeName);
876 return Install(phy, mac, NodeContainer(node));
877}
878
879void
881{
884
885 LogComponentEnable("AarfWifiManager", LOG_LEVEL_ALL);
886 LogComponentEnable("AarfcdWifiManager", LOG_LEVEL_ALL);
887 LogComponentEnable("AdhocWifiMac", LOG_LEVEL_ALL);
888 LogComponentEnable("AmrrWifiManager", LOG_LEVEL_ALL);
889 LogComponentEnable("ApWifiMac", LOG_LEVEL_ALL);
890 LogComponentEnable("AparfWifiManager", LOG_LEVEL_ALL);
891 LogComponentEnable("ArfWifiManager", LOG_LEVEL_ALL);
892 LogComponentEnable("BlockAckAgreement", LOG_LEVEL_ALL);
893 LogComponentEnable("BlockAckManager", LOG_LEVEL_ALL);
894 LogComponentEnable("CaraWifiManager", LOG_LEVEL_ALL);
895 LogComponentEnable("ChannelAccessManager", LOG_LEVEL_ALL);
896 LogComponentEnable("ConstantObssPdAlgorithm", LOG_LEVEL_ALL);
897 LogComponentEnable("ConstantRateWifiManager", LOG_LEVEL_ALL);
898 LogComponentEnable("DefaultEmlsrManager", LOG_LEVEL_ALL);
899 LogComponentEnable("DsssErrorRateModel", LOG_LEVEL_ALL);
902 LogComponentEnable("EhtFrameExchangeManager", LOG_LEVEL_ALL);
905 LogComponentEnable("EmlsrManager", LOG_LEVEL_ALL);
906 LogComponentEnable("ErpOfdmPhy", LOG_LEVEL_ALL);
907 LogComponentEnable("ErpOfdmPpdu", LOG_LEVEL_ALL);
908 LogComponentEnable("FrameExchangeManager", LOG_LEVEL_ALL);
909 LogComponentEnable("HeConfiguration", LOG_LEVEL_ALL);
910 LogComponentEnable("HeFrameExchangeManager", LOG_LEVEL_ALL);
913 LogComponentEnable("HtConfiguration", LOG_LEVEL_ALL);
914 LogComponentEnable("HtFrameExchangeManager", LOG_LEVEL_ALL);
917 LogComponentEnable("IdealWifiManager", LOG_LEVEL_ALL);
918 LogComponentEnable("InterferenceHelper", LOG_LEVEL_ALL);
919 LogComponentEnable("MacRxMiddle", LOG_LEVEL_ALL);
920 LogComponentEnable("MacTxMiddle", LOG_LEVEL_ALL);
921 LogComponentEnable("MinstrelHtWifiManager", LOG_LEVEL_ALL);
922 LogComponentEnable("MinstrelWifiManager", LOG_LEVEL_ALL);
923 LogComponentEnable("MpduAggregator", LOG_LEVEL_ALL);
924 LogComponentEnable("MsduAggregator", LOG_LEVEL_ALL);
925 LogComponentEnable("MultiUserScheduler", LOG_LEVEL_ALL);
926 LogComponentEnable("NistErrorRateModel", LOG_LEVEL_ALL);
927 LogComponentEnable("ObssPdAlgorithm", LOG_LEVEL_ALL);
930 LogComponentEnable("OnoeWifiManager", LOG_LEVEL_ALL);
931 LogComponentEnable("OriginatorBlockAckAgreement", LOG_LEVEL_ALL);
932 LogComponentEnable("ParfWifiManager", LOG_LEVEL_ALL);
933 LogComponentEnable("PhyEntity", LOG_LEVEL_ALL);
934 LogComponentEnable("QosFrameExchangeManager", LOG_LEVEL_ALL);
936 LogComponentEnable("RecipientBlockAckAgreement", LOG_LEVEL_ALL);
937 LogComponentEnable("RrMultiUserScheduler", LOG_LEVEL_ALL);
938 LogComponentEnable("RraaWifiManager", LOG_LEVEL_ALL);
939 LogComponentEnable("RrpaaWifiManager", LOG_LEVEL_ALL);
940 LogComponentEnable("SimpleFrameCaptureModel", LOG_LEVEL_ALL);
941 LogComponentEnable("SpectrumWifiPhy", LOG_LEVEL_ALL);
942 LogComponentEnable("StaWifiMac", LOG_LEVEL_ALL);
943 LogComponentEnable("SupportedRates", LOG_LEVEL_ALL);
944 LogComponentEnable("TableBasedErrorRateModel", LOG_LEVEL_ALL);
945 LogComponentEnable("ThompsonSamplingWifiManager", LOG_LEVEL_ALL);
946 LogComponentEnable("ThresholdPreambleDetectionModel", LOG_LEVEL_ALL);
948 LogComponentEnable("VhtConfiguration", LOG_LEVEL_ALL);
949 LogComponentEnable("VhtFrameExchangeManager", LOG_LEVEL_ALL);
952 LogComponentEnable("WifiAckManager", LOG_LEVEL_ALL);
953 LogComponentEnable("WifiAssocManager", LOG_LEVEL_ALL);
954 LogComponentEnable("WifiDefaultAckManager", LOG_LEVEL_ALL);
955 LogComponentEnable("WifiDefaultAssocManager", LOG_LEVEL_ALL);
956 LogComponentEnable("WifiDefaultProtectionManager", LOG_LEVEL_ALL);
958 LogComponentEnable("WifiMacQueue", LOG_LEVEL_ALL);
960 LogComponentEnable("WifiNetDevice", LOG_LEVEL_ALL);
961 LogComponentEnable("WifiPhyStateHelper", LOG_LEVEL_ALL);
962 LogComponentEnable("WifiPhyOperatingChannel", LOG_LEVEL_ALL);
965 LogComponentEnable("WifiProtectionManager", LOG_LEVEL_ALL);
967 LogComponentEnable("WifiRadioEnergyModel", LOG_LEVEL_ALL);
968 LogComponentEnable("WifiRemoteStationManager", LOG_LEVEL_ALL);
969 LogComponentEnable("WifiSpectrumPhyInterface", LOG_LEVEL_ALL);
970 LogComponentEnable("WifiSpectrumSignalParameters", LOG_LEVEL_ALL);
971 LogComponentEnable("WifiTxCurrentModel", LOG_LEVEL_ALL);
972 LogComponentEnable("WifiTxParameters", LOG_LEVEL_ALL);
973 LogComponentEnable("WifiTxTimer", LOG_LEVEL_ALL);
974 LogComponentEnable("YansErrorRateModel", LOG_LEVEL_ALL);
975 LogComponentEnable("YansWifiChannel", LOG_LEVEL_ALL);
976 LogComponentEnable("YansWifiPhy", LOG_LEVEL_ALL);
977
979 LogComponentEnable("WifiHelper", LOG_LEVEL_ALL);
980 LogComponentEnable("SpectrumWifiHelper", LOG_LEVEL_ALL);
981 LogComponentEnable("YansWifiHelper", LOG_LEVEL_ALL);
982
983 // From Spectrum
984 LogComponentEnable("WifiSpectrumValueHelper", LOG_LEVEL_ALL);
985}
986
987int64_t
989{
990 int64_t currentStream = stream;
991 Ptr<NetDevice> netDevice;
992 for (auto i = c.Begin(); i != c.End(); ++i)
993 {
994 netDevice = (*i);
995 if (auto wifi = DynamicCast<WifiNetDevice>(netDevice))
996 {
997 // Handle any random numbers in the PHY objects.
998 for (auto& phy : wifi->GetPhys())
999 {
1000 currentStream += phy->AssignStreams(currentStream);
1001 }
1002
1003 // Handle any random numbers in the station managers.
1004 for (auto& manager : wifi->GetRemoteStationManagers())
1005 {
1006 currentStream += manager->AssignStreams(currentStream);
1007 }
1008
1009 // Handle any random numbers in the MAC objects.
1010 auto mac = wifi->GetMac();
1011 PointerValue ptr;
1012 if (!mac->GetQosSupported())
1013 {
1014 mac->GetAttribute("Txop", ptr);
1015 auto txop = ptr.Get<Txop>();
1016 currentStream += txop->AssignStreams(currentStream);
1017 }
1018 else
1019 {
1020 mac->GetAttribute("VO_Txop", ptr);
1021 auto vo_txop = ptr.Get<QosTxop>();
1022 currentStream += vo_txop->AssignStreams(currentStream);
1023
1024 mac->GetAttribute("VI_Txop", ptr);
1025 auto vi_txop = ptr.Get<QosTxop>();
1026 currentStream += vi_txop->AssignStreams(currentStream);
1027
1028 mac->GetAttribute("BE_Txop", ptr);
1029 auto be_txop = ptr.Get<QosTxop>();
1030 currentStream += be_txop->AssignStreams(currentStream);
1031
1032 mac->GetAttribute("BK_Txop", ptr);
1033 auto bk_txop = ptr.Get<QosTxop>();
1034 currentStream += bk_txop->AssignStreams(currentStream);
1035 }
1036
1037 // if an AP, handle any beacon jitter
1038 if (auto apMac = DynamicCast<ApWifiMac>(mac); apMac)
1039 {
1040 currentStream += apMac->AssignStreams(currentStream);
1041 }
1042 // if a STA, handle any probe request jitter
1043 if (auto staMac = DynamicCast<StaWifiMac>(mac); staMac)
1044 {
1045 currentStream += staMac->AssignStreams(currentStream);
1046 }
1047 }
1048 }
1049 return (currentStream - stream);
1050}
1051
1052} // namespace ns3
Headers for A-MPDU subframes.
uint16_t GetLength() const
Return the length field.
bool GetEof() const
Return the EOF field.
Manage ASCII trace files for device models.
Definition: trace-helper.h:174
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:70
AttributeValue implementation for Boolean.
Definition: boolean.h:37
bool Get() const
Definition: boolean.cc:55
EHT configuration.
HE configuration.
std::size_t GetIndex() const
Get the RU index.
Definition: he-ru.cc:461
RuType GetRuType() const
Get the RU type.
Definition: he-ru.cc:454
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
Definition: he-ru.cc:468
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
@ RU_26_TONE
Definition: he-ru.h:42
@ RU_484_TONE
Definition: he-ru.h:46
@ RU_996_TONE
Definition: he-ru.h:47
@ RU_106_TONE
Definition: he-ru.h:44
@ RU_52_TONE
Definition: he-ru.h:43
@ RU_242_TONE
Definition: he-ru.h:45
@ RU_2x996_TONE
Definition: he-ru.h:48
HT configuration.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
bool IsTypeIdSet() const
Check if the ObjectFactory has been configured with a TypeId.
OBSS PD algorithm interface.
static void EnablePrinting()
Enable printing packets metadata.
Definition: packet.cc:596
Manage pcap files for device models.
Definition: trace-helper.h:40
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:79
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:52
AttributeValue implementation for Pointer.
Definition: pointer.h:48
Ptr< T > Get() const
Definition: pointer.h:234
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:74
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()
Return the current simulation virtual time.
Definition: simulator.cc:208
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:403
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:80
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: txop.cc:560
a unique identifier for an interface.
Definition: type-id.h:59
Hold an unsigned integer type.
Definition: uinteger.h:45
VHT configuration.
virtual ~WifiHelper()
Definition: wifi-helper.cc:721
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
Definition: wifi-helper.h:604
ObjectFactory m_htConfig
HT configuration.
Definition: wifi-helper.h:522
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
Definition: wifi-helper.h:527
ObjectFactory m_ehtConfig
EHT configuration.
Definition: wifi-helper.h:525
ObjectFactory m_vhtConfig
VHT configuration.
Definition: wifi-helper.h:523
void SetSelectQueueCallback(SelectQueueCallback f)
Definition: wifi-helper.cc:750
std::vector< ObjectFactory > m_stationManager
station manager
Definition: wifi-helper.h:520
WifiStandard m_standard
wifi standard
Definition: wifi-helper.h:521
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:988
virtual void SetStandard(WifiStandard standard)
Definition: wifi-helper.cc:738
ObjectFactory m_heConfig
HE configuration.
Definition: wifi-helper.h:524
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
Definition: wifi-helper.cc:756
void DisableFlowControl()
Disable flow control only if you know what you are doing.
Definition: wifi-helper.cc:744
SelectQueueCallback m_selectQueueCallback
select queue callback
Definition: wifi-helper.h:526
static void EnableLogComponents()
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:880
bool m_enableFlowControl
whether to enable flow control
Definition: wifi-helper.h:528
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
Definition: wifi-helper.cc:725
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
Definition: wifi-helper.h:374
create MAC layers for a ns3::WifiNetDevice.
virtual Ptr< WifiMac > Create(Ptr< WifiNetDevice > device, WifiStandard standard) const
Implements the IEEE 802.11 MAC trailer.
represent a single transmission mode
Definition: wifi-mode.h:51
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:185
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
uint8_t GetMcsValue() const
Definition: wifi-mode.cc:163
Hold together all Wifi-related objects.
create PHY objects
Definition: wifi-helper.h:49
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:543
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:624
WifiPhyHelper(uint8_t nLinks=1)
Constructor.
Definition: wifi-helper.cc:146
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:163
~WifiPhyHelper() override
Definition: wifi-helper.cc:158
void DisablePreambleDetectionModel()
Disable the preamble detection model on all links.
Definition: wifi-helper.cc:178
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
Definition: wifi-helper.cc:568
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
Definition: wifi-helper.h:313
std::vector< ObjectFactory > m_frameCaptureModel
frame capture model
Definition: wifi-helper.h:241
std::vector< ObjectFactory > m_preambleDetectionModel
preamble detection model
Definition: wifi-helper.h:242
PcapHelper::DataLinkType GetPcapDataLinkType() const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:562
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:218
std::vector< ObjectFactory > m_phys
PHY objects.
Definition: wifi-helper.h:238
void SetPreambleDetectionModel(std::string type, Args &&... args)
Helper function used to set the preamble detection model.
Definition: wifi-helper.h:586
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:187
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:178
@ DLT_PRISM_HEADER
Include Prism monitor mode information.
Definition: wifi-helper.h:176
std::vector< ObjectFactory > m_errorRateModel
error rate model
Definition: wifi-helper.h:240
virtual std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const =0
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:264
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetGuardInterval() const
uint8_t GetBssColor() 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.
bool IsStbc() const
Check if STBC is used or not.
WifiPreamble GetPreambleType() const
HeMuUserInfo GetHeMuUserInfo(uint16_t staId) const
Get the HE MU user-specific transmission information for the given STA-ID.
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() const
Checks whether the PSDU contains A-MPDU.
uint16_t GetChannelWidth() const
uint8_t GetNess() const
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:978
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:954
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#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:275
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:765
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
uint8_t SelectQueueByDSField(Ptr< QueueItem > item)
Determine the TX queue for a given packet.
Definition: qos-utils.cc:253
@ WIFI_STANDARD_80211be
@ 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:75
@ AC_VO
Voice.
Definition: qos-utils.h:81
@ AC_VI
Video.
Definition: qos-utils.h:79
@ AC_BK
Background.
Definition: qos-utils.h:77
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
Definition: first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:302
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
ASCII trace PHY receive sink without context.
Definition: wifi-helper.cc:132
@ 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
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
ASCII trace PHY receive sink with context.
Definition: wifi-helper.cc:108
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:320
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII trace PHY transmit sink with context.
Definition: wifi-helper.cc:60
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII trace PHY transmit sink without context.
Definition: wifi-helper.cc:84
HeRu::RuSpec ru
RU specification.
MpduInfo structure.
Definition: phy-entity.h:62
MpduType type
type of MPDU
Definition: phy-entity.h:63
uint32_t mpduRefNumber
MPDU ref number.
Definition: phy-entity.h:64
SignalNoiseDbm structure.
Definition: phy-entity.h:55
double noise
noise power in dBm
Definition: phy-entity.h:57
double signal
signal strength in dBm
Definition: phy-entity.h:56