merged with nsnam
authorPavel Boyko <boyko@iitp.ru>
Tue, 16 Jun 2009 17:58:16 +0400
changeset 5074 355de6af8ea9
parent 5073 a60c18b05d41 (current diff)
parent 4534 2680abc768f2 (diff)
child 5076 0afbd18047eb
merged with nsnam
bindings/python/ns3_module_common.py
src/common/packet.cc
src/common/packet.h
src/core/test.h
src/devices/wifi/mac-low.cc
src/internet-stack/ipv4-global-routing.cc
src/internet-stack/ipv4-global-routing.h
--- a/AUTHORS	Tue Jun 16 17:58:06 2009 +0400
+++ b/AUTHORS	Tue Jun 16 17:58:16 2009 +0400
@@ -26,4 +26,5 @@
 Liu Jian (liujatp@gmail.com)
 Andrey Hippo (ahippo@yandex.ru)
 Francesco Malandrino (francesco.malandrino@gmail.com)
-
+Faker Moatamri (faker.moatamri@sophia.inria.fr)
+Guangyu Pei (guangyu.pei@boeing.com)
--- a/bindings/python/ns3_module_common.py	Tue Jun 16 17:58:06 2009 +0400
+++ b/bindings/python/ns3_module_common.py	Tue Jun 16 17:58:16 2009 +0400
@@ -203,6 +203,11 @@
                    'int32_t', 
                    [], 
                    is_const=True)
+    ## buffer.h: void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function]
+    cls.add_method('CopyData', 
+                   'void', 
+                   [param('std::ostream *', 'os'), param('uint32_t', 'size')], 
+                   is_const=True)
     ## buffer.h: ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor]
     cls.add_constructor([param('ns3::Buffer const &', 'o')])
     ## buffer.h: ns3::Buffer::Buffer() [constructor]
@@ -544,6 +549,11 @@
                    'uint32_t', 
                    [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], 
                    is_const=True)
+    ## packet.h: void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function]
+    cls.add_method('CopyData', 
+                   'void', 
+                   [param('std::ostream *', 'os'), param('uint32_t', 'size')], 
+                   is_const=True)
     ## packet.h: ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
     cls.add_method('CreateFragment', 
                    'ns3::Ptr< ns3::Packet >', 
--- a/bindings/python/ns3_module_internet_stack.py	Tue Jun 16 17:58:06 2009 +0400
+++ b/bindings/python/ns3_module_internet_stack.py	Tue Jun 16 17:58:16 2009 +0400
@@ -25,8 +25,6 @@
     module.add_class('UdpHeader', parent=root_module['ns3::Header'])
     ## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl [class]
     module.add_class('Ipv4StaticRoutingImpl', parent=root_module['ns3::Ipv4StaticRouting'])
-    ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting [class]
-    module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
     ## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl [class]
     module.add_class('Ipv4ListRoutingImpl', parent=root_module['ns3::Ipv4ListRouting'])
     
@@ -88,7 +86,6 @@
     register_Ns3TcpHeader_methods(root_module, root_module['ns3::TcpHeader'])
     register_Ns3UdpHeader_methods(root_module, root_module['ns3::UdpHeader'])
     register_Ns3Ipv4StaticRoutingImpl_methods(root_module, root_module['ns3::Ipv4StaticRoutingImpl'])
-    register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
     register_Ns3Ipv4ListRoutingImpl_methods(root_module, root_module['ns3::Ipv4ListRoutingImpl'])
     return
 
@@ -181,10 +178,10 @@
                    'uint16_t', 
                    [], 
                    is_const=True)
-    ## icmpv4.h: ns3::Ptr<ns3::Packet const> ns3::Icmpv4Echo::GetData() const [member function]
+    ## icmpv4.h: uint32_t ns3::Icmpv4Echo::GetData(uint8_t * payload) const [member function]
     cls.add_method('GetData', 
-                   'ns3::Ptr< ns3::Packet const >', 
-                   [], 
+                   'uint32_t', 
+                   [param('uint8_t *', 'payload')], 
                    is_const=True)
     ## icmpv4.h: static ns3::TypeId ns3::Icmpv4Echo::GetTypeId() [member function]
     cls.add_method('GetTypeId', 
@@ -636,70 +633,6 @@
                    visibility='protected', is_virtual=True)
     return
 
