use new pcap/ascii api
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 28 Mar 2008 13:19:14 -0700
changeset 2787 83b3e68557e1
parent 2786 f261e50396ac
child 2788 ad1404dcfad4
use new pcap/ascii api
examples/mixed-global-routing.cc
--- a/examples/mixed-global-routing.cc	Fri Mar 28 13:05:44 2008 -0700
+++ b/examples/mixed-global-routing.cc	Fri Mar 28 13:19:14 2008 -0700
@@ -89,6 +89,9 @@
   CommandLine cmd;
   cmd.Parse (argc, argv);
 
+  std::ofstream ascii;
+  ascii.open ("mixed-global-routing.tr");
+
   NS_LOG_INFO ("Create nodes.");
   NodeContainer c;
   c.Create (7);
@@ -103,6 +106,8 @@
   // We create the channels first without any IP addressing information
   NS_LOG_INFO ("Create channels.");
   PointToPointHelper p2p;
+  p2p.EnablePcap ("mixed-global-routing.pcap");
+  p2p.EnableAscii (ascii);
   p2p.SetChannelParameter ("BitRate", DataRate (5000000));
   p2p.SetChannelParameter ("Delay", MilliSeconds (2));
   NetDeviceContainer d0d2 = p2p.Build (n0n2);
@@ -115,6 +120,8 @@
 
   // We create the channels first without any IP addressing information
   CsmaHelper csma;
+  csma.EnablePcap ("mixed-global-routing.pcap");
+  csma.EnableAscii (ascii);
   csma.SetChannelParameter ("BitRate", DataRate (5000000));
   csma.SetChannelParameter ("Delay", MilliSeconds (2));
   NetDeviceContainer d2345 = csma.Build (n2345);
@@ -152,19 +159,6 @@
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
-  // 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 ();
-
-  // Also configure some tcpdump traces; each interface will be traced
-  // The output files will be named simple-p2p.pcap-<nodeId>-<interfaceId>
-  // and can be read by the "tcpdump -r" command (use "-tt" option to
-  // display timestamps correctly)
-  PcapTrace pcaptrace ("mixed-global-routing.pcap");
-  pcaptrace.TraceAllIp ();
 
   NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();