diff -uprN original/src/network/utils/radiotap-header.cc modified/src/network/utils/radiotap-header.cc --- original/src/network/utils/radiotap-header.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/network/utils/radiotap-header.cc 2015-06-21 15:29:16.000000000 +0200 @@ -16,6 +16,7 @@ * Foundation, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Nicola Baldo + * Author: Hany Assasa */ #include @@ -38,7 +39,11 @@ RadiotapHeader::RadiotapHeader() m_channelFreq (0), m_channelFlags (CHANNEL_FLAG_NONE), m_antennaSignal (0), - m_antennaNoise (0) + m_antennaNoise (0), + m_ampduStatusRef (0), + m_ampduStatusFlags (0), + m_ampduStatusCRC (0), + m_ampduStatusReserved (0) { NS_LOG_FUNCTION (this); } @@ -107,6 +112,7 @@ RadiotapHeader::Serialize (Buffer::Itera // if (m_present & RADIOTAP_CHANNEL) // bit 3 { + start.WriteU8(0, m_channelPad); start.WriteU16 (m_channelFreq); start.WriteU16 (m_channelFlags); } @@ -128,6 +134,28 @@ RadiotapHeader::Serialize (Buffer::Itera { start.WriteU8 (m_antennaNoise); } + + // + // A-MPDU Status, information about the received A-MPDU. + // + if (m_present & RADIOTAP_MCS) // bit 19 + { + start.WriteU8 (0); + start.WriteU8 (0); + start.WriteU8 (0); + } + + // + // A-MPDU Status, information about the received A-MPDU. + // + if (m_present & RADIOTAP_AMPDU_STATUS) // bit 20 + { + start.WriteU8(0, m_ampduStatusPad); + start.WriteU32 (m_ampduStatusRef); + start.WriteU16 (m_ampduStatusFlags); + start.WriteU8 (m_ampduStatusCRC); + start.WriteU8 (m_ampduStatusReserved); + } } uint32_t @@ -176,9 +204,11 @@ RadiotapHeader::Deserialize (Buffer::Ite // if (m_present & RADIOTAP_CHANNEL) // bit 3 { + m_channelPad = (2 - bytesRead % 2) % 2; + start.Next(m_channelPad); m_channelFreq = start.ReadU16 (); m_channelFlags = start.ReadU16 (); - bytesRead += 4; + bytesRead += 4 + m_channelPad; } // @@ -211,6 +241,31 @@ RadiotapHeader::Deserialize (Buffer::Ite ++bytesRead; } + // + // A-MPDU Status, information about the received A-MPDU. + // + if (m_present & RADIOTAP_MCS) // bit 19 + { + m_antennaNoise = start.ReadU8 (); + m_antennaNoise = start.ReadU8 (); + m_antennaNoise = start.ReadU8 (); + bytesRead += 3; + } + + // + // A-MPDU Status, information about the received A-MPDU. + // + if (m_present & RADIOTAP_AMPDU_STATUS) // bit 20 + { + m_ampduStatusPad = (4 - bytesRead % 4) % 4; + start.Next(m_ampduStatusPad); + m_ampduStatusRef = start.ReadU32 (); + m_ampduStatusFlags = start.ReadU16 (); + m_ampduStatusCRC = start.ReadU8 (); + m_ampduStatusReserved = start.ReadU8 (); + bytesRead += 8 + m_ampduStatusPad; + } + NS_ASSERT_MSG (m_length == bytesRead, "RadiotapHeader::Deserialize(): expected and actual lengths inconsistent"); return bytesRead; } @@ -225,7 +280,8 @@ RadiotapHeader::Print (std::ostream &os) << " freq=" << m_channelFreq << " chflags=" << std::hex << (uint32_t)m_channelFlags << std::dec << " signal=" << (int16_t) m_antennaSignal - << " noise=" << (int16_t) m_antennaNoise; + << " noise=" << (int16_t) m_antennaNoise + << " ampduStatusFlags=" << (int16_t) m_ampduStatusFlags; } void @@ -294,6 +350,44 @@ RadiotapHeader::GetRate (void) const return m_rate; } +void +RadiotapHeader::SetAmpduStatus (uint32_t referenceNumber, uint16_t flags, uint8_t crc) +{ + NS_LOG_FUNCTION (this << referenceNumber << flags); + m_ampduStatusRef = referenceNumber; + m_ampduStatusFlags = flags; + m_ampduStatusCRC = crc; + if (!(m_present & RADIOTAP_AMPDU_STATUS)) + { + m_ampduStatusPad = (4 - m_length % 4) % 4;; + m_present |= RADIOTAP_AMPDU_STATUS; + m_length += 8 + m_ampduStatusPad; + } + + NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); +} + +uint16_t +RadiotapHeader::GetAmpduStatusFlags () const +{ + NS_LOG_FUNCTION (this); + return m_ampduStatusFlags; +} + +void +RadiotapHeader::SetMCS (uint32_t value) +{ + NS_LOG_FUNCTION (this << value); + + if (!(m_present & RADIOTAP_MCS)) + { + m_present |= RADIOTAP_MCS; + m_length += 3; + } + + NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); +} + void RadiotapHeader::SetChannelFrequencyAndFlags (uint16_t frequency, uint16_t flags) { @@ -303,8 +397,9 @@ RadiotapHeader::SetChannelFrequencyAndFl if (!(m_present & RADIOTAP_CHANNEL)) { + m_channelPad = (2 - m_length % 2) % 2; m_present |= RADIOTAP_CHANNEL; - m_length += 4; + m_length += 4 + m_channelPad; } NS_LOG_LOGIC (this << " m_length=" << m_length << " m_present=0x" << std::hex << m_present << std::dec); diff -uprN original/src/network/utils/radiotap-header.h modified/src/network/utils/radiotap-header.h --- original/src/network/utils/radiotap-header.h 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/network/utils/radiotap-header.h 2015-06-21 15:28:54.000000000 +0200 @@ -16,6 +16,7 @@ * Foundation, Include., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Nicola Baldo + * Author: Hany Assasa */ #ifndef RADIOTAP_HEADER_H @@ -159,6 +160,28 @@ public: uint8_t GetRate (void) const; enum { + A_MPDU_STATUS_NONE = 0x0000, /**< No flags set */ + A_MPDU_STATUS_REPORT_ZERO_LENGTH = 0x0001, /**< Driver reports 0-length subframes */ + A_MPDU_STATUS_IS_ZERO_LENGTH = 0x0002, /**< Frame is 0-length subframe (valid only if 0x0001 is set) */ + A_MPDU_STATUS_LAST_KNOWN = 0x0004, /**< Last subframe is known (should be set for all subframes in an A-MPDU) */ + A_MPDU_STATUS_LAST = 0x0008, /**< This frame is the last subframe */ + A_MPDU_STATUS_DELIMITER_CRC_ERROR = 0x0010, /**< Delimiter CRC error */ + A_MPDU_STATUS_DELIMITER_CRC_KNOWN = 0x0020 /**< Delimiter CRC value known: the delimiter CRC value field is valid */ + }; + + /** + * @brief Set A-MPDU status. + * @param status The status of the frame which is part of an A-MPDU. + */ + void SetAmpduStatus (uint32_t referenceNumber, uint16_t falgs, uint8_t crc); + + /** + * @brief Get A-MPDU status. + * @returns The status of the frame which is part of an A-MPDU. + */ + uint16_t GetAmpduStatusFlags (void) const; + + enum { CHANNEL_FLAG_NONE = 0x0000, /**< No flags set */ CHANNEL_FLAG_TURBO = 0x0010, /**< Turbo Channel */ CHANNEL_FLAG_CCK = 0x0020, /**< CCK channel */ @@ -227,6 +250,8 @@ public: */ uint8_t GetAntennaNoisePower (void) const; + void SetMCS (uint32_t value); + private: enum { RADIOTAP_TSFT = 0x00000001, @@ -239,23 +264,35 @@ private: RADIOTAP_LOCK_QUALITY = 0x00000080, RADIOTAP_TX_ATTENUATION = 0x00000100, RADIOTAP_DB_TX_ATTENUATION = 0x00000200, - RADIOTAP_DBM_TX_POWER = 0x00000200, - RADIOTAP_ANTENNA = 0x00000400, - RADIOTAP_DB_ANTSIGNAL = 0x00000800, - RADIOTAP_DB_ANTNOISE = 0x00001000, + RADIOTAP_DBM_TX_POWER = 0x00000400, + RADIOTAP_ANTENNA = 0x00000800, + RADIOTAP_DB_ANTSIGNAL = 0x00001000, + RADIOTAP_DB_ANTNOISE = 0x00002000, + RADIOTAP_RX_FLAGS = 0x00004000, + RADIOTAP_MCS = 0x00080000, + RADIOTAP_AMPDU_STATUS = 0x00100000, // The presence of this field indicates the frame was received as part of an A-MPDU. + RADIOTAP_VHT = 0x00200000, RADIOTAP_EXT = 0x10000000 }; - uint16_t m_length; //!< entire length of radiotap data + header - uint32_t m_present; //!< bits describing which fields follow header + uint16_t m_length; //!< Entire length of radiotap data + header + uint32_t m_present; //!< Bits describing which fields follow header uint64_t m_tsft; //!< Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC) uint8_t m_flags; //!< Properties of transmitted and received frames. uint8_t m_rate; //!< TX/RX data rate in units of 500 kbps + uint8_t m_channelPad; //!< Tx/Rx channel Padding. uint16_t m_channelFreq; //!< Tx/Rx frequency in MHz. uint16_t m_channelFlags; //!< Tx/Rx channel flags. int8_t m_antennaSignal; //!< RF signal power at the antenna, dB difference from an arbitrary, fixed reference. int8_t m_antennaNoise; //!< RF noise power at the antenna, dB difference from an arbitrary, fixed reference. + + uint8_t m_ampduStatusPad; //!< A-MPDU Status Flags, Padding before A-MPDU Status Field. + uint32_t m_ampduStatusRef; //!< A-MPDU Status Flags, reference number. + uint16_t m_ampduStatusFlags; //!< A-MPDU Status Flags, information about the received A-MPDU. + uint8_t m_ampduStatusCRC; //!< A-MPDU Status Flags, delimiter CRC value. + uint8_t m_ampduStatusReserved; //!< A-MPDU Status Flags, reserved. + }; } // namespace ns3 diff -uprN original/src/wifi/helper/yans-wifi-helper.cc modified/src/wifi/helper/yans-wifi-helper.cc --- original/src/wifi/helper/yans-wifi-helper.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/helper/yans-wifi-helper.cc 2015-06-21 15:37:49.000000000 +0200 @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Hany Assasa */ #include "ns3/trace-helper.h" @@ -33,6 +34,7 @@ #include "ns3/names.h" #include "ns3/abort.h" #include "ns3/log.h" +#include "ns3/ampdu-subframe-header.h" namespace ns3 { @@ -248,12 +250,13 @@ YansWifiPhyHelper::Create (Ptr nod static void PcapSniffTxEvent ( Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - WifiTxVector txvector) + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector, + uint8_t packetType) { uint32_t dlt = file->GetDataLinkType (); @@ -281,7 +284,7 @@ PcapSniffTxEvent ( { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } - + if (txvector.IsShortGuardInterval ()) { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; @@ -316,6 +319,24 @@ PcapSniffTxEvent ( header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags); + if (txvector.IsAggregated()) + { + uint16_t ampduStatus_Flags = 0; + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN; + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN; + if (packetType == 2) + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST; + + /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */ + AmpduSubframeHeader hdr; + uint32_t extractedLength; + + p->RemoveHeader (hdr); + extractedLength = hdr.GetLength (); + p = p->CreateFragment (0, static_cast (extractedLength)); + header.SetAmpduStatus (10, ampduStatus_Flags, hdr.GetCrc()); + } + p->AddHeader (header); file->Write (Simulator::Now (), p); return; @@ -327,15 +348,15 @@ PcapSniffTxEvent ( static void PcapSniffRxEvent ( - Ptr file, - Ptr packet, - uint16_t channelFreqMhz, - uint16_t channelNumber, - uint32_t rate, - bool isShortPreamble, - WifiTxVector txvector, - double signalDbm, - double noiseDbm) + Ptr file, + Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + uint32_t rate, + bool isShortPreamble, + WifiTxVector txvector, + struct snrDbm snr, + uint8_t packetType) { uint32_t dlt = file->GetDataLinkType (); @@ -363,7 +384,7 @@ PcapSniffRxEvent ( { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } - + if (txvector.IsShortGuardInterval ()) { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; @@ -398,8 +419,26 @@ PcapSniffRxEvent ( header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags); - header.SetAntennaSignalPower (signalDbm); - header.SetAntennaNoisePower (noiseDbm); + header.SetAntennaSignalPower (snr.signal); + header.SetAntennaNoisePower (snr.noise); + + if (txvector.IsAggregated()) + { + uint16_t ampduStatus_Flags = 0; + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN; + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN; + if (packetType == 2) + ampduStatus_Flags |= RadiotapHeader::A_MPDU_STATUS_LAST; + + /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */ + AmpduSubframeHeader hdr; + uint32_t extractedLength; + + p->RemoveHeader (hdr); + extractedLength = hdr.GetLength (); + p = p->CreateFragment (0, static_cast (extractedLength)); + header.SetAmpduStatus (10, ampduStatus_Flags, hdr.GetCrc()); + } p->AddHeader (header); file->Write (Simulator::Now (), p); diff -uprN original/src/wifi/model/mac-low.cc modified/src/wifi/model/mac-low.cc --- original/src/wifi/model/mac-low.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/mac-low.cc 2015-06-21 17:02:13.584367084 +0200 @@ -1545,6 +1545,7 @@ MacLow::ForwardDown (Ptr p AmpduTag ampdutag; ampdutag.SetAmpdu (true); Time delay = Seconds (0); + txVector.SetAggregated (queueSize > 1); for ( ; queueSize > 0; queueSize--) { dequeuedPacket = m_aggregateQueue->Dequeue (&newHdr); diff -uprN original/src/wifi/model/wifi-phy.cc modified/src/wifi/model/wifi-phy.cc --- original/src/wifi/model/wifi-phy.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/wifi-phy.cc 2015-06-21 15:59:09.000000000 +0200 @@ -613,18 +613,19 @@ WifiPhy::NotifyRxDrop (Ptr } void -WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, double signalDbm, double noiseDbm) +WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, struct snrDbm snr, uint8_t packetType) { - m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, signalDbm, noiseDbm); + m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, snr, packetType); } void -WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector) +WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, uint8_t packetType) { - m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector); + m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, isShortPreamble, txvector, packetType); } + // Clause 15 rates (DSSS) WifiMode diff -uprN original/src/wifi/model/wifi-phy.h modified/src/wifi/model/wifi-phy.h --- original/src/wifi/model/wifi-phy.h 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/wifi-phy.h 2015-06-21 16:04:05.000000000 +0200 @@ -38,6 +38,12 @@ namespace ns3 { class WifiChannel; class NetDevice; +struct snrDbm +{ + double signal; + double noise; +}; + /** * \brief receive notifications about phy events. */ @@ -998,13 +1004,13 @@ public: * 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 + * \param signalDbm signal power and noise power in dBm + * \param packetType */ void NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, - double signalDbm, double noiseDbm); + struct snrDbm snr, uint8_t packetType); /** * TracedCallback signature for monitor mode receive events. @@ -1023,14 +1029,15 @@ public: * 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 + * \param signalDbm signal power and noise power in dBm + * \param packetType */ typedef void (* MonitorSnifferRxCallback) (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, WifiTxVector txvector, - double signalDbm, double noiseDbm); + struct snrDbm snr, uint8_t); + /** * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted. @@ -1047,7 +1054,7 @@ public: */ void NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, WifiTxVector txvector); + bool isShortPreamble, WifiTxVector txvector, uint8_t packetType); /** * TracedCallback signature for monitor mode transmit events. @@ -1060,11 +1067,12 @@ public: * 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 tx parameters + * \param packetType Type of the packet */ typedef void (* MonitorSnifferTxCallback) (const Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, - bool isShortPreamble, WifiTxVector txvector); + bool isShortPreamble, WifiTxVector txvector, uint8_t packetType); /** * Assign a fixed random variable stream number to the random variables @@ -1200,7 +1208,7 @@ private: * * \see class CallBackTraceSource */ - TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, double, double> m_phyMonitorSniffRxTrace; + TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, struct snrDbm, uint8_t> m_phyMonitorSniffRxTrace; /** * A trace source that emulates a wifi device in monitor mode @@ -1212,7 +1220,7 @@ private: * * \see class CallBackTraceSource */ - TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector> m_phyMonitorSniffTxTrace; + TracedCallback, uint16_t, uint16_t, uint32_t, bool, WifiTxVector, uint8_t> 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 -uprN original/src/wifi/model/wifi-tx-vector.cc modified/src/wifi/model/wifi-tx-vector.cc --- original/src/wifi/model/wifi-tx-vector.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/wifi-tx-vector.cc 2015-06-21 15:47:59.000000000 +0200 @@ -17,6 +17,7 @@ * * Author: Nicola Baldo * : Ghada Badawy + * : Hany Assasa */ #include "ns3/wifi-tx-vector.h" @@ -30,6 +31,7 @@ WifiTxVector::WifiTxVector () m_nss (1), m_ness (0), m_stbc (false), + m_aggregated (false), m_modeInitialized (false), m_txPowerLevelInitialized (false) { @@ -44,6 +46,7 @@ WifiTxVector::WifiTxVector (WifiMode mod m_nss(nss), m_ness(ness), m_stbc(stbc), + m_aggregated (false), m_modeInitialized (true), m_txPowerLevelInitialized (true) { @@ -58,6 +61,7 @@ WifiTxVector::GetMode (void) const } return m_mode; } + uint8_t WifiTxVector::GetTxPowerLevel (void) const { @@ -67,26 +71,31 @@ WifiTxVector::GetTxPowerLevel (void) con } return m_txPowerLevel; } + uint8_t WifiTxVector::GetRetries (void) const { return m_retries; } + bool WifiTxVector::IsShortGuardInterval (void) const { return m_shortGuardInterval; } + uint8_t WifiTxVector::GetNss (void) const { return m_nss; } + uint8_t WifiTxVector::GetNess (void) const { return m_ness; } + bool WifiTxVector::IsStbc (void) const { @@ -99,38 +108,56 @@ WifiTxVector::SetMode (WifiMode mode) m_mode=mode; m_modeInitialized = true; } + void WifiTxVector::SetTxPowerLevel (uint8_t powerlevel) { m_txPowerLevel=powerlevel; m_txPowerLevelInitialized = true; } + void WifiTxVector::SetRetries (uint8_t retries) { m_retries = retries; } + void WifiTxVector::SetShortGuardInterval (bool guardinterval) { m_shortGuardInterval=guardinterval; } + void WifiTxVector::SetNss (uint8_t nss) { m_nss= nss; } + void WifiTxVector::SetNess (uint8_t ness) { m_ness=ness; } + void WifiTxVector::SetStbc (bool stbc) { m_stbc=stbc; } +bool +WifiTxVector::IsAggregated (void) const +{ + return m_aggregated; +} + +void +WifiTxVector::SetAggregated (bool aggregated) +{ + m_aggregated = aggregated; +} + std::ostream & operator << ( std::ostream &os, const WifiTxVector &v) { os << "mode:" << v.GetMode() << @@ -139,7 +166,8 @@ std::ostream & operator << ( std::ostrea " Short GI: " << v.IsShortGuardInterval() << " Nss: " << (uint32_t)v.GetNss() << " Ness: " << (uint32_t)v.GetNess() << - " STBC: " << v.IsStbc(); + " STBC: " << v.IsStbc() << + " Aggregation: " << v.IsAggregated(); return os; } diff -uprN original/src/wifi/model/wifi-tx-vector.h modified/src/wifi/model/wifi-tx-vector.h --- original/src/wifi/model/wifi-tx-vector.h 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/wifi-tx-vector.h 2015-06-21 15:49:05.000000000 +0200 @@ -17,6 +17,7 @@ * * Author: Nicola Baldo * : Ghada Badawy + * : Hany Assasa */ #ifndef WIFI_TX_VECTOR_H @@ -146,8 +147,19 @@ public: * \param stbc enable or disable STBC */ void SetStbc (bool stbc); + /** + * Checks whether the PSDU contains A-MPDU. + * \returns true if this packet has A-MPDU aggregation, + * false otherwise. + */ + bool IsAggregated (void) const; + /** + * Sets if PSDU contains A-MPDU. + * + * \param aggregated whether the packet contains A-MPDU or not. + */ + void SetAggregated(bool aggregated); - private: WifiMode m_mode; /**< The DATARATE parameter in Table 15-4. @@ -162,6 +174,7 @@ private: uint8_t m_nss; /**< number of streams */ uint8_t m_ness; /**< number of streams in beamforming */ bool m_stbc; /**< STBC used or not */ + bool m_aggregated; /** Flag whether the PSDU contains A-MPDU. */ bool m_modeInitialized; //*< Internal initialization flag */ bool m_txPowerLevelInitialized; //*< Internal initialization flag */ diff -uprN original/src/wifi/model/yans-wifi-phy.cc modified/src/wifi/model/yans-wifi-phy.cc --- original/src/wifi/model/yans-wifi-phy.cc 2015-06-16 22:13:06.000000000 +0200 +++ modified/src/wifi/model/yans-wifi-phy.cc 2015-06-21 15:51:51.000000000 +0200 @@ -779,7 +779,7 @@ YansWifiPhy::SendPacket (PtrSwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble); m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, packetType, txDuration); } @@ -1097,9 +1097,11 @@ YansWifiPhy::EndReceive (Ptr pac dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () * event->GetTxVector ().GetNss () / 500000; } 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, event->GetTxVector (), signalDbm, noiseDbm); + struct snrDbm snr; + snr.signal = RatioToDb (event->GetRxPowerW ()) + 30; + snr.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30; + + NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, event->GetTxVector (), snr, packetType); m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ()); } else