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

Manage a set of ns3::Txop. More...

#include "channel-access-manager.h"

+ Inheritance diagram for ns3::ChannelAccessManager:
+ Collaboration diagram for ns3::ChannelAccessManager:

Classes

struct  Timespan
 Structure defining start time and end time for a given state. More...
 

Public Member Functions

 ChannelAccessManager ()
 
 ~ChannelAccessManager () override
 
void Add (Ptr< Txop > txop)
 
void DisableEdcaFor (Ptr< Txop > qosTxop, Time duration)
 
Time GetAccessGrantStart (bool ignoreNav=false) const
 Access will never be granted to the medium before the time returned by this method.
 
uint16_t GetLargestIdlePrimaryChannel (Time interval, Time end)
 Return the width of the largest primary channel that has been idle for the given time interval before the given time, if any primary channel has been idle, or zero, otherwise.
 
bool GetPer20MHzBusy (const std::set< uint8_t > &indices) const
 
bool IsBusy () const
 Check if the device is busy sending or receiving, or NAV or CCA busy.
 
bool NeedBackoffUponAccess (Ptr< Txop > txop)
 Determine if a new backoff needs to be generated when a packet is queued for transmission.
 
void NotifyAckTimeoutResetNow ()
 Notify that ack timer has reset.
 
void NotifyAckTimeoutStartNow (Time duration)
 Notify that ack timer has started for the given duration.
 
void NotifyCcaBusyStartNow (Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations)
 
void NotifyCtsTimeoutResetNow ()
 Notify that CTS timer has reset.
 
void NotifyCtsTimeoutStartNow (Time duration)
 Notify that CTS timer has started for the given duration.
 
void NotifyNavResetNow (Time duration)
 
void NotifyNavStartNow (Time duration)
 
void NotifyOffNow ()
 Notify the Txop that the device has been put in off mode.
 
void NotifyOnNow ()
 Notify the Txop that the device has been resumed from off mode.
 
void NotifyRxEndErrorNow ()
 Notify the Txop that a packet reception was just completed unsuccessfuly.
 
void NotifyRxEndOkNow ()
 Notify the Txop that a packet reception was just completed successfully.
 
void NotifyRxStartNow (Time duration)
 
void NotifySleepNow ()
 Notify the Txop that the device has been put in sleep mode.
 
void NotifySwitchingStartNow (Time duration)
 
void NotifyTxStartNow (Time duration)
 
void NotifyWakeupNow ()
 Notify the Txop that the device has been resumed from sleep mode.
 
void RemovePhyListener (Ptr< WifiPhy > phy)
 Remove current registered listener for PHY events.
 
void RequestAccess (Ptr< Txop > txop)
 
void SetLinkId (uint8_t linkId)
 Set the ID of the link this Channel Access Manager is associated with.
 
void SetupFrameExchangeManager (Ptr< FrameExchangeManager > feManager)
 Set up the Frame Exchange Manager.
 
void SetupPhyListener (Ptr< WifiPhy > phy)
 Set up listener for PHY events.
 
