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"
23 namespace ns3 {
24 class WaveNetDevice;
25 
31 {
32  uint32_t cwmin;
33  uint32_t cwmax;
34  uint32_t aifsn;
35 };
36 
41 typedef std::map<AcIndex,EdcaParameter> EdcaParameters;
42 
47 typedef std::map<AcIndex,EdcaParameter>::const_iterator EdcaParametersI;
48 
49 #define EXTENDED_ALTERNATING 0x00
50 #define EXTENDED_CONTINUOUS 0xff
51 
65 struct SchInfo
66 {
67  uint32_t channelNumber;
68  //OperationalRateSet operationalRateSet; // not supported
70  uint8_t extendedAccess;
72  SchInfo ()
74  : channelNumber (SCH1),
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 
129 class ChannelScheduler : public Object
130 {
131 public:
136  static TypeId GetTypeId (void);
137  ChannelScheduler ();
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 
196 protected:
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;
223  virtual bool AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate) = 0;
228  virtual bool AssignDefaultCchAccess (void) = 0;
234  virtual bool ReleaseAccess (uint32_t channelNumber) = 0;
235 
237 };
238 
239 }
240 #endif /* CHANNEL_SCHEDULER_H */
uint32_t cwmin
minimum
EdcaParameter structure.
uint8_t extendedAccess
extended access
bool IsSchAccessAssigned(void) const
EdcaParameters edcaParameters
EDCA parameters.
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)=0
bool StartSch(const SchInfo &schInfo)
bool immediateAccess
immediate access
bool IsDefaultCchAccessAssigned(void) const
virtual bool AssignDefaultCchAccess(void)=0
This method will assign default CCH access for CCH.
uint32_t cwmax
maximum
virtual void DoInitialize(void)
Initialize() implementation.
channel
Definition: third.py:92
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess)
Initializer.
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
Initializer.
bool IsExtendedAccessAssigned(uint32_t channelNumber) const
#define EXTENDED_ALTERNATING
bool IsContinuousAccessAssigned(uint32_t channelNumber) const
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)=0
std::map< AcIndex, EdcaParameter >::const_iterator EdcaParametersI
EDCA parameters iterator typedef.
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const =0
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::map< AcIndex, EdcaParameter > EdcaParameters
EDCA parameters typedef.
bool IsAlternatingAccessAssigned(uint32_t channelNumber) const
bool IsCchAccessAssigned(void) const
uint32_t channelNumber
channel number
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)=0
ChannelAccess
ChannelAccess enumeration.
bool StopSch(uint32_t channelNumber)
static TypeId GetTypeId(void)
Get the type ID.
bool IsChannelAccessAssigned(uint32_t channelNumber) const
Ptr< WaveNetDevice > m_device
the device
virtual void DoDispose(void)
Destructor implementation.
A base class which provides memory management and object aggregation.
Definition: object.h:87
SchInfo()
Initializer.
a unique identifier for an interface.
Definition: type-id.h:58
#define SCH1
uint32_t aifsn
AIFSN.
This class will assign channel access for requests from higher layers.
virtual bool ReleaseAccess(uint32_t channelNumber)=0