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  EmlsrLinkSwitchInfo
 Information associated with each PHY that is going to operate on another EMLSR link. More...
 
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 DeactivatePhyListener (Ptr< WifiPhy > phy)
 Deactivate current registered listener for PHY events on the given PHY.
 
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.
 
Time GetBackoffEndFor (Ptr< Txop > txop) const
 Return the time when the backoff procedure ended (or will end) for the given Txop.
 
Time GetBackoffStartFor (Ptr< Txop > txop) const
 Return the time when the backoff procedure started for the given Txop.
 
WifiExpectedAccessReason GetExpectedAccessWithin (const Time &delay) const
 Check whether channel access is expected to be granted within the given delay.
 
bool GetGenerateBackoffOnNoTx () const
 
MHz_u 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.
 
Time GetNavEnd () const
 
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, bool hadFramesToTransmit, bool checkMediumBusy)
 Determine if a new backoff needs to be generated as per letter a) of Section 10.23.2.2 of IEEE 802.11-2020 ("EDCA backoff procedure").
 
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 (const WifiTxVector &txVector)
 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 NotifySwitchingEmlsrLink (Ptr< WifiPhy > phy, const WifiPhyOperatingChannel &channel, uint8_t linkId)
 Notify that the given PHY is about to switch to the given operating channel, which is used by the given link.
 