-def register_Ns3Ipv4GlobalRouting_methods(root_module, cls):
-    ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting(ns3::Ipv4GlobalRouting const & arg0) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4GlobalRouting const &', 'arg0')])
-    ## ipv4-global-routing.h: static ns3::TypeId ns3::Ipv4GlobalRouting::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
-    ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting::Ipv4GlobalRouting() [constructor]
-    cls.add_constructor([])
-    ## ipv4-global-routing.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4GlobalRouting::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
-    cls.add_method('RouteOutput', 
-                   'ns3::Ptr< ns3::Ipv4Route >', 
-                   [param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], 
-                   is_virtual=True)
-    ## ipv4-global-routing.h: bool ns3::Ipv4GlobalRouting::RouteInput(ns3::Ptr<ns3::Packet const> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
-    cls.add_method('RouteInput', 
-                   'bool', 
-                   [param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
-                   is_virtual=True)
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('AddHostRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
-    cls.add_method('AddHostRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('AddNetworkRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
-    cls.add_method('AddNetworkRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
-    ## ipv4-global-routing.h: uint32_t ns3::Ipv4GlobalRouting::GetNRoutes() [member function]
-    cls.add_method('GetNRoutes', 
-                   'uint32_t', 
-                   [])
-    ## ipv4-global-routing.h: ns3::Ipv4RoutingTableEntry * ns3::Ipv4GlobalRouting::GetRoute(uint32_t i) [member function]
-    cls.add_method('GetRoute', 
-                   'ns3::Ipv4RoutingTableEntry *', 
-                   [param('uint32_t', 'i')])
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::RemoveRoute(uint32_t i) [member function]
-    cls.add_method('RemoveRoute', 
-                   'void', 
-                   [param('uint32_t', 'i')])
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::SetNode(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('SetNode', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')])
-    ## ipv4-global-routing.h: ns3::Ptr<ns3::Node> ns3::Ipv4GlobalRouting::GetNode() const [member function]
-    cls.add_method('GetNode', 
-                   'ns3::Ptr< ns3::Node >', 
-                   [], 
-                   is_const=True)
-    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::DoDispose() [member function]
-    cls.add_method('DoDispose', 
-                   'void', 
-                   [], 
-                   visibility='protected', is_virtual=True)
-    return
-
 def register_Ns3Ipv4ListRoutingImpl_methods(root_module, cls):
     ## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl::Ipv4ListRoutingImpl(ns3::Ipv4ListRoutingImpl const & arg0) [copy constructor]
     cls.add_constructor([param('ns3::Ipv4ListRoutingImpl const &', 'arg0')])
--- a/doc/build.txt	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/build.txt	Tue Jun 16 17:58:16 2009 +0400
@@ -36,7 +36,7 @@
 
 Other waf usages include:
 
- 1. ./waf check
+ 1. ./waf --check
     Runs the unit tests
 
  2. ./waf --doxygen
--- a/doc/main.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/main.h	Tue Jun 16 17:58:16 2009 +0400
@@ -27,8 +27,8 @@
  * ns-3 requires Doxygen version 1.5.4 or greater to fully build all items,
  * although earlier versions of Doxygen will mostly work.
  * 
- * Type "./waf check" followed by "./waf --doxygen" to build the documentation.
- * There is a program that runs during "./waf check" that builds pieces of
+ * Type "./waf --check" followed by "./waf --doxygen" to build the documentation.
+ * There is a program that runs during "./waf --check" that builds pieces of
  * the documentation through introspection.  The doc/ directory contains
  * configuration for Doxygen (doxygen.conf and main.txt).  The Doxygen 
  * build process puts html files into the doc/html/ directory, and latex 
--- a/doc/manual/new-models.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/manual/new-models.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -205,7 +205,7 @@
 of adding the .cc file to the rest of the source files, and the .h
 file to the list of the header files. 
 
-Now, pop up to the top level directory and type "./waf check".  You
+Now, pop up to the top level directory and type "./waf --check".  You
 shouldn't have broken anything by this operation.
 @subsection include guards
 Next, let's add some 
--- a/doc/release_steps.txt	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/release_steps.txt	Tue Jun 16 17:58:16 2009 +0400
@@ -6,12 +6,12 @@
    - revise and check in RELEASE_NOTES
    - DO NOT change VERSION at this time
    - confirm that Doxygen builds cleanly and without warnings
-     (./waf check; ./waf --doxygen), and check in any necessary changes 
+     (./waf --check; ./waf --doxygen), and check in any necessary changes 
    - ensure no regressions (./waf --regression)
 3. ./waf configure; ./waf dist
    - this will create an ns-3-dev.tar.bz2 tarball
    - this will also create a ns-3-dev-ref-traces.tar.bz2 tarball
-4. test dev tarball on release platforms (waf check and maybe some other 
+4. test dev tarball on release platforms (waf --check and maybe some other 
    scripts)
 5. once you are happy with the tarball, tag ns-3-dev and ns-3-dev-ref-traces
    - hg tag "ns-3.x"
--- a/doc/tutorial/building-topologies.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/building-topologies.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -248,7 +248,7 @@
 Now we have a topology built, but we need applications.  This section is
 going to be fundamentally similar to the applications section of 
 @code{first.cc} but we are going to instantiate the server on one of the 
-nodes that has a CSMA node and the client on the node having only a 
+nodes that has a CSMA device and the client on the node having only a 
 point-to-point device.
 
 First, we set up the echo server.  We create a @code{UdpEchoServerHelper} and
@@ -296,7 +296,7 @@
 Since we have actually built an internetwork here, we need some form of 
 internetwork routing.  @command{ns-3} provides what we call a global route 
 manager to set up the routing tables on nodes.  This route manager has a 
-global function that runs though the nodes created for the simulation and does
+global function that runs through the nodes created for the simulation and does
 the hard work of setting up routing for you.  
 
 Basically, what happens is that each node behaves as if it were an OSPF router
@@ -317,7 +317,7 @@
 
 @verbatim
   PointToPointHelper::EnablePcapAll ("second");
-  CsmaHelper::EnablePcap ("second", csmaDevices.Get (0), true);
+  CsmaHelper::EnablePcap ("second", csmaDevices.Get (1), true);
 @end verbatim
 
 The CSMA network is a multi-point-to-point network.  This means that there 
@@ -336,8 +336,8 @@
 network and ask it to perform a promiscuous sniff of the network, thereby
 emulating what @code{tcpdump} would do.  If you were on a Linux machine
 you might do something like @code{tcpdump -i eth0} to get the trace.  
-In this case, we specify the device using @code{csmaDevices.Get(0)}, 
-which selects the zeroth device in the container.  Setting the final
+In this case, we specify the device using @code{csmaDevices.Get(1)}, 
+which selects the first device in the container.  Setting the final
 parameter to true enables promiscuous captures.
 
 The last section of code just runs and cleans up the simulation just like
@@ -374,7 +374,7 @@
 @verbatim
   export NS_LOG=
   ./waf --run scratch/mysecond
-#end verbatim
+@end verbatim
 
 Since we have set up the UDP echo applications to log just as we did in 
 @code{first.cc}, you will see similar output when you run the script.
@@ -395,7 +395,7 @@
 is from the echo client, indicating that it has received its echo back from
 the server.
 
-If you now go and look in the top level directory, you will find two trace 
+If you now go and look in the top level directory, you will find three trace 
 files:
 
 @verbatim
@@ -648,7 +648,7 @@
 
 To illustrate the difference between promiscuous and non-promiscuous traces, we
 also requested a non-promiscuous trace for the next-to-last node.  Go ahead and
-take a look at the @code{tcpdump} for @code{second-10-0.pcap}.
+take a look at the @code{tcpdump} for @code{second-100-0.pcap}.
 
 @verbatim
   tcpdump -nn -tt -r second-100-0.pcap
@@ -845,11 +845,11 @@
 
 For simplicity, this code uses the default PHY layer configuration and
 channel models which are documented in the API doxygen documentation for
-the @code{YansWifiChannelHelper::Default} and @code{YAnsWifiPhyHelper::Default}
+the @code{YansWifiChannelHelper::Default} and @code{YansWifiPhyHelper::Default}
 methods. Once these objects are created, we create a channel object
 and associate it to our PHY layer object manager to make sure
-that all the PHY objects created layer by the @code{YansWifiPhyHelper}
-all share the same underlying channel, that is, they share the same
+that all the PHY layer objects created by the @code{YansWifiPhyHelper}
+share the same underlying channel, that is, they share the same
 wireless medium and can communication and interfere:
 
 @verbatim
@@ -1111,9 +1111,9 @@
 @end verbatim
 
 The file ``third-0-0.pcap'' corresponds to the point-to-point device on node
-zero -- the left side of the ``backbone.''  The file ``third-1-0.pcap'' 
+zero -- the left side of the ``backbone''.  The file ``third-1-0.pcap'' 
 corresponds to the point-to-point device on node one -- the right side of the
-``backbone.''  The file ``third-0-1.pcap'' will be the promiscuous (monitor
+``backbone''.  The file ``third-0-1.pcap'' will be the promiscuous (monitor
 mode) trace from the Wifi network and the file ``third-1-1.pcap'' will be the
 promiscuous trace from the CSMA network.  Can you verify this by inspecting
 the code?
@@ -1329,9 +1329,9 @@
 @uref{http://www.nsnam.org/doxygen-release/index.html,,ns-3 Doxygen}
 which you can find in the ``Modules'' tab.
 Under the ``core'' section, you will find a link to ``The list of all trace 
-sources.''  You may find it interesting to try and hook some of these 
+sources.''.  You may find it interesting to try and hook some of these 
 traces yourself.  Additionally in the ``Modules'' documentation, there is
-a link to ``The list of all attributes.''  You can set the default value of 
+a link to ``The list of all attributes.''.  You can set the default value of 
 any of these @code{Attributes} via the command line as we have previously 
 discussed.
 
--- a/doc/tutorial/conceptual-overview.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/conceptual-overview.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -276,7 +276,7 @@
 @end verbatim
 
 to build the project.  So now if you look in the directory 
-@code{build/debug/ns-3} you will find the four module include files shown 
+@code{build/debug/ns3} you will find the four module include files shown 
 above.  You can take a look at the contents of these files and find that they
 do include all of the public include files in their respective modules.
 
@@ -308,8 +308,8 @@
 
 We will use this statement as a convenient place to talk about our Doxygen
 documentation system.  If you look at the project web site, 
-@uref{http://www.nsnam.org,,ns-3 project}, you will find a link to ``APIs
-(Doxygen)'' in the navigation bar.  If you select this link, you will be
+@uref{http://www.nsnam.org,,ns-3 project}, you will find a link to ``Doxygen 
+(ns-3-dev)'' in the navigation bar.  If you select this link, you will be
 taken to our documentation page.
 
 Along the left side, you will find a graphical representation of the structure
@@ -601,7 +601,7 @@
 helper.
 
 Applications require a time to ``start'' generating traffic and may take an
-optional time to ``stop.''  We provide both.  These times are set using  the
+optional time to ``stop''.  We provide both.  These times are set using  the
 @code{ApplicationContainer} methods @code{Start} and @code{Stop}.  These 
 methods take @code{Time} parameters.  In this case, we use an explicit C++
 conversion sequence to take the C++ double 1.0 and convert it to an 
@@ -815,12 +815,12 @@
 The source code is mainly in the @code{src} directory.  You can view source
 code either by clicking on the directory name or by clicking on the @code{files}
 link to the right of the directory name.  If you click on the @code{src}
-directory you be taken to the lising of the @code{src} subdirectories.  If you 
+directory, you will be taken to the listing of the @code{src} subdirectories.  If you 
 click on @code{core} subdirectory, you will find a list of files.  The first file
 you will find (as of this writing) is @code{abort.h}.  If you 
 click on @code{abort.h} link, you will be sent to the source file for @code{abort.h}.
 
 Our example scripts are in the @code{examples} directory.  The source code for
 the helpers we have used in this chapter can be found in the 
-@code{src/helpers} directory.  Feel free to poke around in the directory tree to
+@code{src/helper} directory.  Feel free to poke around in the directory tree to
 get a feel for what is there and the style of @command{ns-3} programs.
--- a/doc/tutorial/getting-started.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/getting-started.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -44,7 +44,7 @@
 
 @cindex tarball
 The @command{ns-3} code is available in Mercurial repositories on the server
-code.nsnam.org.  You can also download a tarball release at
+@uref{http://code.nsnam.org}.  You can also download a tarball release at
 @uref{http://www.nsnam.org/releases/}, or you can work with repositories
 using Mercurial.  We recommend using Mercurial unless there's a good reason
 not to.  See the end of this section for instructions on how to get a tarball
@@ -53,7 +53,7 @@
 @cindex repository
 The simplest way to get started using Mercurial repositories is to use the
 @code{ns-3-allinone} environment.  This is a set of scripts that manages the 
-downloading and building of various subystems of @command{ns-3} for you.  We 
+downloading and building of various subsystems of @command{ns-3} for you.  We 
 recommend that you begin your @command{ns-3} adventures in this environment
 as it can really simplify your life at this point.
 
@@ -128,12 +128,13 @@
 the more constant ns-3-dev here in the tutorial, but you can replace the 
 string ``ns-3-dev'' with your choice of release (e.g., ns-3.4 and 
 ns-3.4-ref-traces) in the text below.  You can find the latest version  of the
-code either by inspection of the repository list or by going to the ``Getting 
-Started'' web page and looking for the latest release identifier.
+code either by inspection of the repository list or by going to the 
+@uref{http://www.nsnam.org/getting_started.html,,``Getting Started''} 
+web page and looking for the latest release identifier.
 
 Go ahead and change into the @code{ns-3-allinone} directory you created when
 you cloned that repository.  We are now going to use the @code{download.py} 
-script to pull down the various pieces of @command{ns-3} you will be using/
+script to pull down the various pieces of @command{ns-3} you will be using.
 
 Go ahead and type the following into your shell (remember you can substitute
 the name of your chosen release number instead of @code{ns-3-dev} -- like
@@ -257,15 +258,15 @@
   mkdir tarballs
   cd tarballs
   wget http://www.nsnam.org/releases/ns-allinone-3.4.tar.bz2
-  tar xjf ns-3.4.tar.bz2
+  tar xjf ns-allinone-3.4.tar.bz2
 @end verbatim 
 
 If you change into the directory @code{ns-allinone-3.4} you should see a
 number of files:
 
 @verbatim
-build.py*     ns-3.4-RC2/             nsc-0.5.0/             util.py
-constants.py  ns-3.4-RC2-ref-traces/  pybindgen-0.10.0.630/
+build.py*     ns-3.4/             nsc-0.5.0/             README
+constants.py  ns-3.4-ref-traces/  pybindgen-0.10.0.630/  util.py
 @end verbatim 
 
 You are now ready to build the @command{ns-3} distribution.
@@ -404,7 +405,7 @@
 @end verbatim
 
 Note the last part of the above output.  Some ns-3 options are not enabled by
-default or require support from the underlying system to work properly
+default or require support from the underlying system to work properly.
 For instance, to enable XmlTo, the library libxml-2.0 must be found on the
 system.  in the example above, this library was not found and the corresponding
 feature was not enabled.  There is a feature to use sudo to set the suid bit of
@@ -438,7 +439,7 @@
 available in waf.  To explore these options, type:
 
 @verbatim
-  ./waf -- help
+  ./waf --help
 @end verbatim
 
 We'll use some of the testing-related commands in the next section.
@@ -455,10 +456,10 @@
 
 @cindex unit tests
 You can run the unit tests of the @command{ns-3} distribution by running the 
-``check'' command,
+``--check'' option,
 
 @verbatim
-  ./waf check
+  ./waf --check
 @end verbatim
 
 You should see a report from each unit test that executes indicating that the
@@ -488,7 +489,7 @@
 
 @cindex regression tests
 You can also run our regression test suite to ensure that your distribution and
-tool chain have produced binaries that generate output that is identical to
+toolchain have produced binaries that generate output that is identical to
 known-good reference output files.  You downloaded these reference traces to 
 your machine during the download process above.  (Warning:  The @code{ns-3.2} 
 and @code{ns-3.3} releases do not use the @code{ns-3-allinone} environment
@@ -505,7 +506,7 @@
 has gone awry.  If the error was discovered in a pcap file, it will be useful
 to convert the pcap files to text using tcpdump prior to comparison.
 
-Some regression tests wmay be SKIPped if the required support
+Some regression tests may be SKIPped if the required support
 is not present.
 
 To run the regression tests, you provide Waf with the regression flag.
@@ -568,7 +569,7 @@
 @end verbatim
 
 Waf first checks to make sure that the program is built correctly and 
-executes a build if required.  Waf then then executes the program, which 
+executes a build if required.  Waf then executes the program, which 
 produces the following output.
 
 @verbatim
--- a/doc/tutorial/in-process/introduction.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/in-process/introduction.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -562,7 +562,7 @@
 the ns-3 programs by simply typing,
 
 @verbatim
-  ./waf check
+  ./waf --check
 @end verbatim
 
 You will see many Waf status messages displayed as the system compiles.  The
--- a/doc/tutorial/introduction.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/introduction.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -226,7 +226,7 @@
 order to extend the system in most cases.
 
 For those interested in the gory details of Waf, the main web site can be 
-found at @uref{http://freehackers.org/~tnagy/waf.html}.
+found at @uref{http://code.google.com/p/waf/}.
 
 @node Development Environment
 @section Development Environment
@@ -275,7 +275,7 @@
 @cindex MinGW
 If you do use Cygwin or MinGW; and use Logitech products, we will save you
 quite a bit of heartburn right off the bat and encourage you to take a look
-at the @uref{http://www.mingw.org/MinGWiki/index.php/FAQ,,MinGW FAQ}.
+at the @uref{http://oldwiki.mingw.org/index.php/FAQ,,MinGW FAQ}.
 
 @cindex Logitech
 Search for ``Logitech'' and read the FAQ entry, ``why does make often 
@@ -295,7 +295,7 @@
 We will assume a basic facility with the Berkeley Sockets API in the examples
 used in this tutorial.  If you are new to sockets, we recommend reviewing the
 API and some common usage cases.  For a good overview of programming TCP/IP
-sockets we recommend @uref{http://www.elsevier.com/wps/product/cws_home/680765,,Practical TCP/IP Sockets in C, Donahoo and Calvert}.
+sockets we recommend @uref{http://www.elsevier.com/wps/find/bookdescription.cws_home/717656/description#description,,TCP/IP Sockets in C, Donahoo and Calvert}.
 
 There is an associated web site that includes source for the examples in the
 book, which you can find at:
@@ -305,6 +305,6 @@
 not have access to a copy of the book, the echo clients and servers shown in 
 the website above) you will be in good shape to understand the tutorial.
 There is a similar book on Multicast Sockets,
-@uref{http://www.elsevier.com/wps/product/cws_home/700736,,Multicast Sockets, Makofske and Almeroth}.
+@uref{http://www.elsevier.com/wps/find/bookdescription.cws_home/700736/description#description,,Multicast Sockets, Makofske and Almeroth}.
 that covers material you may need to understand if you look at the multicast 
 examples in the distribution.
--- a/doc/tutorial/tweaking.texi	Tue Jun 16 17:58:06 2009 +0400
+++ b/doc/tutorial/tweaking.texi	Tue Jun 16 17:58:16 2009 +0400
@@ -112,7 +112,7 @@
 example, to print more information by setting its logging level via the 
 NS_LOG environment variable.  
 
-I am going to assume from here on that are using an sh-like shell that uses 
+I am going to assume from here on that you are using an sh-like shell that uses 
 the``VARIABLE=value'' syntax.  If you are using a csh-like shell, then you 
 will have to convert my examples to the ``setenv VARIABLE value'' syntax 
 required by those shells.
@@ -353,7 +353,7 @@
 
 You now know that you can enable all of the logging for this component by
 setting the @code{NS_LOG} environment variable to the various levels.  Let's
-go ahead add some logging to the script.  The macro used to add an 
+go ahead and add some logging to the script.  The macro used to add an 
 informational level log message is @code{NS_LOG_INFO}.  Go ahead and add one 
 (just before we start creating the nodes) that tells you that the script is 
 ``Creating Topology.''  This is done as in this code snippet,
@@ -439,7 +439,7 @@
 
 This simple two line snippet is actually very useful by itself.  It opens the
 door to the @command{ns-3} global variable and @code{Attribute} systems.  Go 
-ahead and add that two lines of code to the @code{scratch/first.cc} script at
+ahead and add that two lines of code to the @code{scratch/myfirst.cc} script at
 the start of @code{main}.  Go ahead and build the script and run it, but ask 
 the script for help in the following way,
 
@@ -497,7 +497,7 @@
 setting in the @code{PointToPointHelper} above.  Let's use the default values 
 for the point-to-point devices and channels by deleting the 
 @code{SetDeviceAttribute} call and the @code{SetChannelAttribute} call from 
-the @code{first.cc} we have in the scratch directory.
+the @code{myfirst.cc} we have in the scratch directory.
 
 Your script should now just declare the @code{PointToPointHelper} and not do 
 any @code{set} operations as in the following example,
@@ -801,8 +801,8 @@
   #include <fstream>
 @end verbatim
 
-Then, right before the before the call to @code{Simulator::Run ()}, add the
-following lines of code.
+Then, right before the call to @code{Simulator::Run ()}, add the
+following lines of code:
 
 @verbatim
   std::ofstream ascii;
@@ -811,7 +811,7 @@
 @end verbatim
 
 The first two lines are just vanilla C++ code to open a stream that will be
-written to a file named ``myfirst.tr.''  See your favorite C++ tutorial if you
+written to a file named ``myfirst.tr''.  See your favorite C++ tutorial if you
 are unfamiliar with this code.  The last line of code in the snippet above
 tells @command{ns-3} that you want to enable ASCII tracing on all 
 point-to-point devices in your simulation; and you want the (provided) trace
@@ -900,7 +900,7 @@
 created in a script.  Just as a filesystem may have directories under the 
 root, we may have node numbers in the @code{NodeList}.  The string 
 @code{/NodeList/0} therefore refers to the zeroth node in the @code{NodeList}
-which we typically think of as ``node 0.''  In each node there is a list of 
+which we typically think of as ``node 0''.  In each node there is a list of 
 devices that have been installed.  This list appears next in the namespace.
 You can see that this trace event comes from @code{DeviceList/0} which is the 
 zeroth device installed in the node. 
@@ -928,14 +928,12 @@
   00 r 
   01 2.25732 
   02 /NodeList/1/DeviceList/0/$ns3::PointToPointNetDevice/MacRx 
-  03 ns3::PppHeader (
-  04   Point-to-Point Protocol: IP (0x0021)) 
-  05   ns3::Ipv4Header (
-  06     tos 0x0 ttl 64 id 0 offset 0 flags [none] 
-  07     length: 1052 10.1.1.1 > 10.1.1.2)
-  08     ns3::UdpHeader (
-  09       length: 1032 49153 > 9) 
-  10       Payload (size=1024)
+  03   ns3::Ipv4Header (
+  04     tos 0x0 ttl 64 id 0 protocol 17 offset 0 flags [none]
+  05     length: 1052 10.1.1.1 > 10.1.1.2)
+  06     ns3::UdpHeader (
+  07       length: 1032 49153 > 9) 
+  08       Payload (size=1024)
 @end verbatim
 
 Notice that the trace operation is now @code{r} and the simulation time has
@@ -978,7 +976,7 @@
  and a ``.pcap'' suffix.
 
 In our example script, we will eventually see files named ``myfirst-0-0.pcap'' 
-and ``myfirst.1-0.pcap'' which are the pcap traces for node 0-device 0 and 
+and ``myfirst-1-0.pcap'' which are the pcap traces for node 0-device 0 and 
 node 1-device 0, respectively.
 
 Once you have added the line of code to enable pcap tracing, you can run the
@@ -1010,9 +1008,9 @@
   2.257324 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024
 @end verbatim
 
-You can see in the dump of @code{myfirst-0.0.pcap} (the client device) that the 
+You can see in the dump of @code{myfirst-0-0.pcap} (the client device) that the 
 echo packet is sent at 2 seconds into the simulation.  If you look at the
-second dump (@code{first-1-0.pcap}) you can see that packet being received
+second dump (@code{myfirst-1-0.pcap}) you can see that packet being received
 at 2.257324 seconds.  You see the packet being echoed back at 2.257324 seconds
 in the second dump, and finally, you see the packet being received back at 
 the client in the first dump at 2.514648 seconds.
--- a/src/applications/packet-sink/packet-sink.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/applications/packet-sink/packet-sink.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -142,8 +142,7 @@
         {
           InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
           NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << 
-            address.GetIpv4() << " [" << address << "]---'" << 
-            packet->PeekData() << "'");
+            address.GetIpv4() << " [" << address << "]");
         }    
       m_rxTrace (packet, from);
     }
--- a/src/applications/v4ping/v4ping.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/applications/v4ping/v4ping.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -87,10 +87,11 @@
 	  if (echo.GetSequenceNumber () == (m_seq - 1) &&
 	      echo.GetIdentifier () == 0)
 	    {
-	      Ptr<const Packet> data = echo.GetData ();
-	      if (data->GetSize () == 16)
+	      uint8_t data[16];
+	      uint32_t dataSize = echo.GetData (data);
+	      if (dataSize == 16)
 		{
-		  uint32_t *buf = (uint32_t *)data->PeekData ();
+		  uint32_t *buf = (uint32_t *)data;
 		  if (buf[0] == GetNode ()->GetId () &&
 		      buf[1] == GetApplicationId ())
 		    {
--- a/src/common/buffer.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/common/buffer.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -643,6 +643,32 @@
   return m_data->m_data + m_start;
 }
 
+void
+Buffer::CopyData(std::ostream *os, uint32_t size) const
+{
+  if (size == GetSize ())
+    {
+      // fast path
+      os->write((const char*)(m_data->m_data + m_start), m_zeroAreaStart-m_start);
+      char zero = 0;
+      for (uint32_t i = 0; i < m_zeroAreaEnd - m_zeroAreaStart; ++i)
+        {
+          os->write (&zero, 1);
+        }
+      os->write ((const char*)(m_data->m_data + m_zeroAreaStart), m_end - m_zeroAreaEnd);
+    }
+  else
+    {
+      // slow path
+      Buffer::Iterator i = Begin ();
+      while (!i.IsEnd () && size > 0)
+        {
+          char byte = i.ReadU8 ();
+          os->write (&byte, 1);
+        }
+    }
+}
+
 /******************************************************
  *            The buffer iterator below.
  ******************************************************/
--- a/src/common/buffer.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/common/buffer.h	Tue Jun 16 17:58:16 2009 +0400
@@ -22,6 +22,7 @@
 
 #include <stdint.h>
 #include <vector>
+#include <ostream>
 
 #define BUFFER_HEURISTICS 1
 #define BUFFER_USE_INLINE 1
@@ -486,6 +487,8 @@
   int32_t GetCurrentStartOffset (void) const;
   int32_t GetCurrentEndOffset (void) const;
 
+  void CopyData (std::ostream *os, uint32_t size) const;
+
   Buffer (Buffer const &o);
   Buffer &operator = (Buffer const &o);
   Buffer ();
--- a/src/common/packet.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/common/packet.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -356,6 +356,12 @@
   return cur;
 }
 
+void
+Packet::CopyData(std::ostream *os, uint32_t size) const
+{
+  return m_buffer.CopyData (os, size);
+}
+
 uint32_t 
 Packet::GetUid (void) const
 {
--- a/src/common/packet.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/common/packet.h	Tue Jun 16 17:58:16 2009 +0400
@@ -344,6 +344,8 @@
    */
   uint32_t CopyData (uint8_t *buffer, uint32_t size) const;
 
+  void CopyData(std::ostream *os, uint32_t size) const;
+
   /**
    * A packet is allocated a new uid when it is created
    * empty or with zero-filled payload.
--- a/src/common/pcap-writer.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/common/pcap-writer.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -164,7 +164,7 @@
       Write32 (us & 0xffffffff);
       Write32 (packet->GetSize ());
       Write32 (packet->GetSize ());
-      WriteData (packet->PeekData (), packet->GetSize ());
+      packet->CopyData (m_writer, packet->GetSize ());
     }
 }
 
@@ -412,7 +412,7 @@
     }    
 
   // finally, write rest of packet
-  WriteData (packet->PeekData (), packet->GetSize ());
+  packet->CopyData (m_writer, packet->GetSize ());
 }
     
   
--- a/src/contrib/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/contrib/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -16,7 +16,7 @@
                                  "library 'libxml-2.0 >= 2.7' not found")
     conf.sub_config('stats')
 
-    conf.write_config_header('ns3/contrib-config.h', project_root_relative=True)
+    conf.write_config_header('ns3/contrib-config.h', top=True)
 
 def build(bld):
     module = bld.create_ns3_module('contrib', ['simulator', 'common'])
--- a/src/core/test.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/core/test.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -55,6 +55,18 @@
 {
   Get ()->m_verbose = true;
 }
+
+void
+TestManager::PrintTestNames (std::ostream &os)
+{
+  for (TestsCI i = Get ()->m_tests.begin (); i != Get ()->m_tests.end (); i++) 
+    {
+      std::string *testName = (*i).second;
+      os << *testName << std::endl;
+    }
+}
+
+
 std::ostream &
 TestManager::Failure (void)
 {
@@ -95,6 +107,47 @@
   return isSuccess;
 }
 
+bool 
+TestManager::RunTest (std::string name)
+{
+  return Get ()->RealRunTest (name);
+}
+bool 
+TestManager::RealRunTest (std::string name)
+{
+  TestsCI i;
+  
+  for (i = m_tests.begin (); i != m_tests.end (); i++) 
+    {
+      std::string *testName = (*i).second;
+      if (*testName == name) 
+        {
+          break;
+        }
+    }
+  if (i == m_tests.end ())
+    {
+      std::cerr << "Test with name " << name << " not found." << std::endl;
+    }
+  
+  if (!(*i).first->RunTests ()) 
+    {
+      if (m_verbose) 
+        {
+          std::cerr << "FAIL " << name << std::endl;
+        }
+      return false;
+    } 
+  else 
+    {
+      if (m_verbose) 
+        {
+          std::cerr << "PASS "<< name << std::endl;
+        }
+      return true;
+    }
+}
+
 Test::Test (char const *name)
 {
   TestManager::Add (this, name);
--- a/src/core/test.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/core/test.h	Tue Jun 16 17:58:16 2009 +0400
@@ -89,12 +89,17 @@
    */
   static bool RunTests (void);
 
+  static bool RunTest (std::string name);
+
+  static void PrintTestNames (std::ostream &os);
+
 private:
   friend class Test;
   static void Add (Test *test, char const *name);
   static std::ostream &Failure (void);
   static TestManager *Get (void);
   bool RealRunTests (void);
+  bool RealRunTest (std::string name);
 
   TestManager ();
   ~TestManager ();
--- a/src/core/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/core/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -41,7 +41,7 @@
                                  conf.env['ENABLE_THREADING'],
                                  "<pthread.h> include not detected")
 
-    conf.write_config_header('ns3/core-config.h', project_root_relative=True)
+    conf.write_config_header('ns3/core-config.h', top=True)
 
 def build(bld):
     core = bld.create_ns3_module('core')
--- a/src/devices/bridge/bridge-channel.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/devices/bridge/bridge-channel.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -29,7 +29,9 @@
 BridgeChannel::GetTypeId (void)
 {
   static TypeId tid = TypeId ("ns3::BridgeChannel")
-    .SetParent<Channel> ();
+    .SetParent<Channel> ()
+    .AddConstructor<BridgeChannel> ()
+    ;
   return tid;
 }
 
--- a/src/devices/wifi/mac-low.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/devices/wifi/mac-low.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -805,7 +805,7 @@
       (*i)->NavReset (duration);
     }
   m_lastNavStart = Simulator::Now ();
-  m_lastNavDuration = duration;
+  m_lastNavStart = duration;
 }
 bool
 MacLow::DoNavStartNow (Time duration)
--- a/src/devices/wifi/wifi-net-device.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/devices/wifi/wifi-net-device.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -38,6 +38,7 @@
 {
   static TypeId tid = TypeId ("ns3::WifiNetDevice")
     .SetParent<NetDevice> ()
+    .AddConstructor<WifiNetDevice> ()
     .AddAttribute ("Channel", "The channel attached to this device",
                    PointerValue (),
                    MakePointerAccessor (&WifiNetDevice::DoGetChannel),
--- a/src/helper/nqos-wifi-mac-helper.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/helper/nqos-wifi-mac-helper.h	Tue Jun 16 17:58:16 2009 +0400
@@ -31,6 +31,7 @@
   virtual ~NqosWifiMacHelper ();
   /**
    * Create a mac helper in a default working state.
+   * i.e., this is an adhoc mac by default.
    */
   static NqosWifiMacHelper Default (void);
   /**
--- a/src/internet-stack/icmpv4.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/icmpv4.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -108,7 +108,9 @@
 void 
 Icmpv4Echo::SetData (Ptr<const Packet> data)
 {
-  m_data = data->Copy ();
+  uint32_t size = (data->GetSize ()>16)?16:data->GetSize();
+  data->CopyData (m_data, size);
+  m_dataSize = size;
 }
 uint16_t 
 Icmpv4Echo::GetIdentifier (void) const
@@ -120,10 +122,11 @@
 {
   return m_sequence;
 }
-Ptr<const Packet> 
-Icmpv4Echo::GetData (void) const
+uint32_t
+Icmpv4Echo::GetData (uint8_t data[16]) const
 {
-  return m_data->Copy ();
+  memcpy (data, m_data, m_dataSize);
+  return m_dataSize;
 }
 
 
@@ -139,8 +142,14 @@
 Icmpv4Echo::Icmpv4Echo ()
   : m_identifier (0),
     m_sequence (0),
-    m_data (0)
-{}
+    m_dataSize (0)
+{
+  // make sure that thing is initialized to get initialized bytes
+  for (uint8_t j = 0; j < 16; j++)
+    {
+      m_data[j] = 0;
+    }
+}
 Icmpv4Echo::~Icmpv4Echo ()
 {}
 TypeId 
@@ -151,14 +160,14 @@
 uint32_t 
 Icmpv4Echo::GetSerializedSize (void) const
 {
-  return 4 + m_data->GetSize ();
+  return 4 + m_dataSize;
 }
 void 
 Icmpv4Echo::Serialize (Buffer::Iterator start) const
 {
   start.WriteHtonU16 (m_identifier);
   start.WriteHtonU16 (m_sequence);
-  start.Write (m_data->PeekData (), m_data->GetSize ());
+  start.Write (m_data, m_dataSize);
 }
 uint32_t 
 Icmpv4Echo::Deserialize (Buffer::Iterator start)
@@ -166,11 +175,8 @@
   m_identifier = start.ReadNtohU16 ();
   m_sequence = start.ReadNtohU16 ();
   NS_ASSERT (start.GetSize () >= 4);
-  uint32_t size = start.GetSize () - 4;
-  uint8_t *buffer = new uint8_t[size] ();
-  start.Read (buffer, size);
-  m_data = Create<Packet> (buffer, size);
-  delete[] buffer;
+  m_dataSize = start.GetSize () - 4;
+  start.Read (m_data, m_dataSize);
   return start.GetSize ();
 }
 void 
--- a/src/internet-stack/icmpv4.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/icmpv4.h	Tue Jun 16 17:58:16 2009 +0400
@@ -50,7 +50,7 @@
   void SetData (Ptr<const Packet> data);
   uint16_t GetIdentifier (void) const;
   uint16_t GetSequenceNumber (void) const;
-  Ptr<const Packet> GetData (void) const;
+  uint32_t GetData (uint8_t payload[16]) const;
 
 
   static TypeId GetTypeId (void);
@@ -64,7 +64,8 @@
 private:
   uint16_t m_identifier;
   uint16_t m_sequence;
-  Ptr<Packet> m_data;
+  uint8_t m_data[16];
+  uint32_t m_dataSize;
 };
 
 class Icmpv4DestinationUnreachable : public Header
--- a/src/internet-stack/ipv4-global-routing.cc	Tue Jun 16 17:58:06 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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/object.h"
-#include "ns3/packet.h"
-#include "ns3/node.h"
-#include "ns3/ipv4-route.h"
-#include "ns3/ipv4-routing-table-entry.h"
-#include "ipv4-global-routing.h"
-
-NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRouting);
-
-TypeId 
-Ipv4GlobalRouting::GetTypeId (void)
-{ 
-  static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
-    .SetParent<Object> ()
-    ;
-  return tid;
-}
-
-Ipv4GlobalRouting::Ipv4GlobalRouting () 
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-Ipv4GlobalRouting::~Ipv4GlobalRouting ()
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-void 
-Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest, 
-                                   Ipv4Address nextHop, 
-                                   uint32_t interface)
-{
-  NS_LOG_FUNCTION (dest << nextHop << interface);
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
-  m_hostRoutes.push_back (route);
-}
-
-void 
-Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest, 
-                                   uint32_t interface)
-{
-  NS_LOG_FUNCTION (dest << interface);
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
-  m_hostRoutes.push_back (route);
-}
-
-void 
-Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network, 
-                                      Ipv4Mask networkMask, 
-                                      Ipv4Address nextHop, 
-                                      uint32_t interface)
-{
-  NS_LOG_FUNCTION (network << networkMask << nextHop << interface);
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
-                                            networkMask,
-                                            nextHop,
-                                            interface);
-  m_networkRoutes.push_back (route);
-}
-
-void 
-Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network, 
-                                      Ipv4Mask networkMask, 
-                                      uint32_t interface)
-{
-  NS_LOG_FUNCTION (network << networkMask << interface);
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
-                                            networkMask,
-                                            interface);
-  m_networkRoutes.push_back (route);
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ptr<Ipv4Route> rtentry = 0;
-  bool found = false;
-  Ipv4RoutingTableEntry* route = 0;
-
-  for (HostRoutesCI i = m_hostRoutes.begin (); 
-       i != m_hostRoutes.end (); 
-       i++) 
-    {
-      NS_ASSERT ((*i)->IsHost ());
-      if ((*i)->GetDest ().IsEqual (dest)) 
-        {
-          NS_LOG_LOGIC ("Found global host route" << *i); 
-          route = (*i);
-          found = true; 
-          break;
-        }
-    }
-  if (found == false)
-    {
-      for (NetworkRoutesI j = m_networkRoutes.begin (); 
-           j != m_networkRoutes.end (); 
-           j++) 
-        {
-          NS_ASSERT ((*j)->IsNetwork ());
-          Ipv4Mask mask = (*j)->GetDestNetworkMask ();
-          Ipv4Address entry = (*j)->GetDestNetwork ();
-          if (mask.IsMatch (dest, entry)) 
-            {
-              NS_LOG_LOGIC ("Found global network route" << *j); 
-              route = (*j);
-              found = true;
-              break;
-            }
-        }
-    }
-  if (found == true)
-    {
-      Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-      rtentry = Create<Ipv4Route> ();
-      rtentry->SetDestination (route->GetDest ());
-      // XXX handle multi-address case
-      rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
-      rtentry->SetGateway (route->GetGateway ());
-      uint32_t interfaceIdx = route->GetInterface ();
-      rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
-      return rtentry;
-    }
-  else 
-    {
-      return 0;
-    }
-}
-
-uint32_t 
-Ipv4GlobalRouting::GetNRoutes (void)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  uint32_t n = 0;
-  n += m_hostRoutes.size ();
-  n += m_networkRoutes.size ();
-  return n;
-}
-
-Ipv4RoutingTableEntry *
-Ipv4GlobalRouting::GetRoute (uint32_t index)
-{
-  NS_LOG_FUNCTION (index);
-  if (index < m_hostRoutes.size ())
-    {
-      uint32_t tmp = 0;
-      for (HostRoutesCI i = m_hostRoutes.begin (); 
-           i != m_hostRoutes.end (); 
-           i++) 
-        {
-          if (tmp  == index)
-            {
-              return *i;
-            }
-          tmp++;
-        }
-    }
-  index -= m_hostRoutes.size ();
-  uint32_t tmp = 0;
-  for (NetworkRoutesI j = m_networkRoutes.begin (); 
-       j != m_networkRoutes.end (); 
-       j++) 
-    {
-      if (tmp == index)
-        {
-          return *j;
-        }
-      tmp++;
-    }
-  NS_ASSERT (false);
-  // quiet compiler.
-  return 0;
-}
-void 
-Ipv4GlobalRouting::RemoveRoute (uint32_t index)
-{
-  NS_LOG_FUNCTION (index);
-  if (index < m_hostRoutes.size ())
-    {
-      uint32_t tmp = 0;
-      for (HostRoutesI i = m_hostRoutes.begin (); 
-           i != m_hostRoutes.end (); 
-           i++) 
-        {
-          if (tmp  == index)
-            {
-              NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size());
-              delete *i;
-              m_hostRoutes.erase (i);
-              NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size());
-              return;
-            }
-          tmp++;
-        }
-    }
-  index -= m_hostRoutes.size ();
-  uint32_t tmp = 0;
-  for (NetworkRoutesI j = m_networkRoutes.begin (); 
-       j != m_networkRoutes.end (); 
-       j++) 
-    {
-      if (tmp == index)
-        {
-          NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size());
-          delete *j;
-          m_networkRoutes.erase (j);
-          NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size());
-          return;
-        }
-      tmp++;
-    }
-  NS_ASSERT (false);
-}
-
-void
-Ipv4GlobalRouting::DoDispose (void)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  for (HostRoutesI i = m_hostRoutes.begin (); 
-       i != m_hostRoutes.end (); 
-       i = m_hostRoutes.erase (i)) 
-    {
-      delete (*i);
-    }
-  for (NetworkRoutesI j = m_networkRoutes.begin (); 
-       j != m_networkRoutes.end (); 
-       j = m_networkRoutes.erase (j)) 
-    {
-      delete (*j);
-    }
-  Ipv4RoutingProtocol::DoDispose ();
-}
-
-Ptr<Ipv4Route>
-Ipv4GlobalRouting::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
-{      
-
-//
-// First, see if this is a multicast packet we have a route for.  If we
-// have a route, then send the packet down each of the specified interfaces.
-//
-  if (header.GetDestination().IsMulticast ())
-    {
-      NS_LOG_LOGIC ("Multicast destination-- returning false");
-      return 0; // Let other routing protocols try to handle this
-    }
-//
-// See if this is a unicast packet we have a route for.
-//
-  NS_LOG_LOGIC ("Unicast destination- looking up");
-  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination());
-  if (rtentry)
-    {
-      sockerr = Socket::ERROR_NOTERROR;
-    }
-  else
-    {
-      sockerr = Socket::ERROR_NOROUTETOHOST;
-    }
-  return rtentry;
-}
-
-bool 
-Ipv4GlobalRouting::RouteInput  (Ptr<const Packet> p, const Ipv4Header &ipHeader, Ptr<const NetDevice> idev,                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
-                             LocalDeliverCallback lcb, ErrorCallback ecb) 
-{ 
-
-  NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
-
-  if (ipHeader.GetDestination ().IsMulticast ())
-    {
-      NS_LOG_LOGIC ("Multicast destination-- returning false");
-      return false; // Let other routing protocols try to handle this
-    }
-
-// This is a unicast packet.  Check to see if we have a route for it.
-//
-  NS_LOG_LOGIC ("Unicast destination- looking up");
-  Ptr<Ipv4Route> rtentry = LookupGlobal (ipHeader.GetDestination ());
-  if (rtentry != 0)
-    {
-      NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
-      ucb (rtentry, p, ipHeader);
-      return true;
-    }
-  else
-    {
-      NS_LOG_LOGIC ("Did not find unicast destination- returning false");
-      return false; // Let other routing protocols try to handle this
-                    // route request.
-    }
-}
-
-void
-Ipv4GlobalRouting::SetNode (Ptr<Node> node)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  m_node = node;
-}
-
-Ptr<Node>
-Ipv4GlobalRouting::GetNode (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_node;
-}
-
-
-
-}//namespace ns3
--- a/src/internet-stack/ipv4-global-routing.h	Tue Jun 16 17:58:06 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2008 University of Washington
-//
-// 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
-//
-//
-
-#ifndef IPV4_GLOBAL_ROUTING_H
-#define IPV4_GLOBAL_ROUTING_H
-
-#include <list>
-#include <stdint.h>
-#include "ns3/ipv4-address.h"
-#include "ns3/ipv4-header.h"
-#include "ns3/ptr.h"
-#include "ns3/ipv4.h"
-#include "ns3/ipv4-routing-protocol.h"
-
-namespace ns3 {
-
-class Packet;
-class NetDevice;
-class Ipv4Interface;
-class Ipv4Address;
-class Ipv4Header;
-class Ipv4RoutingTableEntry;
-class Ipv4MulticastRoutingTableEntry;
-class Node;
-
-
-/**
- * \brief Global routing protocol for IP version 4 stacks.
- *
- * In ns-3 we have the concept of a pluggable routing protocol.  Routing
- * protocols are added to a list maintained by the Ipv4L3Protocol.  Every 
- * stack gets one routing protocol for free -- the Ipv4StaticRouting routing
- * protocol is added in the constructor of the Ipv4L3Protocol (this is the 
- * piece of code that implements the functionality of the IP layer).
- *
- * As an option to running a dynamic routing protocol, a GlobalRouteManager
- * object has been created to allow users to build routes for all participating
- * nodes.  One can think of this object as a "routing oracle"; it has
- * an omniscient view of the topology, and can construct shortest path
- * routes between all pairs of nodes.  These routes must be stored 
- * somewhere in the node, so therefore this class Ipv4GlobalRouting
- * is used as one of the pluggable routing protocols.  It is kept distinct
- * from Ipv4StaticRouting because these routes may be dynamically cleared
- * and rebuilt in the middle of the simulation, while manually entered
- * routes into the Ipv4StaticRouting may need to be kept distinct.
- *
- * This class deals with Ipv4 unicast routes only.
- *
- * \see Ipv4RoutingProtocol
- * \see GlobalRouteManager
- */
-class Ipv4GlobalRouting : public Ipv4RoutingProtocol
-{
-public:
-  static TypeId GetTypeId (void);
-/**
- * \brief Construct an empty Ipv4GlobalRouting routing protocol,
- *
- * The Ipv4GlobalRouting class supports host and network unicast routes.
- * This method initializes the lists containing these routes to empty.
- *
- * \see Ipv4GlobalRouting
- */
-  Ipv4GlobalRouting ();
-  virtual ~Ipv4GlobalRouting ();
-
-  virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
-
-  virtual bool RouteInput  (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
-                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
-                             LocalDeliverCallback lcb, ErrorCallback ecb);
-
-/**
- * \brief Add a host route to the global routing table.
- *
- * \param dest The Ipv4Address destination for this route.
- * \param nextHop The Ipv4Address of the next hop in the route.
- * \param interface The network interface index used to send packets to the
- * destination.
- *
- * \see Ipv4Address
- */
-  void AddHostRouteTo (Ipv4Address dest, 
-                       Ipv4Address nextHop, 
-                       uint32_t interface);
-/**
- * \brief Add a host route to the global routing table.
- *
- * \param dest The Ipv4Address destination for this route.
- * \param interface The network interface index used to send packets to the
- * destination.
- *
- * \see Ipv4Address
- */
-  void AddHostRouteTo (Ipv4Address dest, 
-                       uint32_t interface);
-
-/**
- * \brief Add a network route to the global routing table.
- *
- * \param network The Ipv4Address network for this route.
- * \param networkMask The Ipv4Mask to extract the network.
- * \param nextHop The next hop in the route to the destination network.
- * \param interface The network interface index used to send packets to the
- * destination.
- *
- * \see Ipv4Address
- */
-  void AddNetworkRouteTo (Ipv4Address network, 
-                          Ipv4Mask networkMask, 
-                          Ipv4Address nextHop, 
-                          uint32_t interface);
-
-/**
- * \brief Add a network route to the global routing table.
- *
- * \param network The Ipv4Address network for this route.
- * \param networkMask The Ipv4Mask to extract the network.
- * \param interface The network interface index used to send packets to the
- * destination.
- *
- * \see Ipv4Address
- */
-  void AddNetworkRouteTo (Ipv4Address network, 
-                          Ipv4Mask networkMask, 
-                          uint32_t interface);
-
-/**
- * \brief Get the number of individual unicast routes that have been added
- * to the routing table.
- *
- * \warning The default route counts as one of the routes.
- */
-  uint32_t GetNRoutes (void);
-
-/**
- * \brief Get a route from the global unicast routing table.
- *
- * Externally, the unicast global routing table appears simply as a table with
- * n entries.  The one sublety of note is that if a default route has been set
- * it will appear as the zeroth entry in the table.  This means that if you
- * add only a default route, the table will have one entry that can be accessed
- * either by explicity calling GetDefaultRoute () or by calling GetRoute (0).
- * 
- * Similarly, if the default route has been set, calling RemoveRoute (0) will
- * remove the default route.
- *
- * \param i The index (into the routing table) of the route to retrieve.  If
- * the default route has been set, it will occupy index zero.
- * \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
- * a zero pointer is returned.
- *
- * \see Ipv4RoutingTableEntry
- * \see Ipv4GlobalRouting::RemoveRoute
- */
-  Ipv4RoutingTableEntry *GetRoute (uint32_t i);
-
-/**
- * \brief Remove a route from the global unicast routing table.
- *
- * Externally, the unicast global routing table appears simply as a table with
- * n entries.  The one sublety of note is that if a default route has been set
- * it will appear as the zeroth entry in the table.  This means that if the
- * default route has been set, calling RemoveRoute (0) will remove the
- * default route.
- *
- * \param i The index (into the routing table) of the route to remove.  If
- * the default route has been set, it will occupy index zero.
- *
- * \see Ipv4RoutingTableEntry
- * \see Ipv4GlobalRouting::GetRoute
- * \see Ipv4GlobalRouting::AddRoute
- */
-  void RemoveRoute (uint32_t i);
-
-  void SetNode (Ptr<Node> node);
-  Ptr<Node> GetNode (void) const;
-
-protected:
-  void DoDispose (void);
-
-private:
-  typedef std::list<Ipv4RoutingTableEntry *> HostRoutes;
-  typedef std::list<Ipv4RoutingTableEntry *>::const_iterator HostRoutesCI;
-  typedef std::list<Ipv4RoutingTableEntry *>::iterator HostRoutesI;
-  typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
-  typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
-  typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
-
-  Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest);
-
-  HostRoutes m_hostRoutes;
-  NetworkRoutes m_networkRoutes;
-
-  Ptr<Node> m_node;
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_GLOBAL_ROUTING_H */
--- a/src/internet-stack/ipv4-list-routing-impl.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/ipv4-list-routing-impl.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -35,6 +35,7 @@
 {
   static TypeId tid = TypeId ("ns3::Ipv4ListRoutingImpl")
     .SetParent<Ipv4ListRouting> ()
+    .AddConstructor<Ipv4ListRoutingImpl> ()
     ;
   return tid;
 }
--- a/src/internet-stack/ipv4-static-routing-impl.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/ipv4-static-routing-impl.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -36,6 +36,7 @@
 {
   static TypeId tid = TypeId ("ns3::Ipv4StaticRoutingImpl")
     .SetParent<Ipv4StaticRouting> ()
+    .AddConstructor<Ipv4StaticRoutingImpl> ()
     ;
   return tid;
 }
--- a/src/internet-stack/nsc-tcp-socket-impl.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/nsc-tcp-socket-impl.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -448,7 +448,7 @@
     {
       SocketAddressTag tag;
       bool found;
-      found = packet->FindFirstMatchingTag (tag);
+      found = packet->PeekPacketTag (tag);
       NS_ASSERT (found);
       fromAddress = tag.GetAddress ();
     }
@@ -600,7 +600,7 @@
   SocketAddressTag tag;
 
   tag.SetAddress (m_peerAddress);
-  p->AddTag (tag);
+  p->AddPacketTag (tag);
   m_deliveryQueue.push (p);
   m_rxAvailable += p->GetSize ();
 
--- a/src/internet-stack/tcp-test.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/tcp-test.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -189,7 +189,7 @@
   {
     rxBytes1 += sz;
     rxPayload = new uint8_t[sz];
-    memcpy (rxPayload, p->PeekData(), sz);
+    p->CopyData (rxPayload, sz);
   }
   else
   {
--- a/src/internet-stack/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/internet-stack/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -82,7 +82,6 @@
         'ipv4-l3-protocol.cc',
         'ipv4-static-routing-impl.cc',
         'ipv4-list-routing-impl.cc',
-        'ipv4-global-routing.cc',
         'ipv4-end-point.cc',
         'udp-l4-protocol.cc',
         'tcp-l4-protocol.cc',
@@ -110,7 +109,6 @@
         'udp-header.h',
         'tcp-header.h',
         'sequence-number.h',
-        'ipv4-global-routing.h',
         'ipv4-list-routing-impl.h',
         'ipv4-static-routing-impl.h',
         'icmpv4.h',
--- a/src/node/ipv4-list-routing.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/ipv4-list-routing.h	Tue Jun 16 17:58:16 2009 +0400
@@ -24,7 +24,7 @@
 namespace ns3 {
 
 /**
- * \ingroup ipv4-routing 
+ * \ingroup ipv4Routing 
  *
  * This class is a specialization of Ipv4RoutingProtocol that allows 
  * other instances of Ipv4RoutingProtocol to be inserted in a 
--- a/src/node/ipv4-route.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/ipv4-route.h	Tue Jun 16 17:58:16 2009 +0400
@@ -31,7 +31,7 @@
 class NetDevice;
 
 /**
- * \ingroup ipv4-routing
+ * \ingroup ipv4Routing
  *
  *\brief Ipv4 route cache entry (similar to Linux struct rtable)
  *
@@ -99,7 +99,7 @@
 std::ostream& operator<< (std::ostream& os, Ipv4Route const& route);
 
 /**
- * \ingroup ipv4-routing
+ * \ingroup ipv4Routing
  * 
  * \brief Ipv4 multicast route cache entry (similar to Linux struct mfc_cache)
  */
--- a/src/node/ipv4-routing-protocol.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/ipv4-routing-protocol.h	Tue Jun 16 17:58:16 2009 +0400
@@ -32,7 +32,7 @@
 
 /**
  * \ingroup node 
- * \defgroup ipv4-routing Ipv4 Routing
+ * \defgroup ipv4Routing Ipv4 Routing
  *
  * Abstract base class for Ipv4 routing protocols.  Defines two
  * virtual functions for packet routing and forwarding.  The first, 
--- a/src/node/ipv4-routing-table-entry.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/ipv4-routing-table-entry.h	Tue Jun 16 17:58:16 2009 +0400
@@ -29,7 +29,7 @@
 namespace ns3 {
 
 /**
- * \ingroup ipv4-routing
+ * \ingroup ipv4Routing
  *
  * A record of an IPv4 routing table entry for Ipv4GlobalRouting and 
  * Ipv4StaticRouting.  This is not a reference counted object.
@@ -155,7 +155,7 @@
 std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route);
 
 /**
- * \ingroup ipv4-routing
+ * \ingroup ipv4Routing
  *
  * \brief A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting
  */
--- a/src/node/ipv4-static-routing.h	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/ipv4-static-routing.h	Tue Jun 16 17:58:16 2009 +0400
@@ -44,7 +44,7 @@
 class Ipv4MulticastRoutingTableEntry;
 
 /**
- * \ingroup ipv4-routing
+ * \ingroup ipv4Routing
  * 
  * \brief Static routing protocol for IP version 4 stacks.
  *
--- a/src/node/socket.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/node/socket.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -148,7 +148,7 @@
     {
       return 0;
     }
-  memcpy (buf, p->PeekData (), p->GetSize());
+  p->CopyData (buf, p->GetSize ());
   return p->GetSize ();
 }
 
@@ -169,7 +169,7 @@
     {
       return 0;
     }
-  memcpy (buf, p->PeekData (), p->GetSize());
+  p->CopyData (buf, p->GetSize ());
   return p->GetSize ();
 }
 
--- a/src/routing/global-routing/global-route-manager-impl.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/routing/global-routing/global-route-manager-impl.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -30,12 +30,12 @@
 #include "ns3/log.h"
 #include "ns3/node-list.h"
 #include "ns3/ipv4.h"
-#include "ns3/ipv4-global-routing.h"
 #include "ns3/ipv4-routing-protocol.h"
 #include "ns3/ipv4-list-routing.h"
 #include "global-router-interface.h"
 #include "global-route-manager-impl.h"
 #include "candidate-queue.h"
+#include "ipv4-global-routing.h"
 
 NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/global-routing/ipv4-global-routing.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -0,0 +1,338 @@
+// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
+//
+// Copyright (c) 2008 University of Washington
+//
+// 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/object.h"
+#include "ns3/packet.h"
+#include "ns3/node.h"
+#include "ns3/ipv4-route.h"
+#include "ns3/ipv4-routing-table-entry.h"
+#include "ipv4-global-routing.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4GlobalRouting");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (Ipv4GlobalRouting);
+
+TypeId 
+Ipv4GlobalRouting::GetTypeId (void)
+{ 
+  static TypeId tid = TypeId ("ns3::Ipv4GlobalRouting")
+    .SetParent<Object> ()
+    ;
+  return tid;
+}
+
+Ipv4GlobalRouting::Ipv4GlobalRouting () 
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+Ipv4GlobalRouting::~Ipv4GlobalRouting ()
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+void 
+Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest, 
+                                   Ipv4Address nextHop, 
+                                   uint32_t interface)
+{
+  NS_LOG_FUNCTION (dest << nextHop << interface);
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
+  m_hostRoutes.push_back (route);
+}
+
+void 
+Ipv4GlobalRouting::AddHostRouteTo (Ipv4Address dest, 
+                                   uint32_t interface)
+{
+  NS_LOG_FUNCTION (dest << interface);
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
+  m_hostRoutes.push_back (route);
+}
+
+void 
+Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network, 
+                                      Ipv4Mask networkMask, 
+                                      Ipv4Address nextHop, 
+                                      uint32_t interface)
+{
+  NS_LOG_FUNCTION (network << networkMask << nextHop << interface);
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
+                                            networkMask,
+                                            nextHop,
+                                            interface);
+  m_networkRoutes.push_back (route);
+}
+
+void 
+Ipv4GlobalRouting::AddNetworkRouteTo (Ipv4Address network, 
+                                      Ipv4Mask networkMask, 
+                                      uint32_t interface)
+{
+  NS_LOG_FUNCTION (network << networkMask << interface);
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
+                                            networkMask,
+                                            interface);
+  m_networkRoutes.push_back (route);
+}
+
+Ptr<Ipv4Route>
+Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ptr<Ipv4Route> rtentry = 0;
+  bool found = false;
+  Ipv4RoutingTableEntry* route = 0;
+
+  for (HostRoutesCI i = m_hostRoutes.begin (); 
+       i != m_hostRoutes.end (); 
+       i++) 
+    {
+      NS_ASSERT ((*i)->IsHost ());
+      if ((*i)->GetDest ().IsEqual (dest)) 
+        {
+          NS_LOG_LOGIC ("Found global host route" << *i); 
+          route = (*i);
+          found = true; 
+          break;
+        }
+    }
+  if (found == false)
+    {
+      for (NetworkRoutesI j = m_networkRoutes.begin (); 
+           j != m_networkRoutes.end (); 
+           j++) 
+        {
+          NS_ASSERT ((*j)->IsNetwork ());
+          Ipv4Mask mask = (*j)->GetDestNetworkMask ();
+          Ipv4Address entry = (*j)->GetDestNetwork ();
+          if (mask.IsMatch (dest, entry)) 
+            {
+              NS_LOG_LOGIC ("Found global network route" << *j); 
+              route = (*j);
+              found = true;
+              break;
+            }
+        }
+    }
+  if (found == true)
+    {
+      Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
+      rtentry = Create<Ipv4Route> ();
+      rtentry->SetDestination (route->GetDest ());
+      // XXX handle multi-address case
+      rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
+      rtentry->SetGateway (route->GetGateway ());
+      uint32_t interfaceIdx = route->GetInterface ();
+      rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
+      return rtentry;
+    }
+  else 
+    {
+      return 0;
+    }
+}
+
+uint32_t 
+Ipv4GlobalRouting::GetNRoutes (void)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  uint32_t n = 0;
+  n += m_hostRoutes.size ();
+  n += m_networkRoutes.size ();
+  return n;
+}
+
+Ipv4RoutingTableEntry *
+Ipv4GlobalRouting::GetRoute (uint32_t index)
+{
+  NS_LOG_FUNCTION (index);
+  if (index < m_hostRoutes.size ())
+    {
+      uint32_t tmp = 0;
+      for (HostRoutesCI i = m_hostRoutes.begin (); 
+           i != m_hostRoutes.end (); 
+           i++) 
+        {
+          if (tmp  == index)
+            {
+              return *i;
+            }
+          tmp++;
+        }
+    }
+  index -= m_hostRoutes.size ();
+  uint32_t tmp = 0;
+  for (NetworkRoutesI j = m_networkRoutes.begin (); 
+       j != m_networkRoutes.end (); 
+       j++) 
+    {
+      if (tmp == index)
+        {
+          return *j;
+        }
+      tmp++;
+    }
+  NS_ASSERT (false);
+  // quiet compiler.
+  return 0;
+}
+void 
+Ipv4GlobalRouting::RemoveRoute (uint32_t index)
+{
+  NS_LOG_FUNCTION (index);
+  if (index < m_hostRoutes.size ())
+    {
+      uint32_t tmp = 0;
+      for (HostRoutesI i = m_hostRoutes.begin (); 
+           i != m_hostRoutes.end (); 
+           i++) 
+        {
+          if (tmp  == index)
+            {
+              NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_hostRoutes.size());
+              delete *i;
+              m_hostRoutes.erase (i);
+              NS_LOG_LOGIC ("Done removing host route " << index << "; host route remaining size = " << m_hostRoutes.size());
+              return;
+            }
+          tmp++;
+        }
+    }
+  index -= m_hostRoutes.size ();
+  uint32_t tmp = 0;
+  for (NetworkRoutesI j = m_networkRoutes.begin (); 
+       j != m_networkRoutes.end (); 
+       j++) 
+    {
+      if (tmp == index)
+        {
+          NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_networkRoutes.size());
+          delete *j;
+          m_networkRoutes.erase (j);
+          NS_LOG_LOGIC ("Done removing network route " << index << "; network route remaining size = " << m_networkRoutes.size());
+          return;
+        }
+      tmp++;
+    }
+  NS_ASSERT (false);
+}
+
+void
+Ipv4GlobalRouting::DoDispose (void)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  for (HostRoutesI i = m_hostRoutes.begin (); 
+       i != m_hostRoutes.end (); 
+       i = m_hostRoutes.erase (i)) 
+    {
+      delete (*i);
+    }
+  for (NetworkRoutesI j = m_networkRoutes.begin (); 
+       j != m_networkRoutes.end (); 
+       j = m_networkRoutes.erase (j)) 
+    {
+      delete (*j);
+    }
+  Ipv4RoutingProtocol::DoDispose ();
+}
+
+Ptr<Ipv4Route>
+Ipv4GlobalRouting::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
+{      
+
+//
+// First, see if this is a multicast packet we have a route for.  If we
+// have a route, then send the packet down each of the specified interfaces.
+//
+  if (header.GetDestination().IsMulticast ())
+    {
+      NS_LOG_LOGIC ("Multicast destination-- returning false");
+      return 0; // Let other routing protocols try to handle this
+    }
+//
+// See if this is a unicast packet we have a route for.
+//
+  NS_LOG_LOGIC ("Unicast destination- looking up");
+  Ptr<Ipv4Route> rtentry = LookupGlobal (header.GetDestination());
+  if (rtentry)
+    {
+      sockerr = Socket::ERROR_NOTERROR;
+    }
+  else
+    {
+      sockerr = Socket::ERROR_NOROUTETOHOST;
+    }
+  return rtentry;
+}
+
+bool 
+Ipv4GlobalRouting::RouteInput  (Ptr<const Packet> p, const Ipv4Header &ipHeader, Ptr<const NetDevice> idev,                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+                             LocalDeliverCallback lcb, ErrorCallback ecb) 
+{ 
+
+  NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
+
+  if (ipHeader.GetDestination ().IsMulticast ())
+    {
+      NS_LOG_LOGIC ("Multicast destination-- returning false");
+      return false; // Let other routing protocols try to handle this
+    }
+
+// This is a unicast packet.  Check to see if we have a route for it.
+//
+  NS_LOG_LOGIC ("Unicast destination- looking up");
+  Ptr<Ipv4Route> rtentry = LookupGlobal (ipHeader.GetDestination ());
+  if (rtentry != 0)
+    {
+      NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
+      ucb (rtentry, p, ipHeader);
+      return true;
+    }
+  else
+    {
+      NS_LOG_LOGIC ("Did not find unicast destination- returning false");
+      return false; // Let other routing protocols try to handle this
+                    // route request.
+    }
+}
+
+void
+Ipv4GlobalRouting::SetNode (Ptr<Node> node)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  m_node = node;
+}
+
+Ptr<Node>
+Ipv4GlobalRouting::GetNode (void) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  return m_node;
+}
+
+
+
+}//namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/global-routing/ipv4-global-routing.h	Tue Jun 16 17:58:16 2009 +0400
@@ -0,0 +1,216 @@
+// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
+//
+// Copyright (c) 2008 University of Washington
+//
+// 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
+//
+//
+
+#ifndef IPV4_GLOBAL_ROUTING_H
+#define IPV4_GLOBAL_ROUTING_H
+
+#include <list>
+#include <stdint.h>
+#include "ns3/ipv4-address.h"
+#include "ns3/ipv4-header.h"
+#include "ns3/ptr.h"
+#include "ns3/ipv4.h"
+#include "ns3/ipv4-routing-protocol.h"
+
+namespace ns3 {
+
+class Packet;
+class NetDevice;
+class Ipv4Interface;
+class Ipv4Address;
+class Ipv4Header;
+class Ipv4RoutingTableEntry;
+class Ipv4MulticastRoutingTableEntry;
+class Node;
+
+
+/**
+ * \brief Global routing protocol for IP version 4 stacks.
+ *
+ * In ns-3 we have the concept of a pluggable routing protocol.  Routing
+ * protocols are added to a list maintained by the Ipv4L3Protocol.  Every 
+ * stack gets one routing protocol for free -- the Ipv4StaticRouting routing
+ * protocol is added in the constructor of the Ipv4L3Protocol (this is the 
+ * piece of code that implements the functionality of the IP layer).
+ *
+ * As an option to running a dynamic routing protocol, a GlobalRouteManager
+ * object has been created to allow users to build routes for all participating
+ * nodes.  One can think of this object as a "routing oracle"; it has
+ * an omniscient view of the topology, and can construct shortest path
+ * routes between all pairs of nodes.  These routes must be stored 
+ * somewhere in the node, so therefore this class Ipv4GlobalRouting
+ * is used as one of the pluggable routing protocols.  It is kept distinct
+ * from Ipv4StaticRouting because these routes may be dynamically cleared
+ * and rebuilt in the middle of the simulation, while manually entered
+ * routes into the Ipv4StaticRouting may need to be kept distinct.
+ *
+ * This class deals with Ipv4 unicast routes only.
+ *
+ * \see Ipv4RoutingProtocol
+ * \see GlobalRouteManager
+ */
+class Ipv4GlobalRouting : public Ipv4RoutingProtocol
+{
+public:
+  static TypeId GetTypeId (void);
+/**
+ * \brief Construct an empty Ipv4GlobalRouting routing protocol,
+ *
+ * The Ipv4GlobalRouting class supports host and network unicast routes.
+ * This method initializes the lists containing these routes to empty.
+ *
+ * \see Ipv4GlobalRouting
+ */
+  Ipv4GlobalRouting ();
+  virtual ~Ipv4GlobalRouting ();
+
+  virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
+
+  virtual bool RouteInput  (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
+                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+                             LocalDeliverCallback lcb, ErrorCallback ecb);
+
+/**
+ * \brief Add a host route to the global routing table.
+ *
+ * \param dest The Ipv4Address destination for this route.
+ * \param nextHop The Ipv4Address of the next hop in the route.
+ * \param interface The network interface index used to send packets to the
+ * destination.
+ *
+ * \see Ipv4Address
+ */
+  void AddHostRouteTo (Ipv4Address dest, 
+                       Ipv4Address nextHop, 
+                       uint32_t interface);
+/**
+ * \brief Add a host route to the global routing table.
+ *
+ * \param dest The Ipv4Address destination for this route.
+ * \param interface The network interface index used to send packets to the
+ * destination.
+ *
+ * \see Ipv4Address
+ */
+  void AddHostRouteTo (Ipv4Address dest, 
+                       uint32_t interface);
+
+/**
+ * \brief Add a network route to the global routing table.
+ *
+ * \param network The Ipv4Address network for this route.
+ * \param networkMask The Ipv4Mask to extract the network.
+ * \param nextHop The next hop in the route to the destination network.
+ * \param interface The network interface index used to send packets to the
+ * destination.
+ *
+ * \see Ipv4Address
+ */
+  void AddNetworkRouteTo (Ipv4Address network, 
+                          Ipv4Mask networkMask, 
+                          Ipv4Address nextHop, 
+                          uint32_t interface);
+
+/**
+ * \brief Add a network route to the global routing table.
+ *
+ * \param network The Ipv4Address network for this route.
+ * \param networkMask The Ipv4Mask to extract the network.
+ * \param interface The network interface index used to send packets to the
+ * destination.
+ *
+ * \see Ipv4Address
+ */
+  void AddNetworkRouteTo (Ipv4Address network, 
+                          Ipv4Mask networkMask, 
+                          uint32_t interface);
+
+/**
+ * \brief Get the number of individual unicast routes that have been added
+ * to the routing table.
+ *
+ * \warning The default route counts as one of the routes.
+ */
+  uint32_t GetNRoutes (void);
+
+/**
+ * \brief Get a route from the global unicast routing table.
+ *
+ * Externally, the unicast global routing table appears simply as a table with
+ * n entries.  The one sublety of note is that if a default route has been set
+ * it will appear as the zeroth entry in the table.  This means that if you
+ * add only a default route, the table will have one entry that can be accessed
+ * either by explicity calling GetDefaultRoute () or by calling GetRoute (0).
+ * 
+ * Similarly, if the default route has been set, calling RemoveRoute (0) will
+ * remove the default route.
+ *
+ * \param i The index (into the routing table) of the route to retrieve.  If
+ * the default route has been set, it will occupy index zero.
+ * \return If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise
+ * a zero pointer is returned.
+ *
+ * \see Ipv4RoutingTableEntry
+ * \see Ipv4GlobalRouting::RemoveRoute
+ */
+  Ipv4RoutingTableEntry *GetRoute (uint32_t i);
+
+/**
+ * \brief Remove a route from the global unicast routing table.
+ *
+ * Externally, the unicast global routing table appears simply as a table with
+ * n entries.  The one sublety of note is that if a default route has been set
+ * it will appear as the zeroth entry in the table.  This means that if the
+ * default route has been set, calling RemoveRoute (0) will remove the
+ * default route.
+ *
+ * \param i The index (into the routing table) of the route to remove.  If
+ * the default route has been set, it will occupy index zero.
+ *
+ * \see Ipv4RoutingTableEntry
+ * \see Ipv4GlobalRouting::GetRoute
+ * \see Ipv4GlobalRouting::AddRoute
+ */
+  void RemoveRoute (uint32_t i);
+
+  void SetNode (Ptr<Node> node);
+  Ptr<Node> GetNode (void) const;
+
+protected:
+  void DoDispose (void);
+
+private:
+  typedef std::list<Ipv4RoutingTableEntry *> HostRoutes;
+  typedef std::list<Ipv4RoutingTableEntry *>::const_iterator HostRoutesCI;
+  typedef std::list<Ipv4RoutingTableEntry *>::iterator HostRoutesI;
+  typedef std::list<Ipv4RoutingTableEntry *> NetworkRoutes;
+  typedef std::list<Ipv4RoutingTableEntry *>::const_iterator NetworkRoutesCI;
+  typedef std::list<Ipv4RoutingTableEntry *>::iterator NetworkRoutesI;
+
+  Ptr<Ipv4Route> LookupGlobal (Ipv4Address dest);
+
+  HostRoutes m_hostRoutes;
+  NetworkRoutes m_networkRoutes;
+
+  Ptr<Node> m_node;
+};
+
+} // Namespace ns3
+
+#endif /* IPV4_GLOBAL_ROUTING_H */
--- a/src/routing/global-routing/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/routing/global-routing/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -7,6 +7,7 @@
         'global-route-manager.cc',
         'global-route-manager-impl.cc',
         'candidate-queue.cc',
+        'ipv4-global-routing.cc',
         ]
     headers = bld.new_task_gen('ns3header')
     headers.module = 'global-routing'
--- a/src/simulator/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/src/simulator/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -31,7 +31,7 @@
 
     conf.check(header_name='sys/inttypes.h', define_name='HAVE_SYS_INT_TYPES_H')
 
-    conf.write_config_header('ns3/simulator-config.h', project_root_relative=True)
+    conf.write_config_header('ns3/simulator-config.h', top=True)
 
     if not conf.check(lib='rt', uselib='RT', define_name='HAVE_RT'):
         conf.report_optional_feature("RealTime", "Real Time Simulator",
--- a/utils/run-tests.cc	Tue Jun 16 17:58:06 2009 +0400
+++ b/utils/run-tests.cc	Tue Jun 16 17:58:16 2009 +0400
@@ -25,13 +25,42 @@
 
 int main (int argc, char *argv[])
 {
+  if (argc > 1)
+    {
+      if (std::string (argv[1]) == "--ListTests")
+        {
 #ifdef RUN_SELF_TESTS
-  ns3::PacketMetadata::Enable ();
-  ns3::TestManager::EnableVerbose ();
-  bool success = ns3::TestManager::RunTests ();
-  if (!success)
-    return 1;
+          ns3::TestManager::PrintTestNames (std::cout);
+#endif
+        }
+      else
+        {
+          // run the test named by argv[1]
+#ifdef RUN_SELF_TESTS
+          bool success = ns3::TestManager::RunTest (argv[1]);
+          if (!success)
+            {
+              return 1;
+            }
+#else
+          std::cerr << "Unit tests not enabled" << std::endl;
+          return 1;
+#endif
+        }      
+    }
+  else
+    {
+      // run all tests
+#ifdef RUN_SELF_TESTS
+      ns3::PacketMetadata::Enable ();
+      ns3::TestManager::EnableVerbose ();
+      bool success = ns3::TestManager::RunTests ();
+      if (!success)
+        {
+          return 1;
+        }
 #endif /* RUN_SELF_TESTS */
-
+    }
   return 0;
 }
+
Binary file waf has changed
--- a/wscript	Tue Jun 16 17:58:06 2009 +0400
+++ b/wscript	Tue Jun 16 17:58:16 2009 +0400
@@ -146,6 +146,9 @@
     opt.add_option('--regression',
                    help=("Enable regression testing; only used for the 'check' target"),
                    default=False, dest='regression', action="store_true")
+    opt.add_option('--check',
+                   help=("Enable unit testing"),
+                   default=False, dest='check', action="store_true")
     opt.add_option('--regression-generate',
                    help=("Generate new regression test traces."),
                    default=False, dest='regression_generate', action="store_true")
@@ -523,6 +526,8 @@
                                  " (--with-regression-traces configure option)")
         regression.run_regression(bld, regression_traces)
 
+    if Options.options.check:
+        _run_check(bld)
 
 
 def shutdown(ctx):
@@ -561,35 +566,163 @@
 
 check_context = Build.BuildContext
 def check(bld):
-    "run the NS-3 unit tests"
-    Scripting.build(bld)
-    ## generate the trace sources list docs
-    env = wutils.bld.env
-    proc_env = wutils.get_proc_env()
-    try:
-        program_obj = wutils.find_program('print-introspected-doxygen', env)
-    except ValueError: # could happen if print-introspected-doxygen is
-                       # not built because of waf configure
-                       # --enable-modules=xxx
-        pass
-    else:
-        prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env)
-        out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
-        if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
-            raise SystemExit(1)
-        out.close()
+    """run the NS-3 unit tests (deprecated in favour of --check option)"""
+    raise Utils.WafError("Please run `./waf --check' instead.")
+
+
+class print_introspected_doxygen_task(Task.TaskBase):
+    after = 'cc cxx cc_link cxx_link'
+    color = 'BLUE'
+
+    def __init__(self, bld):
+        self.bld = bld
+        super(print_introspected_doxygen_task, self).__init__(generator=self)
+        
+    def __str__(self):
+        return 'print-introspected-doxygen\n'
+
+    def runnable_status(self):
+        return Task.RUN_ME
 
-    print "-- Running NS-3 C++ core unit tests..."
-    wutils.run_program('run-tests', env, wutils.get_command_template(env))
+    def run(self):
+        ## generate the trace sources list docs
+        env = wutils.bld.env
+        proc_env = wutils.get_proc_env()
+        try:
+            program_obj = wutils.find_program('print-introspected-doxygen', env)
+        except ValueError: # could happen if print-introspected-doxygen is
+                           # not built because of waf configure
+                           # --enable-modules=xxx
+            pass
+        else:
+            prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env)
+            out = open(os.path.join('..', 'doc', 'introspected-doxygen.h'), 'w')
+            if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
+                raise SystemExit(1)
+            out.close()
 
-    if env['ENABLE_PYTHON_BINDINGS']:
-        print "-- Running NS-3 Python bindings unit tests..."
-        wutils.run_argv([env['PYTHON'], os.path.join("utils", "python-unit-tests.py")],
-                        env, proc_env, force_no_valgrind=True)
-    else:
-        print "-- Skipping NS-3 Python bindings unit tests: Python bindings not enabled."
+class run_python_unit_tests_task(Task.TaskBase):
+    after = 'cc cxx cc_link cxx_link'
+    color = 'BLUE'
+
+    def __init__(self, bld):
+        self.bld = bld
+        super(run_python_unit_tests_task, self).__init__(generator=self)
+        
+    def __str__(self):
+        return 'run-python-unit-tests\n'
+
+    def runnable_status(self):
+        return Task.RUN_ME
+
+    def run(self):
+        proc_env = wutils.get_proc_env()
+        wutils.run_argv([self.bld.env['PYTHON'], os.path.join("..", "utils", "python-unit-tests.py")],
+                        self.bld.env, proc_env, force_no_valgrind=True)
 
 
+class run_a_unit_test_task(Task.TaskBase):
+    after = 'cc cxx cc_link cxx_link'
+    color = 'BLUE'
+
+    def __init__(self, bld, name_of_test):
+        self.bld = bld
+        super(run_a_unit_test_task, self).__init__(generator=self)
+        self.name_of_test = name_of_test
+        try:
+            program_obj = wutils.find_program("run-tests", self.bld.env)
+        except ValueError, ex:
+            raise Utils.WafError(str(ex))
+        program_node = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj))
+        self.program_path = program_node.abspath(self.bld.env)
+
+    def __str__(self):
+        return 'run-unit-test(%s)\n' % self.name_of_test
+
+    def runnable_status(self):
+        return Task.RUN_ME
+
+    def run(self):
+        #print repr([self.program_path, self.name_of_test])
+        try:
+            self.retval = wutils.run_argv([self.program_path, self.name_of_test], self.bld.env)
+        except Utils.WafError:
+            self.retval = 1
+        #print "running test %s: exit with %i" % (self.name_of_test, retval)
+        return 0
+
+class get_list_of_unit_tests_task(Task.TaskBase):
+    after = 'cc cxx cc_link cxx_link'
+    color = 'BLUE'
+
+    def __init__(self, bld):
+        self.bld = bld
+        super(get_list_of_unit_tests_task, self).__init__(generator=self)
+        self.tests = []
+
+    def __str__(self):
+        return 'get-unit-tests-list\n'
+
+    def runnable_status(self):
+        return Task.RUN_ME
+
+    def run(self):
+        try:
+            program_obj = wutils.find_program("run-tests", self.bld.env)
+        except ValueError, ex:
+            raise Utils.WafError(str(ex))
+        program_node = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj))
+        program_path = program_node.abspath(self.bld.env)
+        proc = subprocess.Popen([program_path, "--ListTests"], stdout=subprocess.PIPE,
+                                env=wutils.get_proc_env())
+        self.tests = [l.rstrip() for l in proc.stdout.readlines()]
+        retval = proc.wait()
+        if retval:
+            return retval
+        test_tasks = []
+        for name_of_test in self.tests:
+            test_tasks.append(run_a_unit_test_task(self.bld, name_of_test))
+        collector = collect_unit_test_results_task(self.bld, list(test_tasks))
+        collector.run_after = list(test_tasks)
+        self.more_tasks = [collector] + test_tasks
+        
+
+class collect_unit_test_results_task(Task.TaskBase):
+    after = 'run_a_unit_test_task'
+    color = 'BLUE'
+
+    def __init__(self, bld, test_tasks):
+        self.bld = bld
+        super(collect_unit_test_results_task, self).__init__(generator=self)
+        self.test_tasks = test_tasks
+
+    def __str__(self):
+        return 'collect-unit-tests-results\n'
+
+    def runnable_status(self):
+        for t in self.run_after:
+            if not t.hasrun:
+                return Task.ASK_LATER
+        return Task.RUN_ME
+
+    def run(self):
+        failed = 0
+        for task in self.test_tasks:
+            if task.retval:
+                failed += 1
+        if failed:
+            print "C++ UNIT TESTS: %i tests passed, %i failed." % (len(self.test_tasks) - failed, failed)
+            return 1
+        else:
+            print "C++ UNIT TESTS: all %i tests passed." % (len(self.test_tasks),)
+            return 0
+
+
+def _run_check(bld):
+    task = get_list_of_unit_tests_task(bld)
+    print_introspected_doxygen_task(bld)
+    if bld.env['ENABLE_PYTHON_BINDINGS']:
+        run_python_unit_tests_task(bld)
 
 
 def check_shell(bld):