This class uses a simple mechanism to assign channel access with following features: (1) only in the context of single-PHY device; (2) FCFS (First come First service) strategy, which seems against the description of the standard (preemptive strategy). More...
#include "default-channel-scheduler.h"
Public Member Functions | |
DefaultChannelScheduler () | |
virtual | ~DefaultChannelScheduler () |
virtual enum ChannelAccess | GetAssignedAccessType (uint32_t channelNumber) const |
void | NotifyCchSlotStart (Time duration) |
void | NotifyGuardSlotStart (Time duration, bool cchi) |
void | NotifySchSlotStart (Time duration) |
virtual void | SetWaveNetDevice (Ptr< WaveNetDevice > device) |
![]() | |
ChannelScheduler () | |
virtual | ~ChannelScheduler () |
bool | IsAlternatingAccessAssigned (uint32_t channelNumber) const |
bool | IsCchAccessAssigned (void) const |
bool | IsChannelAccessAssigned (uint32_t channelNumber) const |
bool | IsContinuousAccessAssigned (uint32_t channelNumber) const |
bool | IsDefaultCchAccessAssigned (void) const |
bool | IsExtendedAccessAssigned (uint32_t channelNumber) const |
bool | IsSchAccessAssigned (void) const |
bool | StartSch (const SchInfo &schInfo) |
bool | StopSch (uint32_t channelNumber) |
![]() | |
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 |
Implement the GetInstanceTypeId method defined in ObjectBase. 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... | |
![]() | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
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... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
![]() | |
static TypeId | GetTypeId (void) |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static void | Cleanup (void) |
Noop. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
virtual bool | AssignAlternatingAccess (uint32_t channelNumber, bool immediate) |
virtual bool | AssignContinuousAccess (uint32_t channelNumber, bool immediate) |
virtual bool | AssignDefaultCchAccess (void) |
This method will assign default CCH access for CCH. More... | |
virtual bool | AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate) |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual bool | ReleaseAccess (uint32_t channelNumber) |
void | SwitchToNextChannel (uint32_t curChannelNumber, uint32_t nextChannelNumber) |
Private Attributes | |
enum ChannelAccess | m_channelAccess |
uint32_t | m_channelNumber |
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channelAccess is AlternatingAccess, m_channelNumber is SCH channel number, another alternating channel is CCH; when m_channelAccess is ExtendedAccess, m_channelNumber is extended access, extends is the number of extends access. More... | |
Ptr< ChannelCoordinationListener > | m_coordinationListener |
Ptr< ChannelCoordinator > | m_coordinator |
uint32_t | m_extend |
EventId | m_extendEvent |
Ptr< ChannelManager > | m_manager |
Ptr< WifiPhy > | m_phy |
uint32_t | m_waitChannelNumber |
EventId | m_waitEvent |
uint32_t | m_waitExtend |
Additional Inherited Members | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
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... | |
![]() | |
Ptr< WaveNetDevice > | m_device |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
This class uses a simple mechanism to assign channel access with following features: (1) only in the context of single-PHY device; (2) FCFS (First come First service) strategy, which seems against the description of the standard (preemptive strategy).
ns3::DefaultChannelScheduler is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 144 bytes (on a 64-bit architecture).
Definition at line 32 of file default-channel-scheduler.h.
ns3::DefaultChannelScheduler::DefaultChannelScheduler | ( | ) |
Definition at line 65 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 75 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
|
privatevirtual |
channelNumber | the specific channel |
immediate | indicate whether channel switch to channel |
This method will assign alternating access for SCHs and CCH.
Implements ns3::ChannelScheduler.
Definition at line 137 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, CCH, ns3::ContinuousAccess, ns3::ExtendedAccess, ns3::ChannelCoordinator::IsSchInterval(), m_channelAccess, m_channelNumber, m_coordinator, ns3::NoAccess, NS_ASSERT, NS_LOG_FUNCTION, and SwitchToNextChannel().
|
privatevirtual |
channelNumber | the specific channel |
immediate | indicate whether channel switch to channel |
This method will assign continuous SCH access CCH.
Implements ns3::ChannelScheduler.
Definition at line 174 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, ns3::EventId::Cancel(), ns3::ContinuousAccess, ns3::ExtendedAccess, ns3::EventId::IsExpired(), ns3::ChannelCoordinator::IsSchInterval(), m_channelAccess, m_channelNumber, m_coordinator, m_waitChannelNumber, m_waitEvent, ns3::ChannelCoordinator::NeedTimeToSchInterval(), ns3::NoAccess, NS_ASSERT, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SwitchToNextChannel().
|
privatevirtual |
This method will assign default CCH access for CCH.
Implements ns3::ChannelScheduler.
Definition at line 317 of file default-channel-scheduler.cc.
References CCH, ns3::DefaultCchAccess, EXTENDED_CONTINUOUS, ns3::WifiPhy::GetChannelSwitchDelay(), ns3::WaveNetDevice::GetMac(), m_channelAccess, m_channelNumber, ns3::ChannelScheduler::m_device, m_extend, m_phy, ns3::OcbWifiMac::MakeVirtualBusy(), ns3::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::OcbWifiMac::Resume(), ns3::WifiPhy::SetChannelNumber(), and ns3::RegularWifiMac::SetWifiPhy().
|
privatevirtual |
channelNumber | the specific channel |
immediate | indicate whether channel switch to channel |
This method will assign extended SCH access for SCHs.
Implements ns3::ChannelScheduler.
Definition at line 232 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, ns3::EventId::Cancel(), ns3::ContinuousAccess, ns3::ExtendedAccess, ns3::Simulator::GetDelayLeft(), ns3::Time::GetMilliSeconds(), ns3::ChannelCoordinator::GetSyncInterval(), ns3::EventId::IsExpired(), ns3::ChannelCoordinator::IsSchInterval(), m_channelAccess, m_channelNumber, m_coordinator, m_extend, m_extendEvent, m_waitChannelNumber, m_waitEvent, m_waitExtend, ns3::MilliSeconds(), ns3::ChannelCoordinator::NeedTimeToCchInterval(), ns3::ChannelCoordinator::NeedTimeToSchInterval(), ns3::NoAccess, NS_ASSERT, NS_LOG_FUNCTION, ReleaseAccess(), ns3::Simulator::Schedule(), and SwitchToNextChannel().
|
privatevirtual |
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 overriden 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 88 of file default-channel-scheduler.cc.
References ns3::EventId::Cancel(), ns3::Object::DoDispose(), ns3::EventId::IsExpired(), m_coordinationListener, m_coordinator, m_extendEvent, m_waitEvent, and NS_LOG_FUNCTION.
|
privatevirtual |
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::ChannelScheduler.
Definition at line 81 of file default-channel-scheduler.cc.
References ns3::ChannelScheduler::DoInitialize(), and NS_LOG_FUNCTION.
|
virtual |
channelNumber | the specified channel number |
Implements ns3::ChannelScheduler.
Definition at line 125 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, CCH, m_channelAccess, m_channelNumber, ns3::NoAccess, and NS_LOG_FUNCTION.
|
static |
Definition at line 55 of file default-channel-scheduler.cc.
References ns3::TypeId::SetParent().
void ns3::DefaultChannelScheduler::NotifyCchSlotStart | ( | Time | duration | ) |
Definition at line 402 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::CoordinationListener::NotifyCchSlotStart().
void ns3::DefaultChannelScheduler::NotifyGuardSlotStart | ( | Time | duration, |
bool | cchi | ||
) |
Definition at line 414 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, CCH, ns3::WaveNetDevice::GetMac(), m_channelAccess, m_channelNumber, ns3::ChannelScheduler::m_device, third::mac, ns3::OcbWifiMac::MakeVirtualBusy(), NS_LOG_FUNCTION, and SwitchToNextChannel().
Referenced by ns3::CoordinationListener::NotifyGuardSlotStart().
void ns3::DefaultChannelScheduler::NotifySchSlotStart | ( | Time | duration | ) |
Definition at line 408 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::CoordinationListener::NotifySchSlotStart().
|
privatevirtual |
channelNumber | indicating for which channel should release the assigned channel access resource. |
Implements ns3::ChannelScheduler.
Definition at line 375 of file default-channel-scheduler.cc.
References ns3::EventId::Cancel(), CCH, ns3::DefaultCchAccess, EXTENDED_CONTINUOUS, ns3::EventId::IsExpired(), m_channelAccess, m_channelNumber, m_extend, m_extendEvent, m_waitChannelNumber, m_waitEvent, m_waitExtend, NS_ASSERT, NS_LOG_FUNCTION, and SwitchToNextChannel().
Referenced by AssignExtendedAccess().
|
virtual |
device | enable channel scheduler associated with WaveNetDevice |
Reimplemented from ns3::ChannelScheduler.
Definition at line 108 of file default-channel-scheduler.cc.
References ns3::WaveNetDevice::GetChannelCoordinator(), ns3::WaveNetDevice::GetPhy(), ns3::WaveNetDevice::GetPhys(), m_coordinationListener, m_coordinator, m_phy, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::ChannelCoordinator::RegisterListener(), and ns3::ChannelScheduler::SetWaveNetDevice().
|
private |
curChannelNumber | switch from MAC activity for current channel |
nextChannelNumber | switch to MAC activity for next channel |
Definition at line 348 of file default-channel-scheduler.cc.
References ns3::WifiPhy::GetChannelNumber(), ns3::WifiPhy::GetChannelSwitchDelay(), ns3::WaveNetDevice::GetMac(), ns3::ChannelScheduler::m_device, m_phy, ns3::OcbWifiMac::MakeVirtualBusy(), NS_LOG_FUNCTION, ns3::RegularWifiMac::ResetWifiPhy(), ns3::OcbWifiMac::Resume(), ns3::WifiPhy::SetChannelNumber(), ns3::RegularWifiMac::SetWifiPhy(), and ns3::OcbWifiMac::Suspend().
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignExtendedAccess(), NotifyGuardSlotStart(), and ReleaseAccess().
|
private |
Definition at line 110 of file default-channel-scheduler.h.
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignDefaultCchAccess(), AssignExtendedAccess(), GetAssignedAccessType(), NotifyGuardSlotStart(), and ReleaseAccess().
|
private |
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channelAccess is AlternatingAccess, m_channelNumber is SCH channel number, another alternating channel is CCH; when m_channelAccess is ExtendedAccess, m_channelNumber is extended access, extends is the number of extends access.
when m_channelAccess is DefaultCchAccess, m_channelNumber is CCH.
Definition at line 107 of file default-channel-scheduler.h.
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignDefaultCchAccess(), AssignExtendedAccess(), GetAssignedAccessType(), NotifyGuardSlotStart(), and ReleaseAccess().
|
private |
Definition at line 116 of file default-channel-scheduler.h.
Referenced by DoDispose(), and SetWaveNetDevice().
|
private |
Definition at line 95 of file default-channel-scheduler.h.
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignExtendedAccess(), DoDispose(), and SetWaveNetDevice().
|
private |
Definition at line 108 of file default-channel-scheduler.h.
Referenced by AssignDefaultCchAccess(), AssignExtendedAccess(), and ReleaseAccess().
|
private |
Definition at line 109 of file default-channel-scheduler.h.
Referenced by AssignExtendedAccess(), DoDispose(), and ReleaseAccess().
|
private |
Definition at line 94 of file default-channel-scheduler.h.
Definition at line 96 of file default-channel-scheduler.h.
Referenced by AssignDefaultCchAccess(), SetWaveNetDevice(), and SwitchToNextChannel().
|
private |
Definition at line 113 of file default-channel-scheduler.h.
Referenced by AssignContinuousAccess(), AssignExtendedAccess(), and ReleaseAccess().
|
private |
Definition at line 112 of file default-channel-scheduler.h.
Referenced by AssignContinuousAccess(), AssignExtendedAccess(), DoDispose(), and ReleaseAccess().
|
private |
Definition at line 114 of file default-channel-scheduler.h.
Referenced by AssignExtendedAccess(), and ReleaseAccess().