A Discrete-Event Network Simulator
API
ns3::ChannelAccessManager Class Reference

Manage a set of ns3::TxopHandle a set of independent ns3::Txop, each of which represents a single DCF within a MAC stack. More...

#include "channel-access-manager.h"

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

Public Member Functions

 ChannelAccessManager ()
 
virtual ~ChannelAccessManager ()
 
void Add (Ptr< Txop > dcf)
 
Time GetEifsNoDifs (void) const
 
bool IsBusy (void) const
 Check if the device is busy sending or receiving, or NAV or CCA busy. More...
 
void NotifyAckTimeoutResetNow (void)
 Notify that ACK timer has reset. More...
 
void NotifyAckTimeoutStartNow (Time duration)
 Notify that ACK timer has started for the given duration. More...
 
void NotifyCtsTimeoutResetNow (void)
 Notify that CTS timer has reset. More...
 
void NotifyCtsTimeoutStartNow (Time duration)
 Notify that CTS timer has started for the given duration. More...
 
void NotifyMaybeCcaBusyStartNow (Time duration)
 
void NotifyNavResetNow (Time duration)
 
void NotifyNavStartNow (Time duration)
 
void NotifyOffNow (void)
 Notify the DCF that the device has been put in off mode. More...
 
void NotifyOnNow (void)
 Notify the DCF that the device has been resumed from off mode. More...
 
void NotifyRxEndErrorNow (void)
 Notify the DCF that a packet reception was just completed unsuccessfully. More...
 
void NotifyRxEndOkNow (void)
 Notify the DCF that a packet reception was just completed successfully. More...
 
void NotifyRxStartNow (Time duration)
 
void NotifySleepNow (void)
 Notify the DCF that the device has been put in sleep mode. More...
 
void NotifySwitchingStartNow (Time duration)
 
void NotifyTxStartNow (Time duration)
 
void NotifyWakeupNow (void)
 Notify the DCF that the device has been resumed from sleep mode. More...
 
void RemovePhyListener (Ptr< WifiPhy > phy)
 Remove current registered listener for Phy events. More...
 
void RequestAccess (Ptr< Txop > state, bool isCfPeriod=false)
 
void SetEifsNoDifs (Time eifsNoDifs)
 
void SetSifs (Time sifs)
 
void SetSlot (Time slotTime)
 
void SetupLow (Ptr< MacLow > low)
 Set up listener for MacLow events. More...
 
void SetupPhyListener (Ptr< WifiPhy > phy)
 Set up listener for Phy events. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Protected Member Functions

void DoDispose (void)
 Destructor implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Types

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

Private Member Functions

