18#include "ns3/uniform-random-bit-generator.h"
26#include <unordered_map>
41class VhtConfiguration;
43class EhtConfiguration;
44class FrameExchangeManager;
45class ChannelAccessManager;
46class ExtendedCapabilities;
47class OriginatorBlockAckAgreement;
48class RecipientBlockAckAgreement;
49class UniformRandomVariable;
77typedef std::unordered_map<uint16_t , Ptr<WifiPsdu> >
WifiPsduMap;
188 std::optional<uint8_t>
GetLinkForPhy(std::size_t phyId)
const;
340 const std::set<uint8_t>& linkIds);
353 const std::set<uint8_t>& linkIds);
668 std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement>>;
671 std::optional<std::reference_wrapper<const RecipientBlockAckAgreement>>;
740 uint16_t
GetMaxBaBufferSize(std::optional<Mac48Address> address = std::nullopt)
const;
792 uint8_t linkId)
const;
900 void SwapLinks(std::map<uint8_t, uint8_t> links);
926 const std::map<uint8_t, std::unique_ptr<LinkEntity>>&
GetLinks()
const;
934 LinkEntity&
GetLink(uint8_t linkId)
const;
979 std::list<bool> isDsss,
1199 std::map<uint8_t, std::unique_ptr<LinkEntity>>
m_links;
1208 typedef std::map<AcIndex, Ptr<QosTxop>, std::greater<>>
EdcaQueues;
1348 const std::set<Mac48Address>* missingStations,
1349 std::size_t nTotalStations);
The IEEE 802.11be EHT Capabilities.
The Extended Capabilities Information Element.
The HE 6 GHz Band Capabilities (IEEE 802.11ax-2021 9.4.2.263)
The IEEE 802.11ax HE Capabilities.
The HT Capabilities Information Element.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
The IEEE 802.11 SSID Information Element.
Forward calls to a chain of Callback.
a unique identifier for an interface.
The IEEE 802.11ac VHT Capabilities.
base class for all MAC-level wifi objects.
virtual void DoCompleteConfig()=0
Allow subclasses to complete the configuration of the MAC layer components.
uint16_t GetMaxAmsduSize(AcIndex ac) const
Return the maximum A-MSDU size of the given Access Category.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Ptr< QosTxop > GetBEQueue() const
Accessor for the AC_BE channel access function.
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &remoteAddr) const
virtual void SetMacQueueScheduler(Ptr< WifiMacQueueScheduler > scheduler)
Set the wifi MAC queue scheduler.
Mac48Address GetBssid(uint8_t linkId) const
void(* PsduResponseTimeoutCallback)(uint8_t reason, Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
TracedCallback signature for PSDU response timeout events.
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI (in bytes)
bool m_shortSlotTimeSupported
flag whether short slot time is supported
virtual void Enqueue(Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from)=0
void ConfigurePhyDependentParameters(uint8_t linkId)
Configure PHY dependent parameters such as CWmin and CWmax on the given link.
Ptr< HeConfiguration > GetHeConfiguration() const
DroppedMpduTracedCallback m_droppedMpduCallback
This trace indicates that an MPDU was dropped for the given reason.
TracedCallback< WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpduTracedCallback
TracedCallback for MPDU drop events typedef.
TypeOfStation GetTypeOfStation() const
Return the type of station.
uint32_t GetFrameRetryLimit() const
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service.
void SetBkQueue(Ptr< QosTxop > edca)
Set the AC_BK channel access function This method is private so that it is only used while constructi...
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Ptr< Txop > GetTxop() const
Accessor for the Txop object.
VhtCapabilities GetVhtCapabilities(uint8_t linkId) const
Return the VHT capabilities of the device for the given link.
Callback< void > m_linkDown
Callback when a link is down.
bool GetQosSupported() const
Return whether the device supports QoS.
virtual void SetAddress(Mac48Address address)
void SetFrameExchangeManagers(const std::vector< Ptr< FrameExchangeManager > > &feManagers)
bool CreateLinksIfNeeded(std::size_t nLinks)
If no link has been already created, create the given number links; otherwise, do nothing.
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
Mac48Address m_address
MAC address of this station.
std::set< uint8_t > m_linkIds
IDs of the links in use.
Ptr< WifiMacQueueScheduler > GetMacQueueScheduler() const
Get the wifi MAC queue scheduler.
uint16_t GetMpduBufferSize() const
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
BlockAckType GetBaTypeAsRecipient(Mac48Address originator, uint8_t tid) const
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
void Enqueue(Ptr< Packet > packet, Mac48Address to)
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO (in bytes)
Ptr< MacRxMiddle > m_rxMiddle
RX middle (defragmentation etc.)
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
void DoInitialize() override
Initialize() implementation.
TypeOfStation m_typeOfStation
the type of station
uint16_t m_mpduBufferSize
BlockAck buffer size (in number of MPDUs)
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE (in bytes)
void SetChannelAccessManagers(const std::vector< Ptr< ChannelAccessManager > > &caManagers)
bool TidMappedOnLink(Mac48Address mldAddr, WifiDirection dir, uint8_t tid, uint8_t linkId) const
Check whether the given TID is mapped on the given link in the given direction for the given MLD.
void UnblockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Unblock the transmission on the given links of all unicast frames addressed to the station with the g...
void SetWifiRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &stationManagers)
void SetBeBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BE.
bool GetErpSupported(uint8_t linkId) const
Return whether the device supports ERP on the given link.
void ResetWifiPhys()
Remove currently attached WifiPhy objects from this MAC.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
void SetErpSupported(bool enable, uint8_t linkId)
Enable or disable ERP support for the given link.
bool GetTxBlockedOnLink(AcIndex ac, const WifiContainerQueueId &queueId, uint8_t linkId, WifiQueueBlockedReason reason=WifiQueueBlockedReason::REASONS_COUNT) const
Check whether the transmission of the packets in the given container queue of the given Access Catego...
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO (in bytes)
void(* MpduResponseTimeoutCallback)(uint8_t reason, Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector)
TracedCallback signature for MPDU response timeout events.
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, std::list< bool > isDsss, AcIndex ac)
WifiMac(const WifiMac &)=delete
Ptr< WifiNetDevice > m_device
Pointer to the device.
virtual void NotifyDropPacketToEnqueue(Ptr< Packet > packet, Mac48Address to)
Allow subclasses to take actions when a packet to enqueue has been dropped.
void UpdateLinkId(uint8_t id)
This method is intended to be called when a link changes ID in order to update the link ID stored by ...
IcfDropTracedCallback m_icfDropCallback
traced callback for ICF drop events
Ptr< QosTxop > GetVOQueue() const
Accessor for the AC_VO channel access function.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
MpduTracedCallback m_ackedMpduCallback
ack'ed MPDU callback
void NotifyRsmOfExpiredMpdu(Ptr< const WifiMpdu > mpdu)
Notify the remote station manager if the given expired (hence dropped) MPDU is a management or data f...
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
void SetMpduBufferSize(uint16_t size)
void BlockUnicastTxOnLinks(WifiQueueBlockedReason reason, const Mac48Address &address, const std::set< uint8_t > &linkIds)
Block the transmission on the given links of all unicast frames addressed to the station with the giv...
MpduTracedCallback m_nackedMpduCallback
nack'ed MPDU callback
bool GetEhtSupported() const
Return whether the device supports EHT.
void SetTxop(Ptr< Txop > dcf)
Set the Txop object.
bool GetHeSupported() const
Return whether the device supports HE.
HtCapabilities GetHtCapabilities(uint8_t linkId) const
Return the HT capabilities of the device for the given link.
void SetBkBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BK.
void SetVoBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VO.
virtual std::optional< uint8_t > GetLinkIdByAddress(const Mac48Address &address) const
Get the ID of the link having the given MAC address, if any.
std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > > RecipientAgreementOptConstRef
optional const reference to RecipientBlockAckAgreement
void NotifyPromiscRx(Ptr< const Packet > packet)
std::unordered_map< Mac48Address, WifiTidLinkMapping, WifiAddressHash > m_dlTidLinkMappings
DL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
void SetVoQueue(Ptr< QosTxop > edca)
Set the AC_VO channel access function This method is private so that it is only used while constructi...
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the MAC has frames to transmit over the given link.
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
UniformRandomBitGenerator m_shuffleLinkIdsGen
random number generator to shuffle link IDs
void ApplyTidLinkMapping(const Mac48Address &mldAddr, WifiDirection dir)
Apply the TID-to-Link Mapping negotiated with the given MLD for the given direction by properly confi...
void CompleteConfig()
Complete the configuration of the MAC layer components.
RecipientAgreementOptConstRef GetBaAgreementEstablishedAsRecipient(Mac48Address originator, uint8_t tid) const
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
Ptr< EhtConfiguration > GetEhtConfiguration() const
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
void(* IcfDropCallback)(WifiIcfDrop reason, uint8_t linkId)
TracedCallback signature for ICF drop events.
bool GetVhtSupported(uint8_t linkId) const
Return whether the device supports VHT on the given link.
void SetDsssSupported(bool enable, uint8_t linkId)
Enable or disable DSSS support for the given link.
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
TracedCallback< Ptr< const WifiMpdu > > MpduTracedCallback
TracedCallback for acked/nacked MPDUs typedef.
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
void NotifyTx(Ptr< const Packet > packet)
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId()
Get the type ID.
Ptr< HtConfiguration > GetHtConfiguration() const
void SetFrameRetryLimit(uint32_t limit)
Set the frame retry limit.
std::optional< std::reference_wrapper< const WifiTidLinkMapping > > GetTidToLinkMapping(Mac48Address mldAddr, WifiDirection dir) const
Get the TID-to-Link Mapping negotiated with the given MLD (if any) for the given direction.
uint32_t GetMaxAmpduSize(AcIndex ac) const
Return the maximum A-MPDU size of the given Access Category.
BlockAckReqType GetBarTypeAsRecipient(Mac48Address originator, uint8_t tid) const
Ssid m_ssid
Service Set ID (SSID)
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of Link objects.
virtual void DeaggregateAmsduAndForward(Ptr< const WifiMpdu > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
Ptr< QosTxop > GetVIQueue() const
Accessor for the AC_VI channel access function.
void SetBssid(Mac48Address bssid, uint8_t linkId)
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
void NotifyRx(Ptr< const Packet > packet)
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
void UpdateTidToLinkMapping(const Mac48Address &mldAddr, WifiDirection dir, const WifiTidLinkMapping &mapping)
Update the TID-to-Link Mappings for the given MLD in the given direction based on the given negotiate...
BlockAckType GetBaTypeAsOriginator(const Mac48Address &recipient, uint8_t tid) const
MpduResponseTimeoutTracedCallback m_mpduResponseTimeoutCallback
MPDU response timeout traced callback.
void SetForwardUpCallback(ForwardUpCallback upCallback)
PsduMapResponseTimeoutTracedCallback m_psduMapResponseTimeoutCallback
PSDU map response timeout traced callback.
ExtendedCapabilities GetExtendedCapabilities() const
Return the extended capabilities of the device.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
std::map< AcIndex, Ptr< QosTxop >, std::greater<> > EdcaQueues
This type defines a mapping between an Access Category index, and a pointer to the corresponding chan...
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK (in bytes)
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
std::unordered_map< Mac48Address, WifiTidLinkMapping, WifiAddressHash > m_ulTidLinkMappings
UL TID-to-Link Mapping negotiated with an MLD (identified by its MLD address)
virtual bool SupportsSendFrom() const
He6GhzBandCapabilities GetHe6GhzBandCapabilities(uint8_t linkId) const
Return the HE 6GHz band capabilities of the device for the given 6 GHz link.
uint16_t GetMaxBaBufferSize(std::optional< Mac48Address > address=std::nullopt) const
Get the maximum Block Ack buffer size (in number of MPDUs) supported by the given device,...
virtual Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
std::optional< uint8_t > GetLinkForPhy(Ptr< const WifiPhy > phy) const
Get the ID of the link (if any) on which the given PHY is operating.
void SetViBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VI.
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
bool GetShortSlotTimeSupported() const
BlockAckReqType GetBarTypeAsOriginator(const Mac48Address &recipient, uint8_t tid) const
void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
void SetLinkDownCallback(Callback< void > linkDown)
Ptr< QosTxop > GetBKQueue() const
Accessor for the AC_BK channel access function.
void SetPromisc()
Sets the interface in promiscuous mode.
Ptr< VhtConfiguration > GetVhtConfiguration() const
void NotifyRxDrop(Ptr< const Packet > packet)
virtual void SetLinkUpCallback(Callback< void > linkUp)
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
const std::set< uint8_t > & GetLinkIds() const
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
Mac48Address GetLocalAddress(const Mac48Address &remoteAddr) const
Get the local MAC address used to communicate with a remote STA.
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
uint32_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK (in bytes)
bool GetHtSupported(uint8_t linkId) const
Return whether the device supports HT on the given link.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
bool Is6GhzBand(uint8_t linkId) const
Indicate if a given link is on the 6 GHz band.
TracedCallback< uint8_t, Ptr< const WifiPsdu >, const WifiTxVector & > PsduResponseTimeoutTracedCallback
TracedCallback for PSDU response timeout events typedef.
TracedCallback< uint8_t, Ptr< const WifiMpdu >, const WifiTxVector & > MpduResponseTimeoutTracedCallback
TracedCallback for MPDU response timeout events typedef.
OriginatorAgreementOptConstRef GetBaAgreementEstablishedAsOriginator(Mac48Address recipient, uint8_t tid) const
virtual void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > > OriginatorAgreementOptConstRef
optional const reference to OriginatorBlockAckAgreement
Mac48Address GetAddress() const
void(* DroppedMpduCallback)(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
TracedCallback signature for MPDU drop events.
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
EhtCapabilities GetEhtCapabilities(uint8_t linkId) const
Return the EHT capabilities of the device for the given link.
TracedCallback< uint8_t, WifiPsduMap *, const std::set< Mac48Address > *, std::size_t > PsduMapResponseTimeoutTracedCallback
TracedCallback for PSDU map response timeout events typedef.
Callback< void > m_linkUp
Callback when a link is up.
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
void SetupDcfQueue()
This method is a private utility invoked to configure the channel access function for devices that do...
void SetBeQueue(Ptr< QosTxop > edca)
Set the AC_BE channel access function This method is private so that it is only used while constructi...
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
WifiMac & operator=(const WifiMac &)=delete
virtual bool CanForwardPacketsTo(Mac48Address to) const =0
Return true if packets can be forwarded to the given destination, false otherwise.
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
Callback< void, Ptr< const Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
PsduResponseTimeoutTracedCallback m_psduResponseTimeoutCallback
PSDU response timeout traced callback.
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
void(* PsduMapResponseTimeoutCallback)(uint8_t reason, WifiPsduMap *psduMap, const std::set< Mac48Address > *missingStations, std::size_t nTotalStations)
TracedCallback signature for PSDU map response timeout events.
void NotifyTxDrop(Ptr< const Packet > packet)
void DoDispose() override
Destructor implementation.
uint32_t m_frameRetryLimit
the frame retry limit
bool GetDsssSupported(uint8_t linkId) const
Return whether the device supports DSSS on the given link.
Ptr< ChannelAccessManager > GetChannelAccessManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Channel Access Manager associated with the given link.
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
void SetViQueue(Ptr< QosTxop > edca)
Set the AC_VI channel access function This method is private so that it is only used while constructi...
void SetShortSlotTimeSupported(bool enable)
Enable or disable short slot time feature.
bool m_ctsToSelfSupported
flag indicating whether CTS-To-Self is supported
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE (in bytes)
virtual Mac48Address DoGetLocalAddress(const Mac48Address &remoteAddr) const
This method is called if this device is an MLD to determine the MAC address of the affiliated STA use...
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI (in bytes)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiIcfDrop
Reasons for an EMLSR client to drop an ICF.
TypeOfStation
Enumeration for type of WiFi station.
WifiMacDropReason
The reason why an MPDU was dropped.
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 ...
@ WIFI_MAC_DROP_QOS_OLD_PACKET
@ WIFI_MAC_DROP_FAILED_ENQUEUE
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std:: tuple< WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional< uint8_t > > WifiContainerQueueId
Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
WifiDirection
Wifi direction.
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
The different BlockAckRequest variants.
The different BlockAck variants.
Structure holding information specific to a single link.
Ptr< WifiRemoteStationManager > stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
Ptr< WifiPhy > phy
Wifi PHY object.
virtual ~LinkEntity()
Destructor (a virtual method is needed to make this struct polymorphic)
bool dsssSupported
set to true iff this WifiMac is to model 802.11b
bool erpSupported
set to true iff this WifiMac is to model 802.11g
Ptr< FrameExchangeManager > feManager
Frame Exchange Manager object.
Ptr< ChannelAccessManager > channelAccessManager
channel access manager object