Code cleanup for merge into the mainline
authorPavel Boyko <boyko@iitp.ru>
Fri, 03 Jul 2009 12:02:30 +0400
changeset 5102 0bb1dd1c301d
parent 5101 41589d492ca3
child 5103 e0fff8a36c03
Code cleanup for merge into the mainline
.hgignore
doc/doxygen.conf
src/applications/udp-echo/udp-echo-client.cc
src/applications/udp-echo/udp-echo-client.h
src/applications/udp-echo/udp-echo-server.cc
src/applications/udp-echo/udp-echo-server.h
src/devices/wifi/dca-txop.h
src/devices/wifi/mgt-headers.cc
src/devices/wifi/mgt-headers.h
src/devices/wifi/wifi-mac-header.cc
src/devices/wifi/wifi-remote-station-manager.cc
src/devices/wifi/wifi-remote-station-manager.h
src/devices/wifi/yans-wifi-channel.cc
src/devices/wifi/yans-wifi-phy.cc
src/devices/wifi/yans-wifi-phy.h
--- a/.hgignore	Fri Jul 03 10:10:25 2009 +0400
+++ b/.hgignore	Fri Jul 03 12:02:30 2009 +0400
@@ -11,7 +11,6 @@
 ^doc/introspected-doxygen\.h$
 .*\.py[co]$
 \.pcap$
-\.xml$
 \.mob$
 ^doc/manual/manual/
 doc/manual/manual.aux
--- a/doc/doxygen.conf	Fri Jul 03 10:10:25 2009 +0400
+++ b/doc/doxygen.conf	Fri Jul 03 12:02:30 2009 +0400
@@ -300,7 +300,7 @@
 # If set to NO (the default) these classes will be included in the various 
 # overviews. This option has no effect if EXTRACT_ALL is enabled.
 
-HIDE_UNDOC_CLASSES     = NO
+HIDE_UNDOC_CLASSES     = YES
 
 # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
 # friend (class|struct|union) declarations. 
--- a/src/applications/udp-echo/udp-echo-client.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-client.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -97,7 +97,6 @@
 UdpEchoClient::DoDispose (void)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  NS_LOG_UNCOND("TOTAL SENT:"<<m_sent);
   Application::DoDispose ();
 }
 
--- a/src/applications/udp-echo/udp-echo-client.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-client.h	Fri Jul 03 12:02:30 2009 +0400
@@ -51,7 +51,7 @@
    * to the server).  The contents of the data are set to unspecified (don't
    * care) by this call.
    *
-   * \warning If you have set the fill data for the echo client using one of the
+   * \warn If you have set the fill data for the echo client using one of the
    * SetFill calls, this will undo those effects.
    *
    * \param dataSize The size of the echo data you want to sent.
