A Discrete-Event Network Simulator
API
ns3::DcfState Class Referenceabstract

keep track of the state needed for a single DCF function. More...

#include "dcf-manager.h"

+ Inheritance diagram for ns3::DcfState:
+ Collaboration diagram for ns3::DcfState:

Public Member Functions

 DcfState ()
 
virtual ~DcfState ()
 
uint32_t GetAifsn (void) const
 Return the number of slots that make up an AIFS. More...
 
uint32_t GetCw (void) const
 
uint32_t GetCwMax (void) const
 Return the maximum congestion window size. More...
 
uint32_t GetCwMin (void) const
 Return the minimum congestion window size. More...
 
Time GetTxopLimit (void) const
 Return the TXOP limit. More...
 
bool IsAccessRequested (void) const
 
virtual bool IsEdca (void) const =0
 
void ResetCw (void)
 Update the value of the CW variable to take into account a transmission success or a transmission abort (stop transmission of a packet after the maximum number of retransmissions has been reached). More...
 
void SetAifsn (uint32_t aifsn)
 
void SetCwMax (uint32_t maxCw)
 Set the maximum congestion window size. More...
 
void SetCwMin (uint32_t minCw)
 Set the minimum congestion window size. More...
 
void SetTxopLimit (Time txopLimit)
 Set the TXOP limit. More...
 
void StartBackoffNow (uint32_t nSlots)
 
void UpdateFailedCw (void)
 Update the value of the CW variable to take into account a transmission failure. More...
 

Private Member Functions

virtual void DoNotifyAccessGranted (void)=0
 Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start immediately. More...
 
virtual void DoNotifyChannelSwitching (void)=0
 Called by DcfManager to notify a DcfState subclass that a channel switching occured. More...
 
virtual void DoNotifyCollision (void)=0
 Called by DcfManager to notify a DcfState subclass that a normal collision occured, that is, that the medium was busy when access was requested. More...
 
virtual void DoNotifyInternalCollision (void)=0
 Called by DcfManager to notify a DcfState subclass that an 'internal' collision occured, that is, that the backoff timer of a higher priority DcfState expired at the same time and that access was granted to this higher priority DcfState. More...
 
virtual void DoNotifySleep (void)=0
 Called by DcfManager to notify a DcfState subclass that the device has begun to sleep. More...
 
virtual void DoNotifyWakeUp (void)=0
 Called by DcfManager to notify a DcfState subclass that the device has begun to wake up. More...
 
uint32_t GetBackoffSlots (void) const
 Return the current number of backoff slots. More...
 
Time GetBackoffStart (void) const
 Return the time when the backoff procedure started. More...
 
void NotifyAccessGranted (void)
 Notify that access has been granted. More...
 
void NotifyAccessRequested (void)
 Notify that access request has been received. More...
 
void NotifyChannelSwitching (void)
 Notify that the device is switching channel. More...
 
void NotifyCollision (void)
 Notify that collision has occurred. More...
 
void NotifyInternalCollision (void)
 Notify that internal collision has occurred. More...
 
void NotifySleep (void)
 Notify that the device has started to sleep. More...
 
void NotifyWakeUp (void)
 Notify that the device has started to wake up. More...
 
void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
 Update backoff slots that nSlots has passed. More...
 

Private Attributes

bool m_accessRequested
 
uint32_t m_aifsn
 
uint32_t m_backoffSlots
 
Time m_backoffStart
 
uint32_t m_cw
 
uint32_t m_cwMax
 
uint32_t m_cwMin
 
Time m_txopLimit
 

Friends

class DcfManager
 

Detailed Description

keep track of the state needed for a single DCF function.

Multiple instances of a DcfState can be registered in a single DcfManager to implement 802.11e-style relative QoS. DcfState::SetAifsn and DcfState::SetCwBounds allow the user to control the relative QoS differentiation.

Definition at line 46 of file dcf-manager.h.

Constructor & Destructor Documentation

ns3::DcfState::DcfState ( )

Definition at line 41 of file dcf-manager.cc.

ns3::DcfState::~DcfState ( )
virtual

Definition at line 51 of file dcf-manager.cc.

Member Function Documentation

