A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::AdhocWifiMac Class Reference

Wifi MAC high model for an ad-hoc Wifi MAC. More...

#include "adhoc-wifi-mac.h"

Inheritance diagram for ns3::AdhocWifiMac:
Collaboration diagram for ns3::AdhocWifiMac:

Public Member Functions

 AdhocWifiMac ()
 ~AdhocWifiMac () override
int64_t AssignStreams (int64_t stream) override
 Assign a fixed random variable stream number to the random variables used by this model.
bool CanForwardPacketsTo (Mac48Address to) const override
 Return true if packets can be forwarded to the given destination, false otherwise.
Ptr< Txop > GetTxopFor (AcIndex ac) const override
 Get the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed, or a null pointer, otherwise.
void SetLinkUpCallback (Callback< void > linkUp) override
Public Member Functions inherited from ns3::WifiMac
 WifiMac ()
 WifiMac (const WifiMac &)=delete
 ~WifiMac () override
void BlockUnicastTxOnLinks (WifiQueueBlockedReason reason, Mac48Address address, const std::set< uint8_t > &linkIds, bool exceptMgt=false)
 Block the transmission on the given links of all unicast frames (except management frames, if requested) 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)
void EnqueueMgt (const WifiMacHeader &macHdr, const std::list< std::reference_wrapper< const Header > > &headers, uint8_t linkId)
 Enqueue a management frame.
