20 #include "ns3/simulator.h"
57 static TypeId tid =
TypeId (
"ns3::DefaultChannelScheduler")
59 .AddConstructor<DefaultChannelScheduler> ()
65 : m_channelNumber (0),
68 m_waitChannelNumber (0),
70 m_coordinationListener (0)
111 std::vector<Ptr<WifiPhy> > phys = device->
GetPhys ();
112 if (phys.size () > 1)
114 NS_LOG_WARN (
"The class is only in the context of single-PHY device, while there are more than one PHY devices");
140 uint32_t sch = channelNumber;
177 uint32_t sch = channelNumber;
235 uint32_t sch = channelNumber;
252 if (remainExtends > extends)
326 NS_LOG_DEBUG (
"channel access is already assigned for other SCHs, thus cannot assign default CCH access.");
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Ptr< WifiPhy > GetPhy(uint32_t index) const
Simulation virtual time values and global simulation resolution.
CoordinationListener(DefaultChannelScheduler *scheduler)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void DoDispose(void)
Destructor implementation.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
DefaultChannelScheduler()
uint32_t m_waitChannelNumber
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
virtual void DoDispose(void)
Destructor implementation.
virtual ~CoordinationListener()
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
virtual ~DefaultChannelScheduler()
bool IsSchInterval(Time duration=Seconds(0.0)) const
virtual void DoInitialize(void)
Initialize() implementation.
virtual void NotifyGuardSlotStart(Time duration, bool cchi)
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
Ptr< ChannelCoordinator > GetChannelCoordinator(void) const
DefaultChannelScheduler * m_scheduler
virtual void SetWifiPhy(Ptr< WifiPhy > phy)
static TypeId GetTypeId(void)
void NotifySchSlotStart(Time duration)
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
void Suspend(void)
To support MAC extension for multiple channel operation, Suspend the activity in current MAC entity...
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
void MakeVirtualBusy(Time duration)
#define EXTENDED_CONTINUOUS
virtual void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
virtual void DoInitialize(void)
Initialize() implementation.
virtual void NotifySchSlotStart(Time duration)
virtual bool AssignDefaultCchAccess(void)
This method will assign default CCH access for CCH.
virtual Time GetChannelSwitchDelay(void) const =0
This class uses a simple mechanism to assign channel access with following features: (1) only in the ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< ChannelCoordinator > m_coordinator
void NotifyGuardSlotStart(Time duration, bool cchi)
Ptr< OcbWifiMac > GetMac(uint32_t channelNumber) const
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)
enum ChannelAccess m_channelAccess
virtual uint16_t GetChannelNumber(void) const =0
Return current channel number.
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const
virtual bool ReleaseAccess(uint32_t channelNumber)
virtual void SetChannelNumber(uint16_t id)=0
Set channel number.
Ptr< WaveNetDevice > m_device
void NotifyCchSlotStart(Time duration)
virtual void NotifyCchSlotStart(Time duration)
std::vector< Ptr< WifiPhy > > GetPhys(void) const
Ptr< ChannelCoordinationListener > m_coordinationListener
uint32_t m_channelNumber
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channe...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
receive notifications about channel coordination events.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time GetSyncInterval(void) const
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
a unique identifier for an interface.
void Resume(void)
To support MAC extension for multiple channel operation, Resume the activity of suspended MAC entity...
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
TypeId SetParent(TypeId tid)
This class will assign channel access for requests from higher layers.
void SwitchToNextChannel(uint32_t curChannelNumber, uint32_t nextChannelNumber)