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