void NotifySwitchingStartNow (PhyListener *phyListener, 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 on the given PHY.
 
void RequestAccess (Ptr< Txop > txop)
 
void ResetAllBackoffs ()
 Reset the backoff for all the DCF/EDCAF.
 
void ResetBackoff (Ptr< Txop > txop)
 Reset the backoff for the given DCF/EDCAF.
 
void ResetState ()
 Reset the state variables of this channel access manager.
 
void SetGenerateBackoffOnNoTx (bool enable)
 Set the member variable indicating whether the backoff should be invoked when an AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty.
 
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 (or reactivate) listener for PHY events on the given PHY.
 
- 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 final
 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.
 
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.
 
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, 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::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

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 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 void(* NSlotsLeftCallback) (uint8_t linkId, AcIndex aci, const Time &backoffDelay)
 TracedCallback signature for NSlotsLeft alerts.
 
using NSlotsLeftTracedCallback = TracedCallback<uint8_t, AcIndex, const Time&>
 TracedCallback for NSlotsLeft alerts typedef.
 
using PhyListenerMap = std::unordered_map<Ptr<WifiPhy>, std::shared_ptr<PhyListener>>
 Maps each PHY listener to the associated PHY.
 
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.
 
std::multimap< Time, WifiExpectedAccessReasonDoGetAccessGrantStart (bool ignoreNav) const
 Return a map containing (Time, WifiExpectedAccessReason) pairs sorted in increasing order of times.
 
void DoGrantDcfAccess ()
 Grant access to Txop using DCF/EDCF contention rules.
 
void DoRestartAccessTimeoutIfNeeded ()
 
Time GetBackoffEndFor (Ptr< Txop > txop, Time accessGrantStart) const
 This overload is provided to enable caching the value returned by GetAccessGrantStart(), which is independent of the given Txop object.
 
Time GetBackoffStartFor (Ptr< Txop > txop, Time accessGrantStart) const
 This overload is provided to enable caching the value returned by GetAccessGrantStart(), which is independent of the given Txop object.
 
virtual Time GetEifsNoDifs () const
 Return the EIFS duration minus a DIFS.
 
std::shared_ptr< PhyListenerGetPhyListener (Ptr< WifiPhy > phy) const
 Get current registered listener for PHY events on the given PHY.
 
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 ResizeLastBusyStructs ()
 Resize 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_cachedSifs
 cached value for SIFS, to be only used without a PHY
 
Time m_cachedSlot
 cached value for slot, to be only used without a PHY
 
Time m_eifsNoDifs
 EIFS no DIFS time.
 
Ptr< FrameExchangeManagerm_feManager
 pointer to the Frame Exchange Manager
 
bool m_generateBackoffOnNoTx
 whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty
 
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
 
Timespan m_lastNoPhy
 the last start and end time no PHY was operating on the link
 
Time m_lastOffEnd
 the last off 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_lastSleepEnd
 the last sleep end time
 
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
 
uint8_t m_nSlotsLeft
 fire the NSlotsLeftAlert trace source when the backoff counter with the minimum value among all ACs reaches this value
 
NSlotsLeftTracedCallback m_nSlotsLeftCallback
 traced callback for NSlotsLeft alerts
 
Time m_nSlotsLeftMinDelay
 the minimum gap between the end of a medium busy event and the time the NSlotsLeftAlert trace source can be fired
 
Ptr< WifiPhym_phy
 pointer to the unique active PHY
 
PhyListenerMap m_phyListeners
 the PHY listeners
 
bool m_proactiveBackoff
 whether a new backoff value is generated when a CCA busy period starts and the backoff counter is zero
 
Time m_resetBackoffThreshold
 if no PHY operates on a link for a period greater than this threshold, the backoff on that link is reset
 
std::unordered_map< Ptr< WifiPhy >, EmlsrLinkSwitchInfom_switchingEmlsrLinks
 Store information about the PHY objects that are going to operate on another EMLSR link.
 
Txops m_txops
 the vector of managed Txops
 

Static Private Attributes

static const Time DEFAULT_N_SLOTS_LEFT_MIN_DELAY = MicroSeconds(25)
 default value for the NSlotsLeftMinDelay attribute, corresponds to a PIFS in 5GHz/6GHz bands
 

Friends

class ::EmlsrCcaBusyTest
 
class ::EmlsrUlTxopTest
 Allow test cases to access private members.
 

Additional Inherited Members

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.

Config Paths

ns3::ChannelAccessManager is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/Mac/ChannelAccessManagers/[i]"

Attributes

  • GenerateBackoffIfTxopWithoutTx: Specify whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty.
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • NSlotsLeft: The NSlotsLeftAlert trace source is fired when the number of remaining backoff slots for any AC is equal to or less than the value of this attribute. Note that the trace source is fired only if the AC for which the previous condition is met has requested channel access. Also, if the value of this attribute is zero, the trace source is never fired.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:255
    • Initial value: 0
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • NSlotsLeftMinDelay: The minimum gap between the end of a medium busy event and the time the NSlotsLeftAlert trace source can be fired.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • ProactiveBackoff: Specify whether a new backoff value is generated when a CCA busy period starts, the backoff counter is zero and the station is not a TXOP holder. This is useful to generate a new backoff value when, e.g., the backoff counter reaches zero, the station does not transmit and subsequently the medium becomes busy.
    • Set with class: ns3::BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: constructwriteread
    • Support level: SUPPORTED
  • ResetBackoffThreshold: If no PHY operates on this link for a period greater than this threshold, all the backoffs are reset.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: constructwriteread
    • Support level: SUPPORTED

TraceSources

  • NSlotsLeftAlert: The number of remaining backoff slots for the AC with the given index reached the threshold set through the NSlotsLeft attribute.

Group: Wifi

Size of this type is 528 bytes (on a 64-bit architecture).

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

Member Typedef Documentation

◆ NSlotsLeftCallback

typedef void(* ns3::ChannelAccessManager::NSlotsLeftCallback) (uint8_t linkId, AcIndex aci, const Time &backoffDelay)
private

TracedCallback signature for NSlotsLeft alerts.

Parameters
linkIdthe ID of this link
acithe index of the AC that triggered the NSlotsLeft alert
backoffDelaydelay until backoff counts down to zero

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

◆ NSlotsLeftTracedCallback

TracedCallback for NSlotsLeft alerts typedef.

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

◆ PhyListenerMap

using ns3::ChannelAccessManager::PhyListenerMap = std::unordered_map<Ptr<WifiPhy>, std::shared_ptr<PhyListener>>
private

Maps each PHY listener to the associated PHY.

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

◆ Txops

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

typedef for a vector of Txops

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

Constructor & Destructor Documentation

◆ ChannelAccessManager()

ns3::ChannelAccessManager::ChannelAccessManager ( )

Definition at line 220 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 236 of file channel-access-manager.cc.

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

References DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), m_lastNoPhy, m_phy, m_resetBackoffThreshold, ns3::Simulator::Now(), NS_LOG_FUNCTION, ResetAllBackoffs(), ns3::ChannelAccessManager::Timespan::start, 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 404 of file channel-access-manager.cc.

