27#include "ns3/wifi-phy.h"
28#include "ns3/wifi-psdu.h"
29#include "ns3/wifi-utils.h"
38 uint16_t txCenterFreq,
49 NS_LOG_FUNCTION(
this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
58#ifdef NS3_BUILD_PROFILE_DEBUG
76 uint8_t sigExtension = 0;
81 uint16_t length = ((ceil((
static_cast<double>(ppduDuration.
GetNanoSeconds() - (20 * 1000) -
82 (sigExtension * 1000)) /
106#ifdef NS3_BUILD_PROFILE_DEBUG
110 if (phyHeaders->RemoveHeader(lSig) == 0)
116 if (phyHeaders->RemoveHeader(htSig) == 0)
147 uint16_t htLength = 0;
148#ifdef NS3_BUILD_PROFILE_DEBUG
152 phyHeaders->RemoveHeader(lSig);
154 phyHeaders->RemoveHeader(htSig);
158 htLength = m_htSig.GetHtLength();
185 .SetGroupName(
"Wifi")
199 os <<
"MCS=" << +m_mcs <<
" HT_LENGTH=" << m_htLength <<
" CHANNEL_WIDTH=" << GetChannelWidth()
200 <<
" SGI=" << +m_sgi <<
" AGGREGATION=" << +m_aggregation;
225 m_cbw20_40 = (channelWidth > 20) ? 1 : 0;
231 return m_cbw20_40 ? 40 : 20;
249 m_aggregation = aggregation ? 1 : 0;
255 return m_aggregation;
273 uint8_t
byte = m_mcs;
274 byte |= ((m_cbw20_40 & 0x01) << 7);
276 start.WriteU16(m_htLength);
278 byte |= ((m_aggregation & 0x01) << 3);
279 byte |= ((m_sgi & 0x01) << 7);
288 uint8_t
byte = i.
ReadU8();
290 m_cbw20_40 = ((
byte >> 7) & 0x01);
293 m_aggregation = ((
byte >> 3) & 0x01);
294 m_sgi = ((
byte >> 7) & 0x01);
iterator in a Buffer instance
uint32_t GetDistanceFrom(const Iterator &o) const
static WifiMode GetHtMcs(uint8_t index)
Return the HT MCS corresponding to the provided index.
WifiTxVector DoGetTxVector() const override
Get the TXVECTOR used to send the PPDU.
Ptr< WifiPpdu > Copy() const override
Copy this instance.
void SetHtSigHeader(HtSigHeader &htSig, const WifiTxVector &txVector, std::size_t psduSize) const
Fill in the HT-SIG header.
virtual void SetLSigHeader(LSigHeader &lSig, Time ppduDuration) const
Fill in the L-SIG header.
void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration, std::size_t psduSize)
Fill in the PHY headers.
void SetTxVectorFromPhyHeaders(WifiTxVector &txVector, const LSigHeader &lSig, const HtSigHeader &htSig) const
Fill in the TXVECTOR from PHY headers.
Time GetTxDuration() const override
Get the total transmission duration of the PPDU.
HtPpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint16_t txCenterFreq, Time ppduDuration, WifiPhyBand band, uint64_t uid)
Create an HT PPDU.
WifiPhyBand m_band
the WifiPhyBand used to transmit that PPDU
void AddHeader(const Header &header)
Add header to this packet.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint8_t GetMcsValue() const
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiPreamble m_preamble
the PHY preamble
const WifiTxVector & GetTxVector() const
Get the TXVECTOR used to send the PPDU.
Ptr< Packet > m_phyHeaders
the PHY headers contained in this PPDU
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetGuardInterval() const
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
bool IsAggregation() const
Checks whether the PSDU contains A-MPDU.
uint16_t GetChannelWidth() const
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyBand
Identifies the PHY band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Declaration of ns3::HtPhy class.
Declaration of ns3::HtPpdu class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.