debug to log
authorCraig Dowell <craigdo@ee.washington.edu>
Thu, 13 Sep 2007 21:36:32 -0700
changeset 1505 286ec92f4113
parent 1504 36ecc970ba96
child 1506 3c8b23550e6a
debug to log
src/internet-node/arp-ipv4-interface.cc
src/internet-node/arp-l3-protocol.cc
src/node/channel.cc
src/node/drop-tail-queue.cc
src/node/ethernet-header.cc
src/node/ethernet-trailer.cc
src/node/ipv4-address.cc
src/node/net-device.cc
src/node/packet-socket.cc
src/node/queue.cc
src/node/socket.cc
src/routing/global-routing/candidate-queue.cc
src/routing/global-routing/global-route-manager-impl.cc
src/routing/global-routing/global-route-manager.cc
src/routing/global-routing/global-router-interface.cc
--- a/src/internet-node/arp-ipv4-interface.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/internet-node/arp-ipv4-interface.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -21,7 +21,7 @@
  */
 
 #include "ns3/packet.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/composite-trace-resolver.h"
 #include "ns3/node.h"
 #include "ns3/net-device.h"
@@ -31,7 +31,7 @@
 #include "ipv4-l3-protocol.h"
 #include "arp-l3-protocol.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("ArpIpv4Interface");
+NS_LOG_COMPONENT_DEFINE ("ArpIpv4Interface");
 
 namespace ns3 {
 
@@ -39,18 +39,18 @@
   : Ipv4Interface (device),
     m_node (node)
 {
-  NS_DEBUG ("ArpIpv4Interface::ArpIpv4Interface ()");
+  NS_LOG_FUNCTION;
 }
 
 ArpIpv4Interface::~ArpIpv4Interface ()
 {
-  NS_DEBUG ("ArpIpv4Interface::~ArpIpv4Interface ()");
+  NS_LOG_FUNCTION;
 }
 
 Ptr<TraceResolver>
 ArpIpv4Interface::GetTraceResolver (void) const
 {
-  NS_DEBUG ("ArpIpv4Interface::DoCreateTraceResolver ()");
+  NS_LOG_FUNCTION;
   Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
   if (GetDevice () != 0)
     {
@@ -63,12 +63,13 @@
 void 
 ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest)
 {
-  NS_DEBUG ("ArpIpv4Interface::SendTo (" << &p << ", " << dest << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ", " << dest << ")");
 
   NS_ASSERT (GetDevice () != 0);
   if (GetDevice ()->NeedsArp ())
     {
-      NS_DEBUG ("ArpIpv4Interface::SendTo (): Needs ARP");
+      NS_LOG_LOGIC ("Needs ARP");
       Ptr<ArpL3Protocol> arp = 
         m_node->QueryInterface<ArpL3Protocol> (ArpL3Protocol::iid);
       Address hardwareDestination;
@@ -77,13 +78,13 @@
       if (dest.IsBroadcast () || 
           dest.IsSubnetDirectedBroadcast (GetNetworkMask ()) )
         {
-          NS_DEBUG ("ArpIpv4Interface::SendTo (): IsBroadcast");
+          NS_LOG_LOGIC ("IsBroadcast");
           hardwareDestination = GetDevice ()->GetBroadcast ();
           found = true;
         }
       else if (dest.IsMulticast ())
         {
-          NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast");
+          NS_LOG_LOGIC ("IsMulticast");
           NS_ASSERT_MSG(GetDevice ()->IsMulticast (),
             "ArpIpv4Interface::SendTo (): Sending multicast packet over "
             "non-multicast device");
@@ -93,20 +94,20 @@
         }
       else
         {
-          NS_DEBUG ("ArpIpv4Interface::SendTo (): ARP Lookup");
+          NS_LOG_LOGIC ("ARP Lookup");
           found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination);
         }
 
       if (found)
         {
-          NS_DEBUG ("ArpIpv4Interface::SendTo (): Address Resolved.  Send.");
+          NS_LOG_LOGIC ("Address Resolved.  Send.");
           GetDevice ()->Send (p, hardwareDestination, 
             Ipv4L3Protocol::PROT_NUMBER);
         }
     }
   else
     {
-      NS_DEBUG ("ArpIpv4Interface::SendTo (): Doesn't need ARP");
+      NS_LOG_LOGIC ("Doesn't need ARP");
       GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), 
         Ipv4L3Protocol::PROT_NUMBER);
     }
--- a/src/internet-node/arp-l3-protocol.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/internet-node/arp-l3-protocol.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "ns3/packet.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/node.h"
 #include "ns3/net-device.h"
 
@@ -29,7 +29,7 @@
 #include "arp-cache.h"
 #include "ipv4-interface.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("ArpL3Protocol");