@@ -61,7 +61,7 @@
   /**
    * Get the number of data bytes that will be sent to the server.
    *
-   * \warning The number of bytes may be modified by calling any one of the 
+   * \warn The number of bytes may be modified by calling any one of the 
    * SetFill methods.  If you have called SetFill, then the number of 
    * data bytes will correspond to the size of an initialized data buffer.
    * If you have not called a SetFill method, the number of data bytes will
@@ -75,7 +75,7 @@
    * Set the data fill of the packet (what is sent as data to the server) to 
    * the zero-terminated contents of the fill string string.
    *
-   * \warning The size of resulting echo packets will be automatically adjusted
+   * \warn The size of resulting echo packets will be automatically adjusted
    * to reflect the size of the fill string -- this means that the PacketSize
    * attribute may be changed as a result of this call.
    *
@@ -88,7 +88,7 @@
    * the repeated contents of the fill byte.  i.e., the fill byte will be 
    * used to initialize the contents of the data packet.
    * 
-   * \warning The size of resulting echo packets will be automatically adjusted
+   * \warn The size of resulting echo packets will be automatically adjusted
    * to reflect the dataSize parameter -- this means that the PacketSize
    * attribute may be changed as a result of this call.
    *
@@ -105,7 +105,7 @@
    * accomplished by setting the fillSize set to your desired dataSize
    * (and providing an appropriate buffer).
    *
-   * \warning The size of resulting echo packets will be automatically adjusted
+   * \warn The size of resulting echo packets will be automatically adjusted
    * to reflect the dataSize parameter -- this means that the PacketSize
    * attribute of the Application may be changed as a result of this call.
    *
--- a/src/applications/udp-echo/udp-echo-server.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-server.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -52,13 +52,11 @@
 UdpEchoServer::UdpEchoServer ()
 {
   NS_LOG_FUNCTION_NOARGS ();
-  m_received = 0;
 }
 
 UdpEchoServer::~UdpEchoServer()
 {
   NS_LOG_FUNCTION_NOARGS ();
-  NS_LOG_UNCOND("Total received:"<<m_received);
   m_socket = 0;
 }
 
@@ -120,12 +118,11 @@
       if (InetSocketAddress::IsMatchingType (from))
         {
           InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
-          m_received ++;
           NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << 
             address.GetIpv4());
 
           packet->RemoveAllPacketTags ();
-	  packet->RemoveAllByteTags ();
+          packet->RemoveAllByteTags ();
 
           NS_LOG_LOGIC ("Echoing packet");
           socket->SendTo (packet, 0, from);
--- a/src/applications/udp-echo/udp-echo-server.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-server.h	Fri Jul 03 12:02:30 2009 +0400
@@ -60,7 +60,6 @@
   uint16_t m_port;
   Ptr<Socket> m_socket;
   Address m_local;
-  uint32_t m_received;
 };
 
 } // namespace ns3
--- a/src/devices/wifi/dca-txop.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/dca-txop.h	Fri Jul 03 12:02:30 2009 +0400
@@ -164,7 +164,6 @@
   bool m_accessOngoing;
   Ptr<const Packet> m_currentPacket;
   WifiMacHeader m_currentHdr;
-  uint8_t m_currentRetry;
   uint8_t m_fragmentNumber;
 };
 
--- a/src/devices/wifi/mgt-headers.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/mgt-headers.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -108,11 +108,10 @@
 {}
 MgtProbeResponseHeader::~MgtProbeResponseHeader ()
 {}
-
 uint64_t
 MgtProbeResponseHeader::GetTimestamp()
 {
-	return m_timestamp;
+  return m_timestamp;
 }
 Ssid 
 MgtProbeResponseHeader::GetSsid (void) const
--- a/src/devices/wifi/mgt-headers.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/mgt-headers.h	Fri Jul 03 12:02:30 2009 +0400
@@ -21,7 +21,6 @@
 #define MGT_HEADERS_H
 
 #include <stdint.h>
-//#include <vector>
 
 #include "ns3/header.h"
 #include "status-code.h"
@@ -117,9 +116,7 @@
   void SetSsid (Ssid ssid);
   void SetBeaconIntervalUs (uint64_t us);
   void SetSupportedRates (SupportedRates rates);
-
   uint64_t GetTimestamp();
-
   static TypeId GetTypeId (void);
   virtual TypeId GetInstanceTypeId (void) const;
   virtual void Print (std::ostream &os) const;
--- a/src/devices/wifi/wifi-mac-header.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/wifi-mac-header.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -128,21 +128,18 @@
   m_ctrlType = TYPE_DATA;
   m_ctrlSubtype = 0;
 }
-
 void
 WifiMacHeader::SetAction (void)
 {
  m_ctrlType = TYPE_MGT;
  m_ctrlSubtype = 0x0D;
 }
-
 void
 WifiMacHeader::SetMultihopAction (void)
 {
  m_ctrlType = TYPE_MGT;
  m_ctrlSubtype = 0x0F;
 }
-
 void 
 WifiMacHeader::SetType (enum WifiMacType type)
 {
--- a/src/devices/wifi/wifi-remote-station-manager.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/wifi-remote-station-manager.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -435,7 +435,7 @@
     m_ssrc (0),
     m_slrc (0),
     m_avgSlrcCoefficient(0.9),
-    m_avgSlrc (0.0)
+    m_avgSlrc (0)
 {}
 WifiRemoteStation::~WifiRemoteStation ()
 {}
@@ -560,7 +560,7 @@
   return GetControlAnswerMode (dataMode);
 }
 double
-WifiRemoteStation::GetAvgSlrc ()
+WifiRemoteStation::GetAvgSlrc () const
 {
   return m_avgSlrc;
 }
--- a/src/devices/wifi/wifi-remote-station-manager.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/wifi-remote-station-manager.h	Fri Jul 03 12:02:30 2009 +0400
@@ -260,7 +260,10 @@
    *          handshake.
    */
   WifiMode GetAckMode (WifiMode dataMode);
