From fa91aa4bfffac41f58728d898769d9288787b9c4 Mon Sep 17 00:00:00 2001 From: Rediet Date: Tue, 19 Jan 2021 11:22:54 +0100 Subject: [PATCH] wifi: Rename wifi-preamble.h as wifi-phy-common.h Holds all enums which might be updated upon the addition of a new PHY standard (as suggested by Sebastien) Also cleaned up obsolete modulation classes --- src/wave/model/channel-manager.h | 2 +- src/wifi/helper/athstats-helper.cc | 2 +- src/wifi/model/wifi-mode.h | 36 +------ src/wifi/model/wifi-phy-common.h | 144 +++++++++++++++++++++++++ src/wifi/model/wifi-phy-state-helper.h | 2 +- src/wifi/model/wifi-phy-tag.h | 2 +- src/wifi/model/wifi-preamble.h | 85 --------------- src/wifi/model/wifi-tx-vector.h | 2 +- src/wifi/model/wifi-utils.h | 2 +- src/wifi/wscript | 2 +- 10 files changed, 153 insertions(+), 126 deletions(-) create mode 100644 src/wifi/model/wifi-phy-common.h delete mode 100644 src/wifi/model/wifi-preamble.h diff --git a/src/wave/model/channel-manager.h b/src/wave/model/channel-manager.h index c9e31d01b..35a1e8084 100644 --- a/src/wave/model/channel-manager.h +++ b/src/wave/model/channel-manager.h @@ -21,7 +21,7 @@ #include #include "ns3/object.h" #include "ns3/wifi-mode.h" -#include "ns3/wifi-preamble.h" +#include "ns3/wifi-phy-common.h" namespace ns3 { diff --git a/src/wifi/helper/athstats-helper.cc b/src/wifi/helper/athstats-helper.cc index a003095c2..437082a98 100644 --- a/src/wifi/helper/athstats-helper.cc +++ b/src/wifi/helper/athstats-helper.cc @@ -22,7 +22,7 @@ #include "ns3/simulator.h" #include "ns3/config.h" #include "ns3/wifi-mode.h" -#include "ns3/wifi-preamble.h" +#include "ns3/wifi-phy-common.h" #include "ns3/wifi-phy-state.h" #include "ns3/net-device-container.h" #include "ns3/node-container.h" diff --git a/src/wifi/model/wifi-mode.h b/src/wifi/model/wifi-mode.h index 2edc428cc..8e659fa6a 100644 --- a/src/wifi/model/wifi-mode.h +++ b/src/wifi/model/wifi-mode.h @@ -22,8 +22,9 @@ #ifndef WIFI_MODE_H #define WIFI_MODE_H -#include +#include "wifi-phy-common.h" #include "ns3/attribute-helper.h" +#include namespace ns3 { @@ -31,39 +32,6 @@ namespace ns3 { class WifiTxVector; -/** - * This enumeration defines the modulation classes per - * (Table 9-4 "Modulation classes"; IEEE 802.11-2012). - */ -enum WifiModulationClass -{ - /** Modulation class unknown or unspecified. A WifiMode with this - WifiModulationClass has not been properly initialised. */ - WIFI_MOD_CLASS_UNKNOWN = 0, - /** Infrared (IR) (Clause 16) */ - WIFI_MOD_CLASS_IR, - /** Frequency-hopping spread spectrum (FHSS) PHY (Clause 14) */ - WIFI_MOD_CLASS_FHSS, - /** DSSS PHY (Clause 15) */ - WIFI_MOD_CLASS_DSSS, - /** HR/DSSS PHY (Clause 18) */ - WIFI_MOD_CLASS_HR_DSSS, - /** ERP-PBCC PHY (19.6) */ - WIFI_MOD_CLASS_ERP_PBCC, - /** DSSS-OFDM PHY (19.7) */ - WIFI_MOD_CLASS_DSSS_OFDM, - /** ERP-OFDM PHY (19.5) */ - WIFI_MOD_CLASS_ERP_OFDM, - /** OFDM PHY (Clause 17) */ - WIFI_MOD_CLASS_OFDM, - /** HT PHY (Clause 20) */ - WIFI_MOD_CLASS_HT, - /** VHT PHY (Clause 22) */ - WIFI_MOD_CLASS_VHT, - /** HE PHY (Clause 26) */ - WIFI_MOD_CLASS_HE -}; - /** * This enumeration defines the various convolutional coding rates * used for the OFDM transmission modes in the IEEE 802.11 diff --git a/src/wifi/model/wifi-phy-common.h b/src/wifi/model/wifi-phy-common.h new file mode 100644 index 000000000..0f415aa2e --- /dev/null +++ b/src/wifi/model/wifi-phy-common.h @@ -0,0 +1,144 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2005,2006,2007 INRIA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + */ + +#ifndef WIFI_PHY_COMMON_H +#define WIFI_PHY_COMMON_H + +#include "ns3/fatal-error.h" + +/** + * \file + * \ingroup wifi + * Declaration of the following enums: + * - ns3::WifiPreamble + * - ns3::WifiModulationClass + */ + +namespace ns3 { + +/** + * \ingroup wifi + * The type of preamble to be used by an IEEE 802.11 transmission + */ +enum WifiPreamble +{ + WIFI_PREAMBLE_LONG, + WIFI_PREAMBLE_SHORT, + WIFI_PREAMBLE_HT_MF, + WIFI_PREAMBLE_HT_GF, + WIFI_PREAMBLE_VHT_SU, + WIFI_PREAMBLE_VHT_MU, + WIFI_PREAMBLE_HE_SU, + WIFI_PREAMBLE_HE_ER_SU, + WIFI_PREAMBLE_HE_MU, + WIFI_PREAMBLE_HE_TB +}; + +/** + * \brief Stream insertion operator. + * + * \param os the stream + * \param preamble the preamble + * \returns a reference to the stream + */ +inline std::ostream& operator<< (std::ostream &os, const WifiPreamble &preamble) +{ + switch (preamble) + { + case WIFI_PREAMBLE_LONG: + return (os << "LONG"); + case WIFI_PREAMBLE_SHORT: + return (os << "SHORT"); + case WIFI_PREAMBLE_HT_MF: + return (os << "HT_MF"); + case WIFI_PREAMBLE_HT_GF: + return (os << "HT_GF"); + case WIFI_PREAMBLE_VHT_SU: + return (os << "VHT_SU"); + case WIFI_PREAMBLE_VHT_MU: + return (os << "VHT_MU"); + case WIFI_PREAMBLE_HE_SU: + return (os << "HE_SU"); + case WIFI_PREAMBLE_HE_ER_SU: + return (os << "HE_ER_SU"); + case WIFI_PREAMBLE_HE_MU: + return (os << "HE_MU"); + case WIFI_PREAMBLE_HE_TB: + return (os << "HE_TB"); + default: + NS_FATAL_ERROR ("Invalid preamble"); + return (os << "INVALID"); + } +} + +/** + * \ingroup wifi + * This enumeration defines the modulation classes per + * (Table 10-6 "Modulation classes"; IEEE 802.11-2016, with + * updated in 802.11ax/D6.0 as Table 10-9). + */ +enum WifiModulationClass +{ + /** Modulation class unknown or unspecified. A WifiMode with this + WifiModulationClass has not been properly initialized. */ + WIFI_MOD_CLASS_UNKNOWN = 0, + WIFI_MOD_CLASS_DSSS, //!< DSSS (Clause 15) + WIFI_MOD_CLASS_HR_DSSS, //!< HR/DSSS (Clause 16) + WIFI_MOD_CLASS_ERP_OFDM, //:< ERP-OFDM (18.4) + WIFI_MOD_CLASS_OFDM, //!< OFDM (Clause 17) + WIFI_MOD_CLASS_HT, //!< HT (Clause 19) + WIFI_MOD_CLASS_VHT, //!< VHT (Clause 21) + WIFI_MOD_CLASS_HE //!< HE (Clause 27) +}; + +/** + * \brief Stream insertion operator. + * + * \param os the stream + * \param modulation the WifiModulationClass + * \returns a reference to the stream + */ +inline std::ostream& operator<< (std::ostream &os, const WifiModulationClass &modulation) +{ + switch (modulation) + { + case WIFI_MOD_CLASS_DSSS: + return (os << "DSSS"); + case WIFI_MOD_CLASS_HR_DSSS: + return (os << "HR/DSSS"); + case WIFI_MOD_CLASS_ERP_OFDM: + return (os << "ERP-OFDM"); + case WIFI_MOD_CLASS_OFDM: + return (os << "OFDM"); + case WIFI_MOD_CLASS_HT: + return (os << "HT"); + case WIFI_MOD_CLASS_VHT: + return (os << "VHT"); + case WIFI_MOD_CLASS_HE: + return (os << "HE"); + default: + NS_FATAL_ERROR ("Unknown modulation"); + return (os << "unknown"); + } +} + +} //namespace ns3 + +#endif /* WIFI_PHY_COMMON_H */ diff --git a/src/wifi/model/wifi-phy-state-helper.h b/src/wifi/model/wifi-phy-state-helper.h index ab3afdf2a..0d43d361d 100644 --- a/src/wifi/model/wifi-phy-state-helper.h +++ b/src/wifi/model/wifi-phy-state-helper.h @@ -26,7 +26,7 @@ #include "ns3/traced-callback.h" #include "ns3/nstime.h" #include "wifi-phy-state.h" -#include "wifi-preamble.h" +#include "wifi-phy-common.h" #include "wifi-ppdu.h" namespace ns3 { diff --git a/src/wifi/model/wifi-phy-tag.h b/src/wifi/model/wifi-phy-tag.h index 99a450bf8..8d2262f26 100644 --- a/src/wifi/model/wifi-phy-tag.h +++ b/src/wifi/model/wifi-phy-tag.h @@ -22,7 +22,7 @@ #define WIFI_PHY_TAG_H #include "ns3/tag.h" -#include "wifi-preamble.h" +#include "wifi-phy-common.h" #include "wifi-mode.h" namespace ns3 { diff --git a/src/wifi/model/wifi-preamble.h b/src/wifi/model/wifi-preamble.h deleted file mode 100644 index 0f0affa11..000000000 --- a/src/wifi/model/wifi-preamble.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2005,2006,2007 INRIA - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Mathieu Lacage - */ - -#ifndef WIFI_PREAMBLE_H -#define WIFI_PREAMBLE_H - -#include "ns3/fatal-error.h" - -namespace ns3 { - -/** - * \ingroup wifi - * The type of preamble to be used by an IEEE 802.11 transmission - */ -enum WifiPreamble -{ - WIFI_PREAMBLE_LONG, - WIFI_PREAMBLE_SHORT, - WIFI_PREAMBLE_HT_MF, - WIFI_PREAMBLE_HT_GF, - WIFI_PREAMBLE_VHT_SU, - WIFI_PREAMBLE_VHT_MU, - WIFI_PREAMBLE_HE_SU, - WIFI_PREAMBLE_HE_ER_SU, - WIFI_PREAMBLE_HE_MU, - WIFI_PREAMBLE_HE_TB -}; - -/** -* \brief Stream insertion operator. -* -* \param os the stream -* \param preamble the preamble -* \returns a reference to the stream -*/ -inline std::ostream& operator<< (std::ostream& os, WifiPreamble preamble) -{ - switch (preamble) - { - case WIFI_PREAMBLE_LONG: - return (os << "LONG"); - case WIFI_PREAMBLE_SHORT: - return (os << "SHORT"); - case WIFI_PREAMBLE_HT_MF: - return (os << "HT_MF"); - case WIFI_PREAMBLE_HT_GF: - return (os << "HT_GF"); - case WIFI_PREAMBLE_VHT_SU: - return (os << "VHT_SU"); - case WIFI_PREAMBLE_VHT_MU: - return (os << "VHT_MU"); - case WIFI_PREAMBLE_HE_SU: - return (os << "HE_SU"); - case WIFI_PREAMBLE_HE_ER_SU: - return (os << "HE_ER_SU"); - case WIFI_PREAMBLE_HE_MU: - return (os << "HE_MU"); - case WIFI_PREAMBLE_HE_TB: - return (os << "HE_TB"); - default: - NS_FATAL_ERROR ("Invalid preamble"); - return (os << "INVALID"); - } -} - -} //namespace ns3 - -#endif /* WIFI_PREAMBLE_H */ diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h index d4a7fa7a9..6482e0900 100644 --- a/src/wifi/model/wifi-tx-vector.h +++ b/src/wifi/model/wifi-tx-vector.h @@ -24,7 +24,7 @@ #include #include "wifi-mode.h" -#include "wifi-preamble.h" +#include "wifi-phy-common.h" #include "he-ru.h" namespace ns3 { diff --git a/src/wifi/model/wifi-utils.h b/src/wifi/model/wifi-utils.h index 6d3dc021f..d6a20ecde 100644 --- a/src/wifi/model/wifi-utils.h +++ b/src/wifi/model/wifi-utils.h @@ -22,7 +22,7 @@ #define WIFI_UTILS_H #include "block-ack-type.h" -#include "wifi-preamble.h" +#include "wifi-phy-common.h" #include "wifi-mode.h" namespace ns3 { diff --git a/src/wifi/wscript b/src/wifi/wscript index 072609edb..6a507881d 100644 --- a/src/wifi/wscript +++ b/src/wifi/wscript @@ -154,7 +154,7 @@ def build(bld): 'model/wifi-net-device.h', 'model/wifi-mode.h', 'model/ssid.h', - 'model/wifi-preamble.h', + 'model/wifi-phy-common.h', 'model/wifi-phy-band.h', 'model/wifi-standards.h', 'model/yans-wifi-phy.h',