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