wifi: Make DSSS Parameter Set IE optional in mgt frames

This commit is contained in:
Stefano Avallone
2022-07-13 07:57:50 +02:00
parent 03a5b068f9
commit 552f251a1f
5 changed files with 12 additions and 61 deletions

View File

@@ -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;
}

View File

@@ -478,7 +478,7 @@ MgtProbeResponseHeader::SetDsssParameterSet (DsssParameterSet&& dsssParameterSet
m_dsssParameterSet = std::move (dsssParameterSet);
}
const DsssParameterSet&
const std::optional<DsssParameterSet>&
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);

View File

@@ -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<DsssParameterSet>& 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<DsssParameterSet> m_dsssParameterSet; //!< DSSS Parameter Set
std::optional<ExtendedCapabilities> m_extendedCapability; //!< extended capabilities
std::optional<HtCapabilities> m_htCapability; //!< HT capabilities
std::optional<HtOperation> m_htOperation; //!< HT operation

View File

@@ -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

View File

@@ -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