A Discrete-Event Network Simulator
API
channel-coordinator.h
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 * Author: Junling Bu <linlinjavaer@gmail.com>
16 */
17#ifndef CHANNEL_COORDINATOR_H
18#define CHANNEL_COORDINATOR_H
19#include "ns3/event-id.h"
20#include "ns3/nstime.h"
21#include "ns3/object.h"
22
23namespace ns3
24{
25
30class ChannelCoordinationListener : public SimpleRefCount<ChannelCoordinationListener>
31{
32 public:
37 virtual void NotifyCchSlotStart(Time duration) = 0;
41 virtual void NotifySchSlotStart(Time duration) = 0;
46 virtual void NotifyGuardSlotStart(Time duration, bool cchi) = 0;
47};
48
74{
75 public:
80 static TypeId GetTypeId();
82 ~ChannelCoordinator() override;
83
100
104 void SetCchInterval(Time cchi);
108 Time GetCchInterval() const;
112 void SetSchInterval(Time schi);
116 Time GetSchInterval() const;
120 Time GetSyncInterval() const;
124 void SetGuardInterval(Time guardi);
128 Time GetGuardInterval() const;
135 bool IsValidConfig() const;
136
141 bool IsCchInterval(Time duration = Seconds(0.0)) const;
146 bool IsSchInterval(Time duration = Seconds(0.0)) const;
151 bool IsGuardInterval(Time duration = Seconds(0.0)) const;
157 Time NeedTimeToCchInterval(Time duration = Seconds(0.0)) const;
163 Time NeedTimeToSchInterval(Time duration = Seconds(0.0)) const;
169 Time NeedTimeToGuardInterval(Time duration = Seconds(0.0)) const;
179 Time GetIntervalTime(Time duration = Seconds(0.0)) const;
189 Time GetRemainTime(Time duration = Seconds(0.0)) const;
207
208 private:
209 void DoDispose() override;
210 void DoInitialize() override;
211
223 void NotifySchSlot();
227 void NotifyCchSlot();
231 void NotifyGuardSlot();
235 Time GetSchSlot() const;
239 Time GetCchSlot() const;
240
244
246 typedef std::vector<Ptr<ChannelCoordinationListener>> Listeners;
248 typedef std::vector<Ptr<ChannelCoordinationListener>>::iterator ListenersI;
250
253};
254
255} // namespace ns3
256#endif /* CHANNEL_COORDINATOR_H */
receive notifications about channel coordination events.
virtual void NotifyGuardSlotStart(Time duration, bool cchi)=0
virtual void NotifyCchSlotStart(Time duration)=0
virtual void NotifySchSlotStart(Time duration)=0
ChannelCoordinator deals with channel coordination in data plane (see 1609.4 chapter 5....
static TypeId GetTypeId()
Get the type ID.
void StartChannelCoordination()
start to make channel coordination events
Listeners m_listeners
listeners
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
bool IsSchInterval(Time duration=Seconds(0.0)) const
bool IsGuardInterval(Time duration=Seconds(0.0)) const
uint32_t m_guardCount
guard count
void SetGuardInterval(Time guardi)
void UnregisterAllListeners()
Remove all listeners.
void StopChannelCoordination()
stop channel coordination events
void NotifySchSlot()
notify listeners of a SCH slot start
EventId m_coordination
coordination event
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
void DoInitialize() override
Initialize() implementation.
Time NeedTimeToGuardInterval(Time duration=Seconds(0.0)) const
void UnregisterListener(Ptr< ChannelCoordinationListener > listener)
void NotifyCchSlot()
notify listeners of a CCH slot start
void DoDispose() override
Destructor implementation.
std::vector< Ptr< ChannelCoordinationListener > > Listeners
Listeners typdef.
void NotifyGuardSlot()
notify listeners of a guard slot start
Time GetRemainTime(Time duration=Seconds(0.0)) const
std::vector< Ptr< ChannelCoordinationListener > >::iterator ListenersI
Listeners iterator typedef.
Time GetIntervalTime(Time duration=Seconds(0.0)) const
bool IsCchInterval(Time duration=Seconds(0.0)) const
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
An identifier for simulation events.
Definition: event-id.h:55
A base class which provides memory management and object aggregation.
Definition: object.h:89
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Every class exported by the ns3 library is enclosed in the ns3 namespace.