merge
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 03 Oct 2007 17:38:49 +0100
changeset 1759 a7793aa3ef66
parent 1757 530d2e974eb2 (current diff)
parent 1541 fc95ffdef447 (diff)
child 1760 15e9e94e7e2e
merge
doc/doxygen.conf
doc/trace-source-list.h
tutorial/tutorial-1.cc
tutorial/tutorial-2.cc
tutorial/tutorial-3.cc
tutorial/tutorial-4.cc
tutorial/wscript-0
tutorial/wscript-1
tutorial/wscript-2
tutorial/wscript-3
tutorial/wscript-4
wscript
--- a/.hgignore	Thu Sep 27 12:49:17 2007 +0100
+++ b/.hgignore	Wed Oct 03 17:38:49 2007 +0100
@@ -8,3 +8,4 @@
 ^doc/latex
 ^\.lock-wscript
 ^\.waf
+^doc/trace-source-list\.h$
--- a/doc/doxygen.conf	Thu Sep 27 12:49:17 2007 +0100
+++ b/doc/doxygen.conf	Wed Oct 03 17:38:49 2007 +0100
@@ -397,7 +397,7 @@
 # The QUIET tag can be used to turn on/off the messages that are generated 
 # by doxygen. Possible values are YES and NO. If left blank NO is used.
 
-QUIET                  = NO
+QUIET                  = YES
 
 # The WARNINGS tag can be used to turn on/off the warning messages that are 
 # generated by doxygen. Possible values are YES and NO. If left blank 
--- a/doc/trace-source-list.h	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-///
-/// \ingroup TraceSourceList
-/// \brief send ipv4 packet to outgoing interface
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet sent.
-/// \param arg3 index of output ipv4 interface.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/ipv4/tx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback0 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
-
-///
-/// \ingroup TraceSourceList
-/// \brief receive ipv4 packet from incoming interface
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet received.
-/// \param arg3 index of input ipv4 interface.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/ipv4/rx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback1 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
-
-///
-/// \ingroup TraceSourceList
-/// \brief drop ipv4 packet
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet dropped.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/ipv4/drop.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback2 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief store packet in queue
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet queued.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/enqueue.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::QueueTraceType
-void TraceSinkCallback3 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief remove packet from queue
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet dequeued.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/dequeue.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::QueueTraceType
-void TraceSinkCallback4 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief drop packet from queue
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet dropped.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/drop.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::QueueTraceType
-void TraceSinkCallback5 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief receive MAC packet
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet received.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::PointToPointTraceType
-void TraceSinkCallback6 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief receive MAC packet
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet received.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::CsmaTraceType
-void TraceSinkCallback7 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief drop MAC packet
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet dropped.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/drop.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::NodeNetDeviceIndex
-///  - ns3::CsmaTraceType
-void TraceSinkCallback8 (const TraceContext & arg1, const Packet & arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief The value of the speed vector changed
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 the mobility model whose course changed.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/$MobilityModelNotifier/course-change.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-void TraceSinkCallback9 (const TraceContext & arg1, Ptr<const MobilityModel> arg2);
-
-///
-/// \ingroup TraceSourceList
-/// \brief send ipv4 packet to outgoing interface
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet sent.
-/// \param arg3 index of output ipv4 interface.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/tx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback10 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
-
-///
-/// \ingroup TraceSourceList
-/// \brief receive ipv4 packet from incoming interface
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet received.
-/// \param arg3 index of input ipv4 interface.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/rx.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback11 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
-
-///
-/// \ingroup TraceSourceList
-/// \brief drop ipv4 packet
-/// \param arg1 the trace context associated to the connected trace source.
-/// \param arg2 packet dropped.
-///
-///
-/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/drop.
-///
-/// The following classes can be extracted from \p arg1 with 
-/// ns3::TraceContext::GetElement:
-///  - ns3::NodeListIndex
-///  - ns3::Ipv4L3ProtocolTraceContextElement
-void TraceSinkCallback12 (const TraceContext & arg1, const Packet & arg2);
-
--- a/src/applications/packet-sink/packet-sink.cc	Thu Sep 27 12:49:17 2007 +0100
+++ b/src/applications/packet-sink/packet-sink.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -78,16 +78,15 @@
       m_socket = socketFactory->CreateSocket ();
       m_socket->Bind (m_local);
     }