void AccessTimeout (void)
 Called when access timeout should occur (e.g. More...
 
void DoGrantDcfAccess (void)
 Grant access to DCF. More...
 
void DoGrantPcfAccess (Ptr< Txop > state)
 Grant access to PCF. More...
 
void DoRestartAccessTimeoutIfNeeded (void)
 
Time GetAccessGrantStart (bool ignoreNav=false) const
 Access will never be granted to the medium before the time returned by this method. More...
 
Time GetBackoffEndFor (Ptr< Txop > state)
 Return the time when the backoff procedure ended (or will ended) for the given Txop. More...
 
Time GetBackoffStartFor (Ptr< Txop > state)
 Return the time when the backoff procedure started for the given Txop. More...
 
bool IsWithinAifs (Ptr< Txop > state) const
 Check if the device is between frames (in DIFS or AIFS interval) More...
 
Time MostRecent (std::initializer_list< Time > list) const
 Return the most recent time. More...
 
void UpdateBackoff (void)
 Update backoff slots for all Txops. More...
 

Private Attributes

EventId m_accessTimeout
 the access timeout ID More...
 
Time m_eifsNoDifs
 EIFS no DIFS time. More...
 
Time m_lastAckTimeoutEnd
 the last ACK timeout end time More...
 
Time m_lastBusyDuration
 the last busy duration time More...
 
Time m_lastBusyStart
 the last busy start time More...
 
Time m_lastCtsTimeoutEnd
 the last CTS timeout end time More...
 
Time m_lastNavDuration
 the last NAV duration time More...
 
Time m_lastNavStart
 the last NAV start time More...
 
Time m_lastRxDuration
 the last receive duration time More...
 
Time m_lastRxEnd
 the last receive end time More...
 
bool m_lastRxReceivedOk
 the last receive OK More...
 
Time m_lastRxStart
 the last receive start time More...
 
Time m_lastSwitchingDuration
 the last switching duration time More...
 
Time m_lastSwitchingStart
 the last switching start time More...
 
Time m_lastTxDuration
 the last transmit duration time More...
 
Time m_lastTxStart
 the last transmit start time More...
 
bool m_off
 flag whether it is in off state More...
 
Ptr< WifiPhym_phy
 Ptr to the PHY. More...
 
PhyListenerm_phyListener
 the phy listener More...
 
Time m_sifs
 the SIFS time More...
 
bool m_sleeping
 flag whether it is in sleeping state More...
 
Time m_slot
 the slot time More...
 
States m_states
 the DCF states More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

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

Member Typedef Documentation

◆ States

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

typedef for a vector of Txops

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

Constructor & Destructor Documentation

◆ ChannelAccessManager()

ns3::ChannelAccessManager::ChannelAccessManager ( )

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

References NS_LOG_FUNCTION.

◆ ~ChannelAccessManager()

ns3::ChannelAccessManager::~ChannelAccessManager ( )
virtual

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

References m_phyListener, and NS_LOG_FUNCTION.

Member Function Documentation

◆ AccessTimeout()

void ns3::ChannelAccessManager::AccessTimeout ( void  )
private

Called when access timeout should occur (e.g.

backoff procedure expired).

Definition at line 381 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 dcf)
Parameters
dcfa 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 203 of file channel-access-manager.cc.

References m_states, and NS_LOG_FUNCTION.

Referenced by ChannelAccessManagerTest::AddDcfState(), and ns3::Txop::SetChannelAccessManager().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::ChannelAccessManager::DoDispose ( void  )
protectedvirtual

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

References m_phy, m_states, and NS_LOG_FUNCTION.

◆ DoGrantDcfAccess()

void ns3::ChannelAccessManager::DoGrantDcfAccess ( void  )
private

Grant access to DCF.

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

all other dcfs 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. It is necessary to perform first the calculations of which states 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 326 of file channel-access-manager.cc.

References GetBackoffEndFor(), ns3::Txop::GetBackoffSlots(), ns3::Txop::IsAccessRequested(), m_states, ns3::Txop::NotifyAccessGranted(), ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by AccessTimeout(), and RequestAccess().

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

◆ DoGrantPcfAccess()

void ns3::ChannelAccessManager::DoGrantPcfAccess ( Ptr< Txop state)
private

Grant access to PCF.

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

References ns3::Txop::NotifyAccessGranted().

Referenced by RequestAccess().

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

◆ DoRestartAccessTimeoutIfNeeded()

void ns3::ChannelAccessManager::DoRestartAccessTimeoutIfNeeded ( void  )
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 498 of file channel-access-manager.cc.

References AccessTimeout(), ns3::EventId::Cancel(), GetBackoffEndFor(), ns3::Simulator::GetDelayLeft(), ns3::Simulator::GetMaximumSimulationTime(), ns3::Txop::IsAccessRequested(), ns3::EventId::IsExpired(), ns3::EventId::IsRunning(), m_accessTimeout, m_states, min, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by AccessTimeout(), 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
private

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

References m_eifsNoDifs, m_lastAckTimeoutEnd, m_lastBusyDuration, m_lastBusyStart, m_lastCtsTimeoutEnd, m_lastNavDuration, m_lastNavStart, m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, m_lastSwitchingDuration, m_lastSwitchingStart, m_lastTxDuration, m_lastTxStart, m_sifs, MostRecent(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by GetBackoffStartFor(), IsWithinAifs(), 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 state)
private

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

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

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

References ns3::Txop::GetBackoffSlots(), GetBackoffStartFor(), m_slot, 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 state)
private

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

Parameters
state
Returns
the time when the backoff procedure started

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

References GetAccessGrantStart(), ns3::Txop::GetAifsn(), ns3::Txop::GetBackoffStart(), m_slot, MostRecent(), and NS_LOG_FUNCTION.

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 ( void  ) const
Returns
value set previously using SetEifsNoDifs.

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