-  double GetAvgSlrc ();
+  /**
+   * \return exponentially weighted average SLRC, this is used by Airtime link metric of 802.11s
+   */
+  double GetAvgSlrc () const;
 private:
   virtual Ptr<WifiRemoteStationManager> GetManager (void) const = 0;
   virtual WifiMode DoGetDataMode (uint32_t size) = 0;
@@ -289,13 +292,8 @@
   SupportedModes m_modes;
   TracedValue<uint32_t> m_ssrc;
   TracedValue<uint32_t> m_slrc;
-  ///\name needed to calculate average SLRC
-  ///\{
-  ///\brief the coefficient: we valculate averages slrc as 
-  //m_avgSlrc = m_avgSlr*coefficient + m_slrc*(1-coefficient);
   double m_avgSlrcCoefficient;
   double m_avgSlrc;
-  ///\}
 };
 
 } // namespace ns3 
--- a/src/devices/wifi/yans-wifi-channel.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/yans-wifi-channel.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -74,9 +74,6 @@
 YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
                        WifiMode wifiMode, WifiPreamble preamble) const
 {
-  NS_LOG_DEBUG ("I am on channel "  << sender->GetFrequencyChannel()
-                << " : sending " << packet->GetUid ());
-  
   Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
   NS_ASSERT (senderMobility != 0);
   uint32_t j = 0;
@@ -84,14 +81,9 @@
     { 
       if (sender != (*i))
         {
-          // For now don't account for interchannel interference
+          // For now don't account for inter channel interference
           if ((*i)->GetFrequencyChannel() != sender->GetFrequencyChannel())
-            {
-              NS_LOG_DEBUG ("Dropped: " << (*i)->GetFrequencyChannel() 
-                            << " != " << sender->GetFrequencyChannel() );
               continue;
-            }
-          NS_LOG_DEBUG ("Passed to receiver");
           
           Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
           Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
--- a/src/devices/wifi/yans-wifi-phy.cc	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/yans-wifi-phy.cc	Fri Jul 03 12:02:30 2009 +0400
@@ -126,10 +126,9 @@
 }
 
 YansWifiPhy::YansWifiPhy ()
-  :  m_channelFreqMhz(2437),
-     m_endSyncEvent (),
+  :  m_endSyncEvent (),
      m_random (0.0, 1.0),
-     m_channelStartingFrequency(0.0)
+     m_channelStartingFrequency (0)
 {
   NS_LOG_FUNCTION (this);
   m_state = CreateObject<WifiPhyStateHelper> ();
@@ -305,7 +304,7 @@
 {
   m_channel = channel;
   m_channel->Add (this);
-  m_channelId = 0;      // always start on channel starting frequency
+  m_channelId = 1;      // always start on channel starting frequency (channel 1)
 }
 
 void 
@@ -328,9 +327,9 @@
 }
 
 double
-YansWifiPhy::GetChannelCenterFrequency() const
+YansWifiPhy::GetCenterFrequencyMhz() const
 {
-  return m_channelStartingFrequency + 5e6 * GetFrequencyChannel();
+  return m_channelStartingFrequency + 5 * (GetFrequencyChannel() - 1);
 }
 
 void 
@@ -444,7 +443,7 @@
   NotifyTxBegin (packet);
   uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;   
   bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
-  NotifyPromiscSniffTx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble);
+  NotifyPromiscSniffTx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble);
   m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
   m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
 }
