From bd79628ad37051cdc66fbf9a80e7449691506708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Wed, 25 Jan 2017 23:46:47 +0100 Subject: [PATCH] wifi: Cleanup files after refactoring --- .../ns3wifi/wifi-ac-mapping-test-suite.cc | 2 +- src/wifi/model/dca-txop.h | 14 ++-- src/wifi/model/dcf-manager.cc | 6 +- src/wifi/model/edca-txop-n.cc | 52 +++++++-------- src/wifi/model/edca-txop-n.h | 8 +-- src/wifi/model/mac-low.cc | 32 +++++----- src/wifi/model/regular-wifi-mac.cc | 48 +++++++------- src/wifi/model/regular-wifi-mac.h | 14 ++-- src/wifi/model/spectrum-wifi-phy.h | 4 +- src/wifi/model/wifi-net-device.cc | 2 +- src/wifi/model/wifi-phy.cc | 64 +++++++++---------- src/wifi/model/wifi-phy.h | 36 +++++------ src/wifi/test/dcf-manager-test.cc | 6 +- src/wifi/test/wifi-aggregation-test.cc | 32 +++++----- 14 files changed, 160 insertions(+), 160 deletions(-) diff --git a/src/test/ns3wifi/wifi-ac-mapping-test-suite.cc b/src/test/ns3wifi/wifi-ac-mapping-test-suite.cc index 4e097f2ce..18161c963 100644 --- a/src/test/ns3wifi/wifi-ac-mapping-test-suite.cc +++ b/src/test/ns3wifi/wifi-ac-mapping-test-suite.cc @@ -183,7 +183,7 @@ WifiAcMappingTest::DoRun (void) } uint32_t totalOctetsThrough = - DynamicCast(sinkApp.Get (0))->GetTotalRx (); + DynamicCast (sinkApp.Get (0))->GetTotalRx (); // Check that the first packet has been received NS_TEST_ASSERT_MSG_EQ (totalOctetsThrough, 500, "A single packet should have been received"); diff --git a/src/wifi/model/dca-txop.h b/src/wifi/model/dca-txop.h index 63d0805ee..8fc14b078 100644 --- a/src/wifi/model/dca-txop.h +++ b/src/wifi/model/dca-txop.h @@ -55,13 +55,13 @@ class CtrlBAckResponseHeader; * The rts/cts policy is similar to the fragmentation policy: when * a packet is bigger than a threshold, the rts/cts protocol is used. */ - + class DcaTxop : public Object { public: friend class DcfListener; friend class MacLowTransmissionListener; - + DcaTxop (); virtual ~DcaTxop (); @@ -77,7 +77,7 @@ public: * packet transmission was failed. */ typedef Callback TxFailed; - + virtual bool IsEdca (); /** @@ -179,7 +179,7 @@ public: * \return the TXOP limit. */ Time GetTxopLimit (void) const; - + /** * When a channel switching occurs, enqueued packets are removed. */ @@ -202,7 +202,7 @@ public: * can be sent safely. */ virtual void Queue (Ptr packet, const WifiMacHeader &hdr); - + /* Event handlers */ /** * Event handler when a CTS timeout has occurred. @@ -249,7 +249,7 @@ public: * does not require an ACK has completed. */ virtual void EndTxNoAck (void); - + /* * Check if the station has TXOP granted for the next MPDU. * @@ -309,7 +309,7 @@ protected: * Request access from DCF manager if needed. */ virtual void StartAccessIfNeeded (void); - + /** * Check if the current packet should be fragmented. * diff --git a/src/wifi/model/dcf-manager.cc b/src/wifi/model/dcf-manager.cc index d1a6d40cc..4d16ef81a 100644 --- a/src/wifi/model/dcf-manager.cc +++ b/src/wifi/model/dcf-manager.cc @@ -351,7 +351,7 @@ DcfManager::DoGrantAccess (void) && GetBackoffEndFor (otherState) <= Simulator::Now ()) { NS_LOG_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" << - otherState->GetBackoffSlots ()); + otherState->GetBackoffSlots ()); /** * all other dcfs with a lower priority whose backoff * has expired and which needed access to the medium @@ -443,8 +443,8 @@ DcfManager::GetBackoffEndFor (DcfState *state) { NS_LOG_FUNCTION (this << state); NS_LOG_DEBUG ("Backoff start: " << GetBackoffStartFor (state).As (Time::US) << - " end: " << (GetBackoffStartFor (state) + - MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs)).As (Time::US)); + " end: " << (GetBackoffStartFor (state) + + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs)).As (Time::US)); return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs); } diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index 3ab94520b..06e852ece 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -255,7 +255,7 @@ EdcaTxopN::NotifyAccessGranted (void) params.EnableAck (); } if (((m_currentHdr.IsQosData () && !m_currentHdr.IsQosAmsdu ()) - || (m_currentHdr.IsData () && !m_currentHdr.IsQosData ())) + || (m_currentHdr.IsData () && !m_currentHdr.IsQosData ())) && (m_blockAckThreshold == 0 || m_blockAckType == BASIC_BLOCK_ACK) && NeedFragmentation ()) { @@ -288,8 +288,8 @@ EdcaTxopN::NotifyAccessGranted (void) /* here is performed aggregation */ Ptr currentAggregatedPacket = Create (); m_msduAggregator->Aggregate (m_currentPacket, currentAggregatedPacket, - MapSrcAddressForAggregation (peekedHdr), - MapDestAddressForAggregation (peekedHdr)); + MapSrcAddressForAggregation (peekedHdr), + MapDestAddressForAggregation (peekedHdr)); bool aggregated = false; bool isAmsdu = false; Ptr peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (), @@ -298,8 +298,8 @@ EdcaTxopN::NotifyAccessGranted (void) while (peekedPacket != 0) { aggregated = m_msduAggregator->Aggregate (peekedPacket, currentAggregatedPacket, - MapSrcAddressForAggregation (peekedHdr), - MapDestAddressForAggregation (peekedHdr)); + MapSrcAddressForAggregation (peekedHdr), + MapDestAddressForAggregation (peekedHdr)); if (aggregated) { isAmsdu = true; @@ -361,14 +361,14 @@ void EdcaTxopN::NotifyInternalCollision (void) if (m_isAccessRequestedForRts) { if (!NeedRtsRetransmission (packet, header)) - { - resetDcf = true; - m_stationManager->ReportFinalRtsFailed (header.GetAddr1 (), &header); - } + { + resetDcf = true; + m_stationManager->ReportFinalRtsFailed (header.GetAddr1 (), &header); + } else - { - m_stationManager->ReportRtsFailed (header.GetAddr1 (), &header); - } + { + m_stationManager->ReportRtsFailed (header.GetAddr1 (), &header); + } } else if (header.GetAddr1 () == Mac48Address::GetBroadcast ()) { @@ -377,16 +377,16 @@ void EdcaTxopN::NotifyInternalCollision (void) else { if (!NeedDataRetransmission (packet, header)) - { - resetDcf = true; - m_stationManager->ReportFinalDataFailed (header.GetAddr1 (), &header); - } + { + resetDcf = true; + m_stationManager->ReportFinalDataFailed (header.GetAddr1 (), &header); + } else - { - m_stationManager->ReportDataFailed (header.GetAddr1 (), &header); - } + { + m_stationManager->ReportDataFailed (header.GetAddr1 (), &header); + } } - if (resetDcf) + if (resetDcf) { NS_LOG_DEBUG ("reset DCF"); if (!m_txFailedCallback.IsNull ()) @@ -812,7 +812,7 @@ EdcaTxopN::StartNext (void) } return; } - + MacLowTransmissionParameters params; params.DisableOverrideDurationId (); if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ()) @@ -823,7 +823,7 @@ EdcaTxopN::StartNext (void) { params.EnableAck (); } - + WifiTxVector dataTxVector = m_stationManager->GetDataTxVector (m_currentHdr.GetAddr1 (), &m_currentHdr, peekedPacket); if (m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr, peekedPacket, dataTxVector)) { @@ -927,9 +927,9 @@ EdcaTxopN::NeedFragmentation (void) const if (m_stationManager->HasVhtSupported () || GetAmpduExist (m_currentHdr.GetAddr1 ()) || (m_stationManager->HasHtSupported () - && m_currentHdr.IsQosData () - && GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr)) - && GetMpduAggregator ()->GetMaxAmpduSize () >= m_currentPacket->GetSize ())) + && m_currentHdr.IsQosData () + && GetBaAgreementExists (m_currentHdr.GetAddr1 (), GetTid (m_currentPacket, m_currentHdr)) + && GetMpduAggregator ()->GetMaxAmpduSize () >= m_currentPacket->GetSize ())) { //MSDU is not fragmented when it is transmitted using an HT-immediate or //HT-delayed Block Ack agreement or when it is carried in an A-MPDU. @@ -1146,7 +1146,7 @@ EdcaTxopN::SetupBlockAckIfNeeded () Mac48Address recipient = m_currentHdr.GetAddr1 (); uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient); if ((m_blockAckThreshold > 0 && packets >= m_blockAckThreshold) - || (m_mpduAggregator != 0 && m_mpduAggregator->GetMaxAmpduSize() > 0 && packets > 1) + || (m_mpduAggregator != 0 && m_mpduAggregator->GetMaxAmpduSize () > 0 && packets > 1) || m_stationManager->HasVhtSupported ()) { /* Block ack setup */ diff --git a/src/wifi/model/edca-txop-n.h b/src/wifi/model/edca-txop-n.h index 11a6d4561..b44df04ab 100644 --- a/src/wifi/model/edca-txop-n.h +++ b/src/wifi/model/edca-txop-n.h @@ -70,14 +70,14 @@ class EdcaTxopN : public DcaTxop public: // Allow test cases to access private members friend class ::AmpduAggregationTest; - + std::map m_aMpduEnabled; static TypeId GetTypeId (void); EdcaTxopN (); virtual ~EdcaTxopN (); void DoDispose (); - + virtual bool IsEdca (); /** @@ -236,7 +236,7 @@ public: * false otherwise. */ bool NeedBarRetransmission (void); - + /** * Check if the current packet should be fragmented. * @@ -387,7 +387,7 @@ public: * \param hdr the header of the packet that we failed to sent. */ void BaTxFailed (const WifiMacHeader &hdr); - + /** * This functions are used only to correctly set source address in A-MSDU subframes. * If aggregating sta is a STA (in an infrastructured network): diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index cadb8faa5..d6bb95fc9 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -656,7 +656,7 @@ MacLow::StartTransmission (Ptr packet, CancelAllEvents (); m_txParams = params; m_currentTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); - + if (NeedRts ()) { m_txParams.EnableRts (); @@ -667,9 +667,9 @@ MacLow::StartTransmission (Ptr packet, } if (m_currentHdr.IsMgt () - || (!m_currentHdr.IsQosData () - && !m_currentHdr.IsBlockAck () - && !m_currentHdr.IsBlockAckReq ())) + || (!m_currentHdr.IsQosData () + && !m_currentHdr.IsBlockAck () + && !m_currentHdr.IsBlockAckReq ())) { //This is mainly encountered when a higher priority control or management frame is //sent between A-MPDU transmissions. It avoids to unexpectedly flush the aggregate @@ -691,7 +691,7 @@ MacLow::StartTransmission (Ptr packet, //VHT single MPDUs are followed by normal ACKs m_txParams.EnableAck (); } - AcIndex ac = QosUtilsMapTidToAc (GetTid(packet, *hdr)); + AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); std::map >::const_iterator edcaIt = m_edca.find (ac); Ptr aggregatedPacket = Create (); for (uint32_t i = 0; i < sentMpdus; i++) @@ -942,7 +942,7 @@ MacLow::ReceiveOk (Ptr packet, double rxSnr, WifiTxVector txVector, bool NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ()); SnrTag tag; packet->RemovePacketTag (tag); - FlushAggregateQueue (GetTid(packet, hdr)); + FlushAggregateQueue (GetTid (packet, hdr)); CtrlBAckResponseHeader blockAck; packet->RemoveHeader (blockAck); m_blockAckTimeoutEvent.Cancel (); @@ -1458,7 +1458,7 @@ MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, WifiTxV bool vhtSingleMpdu = false; bool last = false; MpduType mpdutype = NORMAL_MPDU; - + uint8_t tid = GetTid (packet, *hdr); AcIndex ac = QosUtilsMapTidToAc (tid); std::map >::const_iterator edcaIt = m_edca.find (ac); @@ -1491,7 +1491,7 @@ MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, WifiTxV } edcaIt->second->GetMpduAggregator ()->AddHeaderAndPad (newPacket, last, vhtSingleMpdu); - + if (delay == Seconds (0)) { NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); @@ -1504,7 +1504,7 @@ MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, WifiTxV mpdutype = NORMAL_MPDU; } } - + Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, m_phy->GetFrequency (), mpdutype, 0); remainingAmpduDuration -= mpduDuration; @@ -1574,7 +1574,7 @@ MacLow::NormalAckTimeout (void) m_ampdu = false; if (m_currentHdr.IsQosData ()) { - FlushAggregateQueue (GetTid(m_currentPacket, m_currentHdr)); + FlushAggregateQueue (GetTid (m_currentPacket, m_currentHdr)); } dca->MissedAck (); } @@ -1952,10 +1952,10 @@ MacLow::SendDataAfterCts (Mac48Address source, Time duration) */ NS_ASSERT (m_currentPacket != 0); - if (m_currentHdr.IsQosData()) + if (m_currentHdr.IsQosData ()) { - uint8_t tid = GetTid(m_currentPacket, m_currentHdr); - if (m_aggregateQueue[GetTid(m_currentPacket, m_currentHdr)]->GetSize () != 0) + uint8_t tid = GetTid (m_currentPacket, m_currentHdr); + if (m_aggregateQueue[GetTid (m_currentPacket, m_currentHdr)]->GetSize () != 0) { for (std::vector::size_type i = 0; i != m_txPackets[tid].size (); i++) { @@ -2057,7 +2057,7 @@ void MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr) { NS_LOG_FUNCTION (this); - // send an ACK, after SIFS, when you receive a packet + // send an ACK, after SIFS, when you receive a packet WifiTxVector ackTxVector = GetAckTxVector (source, dataTxMode); WifiMacHeader ack; ack.SetType (WIFI_MAC_CTL_ACK); @@ -2626,7 +2626,7 @@ MacLow::AggregateToAmpdu (Ptr packet, const WifiMacHeader hdr) newPacket = packet->Copy (); Ptr currentAggregatedPacket; CtrlBAckRequestHeader blockAckReq; - + if (hdr.IsBlockAckReq ()) { //Workaround to avoid BlockAckReq to be part of an A-MPDU. The standard says that @@ -2636,7 +2636,7 @@ MacLow::AggregateToAmpdu (Ptr packet, const WifiMacHeader hdr) //are supported, the condition of entering here should be changed. return newPacket; } - + //missing hdr.IsAck() since we have no means of knowing the Tid of the Ack yet if (hdr.IsQosData () || hdr.IsBlockAck ()|| hdr.IsBlockAckReq ()) { diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index 2803c4a62..04d6df703 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -34,11 +34,11 @@ NS_LOG_COMPONENT_DEFINE ("RegularWifiMac"); NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac); -RegularWifiMac::RegularWifiMac () : - m_htSupported (0), - m_vhtSupported (0), - m_erpSupported (0), - m_dsssSupported (0) +RegularWifiMac::RegularWifiMac () + : m_htSupported (0), + m_vhtSupported (0), + m_erpSupported (0), + m_dsssSupported (0) { NS_LOG_FUNCTION (this); m_rxMiddle = new MacRxMiddle (); @@ -1171,9 +1171,9 @@ RegularWifiMac::ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax) //Now we configure the EDCA functions for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i) - { - ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first); - } + { + ConfigureDcf (i->second, cwMin, cwMax, isDsssOnly, i->first); + } } void @@ -1233,18 +1233,18 @@ RegularWifiMac::EnableAggregation (void) { NS_LOG_FUNCTION (this); for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i) - { - if (i->second->GetMsduAggregator () == 0) - { - Ptr msduAggregator = CreateObject (); - i->second->SetMsduAggregator (msduAggregator); - } - if (i->second->GetMpduAggregator () == 0) - { - Ptr mpduAggregator = CreateObject (); - i->second->SetMpduAggregator (mpduAggregator); - } - } + { + if (i->second->GetMsduAggregator () == 0) + { + Ptr msduAggregator = CreateObject (); + i->second->SetMsduAggregator (msduAggregator); + } + if (i->second->GetMpduAggregator () == 0) + { + Ptr mpduAggregator = CreateObject (); + i->second->SetMpduAggregator (mpduAggregator); + } + } ConfigureAggregation (); } @@ -1253,10 +1253,10 @@ RegularWifiMac::DisableAggregation (void) { NS_LOG_FUNCTION (this); for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i) - { - i->second->SetMsduAggregator (0); - i->second->SetMpduAggregator (0); - } + { + i->second->SetMsduAggregator (0); + i->second->SetMpduAggregator (0); + } } } //namespace ns3 diff --git a/src/wifi/model/regular-wifi-mac.h b/src/wifi/model/regular-wifi-mac.h index 9b83f36b0..2f6f9a0ca 100644 --- a/src/wifi/model/regular-wifi-mac.h +++ b/src/wifi/model/regular-wifi-mac.h @@ -335,7 +335,7 @@ protected: * chain up to this implementation to deal with the remainder. */ virtual void FinishConfigureStandard (WifiPhyStandard standard); - + /** * \param cwMin the minimum congestion window size * \param cwMax the maximum congestion window size @@ -486,7 +486,7 @@ protected: * \return true if VHT is supported, false otherwise */ bool GetVhtSupported () const; - + /** * This Boolean is set \c true iff this WifiMac is to model * 802.11g. It is exposed through the attribute system. @@ -504,7 +504,7 @@ protected: * \return true if ERP is supported, false otherwise */ bool GetErpSupported () const; - + /** * This Boolean is set \c true iff this WifiMac is to model * 802.11b. It is exposed through the attribute system. @@ -545,17 +545,17 @@ private: void SetViMaxAmpduSize (uint32_t size); void SetBeMaxAmpduSize (uint32_t size); void SetBkMaxAmpduSize (uint32_t size); - + void SetVoBlockAckThreshold (uint8_t threshold); void SetViBlockAckThreshold (uint8_t threshold); void SetBeBlockAckThreshold (uint8_t threshold); void SetBkBlockAckThreshold (uint8_t threshold); - + void SetVoBlockAckInactivityTimeout (uint16_t timeout); void SetViBlockAckInactivityTimeout (uint16_t timeout); void SetBeBlockAckInactivityTimeout (uint16_t timeout); void SetBkBlockAckInactivityTimeout (uint16_t timeout); - + void ConfigureAggregation (void); void EnableAggregation (void); void DisableAggregation (void); @@ -572,7 +572,7 @@ private: TracedCallback m_txOkCallback; TracedCallback m_txErrCallback; - + bool m_shortSlotTimeSupported; }; diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 96247438a..a13251589 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -87,7 +87,7 @@ public: * \param rxParams Input signal parameters */ void StartRx (Ptr rxParams); - + /** * \param packet the packet to send * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send @@ -96,7 +96,7 @@ public: * \param txDuration duration of the transmission. */ void StartTx (Ptr packet, WifiTxVector txVector, Time txDuration); - + /** * Method to encapsulate the creation of the WifiSpectrumPhyInterface * object (used to bind the WifiSpectrumPhy to a SpectrumChannel) and diff --git a/src/wifi/model/wifi-net-device.cc b/src/wifi/model/wifi-net-device.cc index 6ee404dcf..436c256b5 100644 --- a/src/wifi/model/wifi-net-device.cc +++ b/src/wifi/model/wifi-net-device.cc @@ -379,7 +379,7 @@ WifiNetDevice::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to { packet->RemoveHeader (llc); } - + if (!m_promiscRx.IsNull ()) { m_mac->NotifyPromiscRx (packet); diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 167125daf..5112244a9 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -53,9 +53,9 @@ NS_OBJECT_ENSURE_REGISTERED (WifiPhy); * This table maintains the mapping of valid ChannelNumber to * Frequency/ChannelWidth pairs. If you want to make a channel applicable * to all standards, then you may use the WIFI_PHY_STANDARD_UNSPECIFIED - * standard to represent this, as a wildcard. If you want to limit the - * configuration of a particular channel/frequency/width to a particular - * standard(s), then you can specify one or more such bindings. + * standard to represent this, as a wildcard. If you want to limit the + * configuration of a particular channel/frequency/width to a particular + * standard(s), then you can specify one or more such bindings. */ WifiPhy::ChannelToFrequencyWidthMap WifiPhy::m_channelToFrequencyWidth = { @@ -141,7 +141,7 @@ WifiPhy::ChannelToFrequencyWidthMap WifiPhy::m_channelToFrequencyWidth = { std::make_pair (50, WIFI_PHY_STANDARD_80211ac), std::make_pair (5250, 160) }, { std::make_pair (114, WIFI_PHY_STANDARD_80211ac), std::make_pair (5570, 160) }, - // 802.11p (10 MHz channels at the 5.855-5.925 band + // 802.11p (10 MHz channels at the 5.855-5.925 band { std::make_pair (172, WIFI_PHY_STANDARD_80211_10MHZ), std::make_pair (5860, 10) }, { std::make_pair (174, WIFI_PHY_STANDARD_80211_10MHZ), std::make_pair (5870, 10) }, { std::make_pair (176, WIFI_PHY_STANDARD_80211_10MHZ), std::make_pair (5880, 10) }, @@ -397,10 +397,10 @@ WifiPhy::DoDispose (void) m_deviceMcsSet.clear (); } -void +void WifiPhy::DoInitialize (void) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this); m_isConstructed = true; if (m_frequencyChannelNumberInitialized == true) { @@ -445,7 +445,7 @@ WifiPhy::InitializeFrequencyChannelNumber (void) // construction phase, the frequency and channel width will drive the // initial configuration. If frequency has not been set, but both // standard and channel number have been set, that pair will instead - // drive the configuration, and frequency and channel number will be + // drive the configuration, and frequency and channel number will be // aligned if (m_initialFrequency != 0) { @@ -745,7 +745,7 @@ WifiPhy::ConfigureDefaultsForStandard (WifiPhyStandard standard) case WIFI_PHY_STANDARD_80211_5MHZ: SetChannelWidth (5); SetFrequency (5860); - // Channel number should be aligned by SetFrequency () to 0 + // Channel number should be aligned by SetFrequency () to 0 NS_ASSERT (GetChannelNumber () == 0); break; case WIFI_PHY_STANDARD_holland: @@ -883,9 +883,9 @@ WifiPhy::ConfigureHtDeviceMcsSet (void) { // erase all HtMcs modes from deviceMcsSet size_t index = m_deviceMcsSet.size () - 1; - for (std::vector::reverse_iterator rit = m_deviceMcsSet.rbegin (); rit != m_deviceMcsSet.rend(); ++rit, --index) + for (std::vector::reverse_iterator rit = m_deviceMcsSet.rbegin (); rit != m_deviceMcsSet.rend (); ++rit, --index) { - if (m_deviceMcsSet[index].GetModulationClass ()== WIFI_MOD_CLASS_HT) + if (m_deviceMcsSet[index].GetModulationClass () == WIFI_MOD_CLASS_HT) { m_deviceMcsSet.erase (m_deviceMcsSet.begin () + index); } @@ -971,7 +971,7 @@ WifiPhy::Configure80211ac (void) m_bssMembershipSelectorSet.push_back (VHT_PHY); } -bool +bool WifiPhy::DefineChannelNumber (uint8_t channelNumber, WifiPhyStandard standard, uint16_t frequency, uint8_t channelWidth) { NS_LOG_FUNCTION (this << (uint16_t)channelNumber << standard << frequency << (uint16_t)channelWidth); @@ -999,8 +999,8 @@ WifiPhy::FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width) { if (it->second == f) { - found = true; - break; + found = true; + break; } ++it; } @@ -1021,7 +1021,7 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard) { NS_LOG_FUNCTION (this << standard); // If the user has configured both Frequency and ChannelNumber, Frequency - // takes precedence + // takes precedence if (GetFrequency () != 0) { // If Frequency is already set, then see whether a ChannelNumber can @@ -1042,7 +1042,7 @@ WifiPhy::ConfigureChannelForStandard (WifiPhyStandard standard) } else if (GetChannelNumber () != 0) { - // If the channel number is known for this particular standard or for + // If the channel number is known for this particular standard or for // the unspecified standard, configure using the known values; // otherwise, this is a configuration error NS_LOG_DEBUG ("Configuring for channel number " << (uint16_t)GetChannelNumber ()); @@ -1225,7 +1225,7 @@ WifiPhy::SetMaxSupportedTxSpatialStreams (uint8_t streams) ConfigureHtDeviceMcsSet (); } -uint8_t +uint8_t WifiPhy::GetMaxSupportedTxSpatialStreams (void) const { return m_txSpatialStreams; @@ -1238,7 +1238,7 @@ WifiPhy::SetMaxSupportedRxSpatialStreams (uint8_t streams) m_rxSpatialStreams = streams; } -uint8_t +uint8_t WifiPhy::GetMaxSupportedRxSpatialStreams (void) const { return m_rxSpatialStreams; @@ -1945,12 +1945,12 @@ WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, uint16_t freq //check tables 20-35 and 20-36 in the .11n standard to get cases when nes = 2 double Nes = 1; if (payloadMode.GetUniqueName () == "HtMcs21" - || payloadMode.GetUniqueName () == "HtMcs22" - || payloadMode.GetUniqueName () == "HtMcs23" - || payloadMode.GetUniqueName () == "HtMcs28" - || payloadMode.GetUniqueName () == "HtMcs29" - || payloadMode.GetUniqueName () == "HtMcs30" - || payloadMode.GetUniqueName () == "HtMcs31") + || payloadMode.GetUniqueName () == "HtMcs22" + || payloadMode.GetUniqueName () == "HtMcs23" + || payloadMode.GetUniqueName () == "HtMcs28" + || payloadMode.GetUniqueName () == "HtMcs29" + || payloadMode.GetUniqueName () == "HtMcs30" + || payloadMode.GetUniqueName () == "HtMcs31") { Nes = 2; } @@ -2125,7 +2125,7 @@ WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, uint16_t freq Time WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector) { - WifiPreamble preamble = txVector.GetPreambleType(); + WifiPreamble preamble = txVector.GetPreambleType (); Time duration = GetPlcpPreambleDuration (txVector) + GetPlcpHeaderDuration (txVector) + GetPlcpHtSigHeaderDuration (preamble) @@ -2213,7 +2213,7 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType m * - we are idle */ NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ()); - + if (txVector.GetNss () > GetMaxSupportedTxSpatialStreams ()) { NS_FATAL_ERROR ("Unsupported number of spatial streams!"); @@ -2252,7 +2252,7 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType m newPacket->RemovePacketTag (oldtag); WifiPhyTag tag (txVector, mpdutype); newPacket->AddPacketTag (tag); - + StartTx (newPacket, txVector, txDuration); } @@ -2264,7 +2264,7 @@ WifiPhy::StartReceivePreambleAndHeader (Ptr packet, double rxPowerW, Tim NS_LOG_FUNCTION (this << packet << WToDbm (rxPowerW) << rxDuration); AmpduTag ampduTag; Time endRx = Simulator::Now () + rxDuration; - + WifiPhyTag tag; bool found = packet->RemovePacketTag (tag); if (!found) @@ -2274,17 +2274,17 @@ WifiPhy::StartReceivePreambleAndHeader (Ptr packet, double rxPowerW, Tim } WifiTxVector txVector = tag.GetWifiTxVector (); - + if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && (txVector.GetNss () != (1 + (txVector.GetMode ().GetMcsValue () / 8)))) { NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << (uint16_t)txVector.GetMode ().GetMcsValue () << ", NSS = " << (uint16_t)txVector.GetNss ()); } - + if (txVector.GetNss () > GetMaxSupportedRxSpatialStreams ()) - { + { NS_FATAL_ERROR ("Reception ends in failure because of an unsupported number of spatial streams"); - } + } WifiPreamble preamble = txVector.GetPreambleType (); MpduType mpdutype = tag.GetMpduType (); @@ -3311,7 +3311,7 @@ bool WifiPhy::IsValidTxVector (WifiTxVector txVector) { uint8_t chWidth = txVector.GetChannelWidth (); - uint8_t nss = txVector.GetNss(); + uint8_t nss = txVector.GetNss (); std::string modeName = txVector.GetMode ().GetUniqueName (); if (chWidth == 20) diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 51b96dd09..ff834965b 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -211,7 +211,7 @@ public: * upon erroneous packet reception. */ void SetReceiveErrorCallback (RxErrorCallback callback); - + /** * \param listener the new listener * @@ -226,7 +226,7 @@ public: * PHY-level events. */ void UnregisterListener (WifiPhyListener *listener); - + /** * Starting receiving the plcp of a packet (i.e. the first bit of the preamble has arrived). * @@ -237,7 +237,7 @@ public: void StartReceivePreambleAndHeader (Ptr packet, double rxPowerW, Time rxDuration); - + /** * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived). * @@ -250,7 +250,7 @@ public: WifiTxVector txVector, MpduType mpdutype, Ptr event); - + /** * The last bit of the packet has arrived. * @@ -260,7 +260,7 @@ public: * \param event the corresponding event of the first time the packet arrives */ void EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event); - + /** * \param packet the packet to send * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send @@ -269,7 +269,7 @@ public: * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. */ void SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU); - + /** * \param packet the packet to send * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send @@ -606,7 +606,7 @@ public: /** * Add a channel definition to the WifiPhy. The pair (channelNumber, - * WifiPhyStandard) may then be used to lookup a pair (frequency, + * WifiPhyStandard) may then be used to lookup a pair (frequency, * channelWidth). * * If the channel is not already defined for the standard, the method @@ -1398,7 +1398,7 @@ public: */ virtual void SetFrequency (uint16_t freq); /** - * \return the operating center frequency (MHz) + * \return the operating center frequency (MHz) */ virtual uint16_t GetFrequency (void) const; /** @@ -1523,7 +1523,7 @@ protected: virtual void DoDispose (void); /** - * The default implementation does nothing and returns true. This method + * The default implementation does nothing and returns true. This method * is typically called internally by SetChannelNumber (). * * \brief Perform any actions necessary when user changes channel number @@ -1552,7 +1552,7 @@ protected: * \return the transmission power in dBm at the given power level */ double GetPowerDbm (uint8_t power) const; - + /** * Check if Phy state should move to CCA busy state based on current * state of interference tracker. In this model, CCA becomes busy when @@ -1560,7 +1560,7 @@ protected: * class is higher than the CcaMode1Threshold */ void SwitchMaybeToCcaBusy (void); - + InterferenceHelper m_interference; //!< Pointer to InterferenceHelper Ptr m_random; //!< Provides uniform random variables. Ptr m_state; //!< Pointer to WifiPhyStateHelper @@ -1569,7 +1569,7 @@ protected: bool m_plcpSuccess; //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received uint64_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU uint64_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU - + EventId m_endRxEvent; EventId m_endPlcpRxEvent; @@ -1579,10 +1579,10 @@ private: * * This method exists to handle the fact that two attribute values, * Frequency and ChannelNumber, are coupled. The initialization of - * these values needs to be deferred until after attribute construction + * these values needs to be deferred until after attribute construction * time, to avoid static initialization order issues. This method is * typically called either when ConfigureStandard () is called or when - * DoInitialize () is called. + * DoInitialize () is called. */ void InitializeFrequencyChannelNumber (void); /** @@ -1628,7 +1628,7 @@ private: void ConfigureHtDeviceMcsSet (void); /** * Configure the PHY-level parameters for different Wi-Fi standard. - * This method is called when defaults for each standard must be + * This method is called when defaults for each standard must be * selected. * * \param standard the Wi-Fi standard @@ -1733,7 +1733,7 @@ private: * of its size. */ TracedCallback, uint16_t, WifiTxVector, MpduInfo> m_phyMonitorSniffTxTrace; - + /** * This vector holds the set of transmission modes that this * WifiPhy(-derived class) can support. In conversation we call this @@ -1789,7 +1789,7 @@ private: double m_txPowerBaseDbm; //!< Minimum transmission power (dBm) double m_txPowerEndDbm; //!< Maximum transmission power (dBm) uint32_t m_nTxPower; //!< Number of available transmission power levels - + bool m_ldpc; //!< Flag if LDPC is used bool m_stbc; //!< Flag if STBC is used bool m_greenfield; //!< Flag if GreenField format is supported @@ -1813,7 +1813,7 @@ private: Time m_channelSwitchDelay; //!< Time required to switch between channel uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU double m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU - + Ptr m_device; //!< Pointer to the device Ptr m_mobility; //!< Pointer to the mobility model }; diff --git a/src/wifi/test/dcf-manager-test.cc b/src/wifi/test/dcf-manager-test.cc index d9dc8d652..873b79a32 100644 --- a/src/wifi/test/dcf-manager-test.cc +++ b/src/wifi/test/dcf-manager-test.cc @@ -188,7 +188,7 @@ DcfManagerTest::NotifyAccessGranted (uint32_t i) NS_TEST_EXPECT_MSG_EQ (Simulator::Now (), MicroSeconds (expected.second), "Expected access grant is now"); m_dcfManager->NotifyTxStartNow (MicroSeconds (expected.first)); m_dcfManager->NotifyAckTimeoutStartNow (MicroSeconds (m_ackTimeoutValue + expected.first)); - } + } } void @@ -437,7 +437,7 @@ DcfManagerTest::DoRun (void) StartTest (1, 3, 10); AddDcfState (1); AddAccessRequest (1, 1, 4, 0); - ExpectCollision (1, 0, 0); + ExpectCollision (1, 0, 0); AddRxInsideSifsEvt (6, 10); AddTxEvt (8, 1); AddAccessRequest (14, 2, 14, 0); @@ -659,7 +659,7 @@ DcfManagerTest::DoRun (void) EndTest (); // 20 40 50 53 54 55 56 57 - // | switching | busy | sifs | aifsn | bslot0 | bslot 1 | tx | + // | switching | busy | sifs | aifsn | bslot0 | bslot 1 | tx | // | | // 30 busy. 45 access request. // diff --git a/src/wifi/test/wifi-aggregation-test.cc b/src/wifi/test/wifi-aggregation-test.cc index 13fed8148..087ae8881 100644 --- a/src/wifi/test/wifi-aggregation-test.cc +++ b/src/wifi/test/wifi-aggregation-test.cc @@ -91,7 +91,7 @@ AmpduAggregationTest::DoRun (void) m_edca->SetAccessCategory (AC_BE); m_edca->SetWifiRemoteStationManager (m_manager); m_edca->SetManager (m_dcfManager); - + m_txMiddle = new MacTxMiddle (); m_edca->SetTxMiddle (m_txMiddle); m_edca->CompleteConfig (); @@ -138,7 +138,7 @@ AmpduAggregationTest::DoRun (void) * Test behavior when no other packets are in the queue */ m_low->m_currentHdr = hdr; - m_low->m_currentPacket = pkt->Copy(); + m_low->m_currentPacket = pkt->Copy (); m_low->m_currentTxVector = m_low->GetDataTxVector (m_low->m_currentPacket, &m_low->m_currentHdr); bool isAmpdu = m_low->IsAmpdu (pkt, hdr); @@ -178,12 +178,12 @@ AmpduAggregationTest::DoRun (void) WifiMacHeader dequeuedHdr; uint32_t i = 0; for (; aggregationQueueSize > 0; aggregationQueueSize--, i++) - { - dequeuedPacket = m_low->m_aggregateQueue[0]->Dequeue (&dequeuedHdr); - NS_TEST_EXPECT_MSG_EQ (dequeuedHdr.GetSequenceNumber (), i, "wrong sequence number"); - } + { + dequeuedPacket = m_low->m_aggregateQueue[0]->Dequeue (&dequeuedHdr); + NS_TEST_EXPECT_MSG_EQ (dequeuedHdr.GetSequenceNumber (), i, "wrong sequence number"); + } NS_TEST_EXPECT_MSG_EQ (aggregationQueueSize, 0, "aggregation queue should be empty"); - + //----------------------------------------------------------------------------------------------------- /* @@ -212,20 +212,20 @@ AmpduAggregationTest::DoRun (void) hdr3.SetQosTid (0); m_edca->GetQueue ()->Enqueue (pkt3, hdr3); - + isAmpdu = m_low->IsAmpdu (pkt1, hdr1); NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "a single packet for this destination should not result in an A-MPDU"); NS_TEST_EXPECT_MSG_EQ (m_low->m_aggregateQueue[0]->GetSize (), 0, "aggregation queue is not flushed"); - + m_edca->m_currentHdr = hdr2; m_edca->m_currentPacket = pkt2->Copy (); isAmpdu = m_low->IsAmpdu (pkt2, hdr2); NS_TEST_EXPECT_MSG_EQ (isAmpdu, false, "no MPDU aggregation should be performed if there is no agreement"); NS_TEST_EXPECT_MSG_EQ (m_low->m_aggregateQueue[0]->GetSize (), 0, "aggregation queue is not flushed"); - + m_manager->SetMaxSlrc (0); //set to 0 in order to fake that the maximum number of retries has been reached - m_edca->MissedAck(); - + m_edca->MissedAck (); + NS_TEST_EXPECT_MSG_EQ (m_edca->m_currentPacket, 0, "packet should be discarded"); m_edca->GetQueue ()->Remove (pkt3); @@ -292,7 +292,7 @@ TwoLevelAggregationTest::DoRun (void) */ m_msduAggregator = CreateObject (); m_mpduAggregator = CreateObject (); - + m_msduAggregator->SetMaxAmsduSize (4095); m_mpduAggregator->SetMaxAmpduSize (65535); @@ -324,9 +324,9 @@ TwoLevelAggregationTest::DoRun (void) m_edca->GetQueue ()->Enqueue (pkt, hdr); Ptr peekedPacket = m_edca->GetQueue ()->PeekByTidAndAddress (&peekedHdr, 0, - WifiMacHeader::ADDR1, - hdr.GetAddr1 (), - &tstamp); + WifiMacHeader::ADDR1, + hdr.GetAddr1 (), + &tstamp); m_low->m_currentPacket = peekedPacket->Copy (); m_low->m_currentHdr = peekedHdr; m_low->m_currentTxVector = m_low->GetDataTxVector (m_low->m_currentPacket, &m_low->m_currentHdr);