- 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< ObjectGetObject () 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< ObjectGetObject (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.
 
- 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.
 
SimpleRefCountoperator= (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) 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.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
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.
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
void DoInitialize () override
 Initialize() implementation.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
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.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Types

typedef std::vector< Ptr< Txop > > Txops
 typedef for a vector of Txops
 

Private Member Functions

void AccessTimeout ()
 Called when access timeout should occur (e.g.
 
void DoGrantDcfAccess ()
 Grant access to Txop using DCF/EDCF contention rules.
 
void DoRestartAccessTimeoutIfNeeded ()
 
Time GetBackoffEndFor (Ptr< Txop > txop)
 Return the time when the backoff procedure ended (or will ended) for the given Txop.
 
Time GetBackoffStartFor (Ptr< Txop > txop)
 Return the time when the backoff procedure started for the given Txop.
 
virtual Time GetEifsNoDifs () const
 Return the EIFS duration minus a DIFS.
 
virtual Time GetSifs () const
 Return the Short Interframe Space (SIFS) for this PHY.
 
virtual Time GetSlot () const
 Return the slot duration for this PHY.
 
void InitLastBusyStructs ()
 Initialize the structures holding busy end times per channel type (primary, secondary, etc.) and per 20 MHz channel.
 
void UpdateBackoff ()
 Update backoff slots for all Txops.
 
void UpdateLastIdlePeriod ()
 This method determines whether the medium has been idle during a period (of non-null duration) immediately preceding the time this method is called.
 

Private Attributes

EventId m_accessTimeout
 the access timeout ID
 
Time m_eifsNoDifs
 EIFS no DIFS time.
 
Ptr< FrameExchangeManagerm_feManager
 pointer to the Frame Exchange Manager
 
Time m_lastAckTimeoutEnd
 the last Ack timeout end time
 
std::map< WifiChannelListType, Timem_lastBusyEnd
 the last busy end time for each channel type
 
Time m_lastCtsTimeoutEnd
 the last CTS timeout end time
 
std::map< WifiChannelListType, Timespanm_lastIdle
 the last idle start and end time for each channel type
 
Time m_lastNavEnd
 the last NAV end time
 
std::vector< Timem_lastPer20MHzBusyEnd
 the last busy end time per 20 MHz channel (HE stations and channel width > 20 MHz only)
 
Timespan m_lastRx
 the last receive start and end time
 
bool m_lastRxReceivedOk
 the last receive OK
 
Time m_lastSwitchingEnd
 the last switching end time
 
Time m_lastTxEnd
 the last transmit end time
 
uint8_t m_linkId
 the ID of the link this object is associated with
 
bool m_off
 flag whether it is in off state
 
Ptr< WifiPhym_phy
 pointer to the PHY
 
PhyListenerm_phyListener
 the PHY listener
 
bool m_sleeping
 flag whether it is in sleeping state
 
Txops m_txops
 the vector of managed Txops
 

Additional Inherited Members

- 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.
 

Detailed Description

Manage a set of ns3::Txop.

Handle a set of independent ns3::Txop, each of which represents a single DCF within a MAC stack. Each ns3::Txop has a priority implicitly associated with it (the priority is determined when the ns3::Txop is added to the ChannelAccessManager: the first Txop to be added gets the highest priority, the second, the second highest priority, and so on.) which is used to handle "internal" collisions. i.e., when two local Txop are expected to get access to the medium at the same time, the highest priority local Txop wins access to the medium and the other Txop suffers a "internal" collision.

Definition at line 56 of file channel-access-manager.h.

Member Typedef Documentation

◆ Txops

typedef std::vector<Ptr<Txop> > ns3::ChannelAccessManager::Txops
private

typedef for a vector of Txops

Definition at line 349 of file channel-access-manager.h.

Constructor & Destructor Documentation

◆ ChannelAccessManager()

ns3::ChannelAccessManager::ChannelAccessManager ( )

Definition at line 118 of file channel-access-manager.cc.

References ns3::MicroSeconds().

+ Here is the call graph for this function:

◆ ~ChannelAccessManager()

ns3::ChannelAccessManager::~ChannelAccessManager ( )
override

Definition at line 135 of file channel-access-manager.cc.

References m_phyListener, and NS_LOG_FUNCTION.

Member Function Documentation

◆ AccessTimeout()

void ns3::ChannelAccessManager::AccessTimeout ( )
private

Called when access timeout should occur (e.g.

backoff procedure expired).

Definition at line 452 of file channel-access-manager.cc.

References DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), NS_LOG_FUNCTION, and UpdateBackoff().

Referenced by DoRestartAccessTimeoutIfNeeded().

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

◆ Add()

void ns3::ChannelAccessManager::Add ( Ptr< Txop txop)
Parameters
txopa new Txop.

The ChannelAccessManager does not take ownership of this pointer so, the callee must make sure that the Txop pointer will stay valid as long as the ChannelAccessManager is valid. Note that the order in which Txop objects are added to a ChannelAccessManager matters: the first Txop added has the highest priority, the second Txop added, has the second highest priority, etc.

Definition at line 220 of file channel-access-manager.cc.

References m_txops, and NS_LOG_FUNCTION.

Referenced by ns3::MeshWifiInterfaceMac::ConfigureContentionWindow(), and ns3::ApWifiMac::ConfigureStandard().

+ Here is the caller graph for this function:

◆ DisableEdcaFor()

void ns3::ChannelAccessManager::DisableEdcaFor ( Ptr< Txop qosTxop,
Time  duration 
)
Parameters
qosTxopa QosTxop that needs to be disabled
durationthe amount of time during which the QosTxop is disabled

Disable the given EDCA for the given amount of time. This EDCA will not be granted channel access during this period and the backoff timer will be frozen. After this period, the EDCA will start normal operations again by resuming the backoff timer.

Definition at line 662 of file channel-access-manager.cc.

References DoRestartAccessTimeoutIfNeeded(), m_linkId, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

Referenced by ns3::QosTxop::StartMuEdcaTimerNow().

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

◆ DoDispose()

void ns3::ChannelAccessManager::DoDispose ( )
overrideprotectedvirtual

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.

Reimplemented from ns3::Object.

Definition at line 150 of file channel-access-manager.cc.

References m_feManager, m_phy, m_txops, and NS_LOG_FUNCTION.

◆ DoGrantDcfAccess()

void ns3::ChannelAccessManager::DoGrantDcfAccess ( )
private

Grant access to Txop using DCF/EDCF contention rules.

This is the first Txop we find with an expired backoff and which needs access to the medium. i.e., it has data to send.

all other Txops with a lower priority whose backoff has expired and which needed access to the medium must be notified that we did get an internal collision.

Now, we notify all of these changes in one go if the EDCAF winning the contention actually transmitted a frame. It is necessary to perform first the calculations of which Txops are colliding and then only apply the changes because applying the changes through notification could change the global state of the manager, and, thus, could change the result of the calculations.

Definition at line 373 of file channel-access-manager.cc.

References GetBackoffEndFor(), ns3::WifiPhy::GetChannelWidth(), GetLargestIdlePrimaryChannel(), ns3::WifiPhy::GetOperatingChannel(), ns3::WifiPhy::GetPhyBand(), ns3::WifiPhy::GetPifs(), GetSifs(), GetSlot(), ns3::WifiPhyOperatingChannel::IsOfdm(), m_feManager, m_linkId, m_phy, m_txops, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, and ns3::WIFI_PHY_BAND_2_4GHZ.

Referenced by AccessTimeout(), and RequestAccess().

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

◆ DoInitialize()

void ns3::ChannelAccessManager::DoInitialize ( )
overrideprotectedvirtual

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 143 of file channel-access-manager.cc.

References InitLastBusyStructs(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoRestartAccessTimeoutIfNeeded()

void ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded ( )
private

Is there a Txop which needs to access the medium, and, if there is one, how many slots for AIFS+backoff does it require ?

Definition at line 563 of file channel-access-manager.cc.

References AccessTimeout(), ns3::EventId::Cancel(), GetBackoffEndFor(), ns3::Simulator::GetDelayLeft(), ns3::Simulator::GetMaximumSimulationTime(), ns3::EventId::IsExpired(), ns3::EventId::IsRunning(), m_accessTimeout, m_linkId, m_txops, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, and ns3::Simulator::Schedule().

Referenced by AccessTimeout(), DisableEdcaFor(), NotifyAckTimeoutResetNow(), NotifyCtsTimeoutResetNow(), NotifyNavResetNow(), and RequestAccess().

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

◆ GetAccessGrantStart()

Time ns3::ChannelAccessManager::GetAccessGrantStart ( bool  ignoreNav = false) const

Access will never be granted to the medium before the time returned by this method.

Parameters
ignoreNavflag whether NAV should be ignored
Returns
the absolute time at which access could start to be granted

Definition at line 461 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, GetEifsNoDifs(), GetSifs(), m_lastAckTimeoutEnd, m_lastBusyEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastRx, m_lastRxReceivedOk, m_lastSwitchingEnd, m_lastTxEnd, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::WIFI_CHANLIST_PRIMARY.

Referenced by GetBackoffStartFor(), ns3::QosFrameExchangeManager::PifsRecovery(), and RequestAccess().

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

◆ GetBackoffEndFor()

Time ns3::ChannelAccessManager::GetBackoffEndFor ( Ptr< Txop txop)
private

Return the time when the backoff procedure ended (or will ended) for the given Txop.

Parameters
txopthe Txop
Returns
the time when the backoff procedure ended (or will ended)

Definition at line 518 of file channel-access-manager.cc.

References ns3::Time::As(), GetBackoffStartFor(), GetSlot(), m_linkId, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::US.

Referenced by DoGrantDcfAccess(), and DoRestartAccessTimeoutIfNeeded().

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

◆ GetBackoffStartFor()

Time ns3::ChannelAccessManager::GetBackoffStartFor ( Ptr< Txop txop)
private

Return the time when the backoff procedure started for the given Txop.

Parameters
txopthe Txop
Returns
the time when the backoff procedure started

Definition at line 506 of file channel-access-manager.cc.

References ns3::Time::As(), GetAccessGrantStart(), GetSlot(), m_linkId, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::US.

Referenced by GetBackoffEndFor(), and UpdateBackoff().

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

◆ GetEifsNoDifs()

Time ns3::ChannelAccessManager::GetEifsNoDifs ( ) const
privatevirtual

Return the EIFS duration minus a DIFS.

Returns
the EIFS duration minus a DIFS

Reimplemented in ChannelAccessManagerStub.

Definition at line 214 of file channel-access-manager.cc.

References ns3::WifiPhy::GetAckTxTime(), ns3::WifiPhy::GetSifs(), and m_phy.

Referenced by GetAccessGrantStart().

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

◆ GetLargestIdlePrimaryChannel()

uint16_t ns3::ChannelAccessManager::GetLargestIdlePrimaryChannel ( Time  interval,
Time  end 
)

Return the width of the largest primary channel that has been idle for the given time interval before the given time, if any primary channel has been idle, or zero, otherwise.

Parameters
intervalthe given time interval
endthe given end time
Returns
the width of the largest primary channel that has been idle for the given time interval before the given time, if any primary channel has been idle, or zero, otherwise

Definition at line 604 of file channel-access-manager.cc.

References ns3::Time::As(), m_lastIdle, NS_LOG_FUNCTION, ns3::Time::S, UpdateLastIdlePeriod(), and ns3::Time::US.

Referenced by DoGrantDcfAccess(), and LargestIdlePrimaryChannelTest::RunOne().

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

◆ GetPer20MHzBusy()

bool ns3::ChannelAccessManager::GetPer20MHzBusy ( const std::set< uint8_t > &  indices) const
Parameters
indicesa set of indices (starting at 0) specifying the 20 MHz channels to test
Returns
true if per-20 MHz CCA indicates busy for at least one of the specified 20 MHz channels, false otherwise

Definition at line 638 of file channel-access-manager.cc.

References ns3::WifiPhy::GetChannelWidth(), m_lastBusyEnd, m_lastPer20MHzBusyEnd, m_phy, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, and ns3::WIFI_CHANLIST_PRIMARY.

+ Here is the call graph for this function:

◆ GetSifs()

Time ns3::ChannelAccessManager::GetSifs ( ) const
privatevirtual

Return the Short Interframe Space (SIFS) for this PHY.

Returns
the SIFS duration

Reimplemented in ChannelAccessManagerStub.

Definition at line 208 of file channel-access-manager.cc.

References ns3::WifiPhy::GetSifs(), and m_phy.

Referenced by DoGrantDcfAccess(), GetAccessGrantStart(), NeedBackoffUponAccess(), and NotifyTxStartNow().

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

◆ GetSlot()

Time ns3::ChannelAccessManager::GetSlot ( ) const
privatevirtual

Return the slot duration for this PHY.

Returns
the slot duration

Reimplemented in ChannelAccessManagerStub.

Definition at line 202 of file channel-access-manager.cc.

References ns3::WifiPhy::GetSlot(), and m_phy.

Referenced by DoGrantDcfAccess(), GetBackoffEndFor(), GetBackoffStartFor(), NeedBackoffUponAccess(), RequestAccess(), and UpdateBackoff().

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

◆ InitLastBusyStructs()

void ns3::ChannelAccessManager::InitLastBusyStructs ( )
private

Initialize the structures holding busy end times per channel type (primary, secondary, etc.) and per 20 MHz channel.

Definition at line 227 of file channel-access-manager.cc.

References ns3::WifiPhy::GetChannelWidth(), ns3::WifiPhy::GetOperatingChannel(), ns3::WifiPhy::GetStandard(), ns3::WifiPhyOperatingChannel::IsOfdm(), m_lastBusyEnd, m_lastIdle, m_lastPer20MHzBusyEnd, m_phy, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::WIFI_CHANLIST_PRIMARY, ns3::WIFI_CHANLIST_SECONDARY, ns3::WIFI_CHANLIST_SECONDARY40, ns3::WIFI_CHANLIST_SECONDARY80, and ns3::WIFI_STANDARD_80211ax.

Referenced by DoInitialize(), NotifySwitchingStartNow(), and SetupPhyListener().

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

◆ IsBusy()

bool ns3::ChannelAccessManager::IsBusy ( ) const

Check if the device is busy sending or receiving, or NAV or CCA busy.

Returns
true if the device is busy, false otherwise

Definition at line 268 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, m_lastBusyEnd, m_lastNavEnd, m_lastRx, m_lastTxEnd, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::WIFI_CHANLIST_PRIMARY.

Referenced by NeedBackoffUponAccess().

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

◆ NeedBackoffUponAccess()

bool ns3::ChannelAccessManager::NeedBackoffUponAccess ( Ptr< Txop txop)

Determine if a new backoff needs to be generated when a packet is queued for transmission.

Parameters
txopthe Txop requesting to generate a backoff
Returns
true if backoff needs to be generated, false otherwise

Definition at line 281 of file channel-access-manager.cc.

References GetSifs(), GetSlot(), ns3::Txop::GRANTED, IsBusy(), m_linkId, m_off, m_sleeping, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Seconds(), and UpdateBackoff().

Referenced by ns3::Txop::Queue().

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

◆ NotifyAckTimeoutResetNow()

void ns3::ChannelAccessManager::NotifyAckTimeoutResetNow ( )

◆ NotifyAckTimeoutStartNow()

void ns3::ChannelAccessManager::NotifyAckTimeoutStartNow ( Time  duration)

Notify that ack timer has started for the given duration.

Parameters
durationthe duration of the timer

Definition at line 897 of file channel-access-manager.cc.

References m_lastAckTimeoutEnd, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::FrameExchangeManager::SendMpdu(), ns3::HtFrameExchangeManager::SendPsdu(), and ns3::HeFrameExchangeManager::SendPsduMap().

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

◆ NotifyCcaBusyStartNow()

void ns3::ChannelAccessManager::NotifyCcaBusyStartNow ( Time  duration,
WifiChannelListType  channelType,
const std::vector< Time > &  per20MhzDurations 
)
Parameters
durationexpected duration of CCA busy period
channelTypethe channel type for which the CCA busy state is reported.
per20MhzDurationsvector that indicates for how long each 20 MHz subchannel (corresponding to the index of the element in the vector) is busy and where a zero duration indicates that the subchannel is idle. The vector is non-empty if the PHY supports 802.11ax or later and if the operational channel width is larger than 20 MHz.

Notify the Txop that a CCA busy period has just started.

Definition at line 729 of file channel-access-manager.cc.

References m_lastBusyEnd, m_lastPer20MHzBusyEnd, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, UpdateBackoff(), and UpdateLastIdlePeriod().

Referenced by ChannelAccessManagerTest< TxopType >::AddCcaBusyEvt(), ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), ns3::PhyListener::NotifyCcaBusyStart(), and LargestIdlePrimaryChannelTest::RunOne().

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

◆ NotifyCtsTimeoutResetNow()

void ns3::ChannelAccessManager::NotifyCtsTimeoutResetNow ( )

Notify that CTS timer has reset.

Definition at line 920 of file channel-access-manager.cc.

References DoRestartAccessTimeoutIfNeeded(), m_lastCtsTimeoutEnd, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by ns3::FrameExchangeManager::ReceiveMpdu(), and ns3::HtFrameExchangeManager::ReceiveMpdu().

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

◆ NotifyCtsTimeoutStartNow()

void ns3::ChannelAccessManager::NotifyCtsTimeoutStartNow ( Time  duration)

Notify that CTS timer has started for the given duration.

Parameters
durationthe duration of the timer

Definition at line 913 of file channel-access-manager.cc.

References m_lastCtsTimeoutEnd, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by ns3::HeFrameExchangeManager::SendMuRts(), and ns3::FrameExchangeManager::SendRts().

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

◆ NotifyNavResetNow()

void ns3::ChannelAccessManager::NotifyNavResetNow ( Time  duration)
Parameters
durationthe value of the received NAV.

Called at end of RX

If the NAV reset indicates an end-of-NAV which is earlier than the previous end-of-NAV, the expected end of backoff might be later than previously thought so, we might need to restart a new access timeout.

Definition at line 872 of file channel-access-manager.cc.

References DoRestartAccessTimeoutIfNeeded(), m_lastNavEnd, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

Referenced by ChannelAccessManagerTest< TxopType >::AddNavReset(), ns3::FrameExchangeManager::NavResetTimeout(), and ns3::MeshWifiInterfaceMac::SwitchFrequencyChannel().

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

◆ NotifyNavStartNow()

void ns3::ChannelAccessManager::NotifyNavStartNow ( Time  duration)
Parameters
durationthe value of the received NAV.

Called at end of RX

Definition at line 888 of file channel-access-manager.cc.

References m_lastNavEnd, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

Referenced by ChannelAccessManagerTest< TxopType >::AddNavStart(), and ns3::FrameExchangeManager::UpdateNav().

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

◆ NotifyOffNow()

void ns3::ChannelAccessManager::NotifyOffNow ( )

Notify the Txop that the device has been put in off mode.

Definition at line 816 of file channel-access-manager.cc.

References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_off, m_txops, and NS_LOG_FUNCTION.

Referenced by ns3::PhyListener::NotifyOff().

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

◆ NotifyOnNow()

void ns3::ChannelAccessManager::NotifyOnNow ( )

Notify the Txop that the device has been resumed from off mode.

Definition at line 853 of file channel-access-manager.cc.

References m_linkId, m_off, m_txops, ns3::Txop::NOT_REQUESTED, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::PhyListener::NotifyOn().

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

◆ NotifyRxEndErrorNow()

void ns3::ChannelAccessManager::NotifyRxEndErrorNow ( )

Notify the Txop that a packet reception was just completed unsuccessfuly.

Definition at line 697 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), and ns3::PhyListener::NotifyRxEndError().

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

