35 #include <unordered_map>
49 class HtConfiguration;
50 class VhtConfiguration;
51 class HeConfiguration;
52 class EhtConfiguration;
53 class FrameExchangeManager;
54 class ChannelAccessManager;
55 class ExtendedCapabilities;
56 class OriginatorBlockAckAgreement;
57 class RecipientBlockAckAgreement;
84 typedef std::unordered_map<uint16_t , Ptr<WifiPsdu> >
WifiPsduMap;
174 std::optional<uint8_t>
GetLinkForPhy(std::size_t phyId)
const;
318 const std::set<uint8_t>& linkIds);
331 const std::set<uint8_t>& linkIds);
616 std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement>>;
619 std::optional<std::reference_wrapper<const RecipientBlockAckAgreement>>;
728 uint8_t linkId)
const;
844 void SwapLinks(std::map<uint8_t, uint8_t> links);
870 const std::map<uint8_t, std::unique_ptr<LinkEntity>>&
GetLinks()
const;
878 LinkEntity&
GetLink(uint8_t linkId)
const;
913 std::list<bool> isDsss,
1053 std::map<uint8_t, std::unique_ptr<LinkEntity>>
m_links;
1062 typedef std::map<AcIndex, Ptr<QosTxop>, std::greater<>>
EdcaQueues;
1199 const std::set<Mac48Address>* missingStations,
1200 std::size_t nTotalStations);
The IEEE 802.11be EHT Capabilities.
The Extended Capabilities Information Element.
The IEEE 802.11ax HE Capabilities.
The HT Capabilities Information Element.
A base class which provides memory management and object aggregation.
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.
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
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.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service.
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.
std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > > RecipientAgreementOptConstRef
optional const reference to RecipientBlockAckAgreement
virtual void SetAddress(Mac48Address address)
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.
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)
virtual void ConfigureStandard(WifiStandard standard)
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 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.
bool GetHtSupported() const
Return whether the device supports HT.
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to)=0
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.
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.
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 ...
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
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
WifiMac & operator=(const WifiMac &)=delete
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.
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.
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)
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the MAC has frames to transmit over the given link.
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy >> &phys)
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
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...
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...
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)
static TypeId GetTypeId()
Get the type ID.
Ptr< HtConfiguration > GetHtConfiguration() const
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.
Ptr< FrameExchangeManager > SetupFrameExchangeManager(WifiStandard standard)
Create a Frame Exchange Manager depending on the supported version of the standard.
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
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::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > > OriginatorAgreementOptConstRef
optional const reference to OriginatorBlockAckAgreement
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
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,...
void SetWifiRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager >> &stationManagers)
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 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)
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)
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...
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.
HeCapabilities GetHeCapabilities(uint8_t linkId) const
Return the HE capabilities of the device for the given link.
virtual bool CanForwardPacketsTo(Mac48Address to) const =0
Return true if packets can be forwarded to the given destination, false otherwise.
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.
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 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...
TypeOfStation
Enumeration for type of WiFi station.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
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.
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::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
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