-  m_socket->SetRecvCallback((Callback<void, Ptr<Socket>, const Packet &,
-    const Address &>) MakeCallback(&PacketSink::Receive, this));
+  m_socket->SetRecvCallback (MakeCallback(&PacketSink::Receive, this));
 }
 
 void PacketSink::StopApplication()     // Called at time specified by Stop
 {
   if (!m_socket) 
     {
-      m_socket->SetRecvCallback((Callback<void, Ptr<Socket>, const Packet &,
-                               const Address &>) NULL);
+      m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket>, 
+        const Packet &, const Address &> ());
  
     }
 }
--- a/src/applications/udp-echo/udp-echo-server.cc	Thu Sep 27 12:49:17 2007 +0100
+++ b/src/applications/udp-echo/udp-echo-server.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -84,8 +84,7 @@
       m_socket->Bind (m_local);
     }
 
-  m_socket->SetRecvCallback((Callback<void, Ptr<Socket>, const Packet &,
-    const Address &>) MakeCallback(&UdpEchoServer::Receive, this));
+  m_socket->SetRecvCallback(MakeCallback(&UdpEchoServer::Receive, this));
 }
 
 void 
@@ -95,8 +94,8 @@
 
   if (!m_socket) 
     {
-      m_socket->SetRecvCallback((Callback<void, Ptr<Socket>, const Packet &,
-        const Address &>) NULL);
+      m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket>, 
+        const Packet &, const Address &> ());
     }
 }
 
--- a/src/core/command-line.cc	Thu Sep 27 12:49:17 2007 +0100
+++ b/src/core/command-line.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -85,9 +85,7 @@
 void 
 CommandLine::Parse (int argc, char *argv[])
 {
-  argc--;
-  argv++;
-  while (argc > 0)
+  for (argc--, argv++; argc > 0; argc--, argv++)
     {
       // remove "--" or "-" heading.
       std::string param = *argv;
@@ -142,8 +140,6 @@
               continue;
             }
         }
-      argc--;
-      argv++;
     }
 }
 