◆ NotifyRxEndOkNow()

void ns3::ChannelAccessManager::NotifyRxEndOkNow ( )

Notify the Txop that a packet reception was just completed successfully.

Definition at line 688 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ChannelAccessManagerTest< TxopType >::AddRxOkEvt(), and ns3::PhyListener::NotifyRxEndOk().

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

◆ NotifyRxStartNow()

void ns3::ChannelAccessManager::NotifyRxStartNow ( Time  duration)

◆ NotifySleepNow()

void ns3::ChannelAccessManager::NotifySleepNow ( )

Notify the Txop that the device has been put in sleep mode.

Definition at line 798 of file channel-access-manager.cc.

References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_linkId, m_sleeping, m_txops, and NS_LOG_FUNCTION.

Referenced by ns3::PhyListener::NotifySleep().

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

◆ NotifySwitchingStartNow()

void ns3::ChannelAccessManager::NotifySwitchingStartNow ( Time  duration)
Parameters
durationexpected duration of channel switching period

Notify the Txop that a channel switching period has just started. During switching state, new packets can be enqueued in Txop/QosTxop but they won't access to the medium until the end of the channel switching.

Definition at line 754 of file channel-access-manager.cc.

References ns3::EventId::Cancel(), ns3::ChannelAccessManager::Timespan::end, InitLastBusyStructs(), ns3::EventId::IsRunning(), m_accessTimeout, m_feManager, m_lastAckTimeoutEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastRx, m_lastRxReceivedOk, m_lastSwitchingEnd, m_lastTxEnd, m_linkId, m_txops, ns3::Txop::NOT_REQUESTED, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateLastIdlePeriod().

