Wifi MAC high model for an ad-hoc Wifi MAC. More...
#include "adhoc-wifi-mac.h"
Public Member Functions | |
AdhocWifiMac () | |
~AdhocWifiMac () override | |
bool | CanForwardPacketsTo (Mac48Address to) const override |
Return true if packets can be forwarded to the given destination, false otherwise. | |
void | SetLinkUpCallback (Callback< void > linkUp) override |
Public Member Functions inherited from ns3::WifiMac | |
WifiMac () | |
WifiMac (const WifiMac &)=delete | |
~WifiMac () override | |
virtual int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
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 given address for the given reason. | |
void | Enqueue (Ptr< Packet > packet, Mac48Address to) |
void | Enqueue (Ptr< Packet > packet, Mac48Address to, Mac48Address from) |
void | Enqueue (Ptr< Packet > packet, Mac48Address to, Mac48Address from, uint8_t tid) |
Mac48Address | GetAddress () const |
OriginatorAgreementOptConstRef | GetBaAgreementEstablishedAsOriginator (Mac48Address recipient, uint8_t tid) const |
RecipientAgreementOptConstRef | GetBaAgreementEstablishedAsRecipient (Mac48Address originator, uint8_t tid) const |
BlockAckReqType | GetBarTypeAsOriginator (const Mac48Address &recipient, uint8_t tid) const |
BlockAckReqType | GetBarTypeAsRecipient (Mac48Address originator, uint8_t tid) const |
BlockAckType | GetBaTypeAsOriginator (const Mac48Address &recipient, uint8_t tid) const |
BlockAckType | GetBaTypeAsRecipient (Mac48Address originator, uint8_t tid) const |
Mac48Address | GetBssid (uint8_t linkId) const |
Ptr< ChannelAccessManager > | GetChannelAccessManager (uint8_t linkId=SINGLE_LINK_OP_ID) const |
Get the Channel Access Manager associated with the given link. | |
Ptr< WifiNetDevice > | GetDevice () const |
Return the device this PHY is associated with. | |
bool | GetDsssSupported (uint8_t linkId) const |
Return whether the device supports DSSS on the given link. | |
EhtCapabilities | GetEhtCapabilities (uint8_t linkId) const |
Return the EHT capabilities of the device for the given link. | |
Ptr< EhtConfiguration > | GetEhtConfiguration () const |
bool | GetEhtSupported () const |
Return whether the device supports EHT. | |
bool | GetEhtSupported (const Mac48Address &address) const |
bool | GetErpSupported (uint8_t linkId) const |
Return whether the device supports ERP on the given link. | |
ExtendedCapabilities | GetExtendedCapabilities () const |
Return the extended capabilities of the device. | |
Ptr< FrameExchangeManager > | GetFrameExchangeManager (uint8_t linkId=SINGLE_LINK_OP_ID) const |
Get the Frame Exchange Manager associated with the given link. | |
He6GhzBandCapabilities | GetHe6GhzBandCapabilities (uint8_t linkId) const |
Return the HE 6GHz band capabilities of the device for the given 6 GHz link. | |
HeCapabilities | GetHeCapabilities (uint8_t linkId) const |
Return the HE capabilities of the device for the given link. | |
Ptr< HeConfiguration > | GetHeConfiguration () const |
bool | GetHeSupported () const |
Return whether the device supports HE. | |
bool | GetHeSupported (const Mac48Address &address) const |
HtCapabilities | GetHtCapabilities (uint8_t linkId) const |
Return the HT capabilities of the device for the given link. | |
Ptr< HtConfiguration > | GetHtConfiguration () const |
bool | GetHtSupported (const Mac48Address &address) const |
bool | GetHtSupported (uint8_t linkId) const |
Return whether the device supports HT on the given link. | |
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. | |
std::optional< uint8_t > | GetLinkForPhy (std::size_t phyId) const |
Get the ID of the link (if any) on which the given PHY is operating. | |
virtual std::optional< uint8_t > | GetLinkIdByAddress (const Mac48Address &address) const |
Get the ID of the link having the given MAC address, if any. | |
const std::set< uint8_t > & | GetLinkIds () const |
Mac48Address | GetLocalAddress (const Mac48Address &remoteAddr) const |
Get the local MAC address used to communicate with a remote STA. | |
Ptr< WifiMacQueueScheduler > | GetMacQueueScheduler () const |
Get the wifi MAC queue scheduler. | |
uint32_t | GetMaxAmpduSize (AcIndex ac) const |
Return the maximum A-MPDU size of the given Access Category. | |
uint16_t | GetMaxAmsduSize (AcIndex ac) const |
Return the maximum A-MSDU size of the given Access Category. | |
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, if any, or by this device, otherwise, based on the supported standard. | |
std::optional< Mac48Address > | GetMldAddress (const Mac48Address &remoteAddr) const |
uint16_t | GetMpduBufferSize () const |
uint8_t | GetNLinks () const |
Get the number of links (can be greater than 1 for 11be devices only). | |
bool | GetQosSupported () const |
Return whether the device supports QoS. | |
Ptr< QosTxop > | GetQosTxop (AcIndex ac) const |
Accessor for a specified EDCA object. | |
Ptr< QosTxop > | GetQosTxop (uint8_t tid) const |
Accessor for a specified EDCA object. | |
Ssid | GetSsid () 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. | |
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 Category are blocked on the given link for the given reason (if any). | |
Ptr< Txop > | GetTxop () const |
Accessor for the Txop object. | |
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, or a null pointer, otherwise. | |
TypeOfStation | GetTypeOfStation () const |
Return the type of station. | |
VhtCapabilities | GetVhtCapabilities (uint8_t linkId) const |
Return the VHT capabilities of the device for the given link. | |
Ptr< VhtConfiguration > | GetVhtConfiguration () const |
bool | GetVhtSupported (const Mac48Address &address) const |
bool | GetVhtSupported (uint8_t linkId) const |
Return whether the device supports VHT on the given link. | |
Ptr< WifiPhy > | GetWifiPhy (uint8_t linkId=SINGLE_LINK_OP_ID) const |
Ptr< WifiRemoteStationManager > | GetWifiRemoteStationManager (uint8_t linkId=0) const |
virtual bool | HasFramesToTransmit (uint8_t linkId) |
Check if the MAC has frames to transmit over the given link. | |
bool | Is6GhzBand (uint8_t linkId) const |
Indicate if a given link is on the 6 GHz band. | |
virtual void | NotifyChannelSwitching (uint8_t linkId) |
Notify that channel on the given link has been switched. | |
void | NotifyPromiscRx (Ptr< const Packet > packet) |
void | NotifyRx (Ptr< const Packet > packet) |
void | NotifyRxDrop (Ptr< const Packet > packet) |
void | NotifyTx (Ptr< const Packet > packet) |
void | NotifyTxDrop (Ptr< const Packet > packet) |
WifiMac & | operator= (const WifiMac &)=delete |
void | ResetWifiPhys () |
Remove currently attached WifiPhy objects from this MAC. | |
virtual void | SetAddress (Mac48Address address) |
void | SetBssid (Mac48Address bssid, uint8_t linkId) |
void | SetChannelAccessManagers (const std::vector< Ptr< ChannelAccessManager > > &caManagers) |
void | SetCtsToSelfSupported (bool enable) |
Enable or disable CTS-to-self feature. | |
void | SetDevice (const Ptr< WifiNetDevice > device) |
Sets the device this PHY is associated with. | |
void | SetForwardUpCallback (ForwardUpCallback upCallback) |
void | SetFrameExchangeManagers (const std::vector< Ptr< FrameExchangeManager > > &feManagers) |
void | SetLinkDownCallback (Callback< void > linkDown) |
virtual void | SetMacQueueScheduler (Ptr< WifiMacQueueScheduler > scheduler) |
Set the wifi MAC queue scheduler. | |
void | SetMpduBufferSize (uint16_t size) |
void | SetPromisc () |
Sets the interface in promiscuous mode. | |
void | SetSsid (Ssid ssid) |
void | SetTypeOfStation (TypeOfStation type) |
This method is invoked by a subclass to specify what type of station it is implementing. | |
virtual void | SetWifiPhys (const std::vector< Ptr< WifiPhy > > &phys) |
void | SetWifiRemoteStationManager (Ptr< WifiRemoteStationManager > stationManager) |
void | SetWifiRemoteStationManagers (const std::vector< Ptr< WifiRemoteStationManager > > &stationManagers) |
virtual bool | SupportsSendFrom () const |
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 given address for the given reason. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::WifiMac | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Member Functions | |
void | DoCompleteConfig () override |
Allow subclasses to complete the configuration of the MAC layer components. | |
void | Enqueue (Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override |
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 been received on the given link. | |
Additional Inherited Members | |
Public Types inherited from ns3::WifiMac | |
typedef 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 packet up the stack. | |
using | OriginatorAgreementOptConstRef |
optional const reference to OriginatorBlockAckAgreement | |
using | RecipientAgreementOptConstRef |
optional const reference to RecipientBlockAckAgreement | |
Protected Member Functions inherited from ns3::WifiMac | |
void | ApplyTidLinkMapping (const Mac48Address &mldAddr, WifiDirection dir) |
Apply the TID-to-Link Mapping negotiated with the given MLD for the given direction by properly configuring the queue scheduler. | |
virtual void | ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax) |
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. | |
void | DoDispose () override |
Destructor implementation. | |
void | DoInitialize () override |
Initialize() implementation. | |
void | ForwardUp (Ptr< const Packet > packet, Mac48Address from, Mac48Address to) |
Forward the packet up to the device. | |
Ptr< QosTxop > | GetBEQueue () const |
Accessor for the AC_BE channel access function. | |
Ptr< QosTxop > | GetBKQueue () const |
Accessor for the AC_BK channel access function. | |
LinkEntity & | GetLink (uint8_t linkId) const |
Get a reference to the link associated with the given ID. | |
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & | GetLinks () const |
bool | GetShortSlotTimeSupported () const |
Ptr< QosTxop > | GetVIQueue () const |
Accessor for the AC_VI channel access function. | |
Ptr< QosTxop > | GetVOQueue () const |
Accessor for the AC_VO channel access function. | |
void | NotifyConstructionCompleted () override |
Notifier called once the ObjectBase is fully constructed. | |
void | SetShortSlotTimeSupported (bool enable) |
Enable or disable short slot time feature. | |
void | SwapLinks (std::map< uint8_t, uint8_t > links) |
Swap the links based on the information included in the given map. | |
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 negotiated mappings. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
Protected Attributes inherited from ns3::WifiMac | |
Callback< void > | m_linkDown |
Callback when a link is down. | |
Callback< void > | m_linkUp |
Callback when a link is up. | |
Ptr< MacRxMiddle > | m_rxMiddle |
RX middle (defragmentation etc.) | |
Ptr< WifiMacQueueScheduler > | m_scheduler |
wifi MAC queue scheduler | |
Ptr< MacTxMiddle > | m_txMiddle |
TX middle (aggregation etc.) | |
Ptr< Txop > | m_txop |
TXOP used for transmission of frames to non-QoS peers. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Wifi MAC high model for an ad-hoc Wifi MAC.
Definition at line 24 of file adhoc-wifi-mac.h.
ns3::AdhocWifiMac::AdhocWifiMac | ( | ) |
Definition at line 39 of file adhoc-wifi-mac.cc.
References ns3::ADHOC_STA, NS_LOG_FUNCTION, and ns3::WifiMac::SetTypeOfStation().
|
override |
Definition at line 46 of file adhoc-wifi-mac.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Return true if packets can be forwarded to the given destination, false otherwise.
to | the address to which the packet should be sent |
Implements ns3::WifiMac.
Definition at line 58 of file adhoc-wifi-mac.cc.
|
overrideprivatevirtual |
Allow subclasses to complete the configuration of the MAC layer components.
Implements ns3::WifiMac.
Definition at line 52 of file adhoc-wifi-mac.cc.
References NS_LOG_FUNCTION.
|
overrideprivatevirtual |
mpdu | the MPDU to send. |
to | the address to which the packet should be sent. |
from | the address from which the packet should be sent. |
Subclasses need to implement this method to finalize the MAC header of the MPDU (MAC addresses and ToDS/FromDS flags) and enqueue the MPDU in a TX queue.
Implements ns3::WifiMac.
Definition at line 64 of file adhoc-wifi-mac.cc.
References ns3::WifiMac::GetAddress(), ns3::WifiMac::GetBssid(), ns3::WifiMac::GetEhtCapabilities(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetHe6GhzBandCapabilities(), ns3::WifiMac::GetHeCapabilities(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetQosTxop(), ns3::WifiMac::GetTxop(), ns3::WifiMac::GetVhtCapabilities(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::WifiMac::Is6GhzBand(), NS_ASSERT, NS_LOG_FUNCTION, ns3::SINGLE_LINK_OP_ID, and ns3::StaticCast().
|
static |
Get the type ID.
Definition at line 30 of file adhoc-wifi-mac.cc.
References ns3::TypeId::SetParent().
|
overrideprivatevirtual |
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has been received on the given link.
The implementation is intended to capture logic that is going to be common to all (or most) derived classes. Specifically, handling of Block Ack management frames is dealt with here.
This method will need, however, to be overridden by derived classes so that they can perform their data handling before invoking the base version.
The given link may be undefined in some cases (e.g., in case of QoS Data frames received in the context of a Block Ack agreement – because the BlockAckManager does not have to record the link each buffered MPDU has been received on); in such a cases, the value of linkId should be WIFI_LINKID_UNDEFINED.
mpdu | the MPDU that has been received. |
linkId | the ID of the given link |
Reimplemented from ns3::WifiMac.
Definition at line 132 of file adhoc-wifi-mac.cc.
References ns3::WifiMac::DeaggregateAmsduAndForward(), ns3::WifiMac::ForwardUp(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMac::GetEhtCapabilities(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetHeCapabilities(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetVhtCapabilities(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::WifiMacHeader::IsCtl(), ns3::WifiMacHeader::IsData(), ns3::WifiMacHeader::IsQosAmsdu(), ns3::WifiMacHeader::IsQosData(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiMac::Receive(), and ns3::SINGLE_LINK_OP_ID.
|
overridevirtual |
linkUp | the callback to invoke when the link becomes up. |
Reimplemented from ns3::WifiMac.
Definition at line 120 of file adhoc-wifi-mac.cc.
References NS_LOG_FUNCTION, and ns3::WifiMac::SetLinkUpCallback().