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