wifi: Support DSSS Parameter Set information element
This commit is contained in:
@@ -389,6 +389,18 @@ ApWifiMac::GetSupportedRates (void) const
|
||||
return rates;
|
||||
}
|
||||
|
||||
DsssParameterSet
|
||||
ApWifiMac::GetDsssParameterSet (void) const
|
||||
{
|
||||
DsssParameterSet dsssParameters;
|
||||
if (m_dsssSupported)
|
||||
{
|
||||
dsssParameters.SetDsssSupported (1);
|
||||
dsssParameters.SetCurrentChannel (m_phy->GetChannelNumber ());
|
||||
}
|
||||
return dsssParameters;
|
||||
}
|
||||
|
||||
CapabilityInformation
|
||||
ApWifiMac::GetCapabilities (void) const
|
||||
{
|
||||
@@ -502,6 +514,10 @@ ApWifiMac::SendProbeResp (Mac48Address to)
|
||||
probe.SetCapabilities (GetCapabilities ());
|
||||
m_stationManager->SetShortPreambleEnabled (GetShortPreambleEnabled ());
|
||||
m_stationManager->SetShortSlotTimeEnabled (GetShortSlotTimeEnabled ());
|
||||
if (m_dsssSupported)
|
||||
{
|
||||
probe.SetDsssParameterSet (GetDsssParameterSet ());
|
||||
}
|
||||
if (m_erpSupported)
|
||||
{
|
||||
probe.SetErpInformation (GetErpInformation ());
|
||||
@@ -601,6 +617,10 @@ ApWifiMac::SendOneBeacon (void)
|
||||
beacon.SetCapabilities (GetCapabilities ());
|
||||
m_stationManager->SetShortPreambleEnabled (GetShortPreambleEnabled ());
|
||||
m_stationManager->SetShortSlotTimeEnabled (GetShortSlotTimeEnabled ());
|
||||
if (m_dsssSupported)
|
||||
{
|
||||
beacon.SetDsssParameterSet (GetDsssParameterSet ());
|
||||
}
|
||||
if (m_erpSupported)
|
||||
{
|
||||
beacon.SetErpInformation (GetErpInformation ());
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "vht-capabilities.h"
|
||||
#include "amsdu-subframe-header.h"
|
||||
#include "supported-rates.h"
|
||||
#include "dsss-parameter-set.h"
|
||||
#include "erp-information.h"
|
||||
#include "edca-parameter-set.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
@@ -228,6 +229,12 @@ private:
|
||||
* \return SupportedRates all rates that we support
|
||||
*/
|
||||
SupportedRates GetSupportedRates (void) const;
|
||||
/**
|
||||
* Return the DSSS Parameter Set that we support.
|
||||
*
|
||||
* \return the DSSS Parameter Set that we support
|
||||
*/
|
||||
DsssParameterSet GetDsssParameterSet (void) const;
|
||||
/**
|
||||
* Enable or disable beacon generation of the AP.
|
||||
*
|
||||
|
||||
116
src/wifi/model/dsss-parameter-set.cc
Normal file
116
src/wifi/model/dsss-parameter-set.cc
Normal file
@@ -0,0 +1,116 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2016 Sébastien Deronne
|
||||
*
|
||||
* 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: Sébastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include "dsss-parameter-set.h"
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/log.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("DsssParameterSet");
|
||||
|
||||
DsssParameterSet::DsssParameterSet ()
|
||||
: m_currentChannel (0),
|
||||
m_dsssSupported (0)
|
||||
{
|
||||
}
|
||||
|
||||
WifiInformationElementId
|
||||
DsssParameterSet::ElementId () const
|
||||
{
|
||||
return IE_DS_PARAMETER_SET;
|
||||
}
|
||||
|
||||
void
|
||||
DsssParameterSet::SetDsssSupported (uint8_t dsssSupported)
|
||||
{
|
||||
m_dsssSupported = dsssSupported;
|
||||
}
|
||||
|
||||
void
|
||||
DsssParameterSet::SetCurrentChannel (uint8_t currentChannel)
|
||||
{
|
||||
m_currentChannel = currentChannel;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
DsssParameterSet::GetCurrentChannel (void) const
|
||||
{
|
||||
return m_currentChannel;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
DsssParameterSet::GetInformationFieldSize () const
|
||||
{
|
||||
NS_ASSERT (m_dsssSupported > 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Buffer::Iterator
|
||||
DsssParameterSet::Serialize (Buffer::Iterator i) const
|
||||
{
|
||||
if (m_dsssSupported < 1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
return WifiInformationElement::Serialize (i);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
DsssParameterSet::GetSerializedSize () const
|
||||
{
|
||||
if (m_dsssSupported < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return WifiInformationElement::GetSerializedSize ();
|
||||
}
|
||||
|
||||
void
|
||||
DsssParameterSet::SerializeInformationField (Buffer::Iterator start) const
|
||||
{
|
||||
if (m_dsssSupported == 1)
|
||||
{
|
||||
start.WriteU8 (m_currentChannel);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
DsssParameterSet::DeserializeInformationField (Buffer::Iterator start, uint8_t length)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
m_currentChannel = i.ReadU8 ();
|
||||
return length;
|
||||
}
|
||||
|
||||
ATTRIBUTE_HELPER_CPP (DsssParameterSet);
|
||||
|
||||
std::ostream & operator << (std::ostream &os, const DsssParameterSet &DsssParameterSet)
|
||||
{
|
||||
return os;
|
||||
}
|
||||
|
||||
std::istream &operator >> (std::istream &is, DsssParameterSet &DsssParameterSet)
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
94
src/wifi/model/dsss-parameter-set.h
Normal file
94
src/wifi/model/dsss-parameter-set.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2016 Sébastien Deronne
|
||||
*
|
||||
* 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: Sébastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef DSSS_PARAMETER_SET_H
|
||||
#define DSSS_PARAMETER_SET_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ostream>
|
||||
#include "ns3/buffer.h"
|
||||
#include "ns3/wifi-information-element.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief The DSSS Parameter Set
|
||||
* \ingroup wifi
|
||||
*
|
||||
* This class knows how to serialise and deserialise the DSSS Parameter Set.
|
||||
*/
|
||||
class DsssParameterSet : public WifiInformationElement
|
||||
{
|
||||
public:
|
||||
DsssParameterSet ();
|
||||
void SetDsssSupported (uint8_t DsssSupported);
|
||||
|
||||
/**
|
||||
* Set the Current Channel field in the DsssParameterSet information element.
|
||||
*
|
||||
* \param qosInfo the CurrentChannel field in the DsssParameterSet information element
|
||||
*/
|
||||
void SetCurrentChannel (uint8_t currentChannel);
|
||||
|
||||
/*
|
||||
* Return the Current Channel field in the DsssParameterSet information element.
|
||||
*
|
||||
* \return the Current Channel field in the DsssParameterSet information element
|
||||
*/
|
||||
uint8_t GetCurrentChannel (void) const;
|
||||
|
||||
WifiInformationElementId ElementId () const;
|
||||
uint8_t GetInformationFieldSize () const;
|
||||
void SerializeInformationField (Buffer::Iterator start) const;
|
||||
uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* \param start
|
||||
*
|
||||
* \return an iterator
|
||||
*/
|
||||
Buffer::Iterator Serialize (Buffer::Iterator start) const;
|
||||
/**
|
||||
* Return the serialized size of this DSSS Parameter Set.
|
||||
*
|
||||
* \return the serialized size of this DSSS Parameter Set
|
||||
*/
|
||||
uint16_t GetSerializedSize () const;
|
||||
|
||||
private:
|
||||
uint8_t m_currentChannel;
|
||||
|
||||
//This is used to decide whether this element should be added to the frame or not
|
||||
bool m_dsssSupported;
|
||||
};
|
||||
|
||||
std::ostream &operator << (std::ostream &os, const DsssParameterSet &dsssParameterSet);
|
||||
std::istream &operator >> (std::istream &is, DsssParameterSet &dsssParameterSet);
|
||||
|
||||
ATTRIBUTE_HELPER_HEADER (DsssParameterSet);
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* DSSS_PARAMETER_SET_H */
|
||||
@@ -251,6 +251,18 @@ MgtProbeResponseHeader::SetSupportedRates (SupportedRates rates)
|
||||
m_rates = rates;
|
||||
}
|
||||
|
||||
void
|
||||
MgtProbeResponseHeader::SetDsssParameterSet (DsssParameterSet dsssParameterSet)
|
||||
{
|
||||
m_dsssParameterSet = dsssParameterSet;
|
||||
}
|
||||
|
||||
DsssParameterSet
|
||||
MgtProbeResponseHeader::GetDsssParameterSet (void) const
|
||||
{
|
||||
return m_dsssParameterSet;
|
||||
}
|
||||
|
||||
void
|
||||
MgtProbeResponseHeader::SetErpInformation (ErpInformation erpInformation)
|
||||
{
|
||||
@@ -301,7 +313,7 @@ MgtProbeResponseHeader::GetSerializedSize (void) const
|
||||
size += m_capability.GetSerializedSize ();
|
||||
size += m_ssid.GetSerializedSize ();
|
||||
size += m_rates.GetSerializedSize ();
|
||||
//size += 3; //ds parameter set
|
||||
size += m_dsssParameterSet.GetSerializedSize ();
|
||||
size += m_erpInformation.GetSerializedSize ();
|
||||
size += m_rates.extended.GetSerializedSize ();
|
||||
size += m_edcaParameterSet.GetSerializedSize ();
|
||||
@@ -316,6 +328,7 @@ MgtProbeResponseHeader::Print (std::ostream &os) const
|
||||
{
|
||||
os << "ssid=" << m_ssid << ", "
|
||||
<< "rates=" << m_rates << ", "
|
||||
<< "DSSS Parameter Set=" << m_dsssParameterSet << " , "
|
||||
<< "ERP information=" << m_erpInformation << ", "
|
||||
<< "HT Capabilities=" << m_htCapability << " , "
|
||||
<< "HT Operations=" << m_htOperations << " , "
|
||||
@@ -340,7 +353,7 @@ MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const
|
||||
i = m_capability.Serialize (i);
|
||||
i = m_ssid.Serialize (i);
|
||||
i = m_rates.Serialize (i);
|
||||
//i.WriteU8 (0, 3); //ds parameter set.
|
||||
i = m_dsssParameterSet.Serialize (i);
|
||||
i = m_erpInformation.Serialize (i);
|
||||
i = m_rates.extended.Serialize (i);
|
||||
i = m_edcaParameterSet.Serialize (i);
|
||||
@@ -359,7 +372,7 @@ MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
|
||||
i = m_capability.Deserialize (i);
|
||||
i = m_ssid.Deserialize (i);
|
||||
i = m_rates.Deserialize (i);
|
||||
//i.Next (3); //ds parameter set
|
||||
i = m_dsssParameterSet.DeserializeIfPresent (i);
|
||||
i = m_erpInformation.DeserializeIfPresent (i);
|
||||
i = m_rates.extended.DeserializeIfPresent (i);
|
||||
i = m_edcaParameterSet.DeserializeIfPresent (i);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "capability-information.h"
|
||||
#include "supported-rates.h"
|
||||
#include "ssid.h"
|
||||
#include "dsss-parameter-set.h"
|
||||
#include "ht-capabilities.h"
|
||||
#include "ht-operations.h"
|
||||
#include "vht-capabilities.h"
|
||||
@@ -387,6 +388,12 @@ public:
|
||||
* \return Capability information
|
||||
*/
|
||||
CapabilityInformation GetCapabilities (void) const;
|
||||
/**
|
||||
* Return the DSSS Parameter Set.
|
||||
*
|
||||
* \return the DSSS Parameter Set
|
||||
*/
|
||||
DsssParameterSet GetDsssParameterSet (void) const;
|
||||
/**
|
||||
* Return the HT capabilities.
|
||||
*
|
||||
@@ -459,6 +466,12 @@ public:
|
||||
* \param rates the supported rates
|
||||
*/
|
||||
void SetSupportedRates (SupportedRates rates);
|
||||
/**
|
||||
* Set the DSSS Parameter Set.
|
||||
*
|
||||
* \param dsssParameterSet the DSSS Parameter Set
|
||||
*/
|
||||
void SetDsssParameterSet (DsssParameterSet dsssParameterSet);
|
||||
/**
|
||||
* Set the ERP information.
|
||||
*
|
||||
@@ -496,6 +509,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
|
||||
HtCapabilities m_htCapability; //!< HT capabilities
|
||||
HtOperations m_htOperations; //!< HT operations
|
||||
VhtCapabilities m_vhtCapability; //!< VHT capabilities
|
||||
|
||||
@@ -43,7 +43,7 @@ RegularWifiMac::RegularWifiMac () :
|
||||
m_htSupported (0),
|
||||
m_vhtSupported (0),
|
||||
m_erpSupported (0),
|
||||
m_isDsssOnly (0)
|
||||
m_dsssSupported (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_rxMiddle = new MacRxMiddle ();
|
||||
@@ -523,9 +523,26 @@ void
|
||||
RegularWifiMac::SetErpSupported (bool enable)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (enable)
|
||||
{
|
||||
SetDsssSupported (true);
|
||||
}
|
||||
m_erpSupported = enable;
|
||||
}
|
||||
|
||||
void
|
||||
RegularWifiMac::SetDsssSupported (bool enable)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_dsssSupported = enable;
|
||||
}
|
||||
|
||||
bool
|
||||
RegularWifiMac::GetDsssSupported () const
|
||||
{
|
||||
return m_dsssSupported;
|
||||
}
|
||||
|
||||
void
|
||||
RegularWifiMac::SetCtsToSelfSupported (bool enable)
|
||||
{
|
||||
@@ -1108,9 +1125,9 @@ RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
|
||||
cwmax = 1023;
|
||||
break;
|
||||
case WIFI_PHY_STANDARD_80211b:
|
||||
SetDsssSupported (true);
|
||||
cwmin = 31;
|
||||
cwmax = 1023;
|
||||
m_isDsssOnly = true;
|
||||
break;
|
||||
default:
|
||||
NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
|
||||
@@ -1122,14 +1139,15 @@ RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
|
||||
void
|
||||
RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax)
|
||||
{
|
||||
bool isDsssOnly = m_dsssSupported && !m_erpSupported;
|
||||
//The special value of AC_BE_NQOS which exists in the Access
|
||||
//Category enumeration allows us to configure plain old DCF.
|
||||
ConfigureDcf (m_dca, cwMin, cwMax, m_isDsssOnly, AC_BE_NQOS);
|
||||
ConfigureDcf (m_dca, cwMin, cwMax, isDsssOnly, AC_BE_NQOS);
|
||||
|
||||
//Now we configure the EDCA functions
|
||||
for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
|
||||
{
|
||||
ConfigureDcf (i->second, cwMin, cwMax, m_isDsssOnly, i->first);
|
||||
ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -509,6 +509,24 @@ protected:
|
||||
* \return true if ERP is supported, false otherwise
|
||||
*/
|
||||
bool GetErpSupported () const;
|
||||
|
||||
/**
|
||||
* This Boolean is set \c true iff this WifiMac is to model
|
||||
* 802.11b. It is exposed through the attribute system.
|
||||
*/
|
||||
bool m_dsssSupported;
|
||||
/**
|
||||
* Enable or disable DSSS support for the device.
|
||||
*
|
||||
* \param enable whether DSSS is supported
|
||||
*/
|
||||
void SetDsssSupported (bool enable);
|
||||
/**
|
||||
* Return whether the device supports DSSS.
|
||||
*
|
||||
* \return true if DSSS is supported, false otherwise
|
||||
*/
|
||||
bool GetDsssSupported () const;
|
||||
|
||||
|
||||
private:
|
||||
@@ -561,7 +579,6 @@ private:
|
||||
TracedCallback<const WifiMacHeader &> m_txErrCallback;
|
||||
|
||||
bool m_shortSlotTimeSupported;
|
||||
bool m_isDsssOnly;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -78,6 +78,7 @@ def build(bld):
|
||||
'model/vht-capabilities.cc',
|
||||
'model/erp-information.cc',
|
||||
'model/ht-operations.cc',
|
||||
'model/dsss-parameter-set.cc',
|
||||
'model/edca-parameter-set.cc',
|
||||
'helper/wifi-radio-energy-model-helper.cc',
|
||||
'helper/vht-wifi-mac-helper.cc',
|
||||
@@ -181,6 +182,7 @@ def build(bld):
|
||||
'model/vht-capabilities.h',
|
||||
'model/erp-information.h',
|
||||
'model/ht-operations.h',
|
||||
'model/dsss-parameter-set.h',
|
||||
'model/edca-parameter-set.h',
|
||||
'helper/wifi-radio-energy-model-helper.h',
|
||||
'helper/vht-wifi-mac-helper.h',
|
||||
|
||||
Reference in New Issue
Block a user