virtual void ns3::DcfState::DoNotifyAccessGranted ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start immediately.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifyAccessGranted().

+ Here is the caller graph for this function:

virtual void ns3::DcfState::DoNotifyChannelSwitching ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that a channel switching occured.

The subclass is expected to flush the queue of packets.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifyChannelSwitching().

+ Here is the caller graph for this function:

virtual void ns3::DcfState::DoNotifyCollision ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that a normal collision occured, that is, that the medium was busy when access was requested.

This may also be called if the request for access occurred within the DIFS or AIFS between two frames.

The subclass is expected to start a new backoff by calling DcfState::StartBackoffNow and DcfManager::RequestAccess is access is still needed.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifyCollision().

+ Here is the caller graph for this function:

virtual void ns3::DcfState::DoNotifyInternalCollision ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that an 'internal' collision occured, that is, that the backoff timer of a higher priority DcfState expired at the same time and that access was granted to this higher priority DcfState.

The subclass is expected to start a new backoff by calling DcfState::StartBackoffNow and DcfManager::RequestAccess is access is still needed.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifyInternalCollision().

+ Here is the caller graph for this function:

virtual void ns3::DcfState::DoNotifySleep ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that the device has begun to sleep.

The subclass is expected to re-insert the pending packet into the queue

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifySleep().

+ Here is the caller graph for this function:

virtual void ns3::DcfState::DoNotifyWakeUp ( void  )
privatepure virtual

Called by DcfManager to notify a DcfState subclass that the device has begun to wake up.

The subclass is expected to restart a new backoff by calling DcfState::StartBackoffNow and DcfManager::RequestAccess is access is still needed.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by NotifyWakeUp().

+ Here is the caller graph for this function:

uint32_t ns3::DcfState::GetAifsn ( void  ) const

Return the number of slots that make up an AIFS.

Returns
the number of slots that make up an AIFS

Definition at line 91 of file dcf-manager.cc.

References m_aifsn.

Referenced by ns3::DcaTxop::GetAifsn(), ns3::EdcaTxopN::GetAifsn(), ns3::DcfManager::GetBackoffStartFor(), and ns3::DcfManager::IsWithinAifs().

+ Here is the caller graph for this function:

uint32_t ns3::DcfState::GetBackoffSlots ( void  ) const
private

Return the current number of backoff slots.

Returns
the current number of backoff slots

Definition at line 157 of file dcf-manager.cc.

References m_backoffSlots.

Referenced by ns3::DcfManager::DoGrantAccess(), ns3::DcfManager::GetBackoffEndFor(), ns3::DcfManager::NotifySwitchingStartNow(), ns3::DcfManager::NotifyWakeupNow(), ns3::DcfManager::RequestAccess(), and ns3::DcfManager::UpdateBackoff().

+ Here is the caller graph for this function:

Time ns3::DcfState::GetBackoffStart ( void  ) const
private

Return the time when the backoff procedure started.

Returns
the time when the backoff procedure started

Definition at line 163 of file dcf-manager.cc.

References m_backoffStart.

Referenced by ns3::DcfManager::GetBackoffStartFor().

+ Here is the caller graph for this function:

uint32_t ns3::DcfState::GetCwMax ( void  ) const

Return the maximum congestion window size.

Returns
the maximum congestion window size

Definition at line 109 of file dcf-manager.cc.

References m_cwMax.

Referenced by ns3::DcaTxop::GetMaxCw(), and ns3::EdcaTxopN::GetMaxCw().

+ Here is the caller graph for this function:

uint32_t ns3::DcfState::GetCwMin ( void  ) const

Return the minimum congestion window size.

Returns
the minimum congestion window size

Definition at line 103 of file dcf-manager.cc.

References m_cwMin.

Referenced by ns3::DcaTxop::GetMinCw(), and ns3::EdcaTxopN::GetMinCw().

+ Here is the caller graph for this function:

Time ns3::DcfState::GetTxopLimit ( void  ) const

Return the TXOP limit.

Returns
the TXOP limit

Definition at line 97 of file dcf-manager.cc.

References m_txopLimit.

Referenced by ns3::DcaTxop::GetTxopLimit(), and ns3::EdcaTxopN::GetTxopLimit().

+ Here is the caller graph for this function:

bool ns3::DcfState::IsAccessRequested ( void  ) const
Returns
true if access has been requested for this DcfState and has not been granted already, false otherwise.

Definition at line 169 of file dcf-manager.cc.

References m_accessRequested.

Referenced by ns3::DcfManager::DoGrantAccess(), ns3::DcfManager::DoRestartAccessTimeoutIfNeeded(), ns3::DcfManager::RequestAccess(), ns3::DcaTxop::RestartAccessIfNeeded(), ns3::EdcaTxopN::RestartAccessIfNeeded(), ns3::DcaTxop::StartAccessIfNeeded(), and ns3::EdcaTxopN::StartAccessIfNeeded().

+ Here is the caller graph for this function:

virtual bool ns3::DcfState::IsEdca ( void  ) const
pure virtual
Returns
whether this DCF state is an EDCA state

This method, which must be overridden in derived classes, indicates whether DCF or EDCAF rules should be used for this channel access function. This affects the behavior of DcfManager when dealing with this instance.

Implemented in ns3::EdcaTxopN::Dcf, ns3::DcaTxop::Dcf, and DcfStateTest.

Referenced by ns3::DcfManager::UpdateBackoff().

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyAccessGranted ( void  )
private

Notify that access has been granted.

Definition at line 180 of file dcf-manager.cc.

References DoNotifyAccessGranted(), m_accessRequested, and NS_ASSERT.

Referenced by ns3::DcfManager::DoGrantAccess().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyAccessRequested ( void  )
private

Notify that access request has been received.

Definition at line 174 of file dcf-manager.cc.

References m_accessRequested.

Referenced by ns3::DcfManager::RequestAccess().

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyChannelSwitching ( void  )
private

Notify that the device is switching channel.

Definition at line 200 of file dcf-manager.cc.

References DoNotifyChannelSwitching().

Referenced by ns3::DcfManager::NotifySwitchingStartNow().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyCollision ( void  )
private

Notify that collision has occurred.

Definition at line 188 of file dcf-manager.cc.

References DoNotifyCollision().

Referenced by ns3::DcfManager::RequestAccess().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyInternalCollision ( void  )
private

Notify that internal collision has occurred.

Definition at line 194 of file dcf-manager.cc.

References DoNotifyInternalCollision().

Referenced by ns3::DcfManager::RequestAccess().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::NotifySleep ( void  )
private

Notify that the device has started to sleep.

Definition at line 206 of file dcf-manager.cc.

References DoNotifySleep().

Referenced by ns3::DcfManager::NotifySleepNow().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::NotifyWakeUp ( void  )
private

Notify that the device has started to wake up.

Definition at line 212 of file dcf-manager.cc.

References DoNotifyWakeUp().

Referenced by ns3::DcfManager::NotifyWakeupNow().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::ResetCw ( void  )

Update the value of the CW variable to take into account a transmission success or a transmission abort (stop transmission of a packet after the maximum number of retransmissions has been reached).

By default, this resets the CW variable to minCW.

Definition at line 115 of file dcf-manager.cc.

References m_cw, and m_cwMin.

Referenced by ns3::DcaTxop::DoInitialize(), ns3::EdcaTxopN::DoInitialize(), ns3::DcaTxop::EndTxNoAck(), ns3::EdcaTxopN::EndTxNoAck(), ns3::DcaTxop::GotAck(), ns3::EdcaTxopN::GotAck(), ns3::EdcaTxopN::GotBlockAck(), ns3::DcaTxop::MissedAck(), ns3::EdcaTxopN::MissedAck(), ns3::EdcaTxopN::MissedBlockAck(), ns3::DcaTxop::MissedCts(), ns3::EdcaTxopN::MissedCts(), ns3::EdcaTxopN::NotifyInternalCollision(), ns3::DcfManager::NotifySwitchingStartNow(), ns3::DcfManager::NotifyWakeupNow(), SetCwMax(), and SetCwMin().

+ Here is the caller graph for this function:

void ns3::DcfState::SetAifsn ( uint32_t  aifsn)
Parameters
aifsnthe number of slots which make up an AIFS for a specific DCF. a DIFS corresponds to an AIFSN = 2.

