A Discrete-Event Network Simulator
API
channel-scheduler.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation;
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Author: Junling Bu <linlinjavaer@gmail.com>
17 */
18#ifndef CHANNEL_SCHEDULER_H
19#define CHANNEL_SCHEDULER_H
20
21#include <map>
22#include "wave-net-device.h"
23namespace ns3 {
24class WaveNetDevice;
25
31{
35};
36
41typedef std::map<AcIndex,EdcaParameter> EdcaParameters;
42
47typedef std::map<AcIndex,EdcaParameter>::const_iterator EdcaParametersI;
48
49#define EXTENDED_ALTERNATING 0x00
50#define EXTENDED_CONTINUOUS 0xff
65struct SchInfo
66{
68 //OperationalRateSet operationalRateSet; // not supported
75 immediateAccess (false),
77 {
78
79 }
86 SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess)
88 immediateAccess (immediate),
89 extendedAccess (channelAccess)
90 {
91
92 }
100 SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
102 immediateAccess (immediate),
103 extendedAccess (channelAccess),
104 edcaParameters (edca)
105 {
106
107 }
108};
109
112{
113 ContinuousAccess, // continuous access for SCHs
114 AlternatingAccess, //alternating CCH and SCH access
115 ExtendedAccess, // extended access in SCHs
116 DefaultCchAccess, // default continuous CCH access
117 NoAccess, // no channel access assigned
118};
119
130{
131public:
136 static TypeId GetTypeId (void);
138 virtual ~ChannelScheduler ();
139
143 virtual void SetWaveNetDevice (Ptr<WaveNetDevice> device);
147 bool IsCchAccessAssigned (void) const;
151 bool IsSchAccessAssigned (void) const;
156 bool IsChannelAccessAssigned (uint32_t channelNumber) const;
161 bool IsContinuousAccessAssigned (uint32_t channelNumber) const;
166 bool IsAlternatingAccessAssigned (uint32_t channelNumber) const;
171 bool IsExtendedAccessAssigned (uint32_t channelNumber) const;
175 bool IsDefaultCchAccessAssigned (void) const;
180 virtual enum ChannelAccess GetAssignedAccessType (uint32_t channelNumber) const = 0;
181
188 bool StartSch (const SchInfo & schInfo);
194 bool StopSch (uint32_t channelNumber);
195
196protected:
197 virtual void DoInitialize (void);
198 virtual void DoDispose (void);
199
207 virtual bool AssignAlternatingAccess (uint32_t channelNumber, bool immediate) = 0;
215 virtual bool AssignContinuousAccess (uint32_t channelNumber, bool immediate) = 0;
224 virtual bool AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate) = 0;
229 virtual bool AssignDefaultCchAccess (void) = 0;
235 virtual bool ReleaseAccess (uint32_t channelNumber) = 0;
236
238};
239
240}
241#endif /* CHANNEL_SCHEDULER_H */
#define SCH1
#define EXTENDED_ALTERNATING
This class will assign channel access for requests from higher layers.
bool IsSchAccessAssigned(void) const
bool StopSch(uint32_t channelNumber)
virtual void DoInitialize(void)
Initialize() implementation.
static TypeId GetTypeId(void)
Get the type ID.
bool StartSch(const SchInfo &schInfo)
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const =0
virtual void DoDispose(void)
Destructor implementation.
bool IsAlternatingAccessAssigned(uint32_t channelNumber) const
bool IsContinuousAccessAssigned(uint32_t channelNumber) const
virtual bool AssignDefaultCchAccess(void)=0
This method will assign default CCH access for CCH.
bool IsCchAccessAssigned(void) const
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
bool IsChannelAccessAssigned(uint32_t channelNumber) const
Ptr< WaveNetDevice > m_device
the device
virtual bool ReleaseAccess(uint32_t channelNumber)=0
bool IsDefaultCchAccessAssigned(void) const
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)=0
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:88
a unique identifier for an interface.
Definition: type-id.h:59
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:92
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.