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 
27 {
28  uint32_t cwmin;
29  uint32_t cwmax;
30  uint32_t aifsn;
31 };
32 typedef std::map<AcIndex,EdcaParameter> EdcaParameters;
33 typedef std::map<AcIndex,EdcaParameter>::const_iterator EdcaParametersI;
34 
35 #define EXTENDED_ALTERNATING 0x00
36 #define EXTENDED_CONTINUOUS 0xff
37 
49 struct SchInfo
50 {
51  uint32_t channelNumber;
52  //OperationalRateSet operationalRateSet; // not supported
54  uint8_t extendedAccess;
55  EdcaParameters edcaParameters;
57  : channelNumber (SCH1),
58  immediateAccess (false),
59  extendedAccess (EXTENDED_ALTERNATING)
60  {
61 
62  }
63  SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess)
64  : channelNumber (channel),
65  immediateAccess (immediate),
66  extendedAccess (channelAccess)
67  {
68 
69  }
70  SchInfo (uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
71  : channelNumber (channel),
72  immediateAccess (immediate),
73  extendedAccess (channelAccess),
74  edcaParameters (edca)
75  {
76 
77  }
78 };
79 
81 {
82  ContinuousAccess, // continuous access for SCHs
83  AlternatingAccess, //alternating CCH and SCH access
84  ExtendedAccess, // extended access in SCHs
85  DefaultCchAccess, // default continuous CCH access
86  NoAccess, // no channel access assigned
87 };
88 
98 class ChannelScheduler : public Object
99 {
100 public:
101  static TypeId GetTypeId (void);
102  ChannelScheduler ();
103  virtual ~ChannelScheduler ();
104 
108  virtual void SetWaveNetDevice (Ptr<WaveNetDevice> device);
112  bool IsCchAccessAssigned (void) const;
116  bool IsSchAccessAssigned (void) const;
121  bool IsChannelAccessAssigned (uint32_t channelNumber) const;
126  bool IsContinuousAccessAssigned (uint32_t channelNumber) const;
131  bool IsAlternatingAccessAssigned (uint32_t channelNumber) const;
136  bool IsExtendedAccessAssigned (uint32_t channelNumber) const;
140  bool IsDefaultCchAccessAssigned (void) const;
145  virtual enum ChannelAccess GetAssignedAccessType (uint32_t channelNumber) const = 0;
146 
153  bool StartSch (const SchInfo & schInfo);
158  bool StopSch (uint32_t channelNumber);
159 
160 protected:
161  virtual void DoInitialize (void);
162 
170  virtual bool AssignAlternatingAccess (uint32_t channelNumber, bool immediate) = 0;
178  virtual bool AssignContinuousAccess (uint32_t channelNumber, bool immediate) = 0;
186  virtual bool AssignExtendedAccess (uint32_t channelNumber, uint32_t extends, bool immediate) = 0;
187  /*
188  * This method will assign default CCH access for CCH.
189  */
190  virtual bool AssignDefaultCchAccess (void) = 0;
195  virtual bool ReleaseAccess (uint32_t channelNumber) = 0;
196 
198 };
199 
200 }
201 #endif /* CHANNEL_SCHEDULER_H */
tuple channel
Definition: third.py:85
uint8_t extendedAccess
EdcaParameters edcaParameters
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)=0
bool StartSch(const SchInfo &schInfo)
virtual bool AssignDefaultCchAccess(void)=0
bool IsDefaultCchAccessAssigned(void) const
virtual void DoInitialize(void)
Initialize() implementation.
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess)
SchInfo(uint32_t channel, bool immediate, uint32_t channelAccess, EdcaParameters edca)
bool IsSchAccessAssigned(void) const
std::map< AcIndex, EdcaParameter >::const_iterator EdcaParametersI
#define EXTENDED_ALTERNATING
bool IsAlternatingAccessAssigned(uint32_t channelNumber) const
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)=0
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const =0
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t channelNumber
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)=0
bool IsContinuousAccessAssigned(uint32_t channelNumber) const
bool StopSch(uint32_t channelNumber)
static TypeId GetTypeId(void)
std::map< AcIndex, EdcaParameter > EdcaParameters
Ptr< WaveNetDevice > m_device
bool IsCchAccessAssigned(void) const
bool IsExtendedAccessAssigned(uint32_t channelNumber) const
bool IsChannelAccessAssigned(uint32_t channelNumber) const
A base class which provides memory management and object aggregation.
Definition: object.h:87
a unique identifier for an interface.
Definition: type-id.h:58
#define SCH1
This class will assign channel access for requests from higher layers.
virtual bool ReleaseAccess(uint32_t channelNumber)=0