A Discrete-Event Network Simulator
API
channel-scheduler.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_SCHEDULER_H
18#define CHANNEL_SCHEDULER_H
19
20#include "wave-net-device.h"
21
22#include "ns3/qos-utils.h"
23
24#include <map>
25
26namespace ns3
27{
28class WaveNetDevice;
29
35{
39};
40
45typedef std::map<AcIndex, EdcaParameter> EdcaParameters;
46
51typedef std::map<AcIndex, EdcaParameter>::const_iterator EdcaParametersI;
52
53#define EXTENDED_ALTERNATING 0x00
54#define EXTENDED_CONTINUOUS 0xff
55
70struct SchInfo
71{
73 // OperationalRateSet operationalRateSet; // not supported
77
81 immediateAccess(false),
83 {
84 }
85
92 SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess)
94 immediateAccess(immediate),
95 extendedAccess(channelAccess)
96 {
97 }
98
106 SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
108 immediateAccess(immediate),
109 extendedAccess(channelAccess),
110 edcaParameters(edca)
111 {
112 }
113};
114
117{
118 ContinuousAccess, // continuous access for SCHs
119 AlternatingAccess, // alternating CCH and SCH access
120 ExtendedAccess, // extended access in SCHs
121 DefaultCchAccess, // default continuous CCH access
122 NoAccess, // no channel access assigned
123};
124
135{
136 public:
141 static TypeId GetTypeId();
143 ~ChannelScheduler() override;
144
148 virtual void SetWaveNetDevice(Ptr<WaveNetDevice> device);
152 bool IsCchAccessAssigned() const;
156 bool IsSchAccessAssigned() const;
161 bool IsChannelAccessAssigned(uint32_t channelNumber) const;
166 bool IsContinuousAccessAssigned(uint32_t channelNumber) const;
171 bool IsAlternatingAccessAssigned(uint32_t channelNumber) const;
176 bool IsExtendedAccessAssigned(uint32_t channelNumber) const;
180 bool IsDefaultCchAccessAssigned() const;
185 virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const = 0;
186
193 bool StartSch(const SchInfo& schInfo);
199 bool StopSch(uint32_t channelNumber);
200
201 protected:
202 void DoInitialize() override;
203 void DoDispose() override;
204
212 virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate) = 0;
220 virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate) = 0;
229 virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate) = 0;
234 virtual bool AssignDefaultCchAccess() = 0;
240 virtual bool ReleaseAccess(uint32_t channelNumber) = 0;
241
243};
244
245} // namespace ns3
246#endif /* CHANNEL_SCHEDULER_H */
#define SCH1
#define EXTENDED_ALTERNATING
This class will assign channel access for requests from higher layers.
bool StopSch(uint32_t channelNumber)
bool StartSch(const SchInfo &schInfo)
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const =0
bool IsAlternatingAccessAssigned(uint32_t channelNumber) const
bool IsCchAccessAssigned() const
void DoDispose() override
Destructor implementation.
bool IsSchAccessAssigned() const
bool IsContinuousAccessAssigned(uint32_t channelNumber) const
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
bool IsChannelAccessAssigned(uint32_t channelNumber) const
static TypeId GetTypeId()
Get the type ID.
Ptr< WaveNetDevice > m_device
the device
bool IsDefaultCchAccessAssigned() const
virtual bool ReleaseAccess(uint32_t channelNumber)=0
void DoInitialize() override
Initialize() implementation.
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)=0
virtual bool AssignDefaultCchAccess()=0
This method will assign default CCH access for CCH.
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)=0
bool IsExtendedAccessAssigned(uint32_t channelNumber) const
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)=0
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:60
std::map< AcIndex, EdcaParameter >::const_iterator EdcaParametersI
EDCA parameters iterator typedef.
std::map< AcIndex, EdcaParameter > EdcaParameters
EDCA parameters typedef.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ChannelAccess
ChannelAccess enumeration.
@ AlternatingAccess
@ ContinuousAccess
@ ExtendedAccess
@ DefaultCchAccess
channel
Definition: third.py:81
EdcaParameter structure.
uint32_t cwmin
minimum
uint32_t aifsn
AIFSN.
uint32_t cwmax
maximum
SchInfo()
Initializer.
uint8_t extendedAccess
extended access
EdcaParameters edcaParameters
EDCA parameters.
uint32_t channelNumber
channel number
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess)
Initializer.
bool immediateAccess
immediate access
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
Initializer.