A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-phy-operating-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Stefano Avallone <stavallo@unina.it>
18 * Sébastien Deronne <sebastien.deronne@gmail.com>
19 */
20
21#ifndef WIFI_PHY_OPERATING_CHANNEL_H
22#define WIFI_PHY_OPERATING_CHANNEL_H
23
24#include "wifi-phy-band.h"
25#include "wifi-standards.h"
26
27#include "ns3/he-ru.h"
28
29#include <set>
30#include <tuple>
31
32namespace ns3
33{
34
38typedef std::tuple<uint8_t, uint16_t, uint16_t, FrequencyChannelType, WifiPhyBand>
40
47{
48 public:
50 typedef std::set<FrequencyChannelInfo>::const_iterator ConstIterator;
51
56
64
66
67 static const std::set<FrequencyChannelInfo>
69
75 bool IsSet() const;
89 void Set(uint8_t number,
90 uint16_t frequency,
91 uint16_t width,
92 WifiStandard standard,
93 WifiPhyBand band);
103 void SetDefault(uint16_t width, WifiStandard standard, WifiPhyBand band);
104
114 static uint8_t GetDefaultChannelNumber(uint16_t width, WifiStandard standard, WifiPhyBand band);
115
121 uint8_t GetNumber() const;
127 uint16_t GetFrequency() const;
133 uint16_t GetWidth() const;
139 WifiPhyBand GetPhyBand() const;
145 bool IsOfdm() const;
151 bool IsDsss() const;
157 bool Is80211p() const;
158
167 uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const;
168
177 uint8_t GetSecondaryChannelIndex(uint16_t secondaryChannelWidth) const;
178
185 void SetPrimary20Index(uint8_t index);
186
193 uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const;
194
201 uint16_t GetSecondaryChannelCenterFrequency(uint16_t secondaryChannelWidth) const;
202
213 std::set<uint8_t> GetAll20MHzChannelIndicesInPrimary(uint16_t width) const;
224 std::set<uint8_t> GetAll20MHzChannelIndicesInSecondary(uint16_t width) const;
236 std::set<uint8_t> GetAll20MHzChannelIndicesInSecondary(
237 const std::set<uint8_t>& primaryIndices) const;
238
252 static ConstIterator FindFirst(uint8_t number,
253 uint16_t frequency,
254 uint16_t width,
255 WifiStandard standard,
256 WifiPhyBand band,
257 ConstIterator start = m_frequencyChannels.begin());
258
266 uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth, WifiStandard standard) const;
267
276 std::set<uint8_t> Get20MHzIndicesCoveringRu(HeRu::RuSpec ru, uint16_t width) const;
277
278 private:
282};
283
284} // namespace ns3
285
286#endif /* WIFI_PHY_OPERATING_CHANNEL_H */
RU Specification.
Definition: he-ru.h:66
Class that keeps track of all information about the current PHY operating channel.
bool IsSet() const
Return true if a valid channel has been set, false otherwise.
WifiPhyOperatingChannel()
Create an uninitialized PHY operating channel.
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
uint16_t GetSecondaryChannelCenterFrequency(uint16_t secondaryChannelWidth) const
Get the center frequency of the secondary channel of the given width.
bool IsDsss() const
Return whether the operating channel is a DSSS channel.
uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
ConstIterator m_channelIt
const iterator pointing to the configured frequency channel
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
void Set(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band)
Set the channel according to the specified parameters if a unique frequency channel matches the speci...
bool Is80211p() const
Return whether the operating channel is an 802.11p channel.
uint8_t GetPrimaryChannelNumber(uint16_t primaryChannelWidth, WifiStandard standard) const
Get channel number of the primary channel.
void SetDefault(uint16_t width, WifiStandard standard, WifiPhyBand band)
Set the default channel of the given width and for the given standard and band.
bool IsOfdm() const
Return whether the operating channel is an OFDM channel.
uint16_t GetWidth() const
Return the width of the whole operating channel (in MHz).
static uint8_t GetDefaultChannelNumber(uint16_t width, WifiStandard standard, WifiPhyBand band)
Get the default channel number of the given width and for the given standard and band.
std::set< uint8_t > GetAll20MHzChannelIndicesInSecondary(uint16_t width) const
Get the channel indices of all the 20 MHz channels included in the secondary channel of the given wid...
std::set< uint8_t > Get20MHzIndicesCoveringRu(HeRu::RuSpec ru, uint16_t width) const
Get the channel indices of the minimum subset of 20 MHz channels containing the given RU.
uint8_t GetSecondaryChannelIndex(uint16_t secondaryChannelWidth) const
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary cha...
uint8_t m_primary20Index
index of the primary20 channel (0 indicates the 20 MHz subchannel with the lowest center frequency)
std::set< uint8_t > GetAll20MHzChannelIndicesInPrimary(uint16_t width) const
Get the channel indices of all the 20 MHz channels included in the primary channel of the given width...
WifiPhyBand GetPhyBand() const
Return the PHY band of the operating channel.
uint8_t GetNumber() const
Return the channel number identifying the whole operating channel.
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
std::set< FrequencyChannelInfo >::const_iterator ConstIterator
Typedef for a const iterator pointing to a channel in the set of available channels.
uint16_t GetFrequency() const
Return the center frequency of the operating channel (in MHz).
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::tuple< uint8_t, uint16_t, uint16_t, FrequencyChannelType, WifiPhyBand > FrequencyChannelInfo
A tuple (number, frequency, width, type, band) identifying a frequency channel.