Mac48Address GetAddress () const
OriginatorAgreementOptConstRef GetBaAgreementEstablishedAsOriginator (Mac48Address recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
RecipientAgreementOptConstRef GetBaAgreementEstablishedAsRecipient (Mac48Address originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) 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.
std::set< linkId_t > GetDisabledLinks (Mac48Address mldAddr)
 Get the set of links that have been disabled for the given MLD, i.e., no TID is mapped onto such links both in the DL direction and the UL direction.
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.
uint32_t GetFrameRetryLimit () const
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.
bool GetRobustAVStreamingSupported () const
 Return whether the device supports Robust AV Streaming.
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.
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 NotifyChannelReleased (Ptr< Txop > txop, uint8_t linkId)
 Notify that the given TXOP has released the channel on the given link.
virtual void NotifyChannelSwitching (uint8_t linkId)
 Notify that channel on the given link has been switched.
void NotifyPromiscRx (Ptr< const Packet > packet)
virtual void NotifyRequestAccess (Ptr< Txop > txop, uint8_t linkId)
 Notify that the given TXOP is requesting channel access on the given link.
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 SetFrameRetryLimit (uint32_t limit)
 Set the frame retry limit.
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 SetRobustAVStreamingSupported (bool enable)
 Enable or disable Robust AV Streaming support for the device.
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, 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 ()
 Caller graph was not generated because of its size.
 ~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 final
 Get the most derived TypeId for this Object.
template<>
Ptr< Object > GetObject () const
 Specialization of () for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
template<>
Ptr< Object > GetObject (TypeId tid) const
 Specialization of (TypeId tid) 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.
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.
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 CancelPendingBeacon ()
 Cancel the remaining IBSS random delay and flush any Beacon waiting in the beacon queue.
void DoCompleteConfig () override
 Allow subclasses to complete the configuration of the MAC layer components.
void DoDispose () override
 Destructor implementation.
void DoInitialize () override
 Initialize() implementation.
void Enqueue (Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override
Time GetBeaconInterval () const
CapabilityInformation GetCapabilities () const
 Return the Capability information of the IBSS.
DsssParameterSet GetDsssParameterSet () const
 Return the DSSS Parameter Set that we support.
EdcaParameterSet GetEdcaParameterSet () const
 Return the EDCA Parameter Set of the IBSS.
EhtOperation GetEhtOperation () const
 Return the EHT operation of the IBSS.
ErpInformation GetErpInformation () const
 Return the ERP information of the IBSS.
HeOperation GetHeOperation () const
 Return the HE operation of the IBSS.
HtOperation GetHtOperation () const
 Return the HT operation of the IBSS.
AllSupportedRates GetSupportedRates () const
 Return an instance of SupportedRates that contains all rates that we support (including HT rates).
VhtOperation GetVhtOperation () const
 Return the VHT operation of the IBSS.
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.
void ReceiveBeacon (Ptr< const WifiMpdu > mpdu, linkId_t linkId)
 Process the Beacon frame received on the given link.
void ReceiveProbeRequest (Ptr< const WifiMpdu > mpdu, linkId_t linkId)
 Process the Probe Request frame received on the given link.
void SendOneBeacon ()
 Forward a beacon packet for transmission.
void SetAllCapabilities (Mac48Address address)
 Fill in the same capabilities as this device for a given new peer.
void SetBeaconGeneration (bool enable)
 Enable or disable beacon generation.
void SetBeaconInterval (Time interval)
void TbttTimeout ()
 Called at each target beacon transmission time (TBTT).

Private Attributes

AcIndex m_beaconAc
 the access category to use for beacons
EventId m_beaconEvent
 Event to generate one beacon after the IBSS random delay.
Time m_beaconInterval
 the beacon interval
Ptr< RandomVariableStream > m_beaconJitter
 Uniform [0, 1] RV for the initial TBTT offset and the per-TBTT delay.
Ptr< Txop > m_beaconTxop
 Dedicated Txop for beacons.
bool m_enableBeaconGeneration
 Flag whether beacons are being generated.
bool m_enableBeaconJitter
 Flag whether the first TBTT is delayed by a random fraction of BeaconInterval.
EventId m_tbttEvent
 Event for the next TBTT.

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.
typedef void(* IcfDropCallback) (const IcfDropInfo &info)
 TracedCallback signature for ICF drop events.
using IcfDropTracedCallback = TracedCallback<const IcfDropInfo&>
 TracedCallback for ICF drop events typedef.
using MgtFrameType
 type of the management frames
using MgtResponseFrameType
 type of the management response frames
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 DestroyAllBlockAckAgreements (Mac48Address remoteAddr)
 Destroy all the Block Ack agreements established with the given remote station.
void DoDispose () override
 Destructor implementation.
void DoInitialize () override
 Initialize() implementation.
void EnqueueDisassociation (Mac48Address addr1, uint8_t linkId)
 Prepare and enqueue a Disassociation frame.
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 HandleQueuesUponAssocStateChanged (Mac48Address remoteAddr, const std::set< uint8_t > &linkIds, bool isDisassoc)
 This function performs the operations that APs and non-AP STAs need to take on their queues in case of disassociation or (re)association.
void NotifyConstructionCompleted () override
 Notifier called once the ObjectBase is fully constructed.
void RecordCapabilities (const MgtFrameType &frame, const Mac48Address &addr, uint8_t linkId)
 Update capabilities information from the given management frame.
void ResetRemoteInfo (Mac48Address remoteAddr, uint8_t linkId)
 Reset the information about the given remote station from the remote station manager operating on the given link.
void RestoreQueuesAfterReassoc (Mac48Address remoteAddr)
 Queues that have been blocked (and not flushed) upon disassociation or reassociation need to be restored in case of successful association.
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
UniformRandomBitGenerator m_shuffleLinkIdsGen
 random number generator to shuffle link IDs
Ptr< MacTxMiddle > m_txMiddle
 TX middle (aggregation etc.).
Ptr< Txop > m_txop
 TXOP used for transmission of frames to non-QoS peers.

Detailed Description

Wifi MAC high model for an ad-hoc Wifi MAC.

As per IEEE 802.11-2024, sec. 11.1.3.5 (Beacon generation in an IBSS), if beacon generation is enabled, TBTTs occur every BeaconInterval. At each TBTT a random delay in [0, 2 * aCWmin * aSlotTime] is applied before transmitting a Beacon. If a Beacon from the same IBSS is received before that delay expires, the remaining delay and any pending Beacon are cancelled.

Note that The first TBTT may be further delayed by BeaconJitter.

Definition at line 44 of file adhoc-wifi-mac.h.

Constructor & Destructor Documentation

◆ AdhocWifiMac()

ns3::AdhocWifiMac::AdhocWifiMac ( )

Definition at line 96 of file adhoc-wifi-mac.cc.

References ns3::ADHOC_STA, ns3::CreateObjectWithAttributes(), m_beaconTxop, m_enableBeaconGeneration, ns3::WifiMac::m_txMiddle, NS_LOG_FUNCTION, and ns3::WifiMac::SetTypeOfStation().

Referenced by GetTypeId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~AdhocWifiMac()

ns3::AdhocWifiMac::~AdhocWifiMac ( )
override

Definition at line 107 of file adhoc-wifi-mac.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::AdhocWifiMac::AssignStreams ( int64_t stream)
overridevirtual

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Reimplemented from ns3::WifiMac.

Definition at line 189 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::AssignStreams(), m_beaconJitter, m_beaconTxop, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ CancelPendingBeacon()

void ns3::AdhocWifiMac::CancelPendingBeacon ( )
private

Cancel the remaining IBSS random delay and flush any Beacon waiting in the beacon queue.

Definition at line 330 of file adhoc-wifi-mac.cc.

References m_beaconEvent, m_beaconTxop, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ReceiveBeacon(), and SetBeaconGeneration().

Here is the caller graph for this function:

◆ CanForwardPacketsTo()

bool ns3::AdhocWifiMac::CanForwardPacketsTo ( Mac48Address to) const
overridevirtual

Return true if packets can be forwarded to the given destination, false otherwise.

Parameters
tothe address to which the packet should be sent
Returns
whether packets can be forwarded to the given destination

Implements ns3::WifiMac.

Definition at line 225 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetWifiRemoteStationManager(), and m_enableBeaconGeneration.

Here is the call graph for this function:

◆ DoCompleteConfig()

void ns3::AdhocWifiMac::DoCompleteConfig ( )
overrideprivatevirtual

Allow subclasses to complete the configuration of the MAC layer components.

Implements ns3::WifiMac.

Definition at line 200 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::LinkEntity::channelAccessManager, ns3::WifiMac::GetLink(), ns3::WifiMac::GetNLinks(), ns3::WifiMac::GetQosSupported(), ns3::WifiMac::GetQosTxop(), ns3::WifiMac::GetTxop(), m_beaconAc, m_beaconTxop, NS_LOG_FUNCTION, and ns3::StaticCast().

Here is the call graph for this function:

◆ DoDispose()

void ns3::AdhocWifiMac::DoDispose ( )
overrideprivatevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Caller graph was not generated because of its size.

Reimplemented from ns3::Object.

Definition at line 138 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::DoDispose(), m_beaconEvent, m_beaconTxop, m_enableBeaconGeneration, m_tbttEvent, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ DoInitialize()

void ns3::AdhocWifiMac::DoInitialize ( )
overrideprivatevirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 113 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::DoInitialize(), ns3::WifiMac::GetAddress(), GetBeaconInterval(), ns3::Time::GetMicroSeconds(), m_beaconEvent, m_beaconJitter, m_beaconTxop, m_enableBeaconGeneration, m_enableBeaconJitter, m_tbttEvent, ns3::MicroSeconds(), NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and TbttTimeout().

Here is the call graph for this function:

◆ Enqueue()

void ns3::AdhocWifiMac::Enqueue ( Ptr< WifiMpdu > mpdu,
Mac48Address to,
Mac48Address from )
overrideprivatevirtual
Parameters
mpduthe MPDU to send.
tothe address to which the packet should be sent.
fromthe 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 270 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetAddress(), ns3::WifiMac::GetBssid(), ns3::WifiMac::GetQosTxop(), ns3::WifiMac::GetTxop(), ns3::WifiMac::GetWifiRemoteStationManager(), m_enableBeaconGeneration, ns3::WifiMac::NotifyTxDrop(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, SetAllCapabilities(), ns3::SINGLE_LINK_OP_ID, and ns3::StaticCast().

Here is the call graph for this function:

◆ GetBeaconInterval()

Time ns3::AdhocWifiMac::GetBeaconInterval ( ) const
private
Returns
the interval between two beacon transmissions.

Definition at line 183 of file adhoc-wifi-mac.cc.

References m_beaconInterval.

Referenced by DoInitialize(), GetTypeId(), SendOneBeacon(), and TbttTimeout().

Here is the caller graph for this function:

◆ GetCapabilities()

CapabilityInformation ns3::AdhocWifiMac::GetCapabilities ( ) const
private

Return the Capability information of the IBSS.

Returns
the Capability information that we support

Definition at line 562 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetErpSupported(), ns3::WifiMac::GetShortSlotTimeSupported(), ns3::WifiMac::GetWifiPhy(), ns3::CapabilityInformation::SetIbss(), ns3::CapabilityInformation::SetShortPreamble(), ns3::CapabilityInformation::SetShortSlotTime(), and ns3::SINGLE_LINK_OP_ID.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDsssParameterSet()

DsssParameterSet ns3::AdhocWifiMac::GetDsssParameterSet ( ) const
private

Return the DSSS Parameter Set that we support.

Returns
the DSSS Parameter Set that we support

Definition at line 553 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetDsssSupported(), ns3::WifiMac::GetWifiPhy(), NS_ASSERT, ns3::DsssParameterSet::SetCurrentChannel(), and ns3::SINGLE_LINK_OP_ID.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEdcaParameterSet()

EdcaParameterSet ns3::AdhocWifiMac::GetEdcaParameterSet ( ) const
private

◆ GetEhtOperation()

EhtOperation ns3::AdhocWifiMac::GetEhtOperation ( ) const
private

Return the EHT operation of the IBSS.

Returns
the EHT operation that we support

Definition at line 732 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetWifiPhy(), NS_ASSERT, ns3::EhtOperation::SetMaxRxNss(), ns3::EhtOperation::SetMaxTxNss(), and ns3::WIFI_EHT_MAX_MCS_INDEX.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetErpInformation()

ErpInformation ns3::AdhocWifiMac::GetErpInformation ( ) const
private

Return the ERP information of the IBSS.

Returns
the ERP information that we support

Definition at line 574 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetErpSupported(), NS_ASSERT, and ns3::SINGLE_LINK_OP_ID.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHeOperation()

HeOperation ns3::AdhocWifiMac::GetHeOperation ( ) const
private

Return the HE operation of the IBSS.

Returns
the HE operation that we support

Definition at line 699 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetHeConfiguration(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetWifiPhy(), ns3::HeOperation::m_6GHzOpInfo, ns3::HeOperation::BssColorInfo::m_bssColor, ns3::HeOperation::m_bssColorInfo, ns3::HeOperation::OpInfo6GHz::m_chCntrFreqSeg0, ns3::HeOperation::OpInfo6GHz::m_chCntrFreqSeg1, ns3::HeOperation::OpInfo6GHz::m_chWid, ns3::HeOperation::OpInfo6GHz::m_primCh, NS_ASSERT, ns3::HeOperation::SetMaxHeMcsPerNss(), ns3::WIFI_PHY_BAND_6GHZ, and ns3::WIFI_STANDARD_80211ax.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHtOperation()

HtOperation ns3::AdhocWifiMac::GetHtOperation ( ) const
private

Return the HT operation of the IBSS.

Returns
the HT operation that we support

Definition at line 628 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetHtConfiguration(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetWifiPhy(), ns3::NanoSeconds(), NS_ASSERT, NS_LOG_DEBUG, ns3::HtOperation::SetPrimaryChannel(), ns3::HtOperation::SetRxHighestSupportedDataRate(), ns3::HtOperation::SetSecondaryChannelOffset(), ns3::HtOperation::SetStaChannelWidth(), ns3::HtOperation::SetTxMaxNSpatialStreams(), ns3::HtOperation::SetTxMcsSetDefined(), ns3::SINGLE_LINK_OP_ID, and ns3::WIFI_MOD_CLASS_HT.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSupportedRates()

AllSupportedRates ns3::AdhocWifiMac::GetSupportedRates ( ) const
private

Return an instance of SupportedRates that contains all rates that we support (including HT rates).

Returns
all rates that we support for the given link

Definition at line 533 of file adhoc-wifi-mac.cc.

References ns3::AllSupportedRates::AddBssMembershipSelectorRate(), ns3::AllSupportedRates::AddSupportedRate(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetWifiPhy(), NS_LOG_DEBUG, and ns3::SINGLE_LINK_OP_ID.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTxopFor()

Ptr< Txop > ns3::AdhocWifiMac::GetTxopFor ( AcIndex ac) const
overridevirtual

Get the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed, or a null pointer, otherwise.

Parameters
acthe given Access Category
Returns
the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed, or a null pointer, otherwise

Reimplemented from ns3::WifiMac.

Definition at line 215 of file adhoc-wifi-mac.cc.

References ns3::AC_BEACON, ns3::WifiMac::GetTxopFor(), and m_beaconTxop.

Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::AdhocWifiMac::GetTypeId ( )
static

◆ GetVhtOperation()

VhtOperation ns3::AdhocWifiMac::GetVhtOperation ( ) const
private

Return the VHT operation of the IBSS.

Returns
the VHT operation that we support

Definition at line 664 of file adhoc-wifi-mac.cc.

References ns3::VhtOperation::GetChannelWidth(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetWifiPhy(), NS_ASSERT, ns3::VhtOperation::SetChannelCenterFrequencySegment0(), ns3::VhtOperation::SetChannelCenterFrequencySegment1(), ns3::VhtOperation::SetChannelWidth(), ns3::VhtOperation::SetMaxVhtMcsPerNss(), and ns3::SINGLE_LINK_OP_ID.

Referenced by SendOneBeacon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Receive()

void ns3::AdhocWifiMac::Receive ( Ptr< const WifiMpdu > mpdu,
uint8_t linkId )
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.

Parameters
mpduthe MPDU that has been received.
linkIdthe ID of the given link

Reimplemented from ns3::WifiMac.

Definition at line 411 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::DeaggregateAmsduAndForward(), ns3::WifiMac::ForwardUp(), ns3::WifiMac::GetWifiRemoteStationManager(), m_enableBeaconGeneration, ns3::WifiMac::NotifyRxDrop(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::WifiMac::Receive(), ReceiveBeacon(), ReceiveProbeRequest(), SetAllCapabilities(), ns3::WIFI_MAC_MGT_ASSOCIATION_REQUEST, ns3::WIFI_MAC_MGT_ASSOCIATION_RESPONSE, ns3::WIFI_MAC_MGT_BEACON, ns3::WIFI_MAC_MGT_PROBE_REQUEST, ns3::WIFI_MAC_MGT_REASSOCIATION_REQUEST, and ns3::WIFI_MAC_MGT_REASSOCIATION_RESPONSE.

Here is the call graph for this function:

◆ ReceiveBeacon()

void ns3::AdhocWifiMac::ReceiveBeacon ( Ptr< const WifiMpdu > mpdu,
linkId_t linkId )
private

Process the Beacon frame received on the given link.

Parameters
mpduthe MPDU containing the Beacon frame
linkIdthe ID of the given link

Definition at line 470 of file adhoc-wifi-mac.cc.

References CancelPendingBeacon(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMac::GetSsid(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::WifiMacHeader::IsBeacon(), ns3::CapabilityInformation::IsIbss(), ns3::MgtBeaconHeader::m_capability, m_enableBeaconGeneration, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, and ns3::WifiMac::RecordCapabilities().

Referenced by Receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReceiveProbeRequest()

void ns3::AdhocWifiMac::ReceiveProbeRequest ( Ptr< const WifiMpdu > mpdu,
linkId_t linkId )
private

Process the Probe Request frame received on the given link.

Parameters
mpduthe MPDU containing the Probe Request frame
linkIdthe ID of the given link

Definition at line 508 of file adhoc-wifi-mac.cc.

References ns3::WifiMacHeader::GetAddr2(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::WifiMacHeader::IsProbeReq(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::WifiMac::RecordCapabilities().

Referenced by Receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendOneBeacon()

void ns3::AdhocWifiMac::SendOneBeacon ( )
private

Forward a beacon packet for transmission.

Definition at line 346 of file adhoc-wifi-mac.cc.

References ns3::Create(), ns3::WifiMac::GetAddress(), GetBeaconInterval(), ns3::Mac48Address::GetBroadcast(), GetCapabilities(), GetDsssParameterSet(), ns3::WifiMac::GetDsssSupported(), GetEdcaParameterSet(), ns3::WifiMac::GetEhtCapabilities(), GetEhtOperation(), ns3::WifiMac::GetEhtSupported(), GetErpInformation(), ns3::WifiMac::GetErpSupported(), ns3::WifiMac::GetExtendedCapabilities(), ns3::WifiMac::GetHe6GhzBandCapabilities(), ns3::WifiMac::GetHeCapabilities(), GetHeOperation(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), GetHtOperation(), ns3::WifiMac::GetHtSupported(), ns3::Time::GetMicroSeconds(), ns3::WifiMac::GetQosSupported(), ns3::WifiMac::GetSsid(), GetSupportedRates(), ns3::WifiMac::GetVhtCapabilities(), GetVhtOperation(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::Is6GhzBand(), ns3::MgtBeaconHeader::m_beaconInterval, m_beaconTxop, ns3::MgtBeaconHeader::m_capability, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetType(), ns3::SINGLE_LINK_OP_ID, and ns3::WIFI_MAC_MGT_BEACON.

Referenced by TbttTimeout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAllCapabilities()

void ns3::AdhocWifiMac::SetAllCapabilities ( Mac48Address address)
private

Fill in the same capabilities as this device for a given new peer.

Parameters
Addressthe MAC address of the peer

Definition at line 231 of file adhoc-wifi-mac.cc.

References ns3::WifiMac::GetEhtCapabilities(), ns3::WifiMac::GetEhtSupported(), ns3::WifiMac::GetHe6GhzBandCapabilities(), ns3::WifiMac::GetHeCapabilities(), ns3::WifiMac::GetHeSupported(), ns3::WifiMac::GetHtCapabilities(), ns3::WifiMac::GetHtSupported(), ns3::WifiMac::GetVhtCapabilities(), ns3::WifiMac::GetVhtSupported(), ns3::WifiMac::GetWifiRemoteStationManager(), ns3::WifiMac::Is6GhzBand(), and ns3::SINGLE_LINK_OP_ID.

Referenced by Enqueue(), and Receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBeaconGeneration()

void ns3::AdhocWifiMac::SetBeaconGeneration ( bool enable)
private

Enable or disable beacon generation.

Parameters
enableenable or disable beacon generation

Definition at line 150 of file adhoc-wifi-mac.cc.

References CancelPendingBeacon(), m_enableBeaconGeneration, m_tbttEvent, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), and TbttTimeout().

Referenced by GetTypeId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBeaconInterval()

void ns3::AdhocWifiMac::SetBeaconInterval ( Time interval)
private
Parameters
intervalthe interval between two beacon transmissions.

Definition at line 166 of file adhoc-wifi-mac.cc.

References ns3::Time::GetMicroSeconds(), m_beaconInterval, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetLinkUpCallback()

void ns3::AdhocWifiMac::SetLinkUpCallback ( Callback< void > linkUp)
overridevirtual
Parameters
linkUpthe callback to invoke when the link becomes up.

Reimplemented from ns3::WifiMac.

Definition at line 302 of file adhoc-wifi-mac.cc.

References NS_LOG_FUNCTION, and ns3::WifiMac::SetLinkUpCallback().

Here is the call graph for this function:

◆ TbttTimeout()

void ns3::AdhocWifiMac::TbttTimeout ( )
private

Called at each target beacon transmission time (TBTT).

Schedules the next TBTT and a Beacon transmission after the IBSS random delay.

Definition at line 314 of file adhoc-wifi-mac.cc.

References GetBeaconInterval(), ns3::WifiMac::GetQosSupported(), ns3::WifiMac::GetQosTxop(), ns3::WifiMac::GetTxop(), ns3::WifiMac::GetWifiPhy(), m_beaconAc, m_beaconEvent, m_beaconJitter, m_tbttEvent, NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SendOneBeacon(), ns3::SINGLE_LINK_OP_ID, ns3::StaticCast(), TbttTimeout(), and ns3::Time::US.

Referenced by DoInitialize(), SetBeaconGeneration(), and TbttTimeout().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_beaconAc

AcIndex ns3::AdhocWifiMac::m_beaconAc
private

the access category to use for beacons

Definition at line 192 of file adhoc-wifi-mac.h.

Referenced by DoCompleteConfig(), GetTypeId(), and TbttTimeout().

◆ m_beaconEvent

EventId ns3::AdhocWifiMac::m_beaconEvent
private

Event to generate one beacon after the IBSS random delay.

Definition at line 199 of file adhoc-wifi-mac.h.

Referenced by CancelPendingBeacon(), DoDispose(), DoInitialize(), and TbttTimeout().

◆ m_beaconInterval

Time ns3::AdhocWifiMac::m_beaconInterval
private

the beacon interval

Definition at line 191 of file adhoc-wifi-mac.h.

Referenced by GetBeaconInterval(), and SetBeaconInterval().

◆ m_beaconJitter

Ptr<RandomVariableStream> ns3::AdhocWifiMac::m_beaconJitter
private

Uniform [0, 1] RV for the initial TBTT offset and the per-TBTT delay.

Definition at line 194 of file adhoc-wifi-mac.h.

Referenced by AssignStreams(), DoInitialize(), GetTypeId(), and TbttTimeout().

◆ m_beaconTxop

Ptr<Txop> ns3::AdhocWifiMac::m_beaconTxop
private

◆ m_enableBeaconGeneration

bool ns3::AdhocWifiMac::m_enableBeaconGeneration
private

Flag whether beacons are being generated.

Definition at line 190 of file adhoc-wifi-mac.h.

Referenced by AdhocWifiMac(), CanForwardPacketsTo(), DoDispose(), DoInitialize(), Enqueue(), Receive(), ReceiveBeacon(), and SetBeaconGeneration().

◆ m_enableBeaconJitter

bool ns3::AdhocWifiMac::m_enableBeaconJitter
private

Flag whether the first TBTT is delayed by a random fraction of BeaconInterval.

Definition at line 195 of file adhoc-wifi-mac.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_tbttEvent

EventId ns3::AdhocWifiMac::m_tbttEvent
private

Event for the next TBTT.

Definition at line 198 of file adhoc-wifi-mac.h.

Referenced by DoDispose(), DoInitialize(), SetBeaconGeneration(), and TbttTimeout().


The documentation for this class was generated from the following files: