From 552f251a1fc2eeb3321b9bca97c61ead049caa30 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 13 Jul 2022 07:57:50 +0200 Subject: [PATCH] wifi: Make DSSS Parameter Set IE optional in mgt frames --- src/wifi/model/ap-wifi-mac.cc | 7 ++--- src/wifi/model/mgt-headers.cc | 8 ++--- src/wifi/model/mgt-headers.h | 8 ++--- src/wifi/model/non-ht/dsss-parameter-set.cc | 35 ++------------------- src/wifi/model/non-ht/dsss-parameter-set.h | 15 --------- 5 files changed, 12 insertions(+), 61 deletions(-) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 20d576774..626bec06b 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -439,12 +439,9 @@ DsssParameterSet ApWifiMac::GetDsssParameterSet (uint8_t linkId) const { NS_LOG_FUNCTION (this << +linkId); + NS_ASSERT (GetDsssSupported (linkId)); DsssParameterSet dsssParameters; - if (GetDsssSupported (linkId)) - { - dsssParameters.SetDsssSupported (1); - dsssParameters.SetCurrentChannel (GetWifiPhy (linkId)->GetChannelNumber ()); - } + dsssParameters.SetCurrentChannel (GetWifiPhy (linkId)->GetChannelNumber ()); return dsssParameters; } diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index cea36a6e2..ac2d5b535 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -478,7 +478,7 @@ MgtProbeResponseHeader::SetDsssParameterSet (DsssParameterSet&& dsssParameterSet m_dsssParameterSet = std::move (dsssParameterSet); } -const DsssParameterSet& +const std::optional& MgtProbeResponseHeader::GetDsssParameterSet (void) const { return m_dsssParameterSet; @@ -588,7 +588,7 @@ MgtProbeResponseHeader::GetSerializedSize (void) const size += m_capability.GetSerializedSize (); size += m_ssid.GetSerializedSize (); size += m_rates.GetSerializedSize (); - size += m_dsssParameterSet.GetSerializedSize (); + if (m_dsssParameterSet.has_value ()) size += m_dsssParameterSet->GetSerializedSize (); if (m_erpInformation.has_value ()) size += m_erpInformation->GetSerializedSize (); size += m_rates.extended.GetSerializedSize (); if (m_edcaParameterSet.has_value ()) size += m_edcaParameterSet->GetSerializedSize (); @@ -631,7 +631,7 @@ MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const i = m_capability.Serialize (i); i = m_ssid.Serialize (i); i = m_rates.Serialize (i); - i = m_dsssParameterSet.Serialize (i); + if (m_dsssParameterSet.has_value ()) i = m_dsssParameterSet->Serialize (i); if (m_erpInformation.has_value ()) i = m_erpInformation->Serialize (i); i = m_rates.extended.Serialize (i); if (m_edcaParameterSet.has_value ()) i = m_edcaParameterSet->Serialize (i); @@ -658,7 +658,7 @@ MgtProbeResponseHeader::Deserialize (Buffer::Iterator start) i = m_capability.Deserialize (i); i = m_ssid.Deserialize (i); i = m_rates.Deserialize (i); - i = m_dsssParameterSet.DeserializeIfPresent (i); + i = WifiInformationElement::DeserializeIfPresent (m_dsssParameterSet, i); i = WifiInformationElement::DeserializeIfPresent (m_erpInformation, i); i = m_rates.extended.DeserializeIfPresent (i); i = WifiInformationElement::DeserializeIfPresent (m_edcaParameterSet, i); diff --git a/src/wifi/model/mgt-headers.h b/src/wifi/model/mgt-headers.h index 4475f28ef..1d4a06e1d 100644 --- a/src/wifi/model/mgt-headers.h +++ b/src/wifi/model/mgt-headers.h @@ -914,11 +914,11 @@ public: */ const CapabilityInformation& GetCapabilities (void) const; /** - * Return the DSSS Parameter Set. + * Return the DSSS Parameter Set, if present. * - * \return the DSSS Parameter Set + * \return the DSSS Parameter Set, if present */ - const DsssParameterSet& GetDsssParameterSet (void) const; + const std::optional& GetDsssParameterSet (void) const; /** * Return the extended capabilities, if present. * @@ -1194,7 +1194,7 @@ private: uint64_t m_beaconInterval; //!< Beacon interval SupportedRates m_rates; //!< List of supported rates CapabilityInformation m_capability; //!< Capability information - DsssParameterSet m_dsssParameterSet; //!< DSSS Parameter Set + std::optional m_dsssParameterSet; //!< DSSS Parameter Set std::optional m_extendedCapability; //!< extended capabilities std::optional m_htCapability; //!< HT capabilities std::optional m_htOperation; //!< HT operation diff --git a/src/wifi/model/non-ht/dsss-parameter-set.cc b/src/wifi/model/non-ht/dsss-parameter-set.cc index 5d9f4987c..ffa6f963c 100644 --- a/src/wifi/model/non-ht/dsss-parameter-set.cc +++ b/src/wifi/model/non-ht/dsss-parameter-set.cc @@ -23,8 +23,7 @@ namespace ns3 { DsssParameterSet::DsssParameterSet () - : m_currentChannel (0), - m_dsssSupported (0) + : m_currentChannel (0) { } @@ -34,12 +33,6 @@ DsssParameterSet::ElementId () const return IE_DSSS_PARAMETER_SET; } -void -DsssParameterSet::SetDsssSupported (uint8_t dsssSupported) -{ - m_dsssSupported = dsssSupported; -} - void DsssParameterSet::SetCurrentChannel (uint8_t currentChannel) { @@ -49,37 +42,13 @@ DsssParameterSet::SetCurrentChannel (uint8_t currentChannel) uint8_t DsssParameterSet::GetInformationFieldSize () const { - NS_ASSERT (m_dsssSupported); return 1; } -Buffer::Iterator -DsssParameterSet::Serialize (Buffer::Iterator i) const -{ - if (!m_dsssSupported) - { - return i; - } - return WifiInformationElement::Serialize (i); -} - -uint16_t -DsssParameterSet::GetSerializedSize () const -{ - if (!m_dsssSupported) - { - return 0; - } - return WifiInformationElement::GetSerializedSize (); -} - void DsssParameterSet::SerializeInformationField (Buffer::Iterator start) const { - if (m_dsssSupported) - { - start.WriteU8 (m_currentChannel); - } + start.WriteU8 (m_currentChannel); } uint8_t diff --git a/src/wifi/model/non-ht/dsss-parameter-set.h b/src/wifi/model/non-ht/dsss-parameter-set.h index d1a2c4676..5874afe04 100644 --- a/src/wifi/model/non-ht/dsss-parameter-set.h +++ b/src/wifi/model/non-ht/dsss-parameter-set.h @@ -41,18 +41,6 @@ public: uint8_t GetInformationFieldSize () const override; void SerializeInformationField (Buffer::Iterator start) const override; uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length) override; - /* This information element is a bit special in that it is only - included if the STA does support DSSS. To support this we - override the Serialize and GetSerializedSize methods of - WifiInformationElement. */ - Buffer::Iterator Serialize (Buffer::Iterator start) const override; - uint16_t GetSerializedSize () const override; - - /** - * Set DSSS supported - * \param dsssSupported the DSSS supported indicator - */ - void SetDsssSupported (uint8_t dsssSupported); /** * Set the Current Channel field in the DsssParameterSet information element. @@ -64,9 +52,6 @@ public: private: uint8_t m_currentChannel; ///< current channel number - - /// This is used to decide whether this element should be added to the frame or not - bool m_dsssSupported; }; } //namespace ns3