Referenced by ChannelAccessManagerTest< TxopType >::AddSwitchingEvt(), and ns3::PhyListener::NotifySwitchingStart().

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

◆ NotifyTxStartNow()

void ns3::ChannelAccessManager::NotifyTxStartNow ( Time  duration)
Parameters
durationexpected duration of transmission

Notify the Txop that a packet transmission was just started and is expected to last for the specified duration.

Definition at line 707 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, GetSifs(), m_lastRx, m_lastRxReceivedOk, m_lastTxEnd, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::ChannelAccessManager::Timespan::start, UpdateBackoff(), and UpdateLastIdlePeriod().

Referenced by ChannelAccessManagerTest< TxopType >::AddTxEvt(), and ns3::PhyListener::NotifyTxStart().

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

◆ NotifyWakeupNow()

void ns3::ChannelAccessManager::NotifyWakeupNow ( )

Notify the Txop that the device has been resumed from sleep mode.

Definition at line 834 of file channel-access-manager.cc.

References m_linkId, m_sleeping, m_txops, ns3::Txop::NOT_REQUESTED, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by ns3::PhyListener::NotifyWakeup().

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

◆ RemovePhyListener()

void ns3::ChannelAccessManager::RemovePhyListener ( Ptr< WifiPhy phy)

Remove current registered listener for PHY events.

