diff --git a/src/wave/helper/wave-helper.cc b/src/wave/helper/wave-helper.cc index 8e1fc6cd7..1a6f7ecbd 100644 --- a/src/wave/helper/wave-helper.cc +++ b/src/wave/helper/wave-helper.cc @@ -88,12 +88,12 @@ AsciiPhyReceiveSinkWithoutContext ( static void PcapSniffTxEvent ( Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - uint8_t txPower) + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector) { uint32_t dlt = file->GetDataLinkType (); @@ -121,7 +121,12 @@ PcapSniffTxEvent ( { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } - + + if (txvector.IsShortGuardInterval ()) + { + frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; + } + header.SetFrameFlags (frameFlags); header.SetRate (rate); @@ -164,13 +169,14 @@ PcapSniffTxEvent ( static void PcapSniffRxEvent ( Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - double signalDbm, - double noiseDbm) + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector, + double signalDbm, + double noiseDbm) { uint32_t dlt = file->GetDataLinkType (); @@ -199,6 +205,11 @@ PcapSniffRxEvent ( frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } + if (txvector.IsShortGuardInterval ()) + { + frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; + } + header.SetFrameFlags (frameFlags); header.SetRate (rate); diff --git a/src/wifi/helper/yans-wifi-helper.cc b/src/wifi/helper/yans-wifi-helper.cc index 55efe5a41..c7fb2ba89 100644 --- a/src/wifi/helper/yans-wifi-helper.cc +++ b/src/wifi/helper/yans-wifi-helper.cc @@ -248,12 +248,12 @@ YansWifiPhyHelper::Create (Ptr node, Ptr device) const static void PcapSniffTxEvent ( Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - uint8_t txPower) + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector) { uint32_t dlt = file->GetDataLinkType (); @@ -281,6 +281,11 @@ PcapSniffTxEvent ( { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } + + if (txvector.IsShortGuardInterval ()) + { + frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; + } header.SetFrameFlags (frameFlags); header.SetRate (rate); @@ -310,7 +315,6 @@ PcapSniffTxEvent ( } header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags); - p->AddHeader (header); file->Write (Simulator::Now (), p); @@ -324,13 +328,14 @@ PcapSniffTxEvent ( static void PcapSniffRxEvent ( Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - double signalDbm, - double noiseDbm) + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector, + double signalDbm, + double noiseDbm) { uint32_t dlt = file->GetDataLinkType (); @@ -358,6 +363,11 @@ PcapSniffRxEvent ( { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } + + if (txvector.IsShortGuardInterval ()) + { + frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; + } header.SetFrameFlags (frameFlags); header.SetRate (rate); diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 08530fad5..2c6a895b2 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -382,10 +382,9 @@ WifiPhy::GetPlcpPreambleDuration (WifiMode payloadMode, WifiPreamble preamble) Time WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txvector, WifiPreamble preamble, double frequency, uint8_t packetType, uint8_t incFlag) { - WifiMode payloadMode=txvector.GetMode(); - + WifiMode payloadMode = txvector.GetMode(); NS_LOG_FUNCTION (size << payloadMode); - + switch (payloadMode.GetModulationClass ()) { case WIFI_MOD_CLASS_OFDM: @@ -632,15 +631,15 @@ WifiPhy::NotifyRxDrop (Ptr packet) } void -WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm) +WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, double signalDbm, double noiseDbm) { - m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm); + m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, signalDbm, noiseDbm); } void -WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower) +WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector) { - m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txPower); + m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector); } diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index c2b44996f..67075d5a2 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1011,13 +1011,14 @@ public: * \param rate the PHY data rate in units of 500kbps (i.e., the same * units used both for the radiotap and for the prism header) * \param isShortPreamble true if short preamble is used, false otherwise + * \param txVector the txvector that holds rx parameters * \param signalDbm signal power in dBm * \param noiseDbm noise power in dBm */ void NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, double signalDbm, - double noiseDbm); + bool isShortPreamble, WifiTxVector txvector, + double signalDbm, double noiseDbm); /** * TracedCallback signature for monitor mode receive events. @@ -1035,14 +1036,15 @@ public: * \param rate the PHY data rate in units of 500kbps (i.e., the same * units used both for the radiotap and for the prism header) * \param isShortPreamble true if short preamble is used, false otherwise + * \param txVector the txvector that holds rx parameters * \param signalDbm signal power in dBm * \param noiseDbm noise power in dBm */ typedef void (* MonitorSnifferRxCallback) (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, double signalDbm, - double noiseDbm); + bool isShortPreamble, WifiTxVector txvector, + double signalDbm, double noiseDbm); /** * Public method used to fire a MonitorSniffer trace for a wifi packet @@ -1055,11 +1057,11 @@ public: * \param rate the PHY data rate in units of 500kbps (i.e., the same * units used both for the radiotap and for the prism header) * \param isShortPreamble true if short preamble is used, false otherwise - * \param txPower the transmission power in dBm + * \param txVector the txvector that holds tx parameters */ void NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, uint8_t txPower); + bool isShortPreamble, WifiTxVector txvector); /** * TracedCallback signature for monitor mode transmit events. @@ -1071,12 +1073,12 @@ public: * \param rate the PHY data rate in units of 500kbps (i.e., the same * units used both for the radiotap and for the prism header) * \param isShortPreamble true if short preamble is used, false otherwise - * \param txPower the transmission power in dBm + * \param txVector the txvector that holds tx parameters */ typedef void (* MonitorSnifferTxCallback) (const Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, uint8_t txPower); + bool isShortPreamble, WifiTxVector txvector); /** @@ -1214,7 +1216,7 @@ private: * * \see class CallBackTraceSource */ - TracedCallback, uint16_t, uint16_t, uint32_t, bool, double, double> m_phyMonitorSniffRxTrace; + TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, double, double> m_phyMonitorSniffRxTrace; /** * A trace source that emulates a wifi device in monitor mode @@ -1226,7 +1228,7 @@ private: * * \see class CallBackTraceSource */ - TracedCallback, uint16_t, uint16_t, uint32_t, bool,uint8_t> m_phyMonitorSniffTxTrace; + TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector> m_phyMonitorSniffTxTrace; uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU diff --git a/src/wifi/model/yans-wifi-phy.cc b/src/wifi/model/yans-wifi-phy.cc index a98b49564..2a7577b6a 100644 --- a/src/wifi/model/yans-wifi-phy.cc +++ b/src/wifi/model/yans-wifi-phy.cc @@ -748,7 +748,7 @@ YansWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPr dataRate500KbpsUnits = txVector.GetMode().GetDataRate () * txVector.GetNss() / 500000; } bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble); - NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector.GetTxPowerLevel()); + NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, txVector); m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel()), txVector, preamble); m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel()) + m_txGainDb, txVector, preamble, packetType, txDuration); } @@ -1033,7 +1033,7 @@ YansWifiPhy::EndReceive (Ptr packet, enum WifiPreamble preamble, uint8_t bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30; - NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); + NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, event->GetTxVector (), signalDbm, noiseDbm); m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ()); } else