A Discrete-Event Network Simulator
API
wifi-standards.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef WIFI_STANDARD_H
22 #define WIFI_STANDARD_H
23 
24 #include <map>
25 #include <list>
26 #include "wifi-phy-band.h"
27 #include "ns3/abort.h"
28 
29 namespace ns3 {
30 
36 {
45 };
46 
54 inline std::ostream& operator<< (std::ostream& os, WifiStandard standard)
55 {
56  switch (standard)
57  {
59  return (os << "802.11a");
61  return (os << "802.11b");
63  return (os << "802.11g");
65  return (os << "802.11p");
67  return (os << "802.11n");
69  return (os << "802.11ac");
71  return (os << "802.11ax");
72  default:
73  return (os << "UNSPECIFIED");
74  }
75 }
76 
77 
81 const std::map<WifiStandard, std::list<WifiPhyBand>> wifiStandards =
82 {
90 };
91 
96 enum FrequencyChannelType : uint8_t
97 {
101 };
102 
110 {
111  switch (standard)
112  {
114  return WIFI_PHY_DSSS_CHANNEL;
117  default:
118  return WIFI_PHY_OFDM_CHANNEL;
119  }
120 }
121 
128 inline uint16_t GetMaximumChannelWidth (WifiStandard standard)
129 {
130  switch (standard)
131  {
133  return 22;
135  return 10;
138  return 20;
140  return 40;
143  return 160;
144  default:
145  NS_ABORT_MSG ("Unknown standard: " << standard);
146  return 0;
147  }
148 }
149 
157 inline uint16_t GetDefaultChannelWidth (WifiStandard standard, WifiPhyBand band)
158 {
159  switch (standard)
160  {
162  return 22;
164  return 10;
166  return 80;
168  return (band == WIFI_PHY_BAND_2_4GHZ ? 20 : 80);
169  default:
170  return 20;
171  }
172 }
173 
181 {
182  switch (standard)
183  {
188  return WIFI_PHY_BAND_5GHZ;
189  default:
190  return WIFI_PHY_BAND_2_4GHZ;
191  }
192 }
193 
194 } //namespace ns3
195 
196 #endif /* WIFI_STANDARD_H */
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
FrequencyChannelType
Enumeration of frequency channel types.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
@ WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
@ WIFI_PHY_80211p_CHANNEL
@ WIFI_PHY_OFDM_CHANNEL
@ WIFI_PHY_DSSS_CHANNEL
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const std::map< WifiStandard, std::list< WifiPhyBand > > wifiStandards
map a given standard configured by the user to the allowed PHY bands
WifiPhyBand GetDefaultPhyBand(WifiStandard standard)
Get the default PHY band for the given standard.
uint16_t GetDefaultChannelWidth(WifiStandard standard, WifiPhyBand band)
Get the default channel width for the given PHY standard and band.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:139
FrequencyChannelType GetFrequencyChannelType(WifiStandard standard)
Get the type of the frequency channel for the given standard.
uint16_t GetMaximumChannelWidth(WifiStandard standard)
Get the maximum channel width in MHz allowed for the given standard.