References m_txops, and NS_LOG_FUNCTION.

◆ DeactivatePhyListener()

void ns3::ChannelAccessManager::DeactivatePhyListener ( Ptr< WifiPhy > phy)

Deactivate current registered listener for PHY events on the given PHY.

All notifications but channel switch notifications coming from an inactive listener are ignored.

Parameters
phythe WifiPhy to listen to

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

References GetPhyListener(), and NS_LOG_FUNCTION.

Referenced by SetupPhyListener().

+ Here is the call graph for this function:
+ 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 1024 of file channel-access-manager.cc.

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

+ Here is the call 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 249 of file channel-access-manager.cc.

References m_feManager, m_phy, m_phyListeners, m_txops, and NS_LOG_FUNCTION.

◆ DoGetAccessGrantStart()

std::multimap< Time, WifiExpectedAccessReason > ns3::ChannelAccessManager::DoGetAccessGrantStart ( bool ignoreNav) const
private

Return a map containing (Time, WifiExpectedAccessReason) pairs sorted in increasing order of times.

For each of the events preventing channel access (e.g., medium busy, RX state, TX state, etc), a pair is present in the map indicating the latest known time for which channel access cannot be granted due to that event. Therefore, the returned map does not contain a pair for some WifiExpectedAccessReason enum values (ACCESS_EXPECTED, NOTHING_TO_TX, NOT_REQUESTED and BACKOFF_END).

Parameters
ignoreNavwhether NAV should be ignored
Returns
a map containing (Time, WifiExpectedAccessReason) pairs sorted in increasing order of times

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

References ns3::ACK_TIMER_END, ns3::Time::As(), ns3::BUSY_END, ns3::CTS_TIMER_END, ns3::ChannelAccessManager::Timespan::end, GetEifsNoDifs(), m_lastAckTimeoutEnd, m_lastBusyEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastNoPhy, m_lastOffEnd, m_lastRx, m_lastRxReceivedOk, m_lastSleepEnd, m_lastSwitchingEnd, m_lastTxEnd, m_phy, ns3::NAV_END, ns3::NO_PHY_END, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::OFF_END, ns3::RX_END, ns3::SLEEP_END, ns3::SWITCHING_END, ns3::TX_END, ns3::Time::US, and ns3::WIFI_CHANLIST_PRIMARY.

Referenced by GetAccessGrantStart(), and GetExpectedAccessWithin().

+ Here is the call graph for this function:
+ Here is the caller graph for this 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 601 of file channel-access-manager.cc.

References GetAccessGrantStart(), 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, ns3::StaticCast(), 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 242 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 903 of file channel-access-manager.cc.

References AccessTimeout(), ns3::EventId::Cancel(), GetAccessGrantStart(), GetBackoffEndFor(), ns3::Simulator::GetDelayLeft(), ns3::Simulator::GetMaximumSimulationTime(), GetSifs(), GetSlot(), ns3::EventId::IsExpired(), ns3::EventId::IsPending(), m_accessTimeout, m_linkId, m_nSlotsLeft, m_nSlotsLeftCallback, m_nSlotsLeftMinDelay, m_txops, Max, 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 747 of file channel-access-manager.cc.

