A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sta-wifi-mac.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006, 2009 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8 * Mirko Banchi <mk.banchi@gmail.com>
9 */
10
11#ifndef STA_WIFI_MAC_H
12#define STA_WIFI_MAC_H
13
14#include "wifi-mac.h"
15
16#include "ns3/eht-configuration.h"
17#include "ns3/wifi-export.h"
18
19#include <set>
20#include <variant>
21
24class ProbeExchTest;
25
26namespace ns3
27{
28
29class SupportedRates;
34class EmlsrManager;
35
36/**
37 * @ingroup wifi
38 *
39 * Type of association performed by this device (provided that it is supported by the standard
40 * configured for this device).
41 */
42enum class WifiAssocType : uint8_t
43{
44 LEGACY = 0,
46};
47
48/**
49 * @ingroup wifi
50 *
51 * Scan type (active or passive)
52 */
53enum class WifiScanType : uint8_t
54{
55 ACTIVE = 0,
57};
58
59/**
60 * @ingroup wifi
61 *
62 * Structure holding scan parameters
63 */
64struct WIFI_EXPORT WifiScanParams
65{
66 /**
67 * Struct identifying a channel to scan.
68 * A channel number equal to zero indicates to scan all the channels;
69 * an unspecified band (WIFI_PHY_BAND_UNSPECIFIED) indicates to scan
70 * all the supported PHY bands.
71 */
72 struct WIFI_EXPORT Channel
73 {
74 uint16_t number{0}; ///< channel number
76 };
77
78 /// typedef for a list of channels
79 using ChannelList = std::list<Channel>;
80
81 WifiScanType type; ///< indicates either active or passive scanning
82 Ssid ssid; ///< desired SSID or wildcard SSID
83 std::map<uint8_t, ChannelList> channelList; ///< list of channels to scan, for each PHY ID
84 Time probeDelay; ///< delay prior to transmitting a Probe Request
85 Time minChannelTime; ///< minimum time to spend on each channel
86 Time maxChannelTime; ///< maximum time to spend on each channel
87};
88
89/**
90 * @ingroup wifi
91 *
92 * Enumeration for power management modes
93 */
101
102/**
103 * @ingroup wifi
104 *
105 * The Wifi MAC high model for a non-AP STA in a BSS. The state
106 * machine is as follows:
107 *
108 @verbatim
109 ┌───────────┐ ┌────────────────┐ ┌─────────────┐
110 │ Start │ ┌─────┤ Associated ◄───────────────────┐ ┌──► Refused │
111 └─┬─────────┘ │ └────────────────┘ │ │ └─────────────┘
112 │ │ │ │
113 │ │ ┌─────────────────────────────────────┐ │ │
114 │ │ │ │ │ │
115 │ ┌─────────────▼─▼──┐ ┌──────────────┐ ┌───┴──▼────┴───────────────────┐
116 └──► Unassociated ├───────► Scanning ├───────► Wait Association Response │
117 └──────────────────┘ └──────┬──▲────┘ └───────────────┬──▲────────────┘
118 │ │ │ │
119 │ │ │ │
120 └──┘ └──┘
121 @endverbatim
122 *
123 * Notes:
124 * 1. The state 'Start' is not included in #MacState and only used
125 * for illustration purpose.
126 * 2. The Unassociated state is a transient state before STA starts the
127 * scanning procedure which moves it into the Scanning state.
128 * 3. In Scanning, STA is gathering beacon or probe response frames from APs,
129 * resulted in a list of candidate AP. After the timeout, it then tries to
130 * associate to the best AP, which is indicated by the Association Manager.
131 * STA will restart the scanning procedure if SetActiveProbing() called.
132 * 4. In the case when AP responded to STA's association request with a
133 * refusal, STA will try to associate to the next best AP until the list
134 * of candidate AP is exhausted which sends STA to Refused state.
135 * - Note that this behavior is not currently tested since ns-3 does not
136 * implement association refusal at present.
137 * 5. The transition from Wait Association Response to Unassociated
138 * occurs if an association request fails without explicit
139 * refusal (i.e., the AP fails to respond).
140 * 6. The transition from Associated to Wait Association Response
141 * occurs when STA's PHY capabilities changed. In this state, STA
142 * tries to reassociate with the previously associated AP.
143 * 7. The transition from Associated to Unassociated occurs if the number
144 * of missed beacons exceeds the threshold.
145 */
146class WIFI_EXPORT StaWifiMac : public WifiMac
147{
148 public:
149 /// Allow test cases to access private members
150 friend class ::AmpduAggregationTest;
151 friend class ::MultiLinkOperationsTestBase;
152 friend class ::ProbeExchTest;
154
155 /**
156 * Struct to hold information regarding observed AP through
157 * active/passive scanning
158 */
159 struct WIFI_EXPORT ApInfo
160 {
161 /**
162 * Information about links to setup
163 */
164 struct WIFI_EXPORT SetupLinksInfo
165 {
166 uint8_t localLinkId; ///< local link ID
167 uint8_t apLinkId; ///< AP link ID
168 Mac48Address bssid; ///< BSSID
169 };
170
172 Mac48Address m_apAddr; ///< AP MAC address
173 double m_snr; ///< SNR in linear scale
174 MgtResponseFrameType m_frame; ///< The body of the management frame used to update AP info
175 WifiScanParams::Channel m_channel; ///< The channel the management frame was received on
176 uint8_t m_linkId; ///< ID of the link used to communicate with the AP
177 std::list<SetupLinksInfo>
178 m_setupLinks; ///< information about the links to setup between MLDs
179 };
180
181 /**
182 * @brief Get the type ID.
183 * @return the object TypeId
184 */
185 static TypeId GetTypeId();
186
187 StaWifiMac();
188 ~StaWifiMac() override;
189
190 bool CanForwardPacketsTo(Mac48Address to) const override;
191 int64_t AssignStreams(int64_t stream) override;
192
193 /**
194 * @param phys the physical layers attached to this MAC.
195 */
196 void SetWifiPhys(const std::vector<Ptr<WifiPhy>>& phys) override;
197
198 /**
199 * Set the Association Manager.
200 *
201 * @param assocManager the Association Manager
202 */
203 void SetAssocManager(Ptr<WifiAssocManager> assocManager);
204
205 /**
206 * @return the Association Manager
207 */
209
210 /**
211 * Set the Power Save Manager.
212 *
213 * @param powerSaveManager the Power Save Manager
214 */
215 void SetPowerSaveManager(Ptr<PowerSaveManager> powerSaveManager);
216
217 /**
218 * @return the Power Save Manager
219 */
221
222 /**
223 * Set the EMLSR Manager.
224 *
225 * @param emlsrManager the EMLSR Manager
226 */
227 void SetEmlsrManager(Ptr<EmlsrManager> emlsrManager);
228
229 /**
230 * @return the EMLSR Manager
231 */
233
234 /**
235 * Get the frame body of the Probe Request to transmit on the given link.
236 *
237 * @param linkId the ID of the given link
238 * @return the Probe Request frame body
239 */
240 MgtProbeRequestHeader GetProbeRequest(uint8_t linkId) const;
241
242 /**
243 * Get the frame body of the Multi-Link Probe Request to transmit on the given link.
244 *
245 * @param linkId the ID of the given link
246 * @param apLinkIds ID of the links on which the requested APs, affiliated with the
247 * AP MLD, operate
248 * @param apMldId the AP MLD ID to include in the Common Info field
249 * @return the Multi-Link Probe Request frame body
250 */
252 const std::vector<uint8_t>& apLinkIds,
253 std::optional<uint8_t> apMldId) const;
254
255 /**
256 * Enqueue the given probe request packet for transmission on the given link.
257 *
258 * @param probeReq the given Probe Request frame body
259 * @param linkId the ID of the given link
260 * @param addr1 the MAC address for the Address1 field
261 * @param addr3 the MAC address for the Address3 field
262 */
263 void EnqueueProbeRequest(const MgtProbeRequestHeader& probeReq,
264 uint8_t linkId,
267
268 /**
269 * This method is called after wait beacon timeout or wait probe request timeout has
270 * occurred. This will trigger association process from beacons or probe responses
271 * gathered while scanning.
272 *
273 * @param bestAp the info about the best AP to associate with, if one was found
274 */
275 void ScanningTimeout(const std::optional<ApInfo>& bestAp);
276
277 /**
278 * Return whether we are associated with an AP.
279 *
280 * @return true if we are associated with an AP, false otherwise
281 */
282 bool IsAssociated() const;
283
284 /**
285 * Get the IDs of the setup links (if any).
286 *
287 * @return the IDs of the setup links
288 */
289 std::set<uint8_t> GetSetupLinkIds() const;
290
291 /**
292 * Return the association ID.
293 *
294 * @return the association ID
295 */
296 uint16_t GetAssociationId() const;
297
298 /// @return the type of association procedure performed by this device
300
301 /**
302 * Enable or disable Power Save mode on the given link.
303 *
304 * @param enableLinkIdPair a pair indicating whether to enable or not power save mode on
305 * the link with the given ID
306 */
307 void SetPowerSaveMode(const std::pair<bool, uint8_t>& enableLinkIdPair);
308
309 /**
310 * @param linkId the ID of the given link
311 * @return the current Power Management mode of the STA operating on the given link
312 */
313 WifiPowerManagementMode GetPmMode(uint8_t linkId) const;
314
315 /**
316 * Set the Power Management mode of the setup links after association.
317 *
318 * @param linkId the ID of the link used to establish association
319 */
320 void SetPmModeAfterAssociation(uint8_t linkId);
321
322 /**
323 * Enqueue a PS-Poll frame to be sent on the given link.
324 *
325 * @param linkId the ID of the link on which the PS-Poll frame must be sent
326 */
327 void EnqueuePsPoll(uint8_t linkId);
328
329 /**
330 * Notify the reception of a frame in response to a PS-Poll frame on the given link.
331 *
332 * @param mpdu the received MPDU
333 * @param linkId the ID of the given link
334 */
335 void NotifyReceivedFrameAfterPsPoll(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
336
337 /**
338 * Notify that the MPDU we sent was successfully received by the receiver
339 * (i.e. we received an Ack from the receiver).
340 *
341 * @param mpdu the MPDU that we successfully sent
342 */
343 void TxOk(Ptr<const WifiMpdu> mpdu);
344
345 void NotifyChannelSwitching(uint8_t linkId) override;
346 void NotifyRequestAccess(Ptr<Txop> txop, uint8_t linkId) override;
347 void NotifyChannelReleased(Ptr<Txop> txop, uint8_t linkId) override;
348
349 /**
350 * Notify the MAC that EMLSR mode has changed on the given set of links.
351 *
352 * @param txLinkId the ID of the link on which the EML OMN frame was sent by the EMLSR client
353 * @param linkIds the IDs of the links that are now EMLSR links (EMLSR mode is disabled
354 * on other links)
355 */
356 void NotifyEmlsrModeChanged(uint8_t txLinkId, const std::set<uint8_t>& linkIds);
357
358 /**
359 * @param linkId the ID of the given link
360 * @return whether the EMLSR mode is enabled on the given link
361 */
362 bool IsEmlsrLink(uint8_t linkId) const;
363
364 /**
365 * Notify that the given PHY switched channel to operate on another EMLSR link.
366 *
367 * @param phy the given PHY
368 * @param linkId the ID of the EMLSR link on which the given PHY operates after
369 * the channel switch
370 * @param delay the delay after which the channel switch will be completed
371 */
372 void NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId, Time delay);
373
374 /**
375 * Cancel any scheduled event for connecting the given PHY to an EMLSR link.
376 *
377 * @param phyId the ID of the given PHY
378 */
379 void CancelEmlsrPhyConnectEvent(uint8_t phyId);
380
381 /**
382 * Block transmissions on the given link for the given reason.
383 *
384 * @param linkId the ID of the given link
385 * @param reason the reason for blocking transmissions on the given link
386 */
387 void BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason);
388
389 /**
390 * Unblock transmissions on the given links for the given reason.
391 *
392 * @param linkIds the IDs of the given links
393 * @param reason the reason for unblocking transmissions on the given links
394 */
395 void UnblockTxOnLink(std::set<uint8_t> linkIds, WifiQueueBlockedReason reason);
396
397 /**
398 * Force the STA to disassociate from the current AP. This will trigger a new scanning
399 * procedure, which is started immediately, if the AP is not notified, or when the AP
400 * acknowledges the disassociation frame or the disassociation timer expires, whichever
401 * occurs first, otherwise.
402 *
403 * @param notifyAp whether the AP must be notified by sending a Disassociation frame
404 */
405 void ForceDisassociation(bool notifyAp);
406
407 protected:
408 /**
409 * Structure holding information specific to a single link. Here, the meaning of
410 * "link" is that of the 11be amendment which introduced multi-link devices. For
411 * previous amendments, only one link can be created.
412 */
413 struct WIFI_EXPORT StaLinkEntity : public WifiMac::LinkEntity
414 {
415 /// Destructor (a virtual method is needed to make this struct polymorphic)
416 ~StaLinkEntity() override;
417
418 bool sendAssocReq; //!< whether this link is used to send the
419 //!< Association Request frame
420 std::optional<Mac48Address> bssid; //!< BSSID of the AP to associate with over this link
421 WifiPowerManagementMode pmMode{WIFI_PM_ACTIVE}; /**< the current PM mode, if the STA is
422 associated, or the PM mode to switch
423 to upon association, otherwise */
424 bool emlsrEnabled{false}; //!< whether EMLSR mode is enabled on this link
425 };
426
427 /**
428 * Get a reference to the link associated with the given ID.
429 *
430 * @param linkId the given link ID
431 * @return a reference to the link associated with the given ID
432 */
433 StaLinkEntity& GetLink(uint8_t linkId) const;
434
435 /**
436 * Cast the given LinkEntity object to StaLinkEntity.
437 *
438 * @param link the given LinkEntity object
439 * @return a reference to the object casted to StaLinkEntity
440 */
441 StaLinkEntity& GetStaLink(const std::unique_ptr<WifiMac::LinkEntity>& link) const;
442
443 public:
444 /**
445 * The current MAC state of the STA.
446 */
455
456 private:
457 void DoCompleteConfig() override;
458
459 /**
460 * Enable or disable active probing.
461 *
462 * @param enable enable or disable active probing
463 */
464 void SetActiveProbing(bool enable);
465 /**
466 * Return whether active probing is enabled.
467 *
468 * @return true if active probing is enabled, false otherwise
469 */
470 bool GetActiveProbing() const;
471
472 /**
473 * Determine whether the supported rates indicated in a given Beacon frame or
474 * Probe Response frame fit with the configured membership selector.
475 *
476 * @param frame the given Beacon or Probe Response frame
477 * @param linkId ID of the link the mgt frame was received over
478 * @return whether the supported rates indicated in the given management
479 * frame fit with the configured membership selector
480 */
481 bool CheckSupportedRates(std::variant<MgtBeaconHeader, MgtProbeResponseHeader> frame,
482 uint8_t linkId);
483
484 void Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
485 std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
486 Mac48Address DoGetLocalAddress(const Mac48Address& remoteAddr) const override;
487 void Enqueue(Ptr<WifiMpdu> mpdu, Mac48Address to, Mac48Address from) override;
488 void NotifyDropPacketToEnqueue(Ptr<Packet> packet, Mac48Address to) override;
489
490 /**
491 * Process the Beacon frame received on the given link.
492 *
493 * @param mpdu the MPDU containing the Beacon frame
494 * @param linkId the ID of the given link
495 */
496 void ReceiveBeacon(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
497
498 /**
499 * Process the Probe Response frame received on the given link.
500 *
501 * @param mpdu the MPDU containing the Probe Response frame
502 * @param linkId the ID of the given link
503 */
504 void ReceiveProbeResp(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
505
506 /**
507 * Process the (Re)Association Response frame received on the given link.
508 *
509 * @param mpdu the MPDU containing the (Re)Association Response frame
510 * @param linkId the ID of the given link
511 */
512 void ReceiveAssocResp(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
513
514 /**
515 * Update operations information from the given management frame.
516 *
517 * @param frame the body of the given management frame
518 * @param addr MAC address of the sender
519 * @param linkId ID of the link the management frame was received over
520 */
521 void RecordOperations(const MgtResponseFrameType& frame,
522 const Mac48Address& addr,
523 linkId_t linkId);
524
525 /**
526 * Update operational settings based on associated AP's information provided by the given
527 * management frame (Beacon, Probe Response or Association Response).
528 *
529 * @param frame the body of the given management frame
530 * @param apAddr MAC address of the AP
531 * @param bssid MAC address of BSSID
532 * @param linkId ID of the link the management frame was received over
533 */
534 void ApplyOperationalSettings(const MgtResponseFrameType& frame,
535 const Mac48Address& apAddr,
536 const Mac48Address& bssid,
537 uint8_t linkId);
538
539 /**
540 * Get the (Re)Association Request frame to send on a given link. The returned frame
541 * never includes a Multi-Link Element.
542 *
543 * @param isReassoc whether a Reassociation Request has to be returned
544 * @param linkId the ID of the given link
545 * @return the (Re)Association Request frame
546 */
547 std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader> GetAssociationRequest(
548 bool isReassoc,
549 uint8_t linkId) const;
550
551 /**
552 * Forward an association or reassociation request packet to the DCF.
553 * The standard is not clear on the correct queue for management frames if QoS is supported.
554 * We always use the DCF.
555 *
556 * @param isReassoc flag whether it is a reassociation request
557 *
558 */
559 void SendAssociationRequest(bool isReassoc);
560 /**
561 * Try to ensure that we are associated with an AP by taking an appropriate action
562 * depending on the current association status.
563 */
564 void TryToEnsureAssociated();
565 /**
566 * This method is called after the association timeout occurred. We switch the state to
567 * WAIT_ASSOC_RESP and re-send an association request.
568 *
569 * @param isReassoc flag whether it is a reassociation request
570 */
571 void AssocRequestTimeout(bool isReassoc);
572 /**
573 * Start the scanning process which trigger active or passive scanning based on the
574 * active probing flag.
575 */
576 void StartScanning();
577 /**
578 * Return whether we are waiting for an association response from an AP.
579 *
580 * @return true if we are waiting for an association response from an AP, false otherwise
581 */
582 bool IsWaitAssocResp() const;
583
584 /**
585 * This method is called after we have not received a beacon from the AP on any link.
586 */
587 void MissedBeacons();
588 /**
589 * Restarts the beacon timer.
590 *
591 * @param delay the delay before the watchdog fires
592 */
593 void RestartBeaconWatchdog(Time delay);
594 /**
595 * Set the state to unassociated and try to associate again.
596 */
597 void Disassociated();
598
599 /**
600 * Update the Address 1 and Address 2 fields (if needed) of the queued frames upon association
601 * with an AP having the given address.
602 *
603 * @param apAddr the AP address
604 * @param isMldAddr whether the AP address is an MLD address
605 */
606 void UpdateQueuedFramesAddresses(Mac48Address apAddr, bool isMldAddr);
607
608 /**
609 * Return an instance of SupportedRates that contains all rates that we support
610 * including HT rates.
611 *
612 * @param linkId the ID of the link for which the request is made
613 * @return SupportedRates all rates that we support
614 */
615 AllSupportedRates GetSupportedRates(uint8_t linkId) const;
616 /**
617 * Return the Basic Multi-Link Element to include in the management frames transmitted
618 * on the given link
619 *
620 * @param isReassoc whether the Basic Multi-Link Element is included in a Reassociation Request
621 * @param linkId the ID of the given link
622 * @return the Basic Multi-Link Element
623 */
624 MultiLinkElement GetBasicMultiLinkElement(bool isReassoc, uint8_t linkId) const;
625
626 /**
627 * Return the Probe Request Multi-Link Element to include in the management frames to transmit.
628 *
629 * @param apLinkIds ID of the links on which the requested APs operate
630 * @param apMldId the AP MLD ID to include in the Common Info field
631 * @return the Probe Request Multi-Link Element
632 */
633 MultiLinkElement GetProbeReqMultiLinkElement(const std::vector<uint8_t>& apLinkIds,
634 std::optional<uint8_t> apMldId) const;
635
636 /**
637 * @param apNegSupport the negotiation type supported by the AP MLD
638 * @return the TID-to-Link Mapping element(s) to include in Association Request frame.
639 */
640 std::vector<TidToLinkMapping> GetTidToLinkMappingElements(
641 WifiTidToLinkMappingNegSupport apNegSupport);
642
643 /**
644 * Set the current MAC state.
645 *
646 * @param value the new state
647 */
648 void SetState(MacState value);
649
650 /**
651 * EDCA Parameters
652 */
653 struct WIFI_EXPORT EdcaParams
654 {
655 AcIndex ac; //!< the access category
656 uint32_t cwMin; //!< the minimum contention window size
657 uint32_t cwMax; //!< the maximum contention window size
658 uint8_t aifsn; //!< the number of slots that make up an AIFS
659 Time txopLimit; //!< the TXOP limit
660 };
661
662 /**
663 * Set the EDCA parameters for the given link.
664 *
665 * @param params the EDCA parameters
666 * @param linkId the ID of the given link
667 */
668 void SetEdcaParameters(const EdcaParams& params, uint8_t linkId);
669
670 /**
671 * MU EDCA Parameters
672 */
673 struct WIFI_EXPORT MuEdcaParams
674 {
675 AcIndex ac; //!< the access category
676 uint32_t cwMin; //!< the minimum contention window size
677 uint32_t cwMax; //!< the maximum contention window size
678 uint8_t aifsn; //!< the number of slots that make up an AIFS
679 Time muEdcaTimer; //!< the MU EDCA timer
680 };
681
682 /**
683 * Set the MU EDCA parameters for the given link.
684 *
685 * @param params the MU EDCA parameters
686 * @param linkId the ID of the given link
687 */
688 void SetMuEdcaParameters(const MuEdcaParams& params, uint8_t linkId);
689
690 /**
691 * Return the Capability information for the given link.
692 *
693 * @param linkId the ID of the given link
694 * @return the Capability information that we support
695 */
696 CapabilityInformation GetCapabilities(uint8_t linkId) const;
697
698 /**
699 * Indicate that PHY capabilities have changed.
700 */
702
703 /**
704 * Get the current primary20 channel used on the given link as a
705 * (channel number, PHY band) pair.
706 *
707 * @param linkId the ID of the given link
708 * @return a (channel number, PHY band) pair
709 */
710 WifiScanParams::Channel GetCurrentChannel(uint8_t linkId) const;
711
712 void DoInitialize() override;
713 void DoDispose() override;
714
715 MacState m_state; ///< MAC state
716 uint16_t m_aid; ///< Association AID
717 Ptr<WifiAssocManager> m_assocManager; ///< Association Manager
719 WifiAssocType m_assocType; ///< type of association
721 Time m_waitBeaconTimeout; ///< wait beacon timeout
722 Time m_probeRequestTimeout; ///< probe request timeout
723 Time m_assocRequestTimeout; ///< association request timeout
724 EventId m_assocRequestEvent; ///< association request event
725 Time m_disassocTimeout; ///< disassociation timeout
726 EventId m_disassocEvent; ///< disassociation event
727 uint32_t m_maxMissedBeacons; ///< maximum missed beacons
728 EventId m_beaconWatchdog; //!< beacon watchdog
729 Time m_beaconWatchdogEnd{0}; //!< beacon watchdog end
730 bool m_enableScanning; //!< enable channel scanning
731 bool m_activeProbing; ///< active probing
732 std::optional<Mac48Address> m_prevApAddr; ///< the address (MLD address for ML setup, link
733 ///< address for legacy association) of the AP
734 ///< this STA was previously associated with
735 Ptr<RandomVariableStream> m_probeDelay; ///< RandomVariable used to randomize the time
736 ///< of the first Probe Response on each channel
737 Time m_pmModeSwitchTimeout; ///< PM mode switch timeout
738 std::map<uint8_t, EventId> m_emlsrLinkSwitch; ///< maps PHY ID to the event scheduled to switch
739 ///< the corresponding PHY to a new EMLSR link
740
741 /// store the DL TID-to-Link Mapping included in the Association Request frame
743 /// store the UL TID-to-Link Mapping included in the Association Request frame
745
749 TracedCallback<Time> m_beaconArrival; ///< beacon arrival logger
750 TracedCallback<ApInfo> m_beaconInfo; ///< beacon info logger
752 m_emlsrLinkSwitchLogger; ///< EMLSR link switch logger
753
754 /// TracedCallback signature for link setup completed/canceled events
755 using LinkSetupCallback = void (*)(uint8_t /* link ID */, Mac48Address /* AP address */);
756
757 /// TracedCallback signature for EMLSR link switch events
758 using EmlsrLinkSwitchCallback = void (*)(uint8_t /* link ID */, Ptr<WifiPhy> /* PHY */);
759};
760
761/**
762 * @brief Stream insertion operator.
763 *
764 * @param os the output stream
765 * @param apInfo the AP information
766 * @returns a reference to the stream
767 */
768WIFI_EXPORT std::ostream& operator<<(std::ostream& os, const StaWifiMac::ApInfo& apInfo);
769
770/**
771 * @brief Stream insertion operator.
772 *
773 * @param os the output stream
774 * @param pmMode the power management mode
775 * @returns a reference to the stream
776 */
777WIFI_EXPORT std::ostream& operator<<(std::ostream& os, WifiPowerManagementMode pmMode);
778
779} // namespace ns3
780
781#endif /* STA_WIFI_MAC_H */
Ampdu Aggregation Test.
Probe Request-Probe Response exchange.
EmlsrManager is an abstract base class defining the API that EHT non-AP MLDs with EMLSR activated can...
An identifier for simulation events.
Definition event-id.h:45
an EUI-48 address
static Mac48Address GetBroadcast()
Implement the header for management frames of type probe request.
PowerSaveManager is an abstract base class.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
The basic uniform Random Number Generator (RNG).
The IEEE 802.11 SSID Information Element.
Definition ssid.h:27
std::set< uint8_t > GetSetupLinkIds() const
Get the IDs of the setup links (if any).
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
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
void SetPowerSaveMode(const std::pair< bool, uint8_t > &enableLinkIdPair)
Enable or disable Power Save mode on the given link.
Ptr< WifiAssocManager > m_assocManager
Association Manager.
bool m_activeProbing
active probing
void DoInitialize() override
Initialize() implementation.
void SetAssocManager(Ptr< WifiAssocManager > assocManager)
Set the Association Manager.
void NotifyEmlsrModeChanged(uint8_t txLinkId, const std::set< uint8_t > &linkIds)
Notify the MAC that EMLSR mode has changed on the given set of links.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
Time m_beaconWatchdogEnd
beacon watchdog end
bool m_enableScanning
enable channel scanning
void SetEdcaParameters(const EdcaParams &params, uint8_t linkId)
Set the EDCA parameters for the given link.
void SetPowerSaveManager(Ptr< PowerSaveManager > powerSaveManager)
Set the Power Save Manager.
TracedCallback< Mac48Address > m_deAssocLogger
disassociation logger
MacState
The current MAC state of the STA.
void NotifyChannelSwitching(uint8_t linkId) override
Notify that channel on the given link has been switched.
EventId m_beaconWatchdog
beacon watchdog
void PhyCapabilitiesChanged()
Indicate that PHY capabilities have changed.
WifiAssocType m_assocType
type of association
void SetPmModeAfterAssociation(uint8_t linkId)
Set the Power Management mode of the setup links after association.
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 ForceDisassociation(bool notifyAp)
Force the STA to disassociate from the current AP.
void NotifySwitchingEmlsrLink(Ptr< WifiPhy > phy, uint8_t linkId, Time delay)
Notify that the given PHY switched channel to operate on another EMLSR link.
std::optional< Mac48Address > m_prevApAddr
the address (MLD address for ML setup, link address for legacy association) of the AP this STA was pr...
static TypeId GetTypeId()
Get the type ID.
void CancelEmlsrPhyConnectEvent(uint8_t phyId)
Cancel any scheduled event for connecting the given PHY to an EMLSR link.
void(*)(uint8_t, Mac48Address) LinkSetupCallback
TracedCallback signature for link setup completed/canceled events.
void DoDispose() override
Destructor implementation.
void BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason)
Block transmissions on the given link for the given reason.
std::map< uint8_t, EventId > m_emlsrLinkSwitch
maps PHY ID to the event scheduled to switch the corresponding PHY to a new EMLSR link
Time m_disassocTimeout
disassociation timeout
uint32_t m_maxMissedBeacons
maximum missed beacons
TracedCallback< uint8_t, Mac48Address > m_setupCompleted
link setup completed logger
TracedCallback< Mac48Address > m_assocLogger
association logger
void NotifyChannelReleased(Ptr< Txop > txop, uint8_t linkId) override
Notify that the given TXOP has released the channel on the given link.
void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys) override
void SetMuEdcaParameters(const MuEdcaParams &params, uint8_t linkId)
Set the MU EDCA parameters for the given link.
friend class WifiStaticSetupHelper
void SetEmlsrManager(Ptr< EmlsrManager > emlsrManager)
Set the EMLSR Manager.
Ptr< PowerSaveManager > GetPowerSaveManager() const
Time m_pmModeSwitchTimeout
PM mode switch timeout.
Ptr< EmlsrManager > GetEmlsrManager() const
EventId m_disassocEvent
disassociation event
void TxOk(Ptr< const WifiMpdu > mpdu)
Notify that the MPDU we sent was successfully received by the receiver (i.e.
MgtProbeRequestHeader GetProbeRequest(uint8_t linkId) const
Get the frame body of the Probe Request to transmit on the given link.
void EnqueuePsPoll(uint8_t linkId)
Enqueue a PS-Poll frame to be sent on the given link.
MgtProbeRequestHeader GetMultiLinkProbeRequest(uint8_t linkId, const std::vector< uint8_t > &apLinkIds, std::optional< uint8_t > apMldId) const
Get the frame body of the Multi-Link Probe Request to transmit on the given link.
void NotifyReceivedFrameAfterPsPoll(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Notify the reception of a frame in response to a PS-Poll frame on the given link.
WifiTidLinkMapping m_ulTidLinkMappingInAssocReq
store the UL TID-to-Link Mapping included in the Association Request frame
Ptr< WifiAssocManager > GetAssocManager() const
WifiPowerManagementMode GetPmMode(uint8_t linkId) const
Ptr< RandomVariableStream > m_probeDelay
RandomVariable used to randomize the time of the first Probe Response on each channel.
TracedCallback< ApInfo > m_beaconInfo
beacon info logger
uint16_t m_aid
Association AID.
void(*)(uint8_t, Ptr< WifiPhy >) EmlsrLinkSwitchCallback
TracedCallback signature for EMLSR link switch events.
MacState m_state
MAC state.
bool IsEmlsrLink(uint8_t linkId) const
WifiAssocType GetAssocType() const
void NotifyRequestAccess(Ptr< Txop > txop, uint8_t linkId) override
Notify that the given TXOP is requesting channel access on the given link.
TracedCallback< Time > m_beaconArrival
beacon arrival logger
void UnblockTxOnLink(std::set< uint8_t > linkIds, WifiQueueBlockedReason reason)
Unblock transmissions on the given links for the given reason.
Ptr< EmlsrManager > m_emlsrManager
EMLSR Manager.
Time m_assocRequestTimeout
association request timeout
Time m_probeRequestTimeout
probe request timeout
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.
Ptr< PowerSaveManager > m_powerSaveManager
Power Save Manager.
EventId m_assocRequestEvent
association request event
void EnqueueProbeRequest(const MgtProbeRequestHeader &probeReq, uint8_t linkId, const Mac48Address &addr1=Mac48Address::GetBroadcast(), const Mac48Address &addr3=Mac48Address::GetBroadcast())
Enqueue the given probe request packet for transmission on the given link.
TracedCallback< uint8_t, Ptr< WifiPhy >, bool > m_emlsrLinkSwitchLogger
EMLSR link switch logger.
WifiTidLinkMapping m_dlTidLinkMappingInAssocReq
store the DL TID-to-Link Mapping included in the Association Request frame
The Supported Rates Information Element.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:50
Abstract base class for the Association Manager, which manages scanning and association for single li...
std::variant< MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader > MgtResponseFrameType
type of the management response frames
Definition wifi-mac.h:135
WifiScanType
Scan type (active or passive).
WifiPowerManagementMode
Enumeration for power management modes.
WifiPhyBand
Identifies the PHY band.
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
WifiAssocType
Type of association performed by this device (provided that it is supported by the standard configure...
@ WIFI_PM_SWITCHING_TO_ACTIVE
@ WIFI_PM_POWERSAVE
@ WIFI_PM_SWITCHING_TO_PS
@ WIFI_PM_ACTIVE
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiTidToLinkMappingNegSupport
TID-to-Link Mapping Negotiation Support.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::map< tid_t, std::set< linkId_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition wifi-utils.h:79
uint8_t linkId_t
IEEE 802.11be D7.0 Figure 9-207e—Link ID Info field format.
Definition wifi-utils.h:76
Struct containing all supported rates.
Struct to hold information regarding observed AP through active/passive scanning.
WifiScanParams::Channel m_channel
The channel the management frame was received on.
std::list< SetupLinksInfo > m_setupLinks
information about the links to setup between MLDs
MgtResponseFrameType m_frame
The body of the management frame used to update AP info.
Mac48Address m_apAddr
AP MAC address.
uint8_t m_linkId
ID of the link used to communicate with the AP.
Mac48Address m_bssid
BSSID.
double m_snr
SNR in linear scale.
uint32_t cwMax
the maximum contention window size
AcIndex ac
the access category
uint32_t cwMin
the minimum contention window size
uint8_t aifsn
the number of slots that make up an AIFS
Time txopLimit
the TXOP limit
Time muEdcaTimer
the MU EDCA timer
uint8_t aifsn
the number of slots that make up an AIFS
uint32_t cwMin
the minimum contention window size
AcIndex ac
the access category
uint32_t cwMax
the maximum contention window size
Struct identifying a channel to scan.
WifiPhyBand band
PHY band.
uint16_t number
channel number
Structure holding scan parameters.
std::list< Channel > ChannelList
typedef for a list of channels
Time probeDelay
delay prior to transmitting a Probe Request
WifiScanType type
indicates either active or passive scanning
Time maxChannelTime
maximum time to spend on each channel
Ssid ssid
desired SSID or wildcard SSID
std::map< uint8_t, ChannelList > channelList
list of channels to scan, for each PHY ID
Time minChannelTime
minimum time to spend on each channel