Parameters
phythe WifiPhy to listen to

Definition at line 174 of file channel-access-manager.cc.

References m_phy, m_phyListener, and NS_LOG_FUNCTION.

Referenced by LargestIdlePrimaryChannelTest::DoRun().

+ Here is the caller graph for this function:

◆ RequestAccess()

void ns3::ChannelAccessManager::RequestAccess ( Ptr< Txop txop)
Parameters
txopa Txop

Notify the ChannelAccessManager that a specific Txop needs access to the medium. The ChannelAccessManager is then responsible for starting an access timer and, invoking FrameExchangeManager::StartTransmission when the access is granted if it ever gets granted.

Definition at line 338 of file channel-access-manager.cc.

References DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetAccessGrantStart(), GetSlot(), m_linkId, m_off, m_phy, m_sleeping, ns3::WifiPhy::NotifyChannelAccessRequested(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, and UpdateBackoff().

Referenced by ns3::MultiUserScheduler::AccessReqTimeout(), ns3::Txop::RequestAccess(), and ns3::Txop::StartAccessIfNeeded().

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

◆ SetLinkId()

void ns3::ChannelAccessManager::SetLinkId ( uint8_t  linkId)

Set the ID of the link this Channel Access Manager is associated with.

Parameters
linkIdthe ID of the link this Channel Access Manager is associated with

Definition at line 187 of file channel-access-manager.cc.

References m_linkId, and NS_LOG_FUNCTION.

◆ SetupFrameExchangeManager()

void ns3::ChannelAccessManager::SetupFrameExchangeManager ( Ptr< FrameExchangeManager feManager)

Set up the Frame Exchange Manager.

Parameters
feManagerthe Frame Exchange Manager

Definition at line 194 of file channel-access-manager.cc.

References m_feManager, and NS_LOG_FUNCTION.

◆ SetupPhyListener()

void ns3::ChannelAccessManager::SetupPhyListener ( Ptr< WifiPhy phy)

Set up listener for PHY events.

Parameters
phythe WifiPhy to listen to

Definition at line 163 of file channel-access-manager.cc.

References InitLastBusyStructs(), m_phy, m_phyListener, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by LargestIdlePrimaryChannelTest::DoRun().

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

◆ UpdateBackoff()

void ns3::ChannelAccessManager::UpdateBackoff ( )
private

Update backoff slots for all Txops.

Definition at line 528 of file channel-access-manager.cc.

References GetBackoffStartFor(), GetSlot(), m_linkId, m_txops, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by AccessTimeout(), DisableEdcaFor(), NeedBackoffUponAccess(), NotifyCcaBusyStartNow(), NotifyNavResetNow(), NotifyNavStartNow(), NotifyRxStartNow(), NotifyTxStartNow(), and RequestAccess().

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

◆ UpdateLastIdlePeriod()

void ns3::ChannelAccessManager::UpdateLastIdlePeriod ( )
private

This method determines whether the medium has been idle during a period (of non-null duration) immediately preceding the time this method is called.

If so, the last idle start time and end time for each channel type are updated. Otherwise, no change is made by this method. This method is normally called when we are notified of the start of a transmission, reception, CCA Busy or switching to correctly maintain the information about the last idle period.

Definition at line 928 of file channel-access-manager.cc.

References ns3::ChannelAccessManager::Timespan::end, m_lastBusyEnd, m_lastIdle, m_lastRx, m_lastSwitchingEnd, m_lastTxEnd, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Time::S.

Referenced by GetLargestIdlePrimaryChannel(), NotifyCcaBusyStartNow(), NotifyRxStartNow(), NotifySwitchingStartNow(), and NotifyTxStartNow().

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

Member Data Documentation

◆ m_accessTimeout

EventId ns3::ChannelAccessManager::m_accessTimeout
private

the access timeout ID

Definition at line 368 of file channel-access-manager.h.

Referenced by DoRestartAccessTimeoutIfNeeded(), NotifyOffNow(), NotifySleepNow(), and NotifySwitchingStartNow().

◆ m_eifsNoDifs

Time ns3::ChannelAccessManager::m_eifsNoDifs
private

EIFS no DIFS time.

Definition at line 367 of file channel-access-manager.h.

◆ m_feManager

Ptr<FrameExchangeManager> ns3::ChannelAccessManager::m_feManager
private

pointer to the Frame Exchange Manager

Definition at line 371 of file channel-access-manager.h.

Referenced by DoDispose(), DoGrantDcfAccess(), NotifySwitchingStartNow(), and SetupFrameExchangeManager().

◆ m_lastAckTimeoutEnd

Time ns3::ChannelAccessManager::m_lastAckTimeoutEnd
private

the last Ack timeout end time

Definition at line 352 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), NotifyAckTimeoutResetNow(), NotifyAckTimeoutStartNow(), and NotifySwitchingStartNow().

