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) |
Notify CCH slot start. More... | |
void | NotifyGuardSlotStart (Time duration, bool cchi) |
Notify guard slot start. More... | |
void | NotifySchSlotStart (Time duration) |
Notify SCH slot start. More... | |
virtual void | SetWaveNetDevice (Ptr< WaveNetDevice > device) |
Public Member Functions inherited from ns3::ChannelScheduler | |
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) |
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... | |
SimpleRefCount & | operator= (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... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::ChannelScheduler | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
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... | |
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 |
channel access More... | |
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 |
coordination listener More... | |
Ptr< ChannelCoordinator > | m_coordinator |
channel coordinator More... | |
uint32_t | m_extend |
extend More... | |
EventId | m_extendEvent |
extend event More... | |
Ptr< ChannelManager > | m_manager |
channel manager More... | |
Ptr< WifiPhy > | m_phy |
Phy. More... | |
uint32_t | m_waitChannelNumber |
wait channel number More... | |
EventId | m_waitEvent |
wait event More... | |
uint32_t | m_waitExtend |
wait extend More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
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... | |
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... | |
Protected Attributes inherited from ns3::ChannelScheduler | |
Ptr< WaveNetDevice > | m_device |
the device More... | |
Related Functions inherited from ns3::ObjectBase | |
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 75 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 85 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 147 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 184 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 327 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 242 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 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 98 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 91 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 135 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, CCH, m_channelAccess, m_channelNumber, ns3::NoAccess, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 65 of file default-channel-scheduler.cc.
References ns3::TypeId::SetParent().
void ns3::DefaultChannelScheduler::NotifyCchSlotStart | ( | Time | duration | ) |
Notify CCH slot start.
duration | the CCH slot duration |
Definition at line 412 of file default-channel-scheduler.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::CoordinationListener::NotifyCchSlotStart().
void ns3::DefaultChannelScheduler::NotifyGuardSlotStart | ( | Time | duration, |
bool | cchi | ||
) |
Notify guard slot start.
duration | the CCH slot duration |
cchi | if true, switch to next channel |
Definition at line 424 of file default-channel-scheduler.cc.
References ns3::AlternatingAccess, CCH, ns3::WaveNetDevice::GetMac(), m_channelAccess, m_channelNumber, ns3::ChannelScheduler::m_device, third::mac, NS_LOG_FUNCTION, and SwitchToNextChannel().
Referenced by ns3::CoordinationListener::NotifyGuardSlotStart().
void ns3::DefaultChannelScheduler::NotifySchSlotStart | ( | Time | duration | ) |
Notify SCH slot start.
duration | the SCH slot duration |
Definition at line 418 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 385 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 118 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 358 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 |
channel access
Definition at line 129 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.channel number
Definition at line 126 of file default-channel-scheduler.h.
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignDefaultCchAccess(), AssignExtendedAccess(), GetAssignedAccessType(), NotifyGuardSlotStart(), and ReleaseAccess().
|
private |
coordination listener
Definition at line 135 of file default-channel-scheduler.h.
Referenced by DoDispose(), and SetWaveNetDevice().
|
private |
channel coordinator
Definition at line 114 of file default-channel-scheduler.h.
Referenced by AssignAlternatingAccess(), AssignContinuousAccess(), AssignExtendedAccess(), DoDispose(), and SetWaveNetDevice().
|
private |
extend
Definition at line 127 of file default-channel-scheduler.h.
Referenced by AssignDefaultCchAccess(), AssignExtendedAccess(), and ReleaseAccess().
|
private |
extend event
Definition at line 128 of file default-channel-scheduler.h.
Referenced by AssignExtendedAccess(), DoDispose(), and ReleaseAccess().
|
private |
channel manager
Definition at line 113 of file default-channel-scheduler.h.
Phy.
Definition at line 115 of file default-channel-scheduler.h.
Referenced by AssignDefaultCchAccess(), SetWaveNetDevice(), and SwitchToNextChannel().
|
private |
wait channel number
Definition at line 132 of file default-channel-scheduler.h.
Referenced by AssignContinuousAccess(), AssignExtendedAccess(), and ReleaseAccess().
|
private |
wait event
Definition at line 131 of file default-channel-scheduler.h.
Referenced by AssignContinuousAccess(), AssignExtendedAccess(), DoDispose(), and ReleaseAccess().
|
private |
wait extend
Definition at line 133 of file default-channel-scheduler.h.
Referenced by AssignExtendedAccess(), and ReleaseAccess().