diff --git a/examples/csma-broadcast.cc b/examples/csma-broadcast.cc index a6d57839b..fbd91375c 100644 --- a/examples/csma-broadcast.cc +++ b/examples/csma-broadcast.cc @@ -34,7 +34,6 @@ #include "ns3/core-module.h" #include "ns3/helper-module.h" -#include "ns3/internet-node-module.h" #include "ns3/simulator-module.h" using namespace ns3; diff --git a/examples/simple-alternate-routing.cc b/examples/simple-alternate-routing.cc index d5c907544..c2f6dcb5f 100644 --- a/examples/simple-alternate-routing.cc +++ b/examples/simple-alternate-routing.cc @@ -41,8 +41,6 @@ #include "ns3/simulator-module.h" #include "ns3/helper-module.h" #include "ns3/global-route-manager.h" -#include "ns3/ascii-trace.h" -#include "ns3/pcap-trace.h" using namespace ns3; @@ -105,6 +103,9 @@ main (int argc, char *argv[]) // DefaultValue::Bind ()s at run-time, via command-line arguments cmd.Parse (argc, argv); + std::ofstream ascii; + ascii.open ("simple-alternate-routing.tr"); + // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); @@ -118,6 +119,8 @@ main (int argc, char *argv[]) // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); PointToPointHelper p2p; + p2p.EnablePcap ("simple-alternate-routing.pcap"); + p2p.EnableAscii (ascii); p2p.SetChannelParameter ("BitRate", DataRate (5000000)); p2p.SetChannelParameter ("Delay", MilliSeconds (2)); NetDeviceContainer d0d2 = p2p.Build (n0n2); @@ -177,19 +180,6 @@ main (int argc, char *argv[]) apps.Start (Seconds (1.1)); apps.Stop (Seconds (10.0)); - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the simple-alternate-routing.tr file - NS_LOG_INFO ("Configure Tracing."); - AsciiTrace asciitrace ("simple-alternate-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-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) - PcapTrace pcaptrace ("simple-alternate-routing.pcap"); - pcaptrace.TraceAllIp (); NS_LOG_INFO ("Run Simulation."); Simulator::Run (); diff --git a/examples/simple-error-model.cc b/examples/simple-error-model.cc index 6a2b74493..52e80594a 100644 --- a/examples/simple-error-model.cc +++ b/examples/simple-error-model.cc @@ -38,12 +38,11 @@ // - Tracing of queues and packet receptions to file // "simple-error-model.tr" +#include #include "ns3/core-module.h" #include "ns3/common-module.h" #include "ns3/simulator-module.h" #include "ns3/helper-module.h" -#include "ns3/ascii-trace.h" -#include "ns3/pcap-trace.h" #include "ns3/global-route-manager.h" using namespace ns3; @@ -72,6 +71,9 @@ main (int argc, char *argv[]) CommandLine cmd; cmd.Parse (argc, argv); + std::ofstream ascii; + ascii.open ("simple-error-model.pcap"); + // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); @@ -87,6 +89,8 @@ main (int argc, char *argv[]) // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); PointToPointHelper p2p; + p2p.EnablePcap ("simple-error-model.pcap"); + p2p.EnableAscii (ascii); p2p.SetChannelParameter ("BitRate", DataRate (5000000)); p2p.SetChannelParameter ("Delay", MilliSeconds (2)); NetDeviceContainer d0d2 = p2p.Build (n0n2); @@ -162,12 +166,6 @@ main (int argc, char *argv[]) pem->SetList (sampleList); d0d2.Get (1)->SetAttribute ("ReceiveErrorModel", pem); - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the simple-error-model.tr file - NS_LOG_INFO ("Configure Tracing."); - AsciiTrace asciitrace ("simple-error-model.tr"); - asciitrace.TraceAllQueues (); - asciitrace.TraceAllNetDeviceRx (); NS_LOG_INFO ("Run Simulation."); Simulator::Run (); diff --git a/examples/simple-global-routing.cc b/examples/simple-global-routing.cc index 61cc3a12f..179a2faf8 100644 --- a/examples/simple-global-routing.cc +++ b/examples/simple-global-routing.cc @@ -45,8 +45,6 @@ #include "ns3/core-module.h" #include "ns3/simulator-module.h" #include "ns3/helper-module.h" -#include "ns3/ascii-trace.h" -#include "ns3/pcap-trace.h" #include "ns3/global-route-manager.h" using namespace ns3; @@ -95,6 +93,9 @@ main (int argc, char *argv[]) CommandLine cmd; cmd.Parse (argc, argv); + std::ofstream ascii; + ascii.open ("simple-global-routing.tr"); + // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. NS_LOG_INFO ("Create nodes."); @@ -110,6 +111,8 @@ main (int argc, char *argv[]) // We create the channels first without any IP addressing information NS_LOG_INFO ("Create channels."); PointToPointHelper p2p; + p2p.EnablePcap ("simple-global-routing.pcap"); + p2p.EnableAscii (ascii); p2p.SetChannelParameter ("BitRate", DataRate (5000000)); p2p.SetChannelParameter ("Delay", MilliSeconds (2)); NetDeviceContainer d0d2 = p2p.Build (n0n2); @@ -167,19 +170,6 @@ main (int argc, char *argv[]) apps.Start (Seconds (1.1)); 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 ("simple-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-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) - PcapTrace pcaptrace ("simple-global-routing.pcap"); - pcaptrace.TraceAllIp (); NS_LOG_INFO ("Run Simulation."); Simulator::Run (); diff --git a/examples/tcp-large-transfer.cc b/examples/tcp-large-transfer.cc index e9c661086..550be0a45 100644 --- a/examples/tcp-large-transfer.cc +++ b/examples/tcp-large-transfer.cc @@ -40,9 +40,6 @@ #include "ns3/global-route-manager.h" #include "ns3/simulator-module.h" -#include "ns3/ascii-trace.h" -#include "ns3/pcap-trace.h" - using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TcpLargeTransfer"); @@ -133,8 +130,13 @@ int main (int argc, char *argv[]) c1.Add (c0.Get (1)); c1.Create (1); + std::ofstream ascii; + ascii.open ("tcp-large-transfer.tr"); + // We create the channels first without any IP addressing information PointToPointHelper p2p; + p2p.EnablePcap ("tcp-large-transfer.pcap"); + p2p.EnableAscii (ascii); p2p.SetChannelParameter ("BitRate", DataRate(10000000)); p2p.SetChannelParameter ("Delay", MilliSeconds(10)); NetDeviceContainer dev0 = p2p.Build (c0); @@ -180,21 +182,6 @@ int main (int argc, char *argv[]) Simulator::ScheduleNow (&StartFlow, localSocket, nBytes, ipInterfs.GetAddress (1), servPort); - // Configure tracing of all enqueue, dequeue, and NetDevice receive events - // Trace output will be sent to the simple-examples.tr file - AsciiTrace asciitrace ("tcp-large-transfer.tr"); - asciitrace.TraceAllQueues (); - asciitrace.TraceAllNetDeviceRx (); - - - // Also configure some tcpdump traces; each interface will be traced - // The output files will be named - // simple-examples.pcap-- - // and can be read by the "tcpdump -r" command (use "-tt" option to - // display timestamps correctly) - PcapTrace pcaptrace ("tcp-large-transfer.pcap"); - pcaptrace.TraceAllIp (); - Config::ConnectWithoutContext ("/NodeList/*/ApplicationList/*/Rx", MakeCallback (&ApplicationTraceSink)); diff --git a/examples/udp-echo.cc b/examples/udp-echo.cc index de4c7902c..599f8efa9 100644 --- a/examples/udp-echo.cc +++ b/examples/udp-echo.cc @@ -25,11 +25,10 @@ // - DropTail queues // - Tracing of queues and packet receptions to file "udp-echo.tr" +#include #include "ns3/core-module.h" #include "ns3/simulator-module.h" #include "ns3/helper-module.h" -#include "ns3/ascii-trace.h" -#include "ns3/pcap-trace.h" using namespace ns3; @@ -83,11 +82,16 @@ main (int argc, char *argv[]) InternetStackHelper internet; internet.Build (n); + std::ofstream ascii; + ascii.open ("udp-echo.tr"); + NS_LOG_INFO ("Create channels."); // // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; + csma.EnablePcap ("udp-echo.pcap"); + csma.EnableAscii (ascii); csma.SetChannelParameter ("BitRate", DataRate(5000000)); csma.SetChannelParameter ("Delay", MilliSeconds (2)); NetDeviceContainer d = csma.Build (n); @@ -128,23 +132,6 @@ main (int argc, char *argv[]) apps.Stop (Seconds (10.0)); // -// Configure tracing of all enqueue, dequeue, and NetDevice receive events. -// Trace output will be sent to the file "udp-echo.tr" -// - NS_LOG_INFO ("Configure Tracing."); - AsciiTrace asciitrace ("udp-echo.tr"); - asciitrace.TraceAllNetDeviceRx (); - asciitrace.TraceAllQueues (); -// -// Also configure some tcpdump traces; each interface will be traced. -// The output files will be named: -// udp-echo.pcap-- -// and can be read by the "tcpdump -r" command (use "-tt" option to -// display timestamps correctly) -// - PcapTrace pcaptrace ("udp-echo.pcap"); - pcaptrace.TraceAllIp (); -// // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation.");