ns3::DcfManager Class Reference

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

#include <dcf-manager.h>

Collaboration diagram for ns3::DcfManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DcfManager ()
 ~DcfManager ()
void SetupPhyListener (Ptr< WifiPhy > phy)
void SetupLowListener (Ptr< MacLow > low)
void SetSlot (Time slotTime)
void SetSifs (Time sifs)
void SetEifsNoDifs (Time eifsNoDifs)
void Add (DcfState *dcf)
void RequestAccess (DcfState *state)
void NotifyRxStartNow (Time duration)
void NotifyRxEndOkNow (void)
void NotifyRxEndErrorNow (void)
void NotifyTxStartNow (Time duration)
void NotifyMaybeCcaBusyStartNow (Time duration)
void NotifyNavResetNow (Time duration)
void NotifyNavStartNow (Time duration)

Private Types

typedef std::vector< DcfState * > States

Private Member Functions

void UpdateBackoff (void)
Time MostRecent (Time a, Time b) const
Time MostRecent (Time a, Time b, Time c) const
Time MostRecent (Time a, Time b, Time c, Time d) const
Time GetAccessGrantStart (void) const
Time GetBackoffStartFor (DcfState *state)
Time GetBackoffEndFor (DcfState *state)
void DoRestartAccessTimeoutIfNeeded (void)
void AccessTimeout (void)
void DoGrantAccess (void)
bool IsBusy (void) const

Private Attributes

States m_states
Time m_lastNavStart
Time m_lastNavDuration
Time m_lastRxStart
Time m_lastRxDuration
bool m_lastRxReceivedOk
Time m_lastRxEnd
Time m_lastTxStart
Time m_lastTxDuration
Time m_lastBusyStart
Time m_lastBusyDuration
bool m_rxing
bool m_sleeping
Time m_eifsNoDifs
EventId m_accessTimeout
Time m_slotTime
Time m_sifs
class PhyListenerm_phyListener
class LowNavListenerm_lowListener

Detailed Description

Manage a set of ns3::DcfState.

