examples/mixed-global-routing.cc
changeset 1504 36ecc970ba96
parent 1494 c2985e1cd091
child 1514 addb79f47ba5
--- a/examples/mixed-global-routing.cc	Thu Sep 13 12:37:30 2007 -0700
+++ b/examples/mixed-global-routing.cc	Thu Sep 13 17:47:42 2007 -0700
@@ -36,7 +36,7 @@
 #include <string>
 #include <cassert>
 
-#include "ns3/debug.h"
+#include "ns3/log.h"
 
 #include "ns3/command-line.h"
 #include "ns3/default-value.h"
@@ -68,22 +68,39 @@
 
 using namespace ns3;
 
-int main (int argc, char *argv[])
+NS_LOG_COMPONENT_DEFINE ("MixedGlobalRoutingExample");
+
+int 
+main (int argc, char *argv[])
 {
 
   // Users may find it convenient to turn on explicit debugging
   // for selected modules; the below lines suggest how to do this
 #if 0 
-  DebugComponentEnable ("Object");
-  DebugComponentEnable ("Queue");
-  DebugComponentEnable ("DropTailQueue");
-  DebugComponentEnable ("Channel");
-  DebugComponentEnable ("PointToPointChannel");
-  DebugComponentEnable ("PointToPointNetDevice");
-  DebugComponentEnable ("GlobalRouter");
-  DebugComponentEnable ("GlobalRouteManager");
+  LogComponentEnable ("MixedGlobalRoutingExample", LOG_LEVEL_INFO);
+
+  LogComponentEnable("Object", LOG_LEVEL_ALL);
+  LogComponentEnable("Queue", LOG_LEVEL_ALL);
+  LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
+  LogComponentEnable("Channel", LOG_LEVEL_ALL);
+  LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL);
+  LogComponentEnable("NetDevice", LOG_LEVEL_ALL);
+  LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL);
+  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
+  LogComponentEnable("PacketSocket", LOG_LEVEL_ALL);
+  LogComponentEnable("Socket", LOG_LEVEL_ALL);
+  LogComponentEnable("UdpSocket", LOG_LEVEL_ALL);
+  LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL);
+  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
+  LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL);
+  LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL);
+  LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL);
+  LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL);
+  LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL);
+  LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL);
+  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL);
+  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL);
 #endif
-
   // Set up some default values for the simulation.  Use the Bind ()
   // technique to tell the system what subclass of Queue to use,
   // and what the queue limit is
@@ -102,6 +119,7 @@
   // Bind ()s at run-time, via command-line arguments
   CommandLine::Parse (argc, argv);
 
+  NS_LOG_INFO ("Create nodes.");
   Ptr<Node> n0 = Create<InternetNode> ();
   Ptr<Node> n1 = Create<InternetNode> (); 
   Ptr<Node> n2 = Create<InternetNode> (); 
@@ -111,6 +129,7 @@
   Ptr<Node> n6 = Create<InternetNode> ();
 
   // We create the channels first without any IP addressing information
+  NS_LOG_INFO ("Create channels.");
   Ptr<PointToPointChannel> channel0 = 
     PointToPointTopology::AddPointToPointLink (
       n0, n2, DataRate (5000000), MilliSeconds (2));
@@ -128,6 +147,7 @@
     CsmaTopology::CreateCsmaChannel(
       DataRate(5000000), MilliSeconds(2));
 
+  NS_LOG_INFO ("Build Topology.");
   uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0,
                                          Mac48Address("10:54:23:54:23:50"));
   uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0,
@@ -138,6 +158,7 @@
                                          Mac48Address("10:54:23:54:23:53"));
 
   // Later, we add IP addresses.  
+  NS_LOG_INFO ("Assign IP Addresses.");
   PointToPointTopology::AddIpv4Addresses (
       channel0, n0, Ipv4Address ("10.1.1.1"),
       n2, Ipv4Address ("10.1.1.2"));
@@ -168,6 +189,7 @@
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
+  NS_LOG_INFO ("Create Applications.");
   Ptr<OnOffApplication> ooff = Create<OnOffApplication> (
     n0, 
     InetSocketAddress ("10.1.3.2", 80), 
@@ -182,6 +204,7 @@
 
   // Configure tracing of all enqueue, dequeue, and NetDevice receive events
   // Trace output will be sent to the simple-global-routing.tr file
+  NS_LOG_INFO ("Configure Tracing.");
   AsciiTrace asciitrace ("mixed-global-routing.tr");
   asciitrace.TraceAllQueues ();
   asciitrace.TraceAllNetDeviceRx ();
@@ -193,7 +216,8 @@
   PcapTrace pcaptrace ("mixed-global-routing.pcap");
   pcaptrace.TraceAllIp ();
 
+  NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();
-    
   Simulator::Destroy ();
+  NS_LOG_INFO ("Done.");
 }