References DoGetAccessGrantStart(), GetSifs(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Time::US.

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

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

◆ GetBackoffEndFor() [1/2]

Time ns3::ChannelAccessManager::GetBackoffEndFor ( Ptr< Txop > txop) const

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

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

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

References GetAccessGrantStart(), and GetBackoffEndFor().

Referenced by DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetBackoffEndFor(), and GetExpectedAccessWithin().

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

◆ GetBackoffEndFor() [2/2]

Time ns3::ChannelAccessManager::GetBackoffEndFor ( Ptr< Txop > txop,
Time accessGrantStart ) const
private

This overload is provided to enable caching the value returned by GetAccessGrantStart(), which is independent of the given Txop object.

Parameters
txopthe Txop
accessGrantStartthe value returned by GetAccessGrantStart()
Returns
the time when the backoff procedure ended (or will end)

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

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

+ Here is the call graph for this function:

◆ GetBackoffStartFor() [1/2]

Time ns3::ChannelAccessManager::GetBackoffStartFor ( Ptr< Txop > txop) const

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

References GetAccessGrantStart(), and GetBackoffStartFor().

Referenced by GetBackoffEndFor(), GetBackoffStartFor(), and UpdateBackoff().

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

◆ GetBackoffStartFor() [2/2]

Time ns3::ChannelAccessManager::GetBackoffStartFor ( Ptr< Txop > txop,
Time accessGrantStart ) const
private

This overload is provided to enable caching the value returned by GetAccessGrantStart(), which is independent of the given Txop object.

Parameters
txopthe Txop
accessGrantStartthe value returned by GetAccessGrantStart()
Returns
the time when the backoff procedure started

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

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

+ Here is the call 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 398 of file channel-access-manager.cc.

References m_eifsNoDifs.

Referenced by DoGetAccessGrantStart().

+ Here is the caller graph for this function:

◆ GetExpectedAccessWithin()

WifiExpectedAccessReason ns3::ChannelAccessManager::GetExpectedAccessWithin ( const Time & delay) const

Check whether channel access is expected to be granted within the given delay.

If it is, ACCESS_EXPECTED is returned. If channel access is not expected to be granted because no AC has requested channel access, NOT_REQUESTED is returned. If no AC has frames to send, NOTHING_TO_TX is returned. If any of the times returned by DoGetAccessGrantStart() exceeds the given deadline, the reason corresponding to the earliest of such times is returned. Otherwise, it means that access cannot be granted in time due to the backoff slots to wait and BACKOFF_END is returned.

See also
DoGetAccessGrantStart
Parameters
delaythe given delay
Returns
ACCESS_EXPECTED or the reason why channel access is not expected to be gained in time

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

References ns3::ACCESS_EXPECTED, ns3::Time::As(), ns3::BACKOFF_END, DoGetAccessGrantStart(), GetBackoffEndFor(), GetSifs(), m_linkId, m_txops, ns3::NOT_REQUESTED, ns3::NOTHING_TO_TX, ns3::Simulator::Now(), NS_ABORT_MSG, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::REQUESTED, and ns3::Time::US.

+ Here is the call graph for this function:

◆ GetGenerateBackoffOnNoTx()

bool ns3::ChannelAccessManager::GetGenerateBackoffOnNoTx ( ) const
Returns
whether the backoff should be invoked when an AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty

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

References m_generateBackoffOnNoTx.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetLargestIdlePrimaryChannel()

MHz_u 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 966 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().

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

◆ GetNavEnd()

Time ns3::ChannelAccessManager::GetNavEnd ( ) const
Returns
the time until the NAV has been set

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

References m_lastNavEnd.

◆ 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 1000 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:

◆ GetPhyListener()

std::shared_ptr< PhyListener > ns3::ChannelAccessManager::GetPhyListener ( Ptr< WifiPhy > phy) const
private

Get current registered listener for PHY events on the given PHY.

Parameters
phythe given PHY
Returns
the current registered listener for PHY events on the given PHY

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

References m_phyListeners.

Referenced by DeactivatePhyListener(), RemovePhyListener(), and SetupPhyListener().

+ Here is the caller 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 388 of file channel-access-manager.cc.

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

Referenced by DoGrantDcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetAccessGrantStart(), GetExpectedAccessWithin(), 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 378 of file channel-access-manager.cc.

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

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

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

◆ GetTypeId()

TypeId ns3::ChannelAccessManager::GetTypeId ( )
static

◆ InitLastBusyStructs()

void ns3::ChannelAccessManager::InitLastBusyStructs ( )
private

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

All values are set to the current time.

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

References m_lastBusyEnd, m_lastIdle, m_lastPer20MHzBusyEnd, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ResizeLastBusyStructs().

Referenced by DoInitialize(), and ResetState().

+ 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 492 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,
bool hadFramesToTransmit,
bool checkMediumBusy )