--- a/src/core/object.cc	Thu Sep 27 12:49:17 2007 +0100
+++ b/src/core/object.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -192,7 +192,7 @@
 Ptr<Object>
 Object::DoQueryInterface (InterfaceId iid) const
 {
-  NS_ASSERT (Check ());
+  NS_ASSERT (CheckLoose ());
   const Object *currentObject = this;
   do {
     NS_ASSERT (currentObject != 0);
@@ -227,24 +227,26 @@
 {
   NS_ASSERT (!m_disposed);
   NS_ASSERT (!o->m_disposed);
-  NS_ASSERT (Check ());
-  NS_ASSERT (o->Check ());
+  NS_ASSERT (CheckLoose ());
+  NS_ASSERT (o->CheckLoose ());
   Object *other = PeekPointer (o);
   Object *next = m_next;
   m_next = other->m_next;
   other->m_next = next;
-  NS_ASSERT (Check ());
-  NS_ASSERT (o->Check ());
+  NS_ASSERT (CheckLoose ());
+  NS_ASSERT (o->CheckLoose ());
 }
 
 void 
 Object::TraceConnect (std::string path, const CallbackBase &cb) const
 {
+  NS_ASSERT (CheckLoose ());
   GetTraceResolver ()->Connect (path, cb, TraceContext ());
 }
 void 
 Object::TraceDisconnect (std::string path, const CallbackBase &cb) const
 {
+  NS_ASSERT (CheckLoose ());
   GetTraceResolver ()->Disconnect (path, cb);
 }
 
@@ -264,6 +266,7 @@
 Ptr<TraceResolver>
 Object::GetTraceResolver (void) const
 {
+  NS_ASSERT (CheckLoose ());
   Ptr<InterfaceIdTraceResolver> resolver =
     Create<InterfaceIdTraceResolver> (this);
   return resolver;
@@ -275,6 +278,28 @@
   return (m_count > 0);
 }
 
+/* In some cases, when an event is scheduled against a subclass of
+ * Object, and if no one owns a reference directly to this object, the
+ * object is alive, has a refcount of zero and the method ran when the
+ * event expires runs against the raw pointer which means that we are
+ * manipulating an object with a refcount of zero.  So, instead we
+ * check the aggregate reference count.
+ */
+bool 
+Object::CheckLoose (void) const
+{
+  uint32_t refcount = 0;
+  const Object *current = this;
+  do
+    {
+      refcount += current->m_count;
+      current = current->m_next;
+    }
+  while (current != this);
+
+  return (refcount > 0);
+}
+
 void
 Object::MaybeDelete (void) const
 {
--- a/src/core/object.h	Thu Sep 27 12:49:17 2007 +0100
+++ b/src/core/object.h	Wed Oct 03 17:38:49 2007 +0100
@@ -186,6 +186,7 @@
                          TraceResolver::SourceCollection *collection) const;
   void DoTraceAll (std::ostream &os, const TraceContext &context) const;
   bool Check (void) const;
+  bool CheckLoose (void) const;
   void MaybeDelete (void) const;
   mutable uint32_t m_count;
   InterfaceId m_iid;
--- a/tutorial/tutorial-1.cc	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "ns3/log.h"
-#include "ns3/ptr.h"
-#include "ns3/internet-node.h"
-#include "ns3/csma-channel.h"
-#include "ns3/mac48-address.h"
-#include "ns3/csma-net-device.h"
-#include "ns3/csma-topology.h"
-#include "ns3/csma-ipv4-topology.h"
-#include "ns3/udp-echo-client.h"
-#include "ns3/udp-echo-server.h"
-#include "ns3/simulator.h"
-#include "ns3/nstime.h"
-
-NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
-
-using namespace ns3;
-
-int 
-main (int argc, char *argv[])
-{
-  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
-
-  NS_LOG_INFO ("UDP Echo Simulation");
-
-  Ptr<Node> n0 = Create<InternetNode> ();
-  Ptr<Node> n1 = Create<InternetNode> ();
-  Ptr<Node> n2 = Create<InternetNode> ();
-  Ptr<Node> n3 = Create<InternetNode> ();
-
-  Ptr<CsmaChannel> lan = 
-    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
-
-  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
-    "08:00:2e:00:00:00");
-
-  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
-    "08:00:2e:00:00:01");
-
-  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
-    "08:00:2e:00:00:02");
-
-  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
-    "08:00:2e:00:00:03");
-
-  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
-
-  uint16_t port = 7;
-
-  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
-    1, Seconds(1.), 1024);
-
-  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
-
-  server->Start(Seconds(1.));
-  client->Start(Seconds(2.));
-
-  server->Stop (Seconds(10.));
-  client->Stop (Seconds(10.));
-
-  Simulator::Run ();
-  Simulator::Destroy ();
-}
--- a/tutorial/tutorial-2.cc	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "ns3/log.h"
-#include "ns3/ptr.h"
-#include "ns3/internet-node.h"
-#include "ns3/csma-channel.h"
-#include "ns3/mac48-address.h"
-#include "ns3/csma-net-device.h"
-#include "ns3/csma-topology.h"
-#include "ns3/csma-ipv4-topology.h"
-#include "ns3/udp-echo-client.h"
-#include "ns3/udp-echo-server.h"
-#include "ns3/simulator.h"
-#include "ns3/nstime.h"
-#include "ns3/ascii-trace.h"
-
-NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
-
-using namespace ns3;
-
-int 
-main (int argc, char *argv[])
-{
-  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
-
-  NS_LOG_INFO ("UDP Echo Simulation");
-
-  Ptr<Node> n0 = Create<InternetNode> ();
-  Ptr<Node> n1 = Create<InternetNode> ();
-  Ptr<Node> n2 = Create<InternetNode> ();
-  Ptr<Node> n3 = Create<InternetNode> ();
-
-  Ptr<CsmaChannel> lan = 
-    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
-
-  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
-    "08:00:2e:00:00:00");
-
-  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
-    "08:00:2e:00:00:01");
-
-  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
-    "08:00:2e:00:00:02");
-
-  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
-    "08:00:2e:00:00:03");
-
-  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
-
-  uint16_t port = 7;
-
-  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
-    1, Seconds(1.), 1024);
-
-  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
-
-  server->Start(Seconds(1.));
-  client->Start(Seconds(2.));
-
-  server->Stop (Seconds(10.));
-  client->Stop (Seconds(10.));
-
-  AsciiTrace asciitrace ("tutorial.tr");
-  asciitrace.TraceAllQueues ();
-  asciitrace.TraceAllNetDeviceRx ();
-
-  Simulator::Run ();
-  Simulator::Destroy ();
-}
--- a/tutorial/tutorial-3.cc	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "ns3/log.h"
-#include "ns3/ptr.h"
-#include "ns3/internet-node.h"
-#include "ns3/csma-channel.h"
-#include "ns3/mac48-address.h"
-#include "ns3/csma-net-device.h"
-#include "ns3/csma-topology.h"
-#include "ns3/csma-ipv4-topology.h"
-#include "ns3/udp-echo-client.h"
-#include "ns3/udp-echo-server.h"
-#include "ns3/simulator.h"
-#include "ns3/nstime.h"
-#include "ns3/ascii-trace.h"
-#include "ns3/pcap-trace.h"
-
-NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
-
-using namespace ns3;
-
-int 
-main (int argc, char *argv[])
-{
-  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
-
-  NS_LOG_INFO ("UDP Echo Simulation");
-
-  Ptr<Node> n0 = Create<InternetNode> ();
-  Ptr<Node> n1 = Create<InternetNode> ();
-  Ptr<Node> n2 = Create<InternetNode> ();
-  Ptr<Node> n3 = Create<InternetNode> ();
-
-  Ptr<CsmaChannel> lan = 
-    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
-
-  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
-    "08:00:2e:00:00:00");
-
-  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
-    "08:00:2e:00:00:01");
-
-  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
-    "08:00:2e:00:00:02");
-
-  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
-    "08:00:2e:00:00:03");
-
-  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
-
-  uint16_t port = 7;
-
-  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
-    1, Seconds(1.), 1024);
-
-  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
-
-  server->Start(Seconds(1.));
-  client->Start(Seconds(2.));
-
-  server->Stop (Seconds(10.));
-  client->Stop (Seconds(10.));
-
-  AsciiTrace asciitrace ("tutorial.tr");
-  asciitrace.TraceAllQueues ();
-  asciitrace.TraceAllNetDeviceRx ();
-
-  PcapTrace pcaptrace ("tutorial.pcap");
-  pcaptrace.TraceAllIp ();
-
-  Simulator::Run ();
-  Simulator::Destroy ();
-}
--- a/tutorial/tutorial-4.cc	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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
- */
-
-#include "ns3/log.h"
-#include "ns3/ptr.h"
-#include "ns3/internet-node.h"
-#include "ns3/point-to-point-channel.h"
-#include "ns3/csma-channel.h"
-#include "ns3/mac48-address.h"
-#include "ns3/point-to-point-net-device.h"
-#include "ns3/csma-net-device.h"
-#include "ns3/point-to-point-topology.h"
-#include "ns3/csma-topology.h"
-#include "ns3/csma-ipv4-topology.h"
-#include "ns3/udp-echo-client.h"
-#include "ns3/udp-echo-server.h"
-#include "ns3/simulator.h"
-#include "ns3/nstime.h"
-#include "ns3/ascii-trace.h"
-#include "ns3/pcap-trace.h"
-#include "ns3/global-route-manager.h"
-
-NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
-
-using namespace ns3;
-
-// Network topology
-//
-//                       point to point
-//                      +--------------+
-//                      |              |
-//       n0   n1   n2   n3             n4   n5   n6   n7
-//       |    |    |    |              |    |    |    |
-//       ================              ================
-//             lan0                          lan1
-//
-int 
-main (int argc, char *argv[])
-{
-  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
-
-  NS_LOG_INFO ("UDP Echo Simulation");
-
-  Ptr<Node> n0 = Create<InternetNode> ();
-  Ptr<Node> n1 = Create<InternetNode> ();
-  Ptr<Node> n2 = Create<InternetNode> ();
-  Ptr<Node> n3 = Create<InternetNode> ();
-
-  Ptr<Node> n4 = Create<InternetNode> ();
-  Ptr<Node> n5 = Create<InternetNode> ();
-  Ptr<Node> n6 = Create<InternetNode> ();
-  Ptr<Node> n7 = Create<InternetNode> ();
-
-  Ptr<CsmaChannel> lan1 = 
-    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
-
-  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan1, 
-    "08:00:2e:00:00:00");
-
-  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan1, 
-    "08:00:2e:00:00:01");
-
-  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, 
-    "08:00:2e:00:00:02");
-
-  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, 
-    "08:00:2e:00:00:03");
-
-  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
-
-  Ptr<CsmaChannel> lan2 = 
-    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
-
-  uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan2, 
-    "08:00:2e:00:00:04");
-
-  uint32_t nd5 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, lan2, 
-    "08:00:2e:00:00:05");
-
-  uint32_t nd6 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n6, lan2, 
-    "08:00:2e:00:00:06");
-
-  uint32_t nd7 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n7, lan2, 
-    "08:00:2e:00:00:07");
-
-  CsmaIpv4Topology::AddIpv4Address (n4, nd4, "10.1.2.1", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n5, nd5, "10.1.2.2", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n6, nd6, "10.1.2.3", "255.255.255.0");
-  CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0");
-
-  Ptr<PointToPointChannel> link = PointToPointTopology::AddPointToPointLink (
-    n3, n4, DataRate (500000), MilliSeconds (20));
-
-  PointToPointTopology::AddIpv4Addresses (link, n3, "10.1.3.1", 
-    n4, "10.1.3.2");
-
-  uint16_t port = 7;
-
-  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.2.4", port, 
-    1, Seconds(1.), 1024);
-
-  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n7, port);
-
-  server->Start(Seconds(1.));
-  client->Start(Seconds(2.));
-
-  server->Stop (Seconds(10.));
-  client->Stop (Seconds(10.));
-
-  AsciiTrace asciitrace ("tutorial-4.tr");
-  asciitrace.TraceAllQueues ();
-  asciitrace.TraceAllNetDeviceRx ();
-
-  PcapTrace pcaptrace ("tutorial-4.pcap");
-  pcaptrace.TraceAllIp ();
-
-  GlobalRouteManager::PopulateRoutingTables ();
-
-  Simulator::Run ();
-  Simulator::Destroy ();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tutorial/tutorial-csma-echo-ascii-trace.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -0,0 +1,86 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "ns3/log.h"
+#include "ns3/ptr.h"
+#include "ns3/internet-node.h"
+#include "ns3/csma-channel.h"
+#include "ns3/mac48-address.h"
+#include "ns3/csma-net-device.h"
+#include "ns3/csma-topology.h"
+#include "ns3/csma-ipv4-topology.h"
+#include "ns3/udp-echo-client.h"
+#include "ns3/udp-echo-server.h"
+#include "ns3/simulator.h"
+#include "ns3/nstime.h"
+#include "ns3/ascii-trace.h"
+
+NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
+
+using namespace ns3;
+
+int 
+main (int argc, char *argv[])
+{
+  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
+
+  NS_LOG_INFO ("UDP Echo Simulation");
+
+  Ptr<Node> n0 = Create<InternetNode> ();
+  Ptr<Node> n1 = Create<InternetNode> ();
+  Ptr<Node> n2 = Create<InternetNode> ();
+  Ptr<Node> n3 = Create<InternetNode> ();
+
+  Ptr<CsmaChannel> lan = 
+    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
+
+  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
+    "08:00:2e:00:00:00");
+
+  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
+    "08:00:2e:00:00:01");
+
+  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
+    "08:00:2e:00:00:02");
+
+  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
+    "08:00:2e:00:00:03");
+
+  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
+
+  uint16_t port = 7;
+
+  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
+    1, Seconds(1.), 1024);
+
+  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+
+  server->Start(Seconds(1.));
+  client->Start(Seconds(2.));
+
+  server->Stop (Seconds(10.));
+  client->Stop (Seconds(10.));
+
+  AsciiTrace asciitrace ("tutorial.tr");
+  asciitrace.TraceAllQueues ();
+  asciitrace.TraceAllNetDeviceRx ();
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tutorial/tutorial-csma-echo-pcap-trace.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -0,0 +1,90 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "ns3/log.h"
+#include "ns3/ptr.h"
+#include "ns3/internet-node.h"
+#include "ns3/csma-channel.h"
+#include "ns3/mac48-address.h"
+#include "ns3/csma-net-device.h"
+#include "ns3/csma-topology.h"
+#include "ns3/csma-ipv4-topology.h"
+#include "ns3/udp-echo-client.h"
+#include "ns3/udp-echo-server.h"
+#include "ns3/simulator.h"
+#include "ns3/nstime.h"
+#include "ns3/ascii-trace.h"
+#include "ns3/pcap-trace.h"
+
+NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
+
+using namespace ns3;
+
+int 
+main (int argc, char *argv[])
+{
+  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
+
+  NS_LOG_INFO ("UDP Echo Simulation");
+
+  Ptr<Node> n0 = Create<InternetNode> ();
+  Ptr<Node> n1 = Create<InternetNode> ();
+  Ptr<Node> n2 = Create<InternetNode> ();
+  Ptr<Node> n3 = Create<InternetNode> ();
+
+  Ptr<CsmaChannel> lan = 
+    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
+
+  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
+    "08:00:2e:00:00:00");
+
+  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
+    "08:00:2e:00:00:01");
+
+  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
+    "08:00:2e:00:00:02");
+
+  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
+    "08:00:2e:00:00:03");
+
+  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
+
+  uint16_t port = 7;
+
+  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
+    1, Seconds(1.), 1024);
+
+  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+
+  server->Start(Seconds(1.));
+  client->Start(Seconds(2.));
+
+  server->Stop (Seconds(10.));
+  client->Stop (Seconds(10.));
+
+  AsciiTrace asciitrace ("tutorial.tr");
+  asciitrace.TraceAllQueues ();
+  asciitrace.TraceAllNetDeviceRx ();
+
+  PcapTrace pcaptrace ("tutorial.pcap");
+  pcaptrace.TraceAllIp ();
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tutorial/tutorial-csma-echo.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -0,0 +1,81 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "ns3/log.h"
+#include "ns3/ptr.h"
+#include "ns3/internet-node.h"
+#include "ns3/csma-channel.h"
+#include "ns3/mac48-address.h"
+#include "ns3/csma-net-device.h"
+#include "ns3/csma-topology.h"
+#include "ns3/csma-ipv4-topology.h"
+#include "ns3/udp-echo-client.h"
+#include "ns3/udp-echo-server.h"
+#include "ns3/simulator.h"
+#include "ns3/nstime.h"
+
+NS_LOG_COMPONENT_DEFINE ("UdpEchoSimulation");
+
+using namespace ns3;
+
+int 
+main (int argc, char *argv[])
+{
+  LogComponentEnable ("UdpEchoSimulation", LOG_LEVEL_INFO);
+
+  NS_LOG_INFO ("UDP Echo Simulation");
+
+  Ptr<Node> n0 = Create<InternetNode> ();
+  Ptr<Node> n1 = Create<InternetNode> ();
+  Ptr<Node> n2 = Create<InternetNode> ();
+  Ptr<Node> n3 = Create<InternetNode> ();
+
+  Ptr<CsmaChannel> lan = 
+    CsmaTopology::CreateCsmaChannel (DataRate (5000000), MilliSeconds (2));
+
+  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan, 
+    "08:00:2e:00:00:00");
+
+  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan, 
+    "08:00:2e:00:00:01");
+
+  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan, 
+    "08:00:2e:00:00:02");
+
+  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan, 
+    "08:00:2e:00:00:03");
+
+  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
+
+  uint16_t port = 7;
+
+  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.1.2", port, 
+    1, Seconds(1.), 1024);
+
+  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n1, port);
+
+  server->Start(Seconds(1.));
+  client->Start(Seconds(2.));
+
+  server->Stop (Seconds(10.));
+  client->Stop (Seconds(10.));
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tutorial/tutorial-naive-dumbbell.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -0,0 +1,138 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ */
+
+#include "ns3/log.h"
+#include "ns3/ptr.h"
+#include "ns3/internet-node.h"
+#include "ns3/point-to-point-channel.h"
+#include "ns3/csma-channel.h"
+#include "ns3/mac48-address.h"
+#include "ns3/point-to-point-net-device.h"
+#include "ns3/csma-net-device.h"
+#include "ns3/point-to-point-topology.h"
+#include "ns3/csma-topology.h"
+#include "ns3/csma-ipv4-topology.h"
+#include "ns3/udp-echo-client.h"
+#include "ns3/udp-echo-server.h"
+#include "ns3/simulator.h"
+#include "ns3/nstime.h"
+#include "ns3/ascii-trace.h"
+#include "ns3/pcap-trace.h"
+#include "ns3/global-route-manager.h"
+
+NS_LOG_COMPONENT_DEFINE ("DumbbellSimulation");
+
+using namespace ns3;
+
+// Network topology
+//
+//                       point to point
+//                      +--------------+
+//                      |              |
+//       n0   n1   n2   n3             n4   n5   n6   n7
+//       |    |    |    |              |    |    |    |
+//       ================              ================
+//             lan1                          lan2
+//
+int 
+main (int argc, char *argv[])
+{
+  LogComponentEnable ("DumbbellSimulation", LOG_LEVEL_INFO);
+//  LogComponentEnableAll (LOG_LEVEL_ALL, LOG_DECORATE_ALL);
+
+  NS_LOG_INFO ("Dumbbell Topology Simulation");
+
+  Ptr<Node> n0 = Create<InternetNode> ();
+  Ptr<Node> n1 = Create<InternetNode> ();
+  Ptr<Node> n2 = Create<InternetNode> ();
+  Ptr<Node> n3 = Create<InternetNode> ();
+
+  Ptr<CsmaChannel> lan1 = 
+    CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
+
+  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan1, 
+    "08:00:2e:00:00:00");
+
+  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan1, 
+    "08:00:2e:00:00:01");
+
+  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, 
+    "08:00:2e:00:00:02");
+
+  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, 
+    "08:00:2e:00:00:03");
+
+  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
+
+  Ptr<Node> n4 = Create<InternetNode> ();
+  Ptr<Node> n5 = Create<InternetNode> ();
+  Ptr<Node> n6 = Create<InternetNode> ();
+  Ptr<Node> n7 = Create<InternetNode> ();
+
+  Ptr<CsmaChannel> lan2 = 
+    CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
+
+  uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan2, 
+    "08:00:2e:00:00:04");
+
+  uint32_t nd5 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, lan2, 
+    "08:00:2e:00:00:05");
+
+  uint32_t nd6 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n6, lan2, 
+    "08:00:2e:00:00:06");
+
+  uint32_t nd7 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n7, lan2, 
+    "08:00:2e:00:00:07");
+
+  CsmaIpv4Topology::AddIpv4Address (n4, nd4, "10.1.2.1", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n5, nd5, "10.1.2.2", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n6, nd6, "10.1.2.3", "255.255.255.0");
+  CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0");
+
+  Ptr<PointToPointChannel> link = PointToPointTopology::AddPointToPointLink (
+    n3, n4, DataRate (38400), MilliSeconds (20));
+
+  PointToPointTopology::AddIpv4Addresses (link, n3, "10.1.3.1", 
+    n4, "10.1.3.2");
+
+  uint16_t port = 7;
+
+  Ptr<UdpEchoClient> client = Create<UdpEchoClient> (n0, "10.1.2.4", port, 
+    1, Seconds(1.), 1024);
+
+  Ptr<UdpEchoServer> server = Create<UdpEchoServer> (n7, port);
+
+  server->Start(Seconds(1.));
+  client->Start(Seconds(2.));
+
+  server->Stop (Seconds(10.));
+  client->Stop (Seconds(10.));
+
+  AsciiTrace asciitrace ("tutorial-4.tr");
+  asciitrace.TraceAllQueues ();
+  asciitrace.TraceAllNetDeviceRx ();
+
+  PcapTrace pcaptrace ("tutorial-4.pcap");
+  pcaptrace.TraceAllIp ();
+
+  GlobalRouteManager::PopulateRoutingTables ();
+
+  Simulator::Run ();
+  Simulator::Destroy ();
+}
--- a/tutorial/wscript	Thu Sep 27 12:49:17 2007 +0100
+++ b/tutorial/wscript	Wed Oct 03 17:38:49 2007 +0100
@@ -5,18 +5,18 @@
         ['core'])
     obj.source = 'hello-simulator.cc'
 