References m_eifsNoDifs, and NS_LOG_FUNCTION.

Referenced by ns3::RegularWifiMac::GetEifsNoDifs().

+ Here is the caller graph for this function:

◆ IsBusy()

bool ns3::ChannelAccessManager::IsBusy ( void  ) 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 217 of file channel-access-manager.cc.

References m_lastBusyDuration, m_lastBusyStart, m_lastNavDuration, m_lastNavStart, m_lastRxEnd, m_lastTxDuration, m_lastTxStart, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by ns3::Txop::CanStartNextPolling(), and RequestAccess().

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

◆ IsWithinAifs()

bool ns3::ChannelAccessManager::IsWithinAifs ( Ptr< Txop state) const
private

Check if the device is between frames (in DIFS or AIFS interval)

Parameters
statethe state to check
Returns
true if the device is within AIFS, false otherwise

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

References GetAccessGrantStart(), ns3::Txop::GetAifsn(), ns3::Time::GetSeconds(), m_slot, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by RequestAccess().

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

◆ MostRecent()

Time ns3::ChannelAccessManager::MostRecent ( std::initializer_list< Time list) const
private

Return the most recent time.

Parameters
listthe initializer list including the times to compare
Returns
the most recent time

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

References list, and NS_ASSERT.

Referenced by GetAccessGrantStart(), GetBackoffStartFor(), and RequestAccess().

+ Here is the caller graph for this function:

◆ NotifyAckTimeoutResetNow()

void ns3::ChannelAccessManager::NotifyAckTimeoutResetNow ( void  )

Notify that ACK timer has reset.

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

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

+ Here is the call graph for this function:

◆ NotifyAckTimeoutStartNow()

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

Notify that ACK timer has started for the given duration.

Parameters
duration

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

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

Referenced by ChannelAccessManagerTest::NotifyAccessGranted().

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

◆ NotifyCtsTimeoutResetNow()

void ns3::ChannelAccessManager::NotifyCtsTimeoutResetNow ( void  )

Notify that CTS timer has reset.

Definition at line 792 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
duration

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

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

+ Here is the call graph for this function:

◆ NotifyMaybeCcaBusyStartNow()

void ns3::ChannelAccessManager::NotifyMaybeCcaBusyStartNow ( Time  duration)
Parameters
durationexpected duration of cca busy period

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

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

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

Referenced by ns3::OcbWifiMac::MakeVirtualBusy(), and ns3::PhyListener::NotifyMaybeCcaBusyStart().

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

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

Referenced by 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 753 of file channel-access-manager.cc.

References m_lastNavDuration, m_lastNavStart, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

+ Here is the call graph for this function:

◆ NotifyOffNow()

void ns3::ChannelAccessManager::NotifyOffNow ( void  )

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

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

References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_off, m_states, ns3::Txop::NotifyOff(), 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 ( void  )

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

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