Determine if a new backoff needs to be generated as per letter a) of Section 10.23.2.2 of IEEE 802.11-2020 ("EDCA backoff procedure").

This method is called upon the occurrence of events such as the enqueuing of a packet or the unblocking of some links after they have been blocked for some reason (e.g., wait for ADDBA Response, wait for TX on another EMLSR link to finish, etc.). The checkMediumBusy argument allows to generate a new backoff regardless of the busy/idle state of the medium, as per Section 35.3.16.4 of 802.11be D4.0.

Parameters
txopthe Txop requesting to generate a backoff
hadFramesToTransmitwhether packets available for transmission were queued just before the occurrence of the event triggering this call
checkMediumBusywhether generation of backoff (also) depends on the busy/idle state of the medium
Returns
true if backoff needs to be generated, false otherwise

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

References GetSifs(), GetSlot(), ns3::Txop::GRANTED, IsBusy(), ns3::WifiPhy::IsStateOff(), ns3::WifiPhy::IsStateSleep(), m_linkId, m_phy, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::Seconds(), and UpdateBackoff().

+ Here is the call graph for this function:

◆ NotifyAckTimeoutResetNow()

void ns3::ChannelAccessManager::NotifyAckTimeoutResetNow ( )

Notify that ack timer has reset.

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

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

Referenced by ChannelAccessManagerTest< TxopType >::AddAckTimeoutReset().

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

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

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

+ Here is the call 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 1105 of file channel-access-manager.cc.

References ns3::Txop::GRANTED, m_lastBusyEnd, m_lastPer20MHzBusyEnd, m_linkId, m_proactiveBackoff, m_txops, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_DEBUG, 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 1354 of file channel-access-manager.cc.

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

+ Here is the call 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 1347 of file channel-access-manager.cc.

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

+ Here is the call 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 1298 of file channel-access-manager.cc.

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

Referenced by ChannelAccessManagerTest< TxopType >::AddNavReset().

+ 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 1322 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().

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

References ns3::EventId::Cancel(), ns3::EventId::IsPending(), m_accessTimeout, 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 1286 of file channel-access-manager.cc.

References m_lastOffEnd, m_txops, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ResetBackoff().

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 ( const WifiTxVector & txVector)

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

Parameters
txVectorthe TXVECTOR used for transmission

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

References ns3::ChannelAccessManager::Timespan::end, ns3::GetEstimatedAckTxTime(), ns3::WifiPhy::GetSifs(), m_eifsNoDifs, m_lastRx, m_lastRxReceivedOk, m_phy, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), 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 1063 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)
Parameters
durationexpected duration of reception

Notify the Txop that a packet reception started for the expected duration.

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

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

Referenced by ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), ChannelAccessManagerTest< TxopType >::AddRxErrorEvt(), ChannelAccessManagerTest< TxopType >::AddRxInsideSifsEvt(), ChannelAccessManagerTest< TxopType >::AddRxOkEvt(), ChannelAccessManagerTest< TxopType >::AddRxStartEvt(), ns3::PhyListener::NotifyRxStart(), and LargestIdlePrimaryChannelTest::RunOne().

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

