diff -r f49a15537f57 examples/wireless/power-adaptation-distance.cc --- a/examples/wireless/power-adaptation-distance.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/examples/wireless/power-adaptation-distance.cc Sun Nov 06 12:04:10 2016 +0100 @@ -172,7 +172,8 @@ WifiMode mode = phy->GetMode (i); WifiTxVector txVector; txVector.SetMode (mode); - timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode)); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, phy->GetFrequency ()), mode)); } } diff -r f49a15537f57 examples/wireless/power-adaptation-interference.cc --- a/examples/wireless/power-adaptation-interference.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/examples/wireless/power-adaptation-interference.cc Sun Nov 06 12:04:10 2016 +0100 @@ -168,7 +168,8 @@ WifiMode mode = phy->GetMode (i); WifiTxVector txVector; txVector.SetMode (mode); - timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode)); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, phy->GetFrequency ()), mode)); } } diff -r f49a15537f57 examples/wireless/wifi-spectrum-per-example.cc --- a/examples/wireless/wifi-spectrum-per-example.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/examples/wireless/wifi-spectrum-per-example.cc Sun Nov 06 12:04:10 2016 +0100 @@ -89,18 +89,15 @@ double g_noiseDbmAvg; uint32_t g_samples; uint16_t g_channelNumber; -uint32_t g_rate; void MonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise) + uint16_t channelNumber, WifiTxVector txVector, + MpduInfo aMpdu, SignalNoiseDbm signalNoise) { g_samples++; g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples); g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples); - g_rate = rate; g_channelNumber = channelNumber; } @@ -523,7 +520,6 @@ g_noiseDbmAvg = 0; g_samples = 0; g_channelNumber = 0; - g_rate = 0; Simulator::Stop (Seconds (simulationTime + 1)); Simulator::Run (); diff -r f49a15537f57 examples/wireless/wifi-spectrum-per-interference.cc --- a/examples/wireless/wifi-spectrum-per-interference.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/examples/wireless/wifi-spectrum-per-interference.cc Sun Nov 06 12:04:10 2016 +0100 @@ -96,18 +96,15 @@ double g_noiseDbmAvg; uint32_t g_samples; uint16_t g_channelNumber; -uint32_t g_rate; void MonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise) + uint16_t channelNumber, WifiTxVector txVector, + MpduInfo aMpdu, SignalNoiseDbm signalNoise) { g_samples++; g_signalDbmAvg += ((signalNoise.signal - g_signalDbmAvg) / g_samples); g_noiseDbmAvg += ((signalNoise.noise - g_noiseDbmAvg) / g_samples); - g_rate = rate; g_channelNumber = channelNumber; } @@ -574,7 +571,6 @@ g_noiseDbmAvg = 0; g_samples = 0; g_channelNumber = 0; - g_rate = 0; // Make sure we are tuned to 5180 MHz; if not, the example will // not work properly diff -r f49a15537f57 src/mesh/model/dot11s/airtime-metric.cc --- a/src/mesh/model/dot11s/airtime-metric.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/mesh/model/dot11s/airtime-metric.cc Sun Nov 06 12:04:10 2016 +0100 @@ -93,10 +93,11 @@ NS_ASSERT (failAvg < 1.0); WifiTxVector txVector; txVector.SetMode (mode); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); //calculate metric uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/ mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs - mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, WIFI_PREAMBLE_LONG, mac->GetWifiPhy ()->GetFrequency()) + mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, mac->GetWifiPhy ()->GetFrequency()) ).GetMicroSeconds () / (10.24 * (1.0 - failAvg))); return metric; } diff -r f49a15537f57 src/network/model/packet-tag-list.h --- a/src/network/model/packet-tag-list.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/network/model/packet-tag-list.h Sun Nov 06 12:04:10 2016 +0100 @@ -158,7 +158,7 @@ */ enum TagData_e { - MAX_SIZE = 21 /**< Size of serialization buffer #data */ + MAX_SIZE = 26 /**< Size of serialization buffer #data */ }; uint8_t data[MAX_SIZE]; /**< Serialization buffer */ diff -r f49a15537f57 src/wave/model/channel-manager.cc --- a/src/wave/model/channel-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/channel-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -161,6 +161,13 @@ return m_channels[channelNumber]->dataRate; } +WifiPreamble +ChannelManager::GetManagementPreamble (uint32_t channelNumber) +{ + NS_LOG_FUNCTION (this << channelNumber); + return m_channels[channelNumber]->preamble; +} + uint32_t ChannelManager::GetManagementPowerLevel (uint32_t channelNumber) { diff -r f49a15537f57 src/wave/model/channel-manager.h --- a/src/wave/model/channel-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/channel-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -21,6 +21,7 @@ #include #include "ns3/object.h" #include "ns3/wifi-mode.h" +#include "ns3/wifi-preamble.h" namespace ns3 { @@ -116,6 +117,11 @@ WifiMode GetManagementDataRate (uint32_t channelNumber); /** * \param channelNumber the specific channel + * \return the preamble for management frames + */ + WifiPreamble GetManagementPreamble (uint32_t channelNumber); + /** + * \param channelNumber the specific channel * \return the tx power level for management frames */ uint32_t GetManagementPowerLevel (uint32_t channelNumber); @@ -130,6 +136,7 @@ uint32_t operatingClass; bool adaptable; WifiMode dataRate; + WifiPreamble preamble; uint32_t txPowerLevel; WaveChannel (uint32_t channel) @@ -137,6 +144,7 @@ operatingClass (DEFAULT_OPERATING_CLASS), adaptable (true), dataRate (WifiMode ("OfdmRate6MbpsBW10MHz")), + preamble (WIFI_PREAMBLE_LONG), txPowerLevel (4) { } diff -r f49a15537f57 src/wave/model/vsa-manager.cc --- a/src/wave/model/vsa-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/vsa-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -178,6 +178,7 @@ txVector.SetChannelWidth (10); txVector.SetTxPowerLevel (manager->GetManagementPowerLevel (channel)); txVector.SetMode (manager->GetManagementDataRate (channel)); + txVector.SetPreambleType (manager->GetManagementPreamble (channel)); HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, manager->GetManagementAdaptable (channel)); vsc->AddPacketTag (tag); diff -r f49a15537f57 src/wave/model/wave-mac-low.cc --- a/src/wave/model/wave-mac-low.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/wave-mac-low.cc Sun Nov 06 12:04:10 2016 +0100 @@ -88,10 +88,12 @@ if (txHigher.GetMode ().GetDataRate (txHigher.GetChannelWidth (), txHigher.IsShortGuardInterval (), 1) > txMac.GetMode ().GetDataRate (txMac.GetChannelWidth (), txMac.IsShortGuardInterval (), 1)) { txAdapter.SetMode (txHigher.GetMode ()); + txAdapter.SetPreambleType (txHigher.GetPreambleType ()); } else { txAdapter.SetMode (txMac.GetMode ()); + txAdapter.SetPreambleType (txMac.GetPreambleType ()); } // the TxPwr_Level set by higher layer is the maximum transmit // power which is the upper bound for the actual transmit power; diff -r f49a15537f57 src/wave/model/wave-net-device.cc --- a/src/wave/model/wave-net-device.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/wave-net-device.cc Sun Nov 06 12:04:10 2016 +0100 @@ -411,6 +411,7 @@ txVector.SetChannelWidth (10); txVector.SetTxPowerLevel (txInfo.txPowerLevel); txVector.SetMode (txInfo.dataRate); + txVector.SetPreambleType (txInfo.preamble); HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, false); packet->AddPacketTag (tag); } @@ -618,6 +619,7 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_txProfile->txPowerLevel); txVector.SetMode (m_txProfile->dataRate); + txVector.SetPreambleType (m_txProfile->preamble); HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, m_txProfile->adaptable); packet->AddPacketTag (tag); } diff -r f49a15537f57 src/wave/model/wave-net-device.h --- a/src/wave/model/wave-net-device.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/model/wave-net-device.h Sun Nov 06 12:04:10 2016 +0100 @@ -58,6 +58,7 @@ uint32_t channelNumber; uint32_t priority; WifiMode dataRate; + WifiPreamble preamble; uint32_t txPowerLevel; // Time expiryTime; // unsupported TxInfo () @@ -67,7 +68,7 @@ { } - TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), uint32_t powerLevel = 8) + TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), WifiPreamble preamble = WIFI_PREAMBLE_NONE, uint32_t powerLevel = 8) : channelNumber (channel), priority (prio), dataRate (rate), @@ -95,10 +96,12 @@ bool adaptable; uint32_t txPowerLevel; WifiMode dataRate; + WifiPreamble preamble; TxProfile (void) : channelNumber (SCH1), adaptable (false), - txPowerLevel (4) + txPowerLevel (4), + preamble (WIFI_PREAMBLE_LONG) { dataRate = WifiMode ("OfdmRate6MbpsBW10MHz"); } @@ -108,6 +111,7 @@ txPowerLevel (powerLevel) { dataRate = WifiMode ("OfdmRate6MbpsBW10MHz"); + preamble = WIFI_PREAMBLE_LONG; } }; diff -r f49a15537f57 src/wave/test/mac-extension-test-suite.cc --- a/src/wave/test/mac-extension-test-suite.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wave/test/mac-extension-test-suite.cc Sun Nov 06 12:04:10 2016 +0100 @@ -347,11 +347,11 @@ // invalid user priority Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 8)); // invalid tx parameters - Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate6Mbps"), 7)); - Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), 10)); + Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate6Mbps"), WIFI_PREAMBLE_LONG, 7)); + Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, false, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 10)); // valid tx parameters - Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), 7)); - Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode (), 8)); + Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 7)); + Simulator::Schedule (Seconds (0.4), &ChannelRoutingTestCase::SendWsmp, this, true, TxInfo (CCH, 7, WifiMode (), WIFI_PREAMBLE_LONG, 8)); // release channel access at 0.6s Simulator::Schedule (Seconds (0.5), &WaveNetDevice::StopSch, m_sender, SCH1); @@ -1019,7 +1019,7 @@ SchInfo infoSender = SchInfo (SCH1, false, EXTENDED_ALTERNATING); Simulator::Schedule (MilliSeconds (0), &WaveNetDevice::StartSch, m_sender, infoSender); - TxInfo txInfo = TxInfo (CCH, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), 0); + TxInfo txInfo = TxInfo (CCH, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 0); // the packet size with 2312 bytes costs 6.42s, which will cancel this transmission in the CCH Interval // so the receiver will receive this packet in next CCH Interval Simulator::Schedule (MilliSeconds (45), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 1); @@ -1028,7 +1028,7 @@ // so the receiver can this packet is this CCH Interval Simulator::Schedule (MilliSeconds (145), &AnnexC_TestCase::SendPacket, this, 312, txInfo, 2); - txInfo = TxInfo (SCH1, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), 0); + txInfo = TxInfo (SCH1, 0, WifiMode ("OfdmRate3MbpsBW10MHz"), WIFI_PREAMBLE_LONG, 0); // the packet size with 2312 bytes costs 6.42ms, which will cancel this transmission in the SCH Interval // so the receiver will receive this packet in next SCH Interval Simulator::Schedule (MilliSeconds (295), &AnnexC_TestCase::SendPacket, this, 2304, txInfo, 3); diff -r f49a15537f57 src/wifi/examples/test-interference-helper.cc --- a/src/wifi/examples/test-interference-helper.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/examples/test-interference-helper.cc Sun Nov 06 12:04:10 2016 +0100 @@ -84,8 +84,8 @@ uint32_t txPowerLevelB; uint32_t packetSizeA; uint32_t packetSizeB; - enum WifiPhyStandard standard; - enum WifiPreamble preamble; + WifiPhyStandard standard; + WifiPreamble preamble; }; InterferenceExperiment (); @@ -106,7 +106,8 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_input.txPowerLevelA); txVector.SetMode (WifiMode (m_input.txModeA)); - m_txA->SendPacket (p, txVector, m_input.preamble); + txVector.SetPreambleType (m_input.preamble); + m_txA->SendPacket (p, txVector); } void @@ -116,7 +117,8 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_input.txPowerLevelB); txVector.SetMode (WifiMode (m_input.txModeB)); - m_txB->SendPacket (p, txVector, m_input.preamble); + txVector.SetPreambleType (m_input.preamble); + m_txB->SendPacket (p, txVector); } InterferenceExperiment::InterferenceExperiment () diff -r f49a15537f57 src/wifi/examples/wifi-phy-test.cc --- a/src/wifi/examples/wifi-phy-test.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/examples/wifi-phy-test.cc Sun Nov 06 12:04:10 2016 +0100 @@ -60,7 +60,7 @@ private: void Send (void); - void Receive (Ptr p, double snr, WifiTxVector txVector, enum WifiPreamble preamble); + void Receive (Ptr p, double snr, WifiTxVector txVector); Ptr m_tx; struct Input m_input; struct Output m_output; @@ -74,11 +74,12 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_input.txPowerLevel); txVector.SetMode (mode); - m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + m_tx->SendPacket (p, txVector); } void -PsrExperiment::Receive (Ptr p, double snr, WifiTxVector txVector, enum WifiPreamble preamble) +PsrExperiment::Receive (Ptr p, double snr, WifiTxVector txVector) { m_output.received++; } @@ -165,7 +166,7 @@ private: void SendA (void) const; void SendB (void) const; - void Receive (Ptr p, double snr, WifiTxVector txVector, enum WifiPreamble preamble); + void Receive (Ptr p, double snr, WifiTxVector txVector); Ptr m_txA; Ptr m_txB; uint32_t m_flowIdA; @@ -182,7 +183,8 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_input.txPowerLevelA); txVector.SetMode (WifiMode (m_input.txModeA)); - m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + m_txA->SendPacket (p, txVector); } void @@ -193,11 +195,12 @@ WifiTxVector txVector; txVector.SetTxPowerLevel (m_input.txPowerLevelB); txVector.SetMode (WifiMode (m_input.txModeB)); - m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + m_txB->SendPacket (p, txVector); } void -CollisionExperiment::Receive (Ptr p, double snr, WifiTxVector txVector, enum WifiPreamble preamble) +CollisionExperiment::Receive (Ptr p, double snr, WifiTxVector txVector) { FlowIdTag tag; if (p->FindFirstMatchingByteTag (tag)) diff -r f49a15537f57 src/wifi/helper/wifi-helper.cc --- a/src/wifi/helper/wifi-helper.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/helper/wifi-helper.cc Sun Nov 06 12:04:10 2016 +0100 @@ -143,12 +143,11 @@ Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, - uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu) + MpduInfo aMpdu) { uint32_t dlt = file->GetDataLinkType (); + WifiPreamble preamble = txVector.GetPreambleType (); switch (dlt) { @@ -181,6 +180,16 @@ } header.SetFrameFlags (frameFlags); + + uint32_t rate; + if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) + { + rate = 128 + txVector.GetMode ().GetMcsValue (); + } + else + { + rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000; + } header.SetRate (rate); uint16_t channelFlags = 0; @@ -335,13 +344,12 @@ Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, - uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu, - struct signalNoiseDbm signalNoise) + MpduInfo aMpdu, + SignalNoiseDbm signalNoise) { uint32_t dlt = file->GetDataLinkType (); + WifiPreamble preamble = txVector.GetPreambleType (); switch (dlt) { @@ -374,6 +382,16 @@ } header.SetFrameFlags (frameFlags); + + uint32_t rate; + if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) + { + rate = 128 + txVector.GetMode ().GetMcsValue (); + } + else + { + rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000; + } header.SetRate (rate); uint16_t channelFlags = 0; diff -r f49a15537f57 src/wifi/helper/wifi-helper.h --- a/src/wifi/helper/wifi-helper.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/helper/wifi-helper.h Sun Nov 06 12:04:10 2016 +0100 @@ -143,8 +143,6 @@ * \param packet the packet * \param channelFreqMhz the channel frequency * \param channelNumber the channel number - * \param rate the PHY bitrate - * \param preamble the preamble type * \param txVector the TXVECTOR * \param aMpdu the A-MPDU information * @@ -154,17 +152,13 @@ Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, - uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu); + MpduInfo aMpdu); /** * \param file the pcap file wrapper * \param packet the packet * \param channelFreqMhz the channel frequency * \param channelNumber the channel number - * \param rate the PHY bitrate - * \param preamble the preamble type * \param txVector the TXVECTOR * \param aMpdu the A-MPDU information * \param signalNoise the rx signal and noise information @@ -175,11 +169,9 @@ Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, - uint32_t rate, - WifiPreamble preamble, WifiTxVector txVector, - struct mpduInfo aMpdu, - struct signalNoiseDbm signalNoise); + MpduInfo aMpdu, + SignalNoiseDbm signalNoise); ObjectFactory m_phy; ObjectFactory m_errorRateModel; diff -r f49a15537f57 src/wifi/model/aarf-wifi-manager.cc --- a/src/wifi/model/aarf-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/aarf-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -238,7 +238,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -255,14 +256,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/aarfcd-wifi-manager.cc --- a/src/wifi/model/aarfcd-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/aarfcd-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -310,7 +310,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -327,14 +328,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/amrr-wifi-manager.cc --- a/src/wifi/model/amrr-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/amrr-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -341,7 +341,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, rateIndex); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -357,14 +358,16 @@ } UpdateMode (station); WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/aparf-wifi-manager.cc --- a/src/wifi/model/aparf-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/aparf-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -329,7 +329,8 @@ channelWidth = 20; } CheckInit (station); - return WifiTxVector (GetSupported (station, station->m_rate), station->m_power, GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, station->m_power, GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -346,14 +347,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/arf-wifi-manager.cc --- a/src/wifi/model/arf-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/arf-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -214,7 +214,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 1, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 1, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -231,14 +232,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/block-ack-manager.cc --- a/src/wifi/model/block-ack-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/block-ack-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -85,7 +85,7 @@ bool BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid, - enum OriginatorBlockAckAgreement::State state) const + OriginatorBlockAckAgreement::State state) const { NS_LOG_FUNCTION (this << recipient << static_cast (tid) << state); AgreementsCI it; @@ -471,7 +471,7 @@ } bool -BlockAckManager::HasBar (struct Bar &bar) +BlockAckManager::HasBar (Bar &bar) { NS_LOG_FUNCTION (this << &bar); if (m_bars.size () > 0) @@ -695,7 +695,7 @@ } void -BlockAckManager::SetBlockAckType (enum BlockAckType bAckType) +BlockAckManager::SetBlockAckType (BlockAckType bAckType) { NS_LOG_FUNCTION (this << bAckType); m_blockAckType = bAckType; @@ -773,7 +773,7 @@ } void -BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, enum WifiMacHeader::QosAckPolicy policy) +BlockAckManager::NotifyMpduTransmission (Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, WifiMacHeader::QosAckPolicy policy) { NS_LOG_FUNCTION (this << recipient << static_cast (tid) << nextSeqNumber); Ptr bar = 0; diff -r f49a15537f57 src/wifi/model/block-ack-manager.h --- a/src/wifi/model/block-ack-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/block-ack-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -110,7 +110,7 @@ * station addressed by recipient for tid tid. */ bool ExistsAgreementInState (Mac48Address recipient, uint8_t tid, - enum OriginatorBlockAckAgreement::State state) const; + OriginatorBlockAckAgreement::State state) const; /** * \param reqHdr Relative Add block ack request (action frame). * \param recipient Address of peer station involved in block ack mechanism. @@ -161,7 +161,7 @@ * corresponding block ack bitmap. This method doesn't remove the packet from this queue. */ Ptr PeekNextPacket (WifiMacHeader &hdr); - bool HasBar (struct Bar &bar); + bool HasBar (Bar &bar); /** * Returns true if there are packets that need of retransmission or at least a * BAR is scheduled. Returns false otherwise. @@ -258,7 +258,7 @@ * * See ctrl-headers.h for more details. */ - void SetBlockAckType (enum BlockAckType bAckType); + void SetBlockAckType (BlockAckType bAckType); /** * \param recipient Address of station involved in block ack mechanism. * \param tid Traffic ID. @@ -450,7 +450,7 @@ std::list m_bars; uint8_t m_blockAckThreshold; - enum BlockAckType m_blockAckType; + BlockAckType m_blockAckType; Time m_maxDelay; MacTxMiddle* m_txMiddle; Mac48Address m_address; diff -r f49a15537f57 src/wifi/model/cara-wifi-manager.cc --- a/src/wifi/model/cara-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/cara-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -188,7 +188,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -205,14 +206,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/constant-rate-wifi-manager.cc --- a/src/wifi/model/constant-rate-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/constant-rate-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -117,14 +117,14 @@ ConstantRateWifiManager::DoGetDataTxVector (WifiRemoteStation *st) { NS_LOG_FUNCTION (this << st); - return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetShortGuardInterval (st), Min(GetNumberOfTransmitAntennas (), GetNumberOfSupportedRxAntennas (st)), 0, GetChannelWidth (st), GetAggregation (st), false); + return WifiTxVector (m_dataMode, GetDefaultTxPowerLevel (), GetLongRetryCount (st), GetPreambleForTransmission (m_dataMode, GetAddress (st)), GetShortGuardInterval (st), Min(GetNumberOfTransmitAntennas (), GetNumberOfSupportedRxAntennas (st)), 0, GetChannelWidth (st), GetAggregation (st), false); } WifiTxVector ConstantRateWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) { NS_LOG_FUNCTION (this << st); - return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetShortGuardInterval (st), 1, 0, GetChannelWidth (st), GetAggregation (st), false); + return WifiTxVector (m_ctlMode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetPreambleForTransmission (m_ctlMode, GetAddress (st)), GetShortGuardInterval (st), 1, 0, GetChannelWidth (st), GetAggregation (st), false); } bool diff -r f49a15537f57 src/wifi/model/ctrl-headers.cc --- a/src/wifi/model/ctrl-headers.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/ctrl-headers.cc Sun Nov 06 12:04:10 2016 +0100 @@ -195,7 +195,7 @@ } void -CtrlBAckRequestHeader::SetType (enum BlockAckType type) +CtrlBAckRequestHeader::SetType (BlockAckType type) { NS_LOG_FUNCTION (this << type); switch (type) @@ -408,7 +408,7 @@ } void -CtrlBAckResponseHeader::SetType (enum BlockAckType type) +CtrlBAckResponseHeader::SetType (BlockAckType type) { NS_LOG_FUNCTION (this << type); switch (type) diff -r f49a15537f57 src/wifi/model/ctrl-headers.h --- a/src/wifi/model/ctrl-headers.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/ctrl-headers.h Sun Nov 06 12:04:10 2016 +0100 @@ -70,7 +70,7 @@ * * \param type */ - void SetType (enum BlockAckType type); + void SetType (BlockAckType type); /** * Set Traffic ID (TID). * @@ -206,7 +206,7 @@ * * \param type */ - void SetType (enum BlockAckType type); + void SetType (BlockAckType type); /** * Set Traffic ID (TID). * diff -r f49a15537f57 src/wifi/model/edca-txop-n.cc --- a/src/wifi/model/edca-txop-n.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/edca-txop-n.cc Sun Nov 06 12:04:10 2016 +0100 @@ -368,13 +368,13 @@ } void -EdcaTxopN::SetTypeOfStation (enum TypeOfStation type) +EdcaTxopN::SetTypeOfStation (TypeOfStation type) { NS_LOG_FUNCTION (this << static_cast (type)); m_typeOfStation = type; } -enum TypeOfStation +TypeOfStation EdcaTxopN::GetTypeOfStation (void) const { NS_LOG_FUNCTION (this); @@ -1451,7 +1451,7 @@ } void -EdcaTxopN::SetAccessCategory (enum AcIndex ac) +EdcaTxopN::SetAccessCategory (AcIndex ac) { NS_LOG_FUNCTION (this << static_cast (ac)); m_ac = ac; @@ -1647,7 +1647,7 @@ } void -EdcaTxopN::SendBlockAckRequest (const struct Bar &bar) +EdcaTxopN::SendBlockAckRequest (const Bar &bar) { NS_LOG_FUNCTION (this << &bar); WifiMacHeader hdr; diff -r f49a15537f57 src/wifi/model/edca-txop-n.h --- a/src/wifi/model/edca-txop-n.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/edca-txop-n.h Sun Nov 06 12:04:10 2016 +0100 @@ -141,19 +141,19 @@ * * \param type */ - void SetTypeOfStation (enum TypeOfStation type); + void SetTypeOfStation (TypeOfStation type); /** * Return type of station. * * \return type of station */ - enum TypeOfStation GetTypeOfStation (void) const; + TypeOfStation GetTypeOfStation (void) const; /** * Return the packet queue associated with this EdcaTxopN. * * \return WifiMacQueue */ - Ptr GetEdcaQueue () const; + Ptr GetEdcaQueue () const; virtual void SetMinCw (uint32_t minCw); virtual void SetMaxCw (uint32_t maxCw); @@ -383,7 +383,7 @@ * * \param ac */ - void SetAccessCategory (enum AcIndex ac); + void SetAccessCategory (AcIndex ac); /** * \param packet packet to send @@ -523,7 +523,7 @@ * * \param bar */ - void SendBlockAckRequest (const struct Bar &bar); + void SendBlockAckRequest (const Bar &bar); /** * For now is typically invoked to complete transmission of a packets sent with ack policy * Block Ack: the packet is buffered and dcf is reset. @@ -586,10 +586,10 @@ * Represents the minimum number of packets for use of block ack. */ uint8_t m_blockAckThreshold; - enum BlockAckType m_blockAckType; + BlockAckType m_blockAckType; Time m_currentPacketTimestamp; uint16_t m_blockAckInactivityTimeout; - struct Bar m_currentBar; + Bar m_currentBar; Time m_startTxop; bool m_isAccessRequestedForRts; TracedValue m_backoffTrace; diff -r f49a15537f57 src/wifi/model/ideal-wifi-manager.cc --- a/src/wifi/model/ideal-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/ideal-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -370,7 +370,7 @@ NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss)); m_currentRate = maxMode.GetDataRate (channelWidth, GetPhy ()->GetGuardInterval (), nss); } - return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, nss, 0, channelWidth, GetAggregation (station), false); + return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, nss, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -402,7 +402,7 @@ maxMode = mode; } } - return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, nss, 0, GetChannelWidthForMode (maxMode), GetAggregation (station), false); + return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, nss, 0, GetChannelWidthForMode (maxMode), GetAggregation (station), false); } bool diff -r f49a15537f57 src/wifi/model/interference-helper.cc --- a/src/wifi/model/interference-helper.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/interference-helper.cc Sun Nov 06 12:04:10 2016 +0100 @@ -34,12 +34,9 @@ * Phy event class ****************************************************************/ -InterferenceHelper::Event::Event (uint32_t size, WifiTxVector txVector, - enum WifiPreamble preamble, - Time duration, double rxPower) +InterferenceHelper::Event::Event (uint32_t size, WifiTxVector txVector, Time duration, double rxPower) : m_size (size), m_txVector (txVector), - m_preamble (preamble), m_startTime (Simulator::Now ()), m_endTime (m_startTime + duration), m_rxPowerW (rxPower) @@ -92,12 +89,6 @@ return m_txVector.GetMode (); } -enum WifiPreamble -InterferenceHelper::Event::GetPreambleType (void) const -{ - return m_preamble; -} - /**************************************************************** * Class which records SNIR change events for a @@ -147,17 +138,11 @@ } Ptr -InterferenceHelper::Add (uint32_t size, WifiTxVector txVector, - enum WifiPreamble preamble, - Time duration, double rxPowerW) +InterferenceHelper::Add (uint32_t size, WifiTxVector txVector, Time duration, double rxPowerW) { Ptr event; - event = Create (size, - txVector, - preamble, - duration, - rxPowerW); + event = Create (size, txVector, duration, rxPowerW); AppendEvent (event); return event; } @@ -168,7 +153,7 @@ // Parameters other than duration and rxPowerW are unused for this type // of signal, so we provide dummy versions WifiTxVector fakeTxVector; - Add (0, fakeTxVector, WIFI_PREAMBLE_NONE, duration, rxPowerW); + Add (0, fakeTxVector, duration, rxPowerW); } void @@ -295,11 +280,11 @@ NiChanges::iterator j = ni->begin (); Time previous = (*j).GetTime (); WifiMode payloadMode = event->GetPayloadMode (); - WifiPreamble preamble = event->GetPreambleType (); - Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector (), preamble); //packet start time + preamble - Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector (), preamble); //packet start time + preamble + L-SIG + WifiPreamble preamble = event->GetTxVector ().GetPreambleType (); + Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector ()); //packet start time + preamble + Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector ()); //packet start time + preamble + L-SIG Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) - Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B + Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B double noiseInterferenceW = (*j).GetDelta (); double powerW = event->GetRxPowerW (); j++; @@ -347,7 +332,7 @@ NiChanges::iterator j = ni->begin (); Time previous = (*j).GetTime (); WifiMode payloadMode = event->GetPayloadMode (); - WifiPreamble preamble = event->GetPreambleType (); + WifiPreamble preamble = event->GetTxVector ().GetPreambleType (); WifiMode htHeaderMode; if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF) { @@ -359,11 +344,11 @@ //mode for PLCP header fields sent with VHT modulation htHeaderMode = WifiPhy::GetVhtPlcpHeaderMode (payloadMode); } - WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble, event->GetTxVector ()); - Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector (), preamble); //packet start time + preamble - Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector (), preamble); //packet start time + preamble + L-SIG + WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (event->GetTxVector ()); + Time plcpHeaderStart = (*j).GetTime () + WifiPhy::GetPlcpPreambleDuration (event->GetTxVector ()); //packet start time + preamble + Time plcpHsigHeaderStart = plcpHeaderStart + WifiPhy::GetPlcpHeaderDuration (event->GetTxVector ()); //packet start time + preamble + L-SIG Time plcpHtTrainingSymbolsStart = plcpHsigHeaderStart + WifiPhy::GetPlcpHtSigHeaderDuration (preamble) + WifiPhy::GetPlcpVhtSigA1Duration (preamble) + WifiPhy::GetPlcpVhtSigA2Duration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) - Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (preamble, event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B + Time plcpPayloadStart = plcpHtTrainingSymbolsStart + WifiPhy::GetPlcpHtTrainingSymbolDuration (event->GetTxVector ()) + WifiPhy::GetPlcpVhtSigBDuration (preamble); //packet start time + preamble + L-SIG + HT-SIG or VHT-SIG-A (A1 + A2) + (V)HT Training + VHT-SIG-B double noiseInterferenceW = (*j).GetDelta (); double powerW = event->GetRxPowerW (); j++; diff -r f49a15537f57 src/wifi/model/interference-helper.h --- a/src/wifi/model/interference-helper.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/interference-helper.h Sun Nov 06 12:04:10 2016 +0100 @@ -25,7 +25,6 @@ #include #include #include "wifi-mode.h" -#include "wifi-preamble.h" #include "wifi-phy-standard.h" #include "ns3/nstime.h" #include "ns3/simple-ref-count.h" @@ -52,13 +51,10 @@ * * \param size packet size * \param txVector TXVECTOR of the packet - * \param preamble preamble type * \param duration duration of the signal * \param rxPower the receive power (w) */ - Event (uint32_t size, WifiTxVector txVector, - enum WifiPreamble preamble, - Time duration, double rxPower); + Event (uint32_t size, WifiTxVector txVector, Time duration, double rxPower); ~Event (); /** @@ -103,18 +99,11 @@ * \return the Wi-Fi mode used for the payload */ WifiMode GetPayloadMode (void) const; - /** - * Return the preamble type of the packet. - * - * \return the preamble type of the packet - */ - enum WifiPreamble GetPreambleType (void) const; private: uint32_t m_size; WifiTxVector m_txVector; - enum WifiPreamble m_preamble; Time m_startTime; Time m_endTime; double m_rxPowerW; @@ -172,15 +161,12 @@ * * \param size packet size * \param txVector TXVECTOR of the packet - * \param preamble Wi-Fi preamble for the packet * \param duration the duration of the signal * \param rxPower receive power (W) * * \return InterferenceHelper::Event */ - Ptr Add (uint32_t size, WifiTxVector txVector, - enum WifiPreamble preamble, - Time duration, double rxPower); + Ptr Add (uint32_t size, WifiTxVector txVector, Time duration, double rxPower); /** * Add a non-Wifi signal to interference helper. diff -r f49a15537f57 src/wifi/model/mac-low.cc --- a/src/wifi/model/mac-low.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/mac-low.cc Sun Nov 06 12:04:10 2016 +0100 @@ -533,7 +533,7 @@ void MacLow::ResetPhy (void) { - m_phy->SetReceiveOkCallback (MakeNullCallback, double, WifiTxVector, enum WifiPreamble> ()); + m_phy->SetReceiveOkCallback (MakeNullCallback, double, WifiTxVector> ()); m_phy->SetReceiveErrorCallback (MakeNullCallback, double> ()); RemovePhyMacLowListener (m_phy); m_phy = 0; @@ -887,9 +887,9 @@ } void -MacLow::ReceiveOk (Ptr packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe) +MacLow::ReceiveOk (Ptr packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe) { - NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << preamble); + NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << txVector.GetPreambleType ()); /* A packet is received from the PHY. * When we have handled this packet, * we handle any packet present in the @@ -901,7 +901,7 @@ bool isPrevNavZero = IsNavZero (); NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ()); - NotifyNav (packet, hdr, preamble); + NotifyNav (packet, hdr, txVector.GetPreambleType ()); if (hdr.IsRts ()) { /* see section 9.2.5.7 802.11-1999 @@ -1242,7 +1242,7 @@ } uint32_t -MacLow::GetBlockAckSize (enum BlockAckType type) const +MacLow::GetBlockAckSize (BlockAckType type) const { WifiMacHeader hdr; hdr.SetType (WIFI_MAC_CTL_BACKRESP); @@ -1282,39 +1282,17 @@ MacLow::GetAckDuration (WifiTxVector ackTxVector) const { NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet) - WifiPreamble preamble; - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, preamble, m_phy->GetFrequency ()); + return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetFrequency ()); } Time -MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const +MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const { /* * For immediate Basic BlockAck we should transmit the frame with the same WifiMode * as the BlockAckReq. */ - WifiPreamble preamble; - if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency ()); + return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, m_phy->GetFrequency ()); } Time @@ -1328,16 +1306,7 @@ MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const { NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet) - WifiPreamble preamble; - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ()); + return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ()); } uint32_t @@ -1419,46 +1388,17 @@ const WifiMacHeader* hdr, const MacLowTransmissionParameters& params) const { - WifiPreamble preamble; Time txTime = Seconds (0); if (params.MustSendRts ()) { WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr); - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ()); + txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ()); txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector); txTime += Time (GetSifs () * 2); } WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); - if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - preamble = WIFI_PREAMBLE_VHT; - } - else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } uint32_t dataSize = GetSize (packet, hdr); - txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency ()); + txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFrequency ()); if (params.MustWaitAck ()) { txTime += GetSifs (); @@ -1476,29 +1416,8 @@ if (params.HasNextPacket ()) { WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); - WifiPreamble preamble; - if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_VHT; - } - if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } txTime += GetSifs (); - txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency ()); + txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, m_phy->GetFrequency ()); } return txTime; } @@ -1536,7 +1455,7 @@ cts.SetType (WIFI_MAC_CTL_CTS); WifiTxVector txVector = GetRtsTxVector (packet, &hdr); Time navCounterResetCtsMissedDelay = - m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency ()) + + m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, m_phy->GetFrequency ()) + Time (2 * GetSifs ()) + Time (2 * GetSlotTime ()); m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay, &MacLow::NavCounterResetCtsMissed, this, @@ -1620,19 +1539,19 @@ } void -MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, - WifiTxVector txVector, WifiPreamble preamble) +MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, WifiTxVector txVector) { NS_LOG_FUNCTION (this << packet << hdr << txVector); NS_LOG_DEBUG ("send " << hdr->GetTypeString () << ", to=" << hdr->GetAddr1 () << ", size=" << packet->GetSize () << ", mode=" << txVector.GetMode () << + ", preamble=" << txVector.GetPreambleType () << ", duration=" << hdr->GetDuration () << ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); if (!m_ampdu || hdr->IsRts () || hdr->IsBlockAck ()) { - m_phy->SendPacket (packet, txVector, preamble); + m_phy->SendPacket (packet, txVector); } else { @@ -1644,7 +1563,7 @@ uint32_t queueSize = m_aggregateQueue->GetSize (); bool vhtSingleMpdu = false; bool last = false; - enum mpduType mpdutype = NORMAL_MPDU; + MpduType mpdutype = NORMAL_MPDU; uint8_t tid = GetTid (packet, *hdr); AcIndex ac = QosUtilsMapTidToAc (tid); @@ -1659,7 +1578,7 @@ AmpduTag ampdutag; ampdutag.SetAmpdu (true); Time delay = Seconds (0); - Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, preamble, m_phy->GetFrequency ()); + Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, m_phy->GetFrequency ()); if (queueSize > 1 || vhtSingleMpdu) { txVector.SetAggregation (true); @@ -1692,7 +1611,7 @@ } } - Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0); + Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, m_phy->GetFrequency (), mpdutype, 0); remainingAmpduDuration -= mpduDuration; ampdutag.SetRemainingNbOfMpdus (queueSize - 1); @@ -1708,11 +1627,11 @@ if (delay == Seconds (0)) { - m_phy->SendPacket (newPacket, txVector, preamble, mpdutype); + m_phy->SendPacket (newPacket, txVector, mpdutype); } else { - Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, preamble, mpdutype); + Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, mpdutype); } if (queueSize > 1) { @@ -1720,16 +1639,16 @@ delay = delay + mpduDuration; } - preamble = WIFI_PREAMBLE_NONE; + txVector.SetPreambleType (WIFI_PREAMBLE_NONE); } } } void -MacLow::SendMpdu (Ptr packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype) +MacLow::SendMpdu (Ptr packet, WifiTxVector txVector, MpduType mpdutype) { NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); - m_phy->SendPacket (packet, txVector, preamble, mpdutype); + m_phy->SendPacket (packet, txVector, mpdutype); } void @@ -1835,16 +1754,6 @@ WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); Time duration = Seconds (0); - WifiPreamble preamble; - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - if (m_txParams.HasDurationId ()) { duration += m_txParams.GetDurationId (); @@ -1855,7 +1764,7 @@ duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector); duration += GetSifs (); duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), - m_currentTxVector, preamble, m_phy->GetFrequency ()); + m_currentTxVector, m_phy->GetFrequency ()); duration += GetSifs (); if (m_txParams.MustWaitBasicBlockAck ()) { @@ -1874,7 +1783,7 @@ if (m_txParams.HasNextPacket ()) { duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, preamble, m_phy->GetFrequency ()); + m_currentTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitAck ()) { duration += GetSifs (); @@ -1884,7 +1793,7 @@ } rts.SetDuration (duration); - Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ()); + Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ()); Time timerDelay = txDuration + GetCtsTimeout (); NS_ASSERT (m_ctsTimeoutEvent.IsExpired ()); @@ -1896,37 +1805,13 @@ WifiMacTrailer fcs; packet->AddTrailer (fcs); - ForwardDown (packet, &rts, rtsTxVector, preamble); + ForwardDown (packet, &rts, rtsTxVector); } void MacLow::StartDataTxTimers (WifiTxVector dataTxVector) { - WifiPreamble preamble; - - if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - preamble = WIFI_PREAMBLE_VHT; - } - //Since it is data then it can have format = GF - else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - - Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency ()); + Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitNormalAck ()) { Time timerDelay = txDuration + GetAckTimeout (); @@ -1990,29 +1875,6 @@ { NS_LOG_FUNCTION (this); /* send this packet directly. No RTS is needed. */ - WifiPreamble preamble; - if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - preamble = WIFI_PREAMBLE_VHT; - } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - //In the future has to make sure that receiver has greenfield enabled - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - StartDataTxTimers (m_currentTxVector); Time duration = Seconds (0.0); @@ -2043,7 +1905,7 @@ { duration += GetSifs (); duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, preamble, m_phy->GetFrequency ()); + m_currentTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitAck ()) { duration += GetSifs (); @@ -2060,7 +1922,7 @@ m_currentPacket->AddTrailer (fcs); } - ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble); + ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector); m_currentPacket = 0; } @@ -2089,21 +1951,6 @@ cts.SetAddr1 (m_self); WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); - - WifiPreamble preamble; - if (ctsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - Time duration = Seconds (0); if (m_txParams.HasDurationId ()) @@ -2114,7 +1961,7 @@ { duration += GetSifs (); duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr), - m_currentTxVector, preamble, m_phy->GetFrequency ()); + m_currentTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitBasicBlockAck ()) { @@ -2137,7 +1984,7 @@ { duration += GetSifs (); duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, preamble, m_phy->GetFrequency ()); + m_currentTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitCompressedBlockAck ()) { duration += GetSifs (); @@ -2159,9 +2006,9 @@ WifiMacTrailer fcs; packet->AddTrailer (fcs); - ForwardDown (packet, &cts, ctsTxVector,preamble); + ForwardDown (packet, &cts, ctsTxVector); - Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ()); + Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ()); txDuration += GetSifs (); NS_ASSERT (m_sendDataEvent.IsExpired ()); @@ -2200,19 +2047,9 @@ SnrTag tag; tag.Set (rtsSnr); packet->AddPacketTag (tag); - - WifiPreamble preamble; - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } //CTS should always use non-HT PPDU (HT PPDU cases not supported yet) - ForwardDown (packet, &cts, ctsTxVector, preamble); + ForwardDown (packet, &cts, ctsTxVector); } void @@ -2237,29 +2074,6 @@ m_txPackets.clear (); } - WifiPreamble preamble; - if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - preamble = WIFI_PREAMBLE_VHT; - } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - //In the future has to make sure that receiver has greenfield enabled - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } - StartDataTxTimers (m_currentTxVector); Time newDuration = Seconds (0); if (m_txParams.MustWaitBasicBlockAck ()) @@ -2282,7 +2096,7 @@ if (m_txParams.HasNextPacket ()) { newDuration += GetSifs (); - newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ()); + newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ()); if (m_txParams.MustWaitCompressedBlockAck ()) { newDuration += GetSifs (); @@ -2296,7 +2110,7 @@ } } - Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, preamble, m_phy->GetFrequency ()); + Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, m_phy->GetFrequency ()); duration -= txDuration; duration -= GetSifs (); @@ -2311,7 +2125,7 @@ m_currentPacket->AddTrailer (fcs); } - ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble); + ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector); m_currentPacket = 0; } @@ -2373,19 +2187,9 @@ SnrTag tag; tag.Set (dataSnr); packet->AddPacketTag (tag); - - WifiPreamble preamble; - if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } //ACK should always use non-HT PPDU (HT PPDU cases not supported yet) - ForwardDown (packet, &ack, ackTxVector, preamble); + ForwardDown (packet, &ack, ackTxVector); } bool @@ -2675,23 +2479,10 @@ packet->AddHeader (hdr); WifiMacTrailer fcs; packet->AddTrailer (fcs); - WifiPreamble preamble; - if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } SnrTag tag; tag.Set (rxSnr); packet->AddPacketTag (tag); - ForwardDown (packet, &hdr, blockAckReqTxVector, preamble); + ForwardDown (packet, &hdr, blockAckReqTxVector); m_currentPacket = 0; } @@ -2805,13 +2596,13 @@ } void -MacLow::RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener) +MacLow::RegisterBlockAckListenerForAc (AcIndex ac, MacLowAggregationCapableTransmissionListener *listener) { m_edcaListeners.insert (std::make_pair (ac, listener)); } void -MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble) +MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector) { NS_LOG_FUNCTION (this); AmpduTag ampdu; @@ -2826,6 +2617,7 @@ WifiMacHeader firsthdr; (*n).first->PeekHeader (firsthdr); NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); + WifiPreamble preamble = txVector.GetPreambleType (); NotifyNav ((*n).first, firsthdr, preamble); if (firsthdr.GetAddr1 () == m_self) @@ -2850,12 +2642,12 @@ if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) { - ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); + ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); } else if (firsthdr.IsData () || firsthdr.IsQosData ()) { NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ()); - ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); + ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); if (firsthdr.IsQosAck ()) { NS_LOG_DEBUG ("Normal Ack"); @@ -2895,7 +2687,7 @@ } else { - ReceiveOk (aggregatedPacket, rxSnr, txVector, preamble, ampduSubframe); + ReceiveOk (aggregatedPacket, rxSnr, txVector, ampduSubframe); } } @@ -2908,37 +2700,18 @@ return true; } - WifiPreamble preamble; Time aPPDUMaxTime = MilliSeconds (10); - uint8_t tid = GetTid (peekedPacket, peekedHdr); AcIndex ac = QosUtilsMapTidToAc (tid); std::map::const_iterator listenerIt = m_edcaListeners.find (ac); if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) { - preamble = WIFI_PREAMBLE_VHT; aPPDUMaxTime = MicroSeconds (5484); } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - { - preamble = WIFI_PREAMBLE_HT_GF; - } - else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) - { - preamble = WIFI_PREAMBLE_HT_MF; - } - else if (m_stationManager->GetShortPreambleEnabled ()) - { - preamble = WIFI_PREAMBLE_SHORT; - } - else - { - preamble = WIFI_PREAMBLE_LONG; - } //A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime - if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, preamble, m_phy->GetFrequency ()) > aPPDUMaxTime) + if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy->GetFrequency ()) > aPPDUMaxTime) { NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime"); return true; diff -r f49a15537f57 src/wifi/model/mac-low.h --- a/src/wifi/model/mac-low.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/mac-low.h Sun Nov 06 12:04:10 2016 +0100 @@ -30,7 +30,6 @@ #include "wifi-mac-header.h" #include "wifi-mode.h" #include "wifi-phy.h" -#include "wifi-preamble.h" #include "wifi-remote-station-manager.h" #include "ctrl-headers.h" #include "mgt-headers.h" @@ -731,13 +730,12 @@ * \param packet packet received * \param rxSnr snr of packet received * \param txVector TXVECTOR of packet received - * \param preamble type of preamble used for the packet received * \param ampduSubframe true if this MPDU is part of an A-MPDU * * This method is typically invoked by the lower PHY layer to notify * the MAC layer that a packet was successfully received. */ - void ReceiveOk (Ptr packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe); + void ReceiveOk (Ptr packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe); /** * \param packet packet received. * \param rxSnr snr of packet received. @@ -795,7 +793,7 @@ * The lifetime of the registered listener is typically equal to the lifetime of the queue * associated to this AC. */ - void RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener); + void RegisterBlockAckListenerForAc (AcIndex ac, MacLowAggregationCapableTransmissionListener *listener); /** * \param packet the packet to be aggregated. If the aggregation is succesfull, it corresponds either to the first data packet that will be aggregated or to the BAR that will be piggybacked at the end of the A-MPDU. * \param hdr the WifiMacHeader for the packet. @@ -809,12 +807,11 @@ * \param aggregatedPacket which is the current A-MPDU * \param rxSnr snr of packet received * \param txVector TXVECTOR of packet received - * \param preamble type of preamble used for the packet received * * This function de-aggregates an A-MPDU and decide if each MPDU is received correctly or not * */ - void DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble); + void DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector); /** * \param peekedPacket the packet to be aggregated * \param peekedHdr the WifiMacHeader for the packet. @@ -862,7 +859,7 @@ * \param type the Block ACK type * \return the total Block ACK size */ - uint32_t GetBlockAckSize (enum BlockAckType type) const; + uint32_t GetBlockAckSize (BlockAckType type) const; /** * Return the total RTS size (including FCS trailer). * @@ -890,20 +887,17 @@ * \param packet * \param hdr * \param txVector - * \param preamble */ - void ForwardDown (Ptr packet, const WifiMacHeader *hdr, - WifiTxVector txVector, WifiPreamble preamble); + void ForwardDown (Ptr packet, const WifiMacHeader *hdr, WifiTxVector txVector); /** * Forward the MPDU down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used. * * \param packet * \param hdr * \param txVector - * \param preamble * \param mpdutype */ - void SendMpdu (Ptr packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype); + void SendMpdu (Ptr packet, WifiTxVector txVector, MpduType mpdutype); /** * Return a TXVECTOR for the RTS frame given the destination. * The function consults WifiRemoteStationManager, which controls the rate @@ -1020,7 +1014,7 @@ * \param type the Block ACK type * \return the time required to transmit the Block ACK (including preamble and FCS) */ - Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const; + Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const; /** * Check if the current packet should be sent with a RTS protection. * diff -r f49a15537f57 src/wifi/model/mgt-headers.h --- a/src/wifi/model/mgt-headers.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/mgt-headers.h Sun Nov 06 12:04:10 2016 +0100 @@ -614,10 +614,10 @@ */ typedef union { - enum MeshActionValue meshAction; - enum MultihopActionValue multihopAction; - enum SelfProtectedActionValue selfProtectedAction; - enum BlockAckActionValue blockAck; + MeshActionValue meshAction; + MultihopActionValue multihopAction; + SelfProtectedActionValue selfProtectedAction; + BlockAckActionValue blockAck; } ActionValue; /** * Set action for this Action header. @@ -625,7 +625,7 @@ * \param type category * \param action action */ - void SetAction (enum CategoryValue type,ActionValue action); + void SetAction (CategoryValue type, ActionValue action); /** * Return the category value. diff -r f49a15537f57 src/wifi/model/minstrel-ht-wifi-manager.cc --- a/src/wifi/model/minstrel-ht-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/minstrel-ht-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -85,9 +85,9 @@ std::vector > ().swap (m_sampleTable); for (uint8_t j = 0; j < m_groupsTable.size (); j++) { - std::vector ().swap (m_groupsTable[j].m_ratesTable); + std::vector ().swap (m_groupsTable[j].m_ratesTable); } - std::vector ().swap (m_groupsTable); + std::vector ().swap (m_groupsTable); m_statsFile.close (); } } @@ -340,7 +340,8 @@ txvector.SetNess (0); txvector.SetStbc (phy->GetStbc ()); txvector.SetMode (mode); - return phy->CalculateTxDuration (m_frameLength, txvector, WIFI_PREAMBLE_HT_MF, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0); + txvector.SetPreambleType (WIFI_PREAMBLE_HT_MF); + return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0); } Time @@ -355,7 +356,8 @@ txvector.SetNess (0); txvector.SetStbc (phy->GetStbc ()); txvector.SetMode (mode); - return phy->CalculateTxDuration (m_frameLength, txvector, WIFI_PREAMBLE_NONE, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0); + txvector.SetPreambleType (WIFI_PREAMBLE_NONE); + return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency (), MPDU_IN_AGGREGATE, 0); } Time @@ -932,8 +934,8 @@ { m_rateChange (dataRate, station->m_state->m_address); } - - return WifiTxVector (GetMcsSupported (station, mcsIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), + WifiMode mode = GetMcsSupported (station, mcsIndex); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), group.sgi, group.streams, GetNess (station), group.chWidth, GetAggregation (station) && !station->m_isSampling, GetStbc (station)); } } @@ -1009,7 +1011,7 @@ NS_ASSERT (rateFound); - return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), GetShortRetryCount (station), + return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (rtsRate, GetAddress (station)), false, 1, 0, GetChannelWidth (station), GetAggregation (station), false); } } diff -r f49a15537f57 src/wifi/model/minstrel-ht-wifi-manager.h --- a/src/wifi/model/minstrel-ht-wifi-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/minstrel-ht-wifi-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -67,7 +67,7 @@ * Data structure for a table of group definitions. * A vector of McsGroups. */ -typedef std::vector MinstrelMcsGroups; +typedef std::vector MinstrelMcsGroups; struct MinstrelHtWifiRemoteStation; /** @@ -114,7 +114,7 @@ * Data structure for a Minstrel Rate table. * A vector of a struct HtRateInfo. */ -typedef std::vector HtMinstrelRate; +typedef std::vector HtMinstrelRate; /** * A struct to contain information of a group. diff -r f49a15537f57 src/wifi/model/minstrel-wifi-manager.cc --- a/src/wifi/model/minstrel-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/minstrel-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -111,7 +111,8 @@ WifiMode mode = phy->GetMode (i); WifiTxVector txVector; txVector.SetMode (mode); - AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ())); + txVector.SetPreambleType (WIFI_PREAMBLE_LONG); + AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, phy->GetFrequency ())); } WifiRemoteStationManager::SetupPhy (phy); } @@ -361,7 +362,8 @@ //start the rate at half way station->m_txrate = station->m_nModes / 2; } - return WifiTxVector (GetSupported (station, station->m_txrate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_txrate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -376,14 +378,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/minstrel-wifi-manager.h --- a/src/wifi/model/minstrel-wifi-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/minstrel-wifi-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -66,7 +66,7 @@ * Data structure for a Minstrel Rate table * A vector of a struct RateInfo */ -typedef std::vector MinstrelRate; +typedef std::vector MinstrelRate; /** * Data structure for a Sample Rate table * A vector of a vector uint32_t diff -r f49a15537f57 src/wifi/model/onoe-wifi-manager.cc --- a/src/wifi/model/onoe-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/onoe-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -283,7 +283,8 @@ //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac channelWidth = 20; } - return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, rateIndex); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -298,14 +299,16 @@ } UpdateMode (station); WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/originator-block-ack-agreement.cc --- a/src/wifi/model/originator-block-ack-agreement.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/originator-block-ack-agreement.cc Sun Nov 06 12:04:10 2016 +0100 @@ -44,7 +44,7 @@ } void -OriginatorBlockAckAgreement::SetState (enum State state) +OriginatorBlockAckAgreement::SetState (State state) { m_state = state; if (state == INACTIVE) diff -r f49a15537f57 src/wifi/model/originator-block-ack-agreement.h --- a/src/wifi/model/originator-block-ack-agreement.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/originator-block-ack-agreement.h Sun Nov 06 12:04:10 2016 +0100 @@ -95,7 +95,7 @@ INACTIVE, UNSUCCESSFUL }; - void SetState (enum State state); + void SetState (State state); /** * Check if the current state of this agreement is PENDING. * @@ -142,7 +142,7 @@ private: - enum State m_state; + State m_state; uint16_t m_sentMpdus; bool m_needBlockAckReq; }; diff -r f49a15537f57 src/wifi/model/parf-wifi-manager.cc --- a/src/wifi/model/parf-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/parf-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -301,7 +301,8 @@ channelWidth = 20; } CheckInit (station); - return WifiTxVector (GetSupported (station, station->m_currentRate), station->m_currentPower, GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_currentRate); + return WifiTxVector (mode, station->m_currentPower, GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -318,14 +319,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (station, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (station, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } diff -r f49a15537f57 src/wifi/model/regular-wifi-mac.cc --- a/src/wifi/model/regular-wifi-mac.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/regular-wifi-mac.cc Sun Nov 06 12:04:10 2016 +0100 @@ -344,7 +344,7 @@ } void -RegularWifiMac::SetupEdcaQueue (enum AcIndex ac) +RegularWifiMac::SetupEdcaQueue (AcIndex ac) { NS_LOG_FUNCTION (this << ac); @@ -1099,7 +1099,7 @@ } void -RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) +RegularWifiMac::FinishConfigureStandard (WifiPhyStandard standard) { NS_LOG_FUNCTION (this << standard); uint32_t cwmin = 0; diff -r f49a15537f57 src/wifi/model/regular-wifi-mac.h --- a/src/wifi/model/regular-wifi-mac.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/regular-wifi-mac.h Sun Nov 06 12:04:10 2016 +0100 @@ -339,7 +339,7 @@ * deal with certain values in the WifiPhyStandard enumeration, and * chain up to this implementation to deal with the remainder. */ - virtual void FinishConfigureStandard (enum WifiPhyStandard standard); + virtual void FinishConfigureStandard (WifiPhyStandard standard); /** * \param cwMin the minimum congestion window size @@ -539,7 +539,7 @@ * * \param ac the Access Category index of the queue to initialise. */ - void SetupEdcaQueue (enum AcIndex ac); + void SetupEdcaQueue (AcIndex ac); void SetVoMaxAmsduSize (uint32_t size); void SetViMaxAmsduSize (uint32_t size); diff -r f49a15537f57 src/wifi/model/rraa-wifi-manager.cc --- a/src/wifi/model/rraa-wifi-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/rraa-wifi-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -295,7 +295,8 @@ { ResetCountersBasic (station); } - return WifiTxVector (GetSupported (station, station->m_rate), GetDefaultTxPowerLevel (), GetLongRetryCount (station), false, 1, 0, channelWidth, GetAggregation (station), false); + WifiMode mode = GetSupported (station, station->m_rate); + return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (mode, GetAddress (station)), false, 1, 0, channelWidth, GetAggregation (station), false); } WifiTxVector @@ -309,14 +310,16 @@ channelWidth = 20; } WifiTxVector rtsTxVector; + WifiMode mode; if (GetUseNonErpProtection () == false) { - rtsTxVector = WifiTxVector (GetSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetSupported (st, 0); } else { - rtsTxVector = WifiTxVector (GetNonErpSupported (st, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (st), false, 1, 0, channelWidth, GetAggregation (station), false); + mode = GetNonErpSupported (st, 0); } + rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetShortRetryCount (st), GetPreambleForTransmission (mode, GetAddress (st)), false, 1, 0, channelWidth, GetAggregation (station), false); return rtsTxVector; } @@ -391,7 +394,7 @@ } } -struct RraaWifiManager::ThresholdsItem +RraaWifiManager::ThresholdsItem RraaWifiManager::GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const { @@ -399,7 +402,7 @@ return GetThresholds (mode, station); } -struct RraaWifiManager::ThresholdsItem +RraaWifiManager::ThresholdsItem RraaWifiManager::GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const { uint8_t nss = 1; // This RAA only supports 1 spatial stream diff -r f49a15537f57 src/wifi/model/rraa-wifi-manager.h --- a/src/wifi/model/rraa-wifi-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/rraa-wifi-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -131,7 +131,7 @@ * * \return threshold */ - struct ThresholdsItem GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const; + ThresholdsItem GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const; /** * Get a threshold for the given station and mode index. * @@ -140,7 +140,7 @@ * * \return threshold */ - struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const; + ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const; bool m_basic; Time m_timeout; diff -r f49a15537f57 src/wifi/model/spectrum-wifi-phy.cc --- a/src/wifi/model/spectrum-wifi-phy.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/spectrum-wifi-phy.cc Sun Nov 06 12:04:10 2016 +0100 @@ -416,20 +416,19 @@ return; } - enum WifiPreamble preamble = tag.GetWifiPreamble (); - enum mpduType mpdutype = tag.GetMpduType (); + WifiPreamble preamble = txVector.GetPreambleType (); + MpduType mpdutype = tag.GetMpduType (); // At this point forward, processing parallels that of // YansWifiPhy::StartReceivePreambleAndHeader () AmpduTag ampduTag; Time endRx = Simulator::Now () + rxDuration; - Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble); + Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector); Ptr event; event = m_interference.Add (packet->GetSize (), txVector, - preamble, rxDuration, rxPowerW); @@ -533,7 +532,7 @@ { NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &SpectrumWifiPhy::StartReceivePacket, this, - packet, txVector, preamble, mpdutype, event); + packet, txVector, mpdutype, event); } NS_ASSERT (m_endRxEvent.IsExpired ()); @@ -563,17 +562,16 @@ void SpectrumWifiPhy::StartReceivePacket (Ptr packet, WifiTxVector txVector, - enum WifiPreamble preamble, - enum mpduType mpdutype, + MpduType mpdutype, Ptr event) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)mpdutype); + NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << (uint32_t)mpdutype); NS_ASSERT (IsStateRx ()); NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); AmpduTag ampduTag; WifiMode txMode = txVector.GetMode (); - struct InterferenceHelper::SnrPer snrPer; + InterferenceHelper::SnrPer snrPer; snrPer = m_interference.CalculatePlcpHeaderSnrPer (event); NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per); @@ -628,12 +626,6 @@ m_wifiSpectrumPhyInterface->SetDevice (device); } -void -SpectrumWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPreamble preamble) -{ - SendPacket (packet, txVector, preamble, NORMAL_MPDU); -} - Ptr SpectrumWifiPhy::GetTxPowerSpectralDensity (uint32_t centerFrequency, uint32_t channelWidth, double txPowerW) const { @@ -664,11 +656,13 @@ } void -SpectrumWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype) +SpectrumWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype) { NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector) - << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype); + << txVector.GetPreambleType () + << (uint32_t)txVector.GetTxPowerLevel () + << (uint32_t)mpdutype); /* Transmission can happen if: * - we are syncing on a packet. It is the responsability of the * MAC layer to avoid doing this but the PHY does nothing to @@ -684,7 +678,7 @@ return; } - Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), mpdutype, 1); + Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency (), mpdutype, 1); NS_ASSERT (txDuration > NanoSeconds (0)); if (m_state->IsStateRx ()) @@ -694,32 +688,23 @@ m_interference.NotifyRxEnd (); } NotifyTxBegin (packet); - uint32_t dataRate500KbpsUnits; - if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - dataRate500KbpsUnits = 128 + txVector.GetMode ().GetMcsValue (); - } - else - { - dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000; - } - if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE) + if ((mpdutype == MPDU_IN_AGGREGATE) && (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE)) { //send the first MPDU in an MPDU m_txMpduReferenceNumber++; } - struct mpduInfo aMpdu; + MpduInfo aMpdu; aMpdu.type = mpdutype; aMpdu.mpduRefNumber = m_txMpduReferenceNumber; - NotifyMonitorSniffTx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu); - m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble); + NotifyMonitorSniffTx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), txVector, aMpdu); + m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector); // // Spectrum elements added here // Ptr newPacket = packet->Copy (); // obtain non-const Packet WifiPhyTag oldtag; newPacket->RemovePacketTag (oldtag); - WifiPhyTag tag (txVector, preamble, mpdutype); + WifiPhyTag tag (txVector, mpdutype); newPacket->AddPacketTag (tag); NS_LOG_DEBUG ("Transmission signal power before antenna gain: " << GetPowerDbm (txVector.GetTxPowerLevel ()) << " dBm"); @@ -751,13 +736,13 @@ } void -SpectrumWifiPhy::EndReceive (Ptr packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr event) +SpectrumWifiPhy::EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event) { NS_LOG_FUNCTION (this << packet << event); NS_ASSERT (IsStateRx ()); NS_ASSERT (event->GetEndTime () == Simulator::Now ()); - struct InterferenceHelper::SnrPer snrPer; + InterferenceHelper::SnrPer snrPer; snrPer = m_interference.CalculatePlcpPayloadSnrPer (event); m_interference.NotifyRxEnd (); bool rxSucceeded; @@ -770,23 +755,14 @@ if (m_random->GetValue () > snrPer.per) { NotifyRxEnd (packet); - uint32_t dataRate500KbpsUnits; - if ((event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) || (event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)) - { - dataRate500KbpsUnits = 128 + event->GetPayloadMode ().GetMcsValue (); - } - else - { - dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate (event->GetTxVector ().GetChannelWidth (), event->GetTxVector ().IsShortGuardInterval (), 1) * event->GetTxVector ().GetNss () / 500000; - } - struct signalNoiseDbm signalNoise; + SignalNoiseDbm signalNoise; signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30; signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30; - struct mpduInfo aMpdu; + MpduInfo aMpdu; aMpdu.type = mpdutype; aMpdu.mpduRefNumber = m_rxMpduReferenceNumber; - NotifyMonitorSniffRx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise); - m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ()); + NotifyMonitorSniffRx (packet, (uint16_t) GetFrequency (), GetChannelNumber (), event->GetTxVector (), aMpdu, signalNoise); + m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ()); rxSucceeded = true; } else diff -r f49a15537f57 src/wifi/model/spectrum-wifi-phy.h --- a/src/wifi/model/spectrum-wifi-phy.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/spectrum-wifi-phy.h Sun Nov 06 12:04:10 2016 +0100 @@ -85,14 +85,12 @@ * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param preamble the preamble of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ void StartReceivePacket (Ptr packet, WifiTxVector txVector, - WifiPreamble preamble, - enum mpduType mpdutype, + MpduType mpdutype, Ptr event); /** @@ -164,8 +162,7 @@ virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback); virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback); - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble); - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype); + virtual void SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU); virtual void RegisterListener (WifiPhyListener *listener); virtual void UnregisterListener (WifiPhyListener *listener); virtual void SetSleepMode (void); @@ -185,10 +182,10 @@ * * \param packet the packet that the last bit has arrived * \param preamble the preamble of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ - void EndReceive (Ptr packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr event); + void EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event); /** * \param centerFrequency center frequency (MHz) diff -r f49a15537f57 src/wifi/model/sta-wifi-mac.h --- a/src/wifi/model/sta-wifi-mac.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/sta-wifi-mac.h Sun Nov 06 12:04:10 2016 +0100 @@ -170,7 +170,7 @@ * * \param value the new state */ - void SetState (enum MacState value); + void SetState (MacState value); /** * Set the EDCA parameters. * @@ -188,7 +188,7 @@ */ CapabilityInformation GetCapabilities (void) const; - enum MacState m_state; + MacState m_state; Time m_probeRequestTimeout; Time m_assocRequestTimeout; EventId m_probeRequestEvent; diff -r f49a15537f57 src/wifi/model/wifi-mac-header.cc --- a/src/wifi/model/wifi-mac-header.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac-header.cc Sun Nov 06 12:04:10 2016 +0100 @@ -177,7 +177,7 @@ } void -WifiMacHeader::SetType (enum WifiMacType type) +WifiMacHeader::SetType (WifiMacType type) { switch (type) { @@ -396,7 +396,7 @@ m_qosEosp = 0; } -void WifiMacHeader::SetQosAckPolicy (enum QosAckPolicy policy) +void WifiMacHeader::SetQosAckPolicy (QosAckPolicy policy) { switch (policy) { @@ -487,7 +487,7 @@ return m_addr4; } -enum WifiMacType +WifiMacType WifiMacHeader::GetType (void) const { switch (m_ctrlType) @@ -609,7 +609,7 @@ } // NOTREACHED NS_ASSERT (false); - return (enum WifiMacType) -1; + return (WifiMacType) - 1; } bool @@ -856,7 +856,7 @@ return m_qosTid; } -enum WifiMacHeader::QosAckPolicy +WifiMacHeader::QosAckPolicy WifiMacHeader::GetQosAckPolicy (void) const { switch (m_qosAckPolicy) @@ -876,7 +876,7 @@ } // NOTREACHED NS_ASSERT (false); - return (enum QosAckPolicy) -1; + return (QosAckPolicy) - 1; } uint8_t diff -r f49a15537f57 src/wifi/model/wifi-mac-header.h --- a/src/wifi/model/wifi-mac-header.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac-header.h Sun Nov 06 12:04:10 2016 +0100 @@ -200,7 +200,7 @@ * * \param type the WifiMacType for the header */ - void SetType (enum WifiMacType type); + void SetType (WifiMacType type); /** * Set the Duration/ID field with the given raw uint16_t value. * @@ -267,7 +267,7 @@ * * \param policy */ - void SetQosAckPolicy (enum QosAckPolicy policy); + void SetQosAckPolicy (QosAckPolicy policy); /** * Set the QoS ACK policy in the QoS control field to normal ACK. */ @@ -340,7 +340,7 @@ * * \return the type (enum WifiMacType) */ - enum WifiMacType GetType (void) const; + WifiMacType GetType (void) const; /** * \return true if From DS bit is set, false otherwise */ @@ -569,7 +569,7 @@ * * \return the QoS ACK Policy of a QoS header */ - enum QosAckPolicy GetQosAckPolicy (void) const; + QosAckPolicy GetQosAckPolicy (void) const; /** * Return the TXOP limit. * diff -r f49a15537f57 src/wifi/model/wifi-mac-queue.cc --- a/src/wifi/model/wifi-mac-queue.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac-queue.cc Sun Nov 06 12:04:10 2016 +0100 @@ -247,7 +247,7 @@ } Mac48Address -WifiMacQueue::GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it) +WifiMacQueue::GetAddressForPacket (WifiMacHeader::AddressType type, PacketQueueI it) { if (type == WifiMacHeader::ADDR1) { diff -r f49a15537f57 src/wifi/model/wifi-mac-queue.h --- a/src/wifi/model/wifi-mac-queue.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac-queue.h Sun Nov 06 12:04:10 2016 +0100 @@ -254,15 +254,15 @@ /** * typedef for packet (struct Item) queue. */ - typedef std::list PacketQueue; + typedef std::list PacketQueue; /** * typedef for packet (struct Item) queue reverse iterator. */ - typedef std::list::reverse_iterator PacketQueueRI; + typedef std::list::reverse_iterator PacketQueueRI; /** * typedef for packet (struct Item) queue iterator. */ - typedef std::list::iterator PacketQueueI; + typedef std::list::iterator PacketQueueI; /** * Return the appropriate address for the given packet (given by PacketQueue iterator). * @@ -271,13 +271,13 @@ * * \return the address */ - Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI it); + Mac48Address GetAddressForPacket (WifiMacHeader::AddressType type, PacketQueueI it); PacketQueue m_queue; //!< Packet (struct Item) queue uint32_t m_size; //!< Current queue size uint32_t m_maxSize; //!< Queue capacity Time m_maxDelay; //!< Time to live for packets in the queue - enum DropPolicy m_dropPolicy; //!< Drop behavior of queue + DropPolicy m_dropPolicy; //!< Drop behavior of queue }; } //namespace ns3 diff -r f49a15537f57 src/wifi/model/wifi-mac.cc --- a/src/wifi/model/wifi-mac.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac.cc Sun Nov 06 12:04:10 2016 +0100 @@ -287,7 +287,7 @@ } void -WifiMac::ConfigureStandard (enum WifiPhyStandard standard) +WifiMac::ConfigureStandard (WifiPhyStandard standard) { switch (standard) { @@ -408,7 +408,7 @@ } void -WifiMac::ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, enum AcIndex ac) +WifiMac::ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac) { /* see IEE802.11 section 7.3.2.29 */ switch (ac) diff -r f49a15537f57 src/wifi/model/wifi-mac.h --- a/src/wifi/model/wifi-mac.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mac.h Sun Nov 06 12:04:10 2016 +0100 @@ -300,7 +300,7 @@ * \sa WifiMac::Configure80211n_5Ghz * \sa WifiMac::Configure80211ac */ - void ConfigureStandard (enum WifiPhyStandard standard); + void ConfigureStandard (WifiPhyStandard standard); protected: @@ -313,7 +313,7 @@ * * Configure the DCF with appropriate values depending on the given access category. */ - void ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, enum AcIndex ac); + void ConfigureDcf (Ptr dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac); private: @@ -399,7 +399,7 @@ * implement this method to configure their dcf queues according to the * requested standard. */ - virtual void FinishConfigureStandard (enum WifiPhyStandard standard) = 0; + virtual void FinishConfigureStandard (WifiPhyStandard standard) = 0; Time m_maxPropagationDelay; diff -r f49a15537f57 src/wifi/model/wifi-mode.cc --- a/src/wifi/model/wifi-mode.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mode.cc Sun Nov 06 12:04:10 2016 +0100 @@ -110,7 +110,7 @@ { //TODO: nss > 4 not supported yet NS_ASSERT (nss <= 4); - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); uint64_t dataRate = 0; uint32_t usableSubCarriers = 0; double symbolRate = 0; @@ -233,10 +233,10 @@ return GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()); } -enum WifiCodeRate +WifiCodeRate WifiMode::GetCodeRate (void) const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); if (item->modClass == WIFI_MOD_CLASS_HT) { switch (item->mcsValue % 8) @@ -288,7 +288,7 @@ uint16_t WifiMode::GetConstellationSize (void) const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); if (item->modClass == WIFI_MOD_CLASS_HT) { switch (item->mcsValue % 8) @@ -342,21 +342,21 @@ WifiMode::GetUniqueName (void) const { //needed for ostream printing of the invalid mode - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); return item->uniqueUid; } bool WifiMode::IsMandatory (void) const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); return item->isMandatory; } uint8_t WifiMode::GetMcsValue (void) const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT) { return item->mcsValue; @@ -375,10 +375,10 @@ return m_uid; } -enum WifiModulationClass +WifiModulationClass WifiMode::GetModulationClass () const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); return item->modClass; } @@ -386,7 +386,7 @@ WifiMode::GetNonHtReferenceRate (void) const { uint64_t dataRate; - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLASS_VHT) { WifiCodeRate codeRate = GetCodeRate(); @@ -464,7 +464,7 @@ bool WifiMode::IsHigherDataRate (WifiMode mode) const { - struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); + WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); switch(item->modClass) { case WIFI_MOD_CLASS_DSSS: @@ -541,9 +541,9 @@ WifiMode WifiModeFactory::CreateWifiMode (std::string uniqueName, - enum WifiModulationClass modClass, + WifiModulationClass modClass, bool isMandatory, - enum WifiCodeRate codingRate, + WifiCodeRate codingRate, uint16_t constellationSize) { WifiModeFactory *factory = GetFactory (); @@ -580,7 +580,7 @@ WifiMode WifiModeFactory::CreateWifiMcs (std::string uniqueName, uint8_t mcsValue, - enum WifiModulationClass modClass) + WifiModulationClass modClass) { WifiModeFactory *factory = GetFactory (); uint32_t uid = factory->AllocateUid (uniqueName); @@ -653,7 +653,7 @@ return uid; } -struct WifiModeFactory::WifiModeItem * +WifiModeFactory::WifiModeItem * WifiModeFactory::Get (uint32_t uid) { NS_ASSERT (uid < m_itemList.size ()); diff -r f49a15537f57 src/wifi/model/wifi-mode.h --- a/src/wifi/model/wifi-mode.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-mode.h Sun Nov 06 12:04:10 2016 +0100 @@ -138,7 +138,7 @@ /** * \returns the coding rate of this transmission mode */ - enum WifiCodeRate GetCodeRate (void) const; + WifiCodeRate GetCodeRate (void) const; /** * \returns the size of the modulation constellation. */ @@ -170,7 +170,7 @@ * \returns the Modulation Class (Section 9.7.8 "Modulation classes"; IEEE 802.11-2012) * to which this WifiMode belongs. */ - enum WifiModulationClass GetModulationClass () const; + WifiModulationClass GetModulationClass () const; /** * \returns the rate (in bps) of the non-HT Reference Rate * which corresponds to the HT MCS of this WifiMode. @@ -263,9 +263,9 @@ * Create a WifiMode (not used for HT or VHT). */ static WifiMode CreateWifiMode (std::string uniqueName, - enum WifiModulationClass modClass, + WifiModulationClass modClass, bool isMandatory, - enum WifiCodeRate codingRate, + WifiCodeRate codingRate, uint16_t constellationSize); /** @@ -280,7 +280,7 @@ */ static WifiMode CreateWifiMcs (std::string uniqueName, uint8_t mcsValue, - enum WifiModulationClass modClass); + WifiModulationClass modClass); private: @@ -303,9 +303,9 @@ struct WifiModeItem { std::string uniqueUid; - enum WifiModulationClass modClass; + WifiModulationClass modClass; uint16_t constellationSize; - enum WifiCodeRate codingRate; + WifiCodeRate codingRate; bool isMandatory; uint8_t mcsValue; }; @@ -338,7 +338,7 @@ /** * typedef for a vector of WifiModeItem. */ - typedef std::vector WifiModeItemList; + typedef std::vector WifiModeItemList; WifiModeItemList m_itemList; }; diff -r f49a15537f57 src/wifi/model/wifi-net-device.cc --- a/src/wifi/model/wifi-net-device.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-net-device.cc Sun Nov 06 12:04:10 2016 +0100 @@ -358,7 +358,7 @@ { NS_LOG_FUNCTION (this << packet << from << to); LlcSnapHeader llc; - enum NetDevice::PacketType type; + NetDevice::PacketType type; if (to.IsBroadcast ()) { type = NetDevice::PACKET_BROADCAST; diff -r f49a15537f57 src/wifi/model/wifi-phy-state-helper.cc --- a/src/wifi/model/wifi-phy-state-helper.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy-state-helper.cc Sun Nov 06 12:04:10 2016 +0100 @@ -190,7 +190,7 @@ return m_startRx; } -enum WifiPhy::State +WifiPhy::State WifiPhyStateHelper::GetState (void) { if (m_sleeping) @@ -313,9 +313,9 @@ void WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr packet, double txPowerDbm, - WifiTxVector txVector, WifiPreamble preamble) + WifiTxVector txVector) { - m_txTrace (packet, txVector.GetMode (), preamble, txVector.GetTxPowerLevel ()); + m_txTrace (packet, txVector.GetMode (), txVector.GetPreambleType (), txVector.GetTxPowerLevel ()); Time now = Simulator::Now (); switch (GetState ()) { @@ -429,14 +429,14 @@ } void -WifiPhyStateHelper::SwitchFromRxEndOk (Ptr packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble) +WifiPhyStateHelper::SwitchFromRxEndOk (Ptr packet, double snr, WifiTxVector txVector) { - m_rxOkTrace (packet, snr, txVector.GetMode (), preamble); + m_rxOkTrace (packet, snr, txVector.GetMode (), txVector.GetPreambleType ()); NotifyRxEndOk (); DoSwitchFromRx (); if (!m_rxOkCallback.IsNull ()) { - m_rxOkCallback (packet, snr, txVector, preamble); + m_rxOkCallback (packet, snr, txVector); } } diff -r f49a15537f57 src/wifi/model/wifi-phy-state-helper.h --- a/src/wifi/model/wifi-phy-state-helper.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy-state-helper.h Sun Nov 06 12:04:10 2016 +0100 @@ -69,7 +69,7 @@ * * \return the current state of WifiPhy */ - enum WifiPhy::State GetState (void); + WifiPhy::State GetState (void); /** * Check whether the current state is CCA busy. * @@ -138,9 +138,8 @@ * \param packet the packet * \param txPowerDbm the nominal tx power in dBm * \param txVector the tx vector of the packet - * \param preamble the preamble of the packet */ - void SwitchToTx (Time txDuration, Ptr packet, double txPowerDbm, WifiTxVector txVector, WifiPreamble preamble); + void SwitchToTx (Time txDuration, Ptr packet, double txPowerDbm, WifiTxVector txVector); /** * Switch state to RX for the given duration. * @@ -159,9 +158,8 @@ * \param packet the successfully received packet * \param snr the SNR of the received packet * \param txVector TXVECTOR of the packet - * \param preamble the preamble of the received packet */ - void SwitchFromRxEndOk (Ptr packet, double snr, WifiTxVector txVector, enum WifiPreamble preamble); + void SwitchFromRxEndOk (Ptr packet, double snr, WifiTxVector txVector); /** * Switch from RX after the reception failed. * @@ -187,7 +185,7 @@ void SwitchFromSleep (Time duration); /** \todo Why is this public? */ - TracedCallback m_stateLogger; + TracedCallback m_stateLogger; /** * TracedCallback signature for state changes. @@ -306,9 +304,9 @@ Time m_previousStateChangeTime; Listeners m_listeners; - TracedCallback, double, WifiMode, enum WifiPreamble> m_rxOkTrace; + TracedCallback, double, WifiMode, WifiPreamble> m_rxOkTrace; TracedCallback, double> m_rxErrorTrace; - TracedCallback,WifiMode,WifiPreamble,uint8_t> m_txTrace; + TracedCallback, WifiMode, WifiPreamble, uint8_t> m_txTrace; WifiPhy::RxOkCallback m_rxOkCallback; WifiPhy::RxErrorCallback m_rxErrorCallback; }; diff -r f49a15537f57 src/wifi/model/wifi-phy-tag.cc --- a/src/wifi/model/wifi-phy-tag.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy-tag.cc Sun Nov 06 12:04:10 2016 +0100 @@ -39,49 +39,34 @@ uint32_t WifiPhyTag::GetSerializedSize (void) const { - return (4 + (6 * 1) + 4 + 2); + return (sizeof (WifiTxVector) + 2); } void WifiPhyTag::Serialize (TagBuffer i) const { - i.WriteU32 (m_wifiTxVector.GetMode ().GetUid ()); - i.WriteU8 (m_wifiTxVector.GetTxPowerLevel ()); - i.WriteU8 (m_wifiTxVector.GetRetries ()); - i.WriteU8 (m_wifiTxVector.IsShortGuardInterval ()); - i.WriteU8 (m_wifiTxVector.GetNss ()); - i.WriteU8 (m_wifiTxVector.GetNess ()); - i.WriteU8 (m_wifiTxVector.IsStbc ()); - i.WriteU32 (m_wifiPreamble); + i.Write ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector)); i.WriteU16 (m_mpduType); } void WifiPhyTag::Deserialize (TagBuffer i) { - m_wifiTxVector.SetMode (WifiMode (i.ReadU32 ())); - m_wifiTxVector.SetTxPowerLevel (i.ReadU8 ()); - m_wifiTxVector.SetRetries (i.ReadU8 ()); - m_wifiTxVector.SetShortGuardInterval (i.ReadU8 ()); - m_wifiTxVector.SetNss (i.ReadU8 ()); - m_wifiTxVector.SetNess (i.ReadU8 ()); - m_wifiTxVector.SetStbc (i.ReadU8 ()); - m_wifiPreamble = i.ReadU32 (); - m_mpduType = static_cast (i.ReadU16 ()); + i.Read ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector)); + m_mpduType = static_cast (i.ReadU16 ()); } void WifiPhyTag::Print (std::ostream &os) const { - os << m_wifiTxVector << " " << (m_wifiPreamble ? "SP " : "LP ") << m_mpduType; + os << m_wifiTxVector << " " << m_mpduType; } WifiPhyTag::WifiPhyTag () { } -WifiPhyTag::WifiPhyTag (WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype) +WifiPhyTag::WifiPhyTag (WifiTxVector txVector, MpduType mpdutype) : m_wifiTxVector (txVector), - m_wifiPreamble (preamble), m_mpduType (mpdutype) { } @@ -92,13 +77,7 @@ return m_wifiTxVector; } -WifiPreamble -WifiPhyTag::GetWifiPreamble (void) const -{ - return ((enum WifiPreamble) m_wifiPreamble); -} - -enum mpduType +MpduType WifiPhyTag::GetMpduType (void) const { return m_mpduType; diff -r f49a15537f57 src/wifi/model/wifi-phy-tag.h --- a/src/wifi/model/wifi-phy-tag.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy-tag.h Sun Nov 06 12:04:10 2016 +0100 @@ -22,7 +22,6 @@ #include #include -#include #include namespace ns3 { @@ -46,25 +45,19 @@ /** * Constructor * \param txVector the WifiTxVector - * \param preamble the WifiPreamble * \param mpduType the mpduType */ - WifiPhyTag (WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype); + WifiPhyTag (WifiTxVector txVector, MpduType mpdutype); /** * Getter for WifiTxVector parameter * \return the WifiTxVector */ WifiTxVector GetWifiTxVector (void) const; /** - * Getter for WifiPreamble parameter - * \return preamble the WifiPreamble - */ - WifiPreamble GetWifiPreamble (void) const; - /** * Getter for mpduType parameter * \return mpduType the mpduType */ - enum mpduType GetMpduType (void) const; + MpduType GetMpduType (void) const; // From class Tag virtual uint32_t GetSerializedSize (void) const; @@ -74,8 +67,7 @@ private: WifiTxVector m_wifiTxVector; - int32_t m_wifiPreamble; - enum mpduType m_mpduType; + MpduType m_mpduType; }; } // namespace ns3 diff -r f49a15537f57 src/wifi/model/wifi-phy.cc --- a/src/wifi/model/wifi-phy.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy.cc Sun Nov 06 12:04:10 2016 +0100 @@ -668,7 +668,7 @@ } void -WifiPhy::ConfigureDefaultsForStandard (enum WifiPhyStandard standard) +WifiPhy::ConfigureDefaultsForStandard (WifiPhyStandard standard) { NS_LOG_FUNCTION (this << standard); switch (standard) @@ -927,7 +927,7 @@ } bool -WifiPhy::DefineChannelNumber (uint16_t channelNumber, enum WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth) +WifiPhy::DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth) { NS_LOG_FUNCTION (this << channelNumber << standard << frequency << channelWidth); ChannelNumberStandardPair p = std::make_pair (channelNumber, standard); @@ -972,7 +972,7 @@ } void -WifiPhy::ConfigureChannelForStandard (enum WifiPhyStandard standard) +WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard) { NS_LOG_FUNCTION (this << standard); // If the user has configured both Frequency and ChannelNumber, Frequency @@ -1023,7 +1023,7 @@ } void -WifiPhy::ConfigureStandard (enum WifiPhyStandard standard) +WifiPhy::ConfigureStandard (WifiPhyStandard standard) { NS_LOG_FUNCTION (this << standard); m_standard = standard; @@ -1076,7 +1076,7 @@ } } -enum WifiPhyStandard +WifiPhyStandard WifiPhy::GetStandard (void) const { return m_standard; @@ -1264,7 +1264,7 @@ } WifiPhy::FrequencyWidthPair -WifiPhy::GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, enum WifiPhyStandard standard) const +WifiPhy::GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, WifiPhyStandard standard) const { ChannelNumberStandardPair p = std::make_pair (channelNumber, standard); FrequencyWidthPair f = m_channelToFrequencyWidth[p]; @@ -1356,7 +1356,7 @@ } Time -WifiPhy::GetPlcpHtTrainingSymbolDuration (WifiPreamble preamble, WifiTxVector txVector) +WifiPhy::GetPlcpHtTrainingSymbolDuration (WifiTxVector txVector) { uint8_t Ndltf, Neltf; //We suppose here that STBC = 0. @@ -1387,7 +1387,7 @@ Neltf = 4; } - switch (preamble) + switch (txVector.GetPreambleType ()) { case WIFI_PREAMBLE_HT_MF: return MicroSeconds (4 + (4 * Ndltf) + (4 * Neltf)); @@ -1459,9 +1459,9 @@ } WifiMode -WifiPhy::GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector) +WifiPhy::GetPlcpHeaderMode (WifiTxVector txVector) { - switch (payloadMode.GetModulationClass ()) + switch (txVector.GetMode ().GetModulationClass ()) { case WIFI_MOD_CLASS_OFDM: case WIFI_MOD_CLASS_HT: @@ -1487,7 +1487,7 @@ return WifiPhy::GetErpOfdmRate6Mbps (); case WIFI_MOD_CLASS_DSSS: case WIFI_MOD_CLASS_HR_DSSS: - if (preamble == WIFI_PREAMBLE_LONG || payloadMode == WifiPhy::GetDsssRate1Mbps ()) + if (txVector.GetPreambleType () == WIFI_PREAMBLE_LONG || txVector.GetMode () == WifiPhy::GetDsssRate1Mbps ()) { //(Section 16.2.3 "PLCP field definitions" and Section 17.2.2.2 "Long PPDU format"; IEEE Std 802.11-2012) return WifiPhy::GetDsssRate1Mbps (); @@ -1504,8 +1504,9 @@ } Time -WifiPhy::GetPlcpHeaderDuration (WifiTxVector txVector, WifiPreamble preamble) +WifiPhy::GetPlcpHeaderDuration (WifiTxVector txVector) { + WifiPreamble preamble = txVector.GetPreambleType (); if (preamble == WIFI_PREAMBLE_NONE) { return MicroSeconds (0); @@ -1568,8 +1569,9 @@ } Time -WifiPhy::GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble) +WifiPhy::GetPlcpPreambleDuration (WifiTxVector txVector) { + WifiPreamble preamble = txVector.GetPreambleType (); if (preamble == WIFI_PREAMBLE_NONE) { return MicroSeconds (0); @@ -1620,15 +1622,16 @@ } Time -WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency) +WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency) { - return GetPayloadDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0); + return GetPayloadDuration (size, txVector, frequency, NORMAL_MPDU, 0); } Time -WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag) +WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag) { WifiMode payloadMode = txVector.GetMode (); + WifiPreamble preamble = txVector.GetPreambleType (); NS_LOG_FUNCTION (size << payloadMode); switch (payloadMode.GetModulationClass ()) @@ -1699,7 +1702,7 @@ } else { - NS_FATAL_ERROR ("Wrong combination of preamble and packet type"); + NS_FATAL_ERROR ("Wrong combination of preamble and packet type: preamble=" << preamble << ", packet type=" << mpdutype); } //Add signal extension for ERP PHY @@ -1918,30 +1921,31 @@ } Time -WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector, WifiPreamble preamble) +WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector) { - Time duration = GetPlcpPreambleDuration (txVector, preamble) - + GetPlcpHeaderDuration (txVector, preamble) + WifiPreamble preamble = txVector.GetPreambleType(); + Time duration = GetPlcpPreambleDuration (txVector) + + GetPlcpHeaderDuration (txVector) + GetPlcpHtSigHeaderDuration (preamble) + GetPlcpVhtSigA1Duration (preamble) + GetPlcpVhtSigA2Duration (preamble) - + GetPlcpHtTrainingSymbolDuration (preamble, txVector) + + GetPlcpHtTrainingSymbolDuration (txVector) + GetPlcpVhtSigBDuration (preamble); return duration; } Time -WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag) +WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag) { - Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble) - + GetPayloadDuration (size, txVector, preamble, frequency, mpdutype, incFlag); + Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector) + + GetPayloadDuration (size, txVector, frequency, mpdutype, incFlag); return duration; } Time -WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency) +WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency) { - return CalculateTxDuration (size, txVector, preamble, frequency, NORMAL_MPDU, 0); + return CalculateTxDuration (size, txVector, frequency, NORMAL_MPDU, 0); } void @@ -1981,15 +1985,15 @@ } void -WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise) +WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise) { - m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu, signalNoise); + m_phyMonitorSniffRxTrace (packet, channelFreqMhz, channelNumber, txVector, aMpdu, signalNoise); } void -WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu) +WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, uint16_t channelNumber, WifiTxVector txVector, MpduInfo aMpdu) { - m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu); + m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, txVector, aMpdu); } @@ -2981,7 +2985,7 @@ return 1; } -std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state) +std::ostream& operator<< (std::ostream& os, WifiPhy::State state) { switch (state) { diff -r f49a15537f57 src/wifi/model/wifi-phy.h --- a/src/wifi/model/wifi-phy.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-phy.h Sun Nov 06 12:04:10 2016 +0100 @@ -53,7 +53,7 @@ /** * This enumeration defines the type of an MPDU. */ -enum mpduType +enum MpduType { /** The MPDU is not part of an A-MPDU */ NORMAL_MPDU = 0, @@ -63,15 +63,15 @@ LAST_MPDU_IN_AGGREGATE }; -struct signalNoiseDbm +struct SignalNoiseDbm { double signal; //in dBm double noise; //in dBm }; -struct mpduInfo +struct MpduInfo { - enum mpduType type; + MpduType type; uint32_t mpduRefNumber; }; @@ -199,7 +199,7 @@ * arg3: TXVECTOR of packet * arg4: type of preamble used for packet. */ - typedef Callback, double, WifiTxVector, enum WifiPreamble> RxOkCallback; + typedef Callback, double, WifiTxVector> RxOkCallback; /** * arg1: packet received unsuccessfully * arg2: snr of packet @@ -227,18 +227,9 @@ * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send * this packet, and txPowerLevel, a power level to use to send this packet. The real transmission * power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels - * \param preamble the type of preamble to use to send this packet. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. */ - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble) = 0; - /** - * \param packet the packet to send - * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send - * this packet, and txPowerLevel, a power level to use to send this packet. The real transmission - * power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels - * \param preamble the type of preamble to use to send this packet. - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. - */ - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype) = 0; + virtual void SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU) = 0; /** * \param listener the new listener @@ -314,39 +305,35 @@ /** * \param size the number of bytes in the packet to send * \param txVector the TXVECTOR used for the transmission of this packet - * \param preamble the type of preamble to use for this packet. * \param frequency the channel center frequency (MHz) * * \return the total amount of time this PHY will stay busy for the transmission of these bytes. */ - Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency); + Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency); /** * \param size the number of bytes in the packet to send * \param txVector the TXVECTOR used for the transmission of this packet - * \param preamble the type of preamble to use for this packet. * \param frequency the channel center frequency (MHz) - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time. * * \return the total amount of time this PHY will stay busy for the transmission of these bytes. */ - Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag); + Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag); /** * \param txVector the transmission parameters used for this packet - * \param preamble the type of preamble to use for this packet. * * \return the total amount of time this PHY will stay busy for the transmission of the PLCP preamble and PLCP header. */ - Time CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector, enum WifiPreamble preamble); + Time CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector); /** - * \param preamble the type of preamble * \param txVector the transmission parameters used for this packet * * \return the training symbol duration */ - static Time GetPlcpHtTrainingSymbolDuration (WifiPreamble preamble, WifiTxVector txVector); + static Time GetPlcpHtTrainingSymbolDuration (WifiTxVector txVector); /** * \param payloadMode the WifiMode use for the transmission of the payload * @@ -385,47 +372,41 @@ */ static Time GetPlcpVhtSigBDuration (WifiPreamble preamble); /** - * \param payloadMode the WifiMode use for the transmission of the payload - * \param preamble the type of preamble * \param txVector the transmission parameters used for this packet * * \return the WifiMode used for the transmission of the PLCP header */ - static WifiMode GetPlcpHeaderMode (WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector); + static WifiMode GetPlcpHeaderMode (WifiTxVector txVector); /** * \param txVector the transmission parameters used for this packet - * \param preamble the type of preamble * * \return the duration of the PLCP header */ - static Time GetPlcpHeaderDuration (WifiTxVector txVector, WifiPreamble preamble); + static Time GetPlcpHeaderDuration (WifiTxVector txVector); /** * \param txVector the transmission parameters used for this packet - * \param preamble the type of preamble * * \return the duration of the PLCP preamble */ - static Time GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble); + static Time GetPlcpPreambleDuration (WifiTxVector txVector); /** * \param size the number of bytes in the packet to send * \param txVector the TXVECTOR used for the transmission of this packet - * \param preamble the type of preamble to use for this packet * \param frequency the channel center frequency (MHz) * * \return the duration of the payload */ - Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency); + Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency); /** * \param size the number of bytes in the packet to send * \param txVector the TXVECTOR used for the transmission of this packet - * \param preamble the type of preamble to use for this packet * \param frequency the channel center frequency (MHz) - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time * * \return the duration of the payload */ - Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag); + Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, double frequency, MpduType mpdutype, uint8_t incFlag); /** * The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used @@ -581,14 +562,14 @@ * * \param standard the Wi-Fi standard */ - virtual void ConfigureStandard (enum WifiPhyStandard standard); + virtual void ConfigureStandard (WifiPhyStandard standard); /** * Get the configured Wi-Fi standard * * \return the Wi-Fi standard that has been configured */ - virtual enum WifiPhyStandard GetStandard (void) const; + virtual WifiPhyStandard GetStandard (void) const; /** * Add a channel definition to the WifiPhy. The pair (channelNumber, @@ -605,12 +586,12 @@ * * \return true if the channel definition succeeded */ - bool DefineChannelNumber (uint16_t channelNumber, enum WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth); + bool DefineChannelNumber (uint16_t channelNumber, WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth); /** * A pair of a ChannelNumber and WifiPhyStandard */ - typedef std::pair ChannelNumberStandardPair; + typedef std::pair ChannelNumberStandardPair; /** * A pair of a center Frequency and a ChannelWidth */ @@ -1159,17 +1140,17 @@ * tuned on a given channel and still to be able to receive packets * on a nearby channel. * \param channelNumber the channel on which the packet is received - * \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 preamble the preamble of the packet * \param txVector the TXVECTOR that holds rx parameters * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) * \param signalNoise signal power and noise power in dBm */ - void NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, - WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise); + void NotifyMonitorSniffRx (Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + WifiTxVector txVector, + MpduInfo aMpdu, + SignalNoiseDbm signalNoise); /** * TracedCallback signature for monitor mode receive events. @@ -1184,9 +1165,6 @@ * tuned on a given channel and still to be able to receive packets * on a nearby channel. * \param channelNumber the channel on which the packet is received - * \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 preamble the preamble of the packet * \param txVector the TXVECTOR that holds rx parameters * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) @@ -1194,9 +1172,12 @@ * \todo WifiTxVector should be passed by const reference because * of its size. */ - typedef void (* MonitorSnifferRxCallback)(Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, - WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise); + typedef void (* MonitorSnifferRxCallback)(Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + WifiTxVector txVector, + MpduInfo aMpdu, + SignalNoiseDbm signalNoise); /** * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted. @@ -1206,16 +1187,15 @@ * \param channelFreqMhz the frequency in MHz at which the packet is * transmitted. * \param channelNumber the channel on which the packet is transmitted - * \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 preamble the preamble of the packet * \param txVector the TXVECTOR that holds tx parameters * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) */ - void NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, - WifiTxVector txVector, struct mpduInfo aMpdu); + void NotifyMonitorSniffTx (Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + WifiTxVector txVector, + MpduInfo aMpdu); /** * TracedCallback signature for monitor mode transmit events. @@ -1224,18 +1204,17 @@ * \param channelFreqMhz the frequency in MHz at which the packet is * transmitted. * \param channelNumber the channel on which the packet is transmitted - * \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 preamble the preamble of the packet * \param txVector the TXVECTOR that holds tx parameters * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) * \todo WifiTxVector should be passed by const reference because * of its size. */ - typedef void (* MonitorSnifferTxCallback)(const Ptr packet, uint16_t channelFreqMhz, - uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, - WifiTxVector txVector, struct mpduInfo aMpdu); + typedef void (* MonitorSnifferTxCallback)(const Ptr packet, + uint16_t channelFreqMhz, + uint16_t channelNumber, + WifiTxVector txVector, + MpduInfo aMpdu); /** * Assign a fixed random variable stream number to the random variables @@ -1660,7 +1639,7 @@ * * \param standard the Wi-Fi standard */ - virtual void ConfigureDefaultsForStandard (enum WifiPhyStandard standard); + virtual void ConfigureDefaultsForStandard (WifiPhyStandard standard); /** * Configure the PHY-level parameters for different Wi-Fi standard. * This method is called when the Frequency or ChannelNumber attributes @@ -1669,7 +1648,7 @@ * * \param standard the Wi-Fi standard */ - virtual void ConfigureChannelForStandard (enum WifiPhyStandard standard); + virtual void ConfigureChannelForStandard (WifiPhyStandard standard); /** * Look for channel number matching the frequency and width @@ -1684,7 +1663,7 @@ * \param standard The WifiPhyStandard to check * \return the FrequencyWidthPair found */ - FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, enum WifiPhyStandard standard) const; + FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint16_t channelNumber, WifiPhyStandard standard) const; /** * The trace source fired when a packet begins the transmission process on @@ -1745,8 +1724,7 @@ * \todo WifiTxVector and signalNoiseDbm should be be passed as * const references because of their sizes. */ - TracedCallback, uint16_t, uint16_t, uint32_t, - WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace; + TracedCallback, uint16_t, uint16_t, WifiTxVector, MpduInfo, SignalNoiseDbm> m_phyMonitorSniffRxTrace; /** * A trace source that emulates a wifi device in monitor mode @@ -1760,8 +1738,7 @@ * \todo WifiTxVector should be passed by const reference because * of its size. */ - TracedCallback, uint16_t, uint16_t, uint32_t, - WifiPreamble, WifiTxVector, struct mpduInfo> m_phyMonitorSniffTxTrace; + TracedCallback, uint16_t, uint16_t, WifiTxVector, MpduInfo> m_phyMonitorSniffTxTrace; /** * This vector holds the set of transmission modes that this @@ -1804,7 +1781,7 @@ std::vector m_bssMembershipSelectorSet; - enum WifiPhyStandard m_standard; //!< WifiPhyStandard + WifiPhyStandard m_standard; //!< WifiPhyStandard bool m_isConstructed; //!< true when ready to set frequency uint32_t m_channelCenterFrequency; //!< Center frequency in MHz uint32_t m_initialFrequency; //!< Store frequency until initialization @@ -1848,7 +1825,7 @@ * \param state wifi state to stringify * \return output stream */ -std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state); +std::ostream& operator<< (std::ostream& os, WifiPhy::State state); } //namespace ns3 diff -r f49a15537f57 src/wifi/model/wifi-remote-station-manager.cc --- a/src/wifi/model/wifi-remote-station-manager.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-remote-station-manager.cc Sun Nov 06 12:04:10 2016 +0100 @@ -719,6 +719,7 @@ { WifiTxVector v; v.SetMode (GetNonUnicastMode ()); + v.SetPreambleType (GetPreambleForTransmission (GetNonUnicastMode (), address)); v.SetTxPowerLevel (m_defaultTxPowerLevel); v.SetChannelWidth (m_wifiPhy->GetChannelWidth ()); v.SetShortGuardInterval (m_wifiPhy->GetGuardInterval ()); @@ -763,9 +764,25 @@ WifiTxVector WifiRemoteStationManager::DoGetCtsToSelfTxVector (void) { - return WifiTxVector (GetDefaultMode (), + WifiMode defaultMode = GetDefaultMode (); + WifiPreamble defaultPreamble; + if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_VHT) + { + defaultPreamble = WIFI_PREAMBLE_VHT; + } + else if (defaultMode.GetModulationClass () == WIFI_MOD_CLASS_HT) + { + defaultPreamble = WIFI_PREAMBLE_HT_MF; + } + else + { + defaultPreamble = WIFI_PREAMBLE_LONG; + } + + return WifiTxVector (defaultMode, GetDefaultTxPowerLevel (), 0, + defaultPreamble, m_wifiPhy->GetChannelWidth (), m_wifiPhy->GetGuardInterval (), GetNumberOfTransmitAntennas (), @@ -1118,7 +1135,7 @@ } bool -WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (enum WifiModulationClass modClassReq, enum WifiModulationClass modClassAnswer) const +WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (WifiModulationClass modClassReq, WifiModulationClass modClassAnswer) const { switch (modClassReq) { @@ -1285,14 +1302,16 @@ WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode) { NS_ASSERT (!address.IsGroup ()); + WifiMode ctsMode = GetControlAnswerMode (address, rtsMode); WifiTxVector v; - v.SetMode (GetControlAnswerMode (address, rtsMode)); - v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, v.GetMode ())); - v.SetChannelWidth (DoGetCtsTxChannelWidth (address, v.GetMode ())); - v.SetShortGuardInterval (DoGetCtsTxGuardInterval (address, v.GetMode ())); - v.SetNss (DoGetCtsTxNss (address, v.GetMode ())); - v.SetNess (DoGetCtsTxNess (address, v.GetMode ())); - v.SetStbc (DoGetCtsTxStbc (address, v.GetMode ())); + v.SetMode (ctsMode); + v.SetPreambleType (GetPreambleForTransmission (ctsMode, address)); + v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode)); + v.SetChannelWidth (DoGetCtsTxChannelWidth (address, ctsMode)); + v.SetShortGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode)); + v.SetNss (DoGetCtsTxNss (address, ctsMode)); + v.SetNess (DoGetCtsTxNess (address, ctsMode)); + v.SetStbc (DoGetCtsTxStbc (address, ctsMode)); return v; } @@ -1300,14 +1319,16 @@ WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode) { NS_ASSERT (!address.IsGroup ()); + WifiMode ackMode = GetControlAnswerMode (address, dataMode); WifiTxVector v; - v.SetMode (GetControlAnswerMode (address, dataMode)); - v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, v.GetMode ())); - v.SetChannelWidth (DoGetAckTxChannelWidth (address, v.GetMode ())); - v.SetShortGuardInterval (DoGetAckTxGuardInterval (address, v.GetMode ())); - v.SetNss (DoGetAckTxNss (address, v.GetMode ())); - v.SetNess (DoGetAckTxNess (address, v.GetMode ())); - v.SetStbc (DoGetAckTxStbc (address, v.GetMode ())); + v.SetMode (ackMode); + v.SetPreambleType (GetPreambleForTransmission (ackMode, address)); + v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode)); + v.SetChannelWidth (DoGetAckTxChannelWidth (address, ackMode)); + v.SetShortGuardInterval (DoGetAckTxGuardInterval (address, ackMode)); + v.SetNss (DoGetAckTxNss (address, ackMode)); + v.SetNess (DoGetAckTxNess (address, ackMode)); + v.SetStbc (DoGetAckTxStbc (address, ackMode)); return v; } @@ -1315,14 +1336,16 @@ WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode) { NS_ASSERT (!address.IsGroup ()); + WifiMode blockAckMode = GetControlAnswerMode (address, blockAckReqMode); WifiTxVector v; - v.SetMode (GetControlAnswerMode (address, blockAckReqMode)); - v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, v.GetMode ())); - v.SetChannelWidth (DoGetBlockAckTxChannelWidth (address, v.GetMode ())); - v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval (address, v.GetMode ())); - v.SetNss (DoGetBlockAckTxNss (address, v.GetMode ())); - v.SetNess (DoGetBlockAckTxNess (address, v.GetMode ())); - v.SetStbc (DoGetBlockAckTxStbc (address, v.GetMode ())); + v.SetMode (blockAckMode); + v.SetPreambleType (GetPreambleForTransmission (blockAckMode, address)); + v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode)); + v.SetChannelWidth (DoGetBlockAckTxChannelWidth (address, blockAckMode)); + v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode)); + v.SetNss (DoGetBlockAckTxNss (address, blockAckMode)); + v.SetNess (DoGetBlockAckTxNess (address, blockAckMode)); + v.SetStbc (DoGetBlockAckTxStbc (address, blockAckMode)); return v; } @@ -1782,6 +1805,12 @@ return station->m_state->m_operationalRateSet[index]; } +Mac48Address +WifiRemoteStationManager::GetAddress (const WifiRemoteStation *station) const +{ + return station->m_state->m_address; +} + uint32_t WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const { @@ -1899,6 +1928,40 @@ return m_wifiPhy->GetNumberOfTransmitAntennas (); } +WifiPreamble +WifiRemoteStationManager::GetPreambleForTransmission (WifiMode mode, Mac48Address dest) +{ + NS_LOG_FUNCTION (this << mode << dest); + WifiPreamble preamble; + if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT) + { + preamble = WIFI_PREAMBLE_VHT; + } + else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT && m_wifiPhy->GetGreenfield () && GetGreenfieldSupported (dest)) + { + preamble = WIFI_PREAMBLE_HT_GF; + } + else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT) + { + preamble = WIFI_PREAMBLE_HT_MF; + } + else if (GetShortPreambleEnabled ()) + { + preamble = WIFI_PREAMBLE_SHORT; + } + else + { + preamble = WIFI_PREAMBLE_LONG; + } + NS_LOG_FUNCTION ("selected preamble=" << preamble); + return preamble; +} + +WifiRemoteStation::~WifiRemoteStation () +{ + NS_LOG_FUNCTION (this); +} + WifiRemoteStationInfo::WifiRemoteStationInfo () : m_memoryTime (Seconds (1.0)), m_lastUpdate (Seconds (0.0)), @@ -1935,9 +1998,4 @@ return m_failAvg; } -WifiRemoteStation::~WifiRemoteStation () -{ - NS_LOG_FUNCTION (this); -} - } //namespace ns3 diff -r f49a15537f57 src/wifi/model/wifi-remote-station-manager.h --- a/src/wifi/model/wifi-remote-station-manager.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-remote-station-manager.h Sun Nov 06 12:04:10 2016 +0100 @@ -751,7 +751,6 @@ typedef void (*RateChangeTracedCallback)(uint32_t rate, Mac48Address remoteAddress); - protected: virtual void DoDispose (void); /** @@ -825,6 +824,14 @@ */ uint32_t GetNNonErpSupported (const WifiRemoteStation *station) const; /** + * Return the address of the station. + * + * \param station the station being queried + * + * \return the address of the station + */ + Mac48Address GetAddress (const WifiRemoteStation *station) const; + /** * Return the channel width supported by the station. * * \param station the station being queried @@ -901,6 +908,15 @@ * \return the short retry limit of the the station */ uint32_t GetShortRetryCount (const WifiRemoteStation *station) const; + /** + * Return the preamble to be used for the transmission. + * + * \param mode the mode selected for the transmission + * \param dest address of the recipient + * + * \return the preamble to be used for the transmission + */ + WifiPreamble GetPreambleForTransmission (WifiMode mode, Mac48Address dest); /** * Return the WifiPhy. @@ -1150,7 +1166,7 @@ * \return true if the modulation class of the selected mode for the * control answer frame is allowed, false otherwise */ - bool IsAllowedControlAnswerModulationClass (enum WifiModulationClass modClassReq, enum WifiModulationClass modClassAnswer) const; + bool IsAllowedControlAnswerModulationClass (WifiModulationClass modClassReq, WifiModulationClass modClassAnswer) const; WifiMode GetControlAnswerMode (Mac48Address address, WifiMode reqMode); diff -r f49a15537f57 src/wifi/model/wifi-tx-vector.cc --- a/src/wifi/model/wifi-tx-vector.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-tx-vector.cc Sun Nov 06 12:04:10 2016 +0100 @@ -26,6 +26,7 @@ WifiTxVector::WifiTxVector () : m_retries (0), + m_preamble (WIFI_PREAMBLE_NONE), m_channelWidth (20), m_shortGuardInterval (false), m_nss (1), @@ -37,12 +38,20 @@ { } -WifiTxVector::WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, - bool shortGuardInterval, uint8_t nss, uint8_t ness, - uint32_t channelWidth, bool aggregation, bool stbc) +WifiTxVector::WifiTxVector (WifiMode mode, + uint8_t powerLevel, + uint8_t retries, + WifiPreamble preamble, + bool shortGuardInterval, + uint8_t nss, + uint8_t ness, + uint32_t channelWidth, + bool aggregation, + bool stbc) : m_mode (mode), m_txPowerLevel (powerLevel), m_retries (retries), + m_preamble (preamble), m_channelWidth (channelWidth), m_shortGuardInterval (shortGuardInterval), m_nss (nss), @@ -80,6 +89,12 @@ return m_retries; } +WifiPreamble +WifiTxVector::GetPreambleType (void) const +{ + return m_preamble; +} + uint32_t WifiTxVector::GetChannelWidth (void) const { @@ -137,6 +152,12 @@ } void +WifiTxVector::SetPreambleType (WifiPreamble preamble) +{ + m_preamble = preamble; +} + +void WifiTxVector::SetChannelWidth (uint32_t channelWidth) { m_channelWidth = channelWidth; @@ -177,6 +198,7 @@ os << "mode: " << v.GetMode () << " txpwrlvl: " << (uint32_t)v.GetTxPowerLevel () << " retries: " << (uint32_t)v.GetRetries () << + " preamble: " << v.GetPreambleType () << " channel width: " << v.GetChannelWidth () << " Short GI: " << v.IsShortGuardInterval () << " Nss: " << (uint32_t)v.GetNss () << diff -r f49a15537f57 src/wifi/model/wifi-tx-vector.h --- a/src/wifi/model/wifi-tx-vector.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/wifi-tx-vector.h Sun Nov 06 12:04:10 2016 +0100 @@ -23,6 +23,7 @@ #define WIFI_TX_VECTOR_H #include +#include #include namespace ns3 { @@ -68,6 +69,7 @@ * \param mode WifiMode * \param powerLevel transmission power level * \param retries retries + * \param preamble preamble type * \param shortGuardInterval enable or disable short guard interval * \param nss the number of spatial STBC streams (NSS) * \param ness the number of extension spatial streams (NESS) @@ -78,6 +80,7 @@ WifiTxVector (WifiMode mode, uint8_t powerLevel, uint8_t retries, + WifiPreamble preamble, bool shortGuardInterval, uint8_t nss, uint8_t ness, @@ -115,6 +118,16 @@ */ void SetRetries (uint8_t retries); /** + * \returns the preamble type + */ + WifiPreamble GetPreambleType (void) const; + /** + * Sets the preamble type + * + * \param preamble + */ + void SetPreambleType (WifiPreamble preamble); + /** * \returns the channel width (in MHz) */ uint32_t GetChannelWidth (void) const; @@ -190,6 +203,7 @@ to PMD_TXPWRLVL.request */ uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter for Click radiotap information */ + WifiPreamble m_preamble; /** preamble */ uint32_t m_channelWidth; /**< channel width in MHz */ bool m_shortGuardInterval; /**< true if short GI is going to be used */ uint8_t m_nss; /**< number of streams */ diff -r f49a15537f57 src/wifi/model/yans-wifi-phy.cc --- a/src/wifi/model/yans-wifi-phy.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/yans-wifi-phy.cc Sun Nov 06 12:04:10 2016 +0100 @@ -287,14 +287,13 @@ return; } - enum WifiPreamble preamble = tag.GetWifiPreamble (); - enum mpduType mpdutype = tag.GetMpduType (); - Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble); + WifiPreamble preamble = txVector.GetPreambleType (); + MpduType mpdutype = tag.GetMpduType (); + Time preambleAndHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector); Ptr event; event = m_interference.Add (packet->GetSize (), txVector, - preamble, rxDuration, rxPowerW); @@ -394,7 +393,7 @@ { NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this, - packet, txVector, preamble, mpdutype, event); + packet, txVector, mpdutype, event); } NS_ASSERT (m_endRxEvent.IsExpired ()); @@ -435,16 +434,15 @@ void YansWifiPhy::StartReceivePacket (Ptr packet, WifiTxVector txVector, - enum WifiPreamble preamble, - enum mpduType mpdutype, + MpduType mpdutype, Ptr event) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)mpdutype); + NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << (uint32_t)mpdutype); NS_ASSERT (IsStateRx ()); NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); WifiMode txMode = txVector.GetMode (); - struct InterferenceHelper::SnrPer snrPer; + InterferenceHelper::SnrPer snrPer; snrPer = m_interference.CalculatePlcpHeaderSnrPer (event); NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per); @@ -472,17 +470,11 @@ } void -YansWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPreamble preamble) -{ - SendPacket (packet, txVector, preamble, NORMAL_MPDU); -} - -void -YansWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype) +YansWifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype) { NS_LOG_FUNCTION (this << packet << txVector.GetMode () - << txVector.GetMode ().GetDataRate (txVector) - << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype); + << txVector.GetMode ().GetDataRate (txVector) << txVector.GetPreambleType () + << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype); /* Transmission can happen if: * - we are syncing on a packet. It is the responsability of the * MAC layer to avoid doing this but the PHY does nothing to @@ -503,7 +495,7 @@ return; } - Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), mpdutype, 1); + Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency (), mpdutype, 1); NS_ASSERT (txDuration > NanoSeconds (0)); if (m_state->IsStateRx ()) @@ -513,30 +505,21 @@ m_interference.NotifyRxEnd (); } NotifyTxBegin (packet); - uint32_t dataRate500KbpsUnits; - if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) - { - dataRate500KbpsUnits = 128 + txVector.GetMode ().GetMcsValue (); - } - else - { - dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000; - } - if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE) + if ((mpdutype == MPDU_IN_AGGREGATE) && (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE)) { //send the first MPDU in an MPDU m_txMpduReferenceNumber++; } - struct mpduInfo aMpdu; + MpduInfo aMpdu; aMpdu.type = mpdutype; aMpdu.mpduRefNumber = m_txMpduReferenceNumber; - NotifyMonitorSniffTx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu); - m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble); + NotifyMonitorSniffTx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), txVector, aMpdu); + m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector); Ptr newPacket = packet->Copy (); // obtain non-const Packet WifiPhyTag oldtag; newPacket->RemovePacketTag (oldtag); - WifiPhyTag tag (txVector, preamble, mpdutype); + WifiPhyTag tag (txVector, mpdutype); newPacket->AddPacketTag (tag); m_channel->Send (this, newPacket, GetPowerDbm (txVector.GetTxPowerLevel ()) + GetTxGain (), txDuration); } @@ -554,13 +537,13 @@ } void -YansWifiPhy::EndReceive (Ptr packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr event) +YansWifiPhy::EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event) { NS_LOG_FUNCTION (this << packet << event); NS_ASSERT (IsStateRx ()); NS_ASSERT (event->GetEndTime () == Simulator::Now ()); - struct InterferenceHelper::SnrPer snrPer; + InterferenceHelper::SnrPer snrPer; snrPer = m_interference.CalculatePlcpPayloadSnrPer (event); m_interference.NotifyRxEnd (); @@ -572,23 +555,14 @@ if (m_random->GetValue () > snrPer.per) { NotifyRxEnd (packet); - uint32_t dataRate500KbpsUnits; - if ((event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) || (event->GetPayloadMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)) - { - dataRate500KbpsUnits = 128 + event->GetPayloadMode ().GetMcsValue (); - } - else - { - dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate (event->GetTxVector ().GetChannelWidth (), event->GetTxVector ().IsShortGuardInterval (), 1) * event->GetTxVector ().GetNss () / 500000; - } - struct signalNoiseDbm signalNoise; + SignalNoiseDbm signalNoise; signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30; signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30; - struct mpduInfo aMpdu; + MpduInfo aMpdu; aMpdu.type = mpdutype; aMpdu.mpduRefNumber = m_rxMpduReferenceNumber; - NotifyMonitorSniffRx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise); - m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ()); + NotifyMonitorSniffRx (packet, (uint16_t)GetFrequency (), GetChannelNumber (), event->GetTxVector (), aMpdu, signalNoise); + m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ()); } else { diff -r f49a15537f57 src/wifi/model/yans-wifi-phy.h --- a/src/wifi/model/yans-wifi-phy.h Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/model/yans-wifi-phy.h Sun Nov 06 12:04:10 2016 +0100 @@ -74,20 +74,17 @@ * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param preamble the preamble of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ void StartReceivePacket (Ptr packet, WifiTxVector txVector, - WifiPreamble preamble, - enum mpduType mpdutype, + MpduType mpdutype, Ptr event); virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback); virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback); - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble); - virtual void SendPacket (Ptr packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype); + virtual void SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU); virtual void RegisterListener (WifiPhyListener *listener); virtual void UnregisterListener (WifiPhyListener *listener); virtual void SetSleepMode (void); @@ -106,12 +103,12 @@ * * \param packet the packet that the last bit has arrived * \param preamble the preamble of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType. + * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ - void EndReceive (Ptr packet, enum WifiPreamble preamble, enum mpduType mpdutype, Ptr event); + void EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event); - Ptr m_channel; //!< YansWifiChannel that this YansWifiPhy is connected to + Ptr m_channel; //!< YansWifiChannel that this YansWifiPhy is connected to }; } //namespace ns3 diff -r f49a15537f57 src/wifi/test/spectrum-wifi-phy-test.cc --- a/src/wifi/test/spectrum-wifi-phy-test.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/test/spectrum-wifi-phy-test.cc Sun Nov 06 12:04:10 2016 +0100 @@ -70,11 +70,8 @@ Ptr SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts) { - WifiPreamble preamble; - preamble = WIFI_PREAMBLE_LONG; - WifiMode mode = WifiPhy::GetOfdmRate6Mbps (); - WifiTxVector txVector = WifiTxVector (mode, 0, 0, false, 1, 0, 20000000, false, false); - enum mpduType mpdutype = NORMAL_MPDU; + WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, 0, WIFI_PREAMBLE_LONG, false, 1, 0, 20000000, false, false); + MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (1000); WifiMacHeader hdr; @@ -83,12 +80,12 @@ hdr.SetType (WIFI_MAC_QOSDATA); hdr.SetQosTid (0); uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize (); - Time txDuration = m_phy->CalculateTxDuration (size, txVector, preamble, m_phy->GetFrequency(), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency(), mpdutype, 0); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, preamble, mpdutype); + WifiPhyTag tag (txVector, mpdutype); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts); Ptr txParams = Create (); diff -r f49a15537f57 src/wifi/test/tx-duration-test.cc --- a/src/wifi/test/tx-duration-test.cc Sun Nov 06 11:34:21 2016 +0100 +++ b/src/wifi/test/tx-duration-test.cc Sun Nov 06 12:04:10 2016 +0100 @@ -87,6 +87,7 @@ { WifiTxVector txVector; txVector.SetMode (payloadMode); + txVector.SetPreambleType (preamble); txVector.SetChannelWidth (channelWidth); txVector.SetShortGuardInterval (isShortGuardInterval); txVector.SetNss (1); @@ -100,7 +101,7 @@ { testedFrequency = CHANNEL_36_MHZ; } - double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds (); + double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, testedFrequency).GetMicroSeconds (); if (calculatedDurationMicroSeconds != knownDurationMicroSeconds) { std::cerr << " size=" << size @@ -115,7 +116,7 @@ { //Durations vary depending on frequency; test also 2.4 GHz (bug 1971) testedFrequency = CHANNEL_1_MHZ; - calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds (); + calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, testedFrequency).GetMicroSeconds (); if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6) { std::cerr << " size=" << size @@ -135,6 +136,7 @@ { WifiTxVector txVector; txVector.SetMode (payloadMode); + txVector.SetPreambleType (preamble); txVector.SetChannelWidth (channelWidth); txVector.SetShortGuardInterval (isShortGuardInterval); txVector.SetNss (1); @@ -148,7 +150,7 @@ { testedFrequency = CHANNEL_36_MHZ; } - double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000; + double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, testedFrequency).GetNanoSeconds ()) / 1000; if (calculatedDurationMicroSeconds != knownDurationMicroSeconds) { std::cerr << " size=" << size @@ -164,7 +166,7 @@ { //Durations vary depending on frequency; test also 2.4 GHz (bug 1971) testedFrequency = CHANNEL_1_MHZ; - calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000; + calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, testedFrequency).GetNanoSeconds ()) / 1000; if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6) { std::cerr << " size=" << size