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
18#include <set>
19#include <variant>
20
23class ProbeExchTest;
24
25namespace ns3
26{
27
28class SupportedRates;
29class CapabilityInformation;
30class RandomVariableStream;
31class WifiAssocManager;
32class EmlsrManager;
33
34/**
35 * @ingroup wifi
36 *
37 * Type of association performed by this device (provided that it is supported by the standard
38 * configured for this device).
39 */
40enum class WifiAssocType : uint8_t
41{
42 LEGACY = 0,
44};
45
46/**
47 * @ingroup wifi
48 *
49 * Scan type (active or passive)
50 */
51enum class WifiScanType : uint8_t
52{
53 ACTIVE = 0,
55};
56
57/**
58 * @ingroup wifi
59 *
60 * Structure holding scan parameters
61 */
63{
64 /**
65 * Struct identifying a channel to scan.
66 * A channel number equal to zero indicates to scan all the channels;
67 * an unspecified band (WIFI_PHY_BAND_UNSPECIFIED) indicates to scan
68 * all the supported PHY bands.
69 */
70 struct Channel
71 {
72 uint16_t number{0}; ///< channel number
74 };
75
76 /// typedef for a list of channels
77 using ChannelList = std::list<Channel>;
78
79 WifiScanType type; ///< indicates either active or passive scanning
80 Ssid ssid; ///< desired SSID or wildcard SSID
81 std::vector<ChannelList> channelList; ///< list of channels to scan, for each link
82 Time probeDelay; ///< delay prior to transmitting a Probe Request
83 Time minChannelTime; ///< minimum time to spend on each channel
84 Time maxChannelTime; ///< maximum time to spend on each channel
85};
86
87/**
88 * @ingroup wifi
89 *
90 * Enumeration for power management modes
91 */
99
100/**
101 * @ingroup wifi
102 *
103 * The Wifi MAC high model for a non-AP STA in a BSS. The state
104 * machine is as follows:
105 *
106 \verbatim
107 ┌───────────┐ ┌────────────────┐ ┌─────────────┐
108 │ Start │ ┌─────┤ Associated ◄───────────────────┐ ┌──► Refused │
109 └─┬─────────┘ │ └────────────────┘ │ │ └─────────────┘
110 │ │ │ │
111 │ │ ┌─────────────────────────────────────┐ │ │
112 │ │ │ │ │ │
113 │ ┌─────────────▼─▼──┐ ┌──────────────┐ ┌───┴──▼────┴───────────────────┐
114 └──► Unassociated ├───────► Scanning ├───────► Wait Association Response │
115 └──────────────────┘ └──────┬──▲────┘ └───────────────┬──▲────────────┘
116 │ │ │ │
117 │ │ │ │
118 └──┘ └──┘
119 \endverbatim
120 *
121 * Notes:
122 * 1. The state 'Start' is not included in #MacState and only used
123 * for illustration purpose.
124 * 2. The Unassociated state is a transient state before STA starts the
125 * scanning procedure which moves it into the Scanning state.
126 * 3. In Scanning, STA is gathering beacon or probe response frames from APs,
127 * resulted in a list of candidate AP. After the timeout, it then tries to
128 * associate to the best AP, which is indicated by the Association Manager.
129 * STA will restart the scanning procedure if SetActiveProbing() called.
130 * 4. In the case when AP responded to STA's association request with a
131 * refusal, STA will try to associate to the next best AP until the list
132 * of candidate AP is exhausted which sends STA to Refused state.
133 * - Note that this behavior is not currently tested since ns-3 does not
134 * implement association refusal at present.
135 * 5. The transition from Wait Association Response to Unassociated
136 * occurs if an association request fails without explicit
137 * refusal (i.e., the AP fails to respond).
138 * 6. The transition from Associated to Wait Association Response
139 * occurs when STA's PHY capabilities changed. In this state, STA
140 * tries to reassociate with the previously associated AP.
141 * 7. The transition from Associated to Unassociated occurs if the number
142 * of missed beacons exceeds the threshold.
143 */
144class StaWifiMac : public WifiMac
145{
146 public:
147 /// Allow test cases to access private members
148 friend class ::AmpduAggregationTest;
149 friend class ::MultiLinkOperationsTestBase;
150 friend class ::ProbeExchTest;
151
152 /// type of the management frames used to get info about APs
154 std::variant<MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader>;
155
156 /**
157 * Struct to hold information regarding observed AP through
158 * active/passive scanning
159 */
160 struct ApInfo
161 {
162 /**
163 * Information about links to setup
164 */
166 {
167 uint8_t localLinkId; ///< local link ID
168 uint8_t apLinkId; ///< AP link ID
169 Mac48Address bssid; ///< BSSID
170 };
171
173 Mac48Address m_apAddr; ///< AP MAC address
174 double m_snr; ///< SNR in linear scale
175 MgtFrameType m_frame; ///< The body of the management frame used to update AP info
176 WifiScanParams::Channel m_channel; ///< The channel the management frame was received on
177 uint8_t m_linkId; ///< ID of the link used to communicate with the AP
178 std::list<SetupLinksInfo>
179 m_setupLinks; ///< information about the links to setup between MLDs
180 };
181
182 /**
183 * @brief Get the type ID.
184 * @return the object TypeId
185 */
186 static TypeId GetTypeId();
187
188 StaWifiMac();
189 ~StaWifiMac() override;
190
191 bool CanForwardPacketsTo(Mac48Address to) const override;
192 int64_t AssignStreams(int64_t stream) override;
193
194 /**
195 * @param phys the physical layers attached to this MAC.
196 */
197 void SetWifiPhys(const std::vector<Ptr<WifiPhy>>& phys) override;
198
199 /**
200 * Set the Association Manager.
201 *
202 * @param assocManager the Association Manager
203 */
204 void SetAssocManager(Ptr<WifiAssocManager> assocManager);
205
206 /**
207 * Set the EMLSR Manager.
208 *
209 * @param emlsrManager the EMLSR Manager
210 */
211 void SetEmlsrManager(Ptr<EmlsrManager> emlsrManager);
212
213 /**
214 * @return the EMLSR Manager
215 */
217
218 /**
219 * Get the frame body of the Probe Request to transmit on the given link.
220 *
221 * @param linkId the ID of the given link
222 * @return the Probe Request frame body
223 */
224 MgtProbeRequestHeader GetProbeRequest(uint8_t linkId) const;
225
226 /**
227 * Get the frame body of the Multi-Link Probe Request to transmit on the given link.
228 *
229 * @param linkId the ID of the given link
230 * @param apLinkIds ID of the links on which the requested APs, affiliated with the
231 * AP MLD, operate
232 * @param apMldId the AP MLD ID to include in the Common Info field
233 * @return the Multi-Link Probe Request frame body
234 */
236 const std::vector<uint8_t>& apLinkIds,
237 std::optional<uint8_t> apMldId) const;
238
239 /**
240 * Enqueue the given probe request packet for transmission on the given link.
241 *
242 * @param probeReq the given Probe Request frame body
243 * @param linkId the ID of the given link
244 * @param addr1 the MAC address for the Address1 field
245 * @param addr3 the MAC address for the Address3 field
246 */
247 void EnqueueProbeRequest(const MgtProbeRequestHeader& probeReq,
248 uint8_t linkId,
251
252 /**
253 * This method is called after wait beacon timeout or wait probe request timeout has
254 * occurred. This will trigger association process from beacons or probe responses
255 * gathered while scanning.
256 *
257 * @param bestAp the info about the best AP to associate with, if one was found
258 */
259 void ScanningTimeout(const std::optional<ApInfo>& bestAp);
260
261 /**
262 * Return whether we are associated with an AP.
263 *
264 * @return true if we are associated with an AP, false otherwise
265 */
266 bool IsAssociated() const;
267
268 /**
269 * Get the IDs of the setup links (if any).
270 *
271 * @return the IDs of the setup links
272 */
273 std::set<uint8_t> GetSetupLinkIds() const;
274
275 /**
276 * Return the association ID.
277 *
278 * @return the association ID
279 */
280 uint16_t GetAssociationId() const;
281
282 /// @return the type of association procedure performed by this device
284
285 /**
286 * Enable or disable Power Save mode on the given link.
287 *
288 * @param enableLinkIdPair a pair indicating whether to enable or not power save mode on
289 * the link with the given ID
290 */
291 void SetPowerSaveMode(const std::pair<bool, uint8_t>& enableLinkIdPair);
292
293 /**
294 * @param linkId the ID of the given link
295 * @return the current Power Management mode of the STA operating on the given link
296 */
297 WifiPowerManagementMode GetPmMode(uint8_t linkId) const;
298
299 /**
300 * Set the Power Management mode of the setup links after association.
301 *
302 * @param linkId the ID of the link used to establish association
303 */
304 void SetPmModeAfterAssociation(uint8_t linkId);
305
306 /**
307 * Notify that the MPDU we sent was successfully received by the receiver
308 * (i.e. we received an Ack from the receiver).
309 *
310 * @param mpdu the MPDU that we successfully sent
311 */
312 void TxOk(Ptr<const WifiMpdu> mpdu);
313
314 void NotifyChannelSwitching(uint8_t linkId) override;
315
316 /**
317 * Notify the MAC that EMLSR mode has changed on the given set of links.
318 *
319 * @param linkIds the IDs of the links that are now EMLSR links (EMLSR mode is disabled
320 * on other links)
321 */
322 void NotifyEmlsrModeChanged(const std::set<uint8_t>& linkIds);
323
324 /**
325 * @param linkId the ID of the given link
326 * @return whether the EMLSR mode is enabled on the given link
327 */
328 bool IsEmlsrLink(uint8_t linkId) const;
329
330 /**
331 * Notify that the given PHY switched channel to operate on another EMLSR link.
332 *
333 * @param phy the given PHY
334 * @param linkId the ID of the EMLSR link on which the given PHY is operating
335 * @param delay the delay after which the channel switch will be completed
336 */
337 void NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId, Time delay);
338
339 /**
340 * Cancel any scheduled event for connecting the given PHY to an EMLSR link.
341 *
342 * @param phyId the ID of the given PHY
343 */
344 void CancelEmlsrPhyConnectEvent(uint8_t phyId);
345
346 /**
347 * Block transmissions on the given link for the given reason.
348 *
349 * @param linkId the ID of the given link
350 * @param reason the reason for blocking transmissions on the given link
351 */
352 void BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason);
353
354 /**
355 * Unblock transmissions on the given links for the given reason.
356 *
357 * @param linkIds the IDs of the given links
358 * @param reason the reason for unblocking transmissions on the given links
359 */
360 void UnblockTxOnLink(std::set<uint8_t> linkIds, WifiQueueBlockedReason reason);
361
362 protected:
363 /**
364 * Structure holding information specific to a single link. Here, the meaning of
365 * "link" is that of the 11be amendment which introduced multi-link devices. For
366 * previous amendments, only one link can be created.
367 */
369 {
370 /// Destructor (a virtual method is needed to make this struct polymorphic)
371 ~StaLinkEntity() override;
372
373 bool sendAssocReq; //!< whether this link is used to send the
374 //!< Association Request frame
375 std::optional<Mac48Address> bssid; //!< BSSID of the AP to associate with over this link
376 WifiPowerManagementMode pmMode{WIFI_PM_ACTIVE}; /**< the current PM mode, if the STA is
377 associated, or the PM mode to switch
378 to upon association, otherwise */
379 bool emlsrEnabled{false}; //!< whether EMLSR mode is enabled on this link
380 };
381
382 /**
383 * Get a reference to the link associated with the given ID.
384 *
385 * @param linkId the given link ID
386 * @return a reference to the link associated with the given ID
387 */
388 StaLinkEntity& GetLink(uint8_t linkId) const;
389
390 /**
391 * Cast the given LinkEntity object to StaLinkEntity.
392 *
393 * @param link the given LinkEntity object
394 * @return a reference to the object casted to StaLinkEntity
395 */
396 StaLinkEntity& GetStaLink(const std::unique_ptr<WifiMac::LinkEntity>& link) const;
397
398 public:
399 /**
400 * The current MAC state of the STA.
401 */
410
411 private:
412 void DoCompleteConfig() override;
413
414 /**
415 * Enable or disable active probing.
416 *
417 * @param enable enable or disable active probing
418 */
419 void SetActiveProbing(bool enable);
420 /**
421 * Return whether active probing is enabled.
422 *
423 * @return true if active probing is enabled, false otherwise
424 */
425 bool GetActiveProbing() const;
426
427 /**
428 * Determine whether the supported rates indicated in a given Beacon frame or
429 * Probe Response frame fit with the configured membership selector.
430 *
431 * @param frame the given Beacon or Probe Response frame
432 * @param linkId ID of the link the mgt frame was received over
433 * @return whether the the supported rates indicated in the given management
434 * frame fit with the configured membership selector
435 */
436 bool CheckSupportedRates(std::variant<MgtBeaconHeader, MgtProbeResponseHeader> frame,
437 uint8_t linkId);
438
439 void Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
440 std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
441 Mac48Address DoGetLocalAddress(const Mac48Address& remoteAddr) const override;
442 void Enqueue(Ptr<WifiMpdu> mpdu, Mac48Address to, Mac48Address from) override;
443 void NotifyDropPacketToEnqueue(Ptr<Packet> packet, Mac48Address to) override;
444
445 /**
446 * Process the Beacon frame received on the given link.
447 *
448 * @param mpdu the MPDU containing the Beacon frame
449 * @param linkId the ID of the given link
450 */
451 void ReceiveBeacon(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
452
453 /**
454 * Process the Probe Response frame received on the given link.
455 *
456 * @param mpdu the MPDU containing the Probe Response frame
457 * @param linkId the ID of the given link
458 */
459 void ReceiveProbeResp(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
460
461 /**
462 * Process the (Re)Association Response frame received on the given link.
463 *
464 * @param mpdu the MPDU containing the (Re)Association Response frame
465 * @param linkId the ID of the given link
466 */
467 void ReceiveAssocResp(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
468
469 /**
470 * Update associated AP's information from the given management frame (Beacon,
471 * Probe Response or Association Response). If STA is not associated, this
472 * information will be used for the association process.
473 *
474 * @param frame the body of the given management frame
475 * @param apAddr MAC address of the AP
476 * @param bssid MAC address of BSSID
477 * @param linkId ID of the link the management frame was received over
478 */
479 void UpdateApInfo(const MgtFrameType& frame,
480 const Mac48Address& apAddr,
481 const Mac48Address& bssid,
482 uint8_t linkId);
483
484 /**
485 * Get the (Re)Association Request frame to send on a given link. The returned frame
486 * never includes a Multi-Link Element.
487 *
488 * @param isReassoc whether a Reassociation Request has to be returned
489 * @param linkId the ID of the given link
490 * @return the (Re)Association Request frame
491 */
492 std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader> GetAssociationRequest(
493 bool isReassoc,
494 uint8_t linkId) const;
495
496 /**
497 * Forward an association or reassociation request packet to the DCF.
498 * The standard is not clear on the correct queue for management frames if QoS is supported.
499 * We always use the DCF.
500 *
501 * @param isReassoc flag whether it is a reassociation request
502 *
503 */
504 void SendAssociationRequest(bool isReassoc);
505 /**
506 * Try to ensure that we are associated with an AP by taking an appropriate action
507 * depending on the current association status.
508 */
510 /**
511 * This method is called after the association timeout occurred. We switch the state to
512 * WAIT_ASSOC_RESP and re-send an association request.
513 */
514 void AssocRequestTimeout();
515 /**
516 * Start the scanning process which trigger active or passive scanning based on the
517 * active probing flag.
518 */
519 void StartScanning();
520 /**
521 * Return whether we are waiting for an association response from an AP.
522 *
523 * @return true if we are waiting for an association response from an AP, false otherwise
524 */
525 bool IsWaitAssocResp() const;
526
527 /**
528 * This method is called after we have not received a beacon from the AP on any link.
529 */
530 void MissedBeacons();
531 /**
532 * Restarts the beacon timer.
533 *
534 * @param delay the delay before the watchdog fires
535 */
536 void RestartBeaconWatchdog(Time delay);
537 /**
538 * Set the state to unassociated and try to associate again.
539 */
540 void Disassociated();
541 /**
542 * Return an instance of SupportedRates that contains all rates that we support
543 * including HT rates.
544 *
545 * @param linkId the ID of the link for which the request is made
546 * @return SupportedRates all rates that we support
547 */
548 AllSupportedRates GetSupportedRates(uint8_t linkId) const;
549 /**
550 * Return the Basic Multi-Link Element to include in the management frames transmitted
551 * on the given link
552 *
553 * @param isReassoc whether the Basic Multi-Link Element is included in a Reassociation Request
554 * @param linkId the ID of the given link
555 * @return the Basic Multi-Link Element
556 */
557 MultiLinkElement GetBasicMultiLinkElement(bool isReassoc, uint8_t linkId) const;
558
559 /**
560 * Return the Probe Request Multi-Link Element to include in the management frames to transmit.
561 *
562 * @param apLinkIds ID of the links on which the requested APs operate
563 * @param apMldId the AP MLD ID to include in the Common Info field
564 * @return the Probe Request Multi-Link Element
565 */
566 MultiLinkElement GetProbeReqMultiLinkElement(const std::vector<uint8_t>& apLinkIds,
567 std::optional<uint8_t> apMldId) const;
568
569 /**
570 * @param apNegSupport the negotiation type supported by the AP MLD
571 * @return the TID-to-Link Mapping element(s) to include in Association Request frame.
572 */
573 std::vector<TidToLinkMapping> GetTidToLinkMappingElements(
574 WifiTidToLinkMappingNegSupport apNegSupport);
575
576 /**
577 * Set the current MAC state.
578 *
579 * @param value the new state
580 */
581 void SetState(MacState value);
582
583 /**
584 * EDCA Parameters
585 */
587 {
588 AcIndex ac; //!< the access category
589 uint32_t cwMin; //!< the minimum contention window size
590 uint32_t cwMax; //!< the maximum contention window size
591 uint8_t aifsn; //!< the number of slots that make up an AIFS
592 Time txopLimit; //!< the TXOP limit
593 };
594
595 /**
596 * Set the EDCA parameters for the given link.
597 *
598 * @param params the EDCA parameters
599 * @param linkId the ID of the given link
600 */
601 void SetEdcaParameters(const EdcaParams& params, uint8_t linkId);
602
603 /**
604 * MU EDCA Parameters
605 */
607 {
608 AcIndex ac; //!< the access category
609 uint32_t cwMin; //!< the minimum contention window size
610 uint32_t cwMax; //!< the maximum contention window size
611 uint8_t aifsn; //!< the number of slots that make up an AIFS
612 Time muEdcaTimer; //!< the MU EDCA timer
613 };
614
615 /**
616 * Set the MU EDCA parameters for the given link.
617 *
618 * @param params the MU EDCA parameters
619 * @param linkId the ID of the given link
620 */
621 void SetMuEdcaParameters(const MuEdcaParams& params, uint8_t linkId);
622
623 /**
624 * Return the Capability information for the given link.
625 *
626 * @param linkId the ID of the given link
627 * @return the Capability information that we support
628 */
629 CapabilityInformation GetCapabilities(uint8_t linkId) const;
630
631 /**
632 * Indicate that PHY capabilities have changed.
633 */
635
636 /**
637 * Get the current primary20 channel used on the given link as a
638 * (channel number, PHY band) pair.
639 *
640 * @param linkId the ID of the given link
641 * @return a (channel number, PHY band) pair
642 */
643 WifiScanParams::Channel GetCurrentChannel(uint8_t linkId) const;
644
645 void DoInitialize() override;
646 void DoDispose() override;
647
648 MacState m_state; ///< MAC state
649 uint16_t m_aid; ///< Association AID
650 Ptr<WifiAssocManager> m_assocManager; ///< Association Manager
651 WifiAssocType m_assocType; ///< type of association
653 Time m_waitBeaconTimeout; ///< wait beacon timeout
654 Time m_probeRequestTimeout; ///< probe request timeout
655 Time m_assocRequestTimeout; ///< association request timeout
656 EventId m_assocRequestEvent; ///< association request event
657 uint32_t m_maxMissedBeacons; ///< maximum missed beacons
658 EventId m_beaconWatchdog; //!< beacon watchdog
659 Time m_beaconWatchdogEnd{0}; //!< beacon watchdog end
660 bool m_activeProbing; ///< active probing
661 Ptr<RandomVariableStream> m_probeDelay; ///< RandomVariable used to randomize the time
662 ///< of the first Probe Response on each channel
663 Time m_pmModeSwitchTimeout; ///< PM mode switch timeout
664 std::map<uint8_t, EventId> m_emlsrLinkSwitch; ///< maps PHY ID to the event scheduled to switch
665 ///< the corresponding PHY to a new EMLSR link
666
667 /// store the DL TID-to-Link Mapping included in the Association Request frame
669 /// store the UL TID-to-Link Mapping included in the Association Request frame
671
675 TracedCallback<Time> m_beaconArrival; ///< beacon arrival logger
676 TracedCallback<ApInfo> m_beaconInfo; ///< beacon info logger
678
679 /// TracedCallback signature for link setup completed/canceled events
680 using LinkSetupCallback = void (*)(uint8_t /* link ID */, Mac48Address /* AP address */);
681
682 /// TracedCallback signature for EMLSR link switch events
683 using EmlsrLinkSwitchCallback = void (*)(uint8_t /* link ID */, Ptr<WifiPhy> /* PHY */);
684};
685
686/**
687 * @brief Stream insertion operator.
688 *
689 * @param os the output stream
690 * @param apInfo the AP information
691 * @returns a reference to the stream
692 */
693std::ostream& operator<<(std::ostream& os, const StaWifiMac::ApInfo& apInfo);
694
695} // namespace ns3
696
697#endif /* STA_WIFI_MAC_H */
Ampdu Aggregation Test.
Probe Request-Probe Response exchange.
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.
Smart pointer class similar to boost::intrusive_ptr.
The IEEE 802.11 SSID Information Element.
Definition ssid.h:25
The Wifi MAC high model for a non-AP STA in a BSS.
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.
void DoCompleteConfig() override
Allow subclasses to complete the configuration of the MAC layer components.
bool m_activeProbing
active probing
void DoInitialize() override
Initialize() implementation.
void SetAssocManager(Ptr< WifiAssocManager > assocManager)
Set the Association Manager.
TracedCallback< uint8_t, Ptr< WifiPhy > > m_emlsrLinkSwitchLogger
EMLSR link switch logger.
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 SetState(MacState value)
Set the current MAC state.
Time m_beaconWatchdogEnd
beacon watchdog end
AllSupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
void SetEdcaParameters(const EdcaParams &params, uint8_t linkId)
Set the EDCA parameters for the given link.
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.
bool GetActiveProbing() const
Return whether active probing is enabled.
EventId m_beaconWatchdog
beacon watchdog
void PhyCapabilitiesChanged()
Indicate that PHY capabilities have changed.
WifiAssocType m_assocType
type of association
StaLinkEntity & GetStaLink(const std::unique_ptr< WifiMac::LinkEntity > &link) const
Cast the given LinkEntity object to StaLinkEntity.
void ReceiveProbeResp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Probe Response frame received on the given link.
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 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 NotifySwitchingEmlsrLink(Ptr< WifiPhy > phy, uint8_t linkId, Time delay)
Notify that the given PHY switched channel to operate on another EMLSR 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.
MultiLinkElement GetBasicMultiLinkElement(bool isReassoc, uint8_t linkId) const
Return the Basic Multi-Link Element to include in the management frames transmitted on the given link...
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
StaLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
uint32_t m_maxMissedBeacons
maximum missed beacons
TracedCallback< uint8_t, Mac48Address > m_setupCompleted
link setup completed logger
TracedCallback< Mac48Address > m_assocLogger
association logger
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.
void NotifyEmlsrModeChanged(const std::set< uint8_t > &linkIds)
Notify the MAC that EMLSR mode has changed on the given set of links.
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...
Mac48Address DoGetLocalAddress(const Mac48Address &remoteAddr) const override
This method is called if this device is an MLD to determine the MAC address of the affiliated STA use...
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
void SetEmlsrManager(Ptr< EmlsrManager > emlsrManager)
Set the EMLSR Manager.
void NotifyDropPacketToEnqueue(Ptr< Packet > packet, Mac48Address to) override
Allow subclasses to take actions when a packet to enqueue has been dropped.
Time m_pmModeSwitchTimeout
PM mode switch timeout.
void Disassociated()
Set the state to unassociated and try to associate again.
Ptr< EmlsrManager > GetEmlsrManager() const
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.
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 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...
WifiTidLinkMapping m_ulTidLinkMappingInAssocReq
store the UL TID-to-Link Mapping included in the Association Request frame
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
void MissedBeacons()
This method is called after we have not received a beacon from the AP on any link.
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 StartScanning()
Start the scanning process which trigger active or passive scanning based on the active probing flag.
std::vector< TidToLinkMapping > GetTidToLinkMappingElements(WifiTidToLinkMappingNegSupport apNegSupport)
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.
void AssocRequestTimeout()
This method is called after the association timeout occurred.
void Enqueue(Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override
Ptr< EmlsrManager > m_emlsrManager
EMLSR Manager.
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...
Time m_assocRequestTimeout
association request timeout
void ReceiveBeacon(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Beacon frame received on the given link.
Time m_probeRequestTimeout
probe request timeout
void SetActiveProbing(bool enable)
Enable or disable active probing.
std::variant< MgtBeaconHeader, MgtProbeResponseHeader, MgtAssocResponseHeader > MgtFrameType
type of the management frames used to get info about APs
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
bool IsWaitAssocResp() const
Return whether we are waiting for an association response from an AP.
MultiLinkElement GetProbeReqMultiLinkElement(const std::vector< uint8_t > &apLinkIds, std::optional< uint8_t > apMldId) const
Return the Probe Request Multi-Link Element to include in the management frames to transmit.
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.
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
WifiTidLinkMapping m_dlTidLinkMappingInAssocReq
store the DL TID-to-Link Mapping included in the Association Request frame
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:49
base class for all MAC-level wifi objects.
Definition wifi-mac.h:90
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:62
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< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition wifi-utils.h:67
Struct containing all supported rates.
Struct to hold information regarding observed AP through active/passive scanning.
MgtFrameType m_frame
The body of the management frame used to update AP info.
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
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
std::vector< ChannelList > channelList
list of channels to scan, for each link
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
Time minChannelTime
minimum time to spend on each channel