◆ NotifySleepNow()

void ns3::ChannelAccessManager::NotifySleepNow ( )

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

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

References m_feManager, m_linkId, m_txops, NS_LOG_FUNCTION, and ResetAllBackoffs().

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

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

◆ NotifySwitchingEmlsrLink()

void ns3::ChannelAccessManager::NotifySwitchingEmlsrLink ( Ptr< WifiPhy > phy,
const WifiPhyOperatingChannel & channel,
uint8_t linkId )

Notify that the given PHY is about to switch to the given operating channel, which is used by the given link.

This notification is sent by the EMLSR Manager when a PHY object switches operating channel to operate on another link.

Parameters
phythe PHY object that is going to switch channel
channelthe new operating channel of the given PHY
linkIdthe ID of the link on which the given PHY is going to operate

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

References m_switchingEmlsrLinks, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

◆ NotifySwitchingStartNow()

void ns3::ChannelAccessManager::NotifySwitchingStartNow ( PhyListener * phyListener,
Time duration )
Parameters
phyListenerthe PHY listener that sent this notification
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 1145 of file channel-access-manager.cc.

References ns3::EventId::Cancel(), ns3::DynamicCast(), ns3::EventId::IsPending(), m_accessTimeout, m_feManager, m_lastSwitchingEnd, m_lastTxEnd, m_phyListeners, m_switchingEmlsrLinks, m_txops, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, RemovePhyListener(), ResetBackoff(), and ResetState().

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

References m_lastSleepEnd, m_linkId, m_txops, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ResetBackoff().

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 on the given PHY.

Parameters
phythe WifiPhy to listen to

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

References GetPhyListener(), m_lastNoPhy, m_phy, m_phyListeners, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::ChannelAccessManager::Timespan::start, UpdateBackoff(), and UpdateLastIdlePeriod().

Referenced by ChannelAccessManagerTest< TxopType >::AddPhyDisconnectEvt(), and NotifySwitchingStartNow().

+ Here is the call graph for this function:
+ 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 565 of file channel-access-manager.cc.

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

+ Here is the call graph for this function:

◆ ResetAllBackoffs()

void ns3::ChannelAccessManager::ResetAllBackoffs ( )

Reset the backoff for all the DCF/EDCAF.

Additionally, cancel the access timeout event.

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

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

Referenced by AccessTimeout(), NotifySleepNow(), and SetupPhyListener().

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

◆ ResetBackoff()

void ns3::ChannelAccessManager::ResetBackoff ( Ptr< Txop > txop)

Reset the backoff for the given DCF/EDCAF.

Parameters
txopthe given DCF/EDCAF

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

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

Referenced by NotifyOnNow(), NotifySwitchingStartNow(), NotifyWakeupNow(), and ResetAllBackoffs().

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

◆ ResetState()

void ns3::ChannelAccessManager::ResetState ( )

Reset the state variables of this channel access manager.

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

References ns3::ChannelAccessManager::Timespan::end, InitLastBusyStructs(), m_lastAckTimeoutEnd, m_lastCtsTimeoutEnd, m_lastNavEnd, m_lastNoPhy, m_lastRx, m_lastRxReceivedOk, ns3::Simulator::Now(), NS_LOG_FUNCTION, and UpdateLastIdlePeriod().

Referenced by NotifySwitchingStartNow().

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

◆ ResizeLastBusyStructs()

void ns3::ChannelAccessManager::ResizeLastBusyStructs ( )
private

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

If a value (e.g., the busy end time for secondary40 channel) already exists, it is not changed; otherwise, it is set to the current time.

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

References ns3::Count20MHzSubchannels(), 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 InitLastBusyStructs(), and SetupPhyListener().

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

◆ SetGenerateBackoffOnNoTx()

void ns3::ChannelAccessManager::SetGenerateBackoffOnNoTx ( bool enable)

Set the member variable indicating whether the backoff should be invoked when an AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty.