◆ m_lastBusyEnd

std::map<WifiChannelListType, Time> ns3::ChannelAccessManager::m_lastBusyEnd
private

the last busy end time for each channel type

Definition at line 359 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), GetPer20MHzBusy(), InitLastBusyStructs(), IsBusy(), NotifyCcaBusyStartNow(), and UpdateLastIdlePeriod().

◆ m_lastCtsTimeoutEnd

Time ns3::ChannelAccessManager::m_lastCtsTimeoutEnd
private

the last CTS timeout end time

Definition at line 353 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), NotifyCtsTimeoutResetNow(), NotifyCtsTimeoutStartNow(), and NotifySwitchingStartNow().

◆ m_lastIdle

std::map<WifiChannelListType, Timespan> ns3::ChannelAccessManager::m_lastIdle
private

the last idle start and end time for each channel type

Definition at line 363 of file channel-access-manager.h.

Referenced by GetLargestIdlePrimaryChannel(), InitLastBusyStructs(), and UpdateLastIdlePeriod().

◆ m_lastNavEnd

Time ns3::ChannelAccessManager::m_lastNavEnd
private

the last NAV end time

Definition at line 354 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), IsBusy(), NotifyNavResetNow(), NotifyNavStartNow(), and NotifySwitchingStartNow().

