A Discrete-Event Network Simulator
API
sta-wifi-mac.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006, 2009 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 "sta-wifi-mac.h"
23
26#include "mgt-headers.h"
27#include "qos-txop.h"
28#include "snr-tag.h"
29#include "wifi-assoc-manager.h"
30#include "wifi-net-device.h"
31#include "wifi-phy.h"
32
33#include "ns3/he-configuration.h"
34#include "ns3/ht-configuration.h"
35#include "ns3/log.h"
36#include "ns3/packet.h"
37#include "ns3/pointer.h"
38#include "ns3/random-variable-stream.h"
39#include "ns3/simulator.h"
40#include "ns3/string.h"
41
42#include <numeric>
43
44namespace ns3
45{
46
47NS_LOG_COMPONENT_DEFINE("StaWifiMac");
48
50
51TypeId
53{
54 static TypeId tid =
55 TypeId("ns3::StaWifiMac")
57 .SetGroupName("Wifi")
58 .AddConstructor<StaWifiMac>()
59 .AddAttribute("ProbeRequestTimeout",
60 "The duration to actively probe the channel.",
61 TimeValue(Seconds(0.05)),
64 .AddAttribute("WaitBeaconTimeout",
65 "The duration to dwell on a channel while passively scanning for beacon",
69 .AddAttribute("AssocRequestTimeout",
70 "The interval between two consecutive association request attempts.",
71 TimeValue(Seconds(0.5)),
74 .AddAttribute("MaxMissedBeacons",
75 "Number of beacons which much be consecutively missed before "
76 "we attempt to restart association.",
77 UintegerValue(10),
79 MakeUintegerChecker<uint32_t>())
80 .AddAttribute(
81 "ActiveProbing",
82 "If true, we send probe requests. If false, we don't."
83 "NOTE: if more than one STA in your simulation is using active probing, "
84 "you should enable it at a different simulation time for each STA, "
85 "otherwise all the STAs will start sending probes at the same time resulting in "
86 "collisions. "
87 "See bug 1060 for more info.",
88 BooleanValue(false),
91 .AddAttribute("ProbeDelay",
92 "Delay (in microseconds) to be used prior to transmitting a "
93 "Probe frame during active scanning.",
94 StringValue("ns3::UniformRandomVariable[Min=50.0|Max=250.0]"),
96 MakePointerChecker<RandomVariableStream>())
97 .AddTraceSource("Assoc",
98 "Associated with an access point. If this is an MLD that associated "
99 "with an AP MLD, the AP MLD address is provided.",
101 "ns3::Mac48Address::TracedCallback")
102 .AddTraceSource("LinkSetupCompleted",
103 "A link was setup in the context of ML setup with an AP MLD. "
104 "Provides ID of the setup link and AP MAC address",
106 "ns3::StaWifiMac::LinkSetupCallback")
107 .AddTraceSource("DeAssoc",
108 "Association with an access point lost. If this is an MLD "
109 "that disassociated with an AP MLD, the AP MLD address is provided.",
111 "ns3::Mac48Address::TracedCallback")
112 .AddTraceSource("LinkSetupCanceled",
113 "A link setup in the context of ML setup with an AP MLD was torn down. "
114 "Provides ID of the setup link and AP MAC address",
116 "ns3::StaWifiMac::LinkSetupCallback")
117 .AddTraceSource("BeaconArrival",
118 "Time of beacons arrival from associated AP",
120 "ns3::Time::TracedCallback")
121 .AddTraceSource("ReceivedBeaconInfo",
122 "Information about every received Beacon frame",
124 "ns3::ApInfo::TracedCallback");
125 return tid;
126}
127
129 : m_state(UNASSOCIATED),
130 m_aid(0),
131 m_assocRequestEvent()
132{
133 NS_LOG_FUNCTION(this);
134
135 // Let the lower layers know that we are acting as a non-AP STA in
136 // an infrastructure BSS.
138}
139
140void
142{
143 NS_LOG_FUNCTION(this);
145}
146
147void
149{
150 NS_LOG_FUNCTION(this);
151 if (m_assocManager)
152 {
153 m_assocManager->Dispose();
154 }
155 m_assocManager = nullptr;
157}
158
160{
161 NS_LOG_FUNCTION(this);
162}
163
165{
167}
168
169std::unique_ptr<WifiMac::LinkEntity>
171{
172 return std::make_unique<StaLinkEntity>();
173}
174
176StaWifiMac::GetLink(uint8_t linkId) const
177{
178 return static_cast<StaLinkEntity&>(WifiMac::GetLink(linkId));
179}
180
181int64_t
183{
184 NS_LOG_FUNCTION(this << stream);
185 m_probeDelay->SetStream(stream);
186 return 1;
187}
188
189void
191{
192 NS_LOG_FUNCTION(this << assocManager);
193 m_assocManager = assocManager;
194 m_assocManager->SetStaWifiMac(this);
195}
196
197uint16_t
199{
200 NS_ASSERT_MSG(IsAssociated(), "This station is not associated to any AP");
201 return m_aid;
202}
203
204void
206{
207 NS_LOG_FUNCTION(this << enable);
208 m_activeProbing = enable;
209 if (m_state == SCANNING)
210 {
211 NS_LOG_DEBUG("STA is still scanning, reset scanning process");
213 }
214}
215
216bool
218{
219 return m_activeProbing;
220}
221
222void
223StaWifiMac::SetWifiPhys(const std::vector<Ptr<WifiPhy>>& phys)
224{
225 NS_LOG_FUNCTION(this);
227 for (auto& phy : phys)
228 {
229 phy->SetCapabilitiesChangedCallback(
231 }
232}
233
235StaWifiMac::GetCurrentChannel(uint8_t linkId) const
236{
237 auto phy = GetWifiPhy(linkId);
238 uint16_t width = phy->GetOperatingChannel().IsOfdm() ? 20 : phy->GetChannelWidth();
239 uint8_t ch = phy->GetOperatingChannel().GetPrimaryChannelNumber(width, phy->GetStandard());
240 return {ch, phy->GetPhyBand()};
241}
242
243void
245{
246 NS_LOG_FUNCTION(this);
247 WifiMacHeader hdr;
250 hdr.SetAddr2(GetAddress());
252 hdr.SetDsNotFrom();
253 hdr.SetDsNotTo();
254 Ptr<Packet> packet = Create<Packet>();
256 probe.SetSsid(GetSsid());
258 if (GetHtSupported())
259 {
262 }
264 {
266 }
267 if (GetHeSupported())
268 {
270 }
271 if (GetEhtSupported())
272 {
274 }
275 packet->AddHeader(probe);
276
277 if (!GetQosSupported())
278 {
279 GetTxop()->Queue(packet, hdr);
280 }
281 // "A QoS STA that transmits a Management frame determines access category used
282 // for medium access in transmission of the Management frame as follows
283 // (If dot11QMFActivated is false or not present)
284 // — If the Management frame is individually addressed to a non-QoS STA, category
285 // AC_BE should be selected.
286 // — If category AC_BE was not selected by the previous step, category AC_VO
287 // shall be selected." (Sec. 10.2.3.2 of 802.11-2020)
288 else
289 {
290 GetVOQueue()->Queue(packet, hdr);
291 }
292}
293
294std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>
295StaWifiMac::GetAssociationRequest(bool isReassoc, uint8_t linkId) const
296{
297 NS_LOG_FUNCTION(this << isReassoc << +linkId);
298
299 std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader> mgtFrame;
300
301 if (isReassoc)
302 {
304 reassoc.SetCurrentApAddress(GetBssid(linkId));
305 mgtFrame = std::move(reassoc);
306 }
307 else
308 {
309 mgtFrame = MgtAssocRequestHeader();
310 }
311
312 // lambda to set the fields of the (Re)Association Request
313 auto fill = [&](auto&& frame) {
314 frame.SetSsid(GetSsid());
315 frame.SetSupportedRates(GetSupportedRates(linkId));
316 frame.SetCapabilities(GetCapabilities(linkId));
317 frame.SetListenInterval(0);
318 if (GetHtSupported())
319 {
320 frame.SetExtendedCapabilities(GetExtendedCapabilities());
321 frame.SetHtCapabilities(GetHtCapabilities(linkId));
322 }
323 if (GetVhtSupported(linkId))
324 {
325 frame.SetVhtCapabilities(GetVhtCapabilities(linkId));
326 }
327 if (GetHeSupported())
328 {
329 frame.SetHeCapabilities(GetHeCapabilities(linkId));
330 }
331 if (GetEhtSupported())
332 {
333 frame.SetEhtCapabilities(GetEhtCapabilities(linkId));
334 }
335 };
336
337 std::visit(fill, mgtFrame);
338 return mgtFrame;
339}
340
342StaWifiMac::GetMultiLinkElement(bool isReassoc, uint8_t linkId) const
343{
344 NS_LOG_FUNCTION(this << isReassoc << +linkId);
345
349 // The Common info field of the Basic Multi-Link element carried in the (Re)Association
350 // Request frame shall include the MLD MAC address, the MLD Capabilities and Operations,
351 // and the EML Capabilities subfields, and shall not include the Link ID Info, the BSS
352 // Parameters Change Count, and the Medium Synchronization Delay Information subfields
353 // (Sec. 35.3.5.4 of 802.11be D2.0)
354 // TODO Add the MLD Capabilities and Operations and the EML Capabilities subfields
355 multiLinkElement.SetMldMacAddress(GetAddress());
356 // For each requested link in addition to the link on which the (Re)Association Request
357 // frame is transmitted, the Link Info field of the Basic Multi-Link element carried
358 // in the (Re)Association Request frame shall contain the corresponding Per-STA Profile
359 // subelement(s).
360 for (uint8_t index = 0; index < GetNLinks(); index++)
361 {
362 auto& link = GetLink(index);
363 if (index != linkId && link.apLinkId.has_value())
364 {
365 multiLinkElement.AddPerStaProfileSubelement();
366 auto& perStaProfile = multiLinkElement.GetPerStaProfile(
367 multiLinkElement.GetNPerStaProfileSubelements() - 1);
368 // The Link ID subfield of the STA Control field of the Per-STA Profile subelement
369 // for the corresponding non-AP STA that requests a link for multi-link (re)setup
370 // with the AP MLD is set to the link ID of the AP affiliated with the AP MLD that
371 // is operating on that link. The link ID is obtained during multi-link discovery
372 perStaProfile.SetLinkId(link.apLinkId.value());
373 // For each Per-STA Profile subelement included in the Link Info field, the
374 // Complete Profile subfield of the STA Control field shall be set to 1
375 perStaProfile.SetCompleteProfile();
376 // The MAC Address Present subfield indicates the presence of the STA MAC Address
377 // subfield in the STA Info field and is set to 1 if the STA MAC Address subfield
378 // is present in the STA Info field; otherwise set to 0. An STA sets this subfield
379 // to 1 when the element carries complete profile.
380 perStaProfile.SetStaMacAddress(link.feManager->GetAddress());
381 perStaProfile.SetAssocRequest(GetAssociationRequest(isReassoc, index));
382 }
383 }
384
385 return multiLinkElement;
386}
387
388void
390{
391 // find the link where the (Re)Association Request has to be sent
392 uint8_t linkId = 0;
393 while (linkId < GetNLinks())
394 {
395 if (GetLink(linkId).sendAssocReq)
396 {
397 break;
398 }
399 linkId++;
400 }
401 NS_ABORT_MSG_IF(linkId == GetNLinks(), "No link selected to send the (Re)Association Request");
402 auto& link = GetLink(linkId);
403 NS_ABORT_MSG_IF(!link.bssid.has_value(),
404 "No BSSID set for the link on which the (Re)Association Request is to be sent");
405
406 NS_LOG_FUNCTION(this << *link.bssid << isReassoc);
407 WifiMacHeader hdr;
409 hdr.SetAddr1(*link.bssid);
410 hdr.SetAddr2(link.feManager->GetAddress());
411 hdr.SetAddr3(*link.bssid);
412 hdr.SetDsNotFrom();
413 hdr.SetDsNotTo();
414 Ptr<Packet> packet = Create<Packet>();
415
416 auto frame = GetAssociationRequest(isReassoc, linkId);
417
418 // include a Multi-Link Element if this device has multiple links (independently
419 // of how many links will be setup) and the AP is a multi-link device
420 if (GetNLinks() > 1 &&
421 GetWifiRemoteStationManager(linkId)->GetMldAddress(*link.bssid).has_value())
422 {
423 auto addMle = [&](auto&& frame) {
424 frame.SetMultiLinkElement(GetMultiLinkElement(isReassoc, linkId));
425 };
426 std::visit(addMle, frame);
427 }
428
429 if (!isReassoc)
430 {
431 packet->AddHeader(std::get<MgtAssocRequestHeader>(frame));
432 }
433 else
434 {
435 packet->AddHeader(std::get<MgtReassocRequestHeader>(frame));
436 }
437
438 if (!GetQosSupported())
439 {
440 GetTxop()->Queue(packet, hdr);
441 }
442 // "A QoS STA that transmits a Management frame determines access category used
443 // for medium access in transmission of the Management frame as follows
444 // (If dot11QMFActivated is false or not present)
445 // — If the Management frame is individually addressed to a non-QoS STA, category
446 // AC_BE should be selected.
447 // — If category AC_BE was not selected by the previous step, category AC_VO
448 // shall be selected." (Sec. 10.2.3.2 of 802.11-2020)
449 else if (!GetWifiRemoteStationManager(linkId)->GetQosSupported(*link.bssid))
450 {
451 GetBEQueue()->Queue(packet, hdr);
452 }
453 else
454 {
455 GetVOQueue()->Queue(packet, hdr);
456 }
457
459 {
461 }
464}
465
466void
468{
469 NS_LOG_FUNCTION(this);
470 switch (m_state)
471 {
472 case ASSOCIATED:
473 return;
474 break;
475 case SCANNING:
476 /* we have initiated active or passive scanning, continue to wait
477 and gather beacons or probe responses until the scanning timeout
478 */
479 break;
480 case UNASSOCIATED:
481 /* we were associated but we missed a bunch of beacons
482 * so we should assume we are not associated anymore.
483 * We try to initiate a scan now.
484 */
485 m_linkDown();
487 break;
488 case WAIT_ASSOC_RESP:
489 /* we have sent an association request so we do not need to
490 re-send an association request right now. We just need to
491 wait until either assoc-request-timeout or until
492 we get an association response.
493 */
494 break;
495 case REFUSED:
496 /* we have sent an association request and received a negative
497 association response. We wait until someone restarts an
498 association with a given SSID.
499 */
500 break;
501 }
502}
503
504void
506{
507 NS_LOG_FUNCTION(this);
510
511 WifiScanParams scanParams;
512 scanParams.ssid = GetSsid();
513 for (uint8_t linkId = 0; linkId < GetNLinks(); linkId++)
514 {
516 (GetWifiPhy(linkId)->HasFixedPhyBand())
519
520 scanParams.channelList.push_back(channel);
521 }
522 if (m_activeProbing)
523 {
524 scanParams.type = WifiScanParams::ACTIVE;
526 scanParams.minChannelTime = scanParams.maxChannelTime = m_probeRequestTimeout;
527 }
528 else
529 {
530 scanParams.type = WifiScanParams::PASSIVE;
532 }
533
534 m_assocManager->StartScanning(std::move(scanParams));
535}
536
537void
538StaWifiMac::ScanningTimeout(const std::optional<ApInfo>& bestAp)
539{
540 NS_LOG_FUNCTION(this);
541
542 if (!bestAp.has_value())
543 {
544 NS_LOG_DEBUG("Exhausted list of candidate AP; restart scanning");
546 return;
547 }
548
549 NS_LOG_DEBUG("Attempting to associate with AP: " << *bestAp);
550 UpdateApInfo(bestAp->m_frame, bestAp->m_apAddr, bestAp->m_bssid, bestAp->m_linkId);
551 // reset info on links to setup
552 for (uint8_t linkId = 0; linkId < GetNLinks(); linkId++)
553 {
554 auto& link = GetLink(linkId);
555 link.sendAssocReq = false;
556 link.apLinkId = std::nullopt;
557 link.bssid = std::nullopt;
558 }
559 // send Association Request on the link where the Beacon/Probe Response was received
560 GetLink(bestAp->m_linkId).sendAssocReq = true;
561 GetLink(bestAp->m_linkId).bssid = bestAp->m_bssid;
562 // update info on links to setup (11be MLDs only)
563 for (const auto& [localLinkId, apLinkId] : bestAp->m_setupLinks)
564 {
565 NS_LOG_DEBUG("Setting up link (local ID=" << +localLinkId << ", AP ID=" << +apLinkId
566 << ")");
567 GetLink(localLinkId).apLinkId = apLinkId;
568 if (localLinkId == bestAp->m_linkId)
569 {
570 continue;
571 }
572 auto mldAddress =
573 GetWifiRemoteStationManager(bestAp->m_linkId)->GetMldAddress(bestAp->m_bssid);
574 NS_ABORT_MSG_IF(!mldAddress.has_value(), "AP MLD address not set");
575 auto bssid = GetWifiRemoteStationManager(localLinkId)->GetAffiliatedStaAddress(*mldAddress);
576 NS_ABORT_MSG_IF(!mldAddress.has_value(),
577 "AP link address not set for local link " << +localLinkId);
578 GetLink(localLinkId).bssid = *bssid;
579 }
580 // lambda to get beacon interval from Beacon or Probe Response
581 auto getBeaconInterval = [](auto&& frame) {
582 using T = std::decay_t<decltype(frame)>;
583 if constexpr (std::is_same_v<T, MgtBeaconHeader> ||
584 std::is_same_v<T, MgtProbeResponseHeader>)
585 {
586 return MicroSeconds(frame.GetBeaconIntervalUs());
587 }
588 else
589 {
590 NS_ABORT_MSG("Unexpected frame type");
591 return Seconds(0);
592 }
593 };
594 Time beaconInterval = std::visit(getBeaconInterval, bestAp->m_frame);
595 Time delay = beaconInterval * m_maxMissedBeacons;
596 // restart beacon watchdog for all links to setup
597 for (uint8_t linkId = 0; linkId < GetNLinks(); linkId++)
598 {
599 if (GetLink(linkId).apLinkId.has_value() || GetNLinks() == 1)
600 {
601 RestartBeaconWatchdog(delay, linkId);
602 }
603 }
606}
607
608void
610{
611 NS_LOG_FUNCTION(this);
614}
615
616void
618{
619 NS_LOG_FUNCTION(this << +linkId);
620 auto& link = GetLink(linkId);
621 if (link.beaconWatchdogEnd > Simulator::Now())
622 {
623 if (link.beaconWatchdog.IsRunning())
624 {
625 link.beaconWatchdog.Cancel();
626 }
627 link.beaconWatchdog = Simulator::Schedule(link.beaconWatchdogEnd - Simulator::Now(),
629 this,
630 linkId);
631 return;
632 }
633 NS_LOG_DEBUG("beacon missed");
634 // We need to switch to the UNASSOCIATED state. However, if we are receiving
635 // a frame, wait until the RX is completed (otherwise, crashes may occur if
636 // we are receiving a MU frame because its reception requires the STA-ID)
637 Time delay = Seconds(0);
638 if (GetWifiPhy(linkId)->IsStateRx())
639 {
640 delay = GetWifiPhy(linkId)->GetDelayUntilIdle();
641 }
642 Simulator::Schedule(delay, &StaWifiMac::Disassociated, this, linkId);
643}
644
645void
647{
648 NS_LOG_FUNCTION(this << +linkId);
649
650 auto& link = GetLink(linkId);
651 if (link.apLinkId.has_value())
652 {
653 // this is a link setup in an ML setup
654 m_setupCanceled(linkId, GetBssid(linkId));
655 }
656
657 // disable the given link
658 link.apLinkId = std::nullopt;
659 link.bssid = std::nullopt;
660 link.phy->SetOffMode();
661
662 for (uint8_t id = 0; id < GetNLinks(); id++)
663 {
664 if (GetLink(id).apLinkId.has_value())
665 {
666 // found an enabled link
667 return;
668 }
669 }
670
671 NS_LOG_DEBUG("Set state to UNASSOCIATED and start scanning");
673 auto mldAddress = GetWifiRemoteStationManager(linkId)->GetMldAddress(GetBssid(linkId));
674 if (GetNLinks() > 1 && mldAddress.has_value())
675 {
676 // trace the AP MLD address
677 m_deAssocLogger(*mldAddress);
678 }
679 else
680 {
681 m_deAssocLogger(GetBssid(linkId));
682 }
683 m_aid = 0; // reset AID
684 // ensure all links are on
685 for (uint8_t id = 0; id < GetNLinks(); id++)
686 {
688 }
690}
691
692void
694{
695 NS_LOG_FUNCTION(this << delay << +linkId);
696 auto& link = GetLink(linkId);
697 link.beaconWatchdogEnd = std::max(Simulator::Now() + delay, link.beaconWatchdogEnd);
698 if (Simulator::GetDelayLeft(link.beaconWatchdog) < delay && link.beaconWatchdog.IsExpired())
699 {
700 NS_LOG_DEBUG("really restart watchdog.");
701 link.beaconWatchdog = Simulator::Schedule(delay, &StaWifiMac::MissedBeacons, this, linkId);
702 }
703}
704
705bool
707{
708 return m_state == ASSOCIATED;
709}
710
711bool
713{
714 return m_state == WAIT_ASSOC_RESP;
715}
716
717bool
719{
720 return (IsAssociated());
721}
722
723void
725{
726 NS_LOG_FUNCTION(this << packet << to);
727 if (!CanForwardPacketsTo(to))
728 {
729 NotifyTxDrop(packet);
731 return;
732 }
733 WifiMacHeader hdr;
734
735 // If we are not a QoS AP then we definitely want to use AC_BE to
736 // transmit the packet. A TID of zero will map to AC_BE (through \c
737 // QosUtilsMapTidToAc()), so we use that as our default here.
738 uint8_t tid = 0;
739
740 // For now, an AP that supports QoS does not support non-QoS
741 // associations, and vice versa. In future the AP model should
742 // support simultaneously associated QoS and non-QoS STAs, at which
743 // point there will need to be per-association QoS state maintained
744 // by the association state machine, and consulted here.
745 if (GetQosSupported())
746 {
749 hdr.SetQosNoEosp();
750 hdr.SetQosNoAmsdu();
751 // Transmission of multiple frames in the same TXOP is not
752 // supported for now
753 hdr.SetQosTxopLimit(0);
754
755 // Fill in the QoS control field in the MAC header
756 tid = QosUtilsGetTidForPacket(packet);
757 // Any value greater than 7 is invalid and likely indicates that
758 // the packet had no QoS tag, so we revert to zero, which'll
759 // mean that AC_BE is used.
760 if (tid > 7)
761 {
762 tid = 0;
763 }
764 hdr.SetQosTid(tid);
765 }
766 else
767 {
769 }
770 if (GetQosSupported())
771 {
772 hdr.SetNoOrder(); // explicitly set to 0 for the time being since HT control field is not
773 // yet implemented (set it to 1 when implemented)
774 }
775
776 hdr.SetAddr1(GetBssid(0)); // TODO use appropriate linkId
777 hdr.SetAddr2(GetAddress());
778 hdr.SetAddr3(to);
779 hdr.SetDsNotFrom();
780 hdr.SetDsTo();
781
782 if (GetQosSupported())
783 {
784 // Sanity check that the TID is valid
785 NS_ASSERT(tid < 8);
786 GetQosTxop(tid)->Queue(packet, hdr);
787 }
788 else
789 {
790 GetTxop()->Queue(packet, hdr);
791 }
792}
793
794void
796{
797 NS_LOG_FUNCTION(this << *mpdu << +linkId);
798 const WifiMacHeader* hdr = &mpdu->GetHeader();
799 Ptr<const Packet> packet = mpdu->GetPacket();
800 NS_ASSERT(!hdr->IsCtl());
801 Mac48Address myAddr =
802 hdr->IsData() ? GetAddress() : GetFrameExchangeManager(linkId)->GetAddress();
803 if (hdr->GetAddr3() == myAddr)
804 {
805 NS_LOG_LOGIC("packet sent by us.");
806 return;
807 }
808 if (hdr->GetAddr1() != myAddr && !hdr->GetAddr1().IsGroup())
809 {
810 NS_LOG_LOGIC("packet is not for us");
811 NotifyRxDrop(packet);
812 return;
813 }
814 if (hdr->IsData())
815 {
816 if (!IsAssociated())
817 {
818 NS_LOG_LOGIC("Received data frame while not associated: ignore");
819 NotifyRxDrop(packet);
820 return;
821 }
822 if (!(hdr->IsFromDs() && !hdr->IsToDs()))
823 {
824 NS_LOG_LOGIC("Received data frame not from the DS: ignore");
825 NotifyRxDrop(packet);
826 return;
827 }
828 if (hdr->GetAddr2() != GetBssid(0)) // TODO use appropriate linkId
829 {
830 NS_LOG_LOGIC("Received data frame not from the BSS we are associated with: ignore");
831 NotifyRxDrop(packet);
832 return;
833 }
834 if (hdr->IsQosData())
835 {
836 if (hdr->IsQosAmsdu())
837 {
838 NS_ASSERT(hdr->GetAddr3() == GetBssid(0)); // TODO use appropriate linkId
840 packet = nullptr;
841 }
842 else
843 {
844 ForwardUp(packet, hdr->GetAddr3(), hdr->GetAddr1());
845 }
846 }
847 else if (hdr->HasData())
848 {
849 ForwardUp(packet, hdr->GetAddr3(), hdr->GetAddr1());
850 }
851 return;
852 }
853
854 switch (hdr->GetType())
855 {
859 // This is a frame aimed at an AP, so we can safely ignore it.
860 NotifyRxDrop(packet);
861 break;
862
864 ReceiveBeacon(mpdu, linkId);
865 break;
866
868 ReceiveProbeResp(mpdu, linkId);
869 break;
870
873 ReceiveAssocResp(mpdu, linkId);
874 break;
875
876 default:
877 // Invoke the receive handler of our parent class to deal with any
878 // other frames. Specifically, this will handle Block Ack-related
879 // Management Action frames.
880 WifiMac::Receive(mpdu, linkId);
881 }
882}
883
884void
886{
887 NS_LOG_FUNCTION(this << *mpdu << +linkId);
888 const WifiMacHeader& hdr = mpdu->GetHeader();
889 NS_ASSERT(hdr.IsBeacon());
890
891 NS_LOG_DEBUG("Beacon received");
892 MgtBeaconHeader beacon;
893 mpdu->GetPacket()->PeekHeader(beacon);
894 const CapabilityInformation& capabilities = beacon.GetCapabilities();
895 NS_ASSERT(capabilities.IsEss());
896 bool goodBeacon;
897 if (IsWaitAssocResp() || IsAssociated())
898 {
899 // we have to process this Beacon only if sent by the AP we are associated
900 // with or from which we are waiting an Association Response frame
901 auto bssid = GetLink(linkId).bssid;
902 goodBeacon = bssid.has_value() && (hdr.GetAddr3() == *bssid);
903 }
904 else
905 {
906 // we retain this Beacon as candidate AP if the supported rates fit the
907 // configured BSS membership selector
908 goodBeacon = CheckSupportedRates(beacon, linkId);
909 }
910
911 SnrTag snrTag;
912 bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
913 NS_ASSERT(found);
914 ApInfo apInfo = {.m_bssid = hdr.GetAddr3(),
915 .m_apAddr = hdr.GetAddr2(),
916 .m_snr = snrTag.Get(),
917 .m_frame = std::move(beacon),
918 .m_channel = {GetCurrentChannel(linkId)},
919 .m_linkId = linkId};
920
921 if (!m_beaconInfo.IsEmpty())
922 {
923 m_beaconInfo(apInfo);
924 }
925
926 if (!goodBeacon)
927 {
928 NS_LOG_LOGIC("Beacon is not for us");
929 return;
930 }
931 if (m_state == ASSOCIATED)
932 {
934 Time delay = MicroSeconds(std::get<MgtBeaconHeader>(apInfo.m_frame).GetBeaconIntervalUs() *
936 RestartBeaconWatchdog(delay, linkId);
937 UpdateApInfo(apInfo.m_frame, hdr.GetAddr2(), hdr.GetAddr3(), linkId);
938 }
939 else
940 {
941 NS_LOG_DEBUG("Beacon received from " << hdr.GetAddr2());
942 m_assocManager->NotifyApInfo(std::move(apInfo));
943 }
944}
945
946void
948{
949 NS_LOG_FUNCTION(this << *mpdu << +linkId);
950 const WifiMacHeader& hdr = mpdu->GetHeader();
951 NS_ASSERT(hdr.IsProbeResp());
952
953 NS_LOG_DEBUG("Probe response received from " << hdr.GetAddr2());
954 MgtProbeResponseHeader probeResp;
955 mpdu->GetPacket()->PeekHeader(probeResp);
956 if (!CheckSupportedRates(probeResp, linkId))
957 {
958 return;
959 }
960 SnrTag snrTag;
961 bool found = mpdu->GetPacket()->PeekPacketTag(snrTag);
962 NS_ASSERT(found);
963 m_assocManager->NotifyApInfo(ApInfo{.m_bssid = hdr.GetAddr3(),
964 .m_apAddr = hdr.GetAddr2(),
965 .m_snr = snrTag.Get(),
966 .m_frame = std::move(probeResp),
967 .m_channel = {GetCurrentChannel(linkId)},
968 .m_linkId = linkId});
969}
970
971void
973{
974 NS_LOG_FUNCTION(this << *mpdu << +linkId);
975 const WifiMacHeader& hdr = mpdu->GetHeader();
976 NS_ASSERT(hdr.IsAssocResp() || hdr.IsReassocResp());
977
979 {
980 return;
981 }
982
983 MgtAssocResponseHeader assocResp;
984 mpdu->GetPacket()->PeekHeader(assocResp);
986 {
988 }
989 if (assocResp.GetStatusCode().IsSuccess())
990 {
991 m_aid = assocResp.GetAssociationId();
992 NS_LOG_DEBUG((hdr.IsReassocResp() ? "reassociation done" : "association completed"));
993 UpdateApInfo(assocResp, hdr.GetAddr2(), hdr.GetAddr3(), linkId);
994 NS_ASSERT(GetLink(linkId).bssid.has_value() && *GetLink(linkId).bssid == hdr.GetAddr3());
995 SetBssid(hdr.GetAddr3(), linkId);
996 if ((GetNLinks() > 1) && assocResp.GetMultiLinkElement().has_value())
997 {
998 // this is an ML setup, trace the MLD address (only once)
999 m_assocLogger(*GetWifiRemoteStationManager(linkId)->GetMldAddress(hdr.GetAddr3()));
1000 m_setupCompleted(linkId, hdr.GetAddr3());
1001 }
1002 else
1003 {
1004 m_assocLogger(hdr.GetAddr3());
1005 }
1007 if (!m_linkUp.IsNull())
1008 {
1009 m_linkUp();
1010 }
1011 }
1012
1013 // if this is an MLD, check if we can setup (other) links
1014 if (GetNLinks() > 1)
1015 {
1016 // create a list of all local Link IDs. IDs are removed as we find a corresponding
1017 // Per-STA Profile Subelements indicating successful association. Links with
1018 // remaining IDs are not setup
1019 std::list<uint8_t> setupLinks(GetNLinks());
1020 std::iota(setupLinks.begin(), setupLinks.end(), 0);
1021 if (assocResp.GetStatusCode().IsSuccess())
1022 {
1023 setupLinks.remove(linkId);
1024 }
1025
1026 // if a Multi-Link Element is present, check its content
1027 if (const auto& mle = assocResp.GetMultiLinkElement(); mle.has_value())
1028 {
1029 NS_ABORT_MSG_IF(!GetLink(linkId).apLinkId.has_value(),
1030 "The link on which the Association Response was received "
1031 "is not a link we requested to setup");
1032 NS_ABORT_MSG_IF(*GetLink(linkId).apLinkId != mle->GetLinkIdInfo(),
1033 "The link ID of the AP that transmitted the Association "
1034 "Response does not match the stored link ID");
1035 NS_ABORT_MSG_IF(GetWifiRemoteStationManager(linkId)->GetMldAddress(hdr.GetAddr2()) !=
1036 mle->GetMldMacAddress(),
1037 "The AP MLD MAC address in the received Multi-Link Element does not "
1038 "match the address stored in the station manager for link "
1039 << +linkId);
1040 // process the Per-STA Profile Subelements in the Multi-Link Element
1041 for (std::size_t elem = 0; elem < mle->GetNPerStaProfileSubelements(); elem++)
1042 {
1043 auto& perStaProfile = mle->GetPerStaProfile(elem);
1044 uint8_t apLinkId = perStaProfile.GetLinkId();
1045 uint8_t staLinkid = 0;
1046 while (staLinkid < GetNLinks())
1047 {
1048 if (GetLink(staLinkid).apLinkId == apLinkId)
1049 {
1050 break;
1051 }
1052 staLinkid++;
1053 }
1054 std::optional<Mac48Address> bssid;
1055 NS_ABORT_MSG_IF(staLinkid == GetNLinks() ||
1056 !(bssid = GetLink(staLinkid).bssid).has_value(),
1057 "Setup for AP link ID " << apLinkId << " was not requested");
1058 NS_ABORT_MSG_IF(*bssid != perStaProfile.GetStaMacAddress(),
1059 "The BSSID in the Per-STA Profile for link ID "
1060 << +staLinkid << " does not match the stored BSSID");
1062 GetWifiRemoteStationManager(staLinkid)->GetMldAddress(
1063 perStaProfile.GetStaMacAddress()) != mle->GetMldMacAddress(),
1064 "The AP MLD MAC address in the received Multi-Link Element does not "
1065 "match the address stored in the station manager for link "
1066 << +staLinkid);
1067 // process the Association Response contained in this Per-STA Profile
1068 MgtAssocResponseHeader assoc = perStaProfile.GetAssocResponse();
1069 if (assoc.GetStatusCode().IsSuccess())
1070 {
1071 NS_ABORT_MSG_IF(m_aid != 0 && m_aid != assoc.GetAssociationId(),
1072 "AID should be the same for all the links");
1073 m_aid = assoc.GetAssociationId();
1074 NS_LOG_DEBUG("Setup on link " << staLinkid << " completed");
1075 UpdateApInfo(assoc, *bssid, *bssid, staLinkid);
1076 SetBssid(*bssid, staLinkid);
1077 if (m_state != ASSOCIATED)
1078 {
1080 *GetWifiRemoteStationManager(staLinkid)->GetMldAddress(*bssid));
1081 }
1082 m_setupCompleted(staLinkid, *bssid);
1084 if (!m_linkUp.IsNull())
1085 {
1086 m_linkUp();
1087 }
1088 }
1089 // remove the ID of the link we setup
1090 setupLinks.remove(staLinkid);
1091 }
1092 }
1093 // remaining links in setupLinks are not setup and hence must be disabled
1094 for (const auto& id : setupLinks)
1095 {
1096 GetLink(id).apLinkId = std::nullopt;
1097 GetLink(id).bssid = std::nullopt;
1098 // if at least one link was setup, disable the links that were not setup (if any)
1099 if (m_state == ASSOCIATED)
1100 {
1101 GetLink(id).phy->SetOffMode();
1102 }
1103 }
1104 }
1105
1106 if (m_state == WAIT_ASSOC_RESP)
1107 {
1108 // if we didn't transition to ASSOCIATED, the request was refused
1109 NS_LOG_DEBUG("association refused");
1111 StartScanning();
1112 }
1113}
1114
1115bool
1116StaWifiMac::CheckSupportedRates(std::variant<MgtBeaconHeader, MgtProbeResponseHeader> frame,
1117 uint8_t linkId)
1118{
1119 NS_LOG_FUNCTION(this << +linkId);
1120
1121 // lambda to invoke on the current frame variant
1122 auto check = [&](auto&& mgtFrame) -> bool {
1123 // check supported rates
1124 const SupportedRates& rates = mgtFrame.GetSupportedRates();
1125 for (const auto& selector : GetWifiPhy(linkId)->GetBssMembershipSelectorList())
1126 {
1127 if (!rates.IsBssMembershipSelectorRate(selector))
1128 {
1129 NS_LOG_DEBUG("Supported rates do not fit with the BSS membership selector");
1130 return false;
1131 }
1132 }
1133
1134 return true;
1135 };
1136
1137 return std::visit(check, frame);
1138}
1139
1140void
1142 const Mac48Address& apAddr,
1143 const Mac48Address& bssid,
1144 uint8_t linkId)
1145{
1146 NS_LOG_FUNCTION(this << frame.index() << apAddr << bssid << +linkId);
1147
1148 // lambda processing Information Elements included in all frame types
1149 auto commonOps = [&](auto&& frame) {
1150 const CapabilityInformation& capabilities = frame.GetCapabilities();
1151 const SupportedRates& rates = frame.GetSupportedRates();
1152 for (const auto& mode : GetWifiPhy(linkId)->GetModeList())
1153 {
1154 if (rates.IsSupportedRate(mode.GetDataRate(GetWifiPhy(linkId)->GetChannelWidth())))
1155 {
1156 GetWifiRemoteStationManager(linkId)->AddSupportedMode(apAddr, mode);
1157 if (rates.IsBasicRate(mode.GetDataRate(GetWifiPhy(linkId)->GetChannelWidth())))
1158 {
1160 }
1161 }
1162 }
1163
1164 bool isShortPreambleEnabled = capabilities.IsShortPreamble();
1165 if (const auto& erpInformation = frame.GetErpInformation();
1166 erpInformation.has_value() && GetErpSupported(linkId))
1167 {
1168 isShortPreambleEnabled &= !erpInformation->GetBarkerPreambleMode();
1169 if (erpInformation->GetUseProtection() != 0)
1170 {
1172 }
1173 else
1174 {
1176 }
1177 if (capabilities.IsShortSlotTime() == true)
1178 {
1179 // enable short slot time
1180 GetWifiPhy(linkId)->SetSlot(MicroSeconds(9));
1181 }
1182 else
1183 {
1184 // disable short slot time
1185 GetWifiPhy(linkId)->SetSlot(MicroSeconds(20));
1186 }
1187 }
1188 GetWifiRemoteStationManager(linkId)->SetShortPreambleEnabled(isShortPreambleEnabled);
1190 capabilities.IsShortSlotTime());
1191
1192 if (!GetQosSupported())
1193 {
1194 return;
1195 }
1196 /* QoS station */
1197 bool qosSupported = false;
1198 const auto& edcaParameters = frame.GetEdcaParameterSet();
1199 if (edcaParameters.has_value())
1200 {
1201 qosSupported = true;
1202 // The value of the TXOP Limit field is specified as an unsigned integer, with the least
1203 // significant octet transmitted first, in units of 32 μs.
1205 edcaParameters->GetBeCWmin(),
1206 edcaParameters->GetBeCWmax(),
1207 edcaParameters->GetBeAifsn(),
1208 32 * MicroSeconds(edcaParameters->GetBeTxopLimit()));
1210 edcaParameters->GetBkCWmin(),
1211 edcaParameters->GetBkCWmax(),
1212 edcaParameters->GetBkAifsn(),
1213 32 * MicroSeconds(edcaParameters->GetBkTxopLimit()));
1215 edcaParameters->GetViCWmin(),
1216 edcaParameters->GetViCWmax(),
1217 edcaParameters->GetViAifsn(),
1218 32 * MicroSeconds(edcaParameters->GetViTxopLimit()));
1220 edcaParameters->GetVoCWmin(),
1221 edcaParameters->GetVoCWmax(),
1222 edcaParameters->GetVoAifsn(),
1223 32 * MicroSeconds(edcaParameters->GetVoTxopLimit()));
1224 }
1225 GetWifiRemoteStationManager(linkId)->SetQosSupport(apAddr, qosSupported);
1226
1227 if (!GetHtSupported())
1228 {
1229 return;
1230 }
1231 /* HT station */
1232 if (const auto& htCapabilities = frame.GetHtCapabilities(); htCapabilities.has_value())
1233 {
1234 if (!htCapabilities->IsSupportedMcs(0))
1235 {
1237 }
1238 else
1239 {
1241 *htCapabilities);
1242 }
1243 }
1244 // TODO: process ExtendedCapabilities
1245 // ExtendedCapabilities extendedCapabilities = frame.GetExtendedCapabilities ();
1246
1247 // we do not return if VHT is not supported because HE STAs operating in
1248 // the 2.4 GHz band do not support VHT
1249 if (GetVhtSupported(linkId))
1250 {
1251 const auto& vhtCapabilities = frame.GetVhtCapabilities();
1252 // we will always fill in RxHighestSupportedLgiDataRate field at TX, so this can be used
1253 // to check whether it supports VHT
1254 if (vhtCapabilities.has_value() &&
1255 vhtCapabilities->GetRxHighestSupportedLgiDataRate() > 0)
1256 {
1258 *vhtCapabilities);
1259 // const auto& vhtOperation = frame.GetVhtOperation ();
1260 for (const auto& mcs : GetWifiPhy(linkId)->GetMcsList(WIFI_MOD_CLASS_VHT))
1261 {
1262 if (vhtCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
1263 {
1264 GetWifiRemoteStationManager(linkId)->AddSupportedMcs(apAddr, mcs);
1265 }
1266 }
1267 }
1268 }
1269
1270 if (!GetHeSupported())
1271 {
1272 return;
1273 }
1274 /* HE station */
1275 const auto& heCapabilities = frame.GetHeCapabilities();
1276 if (heCapabilities.has_value() && heCapabilities->GetSupportedMcsAndNss() != 0)
1277 {
1278 GetWifiRemoteStationManager(linkId)->AddStationHeCapabilities(apAddr, *heCapabilities);
1279 for (const auto& mcs : GetWifiPhy(linkId)->GetMcsList(WIFI_MOD_CLASS_HE))
1280 {
1281 if (heCapabilities->IsSupportedRxMcs(mcs.GetMcsValue()))
1282 {
1283 GetWifiRemoteStationManager(linkId)->AddSupportedMcs(apAddr, mcs);
1284 }
1285 }
1286 if (const auto& heOperation = frame.GetHeOperation(); heOperation.has_value())
1287 {
1288 GetHeConfiguration()->SetAttribute("BssColor",
1289 UintegerValue(heOperation->GetBssColor()));
1290 }
1291 }
1292
1293 const auto& muEdcaParameters = frame.GetMuEdcaParameterSet();
1294 if (muEdcaParameters.has_value())
1295 {
1297 muEdcaParameters->GetMuCwMin(AC_BE),
1298 muEdcaParameters->GetMuCwMax(AC_BE),
1299 muEdcaParameters->GetMuAifsn(AC_BE),
1300 muEdcaParameters->GetMuEdcaTimer(AC_BE));
1302 muEdcaParameters->GetMuCwMin(AC_BK),
1303 muEdcaParameters->GetMuCwMax(AC_BK),
1304 muEdcaParameters->GetMuAifsn(AC_BK),
1305 muEdcaParameters->GetMuEdcaTimer(AC_BK));
1307 muEdcaParameters->GetMuCwMin(AC_VI),
1308 muEdcaParameters->GetMuCwMax(AC_VI),
1309 muEdcaParameters->GetMuAifsn(AC_VI),
1310 muEdcaParameters->GetMuEdcaTimer(AC_VI));
1312 muEdcaParameters->GetMuCwMin(AC_VO),
1313 muEdcaParameters->GetMuCwMax(AC_VO),
1314 muEdcaParameters->GetMuAifsn(AC_VO),
1315 muEdcaParameters->GetMuEdcaTimer(AC_VO));
1316 }
1317
1318 if (!GetEhtSupported())
1319 {
1320 return;
1321 }
1322 /* EHT station */
1323 const auto& ehtCapabilities = frame.GetEhtCapabilities();
1324 // TODO: once we support non constant rate managers, we should add checks here whether EHT
1325 // is supported by the peer
1326 GetWifiRemoteStationManager(linkId)->AddStationEhtCapabilities(apAddr, *ehtCapabilities);
1327 };
1328
1329 // process Information Elements included in the current frame variant
1330 std::visit(commonOps, frame);
1331}
1332
1335{
1336 SupportedRates rates;
1337 for (const auto& mode : GetWifiPhy(linkId)->GetModeList())
1338 {
1339 uint64_t modeDataRate = mode.GetDataRate(GetWifiPhy(linkId)->GetChannelWidth());
1340 NS_LOG_DEBUG("Adding supported rate of " << modeDataRate);
1341 rates.AddSupportedRate(modeDataRate);
1342 }
1343 if (GetHtSupported())
1344 {
1345 for (const auto& selector : GetWifiPhy(linkId)->GetBssMembershipSelectorList())
1346 {
1347 rates.AddBssMembershipSelectorRate(selector);
1348 }
1349 }
1350 return rates;
1351}
1352
1354StaWifiMac::GetCapabilities(uint8_t linkId) const
1355{
1356 CapabilityInformation capabilities;
1357 capabilities.SetShortPreamble(GetWifiPhy(linkId)->GetShortPhyPreambleSupported() ||
1358 GetErpSupported(linkId));
1360 return capabilities;
1361}
1362
1363void
1365{
1366 m_state = value;
1367}
1368
1369void
1371 uint32_t cwMin,
1372 uint32_t cwMax,
1373 uint8_t aifsn,
1374 Time txopLimit)
1375{
1376 Ptr<QosTxop> edca = GetQosTxop(ac);
1377 edca->SetMinCw(cwMin, SINGLE_LINK_OP_ID);
1378 edca->SetMaxCw(cwMax, SINGLE_LINK_OP_ID);
1379 edca->SetAifsn(aifsn, SINGLE_LINK_OP_ID);
1380 edca->SetTxopLimit(txopLimit, SINGLE_LINK_OP_ID);
1381}
1382
1383void
1385 uint16_t cwMin,
1386 uint16_t cwMax,
1387 uint8_t aifsn,
1388 Time muEdcaTimer)
1389{
1390 Ptr<QosTxop> edca = GetQosTxop(ac);
1391 edca->SetMuCwMin(cwMin, SINGLE_LINK_OP_ID);
1392 edca->SetMuCwMax(cwMax, SINGLE_LINK_OP_ID);
1393 edca->SetMuAifsn(aifsn, SINGLE_LINK_OP_ID);
1394 edca->SetMuEdcaTimer(muEdcaTimer, SINGLE_LINK_OP_ID);
1395}
1396
1397void
1399{
1400 NS_LOG_FUNCTION(this);
1401 if (IsAssociated())
1402 {
1403 NS_LOG_DEBUG("PHY capabilities changed: send reassociation request");
1406 }
1407}
1408
1409void
1411{
1412 NS_LOG_FUNCTION(this << +linkId);
1413
1415
1416 if (IsInitialized() && IsAssociated())
1417 {
1418 Disassociated(linkId);
1419 }
1420
1421 // notify association manager
1422 m_assocManager->NotifyChannelSwitched(linkId);
1423}
1424
1425std::ostream&
1426operator<<(std::ostream& os, const StaWifiMac::ApInfo& apInfo)
1427{
1428 os << "BSSID=" << apInfo.m_bssid << ", AP addr=" << apInfo.m_apAddr << ", SNR=" << apInfo.m_snr
1429 << ", Channel={" << apInfo.m_channel.number << "," << apInfo.m_channel.band
1430 << "}, Link ID=" << +apInfo.m_linkId << ", Frame=[";
1431 std::visit([&os](auto&& frame) { frame.Print(os); }, apInfo.m_frame);
1432 os << "]";
1433 return os;
1434}
1435
1436} // namespace ns3
#define max(a, b)
Definition: 80211b.c:43
AttributeValue implementation for Boolean.
Definition: boolean.h:37
bool IsNull() const
Check for null implementation.
Definition: callback.h:556
bool IsShortSlotTime() const
Check if the short slot time in the capability information field is set to 1.
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
bool IsEss() const
Check if the Extended Service Set (ESS) bit in the capability information field is set to 1.
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
bool IsShortPreamble() const
Check if the short preamble bit in the capability information field is set to 1.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:76
an EUI-48 address
Definition: mac48-address.h:46
bool IsGroup() const
static Mac48Address GetBroadcast()
Implement the header for management frames of type association request.
Definition: mgt-headers.h:54
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:446
const std::optional< MultiLinkElement > & GetMultiLinkElement() const
Return the Multi-Link Element information element, if present.
StatusCode GetStatusCode()
Return the status code.
uint16_t GetAssociationId() const
Return the association ID.
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:1222
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:736
void SetSsid(const Ssid &ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:41
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
Definition: mgt-headers.cc:59
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
Definition: mgt-headers.cc:143
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:107
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
Definition: mgt-headers.cc:125
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:89
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the extended capabilities.
Definition: mgt-headers.cc:71
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:885
const CapabilityInformation & GetCapabilities() const
Return the Capability information.
Definition: mgt-headers.cc:340
Implement the header for management frames of type reassociation request.
Definition: mgt-headers.h:247
void SetCurrentApAddress(Mac48Address currentApAddr)
Set the address of the current access point.
bool IsInitialized() const
Check if the object has been initialized.
Definition: object.cc:212
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:268
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetMuCwMin(uint16_t cwMin, uint8_t linkId)
Set the minimum contention window size to use while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:167
void SetMuCwMax(uint16_t cwMax, uint8_t linkId)
Set the maximum contention window size to use while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:174
void SetMuAifsn(uint8_t aifsn, uint8_t linkId)
Set the number of slots that make up an AIFS while the MU EDCA Timer is running for the given link.
Definition: qos-txop.cc:181
void SetMuEdcaTimer(Time timer, uint8_t linkId)
Set the MU EDCA Timer for the given link.
Definition: qos-txop.cc:188
virtual double GetValue()=0
Get the next random value as a double drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Definition: simulator.cc:208
Introspection did not find any typical Config paths.
Definition: snr-tag.h:35
double Get() const
Return the SNR value.
Definition: snr-tag.cc:90
The Wifi MAC high model for a non-AP STA in a BSS.
Definition: sta-wifi-mac.h:122
void ScanningTimeout(const std::optional< ApInfo > &bestAp)
This method is called after wait beacon timeout or wait probe request timeout has occurred.
Time m_waitBeaconTimeout
wait beacon timeout
Definition: sta-wifi-mac.h:476
Ptr< WifiAssocManager > m_assocManager
Association Manager.
Definition: sta-wifi-mac.h:475
void MissedBeacons(uint8_t linkId)
This method is called after we have not received a beacon from the AP on the given link.
bool m_activeProbing
active probing
Definition: sta-wifi-mac.h:481
void DoInitialize() override
Initialize() implementation.
void SetAssocManager(Ptr< WifiAssocManager > assocManager)
Set the Association Manager.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
void SetEdcaParameters(AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
void SetState(MacState value)
Set the current MAC state.
TracedCallback< Mac48Address > m_deAssocLogger
disassociation logger
Definition: sta-wifi-mac.h:487
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:258
void NotifyChannelSwitching(uint8_t linkId) override
Notify that channel on the given link has been switched.
bool GetActiveProbing() const
Return whether active probing is enabled.
void PhyCapabilitiesChanged()
Indicate that PHY capabilities have changed.
void ReceiveProbeResp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Probe Response frame received on the given link.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
WifiScanParams::Channel GetCurrentChannel(uint8_t linkId) const
Get the current primary20 channel used on the given link as a (channel number, PHY band) pair.
uint16_t GetAssociationId() const
Return the association ID.
void TryToEnsureAssociated()
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
void ReceiveAssocResp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the (Re)Association Response frame received on the given link.
void RestartBeaconWatchdog(Time delay, uint8_t linkId)
Restarts the beacon timer for the given link.
std::variant< MgtAssocRequestHeader, MgtReassocRequestHeader > GetAssociationRequest(bool isReassoc, uint8_t linkId) const
Get the (Re)Association Request frame to send on a given link.
static TypeId GetTypeId()
Get the type ID.
Definition: sta-wifi-mac.cc:52
void DoDispose() override
Destructor implementation.
StaLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
uint32_t m_maxMissedBeacons
maximum missed beacons
Definition: sta-wifi-mac.h:480
TracedCallback< uint8_t, Mac48Address > m_setupCompleted
link setup completed logger
Definition: sta-wifi-mac.h:486
TracedCallback< Mac48Address > m_assocLogger
association logger
Definition: sta-wifi-mac.h:485
void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys) override
void Disassociated(uint8_t linkId)
Check if any enabled link remains after the given link is disabled (because, e.g.,...
SupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
TracedCallback< uint8_t, Mac48Address > m_setupCanceled
link setup canceled logger
Definition: sta-wifi-mac.h:488
bool CheckSupportedRates(std::variant< MgtBeaconHeader, MgtProbeResponseHeader > frame, uint8_t linkId)
Determine whether the supported rates indicated in a given Beacon frame or Probe Response frame fit w...
void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId) override
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Ptr< RandomVariableStream > m_probeDelay
RandomVariable used to randomize the time of the first Probe Response on each channel.
Definition: sta-wifi-mac.h:482
TracedCallback< ApInfo > m_beaconInfo
beacon info logger
Definition: sta-wifi-mac.h:490
uint16_t m_aid
Association AID.
Definition: sta-wifi-mac.h:474
MacState m_state
MAC state.
Definition: sta-wifi-mac.h:473
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
void SetMuEdcaParameters(AcIndex ac, uint16_t cwMin, uint16_t cwMax, uint8_t aifsn, Time muEdcaTimer)
Set the MU EDCA parameters.
void StartScanning()
Start the scanning process which trigger active or passive scanning based on the active probing flag.
TracedCallback< Time > m_beaconArrival
beacon arrival logger
Definition: sta-wifi-mac.h:489
void AssocRequestTimeout()
This method is called after the association timeout occurred.
void UpdateApInfo(const MgtFrameType &frame, const Mac48Address &apAddr, const Mac48Address &bssid, uint8_t linkId)
Update associated AP's information from the given management frame (Beacon, Probe Response or Associa...
void SendProbeRequest()
Forward a probe request packet to the DCF.
Time m_assocRequestTimeout
association request timeout
Definition: sta-wifi-mac.h:478
void ReceiveBeacon(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Beacon frame received on the given link.
Time m_probeRequestTimeout
probe request timeout
Definition: sta-wifi-mac.h:477
void SetActiveProbing(bool enable)
Enable or disable active probing.
CapabilityInformation GetCapabilities(uint8_t linkId) const
Return the Capability information for the given link.
bool IsAssociated() const
Return whether we are associated with an AP.
~StaWifiMac() override
std::variant< MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader > MgtFrameType
type of the management frames used to get info about APs
Definition: sta-wifi-mac.h:133
bool IsWaitAssocResp() const
Return whether we are waiting for an association response from an AP.
MultiLinkElement GetMultiLinkElement(bool isReassoc, uint8_t linkId) const
Return the Multi-Link Element to include in the management frames transmitted on the given link.
EventId m_assocRequestEvent
association request event
Definition: sta-wifi-mac.h:479
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
bool IsSuccess() const
Return whether the status code is success.
Definition: status-code.cc:42
Hold variables of type string.
Definition: string.h:42
The Supported Rates Information Element.
void AddBssMembershipSelectorRate(uint64_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
bool IsBssMembershipSelectorRate(uint64_t bs) const
Check if the given rate is a BSS membership selector value.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
AttributeValue implementation for Time.
Definition: nstime.h:1425
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:256
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: txop.cc:376
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:353
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:227
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:505
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
Hold an unsigned integer type.
Definition: uinteger.h:45
Implements the IEEE 802.11 MAC header.
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.
bool IsQosAmsdu() const
Check if the A-MSDU present bit is set in the QoS control field.
Mac48Address GetAddr3() const
Return the address in the Address 3 field.
bool IsBeacon() const
Return true if the header is a Beacon header.
bool IsAssocResp() const
Return true if the header is an Association Response header.
Mac48Address GetAddr1() const
Return the address in the Address 1 field.
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
WifiMacType GetType() const
Return the type (enum WifiMacType)
bool IsCtl() const
Return true if the Type is Control.
void SetNoOrder()
Unset order bit in the frame control field.
void SetDsNotFrom()
Un-set the From DS bit in the Frame Control field.
bool IsProbeResp() const
Return true if the header is a Probe Response header.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetQosNoAmsdu()
Set that A-MSDU is not present.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Mac48Address GetAddr2() const
Return the address in the Address 2 field.
bool HasData() const
Return true if the header type is DATA and is not DATA_NULL.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
bool IsData() const
Return true if the Type is DATA.
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
bool IsReassocResp() const
Return true if the header is a Reassociation Response header.
void SetDsTo()
Set the To DS bit in the Frame Control field.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
bool IsQosData() const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
void SetDsNotTo()
Un-set the To DS bit in the Frame Control field.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:92
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Definition: wifi-mac.cc:835
Ptr< QosTxop > GetBEQueue() const
Accessor for the AC_BE channel access function.
Definition: wifi-mac.cc:523
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
Definition: wifi-mac.cc:555
Mac48Address GetBssid(uint8_t linkId) const
Definition: wifi-mac.cc:468
Ptr< HeConfiguration > GetHeConfiguration() const
Definition: wifi-mac.cc:1250
Ptr< Txop > GetTxop() const
Accessor for the Txop object.
Definition: wifi-mac.cc:483
VhtCapabilities GetVhtCapabilities(uint8_t linkId) const
Return the VHT capabilities of the device for the given link.
Definition: wifi-mac.cc:1435
Callback< void > m_linkDown
Callback when a link is down.
Definition: wifi-mac.h:644
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1011
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
Definition: wifi-mac.cc:901
Ssid GetSsid() const
Definition: wifi-mac.cc:455
bool GetErpSupported(uint8_t linkId) const
Return whether the device supports ERP on the given link.
Definition: wifi-mac.cc:1017
bool GetHtSupported() const
Return whether the device supports HT.
Definition: wifi-mac.cc:1262
Ptr< QosTxop > GetVOQueue() const
Accessor for the AC_VO channel access function.
Definition: wifi-mac.cc:511
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:410
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:949
bool GetEhtSupported() const
Return whether the device supports EHT.
Definition: wifi-mac.cc:1281
bool GetHeSupported() const
Return whether the device supports HE.
Definition: wifi-mac.cc:1275
HtCapabilities GetHtCapabilities(uint8_t linkId) const
Return the HT capabilities of the device for the given link.
Definition: wifi-mac.cc:1378
bool GetVhtSupported(uint8_t linkId) const
Return whether the device supports VHT on the given link.
Definition: wifi-mac.cc:1268
virtual void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
Definition: wifi-mac.cc:1226
void SetBssid(Mac48Address bssid, uint8_t linkId)
Definition: wifi-mac.cc:461
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
Definition: wifi-mac.cc:1367
bool GetShortSlotTimeSupported() const
Definition: wifi-mac.cc:1061
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:594
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:881
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1105
virtual void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: wifi-mac.cc:1112
Mac48Address GetAddress() const
Definition: wifi-mac.cc:442
EhtCapabilities GetEhtCapabilities(uint8_t linkId) const
Return the EHT capabilities of the device for the given link.
Definition: wifi-mac.cc:1572
Callback< void > m_linkUp
Callback when a link is up.
Definition: wifi-mac.h:643
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:893
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
Definition: wifi-mac.cc:1516
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
Definition: wifi-mac.cc:920
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:489
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:576
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:368
Time GetDelayUntilIdle()
Definition: wifi-phy.cc:1980
std::list< uint8_t > GetBssMembershipSelectorList() const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Definition: wifi-phy.cc:1243
void SetSlot(Time slot)
Set the slot duration for this PHY.
Definition: wifi-phy.cc:734
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:950
void SetOffMode()
Put in off mode.
Definition: wifi-phy.cc:1292
bool HasFixedPhyBand() const
Definition: wifi-phy.cc:998
void ResumeFromOff()
Resume from off mode.
Definition: wifi-phy.cc:1335
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1847
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
std::optional< Mac48Address > GetAffiliatedStaAddress(const Mac48Address &mldAddress) const
Get the address of the remote station operating on this link and affiliated with the MLD having the g...
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the supported MCS by a destination.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtCapabilities)
Records VHT capabilities of the remote station.
void SetShortPreambleEnabled(bool enable)
Enable or disable short PHY preambles.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
void AddStationEhtCapabilities(Mac48Address from, EhtCapabilities ehtCapabilities)
Records EHT capabilities of the remote station.
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &address) const
Get the address of the MLD the given station is affiliated with, if any.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:230
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1426
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#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_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_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a QoS tag is attached to the packet, returns a value < 8.
Definition: qos-utils.cc:158
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
Definition: wifi-phy-band.h:43
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ AC_BE
Best Effort.
Definition: qos-utils.h:76
@ AC_VO
Voice.
Definition: qos-utils.h:82
@ AC_VI
Video.
Definition: qos-utils.h:80
@ AC_BK
Background.
Definition: qos-utils.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ STA
Definition: wifi-mac.h:60
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:691
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition: wifi-utils.h:140
@ WIFI_MAC_MGT_PROBE_REQUEST
@ WIFI_MAC_MGT_BEACON
@ WIFI_MAC_MGT_ASSOCIATION_RESPONSE
@ WIFI_MAC_MGT_ASSOCIATION_REQUEST
@ WIFI_MAC_MGT_REASSOCIATION_REQUEST
@ WIFI_MAC_MGT_PROBE_RESPONSE
@ WIFI_MAC_DATA
@ WIFI_MAC_MGT_REASSOCIATION_RESPONSE
@ WIFI_MAC_QOSDATA
value
Definition: second.py:41
channel
Definition: third.py:81
phy
Definition: third.py:82
Struct to hold information regarding observed AP through active/passive scanning.
Definition: sta-wifi-mac.h:140
MgtFrameType m_frame
The body of the management frame used to update AP info.
Definition: sta-wifi-mac.h:144
WifiScanParams::Channel m_channel
The channel the management frame was received on.
Definition: sta-wifi-mac.h:145
Mac48Address m_apAddr
AP MAC address.
Definition: sta-wifi-mac.h:142
uint8_t m_linkId
ID of the link used to communicate with the AP.
Definition: sta-wifi-mac.h:146
Mac48Address m_bssid
BSSID.
Definition: sta-wifi-mac.h:141
double m_snr
SNR in linear scale.
Definition: sta-wifi-mac.h:143
Struct identifying a channel to scan.
Definition: sta-wifi-mac.h:56
WifiPhyBand band
PHY band.
Definition: sta-wifi-mac.h:58
uint16_t number
channel number
Definition: sta-wifi-mac.h:57
Structure holding scan parameters.
Definition: sta-wifi-mac.h:48
std::list< Channel > ChannelList
typedef for a list of channels
Definition: sta-wifi-mac.h:62
std::vector< ChannelList > channelList
list of channels to scan, for each link
Definition: sta-wifi-mac.h:71
Time probeDelay
delay prior to transmitting a Probe Request
Definition: sta-wifi-mac.h:72
Time maxChannelTime
maximum time to spend on each channel
Definition: sta-wifi-mac.h:74
Ssid ssid
desired SSID or wildcard SSID
Definition: sta-wifi-mac.h:70
enum ns3::WifiScanParams::@75 type
indicates either active or passive scanning
Time minChannelTime
minimum time to spend on each channel
Definition: sta-wifi-mac.h:73