A Discrete-Event Network Simulator
API
channel-manager.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_MANAGER_H
19 #define CHANNEL_MANAGER_H
20 #include <map>
21 #include <vector>
22 #include "ns3/object.h"
23 #include "ns3/wifi-mode.h"
24 #include "ns3/wifi-preamble.h"
25 
26 namespace ns3 {
27 
41 #define CH172 172
42 #define CH174 174
43 #define CH176 176
44 #define CH178 178
45 #define CH180 180
46 #define CH182 182
47 #define CH184 184
48 
49 #define SCH1 172
50 #define SCH2 174
51 #define SCH3 176
52 #define CCH 178
53 #define SCH4 180
54 #define SCH5 182
55 #define SCH6 184
56 
62 class ChannelManager : public Object
63 {
64 public:
69  static TypeId GetTypeId (void);
70  ChannelManager ();
71  virtual ~ChannelManager ();
72 
76  static uint32_t GetCch (void);
80  static std::vector<uint32_t> GetSchs (void);
86  static std::vector<uint32_t> GetWaveChannels (void);
90  static uint32_t GetNumberOfWaveChannels (void);
95  static bool IsCch (uint32_t channelNumber);
100  static bool IsSch (uint32_t channelNumber);
105  static bool IsWaveChannel (uint32_t channelNumber);
106 
113  uint32_t GetOperatingClass (uint32_t channelNumber);
118  bool GetManagementAdaptable (uint32_t channelNumber);
123  WifiMode GetManagementDataRate (uint32_t channelNumber);
128  WifiPreamble GetManagementPreamble (uint32_t channelNumber);
133  uint32_t GetManagementPowerLevel (uint32_t channelNumber);
134 
135 private:
137  static const uint32_t DEFAULT_OPERATING_CLASS = 17;
138 
140  struct WaveChannel
141  {
142  uint32_t channelNumber;
143  uint32_t operatingClass;
144  bool adaptable;
147  uint32_t txPowerLevel;
148 
153  WaveChannel (uint32_t channel)
154  : channelNumber (channel),
155  operatingClass (DEFAULT_OPERATING_CLASS),
156  adaptable (true),
157  dataRate (WifiMode ("OfdmRate6MbpsBW10MHz")),
158  preamble (WIFI_PREAMBLE_LONG),
159  txPowerLevel (4)
160  {
161  }
162  };
163  std::map<uint32_t, WaveChannel *> m_channels;
164 };
165 
166 }
167 #endif /* CHANNEL_MANAGER_H */
WifiPreamble preamble
preamble
tuple channel
Definition: third.py:85
static std::vector< uint32_t > GetWaveChannels(void)
static std::vector< uint32_t > GetSchs(void)
bool GetManagementAdaptable(uint32_t channelNumber)
static bool IsWaveChannel(uint32_t channelNumber)
WifiPreamble GetManagementPreamble(uint32_t channelNumber)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
WaveChannel(uint32_t channel)
initializor
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
static uint32_t GetNumberOfWaveChannels(void)
uint32_t txPowerLevel
transmit power level
static uint32_t GetCch(void)
static bool IsCch(uint32_t channelNumber)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t operatingClass
operating class
uint32_t GetOperatingClass(uint32_t channelNumber)
static bool IsSch(uint32_t channelNumber)
uint32_t channelNumber
channel number
uint32_t GetManagementPowerLevel(uint32_t channelNumber)
WifiMode GetManagementDataRate(uint32_t channelNumber)
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
static const uint32_t DEFAULT_OPERATING_CLASS
1609.4-2010 Annex H
static TypeId GetTypeId(void)
Get the type ID.
std::map< uint32_t, WaveChannel * > m_channels
list of channels
manage 7 WaveChannels and the tx information such as data rate and txPowerLevel.