@@ -470,7 +469,7 @@
 {
   NS_LOG_FUNCTION (this);
   m_interference.Configure80211aParameters ();
-  m_channelStartingFrequency = 5e9; // 5 GHz 
+  m_channelStartingFrequency = 5e3; // 5.000 GHz 
   m_modes.push_back (WifiPhy::Get6mba ());
   m_modes.push_back (WifiPhy::Get9mba ());
   m_modes.push_back (WifiPhy::Get12mba ());
@@ -487,6 +486,7 @@
 {
   NS_LOG_FUNCTION (this);
   m_interference.Configure80211bParameters ();
+  m_channelStartingFrequency = 2412; // 2.412 GHz 
   m_modes.push_back (WifiPhy::Get1mbb ());
   m_modes.push_back (WifiPhy::Get2mbb ());
   m_modes.push_back (WifiPhy::Get5_5mbb ());
@@ -498,6 +498,7 @@
 {
   NS_LOG_FUNCTION (this);
   m_interference.Configure80211aParameters ();
+  m_channelStartingFrequency = 5e3; // 5.000 GHz 
   m_modes.push_back (WifiPhy::Get6mba ());
   m_modes.push_back (WifiPhy::Get12mba ());
   m_modes.push_back (WifiPhy::Get18mba ());
@@ -621,7 +622,7 @@
       bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());  
       double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
       double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ;
-      NotifyPromiscSniffRx (packet, m_channelFreqMhz, dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
+      NotifyPromiscSniffRx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
       m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
     } 
   else 
--- a/src/devices/wifi/yans-wifi-phy.h	Fri Jul 03 10:10:25 2009 +0400
+++ b/src/devices/wifi/yans-wifi-phy.h	Fri Jul 03 12:02:30 2009 +0400
@@ -73,7 +73,7 @@
   /** 
    * \brief Set channel number. 
    * 
-   * Channel center frequency = Channel starting frequency + 5 × nch (MHz)
+   * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
    *
    * where Starting channel frequency is standard-dependent, see SetStandard()
    * as defined in IEEE 802.11-2007 17.3.8.3.2.
@@ -81,8 +81,8 @@
   void SetFrequencyChannel (uint16_t id);
   /// Return current channel ID, see SetChannelId()
   uint16_t GetFrequencyChannel () const;
-  /// Return current center channel frequency in Hz, see SetChannelId()
-  double GetChannelCenterFrequency() const;
+  /// Return current center channel frequency in MHz, see SetFrequencyChannel()
+  double GetCenterFrequencyMhz() const;
   
   void StartReceivePacket (Ptr<Packet> packet,
                            double rxPowerDbm,
@@ -160,7 +160,6 @@
   double   m_txPowerBaseDbm;
   double   m_txPowerEndDbm;
   uint32_t m_nTxPower;
-  uint16_t m_channelFreqMhz;
 
   Ptr<YansWifiChannel> m_channel;
   uint16_t m_channelId;
@@ -170,7 +169,7 @@
   EventId m_endSyncEvent;
   UniformVariable m_random;
   WifiPhyStandard m_standard;
-  /// Standard-dependent center frequency of 0-th channel 
+  /// Standard-dependent center frequency of 0-th channel, MHz 
   double m_channelStartingFrequency;
   Ptr<WifiPhyStateHelper> m_state;
   InterferenceHelper m_interference;