+NS_LOG_COMPONENT_DEFINE ("ArpL3Protocol");
 
 namespace ns3 {
 
@@ -39,15 +39,19 @@
 ArpL3Protocol::ArpL3Protocol (Ptr<Node> node)
   : m_node (node)
 {
+  NS_LOG_FUNCTION;
   SetInterfaceId (ArpL3Protocol::iid);
 }
 
 ArpL3Protocol::~ArpL3Protocol ()
-{}
+{
+  NS_LOG_FUNCTION;
+}
 
 void 
 ArpL3Protocol::DoDispose (void)
 {
+  NS_LOG_FUNCTION;
   for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++)
     {
       delete *i;
@@ -60,6 +64,7 @@
 ArpCache *
 ArpL3Protocol::FindCache (Ptr<NetDevice> device)
 {
+  NS_LOG_FUNCTION;
   for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++)
     {
       if ((*i)->GetDevice () == device)
@@ -79,12 +84,13 @@
 void 
 ArpL3Protocol::Receive(Ptr<NetDevice> device, const Packet& p, uint16_t protocol, const Address &from)
 {
+  NS_LOG_FUNCTION;
   ArpCache *cache = FindCache (device);
   ArpHeader arp;
   Packet packet = p;
   packet.RemoveHeader (arp);
   
-  NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") <<
+  NS_LOG_LOGIC ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") <<
             " node="<<m_node->GetId ()<<", got request from " <<
             arp.GetSourceIpv4Address () << " for address " <<
             arp.GetDestinationIpv4Address () << "; we have address " <<
@@ -93,7 +99,7 @@
   if (arp.IsRequest () && 
       arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ()) 
     {
-      NS_DEBUG ("node="<<m_node->GetId () <<", got request from " << 
+      NS_LOG_LOGIC ("node="<<m_node->GetId () <<", got request from " << 
                 arp.GetSourceIpv4Address () << " -- send reply");
       SendArpReply (cache, arp.GetSourceIpv4Address (),
                     arp.GetSourceHardwareAddress ());
@@ -108,7 +114,7 @@
         {
           if (entry->IsWaitReply ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<", got reply from " << 
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply from " << 
                         arp.GetSourceIpv4Address ()
                      << " for waiting entry -- flush");
               Address from_mac = arp.GetSourceHardwareAddress ();
@@ -119,7 +125,7 @@
             {
               // ignore this reply which might well be an attempt 
               // at poisening my arp cache.
-              NS_DEBUG ("node="<<m_node->GetId ()<<", got reply from " << 
+              NS_LOG_LOGIC("node="<<m_node->GetId ()<<", got reply from " << 
                         arp.GetSourceIpv4Address () << 
                         " for non-waiting entry -- drop");
 	      // XXX report packet as dropped.
@@ -127,13 +133,13 @@
         } 
       else 
         {
-          NS_DEBUG ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop");
+          NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop");
 	  // XXX report packet as dropped.
         }
     }
   else
     {
-      NS_DEBUG ("node="<<m_node->GetId ()<<", got request from " <<
+      NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got request from " <<
                 arp.GetSourceIpv4Address () << " for unknown address " <<
                 arp.GetDestinationIpv4Address () << " -- drop");
     }
@@ -143,6 +149,7 @@
                        Ptr<NetDevice> device,
                        Address *hardwareDestination)
 {
+  NS_LOG_FUNCTION;
   ArpCache *cache = FindCache (device);
   ArpCache::Entry *entry = cache->Lookup (destination);
   if (entry != 0)
@@ -151,21 +158,21 @@
         {
           if (entry->IsDead ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", dead entry for " << destination << " expired -- send arp request");
               entry->MarkWaitReply (packet);
               SendArpRequest (cache, destination);
             } 
           else if (entry->IsAlive ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", alive entry for " << destination << " expired -- send arp request");
               entry->MarkWaitReply (packet);
               SendArpRequest (cache, destination);
             } 
           else if (entry->IsWaitReply ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", wait reply for " << destination << " expired -- drop");
               entry->MarkDead ();
 	      // XXX report packet as 'dropped'
@@ -175,20 +182,20 @@
         {
           if (entry->IsDead ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", dead entry for " << destination << " valid -- drop");
 	      // XXX report packet as 'dropped'
             } 
           else if (entry->IsAlive ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", alive entry for " << destination << " valid -- send");
 	      *hardwareDestination = entry->GetMacAddress ();
               return true;
             } 
           else if (entry->IsWaitReply ()) 
             {
-              NS_DEBUG ("node="<<m_node->GetId ()<<
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                         ", wait reply for " << destination << " valid -- drop previous");
               Packet old = entry->UpdateWaitReply (packet);
 	      // XXX report 'old' packet as 'dropped'
@@ -199,7 +206,7 @@
   else
     {
       // This is our first attempt to transmit data to this destination.
-      NS_DEBUG ("node="<<m_node->GetId ()<<
+      NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
                 ", no entry for " << destination << " -- send arp request");
       entry = cache->Add (destination);
       entry->MarkWaitReply (packet);
@@ -211,8 +218,9 @@
 void
 ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to)
 {
+  NS_LOG_FUNCTION;
   ArpHeader arp;
-  NS_DEBUG ("ARP: sending request from node "<<m_node->GetId ()<<
+  NS_LOG_LOGIC ("ARP: sending request from node "<<m_node->GetId ()<<
             " || src: " << cache->GetDevice ()->GetAddress () <<
             " / " << cache->GetInterface ()->GetAddress () <<
             " || dst: " << cache->GetDevice ()->GetBroadcast () <<
@@ -229,8 +237,9 @@
 void
 ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac)
 {
+  NS_LOG_FUNCTION;
   ArpHeader arp;
-  NS_DEBUG ("ARP: sending reply from node "<<m_node->GetId ()<<
+  NS_LOG_LOGIC ("ARP: sending reply from node "<<m_node->GetId ()<<
             "|| src: " << cache->GetDevice ()->GetAddress () << 
             " / " << cache->GetInterface ()->GetAddress () <<
             " || dst: " << toMac << " / " << toIp);
--- a/src/node/channel.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/channel.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -14,16 +14,12 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *	Thu Feb 15 14:50:46 PST 2007 craigdo: Created.
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "channel.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("Channel");
+NS_LOG_COMPONENT_DEFINE ("Channel");
 
 namespace ns3 {
 
@@ -32,31 +28,35 @@
 Channel::Channel ()
   : m_name("Channel")
 {
+  NS_LOG_FUNCTION;
   SetInterfaceId (Channel::iid);
-  NS_DEBUG("Channel::Channel ()");
 }
 
 Channel::Channel (std::string name)
   : m_name(name)
 {
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << name << ")");
   SetInterfaceId (Channel::iid);
-  NS_DEBUG("Channel::Channel (" << name << ")");
 }
 
 Channel::~Channel ()
 {
-  NS_DEBUG("Channel::~Channel ()");
+  NS_LOG_FUNCTION;
 }
 
   void
 Channel::SetName(std::string name)
 {
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << name << ")");
   m_name = name;
 }
 
   std::string
 Channel::GetName(void)
 {
+  NS_LOG_FUNCTION;
   return m_name;
 }
 
--- a/src/node/drop-tail-queue.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/drop-tail-queue.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -17,10 +17,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "drop-tail-queue.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("DropTailQueue");
+NS_LOG_COMPONENT_DEFINE ("DropTailQueue");
 
 namespace ns3 {
 
@@ -33,38 +33,39 @@
   m_packets (),
   m_maxPackets(DTQ_NPACKETS_MAX_DEFAULT)
 {
-  NS_DEBUG("DropTailQueue::DropTailQueue ()");
+  NS_LOG_FUNCTION;
 }
 
 DropTailQueue::~DropTailQueue ()
 {
-  NS_DEBUG("DropTailQueue::~DropTailQueue ()");
+  NS_LOG_FUNCTION;
 }
 
 void 
 DropTailQueue::SetMaxPackets (uint32_t npackets)
 {
-  NS_DEBUG("DropTailQueue::SetMaxPackets (" << npackets << ")");
-
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << npackets << ")");
   m_maxPackets = npackets;
 }
 
 uint32_t 
 DropTailQueue::GetMaxPackets (void)
 {
-  NS_DEBUG("DropTailQueue::GetMaxPackets () <= " << m_maxPackets);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC ("returns " << m_maxPackets);
   return m_maxPackets;
 }
 
 bool 
 DropTailQueue::DoEnqueue (const Packet& p)
 {
-  NS_DEBUG("DropTailQueue::DoEnqueue (" << &p << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
 
   if (m_packets.size () >= m_maxPackets)
     {
-      NS_DEBUG("DropTailQueue::DoEnqueue (): Queue full -- droppping pkt");
+      NS_LOG_LOGIC ("Queue full -- droppping pkt");
       Drop (p);
       return false;
     }
@@ -76,18 +77,19 @@
 bool
 DropTailQueue::DoDequeue (Packet& p)
 {
-  NS_DEBUG("DropTailQueue::DoDequeue (" << &p << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
 
   if (m_packets.empty()) 
     {
-      NS_DEBUG("DropTailQueue::DoDequeue (): Queue empty");
+      NS_LOG_LOGIC ("Queue empty");
       return false;
     }
 
   p = m_packets.front ();
   m_packets.pop ();
 
-  NS_DEBUG("DropTailQueue::DoDequeue (): Popped " << &p << " <= true");
+  NS_LOG_LOGIC ("Popped " << &p);
 
   return true;
 }
@@ -95,11 +97,12 @@
 bool
 DropTailQueue::DoPeek (Packet& p)
 {
-  NS_DEBUG("DropTailQueue::DoPeek (" << &p << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
 
   if (m_packets.empty()) 
     {
-      NS_DEBUG("DropTailQueue::DoPeek (): Queue empty");
+      NS_LOG_LOGIC ("Queue empty");
       return false;
     }
 
--- a/src/node/ethernet-header.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/ethernet-header.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -22,12 +22,12 @@
 #include <iomanip>
 #include <iostream>
 #include "ns3/assert.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/header.h"
 #include "ethernet-header.h"
 #include "address-utils.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("EthernetHeader");
+NS_LOG_COMPONENT_DEFINE ("EthernetHeader");
 
 namespace ns3 {
 
--- a/src/node/ethernet-trailer.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/ethernet-trailer.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -20,11 +20,11 @@
  */
 
 #include "ns3/assert.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/trailer.h"
 #include "ethernet-trailer.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("EthernetTrailer");
+NS_LOG_COMPONENT_DEFINE ("EthernetTrailer");
 
 namespace ns3 {
 
@@ -62,7 +62,7 @@
     {
       return true;
     } else {
-      NS_DEBUG("FCS calculation is not yet enabled" << std::endl);
+      NS_LOG_WARN ("FCS calculation is not yet enabled");
       return false;
     }
 }
@@ -70,7 +70,7 @@
 void
 EthernetTrailer::CalcFcs (const Packet& p)
 {
-  NS_DEBUG("FCS calculation is not yet enabled" << std::endl);
+  NS_LOG_WARN ("FCS calculation is not yet enabled");
 }
 
 void
--- a/src/node/ipv4-address.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/ipv4-address.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -18,12 +18,12 @@
  *
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
-#include "ns3/debug.h"
+
+#include "ns3/log.h"
 #include "ipv4-address.h"
 #include "ns3/assert.h"
 
-NS_DEBUG_COMPONENT_DEFINE("Ipv4Address");
-
+NS_LOG_COMPONENT_DEFINE("Ipv4Address");
 
 namespace ns3 {
 
--- a/src/node/net-device.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/net-device.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -22,15 +22,13 @@
 #include <iostream>
 #include "ns3/assert.h"
 #include "ns3/object.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/trace-resolver.h"
-
-
 #include "channel.h"
 #include "net-device.h"
 #include "node.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("NetDevice");
+NS_LOG_COMPONENT_DEFINE ("NetDevice");
 
 namespace ns3 {
 
@@ -47,22 +45,27 @@
   m_isMulticast (false), 
   m_isPointToPoint (false)
 {
+  NS_LOG_FUNCTION;
   SetInterfaceId (NetDevice::iid);
   m_node->AddDevice (this);
 }
 
 NetDevice::~NetDevice ()
-{}
+{
+  NS_LOG_FUNCTION;
+}
 
 Address 
 NetDevice::GetAddress (void) const
 {
+  NS_LOG_FUNCTION;
   return m_address;
 }
 
 bool
 NetDevice::SetMtu (const uint16_t mtu) 
 {
+  NS_LOG_FUNCTION;
   m_mtu = mtu;
   return true;
 }
@@ -70,54 +73,63 @@
 uint16_t 
 NetDevice::GetMtu (void) const
 {
+  NS_LOG_FUNCTION;
   return m_mtu;
 }
 
 void
 NetDevice::SetName(const std::string name) 
 { 
+  NS_LOG_FUNCTION;
   m_name = name; 
 }
 
 std::string 
 NetDevice::GetName(void) const 
 { 
+  NS_LOG_FUNCTION;
   return m_name; 
 }
 
 void
 NetDevice::SetIfIndex(uint32_t index) 
 { 
+  NS_LOG_FUNCTION;
   m_ifIndex = index; 
 }
 
 uint32_t
 NetDevice::GetIfIndex(void) const 
 { 
+  NS_LOG_FUNCTION;
   return m_ifIndex; 
 }
 
 bool 
 NetDevice::IsLinkUp (void) const
 {
+  NS_LOG_FUNCTION;
   return m_isUp;
 }
 
 void 
 NetDevice::SetLinkChangeCallback (Callback<void> callback)
 {
+  NS_LOG_FUNCTION;
   m_linkChangeCallback = callback;
 }
 
 bool
 NetDevice::IsBroadcast (void) const
 {
+  NS_LOG_FUNCTION;
   return m_isBroadcast;
 }
 
 Address const &
 NetDevice::GetBroadcast (void) const
 {
+  NS_LOG_FUNCTION;
   NS_ASSERT (m_isBroadcast);
   return m_broadcast;
 }
@@ -125,6 +137,7 @@
 void
 NetDevice::EnableBroadcast (Address broadcast)
 {
+  NS_LOG_FUNCTION;
   m_isBroadcast = true;
   m_broadcast = broadcast;
 }
@@ -132,18 +145,21 @@
 void
 NetDevice::DisableBroadcast (void)
 {
+  NS_LOG_FUNCTION;
   m_isBroadcast = false;
 }
 
 bool
 NetDevice::IsMulticast (void) const
 {
+  NS_LOG_FUNCTION;
   return m_isMulticast;
 }
 
 Address 
 NetDevice::GetMulticast (void) const
 {
+  NS_LOG_FUNCTION;
   NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): "
     "Invalid operation when not IsMulticast ()");
   return m_multicast;
@@ -152,6 +168,7 @@
 Address
 NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const
 {
+  NS_LOG_FUNCTION;
   NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): "
     "Invalid operation when not IsMulticast ()");
   return m_multicast;
@@ -160,6 +177,7 @@
 void
 NetDevice::EnableMulticast (Address multicast)
 {
+  NS_LOG_FUNCTION;
   m_isMulticast = true;
   m_multicast = multicast;
 }
@@ -167,24 +185,28 @@
 void
 NetDevice::DisableMulticast (void)
 {
+  NS_LOG_FUNCTION;
   m_isMulticast = false;
 }
 
 bool
 NetDevice::IsPointToPoint (void) const
 {
+  NS_LOG_FUNCTION;
   return m_isPointToPoint;
 }
 
 void
 NetDevice::EnablePointToPoint (void)
 {
+  NS_LOG_FUNCTION;
   m_isPointToPoint = true;
 }
 
 void
 NetDevice::DisablePointToPoint (void)
 {
+  NS_LOG_FUNCTION;
   m_isPointToPoint = false;
 }
 
@@ -192,6 +214,7 @@
 bool 
 NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber)
 {
+  NS_LOG_FUNCTION;
   if (m_isUp)
     {
       return SendTo(p, dest, protocolNumber);
@@ -205,6 +228,7 @@
 Ptr<Channel>
 NetDevice::GetChannel (void) const
 {
+  NS_LOG_FUNCTION;
   return DoGetChannel ();
 }
 
@@ -212,10 +236,10 @@
 bool
 NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from)
 {
+  NS_LOG_FUNCTION;
   bool retval = false;
 
-  NS_DEBUG ("NetDevice::ForwardUp: UID is " << p.GetUid()
-            << " device is: " << GetName());
+  NS_LOG_LOGIC ("UID is " << p.GetUid() << " device is: " << GetName());
   
   if (!m_receiveCallback.IsNull ())
     {
@@ -223,7 +247,7 @@
     } 
   else 
     {
-      NS_DEBUG ("NetDevice::Receive call back is NULL");
+      NS_LOG_WARN ("NetDevice::Receive call back is NULL");
     }
 
     return retval;
@@ -232,6 +256,7 @@
 void 
 NetDevice::NotifyLinkUp (void)
 {
+  NS_LOG_FUNCTION;
   m_isUp = true;
   if (!m_linkChangeCallback.IsNull ())
     {
@@ -242,6 +267,7 @@
 void 
 NetDevice::NotifyLinkDown (void)
 {
+  NS_LOG_FUNCTION;
   m_isUp = false;
   if (!m_linkChangeCallback.IsNull ())
     {
@@ -252,24 +278,28 @@
 Ptr<Node>
 NetDevice::GetNode (void) const
 {
+  NS_LOG_FUNCTION;
   return m_node;
 }
 
 bool
 NetDevice::NeedsArp (void) const
 {
+  NS_LOG_FUNCTION;
   return DoNeedsArp ();
 }
 
 void 
 NetDevice::SetReceiveCallback (ReceiveCallback cb)
 {
+  NS_LOG_FUNCTION;
   m_receiveCallback = cb;
 }
 
 void
 NetDevice::DoDispose()
 {
+  NS_LOG_FUNCTION;
   m_node = 0;
 }
 
--- a/src/node/packet-socket.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/packet-socket.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -21,22 +21,24 @@
 
 #include "packet-socket.h"
 #include "packet-socket-address.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/node.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("PacketSocket");
+NS_LOG_COMPONENT_DEFINE ("PacketSocket");
 
 namespace ns3 {
 
 PacketSocket::PacketSocket (Ptr<Node> node)
   : m_node (node)
 {
+  NS_LOG_FUNCTION;
   Init();
 }
 
 void 
 PacketSocket::Init()
 {
+  NS_LOG_FUNCTION;
   m_state = STATE_OPEN;
   m_shutdownSend = false;
   m_shutdownRecv = false;
@@ -44,37 +46,45 @@
 }
 
 PacketSocket::~PacketSocket ()
-{}
+{
+  NS_LOG_FUNCTION;
+}
 
 void 
 PacketSocket::DoDispose (void)
 {
+  NS_LOG_FUNCTION;
   m_device = 0;
 }
 
 enum Socket::SocketErrno
 PacketSocket::GetErrno (void) const
 {
+  NS_LOG_FUNCTION;
   return m_errno;
 }
 
 Ptr<Node>
 PacketSocket::GetNode (void) const
 {
+  NS_LOG_FUNCTION;
   return m_node;
 }
 
 int
 PacketSocket::Bind (void)
 {
+  NS_LOG_FUNCTION;
   PacketSocketAddress address;
   address.SetProtocol (0);
   address.SetAllDevices ();
   return DoBind (address);
 }
+
 int
 PacketSocket::Bind (const Address &address)
-{
+{ 
+  NS_LOG_FUNCTION;
   if (!PacketSocketAddress::IsMatchingType (address))
     {
       m_errno = ERROR_INVAL;
@@ -87,6 +97,7 @@
 int
 PacketSocket::DoBind (const PacketSocketAddress &address)
 {
+  NS_LOG_FUNCTION;
   if (m_state == STATE_BOUND ||
       m_state == STATE_CONNECTED)
     {
@@ -119,6 +130,7 @@
 int
 PacketSocket::ShutdownSend (void)
 {
+  NS_LOG_FUNCTION;
   if (m_state == STATE_CLOSED)
     {
       m_errno = ERROR_BADF;
@@ -127,9 +139,11 @@
   m_shutdownSend = true;
   return 0;
 }
+
 int
 PacketSocket::ShutdownRecv (void)
 {
+  NS_LOG_FUNCTION;
   if (m_state == STATE_CLOSED)
     {
       m_errno = ERROR_BADF;
@@ -138,9 +152,11 @@
   m_shutdownRecv = false;
   return 0;
 }
+
 int
 PacketSocket::Close(void)
 {
+  NS_LOG_FUNCTION;
   if (m_state == STATE_CLOSED)
     {
       m_errno = ERROR_BADF;
@@ -154,6 +170,7 @@
 int
 PacketSocket::Connect(const Address &ad)
 {
+  NS_LOG_FUNCTION;
   PacketSocketAddress address;
   if (m_state == STATE_CLOSED)
     {
@@ -188,6 +205,7 @@
 int
 PacketSocket::Send (const Packet &p)
 {
+  NS_LOG_FUNCTION;
   if (m_state == STATE_OPEN ||
       m_state == STATE_BOUND)
     {
@@ -200,6 +218,7 @@
 int
 PacketSocket::SendTo(const Address &address, const Packet &p)
 {
+  NS_LOG_FUNCTION;
   PacketSocketAddress ad;
   if (m_state == STATE_CLOSED)
     {
@@ -265,6 +284,7 @@
 PacketSocket::ForwardUp (Ptr<NetDevice> device, const Packet &packet, 
                          uint16_t protocol, const Address &from)
 {
+  NS_LOG_FUNCTION;
   if (m_shutdownRecv)
     {
       return;
@@ -277,8 +297,7 @@
   address.SetSingleDevice (device->GetIfIndex ());
   address.SetProtocol (protocol);
 
-  NS_DEBUG ("PacketSocket::ForwardUp: UID is " << packet.GetUid()
-            << " PacketSocket " << this);
+  NS_LOG_LOGIC ("UID is " << packet.GetUid() << " PacketSocket " << this);
   NotifyDataReceived (p, address);
 }
 
--- a/src/node/queue.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/queue.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -17,13 +17,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/composite-trace-resolver.h"
 #include "ns3/default-value.h"
 #include "ns3/component-manager.h"
 #include "queue.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("Queue");
+NS_LOG_COMPONENT_DEFINE ("Queue");
 
 namespace ns3 {
 
@@ -35,33 +35,48 @@
 std::string 
 QueueTraceType::GetTypeName (void) const
 {
+  NS_LOG_FUNCTION;
   return "ns3::QueueTraceType";
 }
+
 uint16_t 
 QueueTraceType::GetUid (void)
 {
+  NS_LOG_FUNCTION;
   static uint16_t uid = AllocateUid<QueueTraceType> ("QueueTraceType");
   return uid;
 }
+
 QueueTraceType::QueueTraceType ()
   : m_type (QueueTraceType::ENQUEUE)
-{}
+{
+  NS_LOG_FUNCTION;
+}
+
 QueueTraceType::QueueTraceType (enum Type type)
   : m_type (type)
-{}
+{
+  NS_LOG_FUNCTION;
+}
+
 bool 
 QueueTraceType::IsEnqueue (void) const
 {
+  NS_LOG_FUNCTION;
   return m_type == ENQUEUE;
 }
+
 bool 
 QueueTraceType::IsDequeue (void) const
 {
+  NS_LOG_FUNCTION;
   return m_type == DEQUEUE;
 }
+
 bool 
 QueueTraceType::IsDrop (void) const
 {
+  NS_LOG_FUNCTION;
   return m_type == DROP;
 }
 
@@ -90,18 +105,19 @@
   m_nTotalDroppedBytes(0),
   m_nTotalDroppedPackets(0)
 {
+  NS_LOG_FUNCTION;
   SetInterfaceId (Queue::iid);
-  NS_DEBUG("Queue::Queue ()");
 }
 
 Queue::~Queue()
 {
-  NS_DEBUG("Queue::~Queue ()");
+  NS_LOG_FUNCTION;
 }
 
 Ptr<TraceResolver>
 Queue::GetTraceResolver (void) const
 {
+  NS_LOG_FUNCTION;
   Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
   resolver->AddSource ("enqueue", 
                        TraceDoc ("store packet in queue",
@@ -122,9 +138,9 @@
 bool 
 Queue::Enqueue (const Packet& p)
 {
-  NS_DEBUG("Queue::Enqueue (" << &p << ")");
-
-  NS_DEBUG("Queue::Enqueue (): m_traceEnqueue (p)");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
+  NS_LOG_LOGIC ("m_traceEnqueue (p)");
 
   m_traceEnqueue (p);
 
@@ -140,7 +156,8 @@
 bool
 Queue::Dequeue (Packet &p)
 {
-  NS_DEBUG("Queue::Dequeue (" << &p << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
 
   bool retval = DoDequeue (p);
 
@@ -152,7 +169,7 @@
       NS_ASSERT (m_nBytes >= 0);
       NS_ASSERT (m_nPackets >= 0);
 
-      NS_DEBUG("Queue::Dequeue (): m_traceDequeue (p)");
+      NS_LOG_LOGIC("m_traceDequeue (p)");
 
       const Packet packet = p;
       m_traceDequeue (packet);
@@ -164,16 +181,15 @@
 void
 Queue::DequeueAll (void)
 {
-  NS_DEBUG("Queue::DequeueAll ()");
-
-  NS_ASSERT (!"Don't know what to do with dequeued packets!");
+  NS_LOG_FUNCTION;
+  NS_ASSERT_MSG (0, "Don't know what to do with dequeued packets!");
 }
 
 bool
 Queue::Peek (Packet &p)
 {
-  NS_DEBUG("Queue::Peek (" << &p << ")");
-
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
   return DoPeek (p);
 }
 
@@ -181,66 +197,63 @@
 uint32_t 
 Queue::GetNPackets (void)
 {
-  NS_DEBUG("Queue::GetNPackets () <= " << m_nPackets);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC ("returns " << m_nPackets);
   return m_nPackets;
 }
 
 uint32_t
 Queue::GetNBytes (void)
 {
-  NS_DEBUG("Queue::GetNBytes () <= " << m_nBytes);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC (" returns " << m_nBytes);
   return m_nBytes;
 }
 
-
 bool
 Queue::IsEmpty (void)
 {
-  NS_DEBUG("Queue::IsEmpty () <= " << (m_nPackets == 0));
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC ("returns" << (m_nPackets == 0));
   return m_nPackets == 0;
 }
 
 uint32_t
 Queue::GetTotalReceivedBytes (void)
 {
-  NS_DEBUG("Queue::GetTotalReceivedBytes () <= " << m_nTotalReceivedBytes);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC("returns " << m_nTotalReceivedBytes);
   return m_nTotalReceivedBytes;
 }
 
 uint32_t
 Queue::GetTotalReceivedPackets (void)
 {
-  NS_DEBUG("Queue::GetTotalReceivedPackets () <= " << m_nTotalReceivedPackets);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC ("returns " << m_nTotalReceivedPackets);
   return m_nTotalReceivedPackets;
 }
 
 uint32_t
 Queue:: GetTotalDroppedBytes (void)
 {
-  NS_DEBUG(
-    "Queue::GetTotalDroppedBytes () <= " << m_nTotalDroppedBytes
-    );
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC ("returns " << m_nTotalDroppedBytes);
   return m_nTotalDroppedBytes;
 }
 
 uint32_t
 Queue::GetTotalDroppedPackets (void)
 {
-  NS_DEBUG(
-           "Queue::GetTotalDroppedPackets () <= " << m_nTotalDroppedPackets);
-
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC("returns " << m_nTotalDroppedPackets);
   return m_nTotalDroppedPackets;
 }
 
 void 
 Queue::ResetStatistics (void)
 {
-  NS_DEBUG("Queue::ResetStatistics ()");
-
+  NS_LOG_FUNCTION;
   m_nTotalReceivedBytes = 0;
   m_nTotalReceivedPackets = 0;
   m_nTotalDroppedBytes = 0;
@@ -250,18 +263,20 @@
 void
 Queue::Drop (const Packet& p)
 {
-  NS_DEBUG("Queue::Drop (" << &p << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << &p << ")");
 
   m_nTotalDroppedPackets++;
   m_nTotalDroppedBytes += p.GetSize ();
 
-  NS_DEBUG("Queue::Drop (): m_traceDrop (p)");
+  NS_LOG_LOGIC ("m_traceDrop (p)");
   m_traceDrop (p);
 }
 
 Ptr<Queue>
 Queue::CreateDefault (void)
 {
+  NS_LOG_FUNCTION;
   ClassId classId = g_classIdDefaultValue.GetValue ();
   Ptr<Queue> queue = ComponentManager::Create<Queue> (classId, Queue::iid);
   return queue;
--- a/src/node/socket.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/socket.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -20,23 +20,23 @@
  *          Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/packet.h"
 #include "socket.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("Socket");
+NS_LOG_COMPONENT_DEFINE ("Socket");
 
 namespace ns3 {
 
 Socket::~Socket ()
 {
-  NS_DEBUG("Socket::~Socket ()");
+  NS_LOG_FUNCTION;
 }
 
 void 
 Socket::SetCloseCallback (Callback<void,Ptr<Socket> > closeCompleted)
 {
-  NS_DEBUG("Socket::SetCloseCallback ()");
+  NS_LOG_FUNCTION;
   m_closeCompleted = closeCompleted;
 }
 
@@ -46,7 +46,7 @@
   Callback<void, Ptr<Socket> > connectionFailed,
   Callback<void, Ptr<Socket> > halfClose)
 {
-  NS_DEBUG("Socket::SetConnectCallback ()");
+  NS_LOG_FUNCTION;
   m_connectionSucceeded = connectionSucceeded;
   m_connectionFailed = connectionFailed;
   m_halfClose = halfClose;
@@ -58,7 +58,7 @@
   Callback<void, Ptr<Socket>, const Address&> newConnectionCreated,
   Callback<void, Ptr<Socket> > closeRequested)
 {
-  NS_DEBUG("Socket::SetAcceptCallback ()");
+  NS_LOG_FUNCTION;
   m_connectionRequest = connectionRequest;
   m_newConnectionCreated = newConnectionCreated;
   m_closeRequested = closeRequested;
@@ -67,22 +67,21 @@
 void 
 Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent)
 {
-  NS_DEBUG("Socket::SetSendCallback ()");
+  NS_LOG_FUNCTION;
   m_dataSent = dataSent;
 }
 
 void 
 Socket::SetRecvCallback (Callback<void, Ptr<Socket>, const Packet &,const Address&> receivedData)
 {
-  NS_DEBUG("Socket::SetRecvCallback ()");
+  NS_LOG_FUNCTION;
   m_receivedData = receivedData;
 }
 
 void 
 Socket::NotifyCloseCompleted (void)
 {
-  NS_DEBUG("Socket::NotifyCloseCompleted ()");
-
+  NS_LOG_FUNCTION;
   if (!m_closeCompleted.IsNull ())
     {
       m_closeCompleted (this);
@@ -92,8 +91,7 @@
 void 
 Socket::NotifyConnectionSucceeded (void)
 {
-  NS_DEBUG("Socket::NotifyConnectionSucceeded ()");
-
+  NS_LOG_FUNCTION;
   if (!m_connectionSucceeded.IsNull ())
     {
       m_connectionSucceeded (this);
@@ -103,8 +101,7 @@
 void 
 Socket::NotifyConnectionFailed (void)
 {
-  NS_DEBUG("Socket::NotifyConnectionFailed ()");
-
+  NS_LOG_FUNCTION;
   if (!m_connectionFailed.IsNull ())
     {
       m_connectionFailed (this);
@@ -114,8 +111,7 @@
 void 
 Socket::NotifyHalfClose (void)
 {
-  NS_DEBUG("Socket::NotifyHalfClose ()");
-
+  NS_LOG_FUNCTION;
   if (!m_halfClose.IsNull ())
     {
       m_halfClose (this);
@@ -125,8 +121,7 @@
 bool 
 Socket::NotifyConnectionRequest (const Address &from)
 {
-  NS_DEBUG("Socket::NotifyConnectionRequest ()");
-
+  NS_LOG_FUNCTION;
   if (!m_connectionRequest.IsNull ())
     {
       return m_connectionRequest (this, from);
@@ -141,8 +136,7 @@
 void 
 Socket::NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from)
 {
-  NS_DEBUG("Socket::NotifyNewConnectionCreated ()");
-
+  NS_LOG_FUNCTION;
   if (!m_newConnectionCreated.IsNull ())
     {
       m_newConnectionCreated (socket, from);
@@ -152,8 +146,7 @@
 void 
 Socket::NotifyCloseRequested (void)
 {
-  NS_DEBUG("Socket::NotifyCloseRequested ()");
-
+  NS_LOG_FUNCTION;
   if (!m_closeRequested.IsNull ())
     {
       m_closeRequested (this);
@@ -163,8 +156,7 @@
 void 
 Socket::NotifyDataSent (uint32_t size)
 {
-  NS_DEBUG("Socket::NotifyDataSent ()");
-
+  NS_LOG_FUNCTION;
   if (!m_dataSent.IsNull ())
     {
       m_dataSent (this, size);
@@ -174,8 +166,7 @@
 void 
 Socket::NotifyDataReceived (const Packet &p, const Address &from)
 {
-  NS_DEBUG("Socket::NotifyDataReceived ()");
-
+  NS_LOG_FUNCTION;
   if (!m_receivedData.IsNull ())
     {
       m_receivedData (this, p, from);
--- a/src/routing/global-routing/candidate-queue.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/routing/global-routing/candidate-queue.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -14,35 +14,32 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author:  Craig Dowell (craigdo@ee.washington.edu)
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/assert.h"
 #include "candidate-queue.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("CandidateQueue");
+NS_LOG_COMPONENT_DEFINE ("CandidateQueue");
 
 namespace ns3 {
 
 CandidateQueue::CandidateQueue()
   : m_candidates ()
 {
-  NS_DEBUG("CandidateQueue::CandidateQueue ()");
+  NS_LOG_FUNCTION;
 }
 
 CandidateQueue::~CandidateQueue()
 {
-  NS_DEBUG("CandidateQueue::~CandidateQueue ()");
+  NS_LOG_FUNCTION;
   Clear ();
 }
 
   void
 CandidateQueue::Clear (void)
 {
-  NS_DEBUG("CandidateQueue::Clear ()");
-
+  NS_LOG_FUNCTION;
   while (!m_candidates.empty ())
     {
       SPFVertex *p = Pop ();
@@ -54,7 +51,8 @@
   void
 CandidateQueue::Push (SPFVertex *vNew)
 {
-  NS_DEBUG("CandidateQueue::Push (" << vNew << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << vNew << ")");
 
   CandidateList_t::iterator i = m_candidates.begin ();  
 
@@ -72,8 +70,7 @@
   SPFVertex *
 CandidateQueue::Pop (void)
 {
-  NS_DEBUG("CandidateQueue::Pop ()");
-
+  NS_LOG_FUNCTION;
   if (m_candidates.empty ())
     {
       return 0;
@@ -87,8 +84,7 @@
   SPFVertex *
 CandidateQueue::Top (void) const
 {
-  NS_DEBUG("CandidateQueue::Top ()");
-
+  NS_LOG_FUNCTION;
   if (m_candidates.empty ())
     {
       return 0;
@@ -100,24 +96,21 @@
   bool
 CandidateQueue::Empty (void) const
 {
-  NS_DEBUG("CandidateQueue::Empty ()");
-
+  NS_LOG_FUNCTION;
   return m_candidates.empty ();
 }
 
   uint32_t
 CandidateQueue::Size (void) const
 {
-  NS_DEBUG("CandidateQueue::Size ()");
-
+  NS_LOG_FUNCTION;
   return m_candidates.size ();
 }
 
   SPFVertex *
 CandidateQueue::Find (const Ipv4Address addr) const
 {
-  NS_DEBUG("CandidateQueue::Find ()");
-
+  NS_LOG_FUNCTION;
   CandidateList_t::const_iterator i = m_candidates.begin ();
 
   for (; i != m_candidates.end (); i++)
@@ -135,8 +128,7 @@
   void
 CandidateQueue::Reorder (void)
 {
-  NS_DEBUG("CandidateQueue::Reorder ()");
-
+  NS_LOG_FUNCTION;
   std::list<SPFVertex*> temp;
 
   while (!m_candidates.empty ()) {
--- a/src/routing/global-routing/global-route-manager-impl.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/routing/global-routing/global-route-manager-impl.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -16,8 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Authors:  Craig Dowell (craigdo@ee.washington.edu)
- *           Tom Henderson (tomhend@u.washington.edu)
+ * Authors:  Tom Henderson (tomhend@u.washington.edu)
  * 
  * Kunihiro Ishigura, Toshiaki Takada (GNU Zebra) are attributed authors
  * of the quagga 0.99.7/src/ospfd/ospf_spf.c code which was ported here
@@ -28,14 +27,14 @@
 #include <queue>
 #include "ns3/assert.h"
 #include "ns3/fatal-error.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/node-list.h"
 #include "ns3/ipv4.h"
 #include "global-router-interface.h"
 #include "global-route-manager-impl.h"
 #include "candidate-queue.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("GlobalRouteManager");
+NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager");
 
 namespace ns3 {
 
@@ -55,6 +54,7 @@
   m_parent (0),
   m_children ()
 {
+  NS_LOG_FUNCTION;
 }
 
 SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) : 
@@ -66,20 +66,22 @@
   m_parent (0),
   m_children ()
 {
+  NS_LOG_FUNCTION;
   if (lsa->GetLSType () == GlobalRoutingLSA::RouterLSA) 
     {
-      NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexRouter");
+      NS_LOG_LOGIC ("Setting m_vertexType to VertexRouter");
       m_vertexType = SPFVertex::VertexRouter;
     }
   else if (lsa->GetLSType () == GlobalRoutingLSA::NetworkLSA) 
     { 
-      NS_DEBUG ("SPFVertex:: setting m_vertexType to VertexNetwork");
+      NS_LOG_LOGIC ("Setting m_vertexType to VertexNetwork");
       m_vertexType = SPFVertex::VertexNetwork;
     }
 }
 
 SPFVertex::~SPFVertex ()
 {
+  NS_LOG_FUNCTION;
   for ( ListOfSPFVertex_t::iterator i = m_children.begin ();
         i != m_children.end ();
         i++)
@@ -95,96 +97,112 @@
   void 
 SPFVertex::SetVertexType (SPFVertex::VertexType type)
 {
+  NS_LOG_FUNCTION;
   m_vertexType = type;
 }
 
   SPFVertex::VertexType 
 SPFVertex::GetVertexType (void) const
 {
+  NS_LOG_FUNCTION;
   return m_vertexType;
 }
 
   void 
 SPFVertex::SetVertexId (Ipv4Address id)
 {
+  NS_LOG_FUNCTION;
   m_vertexId = id;
 }
 
   Ipv4Address
 SPFVertex::GetVertexId (void) const
 {
+  NS_LOG_FUNCTION;
   return m_vertexId;
 }
 
   void 
 SPFVertex::SetLSA (GlobalRoutingLSA* lsa)
 {
+  NS_LOG_FUNCTION;
   m_lsa = lsa;
 }
 
   GlobalRoutingLSA* 
 SPFVertex::GetLSA (void) const
 {
+  NS_LOG_FUNCTION;
   return m_lsa;
 }
 
   void 
 SPFVertex::SetDistanceFromRoot (uint32_t distance)
 {
+  NS_LOG_FUNCTION;
   m_distanceFromRoot = distance;
 }
 
   uint32_t
 SPFVertex::GetDistanceFromRoot (void) const
 {
+  NS_LOG_FUNCTION;
   return m_distanceFromRoot;
 }
 
   void 
 SPFVertex::SetOutgoingInterfaceId (uint32_t id)
 {
+  NS_LOG_FUNCTION;
   m_rootOif = id;
 }
 
   uint32_t 
 SPFVertex::GetOutgoingInterfaceId (void) const
 {
+  NS_LOG_FUNCTION;
   return m_rootOif;
 }
 
   void 
 SPFVertex::SetNextHop (Ipv4Address nextHop)
 {
+  NS_LOG_FUNCTION;
   m_nextHop = nextHop;
 }
 
   Ipv4Address
 SPFVertex::GetNextHop (void) const
 {
+  NS_LOG_FUNCTION;
   return m_nextHop;
 }
 
   void
 SPFVertex::SetParent (SPFVertex* parent)
 {
+  NS_LOG_FUNCTION;
   m_parent = parent;
 }
 
   SPFVertex* 
 SPFVertex::GetParent (void) const
 {
+  NS_LOG_FUNCTION;
   return m_parent;
 }
 
   uint32_t 
 SPFVertex::GetNChildren (void) const
 {
+  NS_LOG_FUNCTION;
   return m_children.size ();
 }
 
   SPFVertex* 
 SPFVertex::GetChild (uint32_t n) const
 {
+  NS_LOG_FUNCTION;
   uint32_t j = 0;
 
   for ( ListOfSPFVertex_t::const_iterator i = m_children.begin ();
@@ -203,6 +221,7 @@
   uint32_t 
 SPFVertex::AddChild (SPFVertex* child)
 {
+  NS_LOG_FUNCTION;
   m_children.push_back (child);
   return m_children.size ();
 }
@@ -217,29 +236,27 @@
 :
   m_database ()
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::GlobalRouteManagerLSDB ()");
+  NS_LOG_FUNCTION;
 }
 
 GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()");
-
+  NS_LOG_FUNCTION;
   LSDBMap_t::iterator i;
   for (i= m_database.begin (); i!= m_database.end (); i++)
     {
-      NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ():free LSA");
+      NS_LOG_LOGIC ("free LSA");
       GlobalRoutingLSA* temp = i->second;
       delete temp;
     }
-  NS_DEBUG ("GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ():  clear map");
+  NS_LOG_LOGIC ("clear map");
   m_database.clear ();
 }
 
   void
 GlobalRouteManagerLSDB::Initialize ()
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::Initialize ()");
-
+  NS_LOG_FUNCTION;
   LSDBMap_t::iterator i;
   for (i= m_database.begin (); i!= m_database.end (); i++)
     {
@@ -251,14 +268,14 @@
   void
 GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa)
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::Insert ()");
+  NS_LOG_FUNCTION;
   m_database.insert (LSDBPair_t (addr, lsa));
 }
 
   GlobalRoutingLSA*
 GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::GetLSA ()");
+  NS_LOG_FUNCTION;
 //
 // Look up an LSA by its address.
 //
@@ -276,7 +293,7 @@
   GlobalRoutingLSA*
 GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const
 {
-  NS_DEBUG ("GlobalRouteManagerLSDB::GetLSAByLinkData ()");
+  NS_LOG_FUNCTION;
 //
 // Look up an LSA by its address.
 //
@@ -308,14 +325,13 @@
 : 
   m_spfroot (0) 
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::GlobalRoutemanagerImpl ()");
+  NS_LOG_FUNCTION;
   m_lsdb = new GlobalRouteManagerLSDB ();
 }
 
 GlobalRouteManagerImpl::~GlobalRouteManagerImpl ()
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::~GlobalRouteManagerImpl ()");
-
+  NS_LOG_FUNCTION;
   if (m_lsdb)
     {
       delete m_lsdb;
@@ -325,8 +341,7 @@
   void
 GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::DebugUseLsdb ()");
-
+  NS_LOG_FUNCTION;
   if (m_lsdb)
     {
       delete m_lsdb;
@@ -344,14 +359,12 @@
   void
 GlobalRouteManagerImpl::SelectRouterNodes () 
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes ()");
-
+  NS_LOG_FUNCTION;
   for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
     {
       Ptr<Node> node = *i;
-      NS_DEBUG ("GlobalRouteManagerImpl::SelectRouterNodes (): "
-        "Adding GlobalRouter interface to node " <<
-                node->GetId ());
+      NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << 
+        node->GetId ());
 
       Ptr<GlobalRouter> globalRouter = Create<GlobalRouter> (node);
       node->AddInterface (globalRouter);
@@ -370,7 +383,7 @@
   void
 GlobalRouteManagerImpl::BuildGlobalRoutingDatabase () 
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::BuildGlobalRoutingDatabase()");
+  NS_LOG_FUNCTION;
 //
 // Walk the list of nodes looking for the GlobalRouter Interface.
 //
@@ -396,7 +409,7 @@
 // found.
 //
       uint32_t numLSAs = rtr->DiscoverLSAs ();
-      NS_DEBUG ("Discover LSAs:  Found " << numLSAs << " LSAs");
+      NS_LOG_LOGIC ("Found " << numLSAs << " LSAs");
 
       for (uint32_t j = 0; j < numLSAs; ++j)
         {
@@ -406,7 +419,7 @@
 // router.
 //
           rtr->GetLSA (j, *lsa);
-          NS_DEBUG (*lsa);
+          NS_LOG_LOGIC (*lsa);
 //
 // Write the newly discovered link state advertisement to the database.
 //
@@ -451,7 +464,7 @@
   void
 GlobalRouteManagerImpl::InitializeRoutes ()
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::InitializeRoutes ()");
+  NS_LOG_FUNCTION;
 //
 // Walk the list of nodes in the system.
 //
@@ -491,16 +504,17 @@
   void
 GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate)
 {
+  NS_LOG_FUNCTION;
+
   SPFVertex* w = 0;
   GlobalRoutingLSA* w_lsa = 0;
   GlobalRoutingLinkRecord *l = 0;
   uint32_t distance = 0;
   uint32_t numRecordsInVertex = 0;
-
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFNext ()");
-
+//
 // V points to a Router-LSA or Network-LSA
 // Loop over the links in router LSA or attached routers in Network LSA
+//
   if (v->GetVertexType () == SPFVertex::VertexRouter)
     {
       numRecordsInVertex = v->GetLSA ()->GetNLinkRecords (); 
@@ -515,7 +529,7 @@
 // Get w_lsa:  In case of V is Router-LSA
       if (v->GetVertexType () == SPFVertex::VertexRouter) 
         {
-          NS_DEBUG ("SPFNext: Examining " << v->GetVertexId () << "'s " <<
+          NS_LOG_LOGIC ("Examining " << v->GetVertexId () << "'s " <<
             v->GetLSA ()->GetNLinkRecords () << " link records");
 //
 // (a) If this is a link to a stub network, examine the next link in V's LSA.
@@ -525,8 +539,7 @@
           l = v->GetLSA ()->GetLinkRecord (i);
           if (l->GetLinkType () == GlobalRoutingLinkRecord::StubNetwork)
             {
-              NS_DEBUG ("SPFNext: Found a Stub record to " << 
-                l->GetLinkId ());
+              NS_LOG_LOGIC ("Found a Stub record to " << l->GetLinkId ());
               continue;
             }
 //
@@ -542,7 +555,7 @@
 //
               w_lsa = m_lsdb->GetLSA (l->GetLinkId ());
               NS_ASSERT (w_lsa);
-              NS_DEBUG ("SPFNext:  Found a P2P record from " << 
+              NS_LOG_LOGIC ("Found a P2P record from " << 
                 v->GetVertexId () << " to " << w_lsa->GetLinkStateId ());
             }
           else if (l->GetLinkType () == 
@@ -550,7 +563,7 @@
             {
               w_lsa = m_lsdb->GetLSA (l->GetLinkId ());
               NS_ASSERT (w_lsa);
-              NS_DEBUG ("SPFNext:  Found a Transit record from " << 
+              NS_LOG_LOGIC ("Found a Transit record from " << 
                 v->GetVertexId () << " to " << w_lsa->GetLinkStateId ());
             }
           else 
@@ -567,7 +580,7 @@
             {
               continue;
             }
-          NS_DEBUG ("SPFNext:  Found a Network LSA from " << 
+          NS_LOG_LOGIC ("Found a Network LSA from " << 
             v->GetVertexId () << " to " << w_lsa->GetLinkStateId ());
         }
 
@@ -581,7 +594,7 @@
 //
       if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_IN_SPFTREE) 
         {
-          NS_DEBUG ("SPFNext: Skipping->  LSA "<< 
+          NS_LOG_LOGIC ("Skipping ->  LSA "<< 
             w_lsa->GetLinkStateId () << " already in SPF tree");
           continue;
         }
@@ -600,7 +613,7 @@
           distance = v->GetDistanceFromRoot ();
         }
 
-      NS_DEBUG ("SPFNext: Considering w_lsa " << w_lsa->GetLinkStateId ());
+      NS_LOG_LOGIC ("Considering w_lsa " << w_lsa->GetLinkStateId ());
 
 // Is there already vertex w in candidate list?
       if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED)
@@ -622,7 +635,7 @@
 // root node).
 //
               candidate.Push (w);
-              NS_DEBUG ("SPFNext:  Pushing " << 
+              NS_LOG_LOGIC ("Pushing " << 
                 w->GetVertexId () << ", parent vertexId: " << 
                 v->GetVertexId ());
             }
@@ -691,8 +704,8 @@
   GlobalRoutingLinkRecord* l,
   uint32_t distance)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFNexthopCalculation ()");
-
+  NS_LOG_FUNCTION;
+//
 // If w is a NetworkVertex, l should be null
 /*
   if (w->GetVertexType () == SPFVertex::VertexNetwork && l)
@@ -772,7 +785,7 @@
           w->SetOutgoingInterfaceId (
             FindOutgoingInterfaceId (l->GetLinkData ()));
 
-          NS_DEBUG ("SPFNexthopCalculation: Next hop from " << 
+          NS_LOG_LOGIC ("Next hop from " << 
             v->GetVertexId () << " to " << w->GetVertexId () << 
             " goes through next hop " << w->GetNextHop () <<
             " via outgoing interface " << w->GetOutgoingInterfaceId ());
@@ -789,7 +802,7 @@
             w_lsa->GetNetworkLSANetworkMask () ));
           w->SetDistanceFromRoot (distance);
           w->SetParent (v);
-          NS_DEBUG ("SPFNexthopCalculation: Next hop from " << 
+          NS_LOG_LOGIC ("Next hop from " << 
             v->GetVertexId () << " to network " << w->GetVertexId () << 
             " via outgoing interface " << w->GetOutgoingInterfaceId ());
           return 1;
@@ -816,7 +829,7 @@
  */
                 w->SetNextHop(linkRemote->GetLinkData ());
                 w->SetOutgoingInterfaceId (v->GetOutgoingInterfaceId ());
-                NS_DEBUG ("SPFNexthopCalculation: Next hop from " << 
+                NS_LOG_LOGIC ("Next hop from " << 
                   v->GetVertexId () << " to " << w->GetVertexId () << 
                   " goes through next hop " << w->GetNextHop () <<
                   " via outgoing interface " << w->GetOutgoingInterfaceId ());
@@ -873,7 +886,7 @@
   SPFVertex* w,
   GlobalRoutingLinkRecord* prev_link) 
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFGetNextLink ()");
+  NS_LOG_FUNCTION;
 
   bool skip = true;
   bool found_prev_link = false;
@@ -907,12 +920,12 @@
         {
           if (!found_prev_link)
             {
-              NS_DEBUG ("SPFGetNextLink: Skipping links before prev_link found");
+              NS_LOG_LOGIC ("Skipping links before prev_link found");
               found_prev_link = true;
               continue;
             }
         
-          NS_DEBUG ("SPFGetNextLink: Found matching link l:  linkId = " <<
+          NS_LOG_LOGIC ("Found matching link l:  linkId = " <<
           l->GetLinkId () << " linkData = " << l->GetLinkData ());
 //
 // If skip is false, don't (not too surprisingly) skip the link found -- it's 
@@ -923,7 +936,7 @@
 //
         if (skip == false) 
           {
-            NS_DEBUG ("SPFGetNextLink: Returning the found link");
+            NS_LOG_LOGIC ("Returning the found link");
             return l;
           }
         else
@@ -933,7 +946,7 @@
 // Setting skip to false gets us the next point-to-point global router link
 // record in the LSA from <v>.
 //
-            NS_DEBUG ("SPFGetNextLink: Skipping the found link");
+            NS_LOG_LOGIC ("Skipping the found link");
             skip = false;
             continue;
           }
@@ -948,7 +961,7 @@
   void
 GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::DebugSPFCalculate ()");
+  NS_LOG_FUNCTION;
   SPFCalculate (root);
 }
 
@@ -956,8 +969,8 @@
   void
 GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFCalculate (): "
-    "root = " << root);
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << root << ")");
 
   SPFVertex *v;
 //
@@ -1023,7 +1036,7 @@
 // the candidate list.
 //
       v = candidate.Pop ();
-      NS_DEBUG ("SPFCalculate: Popped vertex " << v->GetVertexId ());
+      NS_LOG_LOGIC ("Popped vertex " << v->GetVertexId ());
 //
 // Update the status field of the vertex to indicate that it is in the SPF
 // tree.
@@ -1105,6 +1118,7 @@
   uint32_t
 GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
 {
+  NS_LOG_FUNCTION;
 //
 // We have an IP address <a> and a vertex ID of the root of the SPF tree.  
 // The question is what interface index does this address correspond to.
@@ -1180,7 +1194,7 @@
   void
 GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter ()");
+  NS_LOG_FUNCTION;
 
   NS_ASSERT_MSG (m_spfroot, 
     "GlobalRouteManagerImpl::SPFIntraAddRouter (): Root pointer not set");
@@ -1193,8 +1207,7 @@
 //
   Ipv4Address routerId = m_spfroot->GetVertexId ();
 
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): "
-    "Vertex ID = " << routerId);
+  NS_LOG_LOGIC ("Vertex ID = " << routerId);
 //
 // We need to walk the list of nodes looking for the one that has the router
 // ID corresponding to the root vertex.  This is the one we're going to write
@@ -1214,8 +1227,8 @@
 
       if (rtr == 0)
         {
-          NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): "
-            "No GlobalRouter interface on node " << node->GetId ());
+          NS_LOG_LOGIC ("No GlobalRouter interface on node " << 
+            node->GetId ());
           continue;
         }
 //
@@ -1223,13 +1236,11 @@
 // root of the SPF tree, then this node is the one for which we need to 
 // write the routing tables.
 //
-      NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): "
-        "Considering router " << rtr->GetRouterId ());
+      NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ());
 
       if (rtr->GetRouterId () == routerId)
         {
-          NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): "
-            "setting routes for node " << node->GetId ());
+          NS_LOG_LOGIC ("Setting routes for node " << node->GetId ());
 //
 // Routing information is updated using the Ipv4 interface.  We need to QI
 // for that interface.  If the node is acting as an IP version 4 router, it
@@ -1270,8 +1281,7 @@
                   continue;
                 }
 
-              NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddRouter (): "
-                " Node " << node->GetId () <<
+              NS_LOG_LOGIC (" Node " << node->GetId () <<
                 " add route to " << lr->GetLinkData () <<
                 " using next hop " << v->GetNextHop () <<
                 " via interface " << v->GetOutgoingInterfaceId ());
@@ -1301,7 +1311,7 @@
   void
 GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
 {
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit ()");
+  NS_LOG_FUNCTION;
 
   NS_ASSERT_MSG (m_spfroot, 
     "GlobalRouteManagerImpl::SPFIntraAddTransit (): Root pointer not set");
@@ -1314,8 +1324,7 @@
 //
   Ipv4Address routerId = m_spfroot->GetVertexId ();
 
-  NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): "
-    "Vertex ID = " << routerId);
+  NS_LOG_LOGIC ("Vertex ID = " << routerId);
 //
 // We need to walk the list of nodes looking for the one that has the router
 // ID corresponding to the root vertex.  This is the one we're going to write
@@ -1335,8 +1344,8 @@
 
       if (rtr == 0)
         {
-          NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): "
-            "No GlobalRouter interface on node " << node->GetId ());
+          NS_LOG_LOGIC ("No GlobalRouter interface on node " << 
+            node->GetId ());
           continue;
         }
 //
@@ -1344,13 +1353,11 @@
 // root of the SPF tree, then this node is the one for which we need to 
 // write the routing tables.
 //
-      NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): "
-        "Considering router " << rtr->GetRouterId ());
+      NS_LOG_LOGIC ("Considering router " << rtr->GetRouterId ());
 
       if (rtr->GetRouterId () == routerId)
         {
-          NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddTransit (): "
-            "setting routes for node " << node->GetId ());
+          NS_LOG_LOGIC ("setting routes for node " << node->GetId ());
 //
 // Routing information is updated using the Ipv4 interface.  We need to QI
 // for that interface.  If the node is acting as an IP version 4 router, it
@@ -1375,8 +1382,7 @@
           tempip = tempip.CombineMask (tempmask);
           ipv4->AddNetworkRouteTo (tempip, tempmask, v->GetNextHop (),
             v->GetOutgoingInterfaceId ());
-          NS_DEBUG ("GlobalRouteManagerImpl::SPFIntraAddNetwork (): "
-            " Node " << node->GetId () <<
+          NS_LOG_LOGIC ("Node " << node->GetId () <<
             " add network route to " << tempip <<
             " using next hop " << v->GetNextHop () <<
             " via interface " << v->GetOutgoingInterfaceId ());
@@ -1398,6 +1404,7 @@
   void
 GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v)
 {
+  NS_LOG_FUNCTION;
   v->GetParent ()->AddChild (v);
 }
 
--- a/src/routing/global-routing/global-route-manager.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/routing/global-routing/global-route-manager.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -15,12 +15,11 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Authors:  Craig Dowell (craigdo@ee.washington.edu)
- *           Tom Henderson (tomhend@u.washington.edu)
+ * Author: Tom Henderson (tomhend@u.washington.edu)
  */
 
 #include "ns3/assert.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/simulation-singleton.h"
 #include "global-route-manager.h"
 #include "global-route-manager-impl.h"
--- a/src/routing/global-routing/global-router-interface.cc	Thu Sep 13 17:47:42 2007 -0700
+++ b/src/routing/global-routing/global-router-interface.cc	Thu Sep 13 21:36:32 2007 -0700
@@ -15,11 +15,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Authors:  Craig Dowell (craigdo@ee.washington.edu)
- *           Tom Henderson (tomhend@u.washington.edu)
+ * Authors:  Tom Henderson (tomhend@u.washington.edu)
  */
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 #include "ns3/assert.h"
 #include "ns3/channel.h"
 #include "ns3/net-device.h"
@@ -27,7 +26,7 @@
 #include "ns3/ipv4.h"
 #include "global-router-interface.h"
 
-NS_DEBUG_COMPONENT_DEFINE ("GlobalRouter");
+NS_LOG_COMPONENT_DEFINE ("GlobalRouter");
 
 namespace ns3 {
 
@@ -44,7 +43,7 @@
   m_linkType (Unknown),
   m_metric (0)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ()");
+  NS_LOG_FUNCTION;
 }
 
 GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (
@@ -58,47 +57,48 @@
   m_linkType (linkType),
   m_metric (metric)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (" <<
-    linkType << ", " << linkId << ", " << linkData << ", " << metric << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << linkType << ", " << linkId << ", " << linkData << 
+    ", " << metric << ")");
 }
 
 GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()");
+  NS_LOG_FUNCTION;
 }
 
   Ipv4Address
 GlobalRoutingLinkRecord::GetLinkId (void) const
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GetLinkId ()");
+  NS_LOG_FUNCTION;
   return m_linkId;
 }
 
   void
 GlobalRoutingLinkRecord::SetLinkId (Ipv4Address addr)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::SetLinkId ()");
+  NS_LOG_FUNCTION;
   m_linkId = addr;
 }
 
   Ipv4Address
 GlobalRoutingLinkRecord::GetLinkData (void) const
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GetLinkData ()");
+  NS_LOG_FUNCTION;
   return m_linkData;
 }
 
   void
 GlobalRoutingLinkRecord::SetLinkData (Ipv4Address addr)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::SetLinkData ()");
+  NS_LOG_FUNCTION;
   m_linkData = addr;
 }
 
   GlobalRoutingLinkRecord::LinkType
 GlobalRoutingLinkRecord::GetLinkType (void) const
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GetLinkType ()");
+  NS_LOG_FUNCTION;
   return m_linkType;
 }
 
@@ -106,21 +106,21 @@
 GlobalRoutingLinkRecord::SetLinkType (
   GlobalRoutingLinkRecord::LinkType linkType)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::SetLinkType ()");
+  NS_LOG_FUNCTION;
   m_linkType = linkType;
 }
 
   uint32_t
 GlobalRoutingLinkRecord::GetMetric (void) const
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::GetMetric ()");
+  NS_LOG_FUNCTION;
   return m_metric;
 }
 
   void
 GlobalRoutingLinkRecord::SetMetric (uint32_t metric)
 {
-  NS_DEBUG("GlobalRoutingLinkRecord::SetMetric ()");
+  NS_LOG_FUNCTION;
   m_metric = metric;
 }
 
@@ -140,7 +140,7 @@
   m_attachedRouters(),
   m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED)
 {
-  NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA ()");
+  NS_LOG_FUNCTION;
 }
 
 GlobalRoutingLSA::GlobalRoutingLSA (
@@ -156,8 +156,9 @@
   m_attachedRouters(),
   m_status(status)
 {
-  NS_DEBUG("GlobalRoutingLSA::GlobalRoutingLSA (" << status << ", " <<
-    linkStateId << ", " << advertisingRtr << ")");
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAM ("(" << status << ", " << linkStateId << ", " << 
+    advertisingRtr << ")");
 }
 
 GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa)
@@ -166,6 +167,7 @@
     m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), 
     m_status(lsa.m_status)
 {
+  NS_LOG_FUNCTION;
   NS_ASSERT_MSG(IsEmpty(), 
     "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor");
   CopyLinkRecords (lsa);
@@ -174,6 +176,7 @@
   GlobalRoutingLSA&
 GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa)
 {
+  NS_LOG_FUNCTION;
   m_lsType = lsa.m_lsType;
   m_linkStateId = lsa.m_linkStateId;
   m_advertisingRtr = lsa.m_advertisingRtr;
@@ -188,6 +191,7 @@
   void
 GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa)
 {
+  NS_LOG_FUNCTION;
   for (ListOfLinkRecords_t::const_iterator i = lsa.m_linkRecords.begin ();
        i != lsa.m_linkRecords.end (); 
        i++)
@@ -208,18 +212,19 @@
 
 GlobalRoutingLSA::~GlobalRoutingLSA()
 {
-  NS_DEBUG("GlobalRoutingLSA::~GlobalRoutingLSA ()");
+  NS_LOG_FUNCTION;
   ClearLinkRecords ();
 }
 
   void
 GlobalRoutingLSA::ClearLinkRecords(void)
 {
+  NS_LOG_FUNCTION;
   for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin ();
         i != m_linkRecords.end (); 
         i++)
     {
-      NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords ():  free link record");
+      NS_LOG_LOGIC ("Free link record");
 
       GlobalRoutingLinkRecord *p = *i;
       delete p;
@@ -227,13 +232,14 @@
 
       *i = 0;
     }
-  NS_DEBUG("GlobalRoutingLSA::ClearLinkRecords():  clear list");
+  NS_LOG_LOGIC ("Clear list");
   m_linkRecords.clear();
 }
 
   uint32_t
 GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr)
 {
+  NS_LOG_FUNCTION;
   m_linkRecords.push_back (lr);
   return m_linkRecords.size ();
 }
@@ -241,12 +247,14 @@
   uint32_t
 GlobalRoutingLSA::GetNLinkRecords (void) const
 {
+  NS_LOG_FUNCTION;
   return m_linkRecords.size ();
 }
 
   GlobalRoutingLinkRecord *
 GlobalRoutingLSA::GetLinkRecord (uint32_t n) const
 {
+  NS_LOG_FUNCTION;
   uint32_t j = 0;
   for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin ();
         i != m_linkRecords.end (); 
@@ -264,66 +272,77 @@
   bool
 GlobalRoutingLSA::IsEmpty (void) const
 {
+  NS_LOG_FUNCTION;
   return m_linkRecords.size () == 0;
 }
 
   GlobalRoutingLSA::LSType
 GlobalRoutingLSA::GetLSType (void) const
 {
+  NS_LOG_FUNCTION;
   return m_lsType;
 }
 
   void 
 GlobalRoutingLSA::SetLSType (GlobalRoutingLSA::LSType typ) 
 {
+  NS_LOG_FUNCTION;
   m_lsType = typ;
 }
 
   Ipv4Address
 GlobalRoutingLSA::GetLinkStateId (void) const
 {
+  NS_LOG_FUNCTION;
   return m_linkStateId;
 }
 
   void
 GlobalRoutingLSA::SetLinkStateId (Ipv4Address addr)
 {
+  NS_LOG_FUNCTION;
   m_linkStateId = addr;
 }
 
   Ipv4Address
 GlobalRoutingLSA::GetAdvertisingRouter (void) const
 {
+  NS_LOG_FUNCTION;
   return m_advertisingRtr;
 }
 
   void
 GlobalRoutingLSA::SetAdvertisingRouter (Ipv4Address addr)
 {
+  NS_LOG_FUNCTION;
   m_advertisingRtr = addr;
 }
 
   void 
 GlobalRoutingLSA::SetNetworkLSANetworkMask (Ipv4Mask mask)
 {
+  NS_LOG_FUNCTION;
   m_networkLSANetworkMask = mask;
 }
 
   Ipv4Mask 
 GlobalRoutingLSA::GetNetworkLSANetworkMask (void) const
 {
+  NS_LOG_FUNCTION;
   return m_networkLSANetworkMask;
 }
 
   GlobalRoutingLSA::SPFStatus
 GlobalRoutingLSA::GetStatus (void) const
 {
+  NS_LOG_FUNCTION;
   return m_status;
 }
 
   uint32_t 
 GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr)
 {
+  NS_LOG_FUNCTION;
   m_attachedRouters.push_back (addr);
   return m_attachedRouters.size ();
 }
@@ -331,12 +350,14 @@
   uint32_t 
 GlobalRoutingLSA::GetNAttachedRouters (void) const
 {
+  NS_LOG_FUNCTION;
   return m_attachedRouters.size (); 
 }
 
   Ipv4Address 
 GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const
 {
+  NS_LOG_FUNCTION;
   uint32_t j = 0;
   for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin ();
         i != m_attachedRouters.end (); 
@@ -347,13 +368,15 @@
           return *i;
         }
     }
-  NS_ASSERT_MSG(false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index");
+  NS_ASSERT_MSG(false, 
+    "GlobalRoutingLSA::GetAttachedRouter (): invalid index");
   return Ipv4Address("0.0.0.0");
 }
 
   void
 GlobalRoutingLSA::SetStatus (GlobalRoutingLSA::SPFStatus status)
 {
+  NS_LOG_FUNCTION;
   m_status = status;
 }
 
@@ -414,20 +437,21 @@
 GlobalRouter::GlobalRouter (Ptr<Node> node)
   : m_node(node), m_LSAs()
 {
-  NS_DEBUG("GlobalRouter::GlobalRouter ()");
+  NS_LOG_FUNCTION;
   SetInterfaceId (GlobalRouter::iid);
   m_routerId.Set(GlobalRouteManager::AllocateRouterId ());
 }
 
 GlobalRouter::~GlobalRouter ()
 {
-  NS_DEBUG("GlobalRouter::~GlobalRouter ()");
+  NS_LOG_FUNCTION;
   ClearLSAs();
 }
 
 void
 GlobalRouter::DoDispose ()
 {
+  NS_LOG_FUNCTION;
   m_node = 0;
   Object::DoDispose ();
 }
@@ -435,13 +459,12 @@
   void
 GlobalRouter::ClearLSAs ()
 {
-  NS_DEBUG("GlobalRouter::ClearLSAs ()");
-
+  NS_LOG_FUNCTION;
   for ( ListOfLSAs_t::iterator i = m_LSAs.begin ();
         i != m_LSAs.end (); 
         i++)
     {
-      NS_DEBUG("GlobalRouter::ClearLSAs ():  free LSA");
+      NS_LOG_LOGIC ("Free LSA");
 
       GlobalRoutingLSA *p = *i;
       delete p;
@@ -449,13 +472,14 @@
 
       *i = 0;
     }
-  NS_DEBUG("GlobalRouter::ClearLSAs ():  clear list");
+  NS_LOG_LOGIC ("Clear list");
   m_LSAs.clear();
 }
 
   Ipv4Address
 GlobalRouter::GetRouterId (void) const
 {
+  NS_LOG_FUNCTION;
   return m_routerId;
 }
 
@@ -466,7 +490,8 @@
   uint32_t 
 GlobalRouter::DiscoverLSAs (void)
 {
-  NS_DEBUG("GlobalRouter::DiscoverLSAs () for node " << m_node->GetId () );
+  NS_LOG_FUNCTION;
+  NS_LOG_LOGIC("For node " << m_node->GetId () );
   NS_ASSERT_MSG(m_node, 
     "GlobalRouter::DiscoverLSAs (): <Node> interface not set");
 
@@ -499,14 +524,14 @@
 // ethernets, etc.).  
 //
   uint32_t numDevices = m_node->GetNDevices();
-  NS_DEBUG("GlobalRouter::DiscoverLSAs (): numDevices = " << numDevices);
+  NS_LOG_LOGIC ("numDevices = " << numDevices);
   for (uint32_t i = 0; i < numDevices; ++i)
     {
       Ptr<NetDevice> ndLocal = m_node->GetDevice(i);
 
       if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () )
         {
-          NS_DEBUG("GlobalRouter::DiscoverLSAs (): broadcast link");
+          NS_LOG_LOGIC ("Broadcast link");
           GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord;
 //
 // We need to determine whether we are on a transit or stub network
@@ -521,7 +546,7 @@
           uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal);
           Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
           Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
-          NS_DEBUG("Working with local address " << addrLocal);
+          NS_LOG_LOGIC ("Working with local address " << addrLocal);
 //
 // Now, we're going to walk over to the remote net device on the other end of 
 // the point-to-point channel we now know we have.  This is where our adjacent 
@@ -532,7 +557,7 @@
           if (nDevices == 1)
             {
               // This is a stub broadcast interface
-              NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA stub broadcast link");
+              NS_LOG_LOGIC("Router-LSA stub broadcast link");
               // XXX in future, need to consider if >1 includes other routers
               plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork);
               // Link ID is IP network number of attached network
@@ -549,7 +574,7 @@
             }
           else
             {
-              NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Broadcast link");
+              NS_LOG_LOGIC ("Router-LSA Broadcast link");
               // multiple routers on a broadcast interface
               // lowest IP address is designated router
               plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork);
@@ -559,8 +584,7 @@
               if (desigRtr == addrLocal) 
                 {
                   listOfDRInterfaces.push_back (ndLocal);
-                  NS_DEBUG("GlobalRouter::DiscoverLSAs (): " << 
-                    m_node->GetId () << " is a DR");
+                  NS_LOG_LOGIC (m_node->GetId () << " is a DR");
                 }
               plr->SetLinkId (desigRtr);
               // Link Data is router's own IP address
@@ -574,7 +598,7 @@
         }
       else if (ndLocal->IsPointToPoint () )
         {
-          NS_DEBUG("GlobalRouter::DiscoverLSAs (): Router-LSA Point-to-point device");
+          NS_LOG_LOGIC ("Router-LSA Point-to-point device");
 //
 // Now, we have to find the Ipv4 interface whose netdevice is the one we 
 // just found.  This is still the IP on the local side of the channel.  There 
@@ -588,7 +612,7 @@
 //
           Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
           Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
-          NS_DEBUG("Working with local address " << addrLocal);
+          NS_LOG_LOGIC ("Working with local address " << addrLocal);
 //
 // Now, we're going to walk over to the remote net device on the other end of 
 // the point-to-point channel we now know we have.  This is where our adjacent 
@@ -613,7 +637,7 @@
           NS_ASSERT_MSG(srRemote, 
             "GlobalRouter::DiscoverLSAs():QI for remote <GlobalRouter> failed");
           Ipv4Address rtrIdRemote = srRemote->GetRouterId();
-          NS_DEBUG("Working with remote router " << rtrIdRemote);
+          NS_LOG_LOGIC ("Working with remote router " << rtrIdRemote);
 //
 // Now, just like we did above, we need to get the IP interface index for the 
 // net device on the other end of the point-to-point channel.
@@ -625,7 +649,7 @@
 //
           Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote);
           Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote);
-          NS_DEBUG("Working with remote address " << addrRemote);
+          NS_LOG_LOGIC ("Working with remote address " << addrRemote);
 //
 // Now we can fill out the link records for this link.  There are always two
 // link records; the first is a point-to-point record describing the link and
@@ -655,8 +679,7 @@
 // The LSA goes on a list of LSAs in case we want to begin exporting other
 // kinds of advertisements (than Router LSAs).
   m_LSAs.push_back (pLSA);
-  NS_DEBUG(*pLSA);
-
+  NS_LOG_LOGIC (*pLSA);
 
 // Now, determine whether we need to build a NetworkLSA
   if (listOfDRInterfaces.size () > 0)
@@ -692,7 +715,7 @@
               pLSA->AddAttachedRouter (tempAddr);
             }
           m_LSAs.push_back (pLSA);
-          NS_DEBUG(*pLSA);
+          NS_LOG_LOGIC (*pLSA);
         }
     }
 
@@ -734,7 +757,7 @@
   uint32_t 
 GlobalRouter::GetNumLSAs (void) const
 {
-  NS_DEBUG("GlobalRouter::GetNumLSAs ()");
+  NS_LOG_FUNCTION;
   return m_LSAs.size ();
 }
 
@@ -744,6 +767,7 @@
   bool
 GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const
 {
+  NS_LOG_FUNCTION;
   NS_ASSERT_MSG(lsa.IsEmpty(), "GlobalRouter::GetLSA (): Must pass empty LSA");
 //
 // All of the work was done in GetNumLSAs.  All we have to do here is to
@@ -773,7 +797,7 @@
   Ptr<NetDevice>
 GlobalRouter::GetAdjacent(Ptr<NetDevice> nd, Ptr<Channel> ch) const
 {
-
+  NS_LOG_FUNCTION;
   NS_ASSERT_MSG(ch->GetNDevices() == 2, 
     "GlobalRouter::GetAdjacent (): Channel with other than two devices");
 //
@@ -809,6 +833,7 @@
   uint32_t
 GlobalRouter::FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd) const
 {
+  NS_LOG_FUNCTION;
   Ptr<Ipv4> ipv4 = node->QueryInterface<Ipv4> (Ipv4::iid);
   NS_ASSERT_MSG(ipv4, "QI for <Ipv4> interface failed");
   for (uint32_t i = 0; i < ipv4->GetNInterfaces(); ++i )