keep track of the state needed for a single DCF function. More...
#include <dcf-manager.h>
Public Member Functions | |
DcfState () | |
virtual | ~DcfState () |
void | SetAifsn (uint32_t aifsn) |
void | SetCwMin (uint32_t minCw) |
void | SetCwMax (uint32_t maxCw) |
uint32_t | GetAifsn (void) const |
uint32_t | GetCwMin (void) const |
uint32_t | GetCwMax (void) const |
void | ResetCw (void) |
void | UpdateFailedCw (void) |
void | StartBackoffNow (uint32_t nSlots) |
uint32_t | GetCw (void) const |
bool | IsAccessRequested (void) const |
Private Member Functions | |
uint32_t | GetBackoffSlots (void) const |
Time | GetBackoffStart (void) const |
void | UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound) |
void | NotifyAccessRequested (void) |
void | NotifyAccessGranted (void) |
void | NotifyCollision (void) |
void | NotifyInternalCollision (void) |
virtual void | DoNotifyAccessGranted (void)=0 |
virtual void | DoNotifyInternalCollision (void)=0 |
virtual void | DoNotifyCollision (void)=0 |
Private Attributes | |
uint32_t | m_aifsn |
uint32_t | m_backoffSlots |
Time | m_backoffStart |
uint32_t | m_cwMin |
uint32_t | m_cwMax |
uint32_t | m_cw |
bool | m_accessRequested |
Friends | |
class | DcfManager |
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 22 of file dcf-manager.h.
ns3::DcfState::DcfState | ( | ) |
Definition at line 24 of file dcf-manager.cc.
ns3::DcfState::~DcfState | ( | ) | [virtual] |
Definition at line 33 of file dcf-manager.cc.
virtual void ns3::DcfState::DoNotifyAccessGranted | ( | void | ) | [private, pure virtual] |
Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start immediately.
Implemented in ns3::DcaTxop::Dcf, and ns3::DcfStateTest.
Referenced by NotifyAccessGranted().
virtual void ns3::DcfState::DoNotifyCollision | ( | void | ) | [private, pure 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.
The subclass is expected to start a new backoff by calling DcfState::StartBackoffNow and DcfManager::RequestAccess is access is still needed.
Implemented in ns3::DcaTxop::Dcf, and ns3::DcfStateTest.
Referenced by NotifyCollision().
virtual void ns3::DcfState::DoNotifyInternalCollision | ( | void | ) | [private, pure 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::DcaTxop::Dcf, and ns3::DcfStateTest.
Referenced by NotifyInternalCollision().
uint32_t ns3::DcfState::GetAifsn | ( | void | ) | const |
Definition at line 54 of file dcf-manager.cc.
References m_aifsn.
Referenced by ns3::DcaTxop::GetAifsn(), and ns3::DcfManager::GetBackoffStartFor().
uint32_t ns3::DcfState::GetBackoffSlots | ( | void | ) | const [private] |
Definition at line 105 of file dcf-manager.cc.
References m_backoffSlots.
Referenced by ns3::DcfManager::DoGrantAccess(), ns3::DcfManager::GetBackoffEndFor(), ns3::DcfManager::RequestAccess(), and ns3::DcfManager::UpdateBackoff().
Time ns3::DcfState::GetBackoffStart | ( | void | ) | const [private] |
Definition at line 110 of file dcf-manager.cc.
References m_backoffStart.
Referenced by ns3::DcfManager::GetBackoffStartFor().
uint32_t ns3::DcfState::GetCw | ( | void | ) | const |
Definition at line 100 of file dcf-manager.cc.
References m_cw.
Referenced by ns3::DcaTxop::GotAck(), ns3::DcaTxop::MissedAck(), ns3::DcaTxop::MissedCts(), ns3::DcaTxop::NotifyAccessGranted(), and ns3::DcaTxop::NotifyCollision().
uint32_t ns3::DcfState::GetCwMax | ( | void | ) | const |
Definition at line 64 of file dcf-manager.cc.
References m_cwMax.
Referenced by ns3::DcaTxop::GetMaxCw().
uint32_t ns3::DcfState::GetCwMin | ( | void | ) | const |
Definition at line 59 of file dcf-manager.cc.
References m_cwMin.
Referenced by ns3::DcaTxop::GetMinCw().
bool ns3::DcfState::IsAccessRequested | ( | void | ) | const |
Definition at line 115 of file dcf-manager.cc.
References m_accessRequested.
Referenced by ns3::DcfManager::DoGrantAccess(), ns3::DcfManager::DoRestartAccessTimeoutIfNeeded(), ns3::DcfManager::RequestAccess(), ns3::DcaTxop::RestartAccessIfNeeded(), and ns3::DcaTxop::StartAccessIfNeeded().
void ns3::DcfState::NotifyAccessGranted | ( | void | ) | [private] |
Definition at line 125 of file dcf-manager.cc.
References DoNotifyAccessGranted(), m_accessRequested, and NS_ASSERT.
Referenced by ns3::DcfManager::DoGrantAccess().
void ns3::DcfState::NotifyAccessRequested | ( | void | ) | [private] |
Definition at line 120 of file dcf-manager.cc.
References m_accessRequested.
Referenced by ns3::DcfManager::RequestAccess().
void ns3::DcfState::NotifyCollision | ( | void | ) | [private] |
Definition at line 132 of file dcf-manager.cc.
References DoNotifyCollision().
Referenced by ns3::DcfManager::RequestAccess().
void ns3::DcfState::NotifyInternalCollision | ( | void | ) | [private] |
Definition at line 137 of file dcf-manager.cc.
References DoNotifyInternalCollision().
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 70 of file dcf-manager.cc.
Referenced by ns3::DcaTxop::GotAck(), ns3::DcaTxop::MissedAck(), ns3::DcaTxop::MissedCts(), ns3::DcaTxop::NotifyAccessGranted(), SetCwMax(), and SetCwMin().
void ns3::DcfState::SetAifsn | ( | uint32_t | aifsn | ) |
aifsn | the 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 37 of file dcf-manager.cc.
References m_aifsn.
Referenced by ns3::DcfManagerTest::AddDcfState(), and ns3::DcaTxop::SetAifsn().
void ns3::DcfState::SetCwMax | ( | uint32_t | maxCw | ) |
Definition at line 48 of file dcf-manager.cc.
References m_cwMax, and ResetCw().
Referenced by ns3::DcaTxop::SetMaxCw().
void ns3::DcfState::SetCwMin | ( | uint32_t | minCw | ) |
Definition at line 42 of file dcf-manager.cc.
References m_cwMin, and ResetCw().
Referenced by ns3::DcaTxop::SetMinCw().
void ns3::DcfState::StartBackoffNow | ( | uint32_t | nSlots | ) |
nSlots | the number of slots of the backoff. |
Start a backoff by initializing the backoff counter to the number of slots specified.
Definition at line 91 of file dcf-manager.cc.
References m_backoffSlots, m_backoffStart, MY_DEBUG, ns3::Now(), and NS_ASSERT.
Referenced by ns3::DcaTxop::GotAck(), ns3::DcaTxop::MissedAck(), ns3::DcaTxop::MissedCts(), ns3::DcaTxop::NotifyAccessGranted(), ns3::DcfManagerTest::NotifyCollision(), ns3::DcaTxop::NotifyCollision(), and ns3::DcfManagerTest::NotifyInternalCollision().
void ns3::DcfState::UpdateBackoffSlotsNow | ( | uint32_t | nSlots, | |
Time | backoffUpdateBound | |||
) | [private] |
Definition at line 83 of file dcf-manager.cc.
References m_backoffSlots, m_backoffStart, and MY_DEBUG.
Referenced by ns3::DcfManager::UpdateBackoff().
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 75 of file dcf-manager.cc.
Referenced by ns3::DcaTxop::MissedAck(), and ns3::DcaTxop::MissedCts().
friend class DcfManager [friend] |
Definition at line 73 of file dcf-manager.h.
bool ns3::DcfState::m_accessRequested [private] |
Definition at line 122 of file dcf-manager.h.
Referenced by IsAccessRequested(), NotifyAccessGranted(), and NotifyAccessRequested().
uint32_t ns3::DcfState::m_aifsn [private] |
Definition at line 113 of file dcf-manager.h.
Referenced by GetAifsn(), and SetAifsn().
uint32_t ns3::DcfState::m_backoffSlots [private] |
Definition at line 114 of file dcf-manager.h.
Referenced by GetBackoffSlots(), StartBackoffNow(), and UpdateBackoffSlotsNow().
Time ns3::DcfState::m_backoffStart [private] |
Definition at line 118 of file dcf-manager.h.
Referenced by GetBackoffStart(), StartBackoffNow(), and UpdateBackoffSlotsNow().
uint32_t ns3::DcfState::m_cw [private] |
Definition at line 121 of file dcf-manager.h.
Referenced by GetCw(), ResetCw(), and UpdateFailedCw().
uint32_t ns3::DcfState::m_cwMax [private] |
Definition at line 120 of file dcf-manager.h.
Referenced by GetCwMax(), SetCwMax(), and UpdateFailedCw().
uint32_t ns3::DcfState::m_cwMin [private] |
Definition at line 119 of file dcf-manager.h.
Referenced by GetCwMin(), ResetCw(), and SetCwMin().