|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #include "ns3/simulator.h"
21 #include "ns3/wifi-phy.h"
67 static TypeId tid =
TypeId (
"ns3::DefaultChannelScheduler")
69 .SetGroupName (
"Wave")
76 : m_channelNumber (0),
79 m_waitChannelNumber (0),
81 m_coordinationListener (0)
123 std::vector<Ptr<WifiPhy> > phys = device->
GetPhys ();
124 if (phys.size () > 1)
126 NS_LOG_WARN (
"The class is only in the context of single-PHY device, while there are more than one PHY devices");
152 uint32_t sch = channelNumber;
189 uint32_t sch = channelNumber;
247 uint32_t sch = channelNumber;
264 if (remainExtends > extends)
338 NS_LOG_DEBUG (
"channel access is already assigned for other SCHs, thus cannot assign default CCH access.");
343 if (
Now ().GetMilliSeconds() != 0)
440 mac->MakeVirtualBusy (duration);
448 mac->MakeVirtualBusy (duration);
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< ChannelCoordinationListener > m_coordinationListener
coordination listener
Ptr< ChannelCoordinator > m_coordinator
channel coordinator
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void Suspend(void)
To support MAC extension for multiple channel operation, Suspend the activity in current MAC entity.
void SwitchToNextChannel(uint32_t curChannelNumber, uint32_t nextChannelNumber)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
virtual ~CoordinationListener()
bool IsSchInterval(Time duration=Seconds(0.0)) const
uint8_t GetChannelNumber(void) const
Return current channel number.
uint32_t m_waitExtend
wait extend
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
virtual void DoInitialize(void)
Initialize() implementation.
uint32_t m_channelNumber
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channe...
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Ptr< ChannelCoordinator > GetChannelCoordinator(void) const
void NotifyGuardSlotStart(Time duration, bool cchi)
Notify guard slot start.
void NotifySchSlotStart(Time duration)
Notify SCH slot start.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
DefaultChannelScheduler * m_scheduler
the scheduler
EventId m_extendEvent
extend event
This class will assign channel access for requests from higher layers.
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
#define EXTENDED_CONTINUOUS
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
CoordinationListener class.
void NotifyCchSlotStart(Time duration)
Notify CCH slot start.
ChannelAccess
ChannelAccess enumeration.
std::vector< Ptr< WifiPhy > > GetPhys(void) const
uint32_t m_waitChannelNumber
wait channel number
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
virtual void NotifyGuardSlotStart(Time duration, bool cchi)
receive notifications about channel coordination events.
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const
void ResetWifiPhy(void) override
Remove currently attached WifiPhy device from this MAC.
virtual void NotifySchSlotStart(Time duration)
Ptr< OcbWifiMac > GetMac(uint32_t channelNumber) const
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static TypeId GetTypeId(void)
Get the type ID.
virtual void NotifyCchSlotStart(Time duration)
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
Simulation virtual time values and global simulation resolution.
virtual bool ReleaseAccess(uint32_t channelNumber)
virtual void DoDispose(void)
Destructor implementation.
This class uses a simple mechanism to assign channel access with following features: (1) only in the ...
virtual void DoInitialize(void)
Initialize() implementation.
virtual void DoDispose(void)
Destructor implementation.
void MakeVirtualBusy(Time duration)
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)
enum ChannelAccess m_channelAccess
channel access
void Resume(void)
To support MAC extension for multiple channel operation, Resume the activity of suspended MAC entity.
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
void SetWifiPhy(const Ptr< WifiPhy > phy) override
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time GetChannelSwitchDelay(void) const
virtual ~DefaultChannelScheduler()
DefaultChannelScheduler()
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Ptr< WaveNetDevice > m_device
the device
CoordinationListener(DefaultChannelScheduler *scheduler)
Constructor.
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)
Time GetSyncInterval(void) const
EventId m_waitEvent
wait event
Ptr< WifiPhy > GetPhy(uint32_t index) const
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
virtual bool AssignDefaultCchAccess(void)
This method will assign default CCH access for CCH.