A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-standards.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef WIFI_STANDARD_H
10#define WIFI_STANDARD_H
11
12#include "wifi-phy-band.h"
13#include "wifi-types.h"
14#include "wifi-units.h"
15
16#include "ns3/abort.h"
17#include "ns3/wifi-export.h"
18
19#include <list>
20#include <map>
21
22namespace ns3
23{
24
25/**
26 * @ingroup wifi
27 * Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
28 */
43
44/**
45 * @brief Stream insertion operator.
46 *
47 * @param os the stream
48 * @param standard the standard
49 * @returns a reference to the stream
50 */
51inline std::ostream&
52operator<<(std::ostream& os, WifiStandard standard)
53{
54 switch (standard)
55 {
57 return (os << "802.11a");
59 return (os << "802.11b");
61 return (os << "802.11g");
63 return (os << "802.11p");
65 return (os << "802.11n");
67 return (os << "802.11ac");
69 return (os << "802.11ad");
71 return (os << "802.11ax");
73 return (os << "802.11be");
74 default:
75 return (os << "UNSPECIFIED");
76 }
77}
78
79/**
80 * @brief map a given standard configured by the user to the allowed PHY bands
81 */
82WIFI_EXPORT extern const std::map<WifiStandard, std::list<WifiPhyBand>> wifiStandards;
83
84/**
85 * Get the type of the frequency channel for the given standard
86 *
87 * @param standard the standard
88 * @return the type of the frequency channel for the given standard
89 */
90inline FrequencyChannelType
92{
93 switch (standard)
94 {
99 default:
101 }
102}
103
104/**
105 * Get the default channel width for the given PHY standard and band.
106 *
107 * @param standard the given standard
108 * @param band the given PHY band
109 * @return the default channel width for the given standard
110 */
111inline MHz_u
113{
114 switch (standard)
115 {
117 return MHz_u{22};
119 return MHz_u{10};
121 return MHz_u{80};
123 return MHz_u{2160};
126 return (band == WIFI_PHY_BAND_2_4GHZ ? MHz_u{20} : MHz_u{80});
127 default:
128 return MHz_u{20};
129 }
130}
131
132/**
133 * Get the default PHY band for the given standard.
134 *
135 * @param standard the given standard
136 * @return the default PHY band for the given standard
137 */
138inline WifiPhyBand
140{
141 switch (standard)
142 {
148 return WIFI_PHY_BAND_5GHZ;
150 return WIFI_PHY_BAND_60GHZ;
151 default:
153 }
154}
155
156/**
157 * Get the TypeId name for the FrameExchangeManager corresponding to the given standard.
158 *
159 * @param standard the given standard
160 * @param qosSupported whether QoS is supported (ignored if standard is at least HT)
161 * @return the TypeId name for the FrameExchangeManager corresponding to the given standard
162 */
163inline std::string
165{
166 if (standard >= WIFI_STANDARD_80211be)
167 {
168 return "ns3::EhtFrameExchangeManager";
169 }
170 if (standard >= WIFI_STANDARD_80211ax)
171 {
172 return "ns3::HeFrameExchangeManager";
173 }
174 if (standard >= WIFI_STANDARD_80211ac)
175 {
176 return "ns3::VhtFrameExchangeManager";
177 }
178 if (standard >= WIFI_STANDARD_80211n)
179 {
180 return "ns3::HtFrameExchangeManager";
181 }
182 if (qosSupported)
183 {
184 return "ns3::QosFrameExchangeManager";
185 }
186 return "ns3::FrameExchangeManager";
187}
188
189} // namespace ns3
190
191#endif /* WIFI_STANDARD_H */
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
@ WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211ad
@ WIFI_STANDARD_COUNT
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211be
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_60GHZ
The 60 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::string GetFrameExchangeManagerTypeIdName(WifiStandard standard, bool qosSupported)
Get the TypeId name for the FrameExchangeManager corresponding to the given standard.
double MHz_u
MHz weak type.
Definition wifi-units.h:31
MHz_u GetDefaultChannelWidth(WifiStandard standard, WifiPhyBand band)
Get the default channel width for the given PHY standard and band.
WifiPhyBand GetDefaultPhyBand(WifiStandard standard)
Get the default PHY band for the given standard.
const std::map< WifiStandard, std::list< WifiPhyBand > > wifiStandards
map a given standard configured by the user to the allowed PHY bands
FrequencyChannelType GetFrequencyChannelType(WifiStandard standard)
Get the type of the frequency channel for the given standard.
Declaration of the SI units (as weak types aliases) used across wifi module.