A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ap-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 AP_WIFI_MAC_H
12#define AP_WIFI_MAC_H
13
14#include "wifi-mac-header.h"
15#include "wifi-mac.h"
16
17#include "ns3/attribute-container.h"
18#include "ns3/enum.h"
19#include "ns3/pair.h"
20
21#include <unordered_map>
22#include <variant>
23
24namespace ns3
25{
26
27struct AllSupportedRates;
28class CapabilityInformation;
29class DsssParameterSet;
30class ErpInformation;
31class EdcaParameterSet;
32class MuEdcaParameterSet;
33class ReducedNeighborReport;
34class MultiLinkElement;
35class HtOperation;
36class VhtOperation;
37class HeOperation;
38class EhtOperation;
39class CfParameterSet;
40class UniformRandomVariable;
41class MgtAssocRequestHeader;
42class MgtReassocRequestHeader;
43class MgtAssocResponseHeader;
44class MgtEmlOmn;
45class ApEmlsrManager;
46
47/// variant holding a reference to a (Re)Association Request
48using AssocReqRefVariant = std::variant<std::reference_wrapper<MgtAssocRequestHeader>,
49 std::reference_wrapper<MgtReassocRequestHeader>>;
50
51/**
52 * \brief Wi-Fi AP state machine
53 * \ingroup wifi
54 *
55 * Handle association, dis-association and authentication,
56 * of STAs within an infrastructure BSS. By default, beacons are
57 * sent with PIFS access, zero backoff, and are generated roughly
58 * every 102.4 ms by default (configurable by an attribute) and
59 * with some jitter to de-synchronize beacon transmissions in
60 * multi-BSS scenarios.
61 */
62class ApWifiMac : public WifiMac
63{
64 public:
65 /**
66 * \brief Get the type ID.
67 * \return the object TypeId
68 */
69 static TypeId GetTypeId();
70
71 ApWifiMac();
72 ~ApWifiMac() override;
73
74 void SetLinkUpCallback(Callback<void> linkUp) override;
75 bool CanForwardPacketsTo(Mac48Address to) const override;
76 bool SupportsSendFrom() const override;
77 Ptr<WifiMacQueue> GetTxopQueue(AcIndex ac) const override;
78 int64_t AssignStreams(int64_t stream) override;
79
80 /**
81 * Set the AP EMLSR Manager.
82 *
83 * \param apEmlsrManager the AP EMLSR Manager
84 */
85 void SetApEmlsrManager(Ptr<ApEmlsrManager> apEmlsrManager);
86
87 /**
88 * \return the AP EMLSR Manager
89 */
91
92 /**
93 * \param interval the interval between two beacon transmissions.
94 */
95 void SetBeaconInterval(Time interval);
96 /**
97 * \return the interval between two beacon transmissions.
98 */
99 Time GetBeaconInterval() const;
100
101 /**
102 * Get a const reference to the map of associated stations on the given link.
103 * Each station is specified by an (association ID, MAC address) pair. Make sure
104 * not to use the returned reference after that this object has been deallocated.
105 *
106 * \param linkId the ID of the given link
107 * \return a const reference to the map of associated stations
108 */
109 const std::map<uint16_t, Mac48Address>& GetStaList(uint8_t linkId) const;
110 /**
111 * \param addr the address of the associated station
112 * \param linkId the ID of the link on which the station is associated
113 * \return the Association ID allocated by the AP to the station, SU_STA_ID if unallocated
114 */
115 uint16_t GetAssociationId(Mac48Address addr, uint8_t linkId) const;
116
117 /**
118 * Get the ID of a link (if any) that has been setup with the station having the given MAC
119 * address. The address can be either a link address or an MLD address. In the former case,
120 * the returned ID is the ID of the link connecting the AP to the STA with the given address.
121 *
122 * \param address the given MAC address
123 * \return the ID of a link (if any) that has been setup with the given station
124 */
125 std::optional<uint8_t> IsAssociated(const Mac48Address& address) const;
126
127 /**
128 * \param aid the given AID
129 * \return the MLD address (in case of MLD) or link address (in case of single link device)
130 * of the STA having the given AID, if any
131 */
132 std::optional<Mac48Address> GetMldOrLinkAddressByAid(uint16_t aid) const;
133
134 /**
135 * Return the value of the Queue Size subfield of the last QoS Data or QoS Null
136 * frame received from the station with the given MAC address and belonging to
137 * the given TID.
138 *
139 * The Queue Size value is the total size, rounded up to the nearest multiple
140 * of 256 octets and expressed in units of 256 octets, of all MSDUs and A-MSDUs
141 * buffered at the STA (excluding the MSDU or A-MSDU of the present QoS Data frame).
142 * A queue size value of 254 is used for all sizes greater than 64 768 octets.
143 * A queue size value of 255 is used to indicate an unspecified or unknown size.
144 * See Section 9.2.4.5.6 of 802.11-2016
145 *
146 * \param tid the given TID
147 * \param address the given MAC address
148 * \return the value of the Queue Size subfield
149 */
150 uint8_t GetBufferStatus(uint8_t tid, Mac48Address address) const;
151 /**
152 * Store the value of the Queue Size subfield of the last QoS Data or QoS Null
153 * frame received from the station with the given MAC address and belonging to
154 * the given TID.
155 *
156 * \param tid the given TID
157 * \param address the given MAC address
158 * \param size the value of the Queue Size subfield
159 */
160 void SetBufferStatus(uint8_t tid, Mac48Address address, uint8_t size);
161 /**
162 * Return the maximum among the values of the Queue Size subfield of the last
163 * QoS Data or QoS Null frames received from the station with the given MAC address
164 * and belonging to any TID.
165 *
166 * \param address the given MAC address
167 * \return the maximum among the values of the Queue Size subfields
168 */
169 uint8_t GetMaxBufferStatus(Mac48Address address) const;
170
171 /// ACI-indexed map of access parameters of type unsigned integer (CWmin, CWmax and AIFSN)
172 using UintAccessParamsMap = std::map<AcIndex, std::vector<uint64_t>>;
173
174 /// ACI-indexed map of access parameters of type Time (TxopLimit)
175 using TimeAccessParamsMap = std::map<AcIndex, std::vector<Time>>;
176
177 /// AttributeValue type of a pair (ACI, access parameters of type unsigned integer)
180
181 /// AttributeValue type of a pair (ACI, access parameters of type Time)
184
185 /// AttributeValue type of an ACI-indexed map of access parameters of type unsigned integer
187
188 /// AttributeValue type of ACI-indexed map of access parameters of type Time
190
191 /**
192 * Get a checker for the CwMinsForSta, CwMaxsForSta and AifsnsForSta attributes, which can
193 * be used to deserialize an ACI-indexed map of access parameters of type unsigned integer
194 * (CWmin, CWmax and AIFSN) from a string:
195 *
196 * \code
197 * ApWifiMac::UintAccessParamsMapValue value;
198 * value.DeserializeFromString("BE 31,31; VO 15,15",
199 * ApWifiMac::GetUintAccessParamsChecker<uint32_t>());
200 * auto map = value.Get();
201 * \endcode
202 *
203 * The type of \p map is ApWifiMac::UintAccessParamsMapValue::result_type, which is
204 * std::list<std::pair<AcIndex, std::vector<uint64_t>>>.
205 *
206 * \tparam T \explicit the type of the unsigned integer access parameter
207 * \return a checker for the CwMinsForSta, CwMaxsForSta and AifsnsForSta attributes
208 */
209 template <class T>
211
212 /**
213 * Get a checker for the TxopLimitsForSta attribute, which can be used to deserialize an
214 * ACI-indexed map of access parameters of type Time (TxopLimit) from a string:
215 *
216 * \code
217 * ApWifiMac::TimeAccessParamsMapValue value;
218 * value.DeserializeFromString("BE 3200us; VO 3232us",
219 * ApWifiMac::GetTimeAccessParamsChecker());
220 * auto map = value.Get();
221 * \endcode
222 *
223 * The type of \p map is ApWifiMac::TimeAccessParamsMapValue::result_type, which is
224 * std::list<std::pair<AcIndex, std::vector<Time>>>.
225 *
226 * \return a checker for the TxopLimitsForSta attribute
227 */
229
230 protected:
231 /**
232 * Structure holding information specific to a single link. Here, the meaning of
233 * "link" is that of the 11be amendment which introduced multi-link devices. For
234 * previous amendments, only one link can be created.
235 */
237 {
238 /// Destructor (a virtual method is needed to make this struct polymorphic)
239 ~ApLinkEntity() override;
240
241 EventId beaconEvent; //!< Event to generate one beacon
242 std::map<uint16_t, Mac48Address> staList; //!< Map of all stations currently associated
243 //!< to the AP with their association ID
244 uint16_t numNonHtStations{0}; //!< Number of non-HT stations currently associated to the AP
246 0}; //!< Number of non-ERP stations currently associated to the AP
248 false}; //!< Flag whether short slot time is enabled within the BSS
249 bool shortPreambleEnabled{false}; //!< Flag whether short preamble is enabled in the BSS
250 };
251
252 /**
253 * Get a reference to the link associated with the given ID.
254 *
255 * \param linkId the given link ID
256 * \return a reference to the link associated with the given ID
257 */
258 ApLinkEntity& GetLink(uint8_t linkId) const;
259
260 std::map<uint16_t, Mac48Address>
261 m_aidToMldOrLinkAddress; //!< Maps AIDs to MLD addresses (for MLDs) or link addresses (in
262 //!< case of single link devices)
263
264 private:
265 std::unique_ptr<LinkEntity> CreateLinkEntity() const override;
266 Mac48Address DoGetLocalAddress(const Mac48Address& remoteAddr) const override;
267 void Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
268 void DoCompleteConfig() override;
269 void Enqueue(Ptr<WifiMpdu> mpdu, Mac48Address to, Mac48Address from) override;
270
271 /**
272 * Check whether the supported rate set included in the received (Re)Association
273 * Request frame is compatible with our Basic Rate Set. If so, record all the station's
274 * supported modes in its associated WifiRemoteStation and return true.
275 * Otherwise, return false.
276 *
277 * \param assoc the frame body of the received (Re)Association Request
278 * \param from the Transmitter Address field of the frame
279 * \param linkId the ID of the link on which the frame was received
280 * \return true if the (Re)Association request can be accepted, false otherwise
281 */
282 bool ReceiveAssocRequest(const AssocReqRefVariant& assoc,
283 const Mac48Address& from,
284 uint8_t linkId);
285
286 /**
287 * Given a (Re)Association Request frame body containing a Multi-Link Element,
288 * check if a link can be setup with each of the reported stations (STA MAC address
289 * and a (Re)Association Request frame body must be present, the Link ID identifies
290 * a valid link other than the one the frame was received on and the supported
291 * rates are compatible with our basic rate set).
292 *
293 * \param assoc the frame body of the received (Re)Association Request
294 * \param from the Transmitter Address field of the frame
295 * \param linkId the ID of the link on which the frame was received
296 */
297 void ParseReportedStaInfo(const AssocReqRefVariant& assoc, Mac48Address from, uint8_t linkId);
298
299 /**
300 * Take necessary actions upon receiving the given EML Operating Mode Notification frame
301 * from the given station on the given link.
302 *
303 * \param frame the received EML Operating Mode Notification frame
304 * \param sender the MAC address of the sender of the frame
305 * \param linkId the ID of the link over which the frame was received
306 */
307 void ReceiveEmlOmn(MgtEmlOmn& frame, const Mac48Address& sender, uint8_t linkId);
308
309 /**
310 * The packet we sent was successfully received by the receiver
311 * (i.e. we received an Ack from the receiver). If the packet
312 * was an association response to the receiver, we record that
313 * the receiver is now associated with us.
314 *
315 * \param mpdu the MPDU that we successfully sent
316 */
317 void TxOk(Ptr<const WifiMpdu> mpdu);
318 /**
319 * The packet we sent was successfully received by the receiver
320 * (i.e. we did not receive an Ack from the receiver). If the packet
321 * was an association response to the receiver, we record that
322 * the receiver is not associated with us yet.
323 *
324 * \param timeoutReason the reason why the TX timer was started (\see WifiTxTimer::Reason)
325 * \param mpdu the MPDU that we failed to sent
326 */
327 void TxFailed(WifiMacDropReason timeoutReason, Ptr<const WifiMpdu> mpdu);
328
329 /**
330 * This method is called to de-aggregate an A-MSDU and forward the
331 * constituent packets up the stack. We override the WifiMac version
332 * here because, as an AP, we also need to think about redistributing
333 * to other associated STAs.
334 *
335 * \param mpdu the MPDU containing the A-MSDU.
336 */
338 /**
339 * Send a Probe Response in response to a Probe Request received from the STA with the
340 * given address on the given link.
341 *
342 * \param to the address of the STA we are sending a probe response to
343 * \param linkId the ID of the given link
344 */
345 void SendProbeResp(Mac48Address to, uint8_t linkId);
346 /**
347 * Get the Association Response frame to send on a given link. The returned frame
348 * never includes a Multi-Link Element.
349 *
350 * \param to the address of the STA we are sending an association response to
351 * \param linkId the ID of the given link
352 * \return the Association Response frame
353 */
355 /// Map of (link ID, remote STA address) of the links to setup
356 using LinkIdStaAddrMap = std::map<uint8_t, Mac48Address>;
357 /**
358 * Set the AID field of the given Association Response frame. In case of
359 * multi-link setup, the selected AID value must be assigned to all the STAs
360 * corresponding to the setup links. The AID value is selected among the AID
361 * values that are possibly already assigned to the STAs affiliated with the
362 * non-AP MLD we are associating with. If no STA has an assigned AID value,
363 * a new AID value is selected.
364 *
365 * \param assoc the given Association Response frame
366 * \param linkIdStaAddrMap a map of (link ID, remote STA address) of the links to setup
367 */
368 void SetAid(MgtAssocResponseHeader& assoc, const LinkIdStaAddrMap& linkIdStaAddrMap);
369 /**
370 * Get a map of (link ID, remote STA address) of the links to setup. Information
371 * is taken from the given Association Response that is sent over the given link
372 * to the given station.
373 *
374 * \param assoc the given Association Response frame
375 * \param to the Receiver Address (RA) of the Association Response frame
376 * \param linkId the ID of the link on which the Association Response frame is sent
377 * \return a map of (link ID, remote STA address) of the links to setup
378 */
380 const Mac48Address& to,
381 uint8_t linkId);
382 /**
383 * Forward an association or a reassociation response packet to the DCF/EDCA.
384 *
385 * \param to the address of the STA we are sending an association response to
386 * \param isReassoc indicates whether it is a reassociation response
387 * \param linkId the ID of the link on which the association response must be sent
388 */
389 void SendAssocResp(Mac48Address to, bool isReassoc, uint8_t linkId);
390 /**
391 * Forward a beacon packet to the beacon special DCF for transmission
392 * on the given link.
393 *
394 * \param linkId the ID of the given link
395 */
396 void SendOneBeacon(uint8_t linkId);
397
398 /**
399 * Get the FILS Discovery frame to send on the given link.
400 *
401 * \param linkId the ID of the given link
402 * \return the FILS Discovery frame to send on the given link
403 */
404 Ptr<WifiMpdu> GetFilsDiscovery(uint8_t linkId) const;
405
406 /**
407 * Schedule the transmission of FILS Discovery frames or unsolicited Probe Response frames
408 * on the given link
409 *
410 * \param linkId the ID of the given link
411 */
412 void ScheduleFilsDiscOrUnsolProbeRespFrames(uint8_t linkId);
413
414 /**
415 * Process the Power Management bit in the Frame Control field of an MPDU
416 * successfully received on the given link.
417 *
418 * \param mpdu the successfully received MPDU
419 * \param linkId the ID of the given link
420 */
421 void ProcessPowerManagementFlag(Ptr<const WifiMpdu> mpdu, uint8_t linkId);
422 /**
423 * Perform the necessary actions when a given station switches from active mode
424 * to powersave mode.
425 *
426 * \param staAddr the MAC address of the given station
427 * \param linkId the ID of the link on which the given station is operating
428 */
429 void StaSwitchingToPsMode(const Mac48Address& staAddr, uint8_t linkId);
430 /**
431 * Perform the necessary actions when a given station deassociates or switches
432 * from powersave mode to active mode.
433 *
434 * \param staAddr the MAC address of the given station
435 * \param linkId the ID of the link on which the given station is operating
436 */
437 void StaSwitchingToActiveModeOrDeassociated(const Mac48Address& staAddr, uint8_t linkId);
438
439 /**
440 * Return the Capability information of the current AP for the given link.
441 *
442 * \param linkId the ID of the given link
443 * \return the Capability information that we support
444 */
445 CapabilityInformation GetCapabilities(uint8_t linkId) const;
446 /**
447 * Return the ERP information of the current AP for the given link.
448 *
449 * \param linkId the ID of the given link
450 * \return the ERP information that we support for the given link
451 */
452 ErpInformation GetErpInformation(uint8_t linkId) const;
453 /**
454 * Return the EDCA Parameter Set of the current AP for the given link.
455 *
456 * \param linkId the ID of the given link
457 * \return the EDCA Parameter Set that we support for the given link
458 */
459 EdcaParameterSet GetEdcaParameterSet(uint8_t linkId) const;
460 /**
461 * Return the MU EDCA Parameter Set of the current AP, if one needs to be advertised
462 *
463 * \return the MU EDCA Parameter Set that needs to be advertised (if any)
464 */
465 std::optional<MuEdcaParameterSet> GetMuEdcaParameterSet() const;
466 /**
467 * Return the Reduced Neighbor Report (RNR) element that the current AP sends
468 * on the given link, if one needs to be advertised.
469 *
470 * \param linkId the ID of the link to send the RNR element onto
471 * \return the Reduced Neighbor Report element
472 */
473 std::optional<ReducedNeighborReport> GetReducedNeighborReport(uint8_t linkId) const;
474 /**
475 * Return the Multi-Link Element that the current AP includes in the management
476 * frames of the given type it transmits on the given link.
477 *
478 * \param linkId the ID of the link to send the Multi-Link Element onto
479 * \param frameType the type of the frame containing the Multi-Link Element
480 * \param to the Receiver Address of the frame containing the Multi-Link Element
481 * \return the Multi-Link Element
482 */
484 WifiMacType frameType,
486 /**
487 * Return the HT operation of the current AP for the given link.
488 *
489 * \param linkId the ID of the given link
490 * \return the HT operation that we support
491 */
492 HtOperation GetHtOperation(uint8_t linkId) const;
493 /**
494 * Return the VHT operation of the current AP for the given link.
495 *
496 * \param linkId the ID of the given link
497 * \return the VHT operation that we support
498 */
499 VhtOperation GetVhtOperation(uint8_t linkId) const;
500 /**
501 * Return the HE operation of the current AP for the given link.
502 *
503 * \param linkId the ID of the given link
504 * \return the HE operation that we support
505 */
506 HeOperation GetHeOperation(uint8_t linkId) const;
507 /**
508 * Return the EHT operation of the current AP for the given link.
509 *
510 * \param linkId the ID of the given link
511 * \return the EHT operation that we support
512 */
513 EhtOperation GetEhtOperation(uint8_t linkId) const;
514 /**
515 * Return an instance of SupportedRates that contains all rates that we support
516 * for the given link (including HT rates).
517 *
518 * \param linkId the ID of the given link
519 * \return all rates that we support
520 */
521 AllSupportedRates GetSupportedRates(uint8_t linkId) const;
522 /**
523 * Return the DSSS Parameter Set that we support on the given link
524 *
525 * \param linkId the ID of the given link
526 * \return the DSSS Parameter Set that we support on the given link
527 */
528 DsssParameterSet GetDsssParameterSet(uint8_t linkId) const;
529 /**
530 * Enable or disable beacon generation of the AP.
531 *
532 * \param enable enable or disable beacon generation
533 */
534 void SetBeaconGeneration(bool enable);
535
536 /**
537 * Update whether short slot time should be enabled or not in the BSS
538 * corresponding to the given link.
539 * Typically, short slot time is enabled only when there is no non-ERP station
540 * associated to the AP, and that short slot time is supported by the AP and by all
541 * other ERP stations that are associated to the AP. Otherwise, it is disabled.
542 *
543 * \param linkId the ID of the given link
544 */
545 void UpdateShortSlotTimeEnabled(uint8_t linkId);
546 /**
547 * Update whether short preamble should be enabled or not in the BSS
548 * corresponding to the given link.
549 * Typically, short preamble is enabled only when the AP and all associated
550 * stations support short PHY preamble. Otherwise, it is disabled.
551 *
552 * \param linkId the ID of the given link
553 */
554 void UpdateShortPreambleEnabled(uint8_t linkId);
555
556 /**
557 * Return whether protection for non-ERP stations is used in the BSS
558 * corresponding to the given link.
559 *
560 * \param linkId the ID of the given link
561 * \return true if protection for non-ERP stations is used in the BSS,
562 * false otherwise
563 */
564 bool GetUseNonErpProtection(uint8_t linkId) const;
565
566 void DoDispose() override;
567 void DoInitialize() override;
568
569 /**
570 * \return the next Association ID to be allocated by the AP
571 */
572 uint16_t GetNextAssociationId() const;
573
574 Ptr<Txop> m_beaconTxop; //!< Dedicated Txop for beacons
575 bool m_enableBeaconGeneration; //!< Flag whether beacons are being generated
576 Time m_beaconInterval; //!< Beacon interval
578 m_beaconJitter; //!< UniformRandomVariable used to randomize the time of the first beacon
579 bool m_enableBeaconJitter; //!< Flag whether the first beacon should be generated at random time
580 bool m_enableNonErpProtection; //!< Flag whether protection mechanism is used or not when
581 //!< non-ERP STAs are present within the BSS
582 Time m_bsrLifetime; //!< Lifetime of Buffer Status Reports
583 /// transition timeout events running for EMLSR clients
584 std::map<Mac48Address, EventId> m_transitionTimeoutEvents;
586
587 UintAccessParamsMap m_cwMinsForSta; //!< Per-AC CW min values to advertise to stations
588 UintAccessParamsMap m_cwMaxsForSta; //!< Per-AC CW max values to advertise to stations
589 UintAccessParamsMap m_aifsnsForSta; //!< Per-AC AIFS values to advertise to stations
590 TimeAccessParamsMap m_txopLimitsForSta; //!< Per-AC TXOP limits values to advertise to stations
591
592 Time m_fdBeaconInterval6GHz; //!< Time elapsing between a beacon and FILS Discovery (FD)
593 //!< frame or between two FD frames on 6GHz links
594 Time m_fdBeaconIntervalNon6GHz; //!< Time elapsing between a beacon and FILS Discovery (FD)
595 //!< frame or between two FD frames on 2.4GHz and 5GHz links
596 bool m_sendUnsolProbeResp; //!< send unsolicited Probe Response instead of FILS Discovery
597
598 /// store value and timestamp for each Buffer Status Report
599 struct BsrType
600 {
601 uint8_t value; //!< value of BSR
602 Time timestamp; //!< timestamp of BSR
603 };
604
605 /// Per (MAC address, TID) buffer status reports
606 std::unordered_map<WifiAddressTidPair, BsrType, WifiAddressTidHash> m_bufferStatus;
607
608 /**
609 * TracedCallback signature for association/deassociation events.
610 *
611 * \param aid the AID of the station
612 * \param address the MAC address of the station
613 */
614 typedef void (*AssociationCallback)(uint16_t aid, Mac48Address address);
615
616 TracedCallback<uint16_t /* AID */, Mac48Address> m_assocLogger; ///< association logger
617 TracedCallback<uint16_t /* AID */, Mac48Address> m_deAssocLogger; ///< deassociation logger
618};
619
620} // namespace ns3
621
622#endif /* AP_WIFI_MAC_H */
Wi-Fi AP state machine.
Definition ap-wifi-mac.h:63
void SendAssocResp(Mac48Address to, bool isReassoc, uint8_t linkId)
Forward an association or a reassociation response packet to the DCF/EDCA.
uint16_t GetAssociationId(Mac48Address addr, uint8_t linkId) const
std::unique_ptr< LinkEntity > CreateLinkEntity() const override
Create a LinkEntity object.
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
void ParseReportedStaInfo(const AssocReqRefVariant &assoc, Mac48Address from, uint8_t linkId)
Given a (Re)Association Request frame body containing a Multi-Link Element, check if a link can be se...
void UpdateShortSlotTimeEnabled(uint8_t linkId)
Update whether short slot time should be enabled or not in the BSS corresponding to the given link.
void DoCompleteConfig() override
Allow subclasses to complete the configuration of the MAC layer components.
const std::map< uint16_t, Mac48Address > & GetStaList(uint8_t linkId) const
Get a const reference to the map of associated stations on the given link.
void DoDispose() override
Destructor implementation.
void SetBeaconInterval(Time interval)
bool ReceiveAssocRequest(const AssocReqRefVariant &assoc, const Mac48Address &from, uint8_t linkId)
Check whether the supported rate set included in the received (Re)Association Request frame is compat...
std::map< uint8_t, Mac48Address > LinkIdStaAddrMap
Map of (link ID, remote STA address) of the links to setup.
std::map< Mac48Address, EventId > m_transitionTimeoutEvents
transition timeout events running for EMLSR clients
UintAccessParamsMap m_cwMaxsForSta
Per-AC CW max values to advertise to stations.
void ScheduleFilsDiscOrUnsolProbeRespFrames(uint8_t linkId)
Schedule the transmission of FILS Discovery frames or unsolicited Probe Response frames on the given ...
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...
CapabilityInformation GetCapabilities(uint8_t linkId) const
Return the Capability information of the current AP for the given link.
Ptr< ApEmlsrManager > m_apEmlsrManager
AP EMLSR Manager.
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
bool m_enableNonErpProtection
Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS.
EdcaParameterSet GetEdcaParameterSet(uint8_t linkId) const
Return the EDCA Parameter Set of the current AP for the given link.
void StaSwitchingToActiveModeOrDeassociated(const Mac48Address &staAddr, uint8_t linkId)
Perform the necessary actions when a given station deassociates or switches from powersave mode to ac...
MultiLinkElement GetMultiLinkElement(uint8_t linkId, WifiMacType frameType, const Mac48Address &to=Mac48Address::GetBroadcast())
Return the Multi-Link Element that the current AP includes in the management frames of the given type...
HtOperation GetHtOperation(uint8_t linkId) const
Return the HT operation of the current AP for the given link.
std::optional< Mac48Address > GetMldOrLinkAddressByAid(uint16_t aid) const
void UpdateShortPreambleEnabled(uint8_t linkId)
Update whether short preamble should be enabled or not in the BSS corresponding to the given link.
uint16_t GetNextAssociationId() const
void TxOk(Ptr< const WifiMpdu > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Time m_fdBeaconIntervalNon6GHz
Time elapsing between a beacon and FILS Discovery (FD) frame or between two FD frames on 2....
std::map< uint16_t, Mac48Address > m_aidToMldOrLinkAddress
Maps AIDs to MLD addresses (for MLDs) or link addresses (in case of single link devices)
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
void Enqueue(Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override
LinkIdStaAddrMap GetLinkIdStaAddrMap(MgtAssocResponseHeader &assoc, const Mac48Address &to, uint8_t linkId)
Get a map of (link ID, remote STA address) of the links to setup.
void SetAid(MgtAssocResponseHeader &assoc, const LinkIdStaAddrMap &linkIdStaAddrMap)
Set the AID field of the given Association Response frame.
static Ptr< const AttributeChecker > GetTimeAccessParamsChecker()
Get a checker for the TxopLimitsForSta attribute, which can be used to deserialize an ACI-indexed map...
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Time m_beaconInterval
Beacon interval.
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
std::unordered_map< WifiAddressTidPair, BsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
void SendProbeResp(Mac48Address to, uint8_t linkId)
Send a Probe Response in response to a Probe Request received from the STA with the given address on ...
PairValue< EnumValue< AcIndex >, AttributeContainerValue< TimeValue, ',', std::vector > > TimeAccessParamsPairValue
AttributeValue type of a pair (ACI, access parameters of type Time)
std::map< AcIndex, std::vector< Time > > TimeAccessParamsMap
ACI-indexed map of access parameters of type Time (TxopLimit)
DsssParameterSet GetDsssParameterSet(uint8_t linkId) const
Return the DSSS Parameter Set that we support on the given link.
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Time GetBeaconInterval() const
static TypeId GetTypeId()
Get the type ID.
std::optional< ReducedNeighborReport > GetReducedNeighborReport(uint8_t linkId) const
Return the Reduced Neighbor Report (RNR) element that the current AP sends on the given link,...
void ReceiveEmlOmn(MgtEmlOmn &frame, const Mac48Address &sender, uint8_t linkId)
Take necessary actions upon receiving the given EML Operating Mode Notification frame from the given ...
Ptr< ApEmlsrManager > GetApEmlsrManager() const
Time m_fdBeaconInterval6GHz
Time elapsing between a beacon and FILS Discovery (FD) frame or between two FD frames on 6GHz links.
uint8_t GetMaxBufferStatus(Mac48Address address) const
Return the maximum among the values of the Queue Size subfield of the last QoS Data or QoS Null frame...
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
ApLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
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...
uint8_t GetBufferStatus(uint8_t tid, Mac48Address address) const
Return the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the ...
EhtOperation GetEhtOperation(uint8_t linkId) const
Return the EHT operation of the current AP for the given link.
bool m_sendUnsolProbeResp
send unsolicited Probe Response instead of FILS Discovery
ErpInformation GetErpInformation(uint8_t linkId) const
Return the ERP information of the current AP for the given link.
void SetLinkUpCallback(Callback< void > linkUp) override
VhtOperation GetVhtOperation(uint8_t linkId) const
Return the VHT operation of the current AP for the given link.
~ApWifiMac() override
void TxFailed(WifiMacDropReason timeoutReason, Ptr< const WifiMpdu > mpdu)
The packet we sent was successfully received by the receiver (i.e.
HeOperation GetHeOperation(uint8_t linkId) const
Return the HE operation of the current AP for the given link.
void SetBufferStatus(uint8_t tid, Mac48Address address, uint8_t size)
Store the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the s...
TimeAccessParamsMap m_txopLimitsForSta
Per-AC TXOP limits values to advertise to stations.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
PairValue< EnumValue< AcIndex >, AttributeContainerValue< UintegerValue, ',', std::vector > > UintAccessParamsPairValue
AttributeValue type of a pair (ACI, access parameters of type unsigned integer)
std::optional< MuEdcaParameterSet > GetMuEdcaParameterSet() const
Return the MU EDCA Parameter Set of the current AP, if one needs to be advertised.
void ProcessPowerManagementFlag(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Process the Power Management bit in the Frame Control field of an MPDU successfully received on the g...
void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
bool SupportsSendFrom() const override
std::map< AcIndex, std::vector< uint64_t > > UintAccessParamsMap
ACI-indexed map of access parameters of type unsigned integer (CWmin, CWmax and AIFSN)
MgtAssocResponseHeader GetAssocResp(Mac48Address to, uint8_t linkId)
Get the Association Response frame to send on a given link.
Ptr< WifiMpdu > GetFilsDiscovery(uint8_t linkId) const
Get the FILS Discovery frame to send on the given link.
static Ptr< const AttributeChecker > GetUintAccessParamsChecker()
Get a checker for the CwMinsForSta, CwMaxsForSta and AifsnsForSta attributes, which can be used to de...
void DoInitialize() override
Initialize() implementation.
std::optional< uint8_t > IsAssociated(const Mac48Address &address) const
Get the ID of a link (if any) that has been setup with the station having the given MAC address.
void SendOneBeacon(uint8_t linkId)
Forward a beacon packet to the beacon special DCF for transmission on the given link.
Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const override
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
void SetApEmlsrManager(Ptr< ApEmlsrManager > apEmlsrManager)
Set the AP EMLSR Manager.
bool GetUseNonErpProtection(uint8_t linkId) const
Return whether protection for non-ERP stations is used in the BSS corresponding to the given link.
UintAccessParamsMap m_cwMinsForSta
Per-AC CW min values to advertise to stations.
UintAccessParamsMap m_aifsnsForSta
Per-AC AIFS values to advertise to stations.
void StaSwitchingToPsMode(const Mac48Address &staAddr, uint8_t linkId)
Perform the necessary actions when a given station switches from active mode to powersave mode.
AllSupportedRates GetSupportedRates(uint8_t linkId) const
Return an instance of SupportedRates that contains all rates that we support for the given link (incl...
A container for one type of attribute.
Callback template class.
Definition callback.h:422
The DSSS Parameter Set.
The EDCA Parameter Set.
EHT Operation Information Element.
The ErpInformation Information Element.
An identifier for simulation events.
Definition event-id.h:45
The HE Operation Information Element.
The HT Operation Information Element.
an EUI-48 address
static Mac48Address GetBroadcast()
Implement the header for management frames of type association and reassociation response.
Implement the header for Action frames of type EML Operating Mode Notification.
AttributeValue implementation for Pair.
Definition pair.h:54
Smart pointer class similar to boost::intrusive_ptr.
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
Hold an unsigned integer type.
Definition uinteger.h:34
The VHT Operation Information Element.
base class for all MAC-level wifi objects.
Definition wifi-mac.h:89
WifiMacDropReason
The reason why an MPDU was dropped.
Definition wifi-mac.h:70
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiMacType
Combination of valid MAC header type/subtype.
std::variant< std::reference_wrapper< MgtAssocRequestHeader >, std::reference_wrapper< MgtReassocRequestHeader > > AssocReqRefVariant
variant holding a reference to a (Re)Association Request
Definition ap-wifi-mac.h:48
Struct containing all supported rates.
store value and timestamp for each Buffer Status Report
Time timestamp
timestamp of BSR
uint8_t value
value of BSR