From 19b5fd64056379a95bccbad044e58412c0af4091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 29 Nov 2016 23:16:51 +0100 Subject: [PATCH] wifi: Add missing const --- src/wifi/model/block-ack-cache.cc | 4 ++-- src/wifi/model/block-ack-cache.h | 4 ++-- src/wifi/model/block-ack-manager.cc | 2 +- src/wifi/model/block-ack-manager.h | 2 +- src/wifi/model/dca-txop.cc | 24 +++++++++---------- src/wifi/model/dca-txop.h | 27 +++++++++++----------- src/wifi/model/edca-txop-n.cc | 22 +++++++++--------- src/wifi/model/edca-txop-n.h | 14 +++++------ src/wifi/model/mac-low.cc | 6 ++--- src/wifi/model/mac-low.h | 6 ++--- src/wifi/model/mac-rx-middle.cc | 6 ++--- src/wifi/model/mpdu-aggregator.h | 10 ++++---- src/wifi/model/mpdu-standard-aggregator.cc | 10 ++++---- src/wifi/model/mpdu-standard-aggregator.h | 10 ++++---- src/wifi/model/msdu-aggregator.h | 2 +- src/wifi/model/msdu-standard-aggregator.cc | 4 ++-- src/wifi/model/msdu-standard-aggregator.h | 4 ++-- src/wifi/model/wifi-mode.cc | 2 +- src/wifi/model/wifi-mode.h | 2 +- src/wifi/model/wifi-phy-state-helper.cc | 20 ++++++++-------- src/wifi/model/wifi-phy-state-helper.h | 20 ++++++++-------- src/wifi/model/wifi-phy.cc | 2 +- src/wifi/model/wifi-phy.h | 2 +- 23 files changed, 103 insertions(+), 102 deletions(-) diff --git a/src/wifi/model/block-ack-cache.cc b/src/wifi/model/block-ack-cache.cc index 0545a3019..8d86dd41f 100644 --- a/src/wifi/model/block-ack-cache.cc +++ b/src/wifi/model/block-ack-cache.cc @@ -41,7 +41,7 @@ BlockAckCache::Init (uint16_t winStart, uint16_t winSize) } uint16_t -BlockAckCache::GetWinStart () +BlockAckCache::GetWinStart () const { return m_winStart; } @@ -111,7 +111,7 @@ BlockAckCache::ResetPortionOfBitmap (uint16_t start, uint16_t end) } bool -BlockAckCache::IsInWindow (uint16_t seq) +BlockAckCache::IsInWindow (uint16_t seq) const { NS_LOG_FUNCTION (this << seq); return ((seq - m_winStart + 4096) % 4096) < m_winSize; diff --git a/src/wifi/model/block-ack-cache.h b/src/wifi/model/block-ack-cache.h index 3f5a43be4..01822391c 100644 --- a/src/wifi/model/block-ack-cache.h +++ b/src/wifi/model/block-ack-cache.h @@ -45,14 +45,14 @@ public: * depending on the sequence number of the received MPDU (standard11n page 134). * This function is used to retrieve this value in order to add it to the BlockAck. */ - uint16_t GetWinStart (void); + uint16_t GetWinStart (void) const; void FillBlockAckBitmap (CtrlBAckResponseHeader *blockAckHeader); private: void ResetPortionOfBitmap (uint16_t start, uint16_t end); - bool IsInWindow (uint16_t seq); + bool IsInWindow (uint16_t seq) const; uint16_t m_winStart; uint8_t m_winSize; diff --git a/src/wifi/model/block-ack-manager.cc b/src/wifi/model/block-ack-manager.cc index e993c25db..0e1c22f6b 100644 --- a/src/wifi/model/block-ack-manager.cc +++ b/src/wifi/model/block-ack-manager.cc @@ -558,7 +558,7 @@ BlockAckManager::SetWifiRemoteStationManager (Ptr mana } bool -BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid) +BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid) const { std::list::const_iterator it = m_retryPackets.begin (); while (it != m_retryPackets.end ()) diff --git a/src/wifi/model/block-ack-manager.h b/src/wifi/model/block-ack-manager.h index 9274ac7f7..3b2ac7ee7 100644 --- a/src/wifi/model/block-ack-manager.h +++ b/src/wifi/model/block-ack-manager.h @@ -319,7 +319,7 @@ public: /** * Checks if the packet already exists in the retransmit queue or not if it does then it doesn't add it again */ - bool AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid); + bool AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uint8_t tid) const; /** * Remove a packet after you peek in the queue and get it */ diff --git a/src/wifi/model/dca-txop.cc b/src/wifi/model/dca-txop.cc index e8913767a..74d925b0a 100644 --- a/src/wifi/model/dca-txop.cc +++ b/src/wifi/model/dca-txop.cc @@ -329,7 +329,7 @@ DcaTxop::StartAccessIfNeeded (void) } Ptr -DcaTxop::Low (void) +DcaTxop::GetLow (void) const { NS_LOG_FUNCTION (this); return m_low; @@ -345,7 +345,7 @@ DcaTxop::DoInitialize () } bool -DcaTxop::NeedRtsRetransmission (void) +DcaTxop::NeedRtsRetransmission (void) const { NS_LOG_FUNCTION (this); return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -353,7 +353,7 @@ DcaTxop::NeedRtsRetransmission (void) } bool -DcaTxop::NeedDataRetransmission (void) +DcaTxop::NeedDataRetransmission (void) const { NS_LOG_FUNCTION (this); return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -361,7 +361,7 @@ DcaTxop::NeedDataRetransmission (void) } bool -DcaTxop::NeedFragmentation (void) +DcaTxop::NeedFragmentation (void) const { NS_LOG_FUNCTION (this); return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -376,7 +376,7 @@ DcaTxop::NextFragment (void) } uint32_t -DcaTxop::GetFragmentSize (void) +DcaTxop::GetFragmentSize (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -384,7 +384,7 @@ DcaTxop::GetFragmentSize (void) } bool -DcaTxop::IsLastFragment (void) +DcaTxop::IsLastFragment (void) const { NS_LOG_FUNCTION (this); return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -392,7 +392,7 @@ DcaTxop::IsLastFragment (void) } uint32_t -DcaTxop::GetNextFragmentSize (void) +DcaTxop::GetNextFragmentSize (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -400,7 +400,7 @@ DcaTxop::GetNextFragmentSize (void) } uint32_t -DcaTxop::GetFragmentOffset (void) +DcaTxop::GetFragmentOffset (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -465,7 +465,7 @@ DcaTxop::NotifyAccessGranted (void) params.DisableRts (); params.DisableAck (); params.DisableNextData (); - Low ()->StartTransmission (m_currentPacket, + GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); @@ -489,13 +489,13 @@ DcaTxop::NotifyAccessGranted (void) NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ()); params.EnableNextData (GetNextFragmentSize ()); } - Low ()->StartTransmission (fragment, &hdr, params, + GetLow ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); } else { params.DisableNextData (); - Low ()->StartTransmission (m_currentPacket, &m_currentHdr, + GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); } } @@ -649,7 +649,7 @@ DcaTxop::StartNextFragment (void) { params.EnableNextData (GetNextFragmentSize ()); } - Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); + GetLow ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); } void diff --git a/src/wifi/model/dca-txop.h b/src/wifi/model/dca-txop.h index d63633979..fc1e206e8 100644 --- a/src/wifi/model/dca-txop.h +++ b/src/wifi/model/dca-txop.h @@ -113,6 +113,13 @@ public: */ void SetTxFailedCallback (TxFailed callback); + /** + * Return the MacLow associated with this DcaTxop. + * + * \return MacLow + */ + Ptr GetLow (void) const; + /** * Return the packet queue associated with this DcaTxop. * @@ -162,12 +169,6 @@ private: DcaTxop (const DcaTxop &o); //Inherited from ns3::Object - /** - * Return the MacLow associated with this DcaTxop. - * - * \return MacLow - */ - Ptr Low (void); void DoInitialize (); /* dcf notifications forwarded here */ /** @@ -257,46 +258,46 @@ private: * \return true if RTS should be re-transmitted, * false otherwise */ - bool NeedRtsRetransmission (void); + bool NeedRtsRetransmission (void) const; /** * Check if DATA should be re-transmitted if ACK was missed. * * \return true if DATA should be re-transmitted, * false otherwise */ - bool NeedDataRetransmission (void); + bool NeedDataRetransmission (void) const; /** * Check if the current packet should be fragmented. * * \return true if the current packet should be fragmented, * false otherwise */ - bool NeedFragmentation (void); + bool NeedFragmentation (void) const; /** * Calculate the size of the next fragment. * * \return the size of the next fragment */ - uint32_t GetNextFragmentSize (void); + uint32_t GetNextFragmentSize (void) const; /** * Calculate the size of the current fragment. * * \return the size of the current fragment */ - uint32_t GetFragmentSize (void); + uint32_t GetFragmentSize (void) const; /** * Calculate the offset for the current fragment. * * \return the offset for the current fragment */ - uint32_t GetFragmentOffset (void); + uint32_t GetFragmentOffset (void) const; /** * Check if the curren fragment is the last fragment. * * \return true if the curren fragment is the last fragment, * false otherwise */ - bool IsLastFragment (void); + bool IsLastFragment (void) const; /** * Continue to the next fragment. This method simply * increments the internal variable that keep track diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index fd1c74822..622ff63fe 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -315,7 +315,7 @@ EdcaTxopN::GetBaAgreementExists (Mac48Address address, uint8_t tid) const } uint32_t -EdcaTxopN::GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid) +EdcaTxopN::GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid) const { return m_baManager->GetNBufferedPackets (address, tid); } @@ -447,7 +447,7 @@ EdcaTxopN::SetTxMiddle (MacTxMiddle *txMiddle) } Ptr -EdcaTxopN::Low (void) +EdcaTxopN::GetLow (void) const { return m_low; } @@ -1177,7 +1177,7 @@ EdcaTxopN::StartNextFragment (void) { params.EnableNextData (GetNextFragmentSize ()); } - Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); + GetLow ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); } void @@ -1218,19 +1218,19 @@ EdcaTxopN::StartNext (void) params.DisableRts (); } - if (GetTxopRemaining () >= Low ()->CalculateOverallTxTime (peekedPacket, &hdr, params)) + if (GetTxopRemaining () >= GetLow ()->CalculateOverallTxTime (peekedPacket, &hdr, params)) { NS_LOG_DEBUG ("start next packet"); m_currentPacket = m_queue->DequeueByTidAndAddress (&hdr, m_currentHdr.GetQosTid (), WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ()); - Low ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); + GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); } } Time -EdcaTxopN::GetTxopRemaining (void) +EdcaTxopN::GetTxopRemaining (void) const { Time remainingTxop = GetTxopLimit (); remainingTxop -= (Simulator::Now () - m_startTxop); @@ -1243,7 +1243,7 @@ EdcaTxopN::GetTxopRemaining (void) } bool -EdcaTxopN::HasTxop (void) +EdcaTxopN::HasTxop (void) const { NS_LOG_FUNCTION (this); WifiMacHeader hdr; @@ -1284,7 +1284,7 @@ EdcaTxopN::HasTxop (void) params.DisableRts (); } - return (GetTxopRemaining () >= Low ()->CalculateOverallTxTime (peekedPacket, &hdr, params)); + return (GetTxopRemaining () >= GetLow ()->CalculateOverallTxTime (peekedPacket, &hdr, params)); } void @@ -1327,7 +1327,7 @@ EdcaTxopN::NeedFragmentation (void) const } uint32_t -EdcaTxopN::GetFragmentSize (void) +EdcaTxopN::GetFragmentSize (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -1335,7 +1335,7 @@ EdcaTxopN::GetFragmentSize (void) } uint32_t -EdcaTxopN::GetNextFragmentSize (void) +EdcaTxopN::GetNextFragmentSize (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -1343,7 +1343,7 @@ EdcaTxopN::GetNextFragmentSize (void) } uint32_t -EdcaTxopN::GetFragmentOffset (void) +EdcaTxopN::GetFragmentOffset (void) const { NS_LOG_FUNCTION (this); return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr, diff --git a/src/wifi/model/edca-txop-n.h b/src/wifi/model/edca-txop-n.h index ff93e7ba7..d743de7cb 100644 --- a/src/wifi/model/edca-txop-n.h +++ b/src/wifi/model/edca-txop-n.h @@ -158,7 +158,7 @@ public: * * \return MacLow */ - Ptr Low (void); + Ptr GetLow (void) const; Ptr GetMsduAggregator (void) const; Ptr GetMpduAggregator (void) const; @@ -179,7 +179,7 @@ public: * * Returns number of packets buffered for a specified agreement. */ - uint32_t GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid); + uint32_t GetNOutstandingPacketsInBa (Mac48Address address, uint8_t tid) const; /** * \param recipient address of peer station involved in block ack mechanism. * \param tid traffic ID. @@ -332,19 +332,19 @@ public: * * \return the size of the next fragment */ - uint32_t GetNextFragmentSize (void); + uint32_t GetNextFragmentSize (void) const; /** * Calculate the size of the current fragment. * * \return the size of the current fragment */ - uint32_t GetFragmentSize (void); + uint32_t GetFragmentSize (void) const; /** * Calculate the offset for the current fragment. * * \return the offset for the current fragment */ - uint32_t GetFragmentOffset (void); + uint32_t GetFragmentOffset (void) const; /** * Check if the current fragment is the last fragment. * @@ -528,14 +528,14 @@ private: * * \return the remaining duration in the current TXOP */ - Time GetTxopRemaining (void); + Time GetTxopRemaining (void) const; /* * Check if the station has TXOP granted for the next MPDU. * * \return true if the station has TXOP granted for the next MPDU, * false otherwise */ - bool HasTxop (void); + bool HasTxop (void) const; AcIndex m_ac; class Dcf; diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index 6ce47269b..8c3ef7d2c 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -818,7 +818,7 @@ MacLow::StartTransmission (Ptr packet, } bool -MacLow::NeedRts (void) +MacLow::NeedRts (void) const { WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr, @@ -826,7 +826,7 @@ MacLow::NeedRts (void) } bool -MacLow::NeedCtsToSelf (void) +MacLow::NeedCtsToSelf (void) const { WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); return m_stationManager->NeedCtsToSelf (dataTxVector); @@ -2161,7 +2161,7 @@ MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMod } bool -MacLow::IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize) +MacLow::IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize) const { return ((seq - winstart + 4096) % 4096) < winsize; } diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index 81397ba0c..f51840a34 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -1007,14 +1007,14 @@ private: * \return true if RTS protection should be used, * false otherwise */ - bool NeedRts (void); + bool NeedRts (void) const; /** * Check if CTS-to-self mechanism should be used for the current packet. * * \return true if CTS-to-self mechanism should be used for the current packet, * false otherwise */ - bool NeedCtsToSelf (void); + bool NeedCtsToSelf (void) const; void NotifyNav (Ptr packet,const WifiMacHeader &hdr, WifiPreamble preamble); /** @@ -1183,7 +1183,7 @@ private: * \param winsize the size of the sequence number window (currently default is 64) * This method checks if the MPDU's sequence number is inside the scoreboard boundaries or not */ - bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize); + bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize) const; /** * This method updates the reorder buffer and the scoreboard when an MPDU is received in an HT station * and sotres the MPDU if needed when an MPDU is received in an non-HT Station (implements HT diff --git a/src/wifi/model/mac-rx-middle.cc b/src/wifi/model/mac-rx-middle.cc index 0605a0131..37e8c49eb 100644 --- a/src/wifi/model/mac-rx-middle.cc +++ b/src/wifi/model/mac-rx-middle.cc @@ -65,7 +65,7 @@ public: * \return true if we are de-fragmenting packets, * false otherwise */ - bool IsDeFragmenting (void) + bool IsDeFragmenting (void) const { return m_defragmenting; } @@ -124,7 +124,7 @@ public: * \return true if the sequence control is in order, * false otherwise */ - bool IsNextFragment (uint16_t sequenceControl) + bool IsNextFragment (uint16_t sequenceControl) const { if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4) && (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f) + 1)) @@ -141,7 +141,7 @@ public: * * \return the last sequence control */ - uint16_t GetLastSequenceControl (void) + uint16_t GetLastSequenceControl (void) const { return m_lastSequenceControl; } diff --git a/src/wifi/model/mpdu-aggregator.h b/src/wifi/model/mpdu-aggregator.h index 163d16b18..01c4110fb 100644 --- a/src/wifi/model/mpdu-aggregator.h +++ b/src/wifi/model/mpdu-aggregator.h @@ -58,15 +58,15 @@ public: * Adds packet to aggregatedPacket. In concrete aggregator's implementation is * specified how and if packet can be added to aggregatedPacket. */ - virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket) = 0; + virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket) const = 0; /** * This method performs a VHT single MPDU aggregation. */ - virtual void AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket) = 0; + virtual void AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket) const = 0; /** * Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent. */ - virtual void AddHeaderAndPad (Ptr packet, bool last, bool vhtSingleMpdu) = 0; + virtual void AddHeaderAndPad (Ptr packet, bool last, bool vhtSingleMpdu) const = 0; /** * \param packetSize size of the packet we want to insert into aggregatedPacket. * \param aggregatedPacket packet that will contain the packet of size packetSize, if aggregation is possible. @@ -76,14 +76,14 @@ public: * * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size. */ - virtual bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) = 0; + virtual bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) const = 0; /** * \return padding that must be added to the end of an aggregated packet * * Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added. * Each A-MPDU subframe is padded so that its length is multiple of 4 octets. */ - virtual uint32_t CalculatePadding (Ptr packet) = 0; + virtual uint32_t CalculatePadding (Ptr packet) const = 0; /** * Deaggregates an A-MPDU by removing the A-MPDU subframe header and padding. * diff --git a/src/wifi/model/mpdu-standard-aggregator.cc b/src/wifi/model/mpdu-standard-aggregator.cc index c69a73d81..a1f436ce5 100644 --- a/src/wifi/model/mpdu-standard-aggregator.cc +++ b/src/wifi/model/mpdu-standard-aggregator.cc @@ -64,7 +64,7 @@ MpduStandardAggregator::GetMaxAmpduSize (void) const } bool -MpduStandardAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket) +MpduStandardAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket) const { NS_LOG_FUNCTION (this); Ptr currentPacket; @@ -93,7 +93,7 @@ MpduStandardAggregator::Aggregate (Ptr packet, Ptr aggrega } void -MpduStandardAggregator::AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket) +MpduStandardAggregator::AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket) const { NS_LOG_FUNCTION (this); Ptr currentPacket; @@ -117,7 +117,7 @@ MpduStandardAggregator::AggregateVhtSingleMpdu (Ptr packet, Ptr packet, bool last, bool vhtSingleMpdu) +MpduStandardAggregator::AddHeaderAndPad (Ptr packet, bool last, bool vhtSingleMpdu) const { NS_LOG_FUNCTION (this); AmpduSubframeHeader currentHdr; @@ -143,7 +143,7 @@ MpduStandardAggregator::AddHeaderAndPad (Ptr packet, bool last, bool vht } bool -MpduStandardAggregator::CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) +MpduStandardAggregator::CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) const { uint32_t padding = CalculatePadding (aggregatedPacket); uint32_t actualSize = aggregatedPacket->GetSize (); @@ -162,7 +162,7 @@ MpduStandardAggregator::CanBeAggregated (uint32_t packetSize, Ptr aggreg } uint32_t -MpduStandardAggregator::CalculatePadding (Ptr packet) +MpduStandardAggregator::CalculatePadding (Ptr packet) const { return (4 - (packet->GetSize () % 4 )) % 4; } diff --git a/src/wifi/model/mpdu-standard-aggregator.h b/src/wifi/model/mpdu-standard-aggregator.h index 5480807e0..41596cbc9 100644 --- a/src/wifi/model/mpdu-standard-aggregator.h +++ b/src/wifi/model/mpdu-standard-aggregator.h @@ -49,15 +49,15 @@ public: * This method performs an MPDU aggregation. * Returns true if packet can be aggregated to aggregatedPacket, false otherwise. */ - virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket); + virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket) const; /** * This method performs a VHT single MPDU aggregation. */ - virtual void AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket); + virtual void AggregateVhtSingleMpdu (Ptr packet, Ptr aggregatedPacket) const; /** * Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent. */ - virtual void AddHeaderAndPad (Ptr packet, bool last, bool vhtSingleMpdu); + virtual void AddHeaderAndPad (Ptr packet, bool last, bool vhtSingleMpdu) const; /** * \param packetSize size of the packet we want to insert into aggregatedPacket. * \param aggregatedPacket packet that will contain the packet of size packetSize, if aggregation is possible. @@ -68,14 +68,14 @@ public: * * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size. */ - virtual bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize); + virtual bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize) const; /** * \return padding that must be added to the end of an aggregated packet * * Calculates how much padding must be added to the end of an aggregated packet, after that a new packet is added. * Each A-MPDU subframe is padded so that its length is multiple of 4 octets. */ - virtual uint32_t CalculatePadding (Ptr packet); + virtual uint32_t CalculatePadding (Ptr packet) const; private: diff --git a/src/wifi/model/msdu-aggregator.h b/src/wifi/model/msdu-aggregator.h index 7bcb05c55..3d8d29127 100644 --- a/src/wifi/model/msdu-aggregator.h +++ b/src/wifi/model/msdu-aggregator.h @@ -49,7 +49,7 @@ public: * can be added returns true, false otherwise. */ virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket, - Mac48Address src, Mac48Address dest) = 0; + Mac48Address src, Mac48Address dest) const = 0; static DeaggregatedMsdus Deaggregate (Ptr aggregatedPacket); }; diff --git a/src/wifi/model/msdu-standard-aggregator.cc b/src/wifi/model/msdu-standard-aggregator.cc index 748fe6ffd..0e88f8e37 100644 --- a/src/wifi/model/msdu-standard-aggregator.cc +++ b/src/wifi/model/msdu-standard-aggregator.cc @@ -65,7 +65,7 @@ MsduStandardAggregator::GetMaxAmsduSize (void) const bool MsduStandardAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket, - Mac48Address src, Mac48Address dest) + Mac48Address src, Mac48Address dest) const { NS_LOG_FUNCTION (this); Ptr currentPacket; @@ -94,7 +94,7 @@ MsduStandardAggregator::Aggregate (Ptr packet, Ptr aggrega } uint32_t -MsduStandardAggregator::CalculatePadding (Ptr packet) +MsduStandardAggregator::CalculatePadding (Ptr packet) const { return (4 - (packet->GetSize () % 4 )) % 4; } diff --git a/src/wifi/model/msdu-standard-aggregator.h b/src/wifi/model/msdu-standard-aggregator.h index bb99b381b..fff679fb8 100644 --- a/src/wifi/model/msdu-standard-aggregator.h +++ b/src/wifi/model/msdu-standard-aggregator.h @@ -52,7 +52,7 @@ public: * Returns true if packet can be aggregated to aggregatedPacket, false otherwise. */ virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket, - Mac48Address src, Mac48Address dest); + Mac48Address src, Mac48Address dest) const; private: /** * Calculates how much padding must be added to the end of aggregated packet, @@ -63,7 +63,7 @@ private: * * \return the number of octets required for padding */ - uint32_t CalculatePadding (Ptr packet); + uint32_t CalculatePadding (Ptr packet) const; uint32_t m_maxAmsduLength; }; diff --git a/src/wifi/model/wifi-mode.cc b/src/wifi/model/wifi-mode.cc index 7372c69af..3ae74cd0e 100644 --- a/src/wifi/model/wifi-mode.cc +++ b/src/wifi/model/wifi-mode.cc @@ -599,7 +599,7 @@ WifiModeFactory::CreateWifiMcs (std::string uniqueName, } WifiMode -WifiModeFactory::Search (std::string name) +WifiModeFactory::Search (std::string name) const { WifiModeItemList::const_iterator i; uint32_t j = 0; diff --git a/src/wifi/model/wifi-mode.h b/src/wifi/model/wifi-mode.h index fb358b307..f432e8112 100644 --- a/src/wifi/model/wifi-mode.h +++ b/src/wifi/model/wifi-mode.h @@ -313,7 +313,7 @@ private: * * \return WifiMode */ - WifiMode Search (std::string name); + WifiMode Search (std::string name) const; /** * Allocate a WifiModeItem from a given uniqueUid. * diff --git a/src/wifi/model/wifi-phy-state-helper.cc b/src/wifi/model/wifi-phy-state-helper.cc index 54086c965..7d5d2967b 100644 --- a/src/wifi/model/wifi-phy-state-helper.cc +++ b/src/wifi/model/wifi-phy-state-helper.cc @@ -101,55 +101,55 @@ WifiPhyStateHelper::UnregisterListener (WifiPhyListener *listener) } bool -WifiPhyStateHelper::IsStateIdle (void) +WifiPhyStateHelper::IsStateIdle (void) const { return (GetState () == WifiPhy::IDLE); } bool -WifiPhyStateHelper::IsStateBusy (void) +WifiPhyStateHelper::IsStateBusy (void) const { return (GetState () != WifiPhy::IDLE); } bool -WifiPhyStateHelper::IsStateCcaBusy (void) +WifiPhyStateHelper::IsStateCcaBusy (void) const { return (GetState () == WifiPhy::CCA_BUSY); } bool -WifiPhyStateHelper::IsStateRx (void) +WifiPhyStateHelper::IsStateRx (void) const { return (GetState () == WifiPhy::RX); } bool -WifiPhyStateHelper::IsStateTx (void) +WifiPhyStateHelper::IsStateTx (void) const { return (GetState () == WifiPhy::TX); } bool -WifiPhyStateHelper::IsStateSwitching (void) +WifiPhyStateHelper::IsStateSwitching (void) const { return (GetState () == WifiPhy::SWITCHING); } bool -WifiPhyStateHelper::IsStateSleep (void) +WifiPhyStateHelper::IsStateSleep (void) const { return (GetState () == WifiPhy::SLEEP); } Time -WifiPhyStateHelper::GetStateDuration (void) +WifiPhyStateHelper::GetStateDuration (void) const { return Simulator::Now () - m_previousStateChangeTime; } Time -WifiPhyStateHelper::GetDelayUntilIdle (void) +WifiPhyStateHelper::GetDelayUntilIdle (void) const { Time retval; @@ -190,7 +190,7 @@ WifiPhyStateHelper::GetLastRxStartTime (void) const } WifiPhy::State -WifiPhyStateHelper::GetState (void) +WifiPhyStateHelper::GetState (void) const { if (m_sleeping) { diff --git a/src/wifi/model/wifi-phy-state-helper.h b/src/wifi/model/wifi-phy-state-helper.h index b3382ce1a..d9ca56bd9 100644 --- a/src/wifi/model/wifi-phy-state-helper.h +++ b/src/wifi/model/wifi-phy-state-helper.h @@ -67,61 +67,61 @@ public: * * \return the current state of WifiPhy */ - WifiPhy::State GetState (void); + WifiPhy::State GetState (void) const; /** * Check whether the current state is CCA busy. * * \return true if the current state is CCA busy, false otherwise */ - bool IsStateCcaBusy (void); + bool IsStateCcaBusy (void) const; /** * Check whether the current state is IDLE. * * \return true if the current state is IDLE, false otherwise */ - bool IsStateIdle (void); + bool IsStateIdle (void) const; /** * Check whether the current state is not IDLE. * * \return true if the current state is not IDLE, false otherwise */ - bool IsStateBusy (void); + bool IsStateBusy (void) const; /** * Check whether the current state is RX. * * \return true if the current state is RX, false otherwise */ - bool IsStateRx (void); + bool IsStateRx (void) const; /** * Check whether the current state is TX. * * \return true if the current state is TX, false otherwise */ - bool IsStateTx (void); + bool IsStateTx (void) const; /** * Check whether the current state is SWITCHING. * * \return true if the current state is SWITCHING, false otherwise */ - bool IsStateSwitching (void); + bool IsStateSwitching (void) const; /** * Check whether the current state is SLEEP. * * \return true if the current state is SLEEP, false otherwise */ - bool IsStateSleep (void); + bool IsStateSleep (void) const; /** * Return the elapsed time of the current state. * * \return the elapsed time of the current state */ - Time GetStateDuration (void); + Time GetStateDuration (void) const; /** * Return the time before the state is back to IDLE. * * \return the delay before the state is back to IDLE */ - Time GetDelayUntilIdle (void); + Time GetDelayUntilIdle (void) const; /** * Return the time the last RX start. * diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 6674b67cb..654e0921b 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -657,7 +657,7 @@ WifiPhy::SetMobility (Ptr mobility) } Ptr -WifiPhy::GetMobility (void) +WifiPhy::GetMobility (void) const { if (m_mobility != 0) { diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index dfdfcdca7..17a1f45a1 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -1399,7 +1399,7 @@ public: * * \return the mobility model this PHY is associated with */ - Ptr GetMobility (void); + Ptr GetMobility (void) const; /** * \param freq the operating center frequency (MHz) on this node.