Handle a set of independent ns3::DcfState, each of which represents a single DCF within a MAC stack. Each ns3::DcfState has a priority implicitely associated with it (the priority is determined when the ns3::DcfState is added to the DcfManager: the first DcfState 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 DcfState are expected to get access to the medium at the same time, the highest priority local DcfState wins access to the medium and the other DcfState suffers a "internal" collision.

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


Member Typedef Documentation

typedef std::vector<DcfState *> ns3::DcfManager::States [private]

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


Constructor & Destructor Documentation

ns3::DcfManager::DcfManager (  ) 

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

ns3::DcfManager::~DcfManager (  ) 

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

References m_lowListener, and m_phyListener.


Member Function Documentation

void ns3::DcfManager::AccessTimeout ( void   )  [private]
void ns3::DcfManager::Add ( DcfState dcf  ) 
Parameters:
dcf a new DcfState.

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

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

References m_states.

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

void ns3::DcfManager::DoGrantAccess ( void   )  [private]

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 324 of file dcf-manager.cc.

References GetAccessGrantStart(), GetBackoffEndFor(), ns3::DcfState::GetBackoffSlots(), ns3::DcfState::IsAccessRequested(), m_states, MY_DEBUG, ns3::DcfState::NotifyAccessGranted(), and ns3::Now().

Referenced by AccessTimeout(), and RequestAccess().

void ns3::DcfManager::DoRestartAccessTimeoutIfNeeded ( void   )  [private]
Time ns3::DcfManager::GetAccessGrantStart ( void   )  const [private]

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

Returns:
the absolute time at which access could start to be granted

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

References m_eifsNoDifs, m_lastBusyDuration, m_lastBusyStart, m_lastNavDuration, m_lastNavStart, m_lastRxDuration, m_lastRxEnd, m_lastRxReceivedOk, m_lastRxStart, m_lastTxDuration, m_lastTxStart, m_sifs, MostRecent(), and NS_LOG_INFO.

Referenced by DoGrantAccess(), and GetBackoffStartFor().

Time ns3::DcfManager::GetBackoffEndFor ( DcfState state  )  [private]
Time ns3::DcfManager::GetBackoffStartFor ( DcfState state  )  [private]
bool ns3::DcfManager::IsBusy ( void   )  const [private]
Time ns3::DcfManager::MostRecent ( Time  a,
Time  b,
Time  c,
Time  d 
) const [private]

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

References ns3::Max().

Time ns3::DcfManager::MostRecent ( Time  a,
Time  b,
Time  c 
) const [private]

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

References ns3::Max().

Time ns3::DcfManager::MostRecent ( Time  a,
Time  b 
) const [private]

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

References ns3::Max().

Referenced by GetAccessGrantStart(), and GetBackoffStartFor().

void ns3::DcfManager::NotifyMaybeCcaBusyStartNow ( Time  duration  ) 
Parameters:
duration expected duration of cca busy period

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

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

References m_lastBusyDuration, m_lastBusyStart, MY_DEBUG, ns3::Now(), and UpdateBackoff().

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

void ns3::DcfManager::NotifyNavResetNow ( Time  duration  ) 
Parameters:
duration the 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 539 of file dcf-manager.cc.

References DoRestartAccessTimeoutIfNeeded(), m_lastNavDuration, m_lastNavStart, MY_DEBUG, ns3::Now(), and UpdateBackoff().

Referenced by ns3::DcfManagerTest::AddNavReset(), and ns3::LowNavListener::NavReset().

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

Called at end of rx

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

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

Referenced by ns3::DcfManagerTest::AddNavStart(), and ns3::LowNavListener::NavStart().

void ns3::DcfManager::NotifyRxEndErrorNow ( void   ) 

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

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

References m_lastRxEnd, m_lastRxReceivedOk, m_rxing, MY_DEBUG, and ns3::Now().

Referenced by ns3::DcfManagerTest::AddRxErrorEvt(), and ns3::PhyListener::NotifyRxEndError().

void ns3::DcfManager::NotifyRxEndOkNow ( void   ) 

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

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

References m_lastRxEnd, m_lastRxReceivedOk, m_rxing, MY_DEBUG, and ns3::Now().

Referenced by ns3::DcfManagerTest::AddRxOkEvt(), and ns3::PhyListener::NotifyRxEndOk().

void ns3::DcfManager::NotifyRxStartNow ( Time  duration  ) 
Parameters:
duration expected duration of reception

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

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

References m_lastRxDuration, m_lastRxStart, m_rxing, MY_DEBUG, ns3::Now(), and UpdateBackoff().

Referenced by ns3::DcfManagerTest::AddRxErrorEvt(), ns3::DcfManagerTest::AddRxOkEvt(), and ns3::PhyListener::NotifyRxStart().

void ns3::DcfManager::NotifyTxStartNow ( Time  duration  ) 
Parameters:
duration expected 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 523 of file dcf-manager.cc.

References m_lastTxDuration, m_lastTxStart, MY_DEBUG, ns3::Now(), and UpdateBackoff().

Referenced by ns3::DcfManagerTest::NotifyAccessGranted(), and ns3::PhyListener::NotifyTxStart().

void ns3::DcfManager::RequestAccess ( DcfState state  ) 
Parameters:
state a DcfState

Notify the DcfManager that a specific DcfState needs access to the medium. The DcfManager is then responsible for starting an access timer and, invoking DcfState::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 301 of file dcf-manager.cc.

References DoGrantAccess(), DoRestartAccessTimeoutIfNeeded(), ns3::DcfState::GetBackoffSlots(), ns3::DcfState::IsAccessRequested(), IsBusy(), MY_DEBUG, ns3::DcfState::NotifyAccessRequested(), ns3::DcfState::NotifyCollision(), NS_ASSERT, and UpdateBackoff().

Referenced by ns3::DcfManagerTest::DoAccessRequest(), ns3::DcaTxop::RestartAccessIfNeeded(), and ns3::DcaTxop::StartAccessIfNeeded().

void ns3::DcfManager::SetEifsNoDifs ( Time  eifsNoDifs  ) 
Parameters:
eifsNoDifs the 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 244 of file dcf-manager.cc.

References m_eifsNoDifs.

Referenced by ns3::NqstaWifiMac::SetEifsNoDifs(), ns3::NqapWifiMac::SetEifsNoDifs(), ns3::AdhocWifiMac::SetEifsNoDifs(), and ns3::DcfManagerTest::StartTest().

void ns3::DcfManager::SetSifs ( Time  sifs  ) 
Parameters:
sifs the 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 239 of file dcf-manager.cc.

References m_sifs.

Referenced by ns3::NqstaWifiMac::SetSifs(), ns3::NqapWifiMac::SetSifs(), ns3::AdhocWifiMac::SetSifs(), and ns3::DcfManagerTest::StartTest().

void ns3::DcfManager::SetSlot ( Time  slotTime  ) 
Parameters:
slotTime the 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 234 of file dcf-manager.cc.

References m_slotTime.

Referenced by ns3::NqstaWifiMac::SetSlot(), ns3::NqapWifiMac::SetSlot(), ns3::AdhocWifiMac::SetSlot(), and ns3::DcfManagerTest::StartTest().

void ns3::DcfManager::SetupLowListener ( Ptr< MacLow low  ) 
void ns3::DcfManager::SetupPhyListener ( Ptr< WifiPhy phy  ) 
void ns3::DcfManager::UpdateBackoff ( void   )  [private]

Member Data Documentation

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

Referenced by DoRestartAccessTimeoutIfNeeded().

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

Referenced by GetAccessGrantStart(), and SetEifsNoDifs().

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

Referenced by GetAccessGrantStart(), and NotifyMaybeCcaBusyStartNow().

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

Referenced by GetAccessGrantStart(), and NotifyMaybeCcaBusyStartNow().

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

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

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

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

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

Referenced by GetAccessGrantStart(), and NotifyRxStartNow().

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

Referenced by GetAccessGrantStart(), NotifyRxEndErrorNow(), and NotifyRxEndOkNow().

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

Referenced by GetAccessGrantStart(), NotifyRxEndErrorNow(), and NotifyRxEndOkNow().

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

Referenced by GetAccessGrantStart(), and NotifyRxStartNow().

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

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

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

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

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

Referenced by SetupLowListener(), and ~DcfManager().

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

Referenced by SetupPhyListener(), and ~DcfManager().

bool ns3::DcfManager::m_rxing [private]

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

Referenced by IsBusy(), NotifyRxEndErrorNow(), NotifyRxEndOkNow(), and NotifyRxStartNow().

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

Referenced by GetAccessGrantStart(), and SetSifs().

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

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

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

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

Referenced by Add(), DoGrantAccess(), DoRestartAccessTimeoutIfNeeded(), and UpdateBackoff().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:11:02 2009 for NS-3 by  doxygen 1.6.3