◆ m_lastPer20MHzBusyEnd

std::vector<Time> ns3::ChannelAccessManager::m_lastPer20MHzBusyEnd
private

the last busy end time per 20 MHz channel (HE stations and channel width > 20 MHz only)

Definition at line 360 of file channel-access-manager.h.

Referenced by GetPer20MHzBusy(), InitLastBusyStructs(), and NotifyCcaBusyStartNow().

◆ m_lastRx

Timespan ns3::ChannelAccessManager::m_lastRx
private

◆ m_lastRxReceivedOk

bool ns3::ChannelAccessManager::m_lastRxReceivedOk
private

◆ m_lastSwitchingEnd

Time ns3::ChannelAccessManager::m_lastSwitchingEnd
private

the last switching end time

Definition at line 364 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), NotifySwitchingStartNow(), and UpdateLastIdlePeriod().

◆ m_lastTxEnd

Time ns3::ChannelAccessManager::m_lastTxEnd
private

the last transmit end time

Definition at line 357 of file channel-access-manager.h.

Referenced by GetAccessGrantStart(), IsBusy(), NotifySwitchingStartNow(), NotifyTxStartNow(), and UpdateLastIdlePeriod().

◆ m_linkId

◆ m_off

bool ns3::ChannelAccessManager::m_off
private

flag whether it is in off state

Definition at line 366 of file channel-access-manager.h.

Referenced by NeedBackoffUponAccess(), NotifyOffNow(), NotifyOnNow(), and RequestAccess().

◆ m_phy

Ptr<WifiPhy> ns3::ChannelAccessManager::m_phy
private

◆ m_phyListener

PhyListener* ns3::ChannelAccessManager::m_phyListener
private

the PHY listener

Definition at line 369 of file channel-access-manager.h.

Referenced by ~ChannelAccessManager(), RemovePhyListener(), and SetupPhyListener().

◆ m_sleeping

bool ns3::ChannelAccessManager::m_sleeping
private

flag whether it is in sleeping state

Definition at line 365 of file channel-access-manager.h.

Referenced by NeedBackoffUponAccess(), NotifySleepNow(), NotifyWakeupNow(), and RequestAccess().

◆ m_txops

Txops ns3::ChannelAccessManager::m_txops
private

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