References ns3::Txop::GetBackoffSlots(), ns3::Txop::m_accessRequested, m_off, m_states, ns3::Txop::NotifyOn(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Txop::ResetCw(), and ns3::Txop::UpdateBackoffSlotsNow().

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 ( void  )

Notify the DCF that a packet reception was just completed unsuccessfully.

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

References m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

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

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

◆ NotifyRxEndOkNow()

void ns3::ChannelAccessManager::NotifyRxEndOkNow ( void  )

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

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

References m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by 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 DCF that a packet reception started for the expected duration.

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

References m_lastRxDuration, m_lastRxEnd, m_lastRxStart, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

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

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

◆ NotifySleepNow()

void ns3::ChannelAccessManager::NotifySleepNow ( void  )

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

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

References ns3::EventId::Cancel(), ns3::EventId::IsRunning(), m_accessTimeout, m_sleeping, m_states, ns3::Txop::NotifySleep(), and NS_LOG_FUNCTION.

Referenced by ns3::PhyListener::NotifySleep(), and ns3::OcbWifiMac::Suspend().

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

References ns3::EventId::Cancel(), ns3::Txop::GetBackoffSlots(), ns3::EventId::IsRunning(), ns3::Txop::m_accessRequested, m_accessTimeout, m_lastAckTimeoutEnd, m_lastBusyDuration, m_lastBusyStart, m_lastCtsTimeoutEnd, m_lastNavDuration, m_lastNavStart, m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, m_lastSwitchingDuration, m_lastSwitchingStart, m_lastTxDuration, m_lastTxStart, m_states, ns3::Txop::NotifyChannelSwitching(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Txop::ResetCw(), and ns3::Txop::UpdateBackoffSlotsNow().

Referenced by ns3::PhyListener::NotifySwitchingStart(), and ns3::OcbWifiMac::Reset().

+ 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 DCF that a packet transmission was just started and is expected to last for the specified duration.

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

References m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, m_lastTxDuration, m_lastTxStart, m_sifs, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and UpdateBackoff().

Referenced by ChannelAccessManagerTest::NotifyAccessGranted(), 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 ( void  )

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

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

References ns3::Txop::GetBackoffSlots(), ns3::Txop::m_accessRequested, m_sleeping, m_states, ns3::Txop::NotifyWakeUp(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Txop::ResetCw(), and ns3::Txop::UpdateBackoffSlotsNow().

Referenced by ns3::PhyListener::NotifyWakeup(), and ns3::OcbWifiMac::Resume().

+ 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
phy

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

References m_phy, m_phyListener, NS_LOG_FUNCTION, and third::phy.

Referenced by ns3::RegularWifiMac::ResetWifiPhy().

+ Here is the caller graph for this function:

◆ RequestAccess()

void ns3::ChannelAccessManager::RequestAccess ( Ptr< Txop state,
bool  isCfPeriod = false 
)
Parameters
statea Txop
isCfPeriodflag whether it is called during the CF period

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

If there is a collision, generate a backoff by notifying the collision to the user.

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

References DoGrantDcfAccess(), DoGrantPcfAccess(), DoRestartAccessTimeoutIfNeeded(), GetAccessGrantStart(), ns3::Txop::GetBackoffSlots(), ns3::Txop::IsAccessRequested(), IsBusy(), IsWithinAifs(), m_accessTimeout, m_lastTxDuration, m_lastTxStart, m_off, m_phy, m_sleeping, MostRecent(), ns3::Txop::NotifyAccessRequested(), ns3::WifiPhy::NotifyChannelAccessRequested(), ns3::Txop::NotifyCollision(), ns3::Txop::NotifyInternalCollision(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and UpdateBackoff().

Referenced by ChannelAccessManagerTest::DoAccessRequest(), ns3::QosTxop::RestartAccessIfNeeded(), ns3::Txop::RestartAccessIfNeeded(), ns3::Txop::SendCfFrame(), ns3::QosTxop::StartAccessIfNeeded(), and ns3::Txop::StartAccessIfNeeded().

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

◆ SetEifsNoDifs()

void ns3::ChannelAccessManager::SetEifsNoDifs ( Time  eifsNoDifs)
Parameters
eifsNoDifsthe duration of a EIFS minus the duration of DIFS.

It is a bad idea to call this method after RequestAccess or one of the Notify methods has been invoked.

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

References m_eifsNoDifs, and NS_LOG_FUNCTION.

Referenced by ns3::RegularWifiMac::SetEifsNoDifs(), and ChannelAccessManagerTest::StartTest().

+ Here is the caller graph for this function:

◆ SetSifs()

void ns3::ChannelAccessManager::SetSifs ( Time  sifs)
Parameters
sifsthe duration of a SIFS.

It is a bad idea to call this method after RequestAccess or one of the Notify methods has been invoked.

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

References m_sifs, and NS_LOG_FUNCTION.

Referenced by ns3::RegularWifiMac::SetSifs(), and ChannelAccessManagerTest::StartTest().

+ Here is the caller graph for this function:

◆ SetSlot()

void ns3::ChannelAccessManager::SetSlot ( Time  slotTime)
Parameters
slotTimethe duration of a slot.

It is a bad idea to call this method after RequestAccess or one of the Notify methods has been invoked.

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

References m_slot, and NS_LOG_FUNCTION.

Referenced by ns3::RegularWifiMac::SetSlot(), and ChannelAccessManagerTest::StartTest().

+ Here is the caller graph for this function:

◆ SetupLow()

void ns3::ChannelAccessManager::SetupLow ( Ptr< MacLow low)

Set up listener for MacLow events.

Parameters
low

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

References NS_LOG_FUNCTION.

Referenced by ns3::OcbWifiMac::EnableForWave(), ns3::RegularWifiMac::RegularWifiMac(), and ChannelAccessManagerTest::StartTest().

+ Here is the caller graph for this function:

◆ SetupPhyListener()

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

Set up listener for Phy events.

Parameters
phy

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

References m_phy, m_phyListener, NS_ASSERT, NS_LOG_FUNCTION, and third::phy.

Referenced by ns3::RegularWifiMac::SetWifiPhy().

+ Here is the caller graph for this function:

◆ UpdateBackoff()

void ns3::ChannelAccessManager::UpdateBackoff ( void  )
private

Member Data Documentation

◆ m_accessTimeout

EventId ns3::ChannelAccessManager::m_accessTimeout
private

◆ m_eifsNoDifs

Time ns3::ChannelAccessManager::m_eifsNoDifs
private

EIFS no DIFS time.

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

Referenced by GetAccessGrantStart(), GetEifsNoDifs(), and SetEifsNoDifs().

◆ m_lastAckTimeoutEnd

Time ns3::ChannelAccessManager::m_lastAckTimeoutEnd
private

the last ACK timeout end time

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

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

◆ m_lastBusyDuration

Time ns3::ChannelAccessManager::m_lastBusyDuration
private

the last busy duration time

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

Referenced by GetAccessGrantStart(), IsBusy(), NotifyMaybeCcaBusyStartNow(), and NotifySwitchingStartNow().

◆ m_lastBusyStart

Time ns3::ChannelAccessManager::m_lastBusyStart
private

the last busy start time

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

Referenced by GetAccessGrantStart(), IsBusy(), NotifyMaybeCcaBusyStartNow(), and NotifySwitchingStartNow().

◆ m_lastCtsTimeoutEnd

Time ns3::ChannelAccessManager::m_lastCtsTimeoutEnd
private

the last CTS timeout end time

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

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

◆ m_lastNavDuration

Time ns3::ChannelAccessManager::m_lastNavDuration
private

the last NAV duration time

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

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

◆ m_lastNavStart

Time ns3::ChannelAccessManager::m_lastNavStart
private

the last NAV start time

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

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

◆ m_lastRxDuration

Time ns3::ChannelAccessManager::m_lastRxDuration
private

◆ m_lastRxEnd

Time ns3::ChannelAccessManager::m_lastRxEnd
private

◆ m_lastRxReceivedOk

bool ns3::ChannelAccessManager::m_lastRxReceivedOk
private

◆ m_lastRxStart

Time ns3::ChannelAccessManager::m_lastRxStart
private

◆ m_lastSwitchingDuration

Time ns3::ChannelAccessManager::m_lastSwitchingDuration
private

the last switching duration time

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

Referenced by GetAccessGrantStart(), and NotifySwitchingStartNow().

◆ m_lastSwitchingStart

Time ns3::ChannelAccessManager::m_lastSwitchingStart
private

the last switching start time

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

Referenced by GetAccessGrantStart(), and NotifySwitchingStartNow().

◆ m_lastTxDuration

Time ns3::ChannelAccessManager::m_lastTxDuration
private

the last transmit duration time

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

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

◆ m_lastTxStart

Time ns3::ChannelAccessManager::m_lastTxStart
private

the last transmit start time

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

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

◆ m_off

bool ns3::ChannelAccessManager::m_off
private

flag whether it is in off state

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

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

◆ m_phy

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

Ptr to the PHY.

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

Referenced by DoDispose(), RemovePhyListener(), RequestAccess(), and SetupPhyListener().

◆ m_phyListener

PhyListener* ns3::ChannelAccessManager::m_phyListener
private

the phy listener

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

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

◆ m_sifs

Time ns3::ChannelAccessManager::m_sifs
private

the SIFS time

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

Referenced by GetAccessGrantStart(), NotifyTxStartNow(), and SetSifs().

◆ m_sleeping

bool ns3::ChannelAccessManager::m_sleeping
private

flag whether it is in sleeping state

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

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

◆ m_slot

Time ns3::ChannelAccessManager::m_slot
private

the slot time

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

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

◆ m_states


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