Parameters
enablewhether to enable backoff generation when no TX is performed in a TXOP

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

References m_generateBackoffOnNoTx, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ 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 363 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 370 of file channel-access-manager.cc.

References m_feManager, and NS_LOG_FUNCTION.

◆ SetupPhyListener()

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

Set up (or reactivate) listener for PHY events on the given PHY.

The new (or reactivated) listener becomes the active listener and the previous active listener attached to another PHY, if any, is deactivated.

Parameters
phythe WifiPhy to listen to

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

References DeactivatePhyListener(), ns3::ChannelAccessManager::Timespan::end, GetPhyListener(), m_lastNoPhy, m_lastSwitchingEnd, m_phy, m_phyListeners, m_resetBackoffThreshold, ns3::Simulator::Now(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, ResetAllBackoffs(), ResizeLastBusyStructs(), and ns3::ChannelAccessManager::Timespan::start.

+ Here is the call graph for this function:

◆ UpdateBackoff()

void ns3::ChannelAccessManager::UpdateBackoff ( )
private

Update backoff slots for all Txops.

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

References GetAccessGrantStart(), 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(), RemovePhyListener(), 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 1362 of file channel-access-manager.cc.

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

Referenced by GetLargestIdlePrimaryChannel(), NotifyCcaBusyStartNow(), NotifyRxStartNow(), NotifyTxStartNow(), RemovePhyListener(), and ResetState().

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

Friends And Related Symbol Documentation

◆ ::EmlsrCcaBusyTest

friend class ::EmlsrCcaBusyTest
friend

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

◆ ::EmlsrUlTxopTest

friend class ::EmlsrUlTxopTest
friend

Allow test cases to access private members.

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

Member Data Documentation

◆ DEFAULT_N_SLOTS_LEFT_MIN_DELAY

const Time ns3::ChannelAccessManager::DEFAULT_N_SLOTS_LEFT_MIN_DELAY = MicroSeconds(25)
staticprivate

default value for the NSlotsLeftMinDelay attribute, corresponds to a PIFS in 5GHz/6GHz bands

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

Referenced by GetTypeId().

◆ m_accessTimeout

EventId ns3::ChannelAccessManager::m_accessTimeout
private

the access timeout ID

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

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

◆ m_cachedSifs

Time ns3::ChannelAccessManager::m_cachedSifs
mutableprivate

cached value for SIFS, to be only used without a PHY

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

Referenced by GetSifs().

◆ m_cachedSlot

Time ns3::ChannelAccessManager::m_cachedSlot
mutableprivate

cached value for slot, to be only used without a PHY

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

Referenced by GetSlot().

◆ m_eifsNoDifs

Time ns3::ChannelAccessManager::m_eifsNoDifs
private

EIFS no DIFS time.

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

Referenced by GetEifsNoDifs(), and NotifyRxEndErrorNow().

◆ m_feManager

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

pointer to the Frame Exchange Manager

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

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

◆ m_generateBackoffOnNoTx

bool ns3::ChannelAccessManager::m_generateBackoffOnNoTx
private

whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not transmit any frame (e.g., due to constraints associated with EMLSR operations), provided that the queue is not actually empty

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

Referenced by GetGenerateBackoffOnNoTx(), and SetGenerateBackoffOnNoTx().

◆ m_lastAckTimeoutEnd

Time ns3::ChannelAccessManager::m_lastAckTimeoutEnd
private

the last Ack timeout end time

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

Referenced by DoGetAccessGrantStart(), NotifyAckTimeoutResetNow(), NotifyAckTimeoutStartNow(), and ResetState().

◆ m_lastBusyEnd

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

◆ m_lastCtsTimeoutEnd

Time ns3::ChannelAccessManager::m_lastCtsTimeoutEnd
private

the last CTS timeout end time

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

Referenced by DoGetAccessGrantStart(), NotifyCtsTimeoutResetNow(), NotifyCtsTimeoutStartNow(), and ResetState().

◆ 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 537 of file channel-access-manager.h.

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

◆ m_lastNavEnd

Time ns3::ChannelAccessManager::m_lastNavEnd
private

the last NAV end time

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

Referenced by DoGetAccessGrantStart(), GetNavEnd(), IsBusy(), NotifyNavResetNow(), NotifyNavStartNow(), and ResetState().

◆ m_lastNoPhy

Timespan ns3::ChannelAccessManager::m_lastNoPhy
private

the last start and end time no PHY was operating on the link

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

Referenced by AccessTimeout(), DoGetAccessGrantStart(), RemovePhyListener(), ResetState(), SetupPhyListener(), and UpdateLastIdlePeriod().

◆ m_lastOffEnd

Time ns3::ChannelAccessManager::m_lastOffEnd
private

the last off end time

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

Referenced by DoGetAccessGrantStart(), NotifyOnNow(), and UpdateLastIdlePeriod().

◆ 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 534 of file channel-access-manager.h.

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

◆ m_lastRx

Timespan ns3::ChannelAccessManager::m_lastRx
private

◆ m_lastRxReceivedOk

bool ns3::ChannelAccessManager::m_lastRxReceivedOk
private

◆ m_lastSleepEnd

Time ns3::ChannelAccessManager::m_lastSleepEnd
private

the last sleep end time

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

Referenced by DoGetAccessGrantStart(), NotifyWakeupNow(), and UpdateLastIdlePeriod().

◆ m_lastSwitchingEnd

Time ns3::ChannelAccessManager::m_lastSwitchingEnd
private

the last switching end time

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

Referenced by DoGetAccessGrantStart(), NotifySwitchingStartNow(), SetupPhyListener(), and UpdateLastIdlePeriod().

◆ m_lastTxEnd

Time ns3::ChannelAccessManager::m_lastTxEnd
private

the last transmit end time

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

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

◆ m_linkId

◆ m_nSlotsLeft

uint8_t ns3::ChannelAccessManager::m_nSlotsLeft
private

fire the NSlotsLeftAlert trace source when the backoff counter with the minimum value among all ACs reaches this value

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

Referenced by DoRestartAccessTimeoutIfNeeded(), and GetTypeId().

◆ m_nSlotsLeftCallback

NSlotsLeftTracedCallback ns3::ChannelAccessManager::m_nSlotsLeftCallback
private

traced callback for NSlotsLeft alerts

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

Referenced by DoRestartAccessTimeoutIfNeeded(), and GetTypeId().

◆ m_nSlotsLeftMinDelay

Time ns3::ChannelAccessManager::m_nSlotsLeftMinDelay
private

the minimum gap between the end of a medium busy event and the time the NSlotsLeftAlert trace source can be fired

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

Referenced by DoRestartAccessTimeoutIfNeeded(), and GetTypeId().

◆ m_phy

◆ m_phyListeners

PhyListenerMap ns3::ChannelAccessManager::m_phyListeners
private

◆ m_proactiveBackoff

bool ns3::ChannelAccessManager::m_proactiveBackoff
private

whether a new backoff value is generated when a CCA busy period starts and the backoff counter is zero

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

Referenced by GetTypeId(), and NotifyCcaBusyStartNow().

◆ m_resetBackoffThreshold

Time ns3::ChannelAccessManager::m_resetBackoffThreshold
private

if no PHY operates on a link for a period greater than this threshold, the backoff on that link is reset

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

Referenced by AccessTimeout(), GetTypeId(), and SetupPhyListener().

◆ m_switchingEmlsrLinks

std::unordered_map<Ptr<WifiPhy>, EmlsrLinkSwitchInfo> ns3::ChannelAccessManager::m_switchingEmlsrLinks
private

Store information about the PHY objects that are going to operate on another EMLSR link.

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

Referenced by NotifySwitchingEmlsrLink(), and NotifySwitchingStartNow().

◆ m_txops


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