-    obj = bld.create_ns3_program('tutorial-1',
+    obj = bld.create_ns3_program('tutorial-csma-echo',
         ['core'])
-    obj.source = 'tutorial-1.cc'
+    obj.source = 'tutorial-csma-echo.cc'
 
-    obj = bld.create_ns3_program('tutorial-2',
+    obj = bld.create_ns3_program('tutorial-csma-echo-ascii-trace',
         ['core'])
-    obj.source = 'tutorial-2.cc'
+    obj.source = 'tutorial-csma-echo-ascii-trace.cc'
 
-    obj = bld.create_ns3_program('tutorial-3',
+    obj = bld.create_ns3_program('tutorial-csma-echo-pcap-trace',
         ['core'])
-    obj.source = 'tutorial-3.cc'
+    obj.source = 'tutorial-csma-echo-pcap-trace.cc'
 
-    obj = bld.create_ns3_program('tutorial-4',
+    obj = bld.create_ns3_program('tutorial-naive-dumbbell',
         ['core'])
-    obj.source = 'tutorial-4.cc'
+    obj.source = 'tutorial-naive-dumbbell.cc'
--- a/tutorial/wscript-0	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('hello-simulator',
-        ['core'])
-    obj.source = 'hello-simulator.cc'
--- a/tutorial/wscript-1	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('hello-simulator',
-        ['core'])
-    obj.source = 'hello-simulator.cc'
-
-    obj = bld.create_ns3_program('tutorial-1',
-        ['core'])
-    obj.source = 'tutorial-1.cc'
--- a/tutorial/wscript-2	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('hello-simulator',
-        ['core'])
-    obj.source = 'hello-simulator.cc'
-
-    obj = bld.create_ns3_program('tutorial-1',
-        ['core'])
-    obj.source = 'tutorial-1.cc'
-
-    obj = bld.create_ns3_program('tutorial-2',
-        ['core'])
-    obj.source = 'tutorial-2.cc'
--- a/tutorial/wscript-3	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('hello-simulator',
-        ['core'])
-    obj.source = 'hello-simulator.cc'
-
-    obj = bld.create_ns3_program('tutorial-1',
-        ['core'])
-    obj.source = 'tutorial-1.cc'
-
-    obj = bld.create_ns3_program('tutorial-2',
-        ['core'])
-    obj.source = 'tutorial-2.cc'
-
-    obj = bld.create_ns3_program('tutorial-3',
-        ['core'])
-    obj.source = 'tutorial-3.cc'
--- a/tutorial/wscript-4	Thu Sep 27 12:49:17 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-def build(bld):
-    obj = bld.create_ns3_program('hello-simulator',
-        ['core'])
-    obj.source = 'hello-simulator.cc'
-
-    obj = bld.create_ns3_program('tutorial-1',
-        ['core'])
-    obj.source = 'tutorial-1.cc'
-
-    obj = bld.create_ns3_program('tutorial-2',
-        ['core'])
-    obj.source = 'tutorial-2.cc'
-
-    obj = bld.create_ns3_program('tutorial-3',
-        ['core'])
-    obj.source = 'tutorial-3.cc'
-
-    obj = bld.create_ns3_program('tutorial-4',
-        ['core'])
-    obj.source = 'tutorial-4.cc'
--- a/utils/print-trace-sources.cc	Thu Sep 27 12:49:17 2007 +0100
+++ b/utils/print-trace-sources.cc	Wed Oct 03 17:38:49 2007 +0100
@@ -53,7 +53,7 @@
         }
       os << "///" << std::endl;
       os << "///" << std::endl;
-      os << "/// The path to this trace source is: " << i->path << "." << std::endl;
+      os << "/// The path to this trace source is: <b><tt>\"" << i->path << "\"</tt></b>." << std::endl;
       os << "///" << std::endl;
       if (i->context.Begin ().IsLast ())
         {
--- a/wscript	Thu Sep 27 12:49:17 2007 +0100
+++ b/wscript	Wed Oct 03 17:38:49 2007 +0100
@@ -187,6 +187,7 @@
     lib.target = 'ns3'
     lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES'])
 
+
 def shutdown():
     #import UnitTest
     #ut = UnitTest.unit_test()
@@ -197,7 +198,7 @@
     #ut.print_results()
 
     if Params.g_commands['check']:
-        run_program('run-tests')
+        _run_waf_check()
 
     if Params.g_options.lcov_report:
         lcov_report()
@@ -209,6 +210,19 @@
     if Params.g_options.command_template:
         Params.fatal("Option --command-template requires the option --run to be given")
 
+def _run_waf_check():
+    ## generate the trace sources list docs
+    env = Params.g_build.env_of_name('default')
+    proc_env = _get_proc_env()
+    prog = _find_program('print-trace-sources', env).m_linktask.m_outputs[0].abspath(env)
+    out = open('doc/trace-source-list.h', 'w')
+    if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
+        raise SystemExit(1)
+    out.close()
+
+    run_program('run-tests')
+
+
 def _find_program(program_name, env):
     launch_dir = os.path.abspath(Params.g_cwd_launch)
     found_programs = []
@@ -227,7 +241,7 @@
     raise ValueError("program '%s' not found; available programs are: %r"
                      % (program_name, found_programs))
 
-def _run_argv(argv, os_env=None):
+def _get_proc_env(os_env=None):
     env = Params.g_build.env_of_name('default')
     if sys.platform == 'linux2':
         pathvar = 'LD_LIBRARY_PATH'
@@ -251,7 +265,10 @@
             proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']) + [proc_env[pathvar]])
         else:
             proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']))
+    return proc_env
 
+def _run_argv(argv, os_env=None):
+    proc_env = _get_proc_env(os_env)
     retval = subprocess.Popen(argv, env=proc_env).wait()
     if retval:
         Params.fatal("Command %s exited with code %i" % (argv, retval))
@@ -336,11 +353,14 @@
 
 
 def doxygen():
+    if not os.path.exists('doc/trace-source-list.h'):
+        Params.warning("doc/trace-source-list.h does not exist; run waf check to generate it.")
+
+    ## run doxygen
     doxygen_config = os.path.join('doc', 'doxygen.conf')
     if subprocess.Popen(['doxygen', doxygen_config]).wait():
         raise SystemExit(1)
 
-
 def lcov_report():
     env = Params.g_build.env_of_name('default')
     variant_name = env['NS3_ACTIVE_VARIANT']