Calling this method after DcfManager::Add has been called is not recommended.

Definition at line 56 of file dcf-manager.cc.

References m_aifsn.

Referenced by DcfManagerTest::AddDcfState(), ns3::DcaTxop::SetAifsn(), and ns3::EdcaTxopN::SetAifsn().

+ Here is the caller graph for this function:

void ns3::DcfState::SetCwMax ( uint32_t  maxCw)

Set the maximum congestion window size.

Parameters
maxCwthe maximum congestion window size

Definition at line 80 of file dcf-manager.cc.

References m_cwMax, and ResetCw().

Referenced by ns3::DcaTxop::SetMaxCw(), and ns3::EdcaTxopN::SetMaxCw().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::SetCwMin ( uint32_t  minCw)

Set the minimum congestion window size.

Parameters
minCwthe minimum congestion window size

Definition at line 69 of file dcf-manager.cc.

References m_cwMin, and ResetCw().

Referenced by ns3::DcaTxop::SetMinCw(), and ns3::EdcaTxopN::SetMinCw().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::SetTxopLimit ( Time  txopLimit)

Set the TXOP limit.

Parameters
txopLimitthe TXOP limit

Definition at line 62 of file dcf-manager.cc.

References ns3::Time::GetMicroSeconds(), m_txopLimit, and NS_ASSERT_MSG.

Referenced by ns3::DcaTxop::SetTxopLimit(), and ns3::EdcaTxopN::SetTxopLimit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::DcfState::StartBackoffNow ( uint32_t  nSlots)
void ns3::DcfState::UpdateBackoffSlotsNow ( uint32_t  nSlots,
Time  backoffUpdateBound 
)
private

Update backoff slots that nSlots has passed.

Parameters
nSlots
backoffUpdateBound

Definition at line 128 of file dcf-manager.cc.

References m_backoffSlots, m_backoffStart, and MY_DEBUG.

Referenced by ns3::DcfManager::NotifySwitchingStartNow(), ns3::DcfManager::NotifyWakeupNow(), and ns3::DcfManager::UpdateBackoff().

+ Here is the caller graph for this function:

void ns3::DcfState::UpdateFailedCw ( void  )

Update the value of the CW variable to take into account a transmission failure.

By default, this triggers a doubling of CW (capped by maxCW).

Definition at line 121 of file dcf-manager.cc.

References m_cw, m_cwMax, and min.

Referenced by ns3::DcaTxop::MissedAck(), ns3::EdcaTxopN::MissedAck(), ns3::EdcaTxopN::MissedBlockAck(), ns3::DcaTxop::MissedCts(), ns3::EdcaTxopN::MissedCts(), and ns3::EdcaTxopN::NotifyInternalCollision().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class DcfManager
friend

Definition at line 145 of file dcf-manager.h.

Referenced by DcfManagerTest::StartTest().

Member Data Documentation

bool ns3::DcfState::m_accessRequested
private
uint32_t ns3::DcfState::m_aifsn
private

Definition at line 250 of file dcf-manager.h.

Referenced by GetAifsn(), and SetAifsn().

uint32_t ns3::DcfState::m_backoffSlots
private

Definition at line 251 of file dcf-manager.h.

Referenced by GetBackoffSlots(), StartBackoffNow(), and UpdateBackoffSlotsNow().

Time ns3::DcfState::m_backoffStart
private

Definition at line 255 of file dcf-manager.h.

Referenced by GetBackoffStart(), StartBackoffNow(), and UpdateBackoffSlotsNow().

uint32_t ns3::DcfState::m_cw
private

Definition at line 258 of file dcf-manager.h.

Referenced by GetCw(), ResetCw(), and UpdateFailedCw().

uint32_t ns3::DcfState::m_cwMax
private

Definition at line 257 of file dcf-manager.h.

Referenced by GetCwMax(), SetCwMax(), and UpdateFailedCw().

uint32_t ns3::DcfState::m_cwMin
private

Definition at line 256 of file dcf-manager.h.

Referenced by GetCwMin(), ResetCw(), and SetCwMin().

Time ns3::DcfState::m_txopLimit
private

Definition at line 259 of file dcf-manager.h.

Referenced by GetTxopLimit(), and SetTxopLimit().


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