wifi: Move setting of PHY headers in a seperate function for all WifiPpdu child classes
This commit is contained in:
committed by
Sébastien Deronne
parent
49befbc216
commit
7179427b49
@@ -47,6 +47,13 @@ HtPpdu::HtPpdu(Ptr<const WifiPsdu> psdu,
|
||||
false) // don't instantiate LSigHeader of OfdmPpdu
|
||||
{
|
||||
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
|
||||
SetPhyHeaders(txVector, ppduDuration, psdu->GetSize());
|
||||
}
|
||||
|
||||
void
|
||||
HtPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration, std::size_t psduSize)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration << psduSize);
|
||||
uint8_t sigExtension = 0;
|
||||
if (m_band == WIFI_PHY_BAND_2_4GHZ)
|
||||
{
|
||||
@@ -61,7 +68,7 @@ HtPpdu::HtPpdu(Ptr<const WifiPsdu> psdu,
|
||||
m_lSig.SetLength(length);
|
||||
m_htSig.SetMcs(txVector.GetMode().GetMcsValue());
|
||||
m_htSig.SetChannelWidth(m_channelWidth);
|
||||
m_htSig.SetHtLength(psdu->GetSize());
|
||||
m_htSig.SetHtLength(psduSize);
|
||||
m_htSig.SetAggregation(txVector.IsAggregation());
|
||||
m_htSig.SetShortGuardInterval(txVector.GetGuardInterval() == 400);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,15 @@ class HtPpdu : public OfdmPpdu
|
||||
private:
|
||||
WifiTxVector DoGetTxVector() const override;
|
||||
|
||||
/**
|
||||
* Fill in the PHY headers.
|
||||
*
|
||||
* \param txVector the TXVECTOR that was used for this PPDU
|
||||
* \param ppduDuration the transmission duration of this PPDU
|
||||
* \param psduSize the size duration of the PHY payload (PSDU)
|
||||
*/
|
||||
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration, std::size_t psduSize);
|
||||
|
||||
HtSigHeader m_htSig; //!< the HT-SIG PHY header
|
||||
}; // class HtPpdu
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@ DsssPpdu::DsssPpdu(Ptr<const WifiPsdu> psdu,
|
||||
: WifiPpdu(psdu, txVector, txCenterFreq, uid)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << uid);
|
||||
SetPhyHeaders(txVector, ppduDuration);
|
||||
}
|
||||
|
||||
void
|
||||
DsssPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration);
|
||||
m_dsssSig.SetRate(txVector.GetMode().GetDataRate(22));
|
||||
Time psduDuration = ppduDuration - WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
|
||||
m_dsssSig.SetLength(psduDuration.GetMicroSeconds());
|
||||
|
||||
@@ -117,6 +117,14 @@ class DsssPpdu : public WifiPpdu
|
||||
private:
|
||||
WifiTxVector DoGetTxVector() const override;
|
||||
|
||||
/**
|
||||
* Fill in the PHY headers.
|
||||
*
|
||||
* \param txVector the TXVECTOR that was used for this PPDU
|
||||
* \param ppduDuration the transmission duration of this PPDU
|
||||
*/
|
||||
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
|
||||
|
||||
DsssSigHeader m_dsssSig; //!< the DSSS SIG PHY header
|
||||
}; // class DsssPpdu
|
||||
|
||||
|
||||
@@ -45,11 +45,18 @@ OfdmPpdu::OfdmPpdu(Ptr<const WifiPsdu> psdu,
|
||||
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid);
|
||||
if (instantiateLSig)
|
||||
{
|
||||
m_lSig.SetRate(txVector.GetMode().GetDataRate(txVector), m_channelWidth);
|
||||
m_lSig.SetLength(psdu->GetSize());
|
||||
SetPhyHeaders(txVector, psdu->GetSize());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OfdmPpdu::SetPhyHeaders(const WifiTxVector& txVector, std::size_t psduSize)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << psduSize);
|
||||
m_lSig.SetRate(txVector.GetMode().GetDataRate(txVector), m_channelWidth);
|
||||
m_lSig.SetLength(psduSize);
|
||||
}
|
||||
|
||||
WifiTxVector
|
||||
OfdmPpdu::DoGetTxVector() const
|
||||
{
|
||||
|
||||
@@ -128,6 +128,14 @@ class OfdmPpdu : public WifiPpdu
|
||||
|
||||
private:
|
||||
WifiTxVector DoGetTxVector() const override;
|
||||
|
||||
/**
|
||||
* Fill in the PHY headers.
|
||||
*
|
||||
* \param txVector the TXVECTOR that was used for this PPDU
|
||||
* \param psduSize the size duration of the PHY payload (PSDU)
|
||||
*/
|
||||
void SetPhyHeaders(const WifiTxVector& txVector, std::size_t psduSize);
|
||||
}; // class OfdmPpdu
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -46,6 +46,13 @@ VhtPpdu::VhtPpdu(Ptr<const WifiPsdu> psdu,
|
||||
false) // don't instantiate LSigHeader of OfdmPpdu
|
||||
{
|
||||
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
|
||||
SetPhyHeaders(txVector, ppduDuration);
|
||||
}
|
||||
|
||||
void
|
||||
VhtPpdu::SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << txVector << ppduDuration);
|
||||
uint16_t length =
|
||||
((ceil((static_cast<double>(ppduDuration.GetNanoSeconds() - (20 * 1000)) / 1000) / 4.0) *
|
||||
3) -
|
||||
|
||||
@@ -172,6 +172,14 @@ class VhtPpdu : public OfdmPpdu
|
||||
private:
|
||||
WifiTxVector DoGetTxVector() const override;
|
||||
|
||||
/**
|
||||
* Fill in the PHY headers.
|
||||
*
|
||||
* \param txVector the TXVECTOR that was used for this PPDU
|
||||
* \param ppduDuration the transmission duration of this PPDU
|
||||
*/
|
||||
void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
|
||||
|
||||
VhtSigHeader m_vhtSig; //!< the VHT-SIG PHY header
|
||||
}; // class VhtPpdu
|
||||
|
||||
|
||||
Reference in New Issue
Block a user