merge with ns-3-dev (3.5 rc3)
authorPavel Boyko <boyko@iitp.ru>
Fri, 03 Jul 2009 09:59:04 +0400
changeset 5100 d0cafb0ebeeb
parent 5099 bb2373a0cece (current diff)
parent 4647 db64eae0e481 (diff)
child 5101 41589d492ca3
merge with ns-3-dev (3.5 rc3)
.hgignore
doc/doxygen.conf
examples/stats/wifi-example-apps.cc
src/applications/udp-echo/udp-echo-client.cc
src/devices/wifi/dcf-manager.cc
src/helper/wscript
src/internet-stack/ipv4-l3-protocol.cc
src/internet-stack/ipv4-list-routing-impl.cc
src/internet-stack/ipv4-list-routing-impl.h
src/internet-stack/ipv4-static-routing-impl.cc
src/internet-stack/ipv4-static-routing-impl.h
src/internet-stack/tcp-socket-impl.cc
src/internet-stack/udp-socket-impl.cc
src/internet-stack/udp-test.cc
src/node/ipv4-list-routing.cc
src/node/ipv4-list-routing.h
src/node/ipv4-routing-table-entry.cc
src/node/ipv4-routing-table-entry.h
src/node/ipv4-static-routing.cc
src/node/ipv4-static-routing.h
src/node/wscript
src/wscript
--- a/.hgignore	Wed Jul 01 21:54:24 2009 +0400
+++ b/.hgignore	Fri Jul 03 09:59:04 2009 +0400
@@ -29,3 +29,9 @@
 ^doc/manual/figures/.*pdf
 ^doc/manual/figures/.*png
 ^bindings/python/pybindgen/
+ms_print.*
+massif.*
+\.patch$
+\.diff$
+\.tr$
+\#[^\#/]+\#$
\ No newline at end of file
--- a/.hgtags	Wed Jul 01 21:54:24 2009 +0400
+++ b/.hgtags	Fri Jul 03 09:59:04 2009 +0400
@@ -32,3 +32,6 @@
 4267fd454004f5a60e517496f43a01000ccebc72 ns-3.3-RC6
 2efae18e73794c0acd8061a9bd5c74b69f1b0d93 ns-3.3
 5396ecd09060bcb1e7b1f750bb170cbfde7a77c2 ns-3.4
+13a5b15fbe3429a6c3d00c1bccffa2c156a0603b ns-3.5-rc1
+8562a42accf6f715d312c037326ec7da48095e13 ns-3.5-rc2
+a600c11ff8d40a40e88c2d692acad6512dde70c8 ns-3.5-rc3
--- a/CHANGES.html	Wed Jul 01 21:54:24 2009 +0400
+++ b/CHANGES.html	Fri Jul 03 09:59:04 2009 +0400
@@ -79,6 +79,46 @@
 <h2>Changes to existing API:</h2>
 <ul>
 
+<li><b>Ipv4Interface::GetMtu () deleted</b>
+  <p>The Ipv4Interface API is private to internet-stack module; this method
+was just a pass-through to GetDevice ()-&gt;GetMtu ().
+  </p>
+</li>
+
+<li><b>GlobalRouteManager::PopulateRoutingTables () and RecomputeRoutingTables () are deprecated </b>
+  <p>This API has been moved to the helper API and the above functions will
+be removed in ns-3.6.  The new API is:
+<pre>
+Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
+Ipv4GlobalRoutingHelper::RecomputeRoutingTables ();
+</pre>
+Additionally, these low-level functions in GlobalRouteManager are now public,
+allowing more API flexibility at the low level ns-3 API:
+<pre>
+GlobalRouteManager::DeleteGlobalRoutes ();
+GlobalRouteManager::BuildGlobalRoutingDatabase ();
+GlobalRouteManager::InitializeRoutes ();
+</pre>
+  </p>
+</li>
+
+<li><b>CalcChecksum attribute changes</b>
+  <p>Four IPv4 CalcChecksum attributes (which enable the computation of 
+checksums that are disabled by default) have been collapsed into one global 
+value in class Node.  These four calls: 
+<pre>
+Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
+Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true));
+Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true));
+Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true));
+</pre>
+are replaced by one call to:
+<pre>
+GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
+</pre>
+  </p>
+</li>
+
 <li><b>CreateObject changes</b>
   <p>CreateObject is now able to construct objects with a non-default constructor.
    If you used to pass attribute lists to CreateObject, you must now use CreateObjectWithAttributes.
@@ -118,16 +158,16 @@
 <p> 
 To accommodate support for the radiotap and prism headers in PCAP traces, the interface for promiscuos mode sniff in the wifi device was changed. The new implementation was heavily inspired by the way the madwifi driver handles monitor mode. A distinction between TX and RX events is introduced, to account for the fact that different information is to be put in the radiotap/prism header (e.g., RSSI and noise make sense only for RX packets). The following are the relevant modifications to the WifiPhy class:
 <pre>
--  void NotifyPromiscSniff (Ptr<const Packet> packet);
-+  void NotifyPromiscSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm);
-+  void NotifyPromiscSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble);
--  TracedCallback<Ptr<const Packet> > m_phyPromiscSnifferTrace;
-+  TracedCallback<Ptr<const Packet>, uint16_t, uint32_t, bool, double, double> m_phyPromiscSniffRxTrace;
-+  TracedCallback<Ptr<const Packet>, uint16_t, uint32_t, bool> m_phyPromiscSniffTxTrace;
+-  void NotifyPromiscSniff (Ptr&lt;const Packet&gt; packet);
++  void NotifyPromiscSniffRx (Ptr&lt;const Packet&gt; packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm);
++  void NotifyPromiscSniffTx (Ptr&lt;const Packet&gt; packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble);
+-  TracedCallback&lt;Ptr&lt;const Packet&gt; &gt; m_phyPromiscSnifferTrace;
++  TracedCallback&lt;Ptr&lt;const Packet&gt;, uint16_t, uint32_t, bool, double, double&gt; m_phyPromiscSniffRxTrace;
++  TracedCallback&lt;Ptr&lt;const Packet&gt;, uint16_t, uint32_t, bool&gt; m_phyPromiscSniffTxTrace;
 </pre>
 The above mentioned callbacks are expected to be used to call the following method to write Wifi PCAP traces in promiscuous mode:
 <pre>
-+  void WriteWifiMonitorPacket(Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, bool isTx, double signalDbm, double noiseDbm);
++  void WriteWifiMonitorPacket(Ptr&lt;const Packet&gt; packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, bool isTx, double signalDbm, double noiseDbm);
 </pre>
 In the above method, the isTx parameter is to be used to differentiate between TX and RX packets. For an example of how to implement these callbacks, see the implementation of PcapSniffTxEvent and PcapSniffRxEvent in src/helper/yans-wifi-helper.cc
 </p>
@@ -158,18 +198,18 @@
 locally originated packets, and an asynchronous, callback-based lookup
 for forwarded packets) is still the same.
 <pre>
--  typedef Callback&lt;void, bool, const Ipv4Route&, Ptr&lt;Packet&gt;, const Ipv4Header&&gt; RouteReplyCallback;
-+  typedef Callback&lt;void, Ptr&lt;Ipv4Route&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; UnicastForwardCallback;
-+  typedef Callback&lt;void, Ptr&lt;Ipv4MulticastRoute&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; MulticastForwardCallback;
-+  typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &, uint32_t &gt; LocalDeliverCallback;
-+  typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &&gt; ErrorCallback;
--  virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface) = 0;
-+  virtual Ptr&lt;Ipv4Route&gt; RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &errno) = 0;
+-  typedef Callback&lt;void, bool, const Ipv4Route&amp;, Ptr&lt;Packet&gt;, const Ipv4Header&amp;&gt; RouteReplyCallback;
++  typedef Callback&lt;void, Ptr&lt;Ipv4Route&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &amp;&gt; UnicastForwardCallback;
++  typedef Callback&lt;void, Ptr&lt;Ipv4MulticastRoute&gt;, Ptr&lt;const Packet&gt;, const Ipv4Header &amp;&gt; MulticastForwardCallback;
++  typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &amp;, uint32_t &gt; LocalDeliverCallback;
++  typedef Callback&lt;void, Ptr&lt;const Packet&gt;, const Ipv4Header &amp;&gt; ErrorCallback;
+-  virtual bool RequestInterface (Ipv4Address destination, uint32_t&amp; interface) = 0;
++  virtual Ptr&lt;Ipv4Route&gt; RouteOutput (Ptr&lt;Packet&gt; p, const Ipv4Header &amp;header, uint32_t oif, Socket::SocketErrno &amp;errno) = 0;
 -  virtual bool RequestRoute (uint32_t interface,
--                            const Ipv4Header &ipHeader,
+-                            const Ipv4Header &amp;ipHeader,
 -                            Ptr&lt;Packet&gt; packet,
 -                            RouteReplyCallback routeReply) = 0;
-+  virtual bool RouteInput  (Ptr&lt;const Packet&gt; p, const Ipv4Header &header, Ptr&lt;const NetDevice&gt; idev,
++  virtual bool RouteInput  (Ptr&lt;const Packet&gt; p, const Ipv4Header &amp;header, Ptr&lt;const NetDevice&gt; idev,
 +                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
 +                             LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
 </pre>
@@ -219,16 +259,16 @@
 - static const uint32_t Ipv4RoutingProtocol::IF_INDEX_ANY = 0xffffffff;
 + static const uint32_t Ipv4RoutingProtocol::INTERFACE_ANY = 0xffffffff;
 
-- bool Ipv4RoutingProtocol::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex);
-+ bool Ipv4RoutingProtocol::RequestInterface (Ipv4Address destination, uint32_t& interface);
+- bool Ipv4RoutingProtocol::RequestIfIndex (Ipv4Address destination, uint32_t&amp; ifIndex);
++ bool Ipv4RoutingProtocol::RequestInterface (Ipv4Address destination, uint32_t&amp; interface);
 (N.B. this particular function is planned to be renamed to RouteOutput() in the
 proposed IPv4 routing refactoring)
 
 - uint32_t Ipv4::GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask);
 + int_32t Ipv4::GetInterfaceForAddress (Ipv4Address address, Ipv4Mask mask) const;
 
-- bool Ipv4::GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const;
-+ bool Ipv4::GetInterfaceForDestination (Ipv4Address dest, uint32_t &interface) const;
+- bool Ipv4::GetIfIndexForDestination (Ipv4Address dest, uint32_t &amp;ifIndex) const;
++ bool Ipv4::GetInterfaceForDestination (Ipv4Address dest, uint32_t &amp;interface) const;
 (N.B. this function is not needed in the proposed Ipv4 routing refactoring)
 </pre>
 
@@ -246,13 +286,13 @@
   <li>Regarding legacy API usage, typically where you once did the following,
   using the public Ipv4 class interface (e.g.):
   <pre>
-  ipv4A->SetAddress (ifIndexA, Ipv4Address ("172.16.1.1"));
-  ipv4A->SetNetworkMask (ifIndexA, Ipv4Mask ("255.255.255.255"));
+  ipv4A-&gt;SetAddress (ifIndexA, Ipv4Address ("172.16.1.1"));
+  ipv4A-&gt;SetNetworkMask (ifIndexA, Ipv4Mask ("255.255.255.255"));
   </pre>
   you now do:
   <pre>
   Ipv4InterfaceAddress ipv4IfAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
-  ipv4A->AddAddress (ifIndexA, ipv4IfAddrA);
+  ipv4A-&gt;AddAddress (ifIndexA, ipv4IfAddrA);
   </pre>
   <li> At the helper API level, one often gets an address from an interface
   container.  We preserve the legacy GetAddress (uint32_t i) but it
@@ -270,16 +310,16 @@
 <li><b>New WifiMacHelper objects</b>
 <p>The type of wifi MAC is now set by two new specific helpers, NqosWifiMacHelper for non QoS MACs and QosWifiMacHelper for Qos MACs. They are passed as argument to WifiHelper::Install methods.</li>
   <pre>
-- void WifiHelper::SetMac (std::string type, std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),...)
+- void WifiHelper::SetMac (std::string type, std::string n0 = "", const AttributeValue &amp;v0 = EmptyAttributeValue (),...)
 
-- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const
-+ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const
+- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phyHelper, NodeContainer c) const
++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phyHelper, const WifiMacHelper &amp;macHelper, NodeContainer c) const
 
-- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, Ptr&lt;Node&gt; node) const
-+ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, Ptr&lt;Node&gt; node) const
+- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phy, Ptr&lt;Node&gt; node) const
++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phy, const WifiMacHelper &amp;mac, Ptr&lt;Node&gt; node) const
 
-- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const
-+ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) const
+- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phy, std::string nodeName) const
++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &amp;phy, const WifiMacHelper &amp;mac, std::string nodeName) const
   </pre>
   See src/helper/nqos-wifi-mac-helper.h and src/helper/qos-wifi-mac-helper.h for more details.
   </p>
@@ -311,7 +351,7 @@
 
 <h2>New API:</h2>
 <ul>
-<li>XML support has been added to the ConfigStore in /src/contrib/config-store.cc</li>
+<li>XML support has been added to the ConfigStore in src/contrib/config-store.cc</li>
 
 <li>The ns-2 calendar queue scheduler option has been ported to src/simulator</li>
 
@@ -548,15 +588,15 @@
 The normal and the promiscuous receive callbacks of the NetDevice API
 have been changed from:
 <pre>
-Callback<bool,Ptr<NetDevice>,Ptr<Packet>,uint16_t,const Address &>
-Callback<bool,Ptr<NetDevice>, Ptr<Packet>, uint16_t,
-         const Address &, const Address &, enum PacketType >
+Callback&lt;bool,Ptr&lt;NetDevice&gt;,Ptr&lt;Packet&gt;,uint16_t,const Address &amp;&gt;
+Callback&lt;bool,Ptr&lt;NetDevice&gt;, Ptr&lt;Packet&gt;, uint16_t,
+         const Address &amp;, const Address &amp;, enum PacketType &gt;
 </pre>
 to:
 <pre>
-Callback<bool,Ptr<NetDevice>,Ptr<const Packet>,uint16_t,const Address &>
-Callback<bool,Ptr<NetDevice>, Ptr<const Packet>, uint16_t,
-         const Address &, const Address &, enum PacketType >
+Callback&lt;bool,Ptr&lt;NetDevice&gt;,Ptr&lt;const Packet&gt;,uint16_t,const Address &amp;&gt;
+Callback&lt;bool,Ptr&lt;NetDevice&gt;, Ptr&lt;const Packet&gt;, uint16_t,
+         const Address &amp;, const Address &amp;, enum PacketType &gt;
 </pre>
 to avoid the kind of bugs reported in 
 <a href="http://www.nsnam.org/bugzilla/show_bug.cgi?id=273">bug 273</a>.
@@ -625,7 +665,7 @@
 - void SetPort (uint16_t port); 
 + UdpEchoServerHelper (uint16_t port);
 + 
-+ void SetAttribute (std::string name, const AttributeValue &value);
++ void SetAttribute (std::string name, const AttributeValue &amp;value);
 ApplicationContainer Install (NodeContainer c);
 
 class UdpEchoClientHelper
@@ -634,8 +674,8 @@
 - UdpEchoClientHelper ();
 + UdpEchoClientHelper (Ipv4Address ip, uint16_t port);
 - void SetRemote (Ipv4Address ip, uint16_t port);
-- void SetAppAttribute (std::string name, const AttributeValue &value);
-+ void SetAttribute (std::string name, const AttributeValue &value);
+- void SetAppAttribute (std::string name, const AttributeValue &amp;value);
++ void SetAttribute (std::string name, const AttributeValue &amp;value);
 ApplicationContainer Install (NodeContainer c);
 </pre>
 </li>
--- a/RELEASE_NOTES	Wed Jul 01 21:54:24 2009 +0400
+++ b/RELEASE_NOTES	Fri Jul 03 09:59:04 2009 +0400
@@ -13,7 +13,21 @@
 
 Availability
 ------------
-This release is scheduled for June/July 2009
+This release is immediately available from:
+http://www.nsnam.org/releases/ns-allinone-3.5.tar.bz2
+
+Supported platforms
+-------------------
+ns-3.5 has been tested on the following platforms:
+  - linux x86 gcc 4.2, 4.1, and, 3.4.6.
+  - linux x86_64 gcc 4.4.0, 4.3.2, 4.2.3, 4.2.1, 4.1.3, 3.4.6
+  - MacOS X ppc and x86 (gcc 4.0.x and 4.2.x)
+  - cygwin gcc 3.4.4 (debug only), gcc 4.3.2 (debug and optimized)
+  - mingw gcc 3.4.5 (debug only)
+
+Not all ns-3 options are available on all platforms; consult the
+wiki for more information:
+http://www.nsnam.org/wiki/index.php/Installation
 
 New user-visible features
 -------------------------
@@ -26,7 +40,12 @@
      - 802.11b PHY support (Gary Pei)
      - Nakagami propagation loss model (Timo Bingmann)
      - radiotap and prism headers for PCAP output (Nicola Baldo)
-  c) GammaVariable and ErlangVariable (Timo Bingmann)
+  c) RandomVariable:
+     - GammaVariable and ErlangVariable (Timo Bingmann)
+     - ZipfVariable (Francesco Malandrino)
+  d) UdpEcho: allows setting the payload of echo packets
+  e) Ipv4/Ipv4RoutingProtocol: allow fine-grained control over
+     routing policy and arbitrary composition of routing protocols
  
 API changes from ns-3.4
 -----------------------
@@ -34,13 +53,27 @@
 internal API and composition of the IPv4 stack underwent significant
 refactoring in this release cycle.
 
+Known issues
+------------
+ns-3 build is known to fail on the following platforms:
+  - gcc 3.3 and earlier
+  - optimized builds on gcc 3.4.4 and 3.4.5
+  - optimized builds on linux x86 gcc 4.0.x
+
+Future releases
+---------------
+Our next release, which is expected to happen in 2 to 4 months from now, will
+feature the merging of some of our projects currently in development including
+fuller IPv6 support, and some smaller features such as a new Global ARP package 
+and possibly a new Testing and Validation suite.
+
 Release 3.4
 ===========
 
 Availability
 ------------
 This release is immediately available from:
-http://www.nsnam.org/releases/ns-3.4.tar.bz2
+http://www.nsnam.org/releases/ns-allinone-3.4.tar.bz2
 
 Supported platforms
 -------------------
--- a/bindings/python/ns3_module_bridge.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_bridge.py	Fri Jul 03 09:59:04 2009 +0400
@@ -128,6 +128,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## bridge-net-device.h: void ns3::BridgeNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- a/bindings/python/ns3_module_core.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_core.py	Fri Jul 03 09:59:04 2009 +0400
@@ -85,6 +85,8 @@
     module.add_class('UnsafeAttributeList')
     ## random-variable.h: ns3::WeibullVariable [class]
     module.add_class('WeibullVariable', parent=root_module['ns3::RandomVariable'])
+    ## random-variable.h: ns3::ZipfVariable [class]
+    module.add_class('ZipfVariable', parent=root_module['ns3::RandomVariable'])
     ## empty.h: ns3::empty [class]
     module.add_class('empty')
     ## attribute.h: ns3::AttributeAccessor [class]
@@ -260,6 +262,7 @@
     register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable'])
     register_Ns3UnsafeAttributeList_methods(root_module, root_module['ns3::UnsafeAttributeList'])
     register_Ns3WeibullVariable_methods(root_module, root_module['ns3::WeibullVariable'])
+    register_Ns3ZipfVariable_methods(root_module, root_module['ns3::ZipfVariable'])
     register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
     register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
     register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
@@ -1180,6 +1183,15 @@
     cls.add_constructor([param('double', 'm'), param('double', 's'), param('double', 'b')])
     return
 
+def register_Ns3ZipfVariable_methods(root_module, cls):
+    ## random-variable.h: ns3::ZipfVariable::ZipfVariable(ns3::ZipfVariable const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::ZipfVariable const &', 'arg0')])
+    ## random-variable.h: ns3::ZipfVariable::ZipfVariable(long int n, double alpha) [constructor]
+    cls.add_constructor([param('long int', 'n'), param('double', 'alpha')])
+    ## random-variable.h: ns3::ZipfVariable::ZipfVariable() [constructor]
+    cls.add_constructor([])
+    return
+
 def register_Ns3Empty_methods(root_module, cls):
     ## empty.h: ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
     cls.add_constructor([param('ns3::empty const &', 'arg0')])
--- a/bindings/python/ns3_module_csma.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_csma.py	Fri Jul 03 09:59:04 2009 +0400
@@ -262,10 +262,6 @@
     cls.add_method('SetReceiveEnable', 
                    'void', 
                    [param('bool', 'enable')])
-    ## csma-net-device.h: void ns3::CsmaNetDevice::SetAddress(ns3::Mac48Address addr) [member function]
-    cls.add_method('SetAddress', 
-                   'void', 
-                   [param('ns3::Mac48Address', 'addr')])
     ## csma-net-device.h: void ns3::CsmaNetDevice::SetFrameSize(uint16_t frameSize) [member function]
     cls.add_method('SetFrameSize', 
                    'void', 
@@ -308,6 +304,11 @@
                    'uint16_t', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## csma-net-device.h: void ns3::CsmaNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- a/bindings/python/ns3_module_emu.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_emu.py	Fri Jul 03 09:59:04 2009 +0400
@@ -86,10 +86,6 @@
     cls.add_method('SetQueue', 
                    'void', 
                    [param('ns3::Ptr< ns3::Queue >', 'queue')])
-    ## emu-net-device.h: void ns3::EmuNetDevice::SetAddress(ns3::Mac48Address addr) [member function]
-    cls.add_method('SetAddress', 
-                   'void', 
-                   [param('ns3::Mac48Address', 'addr')])
     ## emu-net-device.h: void ns3::EmuNetDevice::SetIfIndex(uint32_t const index) [member function]
     cls.add_method('SetIfIndex', 
                    'void', 
@@ -105,6 +101,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## emu-net-device.h: void ns3::EmuNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## emu-net-device.h: ns3::Address ns3::EmuNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- a/bindings/python/ns3_module_global_routing.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_global_routing.py	Fri Jul 03 09:59:04 2009 +0400
@@ -17,6 +17,8 @@
     module.add_enum('LinkType', ['Unknown', 'PointToPoint', 'TransitNetwork', 'StubNetwork', 'VirtualLink'], outer_class=root_module['ns3::GlobalRoutingLinkRecord'])
     ## global-router-interface.h: ns3::GlobalRouter [class]
     module.add_class('GlobalRouter', is_singleton=True, parent=root_module['ns3::Object'])
+    ## ipv4-global-routing.h: ns3::Ipv4GlobalRouting [class]
+    module.add_class('Ipv4GlobalRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
     
     ## Register a nested module for the namespace Config
     
@@ -73,6 +75,7 @@
     register_Ns3GlobalRoutingLSA_methods(root_module, root_module['ns3::GlobalRoutingLSA'])
     register_Ns3GlobalRoutingLinkRecord_methods(root_module, root_module['ns3::GlobalRoutingLinkRecord'])
     register_Ns3GlobalRouter_methods(root_module, root_module['ns3::GlobalRouter'])
+    register_Ns3Ipv4GlobalRouting_methods(root_module, root_module['ns3::Ipv4GlobalRouting'])
     return
 
 def register_Ns3GlobalRouteManager_methods(root_module, cls):
@@ -81,31 +84,11 @@
                    'void', 
                    [], 
                    is_static=True)
-    ## global-route-manager.h: static void ns3::GlobalRouteManager::PopulateRoutingTables(ns3::NodeContainer c) [member function]
-    cls.add_method('PopulateRoutingTables', 
-                   'void', 
-                   [param('ns3::NodeContainer', 'c')], 
-                   is_static=True)
     ## global-route-manager.h: static void ns3::GlobalRouteManager::RecomputeRoutingTables() [member function]
     cls.add_method('RecomputeRoutingTables', 
                    'void', 
                    [], 
                    is_static=True)
-    ## global-route-manager.h: static void ns3::GlobalRouteManager::DeleteGlobalRoutes() [member function]
-    cls.add_method('DeleteGlobalRoutes', 
-                   'void', 
-                   [], 
-                   is_static=True)
-    ## global-route-manager.h: static void ns3::GlobalRouteManager::SelectRouterNodes() [member function]
-    cls.add_method('SelectRouterNodes', 
-                   'void', 
-                   [], 
-                   is_static=True)
-    ## global-route-manager.h: static void ns3::GlobalRouteManager::SelectRouterNodes(ns3::NodeContainer c) [member function]
-    cls.add_method('SelectRouterNodes', 
-                   'void', 
-                   [param('ns3::NodeContainer', 'c')], 
-                   is_static=True)
     ## global-route-manager.h: static uint32_t ns3::GlobalRouteManager::AllocateRouterId() [member function]
     cls.add_method('AllocateRouterId', 
                    'uint32_t', 
@@ -267,6 +250,14 @@
                    is_static=True)
     ## global-router-interface.h: ns3::GlobalRouter::GlobalRouter() [constructor]
     cls.add_constructor([])
+    ## global-router-interface.h: void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
+    cls.add_method('SetRoutingProtocol', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4GlobalRouting >', 'routing')])
+    ## global-router-interface.h: ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
+    cls.add_method('GetRoutingProtocol', 
+                   'ns3::Ptr< ns3::Ipv4GlobalRouting >', 
+                   [])
     ## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
     cls.add_method('GetRouterId', 
                    'ns3::Ipv4Address', 
@@ -293,6 +284,86 @@
                    visibility='private', 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::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
+    cls.add_method('RouteOutput', 
+                   'ns3::Ptr< ns3::Ipv4Route >', 
+                   [param('ns3::Ptr< ns3::Packet >', 'p'), 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::Socket::SocketErrno,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::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
+                   is_virtual=True)
+    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyInterfaceUp(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceUp', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyInterfaceDown(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceDown', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyAddAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyRemoveAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-global-routing.h: void ns3::Ipv4GlobalRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
+    cls.add_method('SetIpv4', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], 
+                   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::DoDispose() [member function]
+    cls.add_method('DoDispose', 
+                   'void', 
+                   [], 
+                   visibility='protected', is_virtual=True)
+    return
+
 def register_functions(root_module):
     module = root_module
     register_functions_ns3_Config(module.get_submodule('Config'), root_module)
--- a/bindings/python/ns3_module_helper.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_helper.py	Fri Jul 03 09:59:04 2009 +0400
@@ -17,8 +17,10 @@
     module.add_class('Ipv4AddressHelper', allow_subclassing=False)
     ## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer [class]
     module.add_class('Ipv4InterfaceContainer')
+    ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper [class]
+    module.add_class('Ipv4RoutingHelper', allow_subclassing=False)
     ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper [class]
-    module.add_class('Ipv4StaticRoutingHelper', allow_subclassing=False)
+    module.add_class('Ipv4StaticRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper'])
     ## mobility-helper.h: ns3::MobilityHelper [class]
     module.add_class('MobilityHelper', allow_subclassing=False)
     ## net-device-container.h: ns3::NetDeviceContainer [class]
@@ -28,7 +30,7 @@
     ## ns2-mobility-helper.h: ns3::Ns2MobilityHelper [class]
     module.add_class('Ns2MobilityHelper', allow_subclassing=False)
     ## olsr-helper.h: ns3::OlsrHelper [class]
-    module.add_class('OlsrHelper', allow_subclassing=False)
+    module.add_class('OlsrHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper'])
     ## on-off-helper.h: ns3::OnOffHelper [class]
     module.add_class('OnOffHelper', allow_subclassing=False)
     ## packet-sink-helper.h: ns3::PacketSinkHelper [class]
@@ -57,6 +59,10 @@
     module.add_class('YansWifiPhyHelper', allow_subclassing=False, parent=root_module['ns3::WifiPhyHelper'])
     ## yans-wifi-helper.h: ns3::YansWifiPhyHelper::PcapFormat [enumeration]
     module.add_enum('PcapFormat', ['PCAP_FORMAT_80211', 'PCAP_FORMAT_80211_PRISM', 'PCAP_FORMAT_80211_RADIOTAP'], outer_class=root_module['ns3::YansWifiPhyHelper'])
+    ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper [class]
+    module.add_class('Ipv4GlobalRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper'])
+    ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper [class]
+    module.add_class('Ipv4ListRoutingHelper', allow_subclassing=False, parent=root_module['ns3::Ipv4RoutingHelper'])
     ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper [class]
     module.add_class('NqosWifiMacHelper', allow_subclassing=False, parent=root_module['ns3::WifiMacHelper'])
     ## qos-wifi-mac-helper.h: ns3::QosWifiMacHelper [class]
@@ -120,6 +126,7 @@
     register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper'])
     register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
     register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
+    register_Ns3Ipv4RoutingHelper_methods(root_module, root_module['ns3::Ipv4RoutingHelper'])
     register_Ns3Ipv4StaticRoutingHelper_methods(root_module, root_module['ns3::Ipv4StaticRoutingHelper'])
     register_Ns3MobilityHelper_methods(root_module, root_module['ns3::MobilityHelper'])
     register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
@@ -139,6 +146,8 @@
     register_Ns3WifiPhyHelper_methods(root_module, root_module['ns3::WifiPhyHelper'])
     register_Ns3YansWifiChannelHelper_methods(root_module, root_module['ns3::YansWifiChannelHelper'])
     register_Ns3YansWifiPhyHelper_methods(root_module, root_module['ns3::YansWifiPhyHelper'])
+    register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, root_module['ns3::Ipv4GlobalRoutingHelper'])
+    register_Ns3Ipv4ListRoutingHelper_methods(root_module, root_module['ns3::Ipv4ListRoutingHelper'])
     register_Ns3NqosWifiMacHelper_methods(root_module, root_module['ns3::NqosWifiMacHelper'])
     register_Ns3QosWifiMacHelper_methods(root_module, root_module['ns3::QosWifiMacHelper'])
     return
@@ -420,6 +429,10 @@
     cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')])
     ## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper() [constructor]
     cls.add_constructor([])
+    ## internet-stack-helper.h: void ns3::InternetStackHelper::SetRoutingHelper(ns3::Ipv4RoutingHelper const & routing) [member function]
+    cls.add_method('SetRoutingHelper', 
+                   'void', 
+                   [param('ns3::Ipv4RoutingHelper const &', 'routing')])
     ## internet-stack-helper.h: void ns3::InternetStackHelper::Install(std::string nodeName) const [member function]
     cls.add_method('Install', 
                    'void', 
@@ -435,6 +448,11 @@
                    'void', 
                    [param('ns3::NodeContainer', 'c')], 
                    is_const=True)
+    ## internet-stack-helper.h: void ns3::InternetStackHelper::InstallAll() const [member function]
+    cls.add_method('InstallAll', 
+                   'void', 
+                   [], 
+                   is_const=True)
     ## internet-stack-helper.h: void ns3::InternetStackHelper::SetTcp(std::string tid) [member function]
     cls.add_method('SetTcp', 
                    'void', 
@@ -516,11 +534,28 @@
                    [param('std::string', 'ipv4Name'), param('uint32_t', 'interface')])
     return
 
+def register_Ns3Ipv4RoutingHelper_methods(root_module, cls):
+    ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper::Ipv4RoutingHelper(ns3::Ipv4RoutingHelper const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4RoutingHelper const &', 'arg0')])
+    ## ipv4-routing-helper.h: ns3::Ipv4RoutingHelper::Ipv4RoutingHelper() [constructor]
+    cls.add_constructor([])
+    ## ipv4-routing-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4RoutingHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
+    cls.add_method('Create', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   is_pure_virtual=True, is_const=True, is_virtual=True)
+    return
+
 def register_Ns3Ipv4StaticRoutingHelper_methods(root_module, cls):
     ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper(ns3::Ipv4StaticRoutingHelper const & arg0) [copy constructor]
     cls.add_constructor([param('ns3::Ipv4StaticRoutingHelper const &', 'arg0')])
     ## ipv4-static-routing-helper.h: ns3::Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper() [constructor]
     cls.add_constructor([])
+    ## ipv4-static-routing-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4StaticRoutingHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
+    cls.add_method('Create', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   is_const=True, is_virtual=True)
     ## ipv4-static-routing-helper.h: ns3::Ptr<ns3::Ipv4StaticRouting> ns3::Ipv4StaticRoutingHelper::GetStaticRouting(ns3::Ptr<ns3::Ipv4> ipv4) const [member function]
     cls.add_method('GetStaticRouting', 
                    'ns3::Ptr< ns3::Ipv4StaticRouting >', 
@@ -752,26 +787,15 @@
     cls.add_constructor([param('ns3::OlsrHelper const &', 'arg0')])
     ## olsr-helper.h: ns3::OlsrHelper::OlsrHelper() [constructor]
     cls.add_constructor([])
-    ## olsr-helper.h: void ns3::OlsrHelper::SetAgent(std::string tid, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
-    cls.add_method('SetAgent', 
-                   'void', 
-                   [param('std::string', 'tid'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
-    ## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::NodeContainer container) [member function]
-    cls.add_method('Install', 
+    ## olsr-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::OlsrHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
+    cls.add_method('Create', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   is_const=True, is_virtual=True)
+    ## olsr-helper.h: void ns3::OlsrHelper::Set(std::string name, ns3::AttributeValue const & value) [member function]
+    cls.add_method('Set', 
                    'void', 
-                   [param('ns3::NodeContainer', 'container')])
-    ## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('Install', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')])
-    ## olsr-helper.h: void ns3::OlsrHelper::Install(std::string nodeName) [member function]
-    cls.add_method('Install', 
-                   'void', 
-                   [param('std::string', 'nodeName')])
-    ## olsr-helper.h: void ns3::OlsrHelper::InstallAll() [member function]
-    cls.add_method('InstallAll', 
-                   'void', 
-                   [])
+                   [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
     return
 
 def register_Ns3OnOffHelper_methods(root_module, cls):
@@ -987,6 +1011,18 @@
     cls.add_method('SetAttribute', 
                    'void', 
                    [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
+    ## udp-echo-helper.h: void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, std::string fill) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Application >', 'app'), param('std::string', 'fill')])
+    ## udp-echo-helper.h: void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, uint8_t fill, uint32_t dataLength) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Application >', 'app'), param('uint8_t', 'fill'), param('uint32_t', 'dataLength')])
+    ## udp-echo-helper.h: void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, uint8_t * fill, uint32_t fillLength, uint32_t dataLength) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Application >', 'app'), param('uint8_t *', 'fill'), param('uint32_t', 'fillLength'), param('uint32_t', 'dataLength')])
     ## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
     cls.add_method('Install', 
                    'ns3::ApplicationContainer', 
@@ -1085,6 +1121,11 @@
                    'ns3::NetDeviceContainer', 
                    [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::WifiMacHelper const &', 'mac'), param('std::string', 'nodeName')], 
                    is_const=True)
+    ## wifi-helper.h: static void ns3::WifiHelper::EnableLogComponents() [member function]
+    cls.add_method('EnableLogComponents', 
+                   'void', 
+                   [], 
+                   is_static=True)
     return
 
 def register_Ns3WifiMacHelper_methods(root_module, cls):
@@ -1217,6 +1258,44 @@
                    is_const=True, visibility='private', is_virtual=True)
     return
 
+def register_Ns3Ipv4GlobalRoutingHelper_methods(root_module, cls):
+    ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper(ns3::Ipv4GlobalRoutingHelper const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4GlobalRoutingHelper const &', 'arg0')])
+    ## ipv4-global-routing-helper.h: ns3::Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper() [constructor]
+    cls.add_constructor([])
+    ## ipv4-global-routing-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4GlobalRoutingHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
+    cls.add_method('Create', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   is_const=True, is_virtual=True)
+    ## ipv4-global-routing-helper.h: static void ns3::Ipv4GlobalRoutingHelper::PopulateRoutingTables() [member function]
+    cls.add_method('PopulateRoutingTables', 
+                   'void', 
+                   [], 
+                   is_static=True)
+    ## ipv4-global-routing-helper.h: static void ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables() [member function]
+    cls.add_method('RecomputeRoutingTables', 
+                   'void', 
+                   [], 
+                   is_static=True)
+    return
+
+def register_Ns3Ipv4ListRoutingHelper_methods(root_module, cls):
+    ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper::Ipv4ListRoutingHelper(ns3::Ipv4ListRoutingHelper const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4ListRoutingHelper const &', 'arg0')])
+    ## ipv4-list-routing-helper.h: ns3::Ipv4ListRoutingHelper::Ipv4ListRoutingHelper() [constructor]
+    cls.add_constructor([])
+    ## ipv4-list-routing-helper.h: void ns3::Ipv4ListRoutingHelper::Add(ns3::Ipv4RoutingHelper const & routing, int16_t priority) [member function]
+    cls.add_method('Add', 
+                   'void', 
+                   [param('ns3::Ipv4RoutingHelper const &', 'routing'), param('int16_t', 'priority')])
+    ## ipv4-list-routing-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRoutingHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
+    cls.add_method('Create', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   is_const=True, is_virtual=True)
+    return
+
 def register_Ns3NqosWifiMacHelper_methods(root_module, cls):
     ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper::NqosWifiMacHelper(ns3::NqosWifiMacHelper const & arg0) [copy constructor]
     cls.add_constructor([param('ns3::NqosWifiMacHelper const &', 'arg0')])
--- a/bindings/python/ns3_module_internet_stack.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_internet_stack.py	Fri Jul 03 09:59:04 2009 +0400
@@ -23,10 +23,6 @@
     module.add_enum('Flags_t', ['NONE', 'FIN', 'SYN', 'RST', 'PSH', 'ACK', 'URG'], outer_class=root_module['ns3::TcpHeader'])
     ## udp-header.h: ns3::UdpHeader [class]
     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-list-routing-impl.h: ns3::Ipv4ListRoutingImpl [class]
-    module.add_class('Ipv4ListRoutingImpl', parent=root_module['ns3::Ipv4ListRouting'])
     
     ## Register a nested module for the namespace Config
     
@@ -85,8 +81,6 @@
     register_Ns3Icmpv4TimeExceeded_methods(root_module, root_module['ns3::Icmpv4TimeExceeded'])
     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_Ns3Ipv4ListRoutingImpl_methods(root_module, root_module['ns3::Ipv4ListRoutingImpl'])
     return
 
 def register_Ns3Icmpv4DestinationUnreachable_methods(root_module, cls):
@@ -178,6 +172,11 @@
                    'uint16_t', 
                    [], 
                    is_const=True)
+    ## icmpv4.h: uint32_t ns3::Icmpv4Echo::GetDataSize() const [member function]
+    cls.add_method('GetDataSize', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
     ## icmpv4.h: uint32_t ns3::Icmpv4Echo::GetData(uint8_t * payload) const [member function]
     cls.add_method('GetData', 
                    'uint32_t', 
@@ -521,174 +520,6 @@
                    is_const=True)
     return
 
-def register_Ns3Ipv4StaticRoutingImpl_methods(root_module, cls):
-    ## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl(ns3::Ipv4StaticRoutingImpl const & arg0) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4StaticRoutingImpl const &', 'arg0')])
-    ## ipv4-static-routing-impl.h: static ns3::TypeId ns3::Ipv4StaticRoutingImpl::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
-    ## ipv4-static-routing-impl.h: ns3::Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl() [constructor]
-    cls.add_constructor([])
-    ## ipv4-static-routing-impl.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4StaticRoutingImpl::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-static-routing-impl.h: bool ns3::Ipv4StaticRoutingImpl::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-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
-    cls.add_method('AddHostRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('SetDefaultRoute', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: uint32_t ns3::Ipv4StaticRoutingImpl::GetNRoutes() [member function]
-    cls.add_method('GetNRoutes', 
-                   'uint32_t', 
-                   [], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetDefaultRoute() [member function]
-    cls.add_method('GetDefaultRoute', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetRoute(uint32_t i) [member function]
-    cls.add_method('GetRoute', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('uint32_t', 'i')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::RemoveRoute(uint32_t i) [member function]
-    cls.add_method('RemoveRoute', 
-                   'void', 
-                   [param('uint32_t', 'i')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
-    cls.add_method('AddMulticastRoute', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
-    cls.add_method('SetDefaultMulticastRoute', 
-                   'void', 
-                   [param('uint32_t', 'outputInterface')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: uint32_t ns3::Ipv4StaticRoutingImpl::GetNMulticastRoutes() const [member function]
-    cls.add_method('GetNMulticastRoutes', 
-                   'uint32_t', 
-                   [], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-static-routing-impl.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRoutingImpl::GetMulticastRoute(uint32_t i) const [member function]
-    cls.add_method('GetMulticastRoute', 
-                   'ns3::Ipv4MulticastRoutingTableEntry', 
-                   [param('uint32_t', 'i')], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-static-routing-impl.h: bool ns3::Ipv4StaticRoutingImpl::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
-    cls.add_method('RemoveMulticastRoute', 
-                   'bool', 
-                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::RemoveMulticastRoute(uint32_t index) [member function]
-    cls.add_method('RemoveMulticastRoute', 
-                   'void', 
-                   [param('uint32_t', 'index')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('SetNode', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')], 
-                   is_virtual=True)
-    ## ipv4-static-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRoutingImpl::GetNode() const [member function]
-    cls.add_method('GetNode', 
-                   'ns3::Ptr< ns3::Node >', 
-                   [], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-static-routing-impl.h: void ns3::Ipv4StaticRoutingImpl::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')])
-    ## ipv4-list-routing-impl.h: static ns3::TypeId ns3::Ipv4ListRoutingImpl::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
-    ## ipv4-list-routing-impl.h: ns3::Ipv4ListRoutingImpl::Ipv4ListRoutingImpl() [constructor]
-    cls.add_constructor([])
-    ## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4ListRoutingImpl::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-list-routing-impl.h: bool ns3::Ipv4ListRoutingImpl::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-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
-    cls.add_method('AddRoutingProtocol', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')], 
-                   is_virtual=True)
-    ## ipv4-list-routing-impl.h: uint32_t ns3::Ipv4ListRoutingImpl::GetNRoutingProtocols() const [member function]
-    cls.add_method('GetNRoutingProtocols', 
-                   'uint32_t', 
-                   [], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRoutingImpl::GetRoutingProtocol(uint32_t index, int16_t & priority) const [member function]
-    cls.add_method('GetRoutingProtocol', 
-                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
-                   [param('uint32_t', 'index'), param('int16_t &', 'priority')], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Ipv4StaticRouting> ns3::Ipv4ListRoutingImpl::GetStaticRouting() const [member function]
-    cls.add_method('GetStaticRouting', 
-                   'ns3::Ptr< ns3::Ipv4StaticRouting >', 
-                   [], 
-                   is_const=True, is_virtual=True)
-    ## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::SetNode(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('SetNode', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')])
-    ## ipv4-list-routing-impl.h: ns3::Ptr<ns3::Node> ns3::Ipv4ListRoutingImpl::GetNode() const [member function]
-    cls.add_method('GetNode', 
-                   'ns3::Ptr< ns3::Node >', 
-                   [], 
-                   is_const=True)
-    ## ipv4-list-routing-impl.h: void ns3::Ipv4ListRoutingImpl::DoDispose() [member function]
-    cls.add_method('DoDispose', 
-                   'void', 
-                   [], 
-                   visibility='protected', is_virtual=True)
-    return
-
 def register_functions(root_module):
     module = root_module
     register_functions_ns3_Config(module.get_submodule('Config'), root_module)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/ns3_module_list_routing.py	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,153 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+    root_module = module.get_root()
+    
+    ## ipv4-list-routing.h: ns3::Ipv4ListRouting [class]
+    module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
+    
+    ## Register a nested module for the namespace Config
+    
+    nested_module = module.add_cpp_namespace('Config')
+    register_types_ns3_Config(nested_module)
+    
+    
+    ## Register a nested module for the namespace TimeStepPrecision
+    
+    nested_module = module.add_cpp_namespace('TimeStepPrecision')
+    register_types_ns3_TimeStepPrecision(nested_module)
+    
+    
+    ## Register a nested module for the namespace addressUtils
+    
+    nested_module = module.add_cpp_namespace('addressUtils')
+    register_types_ns3_addressUtils(nested_module)
+    
+    
+    ## Register a nested module for the namespace internal
+    
+    nested_module = module.add_cpp_namespace('internal')
+    register_types_ns3_internal(nested_module)
+    
+    
+    ## Register a nested module for the namespace olsr
+    
+    nested_module = module.add_cpp_namespace('olsr')
+    register_types_ns3_olsr(nested_module)
+    
+
+def register_types_ns3_Config(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_TimeStepPrecision(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_addressUtils(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_internal(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_olsr(module):
+    root_module = module.get_root()
+    
+
+def register_methods(root_module):
+    register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
+    return
+
+def register_Ns3Ipv4ListRouting_methods(root_module, cls):
+    ## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting(ns3::Ipv4ListRouting const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4ListRouting const &', 'arg0')])
+    ## ipv4-list-routing.h: static ns3::TypeId ns3::Ipv4ListRouting::GetTypeId() [member function]
+    cls.add_method('GetTypeId', 
+                   'ns3::TypeId', 
+                   [], 
+                   is_static=True)
+    ## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting() [constructor]
+    cls.add_constructor([])
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
+    cls.add_method('AddRoutingProtocol', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: uint32_t ns3::Ipv4ListRouting::GetNRoutingProtocols() const [member function]
+    cls.add_method('GetNRoutingProtocols', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True, is_virtual=True)
+    ## ipv4-list-routing.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRouting::GetRoutingProtocol(uint32_t index, int16_t & priority) const [member function]
+    cls.add_method('GetRoutingProtocol', 
+                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
+                   [param('uint32_t', 'index'), param('int16_t &', 'priority')], 
+                   is_const=True, is_virtual=True)
+    ## ipv4-list-routing.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4ListRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
+    cls.add_method('RouteOutput', 
+                   'ns3::Ptr< ns3::Ipv4Route >', 
+                   [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: bool ns3::Ipv4ListRouting::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::Socket::SocketErrno,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::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::NotifyInterfaceUp(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceUp', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::NotifyInterfaceDown(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceDown', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyAddAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyRemoveAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
+    cls.add_method('SetIpv4', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], 
+                   is_virtual=True)
+    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::DoDispose() [member function]
+    cls.add_method('DoDispose', 
+                   'void', 
+                   [], 
+                   visibility='protected', is_virtual=True)
+    return
+
+def register_functions(root_module):
+    module = root_module
+    register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+    register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
+    register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+    register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+    register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+    return
+
+def register_functions_ns3_Config(module, root_module):
+    return
+
+def register_functions_ns3_TimeStepPrecision(module, root_module):
+    return
+
+def register_functions_ns3_addressUtils(module, root_module):
+    return
+
+def register_functions_ns3_internal(module, root_module):
+    return
+
+def register_functions_ns3_olsr(module, root_module):
+    return
+
--- a/bindings/python/ns3_module_node.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_node.py	Fri Jul 03 09:59:04 2009 +0400
@@ -29,10 +29,6 @@
     module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'])
     ## ipv4-address.h: ns3::Ipv4Mask [class]
     module.add_class('Ipv4Mask')
-    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry [class]
-    module.add_class('Ipv4MulticastRoutingTableEntry')
-    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry [class]
-    module.add_class('Ipv4RoutingTableEntry')
     ## ipv6-address.h: ns3::Ipv6Address [class]
     module.add_class('Ipv6Address')
     ## ipv6-address.h: ns3::Ipv6Address [class]
@@ -129,8 +125,6 @@
     module.add_class('Ipv4RawSocketFactory', parent=root_module['ns3::SocketFactory'])
     ## ipv4-routing-protocol.h: ns3::Ipv4RoutingProtocol [class]
     module.add_class('Ipv4RoutingProtocol', parent=root_module['ns3::Object'])
-    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
-    module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
     ## net-device.h: ns3::NetDevice [class]
     module.add_class('NetDevice', parent=root_module['ns3::Object'])
     ## net-device.h: ns3::NetDevice::PacketType [enumeration]
@@ -143,8 +137,6 @@
     module.add_class('SimpleChannel', parent=root_module['ns3::Channel'])
     ## simple-net-device.h: ns3::SimpleNetDevice [class]
     module.add_class('SimpleNetDevice', parent=root_module['ns3::NetDevice'])
-    ## ipv4-list-routing.h: ns3::Ipv4ListRouting [class]
-    module.add_class('Ipv4ListRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
     module.add_container('ns3::olsr::MprSet', 'ns3::Ipv4Address', container_type='set')
     module.add_container('std::vector< ns3::Ipv4Address >', 'ns3::Ipv4Address', container_type='vector')
     
@@ -206,8 +198,6 @@
     register_Ns3Ipv4AddressGenerator_methods(root_module, root_module['ns3::Ipv4AddressGenerator'])
     register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
     register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
-    register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, root_module['ns3::Ipv4MulticastRoutingTableEntry'])
-    register_Ns3Ipv4RoutingTableEntry_methods(root_module, root_module['ns3::Ipv4RoutingTableEntry'])
     register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
     register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
     register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
@@ -249,13 +239,11 @@
     register_Ns3Ipv4_methods(root_module, root_module['ns3::Ipv4'])
     register_Ns3Ipv4RawSocketFactory_methods(root_module, root_module['ns3::Ipv4RawSocketFactory'])
     register_Ns3Ipv4RoutingProtocol_methods(root_module, root_module['ns3::Ipv4RoutingProtocol'])
-    register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
     register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
     register_Ns3Node_methods(root_module, root_module['ns3::Node'])
     register_Ns3PacketSocketFactory_methods(root_module, root_module['ns3::PacketSocketFactory'])
     register_Ns3SimpleChannel_methods(root_module, root_module['ns3::SimpleChannel'])
     register_Ns3SimpleNetDevice_methods(root_module, root_module['ns3::SimpleNetDevice'])
-    register_Ns3Ipv4ListRouting_methods(root_module, root_module['ns3::Ipv4ListRouting'])
     return
 
 def register_Ns3Address_methods(root_module, cls):
@@ -570,7 +558,9 @@
     return
 
 def register_Ns3Ipv4InterfaceAddress_methods(root_module, cls):
+    cls.add_binary_comparison_operator('!=')
     cls.add_output_stream_operator()
+    cls.add_binary_comparison_operator('==')
     ## ipv4-interface-address.h: ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress() [constructor]
     cls.add_constructor([])
     ## ipv4-interface-address.h: ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4Address local, ns3::Ipv4Mask mask) [constructor]
@@ -686,131 +676,6 @@
                    [param('uint32_t', 'mask')])
     return
 
-def register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, cls):
-    cls.add_output_stream_operator()
-    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry() [constructor]
-    cls.add_constructor([])
-    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const & route) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const &', 'route')])
-    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const * route) [constructor]
-    cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const *', 'route')])
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4MulticastRoutingTableEntry::CreateMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
-    cls.add_method('CreateMulticastRoute', 
-                   'ns3::Ipv4MulticastRoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetGroup() const [member function]
-    cls.add_method('GetGroup', 
-                   'ns3::Ipv4Address', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetInputInterface() const [member function]
-    cls.add_method('GetInputInterface', 
-                   'uint32_t', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces() const [member function]
-    cls.add_method('GetNOutputInterfaces', 
-                   'uint32_t', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetOrigin() const [member function]
-    cls.add_method('GetOrigin', 
-                   'ns3::Ipv4Address', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterface(uint32_t n) const [member function]
-    cls.add_method('GetOutputInterface', 
-                   'uint32_t', 
-                   [param('uint32_t', 'n')], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: std::vector<unsigned int, std::allocator<unsigned int> > ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterfaces() const [member function]
-    cls.add_method('GetOutputInterfaces', 
-                   'std::vector< unsigned int >', 
-                   [], 
-                   is_const=True)
-    return
-
-def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
-    cls.add_output_stream_operator()
-    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry() [constructor]
-    cls.add_constructor([])
-    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const & route) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
-    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
-    cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('CreateDefaultRoute', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('CreateHostRouteTo', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
-    cls.add_method('CreateHostRouteTo', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('CreateNetworkRouteTo', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
-    cls.add_method('CreateNetworkRouteTo', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')], 
-                   is_static=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
-    cls.add_method('GetDest', 
-                   'ns3::Ipv4Address', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDestNetwork() const [member function]
-    cls.add_method('GetDestNetwork', 
-                   'ns3::Ipv4Address', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Mask ns3::Ipv4RoutingTableEntry::GetDestNetworkMask() const [member function]
-    cls.add_method('GetDestNetworkMask', 
-                   'ns3::Ipv4Mask', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetGateway() const [member function]
-    cls.add_method('GetGateway', 
-                   'ns3::Ipv4Address', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4RoutingTableEntry::GetInterface() const [member function]
-    cls.add_method('GetInterface', 
-                   'uint32_t', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
-    cls.add_method('IsDefault', 
-                   'bool', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsGateway() const [member function]
-    cls.add_method('IsGateway', 
-                   'bool', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsHost() const [member function]
-    cls.add_method('IsHost', 
-                   'bool', 
-                   [], 
-                   is_const=True)
-    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsNetwork() const [member function]
-    cls.add_method('IsNetwork', 
-                   'bool', 
-                   [], 
-                   is_const=True)
-    return
-
 def register_Ns3Ipv6Address_methods(root_module, cls):
     cls.add_binary_comparison_operator('!=')
     cls.add_binary_comparison_operator('<')
@@ -2766,9 +2631,9 @@
                    'int32_t', 
                    [param('ns3::Ptr< ns3::NetDevice const >', 'device')], 
                    is_pure_virtual=True, is_const=True, is_virtual=True)
-    ## ipv4.h: uint32_t ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    ## ipv4.h: bool ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
     cls.add_method('AddAddress', 
-                   'uint32_t', 
+                   'bool', 
                    [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
                    is_pure_virtual=True, is_virtual=True)
     ## ipv4.h: uint32_t ns3::Ipv4::GetNAddresses(uint32_t interface) const [member function]
@@ -2781,6 +2646,11 @@
                    'ns3::Ipv4InterfaceAddress', 
                    [param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')], 
                    is_pure_virtual=True, is_const=True, is_virtual=True)
+    ## ipv4.h: bool ns3::Ipv4::RemoveAddress(uint32_t interface, uint32_t addressIndex) [member function]
+    cls.add_method('RemoveAddress', 
+                   'bool', 
+                   [param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')], 
+                   is_pure_virtual=True, is_virtual=True)
     ## ipv4.h: void ns3::Ipv4::SetMetric(uint32_t interface, uint16_t metric) [member function]
     cls.add_method('SetMetric', 
                    'void', 
@@ -2811,6 +2681,16 @@
                    'void', 
                    [param('uint32_t', 'interface')], 
                    is_pure_virtual=True, is_virtual=True)
+    ## ipv4.h: bool ns3::Ipv4::IsForwarding(uint32_t interface) const [member function]
+    cls.add_method('IsForwarding', 
+                   'bool', 
+                   [param('uint32_t', 'interface')], 
+                   is_pure_virtual=True, is_const=True, is_virtual=True)
+    ## ipv4.h: void ns3::Ipv4::SetForwarding(uint32_t interface, bool val) [member function]
+    cls.add_method('SetForwarding', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('bool', 'val')], 
+                   is_pure_virtual=True, is_virtual=True)
     ## ipv4.h: void ns3::Ipv4::SetIpForward(bool forward) [member function]
     cls.add_method('SetIpForward', 
                    'void', 
@@ -2845,113 +2725,41 @@
                    'ns3::TypeId', 
                    [], 
                    is_static=True)
-    ## ipv4-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4RoutingProtocol::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
+    ## ipv4-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4RoutingProtocol::RouteOutput(ns3::Ptr<ns3::Packet> p, 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')], 
+                   [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-routing-protocol.h: bool ns3::Ipv4RoutingProtocol::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]
+    ## ipv4-routing-protocol.h: bool ns3::Ipv4RoutingProtocol::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::Socket::SocketErrno,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_pure_virtual=True, is_virtual=True)
-    return
-
-def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
-    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting(ns3::Ipv4StaticRouting const & arg0) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
-    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
-    cls.add_constructor([])
-    ## ipv4-static-routing.h: static ns3::TypeId ns3::Ipv4StaticRouting::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::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')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
-    cls.add_method('AddHostRouteTo', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')], 
+                   [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::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('AddNetworkRouteTo', 
+    ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceUp', 
                    'void', 
-                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::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')], 
+                   [param('uint32_t', 'interface')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
-    cls.add_method('SetDefaultRoute', 
+    ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceDown', 
                    'void', 
-                   [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
-    cls.add_method('GetNRoutes', 
-                   'uint32_t', 
-                   [], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
-    cls.add_method('GetDefaultRoute', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [], 
+                   [param('uint32_t', 'interface')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
-    cls.add_method('GetRoute', 
-                   'ns3::Ipv4RoutingTableEntry', 
-                   [param('uint32_t', 'i')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveRoute(uint32_t i) [member function]
-    cls.add_method('RemoveRoute', 
+    ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyAddAddress', 
                    'void', 
-                   [param('uint32_t', 'i')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
-    cls.add_method('AddMulticastRoute', 
-                   'void', 
-                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
-    cls.add_method('SetDefaultMulticastRoute', 
-                   'void', 
-                   [param('uint32_t', 'outputInterface')], 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes() const [member function]
-    cls.add_method('GetNMulticastRoutes', 
-                   'uint32_t', 
-                   [], 
-                   is_pure_virtual=True, is_const=True, is_virtual=True)
-    ## ipv4-static-routing.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
-    cls.add_method('GetMulticastRoute', 
-                   'ns3::Ipv4MulticastRoutingTableEntry', 
-                   [param('uint32_t', 'i')], 
-                   is_pure_virtual=True, is_const=True, is_virtual=True)
-    ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
-    cls.add_method('RemoveMulticastRoute', 
-                   'bool', 
-                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')], 
+    ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyRemoveAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) [member function]
-    cls.add_method('RemoveMulticastRoute', 
-                   'void', 
-                   [param('uint32_t', 'index')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetNode(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('SetNode', 
+    ## ipv4-routing-protocol.h: void ns3::Ipv4RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
+    cls.add_method('SetIpv4', 
                    'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')], 
+                   [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], 
                    is_pure_virtual=True, is_virtual=True)
-    ## ipv4-static-routing.h: ns3::Ptr<ns3::Node> ns3::Ipv4StaticRouting::GetNode() const [member function]
-    cls.add_method('GetNode', 
-                   'ns3::Ptr< ns3::Node >', 
-                   [], 
-                   is_pure_virtual=True, is_const=True, is_virtual=True)
     return
 
 def register_Ns3NetDevice_methods(root_module, cls):
@@ -2979,6 +2787,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_pure_virtual=True, is_const=True, is_virtual=True)
+    ## net-device.h: void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_pure_virtual=True, is_virtual=True)
     ## net-device.h: ns3::Address ns3::NetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
@@ -3139,6 +2952,11 @@
     cls.add_method('UnregisterProtocolHandler', 
                    'void', 
                    [param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
+    ## node.h: static bool ns3::Node::ChecksumEnabled() [member function]
+    cls.add_method('ChecksumEnabled', 
+                   'bool', 
+                   [], 
+                   is_static=True)
     ## node.h: void ns3::Node::DoDispose() [member function]
     cls.add_method('DoDispose', 
                    'void', 
@@ -3216,10 +3034,6 @@
     cls.add_method('SetChannel', 
                    'void', 
                    [param('ns3::Ptr< ns3::SimpleChannel >', 'channel')])
-    ## simple-net-device.h: void ns3::SimpleNetDevice::SetAddress(ns3::Mac48Address address) [member function]
-    cls.add_method('SetAddress', 
-                   'void', 
-                   [param('ns3::Mac48Address', 'address')])
     ## simple-net-device.h: void ns3::SimpleNetDevice::SetIfIndex(uint32_t const index) [member function]
     cls.add_method('SetIfIndex', 
                    'void', 
@@ -3235,6 +3049,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## simple-net-device.h: void ns3::SimpleNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## simple-net-device.h: ns3::Address ns3::SimpleNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
@@ -3342,33 +3161,6 @@
                    visibility='protected', is_virtual=True)
     return
 
-def register_Ns3Ipv4ListRouting_methods(root_module, cls):
-    ## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting(ns3::Ipv4ListRouting const & arg0) [copy constructor]
-    cls.add_constructor([param('ns3::Ipv4ListRouting const &', 'arg0')])
-    ## ipv4-list-routing.h: ns3::Ipv4ListRouting::Ipv4ListRouting() [constructor]
-    cls.add_constructor([])
-    ## ipv4-list-routing.h: static ns3::TypeId ns3::Ipv4ListRouting::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
-    ## ipv4-list-routing.h: void ns3::Ipv4ListRouting::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int16_t priority) [member function]
-    cls.add_method('AddRoutingProtocol', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int16_t', 'priority')], 
-                   is_pure_virtual=True, is_virtual=True)
-    ## ipv4-list-routing.h: uint32_t ns3::Ipv4ListRouting::GetNRoutingProtocols() const [member function]
-    cls.add_method('GetNRoutingProtocols', 
-                   'uint32_t', 
-                   [], 
-                   is_pure_virtual=True, is_const=True, is_virtual=True)
-    ## ipv4-list-routing.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4ListRouting::GetRoutingProtocol(uint32_t index, int16_t & priority) const [member function]
-    cls.add_method('GetRoutingProtocol', 
-                   'ns3::Ptr< ns3::Ipv4RoutingProtocol >', 
-                   [param('uint32_t', 'index'), param('int16_t &', 'priority')], 
-                   is_pure_virtual=True, is_const=True, is_virtual=True)
-    return
-
 def register_functions(root_module):
     module = root_module
     ## address.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeAddressChecker() [free function]
--- a/bindings/python/ns3_module_olsr.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_olsr.py	Fri Jul 03 09:59:04 2009 +0400
@@ -747,27 +747,44 @@
                    is_static=True)
     ## olsr-routing-protocol.h: ns3::olsr::RoutingProtocol::RoutingProtocol() [constructor]
     cls.add_constructor([])
-    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
-    cls.add_method('SetNode', 
-                   'void', 
-                   [param('ns3::Ptr< ns3::Node >', 'node')])
-    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::Start() [member function]
-    cls.add_method('Start', 
-                   'void', 
-                   [])
     ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetMainInterface(uint32_t interface) [member function]
     cls.add_method('SetMainInterface', 
                    'void', 
                    [param('uint32_t', 'interface')])
-    ## olsr-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::olsr::RoutingProtocol::RouteOutput(ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
+    ## olsr-routing-protocol.h: ns3::Ptr<ns3::Ipv4Route> ns3::olsr::RoutingProtocol::RouteOutput(ns3::Ptr<ns3::Packet> p, 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')], 
+                   [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], 
                    visibility='private', is_virtual=True)
-    ## olsr-routing-protocol.h: bool ns3::olsr::RoutingProtocol::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]
+    ## olsr-routing-protocol.h: bool ns3::olsr::RoutingProtocol::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::Socket::SocketErrno,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')], 
+                   [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::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
+                   visibility='private', is_virtual=True)
+    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceUp', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   visibility='private', is_virtual=True)
+    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceDown', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   visibility='private', is_virtual=True)
+    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyAddAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   visibility='private', is_virtual=True)
+    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyRemoveAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   visibility='private', is_virtual=True)
+    ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
+    cls.add_method('SetIpv4', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], 
                    visibility='private', is_virtual=True)
     ## olsr-routing-protocol.h: void ns3::olsr::RoutingProtocol::DoDispose() [member function]
     cls.add_method('DoDispose', 
--- a/bindings/python/ns3_module_point_to_point.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_point_to_point.py	Fri Jul 03 09:59:04 2009 +0400
@@ -172,10 +172,6 @@
     cls.add_method('Receive', 
                    'void', 
                    [param('ns3::Ptr< ns3::Packet >', 'p')])
-    ## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetAddress(ns3::Mac48Address addr) [member function]
-    cls.add_method('SetAddress', 
-                   'void', 
-                   [param('ns3::Mac48Address', 'addr')])
     ## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetFrameSize(uint16_t frameSize) [member function]
     cls.add_method('SetFrameSize', 
                    'void', 
@@ -200,6 +196,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## point-to-point-net-device.h: ns3::Address ns3::PointToPointNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/ns3_module_static_routing.py	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,331 @@
+from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
+
+def register_types(module):
+    root_module = module.get_root()
+    
+    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry [class]
+    module.add_class('Ipv4MulticastRoutingTableEntry')
+    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry [class]
+    module.add_class('Ipv4RoutingTableEntry')
+    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
+    module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
+    
+    ## Register a nested module for the namespace Config
+    
+    nested_module = module.add_cpp_namespace('Config')
+    register_types_ns3_Config(nested_module)
+    
+    
+    ## Register a nested module for the namespace TimeStepPrecision
+    
+    nested_module = module.add_cpp_namespace('TimeStepPrecision')
+    register_types_ns3_TimeStepPrecision(nested_module)
+    
+    
+    ## Register a nested module for the namespace addressUtils
+    
+    nested_module = module.add_cpp_namespace('addressUtils')
+    register_types_ns3_addressUtils(nested_module)
+    
+    
+    ## Register a nested module for the namespace internal
+    
+    nested_module = module.add_cpp_namespace('internal')
+    register_types_ns3_internal(nested_module)
+    
+    
+    ## Register a nested module for the namespace olsr
+    
+    nested_module = module.add_cpp_namespace('olsr')
+    register_types_ns3_olsr(nested_module)
+    
+
+def register_types_ns3_Config(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_TimeStepPrecision(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_addressUtils(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_internal(module):
+    root_module = module.get_root()
+    
+
+def register_types_ns3_olsr(module):
+    root_module = module.get_root()
+    
+
+def register_methods(root_module):
+    register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, root_module['ns3::Ipv4MulticastRoutingTableEntry'])
+    register_Ns3Ipv4RoutingTableEntry_methods(root_module, root_module['ns3::Ipv4RoutingTableEntry'])
+    register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
+    return
+
+def register_Ns3Ipv4MulticastRoutingTableEntry_methods(root_module, cls):
+    cls.add_output_stream_operator()
+    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry() [constructor]
+    cls.add_constructor([])
+    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const & route) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const &', 'route')])
+    ## ipv4-routing-table-entry.h: ns3::Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry(ns3::Ipv4MulticastRoutingTableEntry const * route) [constructor]
+    cls.add_constructor([param('ns3::Ipv4MulticastRoutingTableEntry const *', 'route')])
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4MulticastRoutingTableEntry::CreateMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
+    cls.add_method('CreateMulticastRoute', 
+                   'ns3::Ipv4MulticastRoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetGroup() const [member function]
+    cls.add_method('GetGroup', 
+                   'ns3::Ipv4Address', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetInputInterface() const [member function]
+    cls.add_method('GetInputInterface', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces() const [member function]
+    cls.add_method('GetNOutputInterfaces', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4MulticastRoutingTableEntry::GetOrigin() const [member function]
+    cls.add_method('GetOrigin', 
+                   'ns3::Ipv4Address', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterface(uint32_t n) const [member function]
+    cls.add_method('GetOutputInterface', 
+                   'uint32_t', 
+                   [param('uint32_t', 'n')], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: std::vector<unsigned int, std::allocator<unsigned int> > ns3::Ipv4MulticastRoutingTableEntry::GetOutputInterfaces() const [member function]
+    cls.add_method('GetOutputInterfaces', 
+                   'std::vector< unsigned int >', 
+                   [], 
+                   is_const=True)
+    return
+
+def register_Ns3Ipv4RoutingTableEntry_methods(root_module, cls):
+    cls.add_output_stream_operator()
+    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry() [constructor]
+    cls.add_constructor([])
+    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const & route) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const &', 'route')])
+    ## ipv4-routing-table-entry.h: ns3::Ipv4RoutingTableEntry::Ipv4RoutingTableEntry(ns3::Ipv4RoutingTableEntry const * route) [constructor]
+    cls.add_constructor([param('ns3::Ipv4RoutingTableEntry const *', 'route')])
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
+    cls.add_method('CreateDefaultRoute', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
+    cls.add_method('CreateHostRouteTo', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
+    cls.add_method('CreateHostRouteTo', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
+    cls.add_method('CreateNetworkRouteTo', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: static ns3::Ipv4RoutingTableEntry ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
+    cls.add_method('CreateNetworkRouteTo', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')], 
+                   is_static=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDest() const [member function]
+    cls.add_method('GetDest', 
+                   'ns3::Ipv4Address', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetDestNetwork() const [member function]
+    cls.add_method('GetDestNetwork', 
+                   'ns3::Ipv4Address', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Mask ns3::Ipv4RoutingTableEntry::GetDestNetworkMask() const [member function]
+    cls.add_method('GetDestNetworkMask', 
+                   'ns3::Ipv4Mask', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: ns3::Ipv4Address ns3::Ipv4RoutingTableEntry::GetGateway() const [member function]
+    cls.add_method('GetGateway', 
+                   'ns3::Ipv4Address', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: uint32_t ns3::Ipv4RoutingTableEntry::GetInterface() const [member function]
+    cls.add_method('GetInterface', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsDefault() const [member function]
+    cls.add_method('IsDefault', 
+                   'bool', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsGateway() const [member function]
+    cls.add_method('IsGateway', 
+                   'bool', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsHost() const [member function]
+    cls.add_method('IsHost', 
+                   'bool', 
+                   [], 
+                   is_const=True)
+    ## ipv4-routing-table-entry.h: bool ns3::Ipv4RoutingTableEntry::IsNetwork() const [member function]
+    cls.add_method('IsNetwork', 
+                   'bool', 
+                   [], 
+                   is_const=True)
+    return
+
+def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
+    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting(ns3::Ipv4StaticRouting const & arg0) [copy constructor]
+    cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
+    ## ipv4-static-routing.h: static ns3::TypeId ns3::Ipv4StaticRouting::GetTypeId() [member function]
+    cls.add_method('GetTypeId', 
+                   'ns3::TypeId', 
+                   [], 
+                   is_static=True)
+    ## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
+    cls.add_constructor([])
+    ## ipv4-static-routing.h: ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4StaticRouting::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, uint32_t oif, ns3::Socket::SocketErrno & sockerr) [member function]
+    cls.add_method('RouteOutput', 
+                   'ns3::Ptr< ns3::Ipv4Route >', 
+                   [param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('uint32_t', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::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::Socket::SocketErrno,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::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::NotifyInterfaceUp(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceUp', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::NotifyInterfaceDown(uint32_t interface) [member function]
+    cls.add_method('NotifyInterfaceDown', 
+                   'void', 
+                   [param('uint32_t', 'interface')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyAddAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
+    cls.add_method('NotifyRemoveAddress', 
+                   'void', 
+                   [param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
+    cls.add_method('SetIpv4', 
+                   'void', 
+                   [param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')], 
+                   is_virtual=True)
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::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-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
+    cls.add_method('AddHostRouteTo', 
+                   'void', 
+                   [param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::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-static-routing.h: void ns3::Ipv4StaticRouting::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-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
+    cls.add_method('SetDefaultRoute', 
+                   'void', 
+                   [param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
+    ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
+    cls.add_method('GetNRoutes', 
+                   'uint32_t', 
+                   [])
+    ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
+    cls.add_method('GetDefaultRoute', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [])
+    ## ipv4-static-routing.h: ns3::Ipv4RoutingTableEntry ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
+    cls.add_method('GetRoute', 
+                   'ns3::Ipv4RoutingTableEntry', 
+                   [param('uint32_t', 'i')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveRoute(uint32_t i) [member function]
+    cls.add_method('RemoveRoute', 
+                   'void', 
+                   [param('uint32_t', 'i')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
+    cls.add_method('AddMulticastRoute', 
+                   'void', 
+                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
+    cls.add_method('SetDefaultMulticastRoute', 
+                   'void', 
+                   [param('uint32_t', 'outputInterface')])
+    ## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes() const [member function]
+    cls.add_method('GetNMulticastRoutes', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
+    ## ipv4-static-routing.h: ns3::Ipv4MulticastRoutingTableEntry ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
+    cls.add_method('GetMulticastRoute', 
+                   'ns3::Ipv4MulticastRoutingTableEntry', 
+                   [param('uint32_t', 'i')], 
+                   is_const=True)
+    ## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
+    cls.add_method('RemoveMulticastRoute', 
+                   'bool', 
+                   [param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) [member function]
+    cls.add_method('RemoveMulticastRoute', 
+                   'void', 
+                   [param('uint32_t', 'index')])
+    ## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::DoDispose() [member function]
+    cls.add_method('DoDispose', 
+                   'void', 
+                   [], 
+                   visibility='protected', is_virtual=True)
+    return
+
+def register_functions(root_module):
+    module = root_module
+    register_functions_ns3_Config(module.get_submodule('Config'), root_module)
+    register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
+    register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
+    register_functions_ns3_internal(module.get_submodule('internal'), root_module)
+    register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
+    return
+
+def register_functions_ns3_Config(module, root_module):
+    return
+
+def register_functions_ns3_TimeStepPrecision(module, root_module):
+    return
+
+def register_functions_ns3_addressUtils(module, root_module):
+    return
+
+def register_functions_ns3_internal(module, root_module):
+    return
+
+def register_functions_ns3_olsr(module, root_module):
+    return
+
--- a/bindings/python/ns3_module_stats.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_stats.py	Fri Jul 03 09:59:04 2009 +0400
@@ -256,6 +256,15 @@
                    'void', 
                    [param('ns3::DataCollector &', 'dc')], 
                    is_pure_virtual=True, is_virtual=True)
+    ## data-output-interface.h: void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
+    cls.add_method('SetFilePrefix', 
+                   'void', 
+                   [param('std::string const', 'prefix')])
+    ## data-output-interface.h: std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
+    cls.add_method('GetFilePrefix', 
+                   'std::string', 
+                   [], 
+                   is_const=True)
     ## data-output-interface.h: void ns3::DataOutputInterface::DoDispose() [member function]
     cls.add_method('DoDispose', 
                    'void', 
@@ -294,15 +303,6 @@
                    'void', 
                    [param('ns3::DataCollector &', 'dc')], 
                    is_virtual=True)
-    ## omnet-data-output.h: void ns3::OmnetDataOutput::SetFilePrefix(std::string const prefix) [member function]
-    cls.add_method('SetFilePrefix', 
-                   'void', 
-                   [param('std::string const', 'prefix')])
-    ## omnet-data-output.h: std::string ns3::OmnetDataOutput::GetFilePrefix() const [member function]
-    cls.add_method('GetFilePrefix', 
-                   'std::string', 
-                   [], 
-                   is_const=True)
     ## omnet-data-output.h: void ns3::OmnetDataOutput::DoDispose() [member function]
     cls.add_method('DoDispose', 
                    'void', 
@@ -340,15 +340,6 @@
                    'void', 
                    [param('ns3::DataCollector &', 'dc')], 
                    is_virtual=True)
-    ## sqlite-data-output.h: void ns3::SqliteDataOutput::SetDBFile(std::string const file) [member function]
-    cls.add_method('SetDBFile', 
-                   'void', 
-                   [param('std::string const', 'file')])
-    ## sqlite-data-output.h: std::string ns3::SqliteDataOutput::GetDBFile() const [member function]
-    cls.add_method('GetDBFile', 
-                   'std::string', 
-                   [], 
-                   is_const=True)
     ## sqlite-data-output.h: void ns3::SqliteDataOutput::DoDispose() [member function]
     cls.add_method('DoDispose', 
                    'void', 
--- a/bindings/python/ns3_module_tap_bridge.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_tap_bridge.py	Fri Jul 03 09:59:04 2009 +0400
@@ -111,6 +111,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## tap-bridge.h: void ns3::TapBridge::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## tap-bridge.h: ns3::Address ns3::TapBridge::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
@@ -216,11 +221,16 @@
                    'void', 
                    [], 
                    visibility='protected', is_virtual=True)
-    ## tap-bridge.h: void ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<ns3::Packet const> packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function]
+    ## tap-bridge.h: bool ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<ns3::Packet const> packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function]
     cls.add_method('ReceiveFromBridgedDevice', 
-                   'void', 
+                   'bool', 
                    [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src'), param('ns3::Address const &', 'dst'), param('ns3::NetDevice::PacketType', 'packetType')], 
                    visibility='protected')
+    ## tap-bridge.h: bool ns3::TapBridge::DiscardFromBridgedDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<ns3::Packet const> packet, uint16_t protocol, ns3::Address const & src) [member function]
+    cls.add_method('DiscardFromBridgedDevice', 
+                   'bool', 
+                   [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src')], 
+                   visibility='protected')
     return
 
 def register_functions(root_module):
--- a/bindings/python/ns3_module_udp_echo.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_udp_echo.py	Fri Jul 03 09:59:04 2009 +0400
@@ -77,6 +77,27 @@
     cls.add_method('SetRemote', 
                    'void', 
                    [param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
+    ## udp-echo-client.h: void ns3::UdpEchoClient::SetDataSize(uint32_t dataSize) [member function]
+    cls.add_method('SetDataSize', 
+                   'void', 
+                   [param('uint32_t', 'dataSize')])
+    ## udp-echo-client.h: uint32_t ns3::UdpEchoClient::GetDataSize() const [member function]
+    cls.add_method('GetDataSize', 
+                   'uint32_t', 
+                   [], 
+                   is_const=True)
+    ## udp-echo-client.h: void ns3::UdpEchoClient::SetFill(std::string fill) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('std::string', 'fill')])
+    ## udp-echo-client.h: void ns3::UdpEchoClient::SetFill(uint8_t fill, uint32_t dataSize) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('uint8_t', 'fill'), param('uint32_t', 'dataSize')])
+    ## udp-echo-client.h: void ns3::UdpEchoClient::SetFill(uint8_t * fill, uint32_t fillSize, uint32_t dataSize) [member function]
+    cls.add_method('SetFill', 
+                   'void', 
+                   [param('uint8_t *', 'fill'), param('uint32_t', 'fillSize'), param('uint32_t', 'dataSize')])
     ## udp-echo-client.h: void ns3::UdpEchoClient::DoDispose() [member function]
     cls.add_method('DoDispose', 
                    'void', 
--- a/bindings/python/ns3_module_virtual_net_device.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_virtual_net_device.py	Fri Jul 03 09:59:04 2009 +0400
@@ -95,10 +95,6 @@
     cls.add_method('Receive', 
                    'bool', 
                    [param('ns3::Ptr< ns3::Packet >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'destination'), param('ns3::NetDevice::PacketType', 'packetType')])
-    ## virtual-net-device.h: void ns3::VirtualNetDevice::SetAddress(ns3::Address addr) [member function]
-    cls.add_method('SetAddress', 
-                   'void', 
-                   [param('ns3::Address', 'addr')])
     ## virtual-net-device.h: void ns3::VirtualNetDevice::SetIfIndex(uint32_t const index) [member function]
     cls.add_method('SetIfIndex', 
                    'void', 
@@ -114,6 +110,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## virtual-net-device.h: void ns3::VirtualNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## virtual-net-device.h: ns3::Address ns3::VirtualNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- a/bindings/python/ns3_module_wifi.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3_module_wifi.py	Fri Jul 03 09:59:04 2009 +0400
@@ -4070,6 +4070,11 @@
                    'ns3::Ptr< ns3::Channel >', 
                    [], 
                    is_const=True, is_virtual=True)
+    ## wifi-net-device.h: void ns3::WifiNetDevice::SetAddress(ns3::Address address) [member function]
+    cls.add_method('SetAddress', 
+                   'void', 
+                   [param('ns3::Address', 'address')], 
+                   is_virtual=True)
     ## wifi-net-device.h: ns3::Address ns3::WifiNetDevice::GetAddress() const [member function]
     cls.add_method('GetAddress', 
                    'ns3::Address', 
--- a/bindings/python/ns3modulegen_generated.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/bindings/python/ns3modulegen_generated.py	Fri Jul 03 09:59:04 2009 +0400
@@ -22,14 +22,16 @@
 import ns3_module_v4ping
 import ns3_module_packet_sink
 import ns3_module_stats
-import ns3_module_virtual_net_device
 import ns3_module_onoff
 import ns3_module_internet_stack
 import ns3_module_point_to_point
 import ns3_module_csma
-import ns3_module_bridge
+import ns3_module_list_routing
+import ns3_module_static_routing
+import ns3_module_virtual_net_device
 import ns3_module_wifi
 import ns3_module_emu
+import ns3_module_bridge
 import ns3_module_global_routing
 import ns3_module_udp_echo
 import ns3_module_olsr
@@ -152,17 +154,6 @@
         ns3_module_stats__local.register_types(module)
     
     root_module.end_section('ns3_module_stats')
-    root_module.begin_section('ns3_module_virtual_net_device')
-    ns3_module_virtual_net_device.register_types(module)
-    
-    try:
-        import ns3_module_virtual_net_device__local
-    except ImportError:
-        pass
-    else:
-        ns3_module_virtual_net_device__local.register_types(module)
-    
-    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_onoff')
     ns3_module_onoff.register_types(module)
     
@@ -207,17 +198,39 @@
         ns3_module_csma__local.register_types(module)
     
     root_module.end_section('ns3_module_csma')
-    root_module.begin_section('ns3_module_bridge')
-    ns3_module_bridge.register_types(module)
+    root_module.begin_section('ns3_module_list_routing')
+    ns3_module_list_routing.register_types(module)
     
     try:
-        import ns3_module_bridge__local
+        import ns3_module_list_routing__local
     except ImportError:
         pass
     else:
-        ns3_module_bridge__local.register_types(module)
+        ns3_module_list_routing__local.register_types(module)
+    
+    root_module.end_section('ns3_module_list_routing')
+    root_module.begin_section('ns3_module_static_routing')
+    ns3_module_static_routing.register_types(module)
+    
+    try:
+        import ns3_module_static_routing__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_static_routing__local.register_types(module)
     
-    root_module.end_section('ns3_module_bridge')
+    root_module.end_section('ns3_module_static_routing')
+    root_module.begin_section('ns3_module_virtual_net_device')
+    ns3_module_virtual_net_device.register_types(module)
+    
+    try:
+        import ns3_module_virtual_net_device__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_virtual_net_device__local.register_types(module)
+    
+    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_wifi')
     ns3_module_wifi.register_types(module)
     
@@ -240,6 +253,17 @@
         ns3_module_emu__local.register_types(module)
     
     root_module.end_section('ns3_module_emu')
+    root_module.begin_section('ns3_module_bridge')
+    ns3_module_bridge.register_types(module)
+    
+    try:
+        import ns3_module_bridge__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_bridge__local.register_types(module)
+    
+    root_module.end_section('ns3_module_bridge')
     root_module.begin_section('ns3_module_global_routing')
     ns3_module_global_routing.register_types(module)
     
@@ -450,17 +474,6 @@
         ns3_module_stats__local.register_methods(root_module)
     
     root_module.end_section('ns3_module_stats')
-    root_module.begin_section('ns3_module_virtual_net_device')
-    ns3_module_virtual_net_device.register_methods(root_module)
-    
-    try:
-        import ns3_module_virtual_net_device__local
-    except ImportError:
-        pass
-    else:
-        ns3_module_virtual_net_device__local.register_methods(root_module)
-    
-    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_onoff')
     ns3_module_onoff.register_methods(root_module)
     
@@ -505,17 +518,39 @@
         ns3_module_csma__local.register_methods(root_module)
     
     root_module.end_section('ns3_module_csma')
-    root_module.begin_section('ns3_module_bridge')
-    ns3_module_bridge.register_methods(root_module)
+    root_module.begin_section('ns3_module_list_routing')
+    ns3_module_list_routing.register_methods(root_module)
     
     try:
-        import ns3_module_bridge__local
+        import ns3_module_list_routing__local
     except ImportError:
         pass
     else:
-        ns3_module_bridge__local.register_methods(root_module)
+        ns3_module_list_routing__local.register_methods(root_module)
+    
+    root_module.end_section('ns3_module_list_routing')
+    root_module.begin_section('ns3_module_static_routing')
+    ns3_module_static_routing.register_methods(root_module)
+    
+    try:
+        import ns3_module_static_routing__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_static_routing__local.register_methods(root_module)
     
-    root_module.end_section('ns3_module_bridge')
+    root_module.end_section('ns3_module_static_routing')
+    root_module.begin_section('ns3_module_virtual_net_device')
+    ns3_module_virtual_net_device.register_methods(root_module)
+    
+    try:
+        import ns3_module_virtual_net_device__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_virtual_net_device__local.register_methods(root_module)
+    
+    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_wifi')
     ns3_module_wifi.register_methods(root_module)
     
@@ -538,6 +573,17 @@
         ns3_module_emu__local.register_methods(root_module)
     
     root_module.end_section('ns3_module_emu')
+    root_module.begin_section('ns3_module_bridge')
+    ns3_module_bridge.register_methods(root_module)
+    
+    try:
+        import ns3_module_bridge__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_bridge__local.register_methods(root_module)
+    
+    root_module.end_section('ns3_module_bridge')
     root_module.begin_section('ns3_module_global_routing')
     ns3_module_global_routing.register_methods(root_module)
     
@@ -696,17 +742,6 @@
         ns3_module_stats__local.register_functions(root_module)
     
     root_module.end_section('ns3_module_stats')
-    root_module.begin_section('ns3_module_virtual_net_device')
-    ns3_module_virtual_net_device.register_functions(root_module)
-    
-    try:
-        import ns3_module_virtual_net_device__local
-    except ImportError:
-        pass
-    else:
-        ns3_module_virtual_net_device__local.register_functions(root_module)
-    
-    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_onoff')
     ns3_module_onoff.register_functions(root_module)
     
@@ -751,17 +786,39 @@
         ns3_module_csma__local.register_functions(root_module)
     
     root_module.end_section('ns3_module_csma')
-    root_module.begin_section('ns3_module_bridge')
-    ns3_module_bridge.register_functions(root_module)
+    root_module.begin_section('ns3_module_list_routing')
+    ns3_module_list_routing.register_functions(root_module)
     
     try:
-        import ns3_module_bridge__local
+        import ns3_module_list_routing__local
     except ImportError:
         pass
     else:
-        ns3_module_bridge__local.register_functions(root_module)
+        ns3_module_list_routing__local.register_functions(root_module)
+    
+    root_module.end_section('ns3_module_list_routing')
+    root_module.begin_section('ns3_module_static_routing')
+    ns3_module_static_routing.register_functions(root_module)
+    
+    try:
+        import ns3_module_static_routing__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_static_routing__local.register_functions(root_module)
     
-    root_module.end_section('ns3_module_bridge')
+    root_module.end_section('ns3_module_static_routing')
+    root_module.begin_section('ns3_module_virtual_net_device')
+    ns3_module_virtual_net_device.register_functions(root_module)
+    
+    try:
+        import ns3_module_virtual_net_device__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_virtual_net_device__local.register_functions(root_module)
+    
+    root_module.end_section('ns3_module_virtual_net_device')
     root_module.begin_section('ns3_module_wifi')
     ns3_module_wifi.register_functions(root_module)
     
@@ -784,6 +841,17 @@
         ns3_module_emu__local.register_functions(root_module)
     
     root_module.end_section('ns3_module_emu')
+    root_module.begin_section('ns3_module_bridge')
+    ns3_module_bridge.register_functions(root_module)
+    
+    try:
+        import ns3_module_bridge__local
+    except ImportError:
+        pass
+    else:
+        ns3_module_bridge__local.register_functions(root_module)
+    
+    root_module.end_section('ns3_module_bridge')
     root_module.begin_section('ns3_module_global_routing')
     ns3_module_global_routing.register_functions(root_module)
     
--- a/doc/doxygen.conf	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/doxygen.conf	Fri Jul 03 09:59:04 2009 +0400
@@ -514,7 +514,8 @@
 # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
 
 FILE_PATTERNS          = *.h \
-                         *.tcc
+                         *.tcc \
+			 node-list.cc
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories 
 # should be searched for input files as well. Possible values are YES and NO. 
--- a/doc/manual/emulation.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/manual/emulation.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -131,6 +131,14 @@
 
 @section Usage
 
+Any mixing of ns-3 objects with real objects will typically require that
+ns-3 compute checksums in its protocols.  By default, checksums are not
+computed by ns-3.  To enable checksums (e.g. UDP, TCP, IP), users must set
+the attribute @code{ChecksumEnabled} to true, such as follows:
+@verbatim
+GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
+@end verbatim
+
 @subsection Emu Net Device
 
 The usage of the @code{Emu} net device is straightforward once the network of
Binary file doc/manual/figures/internet-node-recv.dia has changed
Binary file doc/manual/figures/internet-node-send.dia has changed
--- a/doc/manual/node.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/manual/node.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -121,86 +121,74 @@
 Internet Nodes are not subclasses of class Node; they are simply Nodes 
 that have had a bunch of IPv4-related
 objects aggregated to them.  They can be put together by hand, or
-via a helper function @code{AddInternetStack ()} which does the 
-following:
+via a helper function @code{InternetStackHelper::Install ()} which does the 
+following to all nodes passed in as arguments:
 @verbatim
-void AddInternetStack (Ptr<Node> node)
+void
+InternetStackHelper::Install (Ptr<Node> node) const
 {
-  // Create layer-3 protocols 
-  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
-  Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
-  ipv4->SetNode (node);
-  arp->SetNode (node);
-
-  // Create an L4 demux 
-  Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> ();
+  if (node->GetObject<Ipv4> () != 0)
+    {
+      NS_FATAL_ERROR ("InternetStackHelper::Install(): Aggregating "
+                      "an InternetStack to a node with an existing Ipv4 object");
+      return;
+    }
 
-  // Create transport protocols and insert them into the demux
-  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
-  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
-  
-  ipv4L4Demux->SetNode (node);
-  udp->SetNode (node);
-  tcp->SetNode (node);
-  
-  ipv4L4Demux->Insert (udp);
-  ipv4L4Demux->Insert (tcp);
-  
-  // Add factories for instantiating transport protocol sockets
-  Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
-  Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
-  Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> ();
-  
-  udpFactory->SetUdp (udp);
-  tcpFactory->SetTcp (tcp);
-  ipv4Impl->SetIpv4 (ipv4);
-  
-  // Aggregate all of these new objects to the node
-  node->AggregateObject (ipv4);
-  node->AggregateObject (arp);
-  node->AggregateObject (ipv4Impl);
-  node->AggregateObject (udpFactory);
-  node->AggregateObject (tcpFactory);
-  node->AggregateObject (ipv4L4Demux);
+  CreateAndAggregateObjectFromTypeId (node, "ns3::ArpL3Protocol");
+  CreateAndAggregateObjectFromTypeId (node, "ns3::Ipv4L3Protocol");
+  CreateAndAggregateObjectFromTypeId (node, "ns3::Icmpv4L4Protocol");
+  CreateAndAggregateObjectFromTypeId (node, "ns3::UdpL4Protocol");
+  node->AggregateObject (m_tcpFactory.Create<Object> ());
+  Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
+  node->AggregateObject (factory);
+  // Set routing
+  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
+  Ptr<Ipv4RoutingProtocol> ipv4Routing = m_routing->Create (node);
+  ipv4->SetRoutingProtocol (ipv4Routing);
+}
+@end verbatim
+
+Note that the Ipv4 routing protocol is configured and set outside this
+function.  By default, the following protocols are added to Ipv4:
+@verbatim
+InternetStackHelper::InternetStackHelper ()
+{
+  SetTcp ("ns3::TcpL4Protocol");
+  static Ipv4StaticRoutingHelper staticRouting;
+  static Ipv4GlobalRoutingHelper globalRouting;
+  static Ipv4ListRoutingHelper listRouting;
+  listRouting.Add (staticRouting, 0);
+  listRouting.Add (globalRouting, -10);
+  SetRoutingHelper (listRouting);
 }
 @end verbatim
 
 @subsection Internet Node structure
 
-The Internet Node (an ns-3 Node augmented by aggregation to have one or more
+An IPv4-capable Node (an ns-3 Node augmented by aggregation to have one or more
 IP stacks) has the following internal structure.
 
 @subsubsection Layer-3 protocols
 At the lowest layer, sitting above the NetDevices, are the "layer 3" 
-protocols, including IPv4, IPv6, and ARP.  These protocols provide 
-the following key methods and data members:
-
-@verbatim
-class Ipv4L3Protocol : public Object
-{
-public: 
-  // Add an Ipv4 interface corresponding to the provided NetDevice
-  uint32_t AddInterface (Ptr<NetDevice> device);
-
-  // Receive function that can be bound to a callback, for receiving
-  // packets up the stack
-  void Receive( Ptr<NetDevice> device, Ptr<Packet> p, uint16_t protocol, 
-    const Address &from);
+protocols, including IPv4, IPv6 (in the future), and ARP.  The 
+@code{class Ipv4L3Protocol} is an 
+implementation class whose public interface is 
+typically @code{class Ipv4} (found in src/node directory), but the 
+Ipv4L3Protocol public API is also used internally in the 
+src/internet-stack directory at present.
 
-  // Higher-level layers call this method to send a packet
-  // down the stack to the MAC and PHY layers
-  // 
-  void Send (Ptr<Packet> packet, Ipv4Address source,
-             Ipv4Address destination, uint8_t protocol);
-
-private:
-  Ipv4InterfaceList m_interfaces;
-
-  // Protocol handlers
-}
+In class Ipv4L3Protocol, one method described below is @code{Receive ()}:
+@verbatim
+ /**
+   * Lower layer calls this method after calling L3Demux::Lookup
+   * The ARP subclass needs to know from which NetDevice this
+   * packet is coming to:
+   *    - implement a per-NetDevice ARP cache
+   *    - send back arp replies on the right device
+   */
+  void Receive( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
+                const Address &to, NetDevice::PacketType packetType);
 @end verbatim
-There are many more functions (such as @code{Forward ()}) but we will
-focus on the above four items from an architectural perspective.
 
 First, note that the @code{Receive ()} function has a matching signature
 to the ReceiveCallback in the @code{class Node}.  This function pointer
@@ -228,24 +216,15 @@
 This class nicely demonstrates two techniques we exploit in
 ns-3 to bind objects together:  callbacks, and object aggregation.
 
-Once IPv4 has determined that a packet is for the local node, it 
+Once IPv4 routing has determined that a packet is for the local node, it 
 forwards it up the stack.  This is done with the following function:
 
 @verbatim
 void
-Ipv4L3Protocol::ForwardUp (Ptr<Packet> p, Ipv4Header const&ip,
-                           Ptr<Ipv4Interface> incomingInterface)
-{
-  NS_LOG_FUNCTION (this << p << &ip);
-
-  Ptr<Ipv4L4Demux> demux = m_node->GetObject<Ipv4L4Demux> ();
-  Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
-  protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
-}
+Ipv4L3Protocol::LocalDeliver (Ptr<const Packet> packet, Ipv4Header const&ip, uint32_t iif)
 @end verbatim
 
-The first step is to find the aggregated Ipv4L4Demux object.  Then, this
-object is consulted to look up the right Ipv4L4Protocol, based on IP protocol
+The first step is to find the right Ipv4L4Protocol object , based on IP protocol
 number.  For instance, TCP is registered in the demux as protocol number 6.
 Finally, the @code{Receive()} function on the Ipv4L4Protocol (such as
 @code{TcpL4Protocol::Receive} is called.
@@ -321,10 +300,10 @@
 address) associated with the socket, and a receive callback for the socket.
 @end itemize
 
-@subsection Internet Node interfaces
+@subsection Ipv4-capable node interfaces
 
 Many of the implementation details, or internal objects themselves, 
-of Internet Node objects are not exposed at the simulator public
+of Ipv4-capable Node objects are not exposed at the simulator public
 API.  This allows for different implementations; for instance, 
 replacing the native ns-3 models with ported TCP/IP stack code. 
  
--- a/doc/manual/routing.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/manual/routing.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -106,18 +106,26 @@
 Presently, global centralized IPv4 unicast routing over both 
 point-to-point and shared (CSMA) links is supported.
 
+By default, when using the ns-3 helper API and the default InternetStackHelper,
+global routing capability will be added  to the node, and global routing
+will be inserted as a routing protocol with lower priority than the
+static routes (i.e., users can insert routes via Ipv4StaticRouting API
+and they will take precedence over routes found by global routing).
+
 @subsection Global Unicast Routing API
 
 The public API is very minimal.  User scripts include the following:
 @verbatim
-#include "ns3/global-route-manager.h"
+#include "ns3/helper-module.h"
 @end verbatim
 
+If the default InternetStackHelper is used, then an instance of
+global routing will be aggregated to each node.
 After IP addresses are configured, the following function call will
 cause all of the nodes that have an Ipv4 interface to receive
 forwarding tables entered automatically by the GlobalRouteManager:
 @verbatim
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 @end verbatim
 
 @emph{Note:} A reminder that the wifi NetDevice will work but does not
@@ -127,7 +135,7 @@
 It is possible to call this function again in the midst of a simulation
 using the following additional public function:
 @verbatim
-  GlobalRouteManager::RecomputeRoutingTables ();
+  Ipv4GlobalRoutingHelper::RecomputeRoutingTables ();
 @end verbatim
 which flushes the old tables, queries the nodes for new interface information,
 and rebuilds the routes.
@@ -135,7 +143,7 @@
 For instance, this scheduling call will cause the tables to be rebuilt
 at time 5 seconds:
 @verbatim
-  Simulator::Schedule (Seconds (5),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (5),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
 @end verbatim
 
 @subsection Global Routing Implementation
--- a/doc/manual/wifi.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/manual/wifi.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -19,15 +19,26 @@
 @node Overview of the model
 @section Overview of the model
 
-@strong{Note:}  This overview is taken largely from the Doxygen for the
-WifiNetDevice module.
+The WifiNetDevice models a wireless network interface controller based
+on the IEEE 802.11 standard.  We will go into more detail below but in brief,
+ns-3 provides models for these aspects of 802.11:
+@itemize @bullet
+@item basic 802.11 DCF with @strong{infrastructure} and @strong{adhoc} modes
+@item @strong{802.11a} and @strong{802.11b} physical layers
+@item QoS-based EDCA and queueing extensions of @strong{802.11e}
+@item various propagation loss models including @strong{Nakagami, Rayleigh, Friis, LogDistance, FixedRss, Random} 
+@item two propagation delay models, a distance-based and random model
+@item various rate control algorithms including @strong{Aarf, Arf, Cara, Onoe, Rraa, and ConstantRate} 
+@item @emph{(under development)} 802.11s (mesh)
+@item @emph{(under development)} Minstrel rate control
+@end itemize
 
 The set of 802.11 models provided in ns-3 attempts to provide
 an accurate MAC-level implementation of the 802.11 specification
 and to provide a not-so-slow PHY-level model of the 802.11a
 specification.
 
-The current implementation provides roughly four levels of models:
+The implementation is modular and provides roughly four levels of models:
 @itemize @bullet
 @item the @strong{PHY layer models}
 @item the so-called @strong{MAC low models}: they implement DCF and EDCAF
@@ -94,7 +105,8 @@
 The PHY layer implements a single model in the 
 @code{ns3::WifiPhy class}: the
 physical layer model implemented there is described fully in a paper 
-entitled @uref{http://cutebugs.net/files/wns2-yans.pdf,,"Yet Another Network Simulator"}. 
+entitled @uref{http://cutebugs.net/files/wns2-yans.pdf,,"Yet Another Network Simulator"}.  Validation results for 802.11b are available in this
+@uref{http://www.nsnam.org/~pei/80211b.pdf,,technical report}. 
 
 In ns-3, nodes can have multiple WifiNetDevices on separate channels,
 and the WifiNetDevice can coexist with other device types; this removes
@@ -112,6 +124,12 @@
 @node Using the WifiNetDevice
 @section Using the WifiNetDevice
 
+The modularity provided by the implementation makes low-level 
+configuration of the WifiNetDevice powerful but complex.  For this reason,
+we provide some helper classes to perform common operations in a simple
+matter, and leverage the ns-3 attribute system to allow users to control
+the parameterization of the underlying models.
+
 Users who use the low-level ns-3 API and who wish to add a WifiNetDevice
 to their node must create an instance of a WifiNetDevice, plus 
 a number of consitutent objects, and bind them together appropriately
--- a/doc/tutorial/building-topologies.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/tutorial/building-topologies.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -61,7 +61,6 @@
   #include "ns3/simulator-module.h"
   #include "ns3/node-module.h"
   #include "ns3/helper-module.h"
-  #include "ns3/global-routing-module.h"
 @end verbatim
 
 One thing that can be surprisingly useful is a small bit of ASCII art that
@@ -294,10 +293,11 @@
 @end verbatim
 
 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 through the nodes created for the simulation and does
-the hard work of setting up routing for you.  
+internetwork routing.  @command{ns-3} provides what we call global routing to
+help you out.  Global routing takes advantage of the fact that the entire 
+internetwork is accessible in the simulation and runs through the all of the
+nodes created for the simulation --- it does the hard work of setting up routing 
+for you without having to configure routers.
 
 Basically, what happens is that each node behaves as if it were an OSPF router
 that communicates instantly and magically with all other routers behind the
@@ -307,7 +307,7 @@
 is a one-liner:
 
 @verbatim
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 @end verbatim
 
 Next we enable pcap tracing.  The first line of code to enable pcap tracing 
@@ -329,8 +329,8 @@
 one of the devices and place it in promiscuous mode.  That single device
 then ``sniffs'' the network for all packets and stores them in a single
 pcap file.  This is how @code{tcpdump}, for example, works.  That final 
-parameter tells the CSMA helper whether or not to capture packets in 
-promiscuous mode.  
+parameter tells the CSMA helper whether or not to arrange to capture 
+packets in promiscuous mode.  
 
 In this example, we are going to select one of the devices on the CSMA
 network and ask it to perform a promiscuous sniff of the network, thereby
@@ -350,10 +350,10 @@
   }
 @end verbatim
 
-In order to run this example, you have to copy the @code{second.cc} example
-script into the scratch directory and use waf to build just as you did with
+In order to run this example, copy the @code{second.cc} example script into 
+the scratch directory and use waf to build just as you did with
 the @code{first.cc} example.  If you are in the top-level directory of the
-repository you would type,
+repository you just type,
 
 @verbatim
   cp examples/second.cc scratch/mysecond.cc
@@ -380,18 +380,19 @@
 @code{first.cc}, you will see similar output when you run the script.
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.415s)
   Sent 1024 bytes to 10.1.2.4
   Received 1024 bytes from 10.1.1.1
   Received 1024 bytes from 10.1.2.4
 @end verbatim
 
-Recall that the first message, @code{Sent 1024 bytes to 10.1.2.4} is the 
+Recall that the first message, ``@code{Sent 1024 bytes to 10.1.2.4},'' is the 
 UDP echo client sending a packet to the server.  In this case, the server
-is on a different network (10.1.2.0).  The second message, @code{Received 1024 
-bytes from 10.1.1.1}, is from the UDP echo server, generated when it receives
-the echo packet.  The final message, @code{Received 1024 bytes from 10.1.2.4}
+is on a different network (10.1.2.0).  The second message, ``@code{Received 1024 
+bytes from 10.1.1.1},'' is from the UDP echo server, generated when it receives
+the echo packet.  The final message, ``@code{Received 1024 bytes from 10.1.2.4},''
 is from the echo client, indicating that it has received its echo back from
 the server.
 
@@ -483,8 +484,8 @@
 doesn't know the MAC address of the corresponding node.  It broadcasts on the
 CSMA network (ff:ff:ff:ff:ff:ff) asking for the device that has IP address
 10.1.2.4.  In this case, the rightmost node replies saying it is at MAC address
-00:00:00:00:00:06.  (Note that node two is not directly involved in this 
-exchange, but is sniffing the network and reporting all of the traffic it sees.)
+00:00:00:00:00:06.  Note that node two is not directly involved in this 
+exchange, but is sniffing the network and reporting all of the traffic it sees.
 
 This exchange is seen in the following lines,
 
@@ -559,8 +560,9 @@
 You should now see,
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.405s)
   Sent 1024 bytes to 10.1.2.5
   Received 1024 bytes from 10.1.1.1
   Received 1024 bytes from 10.1.2.5
@@ -572,7 +574,7 @@
 It is possible that you may not be satisfied with a trace file generated by
 a bystander in the CSMA network.  You may really want to get a trace from
 a single device and you may not be interested in any other traffic on the 
-network.  You can do this,
+network.  You can do this fairly easily/
 
 Let's take a look at @code{scratch/mysecond.cc} and add that code enabling us
 to be more specific.  @code{ns-3} helpers provide methods that take a node
@@ -615,6 +617,14 @@
 documentation for the method.  Using the @code{GetId} method can make 
 determining node numbers much easier in complex topologies.
 
+Let's clear the old trace files out of the top-level directory to avoid confusion
+about what is going on,
+
+@verbatim
+  rm *.pcap
+  rm *.tr
+@end verbatim
+
 If you build the new script and run the simulation setting @code{nCsma} to 100,
 
 @verbatim
@@ -624,8 +634,9 @@
 you will see the following output:
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.407s)
   Sent 1024 bytes to 10.1.2.101
   Received 1024 bytes from 10.1.1.1
   Received 1024 bytes from 10.1.2.101
@@ -659,9 +670,27 @@
 entire CSMA network.
 
 @verbatim
-reading from file second-100-0.pcap, link-type EN10MB (Ethernet)
-2.003696 arp who-has 10.1.2.101 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1
-2.003811 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.101
+  reading from file second-100-0.pcap, link-type EN10MB (Ethernet)
+  2.003696 arp who-has 10.1.2.101 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1
+  2.003811 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.101
+@end verbatim
+
+Now take a look at the @code{tcpdump} for @code{second-101-0.pcap}.
+
+@verbatim
+  tcpdump -nn -tt -r second-101-0.pcap
+@end verbatim
+
+You can now see that node 101 is really the participant in the echo exchange.
+
+@verbatim
+  reading from file second-101-0.pcap, link-type EN10MB (Ethernet)
+  2.003696 arp who-has 10.1.2.101 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1
+  2.003696 arp reply 10.1.2.101 is-at 00:00:00:00:00:67
+  2.003801 IP 10.1.1.1.49153 > 10.1.2.101.9: UDP, length 1024
+  2.003801 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.101
+  2.003822 arp reply 10.1.2.1 is-at 00:00:00:00:00:03
+  2.003822 IP 10.1.2.101.9 > 10.1.1.1.49153: UDP, length 1024
 @end verbatim
 
 @c ========================================================================
@@ -714,7 +743,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
 #include "ns3/wifi-module.h"
 #include "ns3/mobility-module.h"
 @end verbatim
@@ -1035,14 +1063,15 @@
 just as we did in the @code{second.cc} example script.
 
 @verbatim
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 @end verbatim
 
 One thing that can surprise some users is the fact that the simulation we just
 created will never ``naturally'' stop.  This is because we asked the wireless
-access point to generate beacons.  It will generate beacons forever, so we must
-tell the simulator to stop even though it may have beacon generation events 
-scheduled.  The following line of code tells the simulator to stop so that 
+access point to generate beacons.  It will generate beacons forever, and this
+will result in simulator events being scheduled into the future indefinitely,
+so we must tell the simulator to stop even though it may have beacon generation
+events scheduled.  The following line of code tells the simulator to stop so that 
 we don't simulate beacons forever and enter what is essentially an endless
 loop.
 
@@ -1054,7 +1083,7 @@
 
 @verbatim
   PointToPointHelper::EnablePcapAll ("third");
-  YansWifiPhyHelper::EnablePcap ("third", apDevices.Get (0));
+  phy.EnablePcap ("third", apDevices.Get (0));
   CsmaHelper::EnablePcap ("third", csmaDevices.Get (0), true);
 @end verbatim
 
@@ -1084,27 +1113,28 @@
   ./waf --run scratch/mythird
 @end verbatim
 
-Since we have set up the UDP echo applications just as we did in the 
+Again, since we have set up the UDP echo applications just as we did in the 
 @code{second.cc} script, you will see similar output.
 
 @verbatim
-  Entering directory `repos/ns-3-allinone-dev/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.407s)
   Sent 1024 bytes to 10.1.2.4
   Received 1024 bytes from 10.1.3.3
   Received 1024 bytes from 10.1.2.4
 @end verbatim
 
-Recall that the first message, @code{Sent 1024 bytes to 10.1.2.4} is the 
+Recall that the first message, ``@code{Sent 1024 bytes to 10.1.2.4},'' is the 
 UDP echo client sending a packet to the server.  In this case, the client
 is on the wireless network (10.1.3.0).  The second message, 
-@code{Received 1024 bytes from 10.1.3.3}, is from the UDP echo server, 
+``@code{Received 1024 bytes from 10.1.3.3},'' is from the UDP echo server, 
 generated when it receives the echo packet.  The final message, 
-@code{Received 1024 bytes from 10.1.2.4} is from the echo client, indicating
+``@code{Received 1024 bytes from 10.1.2.4},'' 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 four trace 
-files, two from node zero and two from node one:
+files from this simulation, two from node zero and two from node one:
 
 @verbatim
 third-0-0.pcap  third-0-1.pcap  third-1-0.pcap  third-1-1.pcap
@@ -1223,8 +1253,8 @@
 
 Now, we spent a lot of time setting up mobility models for the wireless network
 and so it would be a shame to finish up without even showing that the STA
-nodes are actually moving around.  Let's do this by hooking into the 
-@code{MobilityModel} course change trace source.  This is usually considered
+nodes are actually moving around during the simulation.  Let's do this by hooking
+into the @code{MobilityModel} course change trace source.  This is usually considered
 a fairly advanced topic, but let's just go for it.
 
 As mentioned in the ``Tweaking ns-3'' section, the @command{ns-3} tracing system 
@@ -1273,8 +1303,8 @@
   /NodeList/7/$ns3::MobilityModel/CourseChange
 @end verbatim
 
-Based on the discussion in the tracing section, you can easily infer that 
-this trace path references the seventh node in the NodeList.  It specifies
+Based on the discussion in the tracing section, you may infer that this trace 
+path references the seventh node in the global NodeList.  It specifies
 what is called an aggregated object of type @code{ns3::MobilityModel}.  The 
 dollar sign prefix implies that the MobilityModel is aggregated to node seven.
 The last component of the path means that we are hooking into the 
@@ -1336,6 +1366,6 @@
 discussed.
 
 We have just scratched the surface of @command{ns-3} in this tutorial, but we 
-hope we have covered enough to get you started doing useful work.
+hope we have hopefully covered enough to get you started doing useful work.
 
 -- The @command{ns-3} development team.
--- a/doc/tutorial/conceptual-overview.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/tutorial/conceptual-overview.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -110,7 +110,7 @@
 you had to buy a specific kind of network cable and a hardware device called
 (in PC terminology) a @emph{peripheral card} that needed to be installed in
 your computer.  If the peripheral card implemented some networking function,
-theys were called Network Interface Cards, or @emph{NICs}.  Today most 
+they were called Network Interface Cards, or @emph{NICs}.  Today most 
 computers come with the network interface hardware built in and users don't 
 see these building blocks.
 
@@ -174,9 +174,10 @@
 directory structure something like the following:
 
 @verbatim
-  AUTHORS  examples/  README         samples/  utils/   waf.bat*
-  build/   LICENSE    regression/    scratch/  VERSION  wscript
-  doc/     ns3/       RELEASE_NOTES  src/      waf*
+  AUTHORS       doc/       README          RELEASE_NOTES  utils/    wscript
+  bindings/     examples/  regression/     samples/       VERSION   wutils.py
+  build/        LICENSE    regression.py   scratch/       waf*      wutils.pyc
+  CHANGES.html  ns3/       regression.pyc  src/           waf.bat*
 @end verbatim
 
 @cindex first.cc
@@ -276,7 +277,7 @@
 @end verbatim
 
 to build the project.  So now if you look in the directory 
-@code{build/debug/ns3} 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.
 
@@ -310,16 +311,18 @@
 documentation system.  If you look at the project web site, 
 @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.
+taken to our documentation page for the current development release.  There 
+is also a link to ``Doxygen (stable)'' that will take you to the documentation
+for the latest stable release of @code{ns-3}.
 
 Along the left side, you will find a graphical representation of the structure
 of the documentation.  A good place to start is the @code{NS-3 Modules} 
-``book.''  If you expand @code{Modules} you will see a list of @command{ns-3}
-module documentation.  The concept of module here ties directly into the 
-module include files discussed above.  It turns out that the @command{ns-3}
-logging subsystem is part of the @code{core} module, so go ahead and expand 
-that documentation node.  Now, expand the @code{Debugging} book and then 
-select the @code{Logging} page.
+``book'' in the @code{ns-3} navigation tree.  If you expand @code{Modules} 
+you will see a list of @command{ns-3} module documentation.  The concept of 
+module here ties directly into the module include files discussed above.  It 
+turns out that the @command{ns-3} logging subsystem is part of the @code{core} 
+module, so go ahead and expand that documentation node.  Now, expand the 
+@code{Debugging} book and then select the @code{Logging} page.
 
 You should now be looking at the Doxygen documentation for the Logging module.
 In the list of @code{#define}s at the top of the page you will see the entry
@@ -437,7 +440,7 @@
     pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
 @end verbatim
 
-tells the @code{PointToPointHelper} object to use the value ``5mbps''
+tells the @code{PointToPointHelper} object to use the value ``5Mbps''
 (five megabits per second) as the ``DataRate'' when it creates a 
 @code{PointToPointNetDevice} object.
 
@@ -492,7 +495,7 @@
 created objects.
 
 After executing the @code{pointToPoint.Install (nodes)} call we will have
-two nodes, each with an installed point-to-point net device and a 
+two nodes, each with an installed point-to-point net device and a single
 point-to-point channel between them.  Both devices will be configured to 
 transmit data at five megabits per second over the channel which has a two 
 millisecond transmission delay.
@@ -576,13 +579,13 @@
 The first line of code in the above snippet declares the 
 @code{UdpEchoServerHelper}.  As usual, this isn't the application itself, it
 is an object used to help us create the actual applications.  One of our 
-conventions is to place required @code{Attributes} in the helper constructor.
+conventions is to place @emph{required} @code{Attributes} in the helper constructor.
 In this case, the helper can't do anything useful unless it is provided with
 a port number that the client also knows about.  Rather than just picking one 
 and hoping it all works out, we require the port number as a parameter to the 
 constructor.  The constructor, in turn, simply does a @code{SetAttribute}
-with the passed value.  You can, if desired, set the ``Port'' @code{Attribute}
-to another value later.
+with the passed value.  If you want, you can set the ``Port'' @code{Attribute}
+to another value later using @code{SetAttribute}.
 
 Similar to many other helper objects, the @code{UdpEchoServerHelper} object 
 has an @code{Install} method.  It is the execution of this method that actually
@@ -591,7 +594,11 @@
 @code{NodeContainter} as a parameter just as the other @code{Install} methods
 we have seen.  This is actually what is passed to the method even though it 
 doesn't look so in this case.  There is a C++ @emph{implicit conversion} at
-work here.
+work here that takes the result of @code{nodes.Get (1)} (which returns a smart
+pointer to a node object --- @code{Ptr<Node>}) and uses that in a constructor
+for an unnamed @code{NodeContainer} that is then passed to @code{Install}.
+If you are ever at a loss to find a particular method signature in C++ code
+that compiles and runs just fine, look for these kinds of implicit conversions.  
 
 We now see that @code{echoServer.Install} is going to install a
 @code{UdpEchoServerApplication} on the node found at index number one of the
@@ -603,9 +610,12 @@
 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
 @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 
-@command{ns-3} @code{Time} object using a @code{Seconds} cast.  The two lines,
+methods take @code{Time} parameters.  In this case, we use an @emph{explicit}
+C++ conversion sequence to take the C++ double 1.0 and convert it to an 
+@command{ns-3} @code{Time} object using a @code{Seconds} cast.  Be aware that
+the conversion rules may be controlled by the model author, and C++ has its
+own rules, so you can't always just assume that parameters will be happily 
+converted for you.  The two lines,
 
 @verbatim
     serverApps.Start (Seconds (1.0));
@@ -614,9 +624,9 @@
 
 will cause the echo server application to @code{Start} (enable itself) at one
 second into the simulation and to @code{Stop} (disable itself) at ten seconds
-into the simulation.  By virtue of the fact that we have implicilty declared
-a simulation event (the application stop event) to be executed at ten seconds,
-the simulation will last at least ten seconds.
+into the simulation.  By virtue of the fact that we have declared a simulation
+event (the application stop event) to be executed at ten seconds, the simulation
+will last @emph{at least} ten seconds.
 
 @subsubsection UdpEchoClientHelper
 
@@ -682,25 +692,27 @@
 @end verbatim
 
 we actually scheduled events in the simulator at 1.0 seconds, 2.0 seconds and
-10.0 seconds.  When @code{Simulator::Run} is called, the system will begin 
-looking through the list of scheduled events and executing them.  First it 
-will run the event at 1.0 seconds, which will enable the echo server 
-application.  Then it will run the event scheduled for t=2.0 seconds which 
-will start the echo client application.  The start event implementation in 
-the echo client application will begin the data transfer phase of the 
-simulation by sending a packet to the server.
+two events at 10.0 seconds.  When @code{Simulator::Run} is called, the system 
+will begin looking through the list of scheduled events and executing them.  
+First it will run the event at 1.0 seconds, which will enable the echo server 
+application (this event may, in turn, schedule many other events).  Then it 
+will run the event scheduled for t=2.0 seconds which will start the echo client
+application.  Again, this event may schedule many more events.  The start event
+implementation in the echo client application will begin the data transfer phase
+of the simulation by sending a packet to the server.
 
 The act of sending the packet to the server will trigger a chain of events
 that will be automatically scheduled behind the scenes and which will perform 
 the mechanics of the packet echo according to the various timing parameters 
 that we have set in the script.
 
-Eventually, since we only send one packet, the chain of events triggered by 
+Eventually, since we only send one packet (recall the @code{MaxPackets} 
+@code{Attribute} was set to one), the chain of events triggered by 
 that single client echo request will taper off and the simulation will go 
 idle.  Once this happens, the remaining events will be the @code{Stop} events
 for the server and the client.  When these events are executed, there are
 no further events to process and @code{Simulator::Run} returns.  The simulation
-is complete.
+is then complete.
 
 All that remains is to clean up.  This is done by calling the global function 
 @code{Simulator::Destroy}.  As the helper functions (or low level 
@@ -721,10 +733,11 @@
 We have made it trivial to build your simple scripts.  All you have to do is 
 to drop your script into the scratch directory and it will automatically be 
 built if you run Waf.  Let's try it.  Copy @code{examples/first.cc} into 
-the @code{scratch} directory.
+the @code{scratch} directory after changing back into the top level directory.
 
 @verbatim
-  ~/repos/ns-3-dev > cp examples/first.cc scratch/myfirst.cc
+  cd ..
+  cp examples/first.cc scratch/myfirst.cc
 @end verbatim
 
 Now build your first example script using waf:
@@ -737,10 +750,11 @@
 successfully.
 
 @verbatim
-  Entering directory `repos/ns-3-allinone-dev/ns-3-dev/build'
-  [563/648] cxx: scratch/myfirst.cc -> build/debug/scratch/myfirst_3.o
-  [646/648] cxx_link: build/debug/scratch/myfirst_3.o -> build/debug/scratch/myfirst
-  Build finished successfully (00:00:02)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  [614/708] cxx: scratch/myfirst.cc -> build/debug/scratch/myfirst_3.o
+  [706/708] cxx_link: build/debug/scratch/myfirst_3.o -> build/debug/scratch/myfirst
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (2.357s)
 @end verbatim
 
 You can now run the example (note that if you build your program in the scratch
@@ -753,8 +767,9 @@
 You should see some output:
 
 @verbatim
-  Entering directory `repos/ns-3-allinone-dev/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.418s)
   Sent 1024 bytes to 10.1.1.2
   Received 1024 bytes from 10.1.1.1
   Received 1024 bytes from 10.1.1.2
@@ -778,49 +793,57 @@
 Now that you have used some of the @command{ns-3} helpers you may want to 
 have a look at some of the source code that implements that functionality.
 The most recent code can be browsed on our web server at the following link:
-@uref{http://code.nsnam.org/?sort=lastchange}.  If you click on the bold
-repository names on the left of the page, you will see @emph{changelogs} for
-these repositories, and links to the @emph{manifest}.  From the manifest
-links, one can browse the source tree.
+@uref{http://code.nsnam.org/ns-3-dev}.  There, you will see the Mercurial
+summary page for our @command{ns-3} development tree.
+
+At the top of the page, you will see a number of links,
 
-The top-level directory for one of our @emph{repositories} will look 
-something like:
+@verbatim
+  summary | shortlog | changelog | graph | tags | files 
+@end verbatim
+
+Go ahead and select the @code{files} link.  This is what the top-level of
+most of our @emph{repositories} will look:
 
 @verbatim
-drwxr-xr-x   [up]   
-drwxr-xr-x   bindings python                          files 
-drwxr-xr-x   doc                                      files 
-drwxr-xr-x   examples                                 files 
-drwxr-xr-x   ns3                                      files 
-drwxr-xr-x   regression                               files 
-drwxr-xr-x   samples                                  files 
-drwxr-xr-x   scratch                                  files 
-drwxr-xr-x   src                                      files 
-drwxr-xr-x   utils                                    files 
--rw-r--r-- 2009-03-24 00:51 -0700 505   .hgignore     file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 1682  .hgtags       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 686   AUTHORS       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 14893 CHANGES.html  file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 17987 LICENSE       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 3742  README        file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 13505 RELEASE_NOTES file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 6     VERSION       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 9257  regression.py file | revisions | annotate 
--rwxr-xr-x 2009-03-24 00:51 -0700 81285 waf           file | revisions | annotate 
--rwxr-xr-x 2009-03-24 00:51 -0700 28    waf.bat       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 26270 wscript       file | revisions | annotate 
--rw-r--r-- 2009-03-24 00:51 -0700 6636  wutils.py     file | revisions | annotate 
+drwxr-xr-x                               [up]     
+drwxr-xr-x                               bindings python  files
+drwxr-xr-x                               doc              files
+drwxr-xr-x                               examples         files
+drwxr-xr-x                               ns3              files
+drwxr-xr-x                               regression       files
+drwxr-xr-x                               samples          files
+drwxr-xr-x                               scratch          files
+drwxr-xr-x                               src              files
+drwxr-xr-x                               utils            files
+-rw-r--r-- 2009-07-01 12:47 +0200 560    .hgignore        file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 1886   .hgtags          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 1276   AUTHORS          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 30961  CHANGES.html     file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 17987  LICENSE          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 3742   README           file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 16171  RELEASE_NOTES    file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 6      VERSION          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 10946  regression.py    file | revisions | annotate
+-rwxr-xr-x 2009-07-01 12:47 +0200 88110  waf              file | revisions | annotate
+-rwxr-xr-x 2009-07-01 12:47 +0200 28     waf.bat          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 35395  wscript          file | revisions | annotate
+-rw-r--r-- 2009-07-01 12:47 +0200 7673   wutils.py        file | revisions | annotate
 @end verbatim
 
+Our example scripts are in the @code{examples} directory.  If you click on @code{examples}
+you will see a list of files.  One of the files in that directory is @code{first.cc}.  If
+you click on @code{first.cc} you will find the code you just walked through.
+
 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 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}.
+then 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 the 
+@code{abort.h} link, you will be sent to the source file for @code{abort.h} which 
+contains useful macros for exiting scripts if abnormal conditions are detected.
 
-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 
+The source code for the helpers we have used in this chapter can be found in the 
 @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	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/tutorial/getting-started.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -80,7 +80,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 26 changesets with 40 changes to 7 files
+  added 31 changesets with 45 changes to 7 files
   7 files updated, 0 files merged, 0 files removed, 0 files unresolved
 @end verbatim
 
@@ -126,8 +126,8 @@
 
 Since the release numbers are going to be changing, I will stick with 
 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
+string ``ns-3-dev'' with your choice of release (e.g., ns-3.5 and 
+ns-3.5-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 
 @uref{http://www.nsnam.org/getting_started.html,,``Getting Started''} 
 web page and looking for the latest release identifier.
@@ -138,13 +138,23 @@
 
 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
-@code{"ns-3.4"} and @code{"ns-3.4-ref-traces"} if you want to work with a 
+@code{"ns-3.5"} and @code{"ns-3.5-ref-traces"} if you want to work with a 
 stable release).
 
 @verbatim
   ./download.py -n ns-3-dev -r ns-3-dev-ref-traces
 @end verbatim
 
+Note that the default for the @code{-n} option is @code{ns-3-dev} and the 
+default for the @code{-r} option is @code{ns-3-dev-ref-traces} and so the
+above is actually redundant.  We provide this example to illustrate how to
+specify alternate repositories.  In order to download @code{ns-3-dev} you 
+can actually use the defaults and simply type,
+
+@verbatim
+  ./download.py
+@end verbatim
+
 As the hg (Mercurial) command executes, you should see something like the 
 following,
 
@@ -152,15 +162,15 @@
       #
       # Get NS-3
       #
-
+  
   Cloning ns-3 branch
    =>  hg clone http://code.nsnam.org/ns-3-dev ns-3-dev
   requesting all changes
   adding changesets
   adding manifests
   adding file changes
-  added 4292 changesets with 15368 changes to 1671 files
-  823 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  added 4634 changesets with 16500 changes to 1762 files
+  870 files updated, 0 files merged, 0 files removed, 0 files unresolved
 @end verbatim
 
 This is output by the download script as it fetches the actual @code{ns-3}
@@ -177,8 +187,8 @@
   adding changesets
   adding manifests
   adding file changes
-  added 79 changesets with 1102 changes to 222 files
-  206 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  added 86 changesets with 1178 changes to 259 files
+  208 files updated, 0 files merged, 0 files removed, 0 files unresolved
 @end verbatim
 
 This is the download script fetching the reference trace files for you.
@@ -191,10 +201,10 @@
       #
       # Get PyBindGen
       #
-  
-  Required pybindgen version:  0.10.0.630
+
+  Required pybindgen version:  0.10.0.640
   Trying to fetch pybindgen; this will fail if no network connection is available.  Hit Ctrl-C to skip.
-   =>  bzr checkout -rrevno:630 https://launchpad.net/pybindgen pybindgen
+   =>  bzr checkout -rrevno:640 https://launchpad.net/pybindgen pybindgen
   Fetch was successful.
 @end verbatim
 
@@ -205,7 +215,7 @@
       #
       # Get NSC
       #
-  
+
   Required NSC version:  nsc-0.5.0
   Retrieving nsc from https://secure.wand.net.nz/mercurial/nsc
    =>  hg clone https://secure.wand.net.nz/mercurial/nsc nsc
@@ -213,8 +223,8 @@
   adding changesets
   adding manifests
   adding file changes
-  added 270 changesets with 17375 changes to 14991 files
-  10614 files updated, 0 files merged, 0 files removed, 0 files unresolved 
+  added 273 changesets with 17565 changes to 15175 files
+  10622 files updated, 0 files merged, 0 files removed, 0 files unresolved
 @end verbatim
 
 This part of the process is the script downloading the Network Simulation
@@ -257,16 +267,16 @@
   cd
   mkdir tarballs
   cd tarballs
-  wget http://www.nsnam.org/releases/ns-allinone-3.4.tar.bz2
-  tar xjf ns-allinone-3.4.tar.bz2
+  wget http://www.nsnam.org/releases/ns-allinone-3.5.tar.bz2
+  tar xjf ns-allinone-3.5.tar.bz2
 @end verbatim 
 
-If you change into the directory @code{ns-allinone-3.4} you should see a
+If you change into the directory @code{ns-allinone-3.5} you should see a
 number of files:
 
 @verbatim
-build.py*     ns-3.4/             nsc-0.5.0/             README
-constants.py  ns-3.4-ref-traces/  pybindgen-0.10.0.630/  util.py
+build.py*     ns-3.5/             nsc-0.5.0/             README
+constants.py  ns-3.5-ref-traces/  pybindgen-0.10.0.640/  util.py
 @end verbatim 
 
 You are now ready to build the @command{ns-3} distribution.
@@ -288,7 +298,7 @@
 downloaded using Mercurial you should have a directory called 
 @code{ns-3-allinone} under your @code{~/repos} directory.  If you downloaded
 using a tarball you should have a directory called something like 
-@code{ns-3-allinone-3.4} under your @code{~/tarballs} directory.  Take a deep
+@code{ns-allinone-3.5} under your @code{~/tarballs} directory.  Take a deep
 breath and type the following:
 
 @verbatim
@@ -300,13 +310,13 @@
 following magic words:
 
 @verbatim
-  Build finished successfully (00:02:37)
-  Leaving directory `./ns-3-dev'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (2m30.586s)
 @end verbatim
 
 Once the project has built you can say goodbye to your old friends, the 
 @code{ns-3-allinone} scripts.  You got what you needed from them and will now 
-interact directly with Waf and we do it in the @code{ns-3-dev} directory and
+interact directly with Waf and we do it in the @code{ns-3-dev} directory,
 not in the @code{ns-3-allinone} directory.  Go ahead and change into the 
 @code{ns-3-dev} directory (or the directory for the appropriate release you
 downloaded.
@@ -340,76 +350,72 @@
 output that looks similar to the following,
 
 @verbatim
-Checking for program g++                 : ok /usr/bin/g++
-Checking for program cpp                 : ok /usr/bin/cpp
-Checking for program ar                  : ok /usr/bin/ar
-Checking for program ranlib              : ok /usr/bin/ranlib
-Checking for g++                         : ok
-Checking for program pkg-config          : ok /usr/bin/pkg-config
-Checking for regression reference traces  : ok ../ns-3-dev-ref-traces (guessed)
-Checking for -Wno-error=deprecated-declarations support : yes
-Checking for header stdlib.h                            : ok
-Checking for header signal.h                            : ok
-Checking for header pthread.h                           : ok
-Checking for high precision time implementation         : 128-bit integer
-Checking for header stdint.h                            : ok
-Checking for header inttypes.h                          : ok
-Checking for header sys/inttypes.h                      : not found
-Checking for library rt                                 : ok
-Checking for header netpacket/packet.h                  : ok
-Checking for header linux/if_tun.h                      : ok
-Checking for pkg-config flags for GTK_CONFIG_STORE      : ok
-Package libxml-2.0 was not found in the pkg-config search path.
-Perhaps you should add the directory containing `libxml-2.0.pc'
-to the PKG_CONFIG_PATH environment variable
-No package 'libxml-2.0' found
-Checking for pkg-config flags for LIBXML2               : not found
-Checking for library sqlite3                            : ok
-Checking for NSC location                               : ok ../nsc (guessed)
-Checking for library dl                                 : ok
-Checking for NSC supported architecture x86_64          : ok
-Package goocanvas was not found in the pkg-config search path.
-Perhaps you should add the directory containing `goocanvas.pc'
-to the PKG_CONFIG_PATH environment variable
-No package 'goocanvas' found
-Checking for pkg-config flags for MOBILITY_VISUALIZER   : not found
-Checking for program python                             : ok /usr/bin/python
-Checking for Python version >= 2.3                      : ok 2.5.2
-Checking for library python2.5                          : ok
-Checking for program python2.5-config                   : ok /usr/bin/python2.5-config
-Checking for header Python.h                            : ok
-Checking for -fvisibility=hidden support                : yes
-Checking for pybindgen location                         : ok ../pybindgen (guessed)
-Checking for Python module pybindgen                    : ok
-Checking for pybindgen version                          : ok 0.10.0.630
-Checking for Python module pygccxml                     : ok
-Checking for pygccxml version                           : ok 0.9.5
-Checking for program gccxml                             : ok /usr/local/bin/gccxml
-Checking for gccxml version                             : ok 0.9.0
-Checking for program sudo                               : ok /usr/bin/sudo
-Checking for program hg                                 : ok /usr/bin/hg
-Checking for program valgrind                           : ok /usr/bin/valgrind
----- Summary of optional NS-3 features:
-Threading Primitives          : enabled
-Real Time Simulator           : enabled
-Emulated Net Device           : enabled
-Tap Bridge                    : enabled
-GtkConfigStore                : enabled
-XmlIo                         : not enabled (library 'libxml-2.0 >= 2.7' not found)
-SQlite stats data output      : enabled
-Network Simulation Cradle     : enabled
-Python Bindings               : enabled
-Python API Scanning Support   : enabled
-Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
-Configuration finished successfully (00:00:02); project is now ready to build.
+  Checking for program g++                 : ok /usr/bin/g++
+  Checking for program cpp                 : ok /usr/bin/cpp
+  Checking for program ar                  : ok /usr/bin/ar
+  Checking for program ranlib              : ok /usr/bin/ranlib
+  Checking for g++                         : ok
+  Checking for program pkg-config          : ok /usr/bin/pkg-config
+  Checking for regression reference traces  : ok ../ns-3-dev-ref-traces (guessed)
+  Checking for -Wno-error=deprecated-declarations support : yes
+  Checking for -Wl,--soname=foo support                   : yes
+  Checking for header stdlib.h                            : ok
+  Checking for header signal.h                            : ok
+  Checking for header pthread.h                           : ok
+  Checking for high precision time implementation         : 128-bit integer
+  Checking for header stdint.h                            : ok
+  Checking for header inttypes.h                          : ok
+  Checking for header sys/inttypes.h                      : not found
+  Checking for library rt                                 : ok
+  Checking for header netpacket/packet.h                  : ok
+  Checking for pkg-config flags for GSL                   : ok
+  Checking for header linux/if_tun.h                      : ok
+  Checking for pkg-config flags for GTK_CONFIG_STORE      : ok
+  Checking for pkg-config flags for LIBXML2               : ok
+  Checking for library sqlite3                            : ok
+  Checking for NSC location                               : ok ../nsc (guessed)
+  Checking for library dl                                 : ok
+  Checking for NSC supported architecture x86_64          : ok
+  Checking for program python                             : ok /usr/bin/python
+  Checking for Python version >= 2.3                      : ok 2.5.2
+  Checking for library python2.5                          : ok
+  Checking for program python2.5-config                   : ok /usr/bin/python2.5-config
+  Checking for header Python.h                            : ok
+  Checking for -fvisibility=hidden support                : yes
+  Checking for pybindgen location                         : ok ../pybindgen (guessed)
+  Checking for Python module pybindgen                    : ok
+  Checking for pybindgen version                          : ok 0.10.0.640
+  Checking for Python module pygccxml                     : ok
+  Checking for pygccxml version                           : ok 0.9.5
+  Checking for program gccxml                             : ok /usr/local/bin/gccxml
+  Checking for gccxml version                             : ok 0.9.0
+  Checking for program sudo                               : ok /usr/bin/sudo
+  Checking for program hg                                 : ok /usr/bin/hg
+  Checking for program valgrind                           : ok /usr/bin/valgrind
+  ---- Summary of optional NS-3 features:
+  Threading Primitives          : enabled
+  Real Time Simulator           : enabled
+  Emulated Net Device           : enabled
+  GNU Scientific Library (GSL)  : enabled
+  Tap Bridge                    : enabled
+  GtkConfigStore                : enabled
+  XmlIo                         : enabled
+  SQlite stats data output      : enabled
+  Network Simulation Cradle     : enabled
+  Python Bindings               : enabled
+  Python API Scanning Support   : enabled
+  Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
+  Static build                  : not enabled (option --enable-static not selected)
+  'configure' finished successfully (2.870s)
 @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.
 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
-certain programs.  This was not enabled by default.
+system.  If this library were not found, the corresponding @command{ns-3} feature 
+would not be enabled and a message would be displayed.  Note further that there is 
+a feature to use the progarm @code{sudo} to set the suid bit of certain programs.
+This is not enabled by default and so this feature is reported as ``not enabled.''
 
 Now go ahead and switch back to the debug build.
 
@@ -427,15 +433,15 @@
 Some waf commands are meaningful during the build phase and some commands are valid
 in the configuration phase.  For example, if you wanted to use the emulation 
 features of @command{ns-3} you might want to enable setting the suid bit using
-sudo.  This is a configuration command, and so you could have run the following
-command
+sudo as described above.  This turns out to be a configuration-time command, and so 
+you could reconfigure using the following command
 
 @verbatim
   ./waf -d debug --enable-sudo configure
 @end verbatim
 
-If you had done this, waf would have run sudo to change the socket creator 
-programs to run as root.  There are many other configure- and build-time options
+If you do this, waf will have run sudo to change the socket creator programs of the
+emulation code to run as root.  There are many other configure- and build-time options
 available in waf.  To explore these options, type:
 
 @verbatim
@@ -462,26 +468,45 @@
   ./waf --check
 @end verbatim
 
-You should see a report from each unit test that executes indicating that the
-test has passed.
+These tests are run in parallel by waf, so the summary, ``Ran n tests'' will 
+appear as soon as all of the tasks are launched, but you should eventually
+see a report saying that,
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
-  -- Running NS-3 C++ core unit tests...
-  PASS AddressHelper
-  PASS Wifi
-  PASS DcfManager
-  ...
-  PASS Object
-  PASS Ptr
-  PASS Callback
-  -- Running NS-3 Python bindings unit tests...
+  C++ UNIT TESTS: all 33 tests passed.
+@end verbatim
+
+This is the important message.
+
+You will also see output from the test runner and waf task sequence numbers
+the output will actually look something like,
+
+@verbatim
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  [707/709] get-unit-tests-list
+  [708/709] run-python-unit-tests
+  [709/709] print-introspected-doxygen
+  [710/743] run-unit-test(AddressHelper)
+  [711/743] run-unit-test(Wifi)
   ...........
   ----------------------------------------------------------------------
   Ran 11 tests in 0.003s
+  
+  OK
+  [712/743] run-unit-test(DcfManager)
+  [713/743] run-unit-test(MacRxMiddle)
+  [714/743] run-unit-test(Ipv4ListRouting)
 
-  OK
+  ...
+
+  [739/743] run-unit-test(RandomVariable)
+  [740/743] run-unit-test(Object)
+  [741/743] run-unit-test(Ptr)
+  [742/743] run-unit-test(Callback)
+  [743/743] collect-unit-tests-results
+  C++ UNIT TESTS: all 33 tests passed.
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (1.799s)
 @end verbatim
 
 This command is typically run by @code{users} to quickly verify that an 
@@ -491,10 +516,10 @@
 You can also run our regression test suite to ensure that your distribution and
 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
-and require you to be online when you run regression tests because they
-dynamically synchronize the reference traces directory with an online
+your machine during the @code{./download.py} process above.  (Warning:  The 
+@code{ns-3.2} and @code{ns-3.3} releases do not use the @code{ns-3-allinone} 
+environment and require you to be online when you run regression tests because 
+hey dynamically synchronize the reference traces directory with an online
 repository immediately prior to the run).
 
 During regression testing Waf will run a number of tests that generate what we
@@ -509,6 +534,9 @@
 Some regression tests may be SKIPped if the required support
 is not present.
 
+Note that the regression tests are also run in parallel and so the messages
+may be interleaved.
+
 To run the regression tests, you provide Waf with the regression flag.
 
 @verbatim
@@ -530,7 +558,8 @@
   ...
   Regression testing summary:
   PASS: 22 of 22 tests passed
-  Build finished successfully (00:00:23)
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (25.826s)
 @end verbatim
 
 If you want to take a look at an example of what might be checked during
--- a/doc/tutorial/introduction.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/tutorial/introduction.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -75,7 +75,7 @@
 generates pcap packet trace files, other utilities can be used to
 analyze traces as well.
 In this tutorial, we will first concentrate on scripting 
-directly in C++ and interpreting results via ascii trace files.  
+directly in C++ and interpreting results via trace files.  
 
 But there are similarities as well (both, for example, are based on C++ 
 objects, and some code from ns-2 has already been ported to @command{ns-3}).
@@ -256,8 +256,8 @@
 software toolchain is the set of programming tools available in the given 
 environment. For a quick review of what is included in the GNU toolchain see,
 @uref{http://en.wikipedia.org/wiki/GNU_toolchain}.  @command{ns-3} uses gcc, 
-GNU binutils, and gdb.  However, we do not use the GNU build system,
-either make or autotools, using Waf instead.
+GNU binutils, and gdb.  However, we do not use the GNU build system tools, 
+neither make nor autotools.  We use Waf for these functions.
 
 @cindex Linux
 Typically an @command{ns-3} author will work in Linux or a Linux-like
@@ -265,11 +265,11 @@
 which simulate the Linux environment to various degrees.  The @command{ns-3} 
 project supports development in the Cygwin environment for 
 these users.  See @uref{http://www.cygwin.com/} 
-for details on downloading (MinGW is presently not supported).
-Cygwin provides many of the popular Linux system commands.
-It can, however, sometimes be problematic due to the way it actually does its 
-emulation, and sometimes interactions with other Windows software can cause 
-problems.
+for details on downloading (MinGW is presently not officially supported,
+although some of the project maintainers to work with it). Cygwin provides 
+many of the popular Linux system commands.  It can, however, sometimes be 
+problematic due to the way it actually does its emulation, and sometimes
+interactions with other Windows software can cause problems.
 
 @cindex Cygwin
 @cindex MinGW
--- a/doc/tutorial/tweaking.texi	Wed Jul 01 21:54:24 2009 +0400
+++ b/doc/tutorial/tweaking.texi	Fri Jul 03 09:59:04 2009 +0400
@@ -89,7 +89,8 @@
 @subsection Enabling Logging
 @cindex NS_LOG
 Let's use the NS_LOG environment variable to turn on some more logging, but
-to get our bearings, go ahead and run the script just as you did previously,
+first, just to get our bearings, go ahead and run the last script just as you 
+did previously,
 
 @verbatim
   ./waf --run scratch/myfirst
@@ -99,8 +100,9 @@
 program
 
 @verbatim
-  Entering directory `repos/ns-3-dev/build'
-  Compilation finished successfully
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.413s)
   Sent 1024 bytes to 10.1.1.2
   Received 1024 bytes from 10.1.1.1
   Received 1024 bytes from 10.1.1.2
@@ -148,15 +150,17 @@
 system will pick up the change and you should see the following output:
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.404s)
   UdpEchoClientApplication:UdpEchoClient()
+  UdpEchoClientApplication:SetDataSize(1024)
   UdpEchoClientApplication:StartApplication()
   UdpEchoClientApplication:ScheduleTransmit()
   UdpEchoClientApplication:Send()
   Sent 1024 bytes to 10.1.1.2
   Received 1024 bytes from 10.1.1.1
-  UdpEchoClientApplication:HandleRead(0x638180, 0x6389b0)
+  UdpEchoClientApplication:HandleRead(0x6241e0, 0x624a20)
   Received 1024 bytes from 10.1.1.2
   UdpEchoClientApplication:StopApplication()
   UdpEchoClientApplication:DoDispose()
@@ -186,7 +190,7 @@
 It turns out that in some cases, it can be hard to determine which method
 actually generates a log message.  If you look in the text above, you may
 wonder where the string ``@code{Received 1024 bytes from 10.1.1.2}'' comes
-from.  You can resolve this by ORing the @code{prefix_func} level into the
+from.  You can resolve this by OR'ing the @code{prefix_func} level into the
 @code{NS_LOG} environment variable.  Try doing the following,
 
 @verbatim
@@ -201,15 +205,17 @@
 name.
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.417s)
   UdpEchoClientApplication:UdpEchoClient()
+  UdpEchoClientApplication:SetDataSize(1024)
   UdpEchoClientApplication:StartApplication()
   UdpEchoClientApplication:ScheduleTransmit()
   UdpEchoClientApplication:Send()
   UdpEchoClientApplication:Send(): Sent 1024 bytes to 10.1.1.2
   Received 1024 bytes from 10.1.1.1
-  UdpEchoClientApplication:HandleRead(0x638180, 0x6389b0)
+  UdpEchoClientApplication:HandleRead(0x6241e0, 0x624a20)
   UdpEchoClientApplication:HandleRead(): Received 1024 bytes from 10.1.1.2
   UdpEchoClientApplication:StopApplication()
   UdpEchoClientApplication:DoDispose()
@@ -236,10 +242,12 @@
 in debugging problems.
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.406s)
   UdpEchoServerApplication:UdpEchoServer()
   UdpEchoClientApplication:UdpEchoClient()
+  UdpEchoClientApplication:SetDataSize(1024)
   UdpEchoServerApplication:StartApplication()
   UdpEchoClientApplication:StartApplication()
   UdpEchoClientApplication:ScheduleTransmit()
@@ -247,7 +255,7 @@
   UdpEchoClientApplication:Send(): Sent 1024 bytes to 10.1.1.2
   UdpEchoServerApplication:HandleRead(): Received 1024 bytes from 10.1.1.1
   UdpEchoServerApplication:HandleRead(): Echoing packet
-  UdpEchoClientApplication:HandleRead(0x638320, 0x638b50)
+  UdpEchoClientApplication:HandleRead(0x624920, 0x625160)
   UdpEchoClientApplication:HandleRead(): Received 1024 bytes from 10.1.1.2
   UdpEchoServerApplication:StopApplication()
   UdpEchoClientApplication:StopApplication()
@@ -269,10 +277,12 @@
 you should see the following output:
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.418s)
   0s UdpEchoServerApplication:UdpEchoServer()
   0s UdpEchoClientApplication:UdpEchoClient()
+  0s UdpEchoClientApplication:SetDataSize(1024)
   1s UdpEchoServerApplication:StartApplication()
   2s UdpEchoClientApplication:StartApplication()
   2s UdpEchoClientApplication:ScheduleTransmit()
@@ -280,7 +290,7 @@
   2s UdpEchoClientApplication:Send(): Sent 1024 bytes to 10.1.1.2
   2.00369s UdpEchoServerApplication:HandleRead(): Received 1024 bytes from 10.1.1.1
   2.00369s UdpEchoServerApplication:HandleRead(): Echoing packet
-  2.00737s UdpEchoClientApplication:HandleRead(0x638490, 0x638cc0)
+  2.00737s UdpEchoClientApplication:HandleRead(0x624290, 0x624ad0)
   2.00737s UdpEchoClientApplication:HandleRead(): Received 1024 bytes from 10.1.1.2
   10s UdpEchoServerApplication:StopApplication()
   10s UdpEchoClientApplication:StopApplication()
@@ -292,22 +302,22 @@
 
 You can see that the constructor for the UdpEchoServer was called at a 
 simulation time of 0 seconds.  This is actually happening before the 
-simulation starts.  The same for the UdpEchoClient constructor.
+simulation starts, but the time is displayed as zero seconds.  The same is true
+for the UdpEchoClient constructor message.
 
 Recall that the @code{scratch/first.cc} script started the echo server 
 application at one second into the simulation.  You can now see that the 
-@code{StartApplication} method of the server is, in fact, called at one second
-(or one billion nanoseconds).  You can also see that the echo client 
-application is started at a simulation time of two seconds as we requested in
-the script.
+@code{StartApplication} method of the server is, in fact, called at one second.
+You can also see that the echo client application is started at a simulation 
+time of two seconds as we requested in the script.
 
 You can now follow the progress of the simulation from the 
 @code{ScheduleTransmit} call in the client that calls @code{Send} to the 
 @code{HandleRead} callback in the echo server application.  Note that the 
-elapsed time as the packet is sent across the point-to-point link is 3.6864
+elapsed time for the packet to be sent across the point-to-point link is 3.69
 milliseconds.  You see the echo server logging a message telling you that it
-has echoed the packet and then, after a delay, you see the echo client receive
-the echoed packet in its @code{HandleRead} method.
+has echoed the packet and then, after another channel delay, you see the echo
+client receive the echoed packet in its @code{HandleRead} method.
 
 There is a lot that is happening under the covers in this simulation that you
 are not seeing as well.  You can very easily follow the entire process by
@@ -320,7 +330,7 @@
 
 The asterisk above is the logging component wildcard.  This will turn on all 
 of the logging in all of the components used in the simulation.  I won't 
-reproduce the output here (as of this writing it produces 974 lines of output
+reproduce the output here (as of this writing it produces 1265 lines of output
 for the single packet echo) but you can redirect this information into a file 
 and look through it with your favorite editor if you like,
 
@@ -328,15 +338,16 @@
   ./waf --run scratch/myfirst > log.out 2>&1
 @end verbatim
 
-I personally use this volume of logging quite a bit when I am presented with 
-a problem and I have no idea where things are going wrong.  I can follow the 
+I personally use this extremely verbose version of logging when I am presented 
+with a problem and I have no idea where things are going wrong.  I can follow the 
 progress of the code quite easily without having to set breakpoints and step 
-through code in a debugger.  When I have a general idea about what is going 
-wrong, I transition into a debugger for fine-grained examination of the 
-problem.  This kind of output can be especially useful when your script does 
-something completely unexpected.  If you are stepping using a debugger you
-may miss an unexpected excursion completely.  Logging the excursion makes it
-quickly visible.
+through code in a debugger.  I can just edit up the output in my favorite editor
+and search around for things I expect, and see things happening that I don't 
+expect.  When I have a general idea about what is going wrong, I transition into
+a debugger for a fine-grained examination of the problem.  This kind of output 
+can be especially useful when your script does something completely unexpected.
+If you are stepping using a debugger you may miss an unexpected excursion 
+completely.  Logging the excursion makes it quickly visible.
 
 @node Adding Logging to your Code
 @subsection Adding Logging to your Code
@@ -399,8 +410,9 @@
 message,
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.404s)
   Creating Topology
   Sent 1024 bytes to 10.1.1.2
   Received 1024 bytes from 10.1.1.1
@@ -453,8 +465,11 @@
 now see the @code{--PrintHelp} argument and respond with,
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.413s)
+  TcpL4Protocol:TcpStateMachine()
+  CommandLine:HandleArgument(): Handle arg name=PrintHelp value=
   --PrintHelp: Print this help message.
   --PrintGroups: Print the list of groups.
   --PrintTypeIds: Print all TypeIds.
@@ -527,7 +542,9 @@
 If you run the script, you should now see the following output,
 
 @verbatim
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.405s)
   0s UdpEchoServerApplication:UdpEchoServer()
   1s UdpEchoServerApplication:StartApplication()
   Sent 1024 bytes to 10.1.1.2
@@ -589,8 +606,9 @@
 @code{DataRate} and @code{Delay} in the script:
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/bu
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/bui
+  'build' finished successfully (0.417s)
   0s UdpEchoServerApplication:UdpEchoServer()
   1s UdpEchoServerApplication:StartApplication()
   Sent 1024 bytes to 10.1.1.2
@@ -608,13 +626,13 @@
 to some other value than one.
 
 How would you go about that?  Give it a try.  Remember you have to comment 
-out the place we override the default @code{Attribute} in the script.  Then you 
-have to rebuild the script using the default.  You will also have to find the
-syntax for actually setting the new default atribute value using the command
-line help facility.  Once you have this figured out you should be able to
-control the number of packets echoed from the command line.  Since we're nice
-folks, we'll tell you that your command line should end up looking something
-like,
+out the place we override the default @code{Attribute} and explicitly set 
+@code{MaxPackets} in the script.  Then you have to rebuild the script.  You 
+will also have to find the syntax for actually setting the new default atribute
+value using the command line help facility.  Once you have this figured out 
+you should be able to control the number of packets echoed from the command 
+line.  Since we're nice folks, we'll tell you that your command line should 
+end up looking something like,
 
 @verbatim
   ./waf --run "scratch/myfirst 
@@ -666,8 +684,9 @@
 @end verbatim
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.403s)
   --PrintHelp: Print this help message.
   --PrintGroups: Print the list of groups.
   --PrintTypeIds: Print all TypeIds.
@@ -688,8 +707,9 @@
 You should now see
 
 @verbatim
-  Entering directory `repos/ns-3-allinone/ns-3-dev/build'
-  Build finished successfully (00:00:00)
+  Waf: Entering directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone-3.5-tutorial/ns-3-dev/build'
+  'build' finished successfully (0.404s)
   0s UdpEchoServerApplication:UdpEchoServer()
   1s UdpEchoServerApplication:StartApplication()
   Sent 1024 bytes to 10.1.1.2
@@ -705,7 +725,7 @@
   UdpEchoServerApplication:~UdpEchoServer()
 @end verbatim
 
-You have now echoed two packets.
+You have now echoed two packets.  Pretty easy, isn't it?
 
 You can see that if you are an @command{ns-3} user, you can use the command 
 line argument system to control global values and @code{Attributes}.  If you are
@@ -827,7 +847,7 @@
 
 @cindex myfirst.tr
 Just as you have seen many times before, you will see some messages from Waf and then
-the ``Build finished successfully'' with some number of messages from 
+``'build' finished successfully'' with some number of messages from 
 the running program.  
 
 When it ran, the program will have created a file named @code{myfirst.tr}.  
--- a/examples/csma-bridge-one-hop.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/csma-bridge-one-hop.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -74,7 +74,6 @@
 #include "ns3/core-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/bridge-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -142,9 +141,10 @@
   BridgeHelper bridge;
   bridge.Install (bridge1, topBridgeDevices);
 
-  // Add internet stack to the topLan nodes
+  // Add internet stack to the router nodes
+  NodeContainer routerNodes (n0, n1, n2, n3, n4);
   InternetStackHelper internet;
-  internet.Install (topLan);
+  internet.Install (routerNodes);
 
   // Repeat for bottom bridged LAN
   NetDeviceContainer bottomLanDevices;
@@ -158,9 +158,6 @@
     }
   bridge.Install (bridge2, bottomBridgeDevices);
 
-  // Add internet stack to the bottomLan nodes
-  internet.Install (NodeContainer (n3, n4));
-
   // We've got the "hardware" in place.  Now we need to add IP addresses.
   NS_LOG_INFO ("Assign IP Addresses.");
   Ipv4AddressHelper ipv4;
@@ -174,8 +171,7 @@
   // tables in the nodes.  We excuse the bridge nodes from having to serve as
   // routers, since they don't even have internet stacks on them.
   //
-  NodeContainer routerNodes (n0, n1, n2, n3, n4);
-  GlobalRouteManager::PopulateRoutingTables (routerNodes);
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   //
   // Create an OnOff application to send UDP datagrams from node zero to node 1.
--- a/examples/csma-broadcast.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/csma-broadcast.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -102,8 +102,10 @@
   // Create an optional packet sink to receive these packets
   PacketSinkHelper sink ("ns3::UdpSocketFactory",
     Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
-  sink.Install (c0.Get (1));
-  sink.Install (c1.Get (1));
+  app = sink.Install (c0.Get (1));
+  app.Add (sink.Install (c1.Get (1)));
+  app.Start (Seconds (1.0));
+  app.Stop (Seconds (10.0));
 
   // Also configure some tcpdump traces; each interface will be traced
   // The output files will be named 
--- a/examples/csma-ping.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/csma-ping.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -37,7 +37,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -85,7 +84,7 @@
   Ipv4InterfaceContainer addresses = ip.Assign (devs);
 
   // setup global router
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
   NS_LOG_INFO ("Create Source");
   Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
   InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
--- a/examples/csma-star.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/csma-star.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -20,7 +20,6 @@
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/csma-module.h"
-#include "ns3/global-route-manager.h"
 
 // Network topology (default)
 //
@@ -196,7 +195,7 @@
   //
   // Turn on global static routing so we can actually be routed across the star.
   //
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   NS_LOG_INFO ("Enable pcap tracing.");
   //
--- a/examples/dynamic-global-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/dynamic-global-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -63,9 +63,11 @@
 //    will start to be dropped 
 //  At time 13s, call RecomputeRoutingTables() and traffic will
 //    start flowing again on the alternate path
-//  At time 14s, re-enable the n1/n6 interface to up.  Will not change routing
-//  At time 15s, call RecomputeRoutingTables() and traffic will start flowing 
-//    again on the original path
+//  At time 14s, re-enable the n1/n6 interface to up.  This will change 
+//    routing back to n1-n6 since the interface up notification will cause
+//    a new local interface route, at higher priority than global routing
+//  At time 15s, call RecomputeRoutingTables(), but there is no effect
+//    since global routing is lower in priority than static routing
 //  At time 16s, stop the second flow.  
 
 // - Tracing of queues and packet receptions to file "dynamic-global-routing.tr"
@@ -79,7 +81,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -145,7 +146,7 @@
 
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
@@ -204,9 +205,9 @@
   uint32_t ipv4ifIndex1 = 2;
 
   Simulator::Schedule (Seconds (2),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
-  Simulator::Schedule (Seconds (3),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (3),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
   Simulator::Schedule (Seconds (4),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
-  Simulator::Schedule (Seconds (5),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (5),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
 
   Ptr<Node> n6 = c.Get (6);
   Ptr<Ipv4> ipv46 = n6->GetObject<Ipv4> ();
@@ -214,14 +215,14 @@
   // then the next p2p is numbered 2
   uint32_t ipv4ifIndex6 = 2;
   Simulator::Schedule (Seconds (6),&Ipv4::SetDown,ipv46, ipv4ifIndex6);
-  Simulator::Schedule (Seconds (7),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (7),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
   Simulator::Schedule (Seconds (8),&Ipv4::SetUp,ipv46, ipv4ifIndex6);
-  Simulator::Schedule (Seconds (9),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (9),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
 
   Simulator::Schedule (Seconds (12),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
-  Simulator::Schedule (Seconds (13),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (13),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
   Simulator::Schedule (Seconds (14),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
-  Simulator::Schedule (Seconds (15),&GlobalRouteManager::RecomputeRoutingTables);
+  Simulator::Schedule (Seconds (15),&Ipv4GlobalRoutingHelper::RecomputeRoutingTables);
 
   NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();
--- a/examples/emu-ping.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/emu-ping.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -102,10 +102,7 @@
   // Since we are going to be talking to real-world machines, we need to enable
   // calculation of checksums in our protocols.
   //
-  Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true)); 
+  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
 
   //
   // In such a simple topology, the use of the helper API can be a hindrance
--- a/examples/global-routing-slash32.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/global-routing-slash32.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -29,7 +29,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -99,7 +98,7 @@
  
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
--- a/examples/mixed-global-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/mixed-global-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -40,7 +40,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -104,7 +103,7 @@
 
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
--- a/examples/mixed-wireless.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/mixed-wireless.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -67,7 +67,6 @@
 #include "ns3/mobility-module.h"
 #include "ns3/contrib-module.h"
 #include "ns3/wifi-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -152,11 +151,21 @@
   YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
   wifiPhy.SetChannel (wifiChannel.Create ());
   NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone);
+
+  // We enable OLSR (which will be consulted at a higher priority than
+  // the global routing) on the backbone ad hoc nodes
+  NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes");
+  OlsrHelper olsr;
   //
   // Add the IPv4 protocol stack to the nodes in our container
   //
   InternetStackHelper internet;
+  internet.SetRoutingHelper (olsr);
   internet.Install (backbone);
+
+  // re-initialize for non-olsr routing.
+  internet = InternetStackHelper ();
+
   //
   // Assign IPv4 addresses to the device drivers (actually to the associated
   // IPv4 interfaces) we just created.
@@ -322,13 +331,7 @@
   // However, it is useful for setting default routes for all of the nodes
   // such as the LAN nodes.  
   NS_LOG_INFO ("Enabling global routing on all nodes");
-  GlobalRouteManager::PopulateRoutingTables ();
-
-  // We enable OLSR (which will be consulted at a higher priority than
-  // the global routing above) on the backbone ad hoc nodes
-  NS_LOG_INFO ("Enabling OLSR routing on all backbone nodes");
-  OlsrHelper olsr;
-  olsr.Install (backbone);
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   /////////////////////////////////////////////////////////////////////////// 
   //                                                                       //
--- a/examples/second.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/second.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -18,7 +18,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
 
 // Default Network Topology
 //
@@ -102,7 +101,7 @@
   clientApps.Start (Seconds (2.0));
   clientApps.Stop (Seconds (10.0));
 
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   PointToPointHelper::EnablePcapAll ("second");
   CsmaHelper::EnablePcap ("second", csmaDevices.Get (1), true);
--- a/examples/simple-alternate-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/simple-alternate-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -41,7 +41,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -53,7 +52,7 @@
   // Users may find it convenient to turn on explicit debugging
   // for selected modules; the below lines suggest how to do this
 #if 0 
-  LogComponentEnable("GlobalRouteManager", LOG_LOGIC);
+  LogComponentEnable("GlobalRoutingHelper", LOG_LOGIC);
   LogComponentEnable("GlobalRouter", LOG_LOGIC);
 #endif
 
@@ -130,7 +129,7 @@
 
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams 
   NS_LOG_INFO ("Create Application.");
--- a/examples/simple-error-model.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/simple-error-model.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -44,7 +44,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -111,7 +110,7 @@
   Ipv4InterfaceContainer i3i2 = ipv4.Assign (d3d2);
 
   NS_LOG_INFO ("Use global routing.");
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
--- a/examples/simple-global-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/simple-global-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -46,7 +46,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -111,7 +110,7 @@
 
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
--- a/examples/simple-point-to-point-olsr.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/simple-point-to-point-olsr.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -82,7 +82,18 @@
   NodeContainer n32 = NodeContainer (c.Get(3), c.Get (2));
   NodeContainer n34 = NodeContainer (c.Get (3), c.Get (4));
 
+  // Enable OLSR
+  NS_LOG_INFO ("Enabling OLSR Routing.");
+  OlsrHelper olsr;
+
+  Ipv4StaticRoutingHelper staticRouting;
+
+  Ipv4ListRoutingHelper list;
+  list.Add (staticRouting, 0);
+  list.Add (olsr, 10);
+
   InternetStackHelper internet;
+  internet.SetRoutingHelper (list);
   internet.Install (c);
 
   // We create the channels first without any IP addressing information
@@ -112,11 +123,6 @@
   ipv4.SetBase ("10.1.4.0", "255.255.255.0");
   Ipv4InterfaceContainer i34 = ipv4.Assign (nd34);
 
-  // Enable OLSR
-  NS_LOG_INFO ("Enabling OLSR Routing.");
-  OlsrHelper olsr;
-  olsr.InstallAll ();
-
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
--- a/examples/simple-wifi-frame-aggregation.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/simple-wifi-frame-aggregation.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -21,7 +21,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
 #include "ns3/wifi-module.h"
 #include "ns3/mobility-module.h"
 
@@ -137,7 +136,7 @@
   clientApps.Start (Seconds (2.0));
   clientApps.Stop (Seconds (10.0));
 
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   Simulator::Stop (Seconds (10.0));
   
--- a/examples/star.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/star.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -19,7 +19,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 // Network topology (default)
 //
@@ -132,7 +131,7 @@
   //
   // Turn on global static routing so we can actually be routed across the star.
   //
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   NS_LOG_INFO ("Enable pcap tracing.");
   //
--- a/examples/stats/wifi-example-apps.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/stats/wifi-example-apps.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -250,11 +250,14 @@
     }
 
     TimestampTag timestamp;
-    packet->FindFirstMatchingByteTag(timestamp);
-    Time tx = timestamp.GetTimestamp();
+    // Should never not be found since the sender is adding it, but
+    // you never know.
+    if (packet->FindFirstMatchingByteTag(timestamp)) {
+      Time tx = timestamp.GetTimestamp();
 
-    if (m_delay != 0) {
-      m_delay->Update(Simulator::Now() - tx);
+      if (m_delay != 0) {
+        m_delay->Update(Simulator::Now() - tx);
+      }
     }
 
     if (m_calc != 0) {
--- a/examples/stats/wifi-example-sim.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/stats/wifi-example-sim.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -54,9 +54,8 @@
 
 
 void TxCallback(Ptr<CounterCalculator<uint32_t> > datac,
-                std::string path, Ptr<const Packet> packet,
-                Mac48Address realto) {
-  NS_LOG_INFO("Sent frame to " << realto << "; counted in " <<
+                std::string path, Ptr<const Packet> packet) {
+  NS_LOG_INFO("Sent frame counted in " <<
               datac->GetKey());
   datac->Update();
   // end TxCallback
@@ -201,7 +200,7 @@
   Ptr<CounterCalculator<uint32_t> > totalTx =
     CreateObject<CounterCalculator<uint32_t> >();
   totalTx->SetKey("wifi-tx-frames");
-  Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Tx",
+  Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
                   MakeBoundCallback(&TxCallback, totalTx));
   data.AddDataCalculator(totalTx);
 
@@ -212,9 +211,9 @@
   Ptr<PacketCounterCalculator> totalRx =
     CreateObject<PacketCounterCalculator>();
   totalRx->SetKey("wifi-rx-frames");
-  Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Rx",
-                  MakeCallback(&PacketCounterCalculator::FrameUpdate,
-                                    totalRx));
+  Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
+                  MakeCallback(&PacketCounterCalculator::PacketUpdate,
+                               totalRx));
   data.AddDataCalculator(totalRx);
 
 
--- a/examples/tap-wifi-dumbbell.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/tap-wifi-dumbbell.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -114,7 +114,6 @@
 #include "ns3/core-module.h"
 #include "ns3/wifi-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
 
 using namespace ns3;
 
@@ -132,11 +131,7 @@
   cmd.Parse (argc, argv);
 
   GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
-
-  Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true)); 
+  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
 
   //
   // The topology has a Wifi network of four nodes on the left side.  We'll make
@@ -231,8 +226,8 @@
   apps = sink.Install (nodesRight.Get (0));
   apps.Start (Seconds (1.0));
 
-  CsmaHelper::EnablePcapAll ("tap-dumbbell", false);
-  GlobalRouteManager::PopulateRoutingTables ();
+  CsmaHelper::EnablePcapAll ("tap-wifi-dumbbell", false);
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   Simulator::Stop (Seconds (60.));
   Simulator::Run ();
--- a/examples/tcp-large-transfer.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/tcp-large-transfer.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -39,15 +39,20 @@
 #include "ns3/core-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/node-module.h"
-#include "ns3/global-route-manager.h"
 #include "ns3/simulator-module.h"
 
 using namespace ns3;
 
 NS_LOG_COMPONENT_DEFINE ("TcpLargeTransfer");
 
+
 // The number of bytes to send in this simulation.
-static uint32_t txBytes = 2000000;
+static const uint32_t totalTxBytes = 2000000;
+static uint32_t currentTxBytes = 0;
+// Perform series of 1040 byte writes (this is a multiple of 26 since
+// we want to detect data splicing in the output stream)
+static const uint32_t writeSize = 1040;
+uint8_t data[writeSize];
 
 // These are for starting the writing process, and handling the sending 
 // socket's notification upcalls (events).  These two together more or less
@@ -75,6 +80,13 @@
   CommandLine cmd;
   cmd.Parse (argc, argv);
 
+  // initialize the tx buffer.
+  for(uint32_t i = 0; i < writeSize; ++i)
+    {
+      char m = toascii (97 + i % 26);
+      data[i] = m;
+    }
+
   // Here, we will explicitly create three nodes.  The first container contains
   // nodes 0 and 1 from the diagram above, and the second one contains nodes
   // 1 and 2.  This reflects the channel connectivity, and will be used to
@@ -98,9 +110,8 @@
   NetDeviceContainer dev1 = p2p.Install (n1n2);
 
   // Now add ip/tcp stack to all nodes.
-  NodeContainer allNodes = NodeContainer (n0n1, n1n2.Get (1));
   InternetStackHelper internet;
-  internet.Install (allNodes);
+  internet.InstallAll ();
 
   // Later, we add IP addresses.
   Ipv4AddressHelper ipv4;
@@ -110,7 +121,7 @@
   Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
 
   // and setup ip routing tables to get total ip-level connectivity.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   ///////////////////////////////////////////////////////////////////////////
   // Simulation 1
@@ -184,38 +195,25 @@
   // tell the tcp implementation to call WriteUntilBufferFull again
   // if we blocked and new tx buffer space becomes available
   localSocket->SetSendCallback (MakeCallback (&WriteUntilBufferFull));
-  WriteUntilBufferFull (localSocket, txBytes);
+  WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
 }
 
 void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
 {
-  // Perform series of 1040 byte writes (this is a multiple of 26 since
-  // we want to detect data splicing in the output stream)
-  uint32_t writeSize = 1040;
-  uint8_t data[writeSize];
-
-  while (txBytes > 0) {
-    uint32_t curSize= txBytes > writeSize ? writeSize : txBytes;
-    if (curSize > txSpace)
-      curSize = txSpace;
-    for(uint32_t i = 0; i < curSize; ++i)
+  while (currentTxBytes < totalTxBytes && localSocket->GetTxAvailable () > 0) 
     {
-      char m = toascii (97 + i % 26);
-      data[i] = m;
+      uint32_t left = totalTxBytes - currentTxBytes;
+      uint32_t dataOffset = currentTxBytes % writeSize;
+      uint32_t toWrite = writeSize - dataOffset;
+      toWrite = std::min (toWrite, left);
+      toWrite = std::min (toWrite, localSocket->GetTxAvailable ());
+      int amountSent = localSocket->Send (&data[dataOffset], toWrite, 0);
+      if(amountSent < 0)
+        {
+          // we will be called again when new tx space becomes available.
+          return;
+        }
+      currentTxBytes += amountSent;
     }
-    int amountSent = localSocket->Send (data, curSize, 0);
-    if(amountSent < 0)
-      {
-        // we will be called again when new tx space becomes available.
-        std::cout << "Socket blocking, " << txBytes << " left to write, returning" << std::endl;
-        return;
-      }
-    txBytes -= curSize;
-    if (amountSent != (int)curSize)
-      {
-        std::cout << "Short Write, returning" << std::endl;
-        return;
-      }
-  }
   localSocket->Close ();
 }
--- a/examples/tcp-nsc-lfn.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/tcp-nsc-lfn.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -36,7 +36,6 @@
 #include "ns3/common-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/node-module.h"
-#include "ns3/global-route-manager.h"
 #include "ns3/simulator-module.h"
 
 using namespace ns3;
@@ -117,7 +116,7 @@
   p2pInterfaces.Get(0)->SetAttribute("ReceiveErrorModel", PointerValue (em1));
   p2pInterfaces.Get(1)->SetAttribute("ReceiveErrorModel", PointerValue (em2));
 
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   uint16_t servPort = 8080;
   PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort));
--- a/examples/tcp-nsc-zoo.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/tcp-nsc-zoo.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -33,7 +33,6 @@
 #include "ns3/core-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/node-module.h"
-#include "ns3/global-route-manager.h"
 #include "ns3/simulator-module.h"
 
 using namespace ns3;
@@ -68,7 +67,6 @@
   NetDeviceContainer ethInterfaces = csma.Install (n);
 
   InternetStackHelper internetStack;
-
   internetStack.SetTcp ("ns3::NscTcpL4Protocol","Library",StringValue("liblinux2.6.26.so"));
   // this switches nodes 0 and 1 to NSCs Linux 2.6.26 stack.
   internetStack.Install (n.Get(0));
@@ -106,7 +104,7 @@
   ipv4.SetBase ("10.0.0.0", "255.255.255.0");
   Ipv4InterfaceContainer ipv4Interfaces = ipv4.Assign (ethInterfaces);
 
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   uint16_t servPort = 8080;
   PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort));
--- a/examples/tcp-star-server.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/tcp-star-server.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -52,7 +52,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 
 using namespace ns3;
 
@@ -123,7 +122,7 @@
   }
 
   //Turn on global static routing
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Create a packet sink on the star "hub" to receive these packets
   uint16_t port = 50000;
--- a/examples/third.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/third.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -18,7 +18,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-routing-module.h"
 #include "ns3/wifi-module.h"
 #include "ns3/mobility-module.h"
 
@@ -159,7 +158,7 @@
   clientApps.Start (Seconds (2.0));
   clientApps.Stop (Seconds (10.0));
 
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   Simulator::Stop (Seconds (10.0));
 
--- a/examples/udp-echo.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/udp-echo.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -43,30 +43,10 @@
 //
 #if 0
   LogComponentEnable ("UdpEchoExample", LOG_LEVEL_INFO);
-
-  LogComponentEnable("Object", LOG_LEVEL_ALL);
-  LogComponentEnable("Queue", LOG_LEVEL_ALL);
-  LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
-  LogComponentEnable("Channel", LOG_LEVEL_ALL);
-  LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL);
-  LogComponentEnable("NetDevice", LOG_LEVEL_ALL);
-  LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("PacketSocket", LOG_LEVEL_ALL);
-  LogComponentEnable("Socket", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpSocket", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL);
-  LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL);
-  LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL);
-  LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL);
   LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL);
   LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL);
 #endif
-
+//
 // Allow the user to override any of the defaults and the above Bind() at
 // run-time, via command-line arguments
 //
@@ -125,6 +105,19 @@
   apps.Start (Seconds (2.0));
   apps.Stop (Seconds (10.0));
 
+#if 0
+//
+// Users may find it convenient to initialize echo packets with actual data;
+// the below lines suggest how to do this
+//
+  client.SetFill(apps.Get (0), "Hello World");
+
+  client.SetFill(apps.Get (0), 0xa5, 1024);
+
+  uint8_t fill[] = {0, 1, 2, 3, 4, 5, 6};
+  client.SetFill(apps.Get (0), fill, sizeof(fill), 1024);
+#endif
+
   std::ofstream ascii;
   ascii.open ("udp-echo.tr");
   CsmaHelper::EnablePcapAll ("udp-echo", false);
--- a/examples/virtual-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/virtual-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -57,7 +57,6 @@
 #include "ns3/simulator-module.h"
 #include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/global-route-manager.h"
 #include "ns3/virtual-net-device.h"
 
 using namespace ns3;
@@ -238,7 +237,7 @@
 
   // Create router nodes, initialize routing database and set up the routing
   // tables in the nodes.
-  GlobalRouteManager::PopulateRoutingTables ();
+  Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
 
   // Add the tunnels
   Tunnel tunnel (c.Get (3), c.Get (0), c.Get (1),
--- a/examples/wifi-wired-bridging.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/examples/wifi-wired-bridging.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -49,7 +49,6 @@
 #include "ns3/helper-module.h"
 #include "ns3/wifi-module.h"
 #include "ns3/node-module.h"
-#include "ns3/global-route-manager.h"
 #include <vector>
 #include <stdint.h>
 #include <sstream>
--- a/regression.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/regression.py	Fri Jul 03 09:59:04 2009 +0400
@@ -40,6 +40,26 @@
     import filecmp
     comp = filecmp.dircmp(dir1, dir2)
     differ = (comp.left_only or comp.right_only or comp.diff_files)
+
+    if differ:
+        # ok, stupid binary comparison reports differences, but maybe
+        # only text files differ, in which case we should compare
+        # again while ignoring newline differences between
+        # windows/mac/unix.
+        if not comp.left_only and not comp.right_only:
+            for diff_fname in comp.diff_files:
+                if not (diff_fname.endswith(".tr") or diff_fname.endswith(".mob")):
+                    # doesn't look like a text file; it has to differ
+                    break
+                diff_file1 = open(os.path.join(dir1, diff_fname), "rtU").readlines()
+                diff_file2 = open(os.path.join(dir2, diff_fname), "rtU").readlines()
+                if diff_file1 != diff_file2:
+                    break
+                #else:
+                #    print ">>>>>>>> %s file does not really differ!" % (diff_fname)
+            else:
+                differ = False
+
     if differ:
         if verbose:
             comp.report()
@@ -142,6 +162,8 @@
                     raise
             os.makedirs(trace_output_path)
             # run it
+            #print "self.run_reference_test:(%r, %r, %r, %r, %r)" \
+            #    % (reference_traces_path, trace_output_path, program, arguments, is_pyscript)
             result = self.run_reference_test(reference_traces_path, trace_output_path, program, arguments, is_pyscript)
             if result == 0:
                 print "PASS " + self.test_name
--- a/samples/main-ns2-mob.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/samples/main-ns2-mob.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -34,5 +34,7 @@
   Simulator::Stop (Seconds (10.0));
   Simulator::Run ();
   Simulator::Destroy ();
+
+  os.close ();
   return 0;
 }
--- a/src/applications/udp-echo/udp-echo-client.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-client.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -57,9 +57,10 @@
                    UintegerValue (0),
                    MakeUintegerAccessor (&UdpEchoClient::m_peerPort),
                    MakeUintegerChecker<uint16_t> ())
-    .AddAttribute ("PacketSize", "Size of packets generated",
+    .AddAttribute ("PacketSize", "Size of echo data in outbound packets",
                    UintegerValue (100),
-                   MakeUintegerAccessor (&UdpEchoClient::m_size),
+                   MakeUintegerAccessor (&UdpEchoClient::SetDataSize,
+                                         &UdpEchoClient::GetDataSize),
                    MakeUintegerChecker<uint32_t> ())
     ;
   return tid;
@@ -71,12 +72,18 @@
   m_sent = 0;
   m_socket = 0;
   m_sendEvent = EventId ();
+  m_data = 0;
+  m_dataSize = 0;
 }
 
 UdpEchoClient::~UdpEchoClient()
 {
   NS_LOG_FUNCTION_NOARGS ();
   m_socket = 0;
+
+  delete [] m_data;
+  m_data = 0;
+  m_dataSize = 0;
 }
 
 void 
@@ -127,6 +134,106 @@
 }
 
 void 
+UdpEchoClient::SetDataSize (uint32_t dataSize)
+{
+  NS_LOG_FUNCTION (dataSize);
+
+  //
+  // If the client is setting the echo packet data size this way, we infer
+  // that she doesn't care about the contents of the packet at all, so 
+  // neither will we.
+  //
+  delete [] m_data;
+  m_data = 0;
+  m_dataSize = 0;
+  m_size = dataSize;
+}
+
+uint32_t 
+UdpEchoClient::GetDataSize (void) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  return m_size;
+}
+
+void 
+UdpEchoClient::SetFill (std::string fill)
+{
+  NS_LOG_FUNCTION (fill);
+
+  uint32_t dataSize = fill.size () + 1;
+
+  if (dataSize != m_dataSize)
+    {
+      delete [] m_data;
+      m_data = new uint8_t [dataSize];
+      m_dataSize = dataSize;
+    }
+
+  memcpy (m_data, fill.c_str (), dataSize);
+
+  //
+  // Overwrite packet size attribute.
+  //
+  m_size = dataSize;
+}
+
+void 
+UdpEchoClient::SetFill (uint8_t fill, uint32_t dataSize)
+{
+  if (dataSize != m_dataSize)
+    {
+      delete [] m_data;
+      m_data = new uint8_t [dataSize];
+      m_dataSize = dataSize;
+    }
+
+  memset (m_data, fill, dataSize);
+
+  //
+  // Overwrite packet size attribute.
+  //
+  m_size = dataSize;
+}
+
+void 
+UdpEchoClient::SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize)
+{
+  if (dataSize != m_dataSize)
+    {
+      delete [] m_data;
+      m_data = new uint8_t [dataSize];
+      m_dataSize = dataSize;
+    }
+
+  if (fillSize >= dataSize)
+    {
+      memcpy (m_data, fill, dataSize);
+      return;
+    }
+
+  //
+  // Do all but the final fill.
+  //
+  uint32_t filled = 0;
+  while (filled + fillSize < dataSize)
+    {
+      memcpy (&m_data[filled], fill, fillSize);
+      filled += fillSize;
+    }
+
+  //
+  // Last fill may be partial
+  //
+  memcpy(&m_data[filled], fill, dataSize - filled);
+
+  //
+  // Overwrite packet size attribute.
+  //
+  m_size = dataSize;
+}
+
+void 
 UdpEchoClient::ScheduleTransmit (Time dt)
 {
   NS_LOG_FUNCTION_NOARGS ();
@@ -140,8 +247,32 @@
 
   NS_ASSERT (m_sendEvent.IsExpired ());
 
-  Ptr<Packet> p = Create<Packet> (m_size);
-  m_socket->Send (p);
+  if (m_dataSize)
+    {
+      //
+      // If m_dataSize is non-zero, we have a data buffer of the same size that we
+      // are expected to copy and send.  This state of affairs is created if one of
+      // the Fill functions is called.  In this case, m_size must have been set
+      // to agree with m_dataSize
+      //
+      NS_ASSERT_MSG (m_dataSize == m_size, "UdpEchoClient::Send(): m_size and m_dataSize inconsistent");
+      NS_ASSERT_MSG (m_data, "UdpEchoClient::Send(): m_dataSize but no m_data");
+      Ptr<Packet> p = Create<Packet> (m_data, m_dataSize);
+      m_socket->Send (p);
+    }
+  else
+    {
+      //
+      // If m_dataSize is zero, the client has indicated that she doesn't care 
+      // about the data itself either by specifying the data size by setting
+      // the corresponding atribute or by not calling a SetFill function.  In 
+      // this case, we don't worry about it either.  But we do allow m_size
+      // to have a value different from the (zero) m_dataSize.
+      //
+      Ptr<Packet> p = Create<Packet> (m_size);
+      m_socket->Send (p);
+    }
+
   ++m_sent;
 
   NS_LOG_INFO ("Sent " << m_size << " bytes to " << m_peerAddress);
--- a/src/applications/udp-echo/udp-echo-client.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/applications/udp-echo/udp-echo-client.h	Fri Jul 03 09:59:04 2009 +0400
@@ -46,6 +46,75 @@
 
   void SetRemote (Ipv4Address ip, uint16_t port);
 
+  /**
+   * Set the data size of the packet (the number of bytes that are sent as data
+   * to the server).  The contents of the data are set to unspecified (don't
+   * care) by this call.
+   *
+   * \warning If you have set the fill data for the echo client using one of the
+   * SetFill calls, this will undo those effects.
+   *
+   * \param dataSize The size of the echo data you want to sent.
+   */
+  void SetDataSize (uint32_t dataSize);
+
+  /**
+   * Get the number of data bytes that will be sent to the server.
+   *
+   * \warning The number of bytes may be modified by calling any one of the 
+   * SetFill methods.  If you have called SetFill, then the number of 
+   * data bytes will correspond to the size of an initialized data buffer.
+   * If you have not called a SetFill method, the number of data bytes will
+   * correspond to the number of don't care bytes that will be sent.
+   *
+   * \returns The number of data bytes.
+   */
+  uint32_t GetDataSize (void) const;
+
+  /**
+   * Set the data fill of the packet (what is sent as data to the server) to 
+   * the zero-terminated contents of the fill string string.
+   *
+   * \warning The size of resulting echo packets will be automatically adjusted
+   * to reflect the size of the fill string -- this means that the PacketSize
+   * attribute may be changed as a result of this call.
+   *
+   * \param fill The string to use as the actual echo data bytes.
+   */
+  void SetFill (std::string fill);
+
+  /**
+   * Set the data fill of the packet (what is sent as data to the server) to 
+   * the repeated contents of the fill byte.  i.e., the fill byte will be 
+   * used to initialize the contents of the data packet.
+   * 
+   * \warning The size of resulting echo packets will be automatically adjusted
+   * to reflect the dataSize parameter -- this means that the PacketSize
+   * attribute may be changed as a result of this call.
+   *
+   * \param fill The byte to be repeated in constructing the packet data..
+   * \param dataSize The desired size of the resulting echo packet data.
+   */
+  void SetFill (uint8_t fill, uint32_t dataSize);
+
+  /**
+   * Set the data fill of the packet (what is sent as data to the server) to
+   * the contents of the fill buffer, repeated as many times as is required.
+   *
+   * Initializing the packet to the contents of a provided single buffer is 
+   * accomplished by setting the fillSize set to your desired dataSize
+   * (and providing an appropriate buffer).
+   *
+   * \warning The size of resulting echo packets will be automatically adjusted
+   * to reflect the dataSize parameter -- this means that the PacketSize
+   * attribute of the Application may be changed as a result of this call.
+   *
+   * \param fill The fill pattern to use when constructing packets.
+   * \param fillSize The number of bytes in the provided fill pattern.
+   * \param dataSize The desired size of the final echo data.
+   */
+  void SetFill (uint8_t *fill, uint32_t fillSize, uint32_t dataSize);
+
 protected:
   virtual void DoDispose (void);
 
@@ -63,6 +132,9 @@
   Time m_interval;
   uint32_t m_size;
 
+  uint32_t m_dataSize;
+  uint8_t *m_data;
+
   uint32_t m_sent;
   Ptr<Socket> m_socket;
   Ipv4Address m_peerAddress;
--- a/src/applications/v4ping/v4ping.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/applications/v4ping/v4ping.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -1,3 +1,18 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 #include "v4ping.h"
 #include "ns3/icmpv4.h"
 #include "ns3/assert.h"
@@ -87,11 +102,12 @@
 	  if (echo.GetSequenceNumber () == (m_seq - 1) &&
 	      echo.GetIdentifier () == 0)
 	    {
-	      uint8_t data[16];
-	      uint32_t dataSize = echo.GetData (data);
-	      if (dataSize == 16)
+              uint32_t buf[4];
+	      uint32_t dataSize = echo.GetDataSize ();
+	      if (dataSize == sizeof(buf))
 		{
-		  uint32_t *buf = (uint32_t *)data;
+                  echo.GetData ((uint8_t *)buf);
+
 		  if (buf[0] == GetNode ()->GetId () &&
 		      buf[1] == GetApplicationId ())
 		    {
--- a/src/common/pcap-writer.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/common/pcap-writer.h	Fri Jul 03 09:59:04 2009 +0400
@@ -118,7 +118,7 @@
    * on a nearby channel.
    * @param rate the PHY data rate in units of 500kbps (i.e., the same
    * units used both for the radiotap and for the prism header) 
-   * @param isPreambleShort true if short preamble is used, false otherwise
+   * @param isShortPreamble true if short preamble is used, false otherwise
    * @param isTx true if packet is being transmitted, false when
    * packet is being received
    * @param signalDbm signal power in dBm
--- a/src/contrib/stats/data-output-interface.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/data-output-interface.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -45,3 +45,15 @@
   Object::DoDispose();
   // end DataOutputInterface::DoDispose
 }
+
+void
+DataOutputInterface::SetFilePrefix(const std::string prefix)
+{
+  m_filePrefix = prefix;
+}
+
+std::string
+DataOutputInterface::GetFilePrefix() const
+{
+  return m_filePrefix;
+}
--- a/src/contrib/stats/data-output-interface.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/data-output-interface.h	Fri Jul 03 09:59:04 2009 +0400
@@ -37,9 +37,14 @@
 
     virtual void Output(DataCollector &dc) = 0;
 
+    void SetFilePrefix(const std::string prefix);
+    std::string GetFilePrefix() const;
+
   protected:
     virtual void DoDispose();
 
+    std::string m_filePrefix;
+
     // end class DataOutputInterface
   };
 
--- a/src/contrib/stats/omnet-data-output.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/omnet-data-output.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -34,9 +34,10 @@
 
 //--------------------------------------------------------------
 //----------------------------------------------
-OmnetDataOutput::OmnetDataOutput() :
-  m_filePrefix("data")
+OmnetDataOutput::OmnetDataOutput()
 {
+  m_filePrefix = "data";
+
   NS_LOG_FUNCTION_NOARGS();
 }
 OmnetDataOutput::~OmnetDataOutput()
@@ -52,17 +53,6 @@
   // end OmnetDataOutput::DoDispose
 }
 
-void
-OmnetDataOutput::SetFilePrefix(const std::string prefix)
-{
-  m_filePrefix = prefix;
-}
-std::string
-OmnetDataOutput::GetFilePrefix() const
-{
-  return m_filePrefix;
-}
-
 //----------------------------------------------
 void
 OmnetDataOutput::Output(DataCollector &dc)
--- a/src/contrib/stats/omnet-data-output.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/omnet-data-output.h	Fri Jul 03 09:59:04 2009 +0400
@@ -37,9 +37,6 @@
 
     virtual void Output(DataCollector &dc);
 
-    void SetFilePrefix(const std::string prefix);
-    std::string GetFilePrefix() const;
-
   protected:
     virtual void DoDispose();
 
@@ -73,7 +70,6 @@
       // end class OmnetOutputCallback
     };
 
-    std::string m_filePrefix;
     // end class OmnetDataOutput
   };
 
--- a/src/contrib/stats/sqlite-data-output.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/sqlite-data-output.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -35,9 +35,9 @@
 
 //--------------------------------------------------------------
 //----------------------------------------------
-SqliteDataOutput::SqliteDataOutput() :
-  m_dbFile("data.db")
+SqliteDataOutput::SqliteDataOutput()
 {
+  m_filePrefix = "data";
   NS_LOG_FUNCTION_NOARGS();
 }
 SqliteDataOutput::~SqliteDataOutput()
@@ -53,17 +53,6 @@
   // end SqliteDataOutput::DoDispose
 }
 
-void
-SqliteDataOutput::SetDBFile(const std::string file)
-{
-  m_dbFile = file;
-}
-std::string
-SqliteDataOutput::GetDBFile() const
-{
-  return m_dbFile;
-}
-
 int
 SqliteDataOutput::Exec(std::string exe) {
   int res;
@@ -111,6 +100,7 @@
 void
 SqliteDataOutput::Output(DataCollector &dc)
 {
+  std::string m_dbFile = m_filePrefix + ".db";
 
   if (sqlite3_open(m_dbFile.c_str(), &m_db)) {
     NS_LOG_ERROR("Could not open sqlite3 database \"" << m_dbFile << "\"");
--- a/src/contrib/stats/sqlite-data-output.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/contrib/stats/sqlite-data-output.h	Fri Jul 03 09:59:04 2009 +0400
@@ -40,9 +40,6 @@
 
     virtual void Output(DataCollector &dc);
 
-    void SetDBFile(const std::string file);
-    std::string GetDBFile() const;
-
   protected:
     virtual void DoDispose();
 
@@ -82,7 +79,6 @@
     sqlite3 *m_db;
     int Exec(std::string exe);
 
-    std::string m_dbFile;
     // end class SqliteDataOutput
   };
 
--- a/src/core/attribute-list.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/core/attribute-list.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -237,7 +237,7 @@
               else
                 {
                   value = str.substr (equal+1, next - (equal+1));
-                  cur++;
+                  cur = next + 1;
                 }
               Ptr<AttributeValue> val = info.checker->Create ();
               bool ok = val->DeserializeFromString (value, info.checker);
--- a/src/core/global-value.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/core/global-value.h	Fri Jul 03 09:59:04 2009 +0400
@@ -35,6 +35,14 @@
  *
  * Instances of this class are expected to be allocated as static 
  * global variables and should be used to store configurable global state.
+ * GlobalValues can be set directly by calling ns3::GlobalValue::SetValue
+ * but they can also be set through the NS_GLOBAL_VALUE environment variable.
+ * For example, NS_GLOBAL_VALUE='Name=Value;OtherName=OtherValue;' would set
+ * global values Name and OtherName to Value and OtherValue respectively. 
+ *
+ * Users of the ns3::CommandLine class also get the ability to set global 
+ * values through commandline arguments to their program: --Name=Value will
+ * set global value Name to Value.
  */
 class GlobalValue
 {
--- a/src/core/random-variable.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/core/random-variable.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -1152,7 +1152,7 @@
 
 RandomVariableBase* LogNormalVariableImpl::Copy () const
 {
-  return new LogNormalVariableImpl (m_mu, m_sigma);
+  return new LogNormalVariableImpl (*this);
 }
 
 LogNormalVariableImpl::LogNormalVariableImpl (double mu, double sigma)
@@ -1515,6 +1515,87 @@
   : RandomVariable (TriangularVariableImpl (s,l,mean))
 {}
 
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// ZipfVariableImpl
+class ZipfVariableImpl : public RandomVariableBase { 
+public:
+  /**
+   * \param n the number of possible items
+   * \param alpha the alpha parameter
+   */
+  ZipfVariableImpl (long n, double alpha);
+
+  /**
+   * \A zipf variable with N=1 and alpha=0
+   */
+  ZipfVariableImpl ();
+
+  /**
+   * \return A random value from this distribution
+   */
+  virtual double GetValue ();
+  virtual RandomVariableBase* Copy(void) const;
+
+private:
+  long m_n;
+  double m_alpha;
+  double m_c; //the normalization constant
+};
+
+
+RandomVariableBase* ZipfVariableImpl::Copy () const
+{
+  return new ZipfVariableImpl (m_n, m_alpha);
+}
+
+ZipfVariableImpl::ZipfVariableImpl ()
+    :m_n(1), m_alpha(0), m_c(1)
+{
+}
+
+
+ZipfVariableImpl::ZipfVariableImpl (long n, double alpha)
+    :m_n(n), m_alpha(alpha), m_c(0)
+{
+  //calculate the normalization constant c
+  for(int i=1;i<=n;i++)
+    {
+      m_c+=(1.0/pow((double)i,alpha));
+    }
+  m_c=1.0/m_c;
+}
+
+double
+ZipfVariableImpl::GetValue ()
+{
+  if(!m_generator)
+    {
+      m_generator = new RngStream();
+    }
+
+  double u = m_generator->RandU01();
+  double sum_prob=0,zipf_value=0;
+  for(int i=1;i<=m_n;i++)
+    {
+      sum_prob+=m_c/pow((double)i,m_alpha);
+      if(sum_prob>u)
+        {
+          zipf_value=i;
+          break;
+        }
+    }
+  return zipf_value;
+}
+
+ZipfVariable::ZipfVariable ()
+  : RandomVariable (ZipfVariableImpl ())
+{}
+
+ZipfVariable::ZipfVariable (long n, double alpha)
+  : RandomVariable (ZipfVariableImpl (n, alpha))
+{}
+
 
 std::ostream &operator << (std::ostream &os, const RandomVariable &var)
 {
--- a/src/core/random-variable.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/core/random-variable.h	Fri Jul 03 09:59:04 2009 +0400
@@ -115,9 +115,8 @@
  * NS-3 has a rich set of  random number generators.
  * Class RandomVariable defines the base class functionalty
  * required for all random number generators.  By default, the underlying
- * generator is seeded with the time of day, and then deterministically
- * creates a sequence of seeds for each subsequent generator that is created.
- * The rest of the documentation outlines how to change this behavior.
+ * generator is seeded all the time with the same seed value and run number
+ * coming from the ns3::GlobalValue \ref GlobalValueRngSeed "RngSeed" and \ref GlobalValueRngRun "RngRun".
  */
 class RandomVariable
 { 
@@ -695,6 +694,25 @@
 };
 
 /**
+ * \brief Zipf Distributed random var (between 1 and n included)
+ * \ingroup randomvariable
+ *
+ */
+class ZipfVariable : public RandomVariable 
+{
+public:
+  /**
+   * \param n the number of possible items
+   * \param alpha the alpha parameter
+   */
+  ZipfVariable (long n, double alpha);
+  /**
+   * A zipf variable with N=1 and alpha=0
+   */
+  ZipfVariable ();
+};
+
+/**
  * \brief Triangularly Distributed random var
  * \ingroup randomvariable
  * 
--- a/src/devices/bridge/bridge-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/bridge/bridge-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -278,6 +278,13 @@
   return m_channel;
 }
 
+void
+BridgeNetDevice::SetAddress (Address address)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  m_address = Mac48Address::ConvertFrom (address);
+}
+
 Address 
 BridgeNetDevice::GetAddress (void) const
 {
--- a/src/devices/bridge/bridge-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/bridge/bridge-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -91,6 +91,7 @@
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
--- a/src/devices/csma/csma-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/csma/csma-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -321,13 +321,6 @@
   return m_frameSize;
 }
 
-  void 
-CsmaNetDevice::SetAddress (Mac48Address self)
-{
-  NS_LOG_FUNCTION (self);
-  m_address = self;
-}
-
   void
 CsmaNetDevice::SetSendEnable (bool sendEnable)
 {
@@ -875,6 +868,13 @@
   return m_channel;
 }
 
+  void
+CsmaNetDevice::SetAddress (Address address)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  m_address = Mac48Address::ConvertFrom (address);
+}
+
   Address 
 CsmaNetDevice::GetAddress (void) const
 {
--- a/src/devices/csma/csma-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/csma/csma-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -183,13 +183,6 @@
   void SetReceiveEnable (bool enable);
 
   /**
-   * Set the MAC address of the the network device.
-   *
-   * \param addr The Mac48Address to use as the address of the device.
-   */
-  void SetAddress (Mac48Address addr);
-
-  /**
    * Set The max frame size of packets sent over this device.
    *
    * Okay, that was easy to say, but the details are a bit thorny.  We have a MAC-level MTU that is the payload that higher 
@@ -310,6 +303,7 @@
   virtual Ptr<Channel> GetChannel (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool IsLinkUp (void) const;
   virtual void SetLinkChangeCallback (Callback<void> callback);
--- a/src/devices/emu/emu-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/emu/emu-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -876,10 +876,10 @@
 }
 
 void 
-EmuNetDevice::SetAddress (Mac48Address addr)
+EmuNetDevice::SetAddress (Address address)
 {
-  NS_LOG_FUNCTION (addr);
-  m_address = addr;
+  NS_LOG_FUNCTION (address);
+  m_address = Mac48Address::ConvertFrom (address);
 }
 
 Address 
--- a/src/devices/emu/emu-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/emu/emu-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -94,14 +94,6 @@
    */
   void SetQueue (Ptr<Queue> queue);
 
-  /**
-   * Assign a MAC address to this device.
-   *
-   * @see Mac48Address
-   * @param addr The new address.
-   */
-  void SetAddress (Mac48Address addr);
-
 //
 // Pure virtual methods inherited from NetDevice we must implement.
 //
@@ -109,6 +101,8 @@
   virtual uint32_t GetIfIndex(void) const;
 
   virtual Ptr<Channel> GetChannel (void) const;
+
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
 
   virtual bool SetMtu (const uint16_t mtu);
--- a/src/devices/point-to-point/point-to-point-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/point-to-point/point-to-point-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -395,10 +395,11 @@
 // information.  However, the base class NetDevice wants us to define the
 // methods to get and set the address.  Rather than be rude and assert, we let
 // clients get and set the address, but simply ignore them.
+
   void 
-PointToPointNetDevice::SetAddress (Mac48Address addr)
+PointToPointNetDevice::SetAddress (Address address)
 {
-  m_address = addr;
+  m_address = Mac48Address::ConvertFrom (address);
 }
 
   Address 
--- a/src/devices/point-to-point/point-to-point-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/point-to-point/point-to-point-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -132,14 +132,6 @@
   void Receive (Ptr<Packet> p);
 
   /**
-   * Assign a MAC address to this device.
-   *
-   * @see Mac48Address
-   * @param addr The new address.
-   */
-  void SetAddress (Mac48Address addr);
-
-  /**
    * Set The max frame size of packets sent over this device.
    *
    * Okay, that was easy to say, but the details are a bit thorny.  We have a MAC-level MTU that is the payload that higher 
@@ -230,6 +222,8 @@
   virtual uint32_t GetIfIndex(void) const;
 
   virtual Ptr<Channel> GetChannel (void) const;
+
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
 
   virtual bool SetMtu (const uint16_t mtu);
--- a/src/devices/tap-bridge/tap-bridge.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/tap-bridge/tap-bridge.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -131,7 +131,7 @@
   m_startEvent (),
   m_stopEvent (),
   m_readThread (0),
-  m_learnedMac (Mac48Address ("ff:ff:ff:ff:ff:ff"))
+  m_ns3AddressRewritten (false)
 {
   NS_LOG_FUNCTION_NOARGS ();
   Start (m_tStart);
@@ -641,7 +641,7 @@
           return;
         }
 
-      NS_LOG_INFO ("TapBridge::ReadThread(): Received packet");
+      NS_LOG_INFO ("TapBridge::ReadThread(): Received packet on node " << m_node->GetId ());
       NS_LOG_INFO ("TapBridge::ReadThread(): Scheduling handler");
       DynamicCast<RealtimeSimulatorImpl> (Simulator::GetImplementation ())->ScheduleRealtimeNow (
         MakeEvent (&TapBridge::ForwardToBridgedDevice, this, buf, len));
@@ -713,21 +713,21 @@
       //
       NS_ASSERT_MSG (Mac48Address::ConvertFrom (src) != Mac48Address ("ff:ff:ff:ff:ff:ff"), 
                      "TapBridge::ForwardToBridgedDevice:  Source addr is broadcast");
-      //
-      // Remember the Mac address since we are going to spoof it when we go
-      // the other way.
-      //
-      m_learnedMac = Mac48Address::ConvertFrom (src);
-      NS_LOG_LOGIC ("Learned MacAddr is " << m_learnedMac);
-
+      if (m_ns3AddressRewritten == false)
+        {
+          //
+          // Set the ns-3 device's mac address to the overlying container's
+          // mac address
+          //
+          Mac48Address learnedMac = Mac48Address::ConvertFrom (src);
+          NS_LOG_LOGIC ("Learned MacAddr is " << learnedMac << ": setting ns-3 device to use this address");
+          m_bridgedDevice->SetAddress (Mac48Address::ConvertFrom (learnedMac));
+          m_ns3AddressRewritten = true;
+        }
       // 
       // If we are operating in USE_LOCAL mode, we may be attached to an ns-3
       // device that does not support bridging (SupportsSendFrom returns false).
-      // The whole point of this mode is really to support this case.  We allow
-      // only packets from one source MAC to flow across the TapBridge in this 
-      // mode and will spoof that address when packets flow the other way.  
-      // Since we will be doing this spoofing, we can relax the normal bridged
-      // device requirement to support SendFrom and use Send.
+      // But, since the mac addresses are now aligned, we can call Send()
       //
       NS_LOG_LOGIC ("Forwarding packet to ns-3 device via Send()");
       m_bridgedDevice->Send (packet, dst, type);
@@ -864,20 +864,34 @@
     }
 
   //
-  // Tell the bridged device to forward its received packets here.  We use the 
-  // promiscuous mode hook to get both the source and destination addresses.
+  // We need to disconnect the bridged device from the internet stack on our
+  // node to ensure that only one stack responds to packets inbound over the
+  // bridged device.  That one stack lives outside ns-3 so we just blatantly
+  // steal the device callbacks.
   //
-  m_node->RegisterProtocolHandler (MakeCallback (&TapBridge::ReceiveFromBridgedDevice, this), 0, bridgedDevice, true);
+  // N.B This can be undone if someone does a RegisterProtocolHandler later 
+  // on this node.
+  //
+  bridgedDevice->SetReceiveCallback (MakeCallback (&TapBridge::DiscardFromBridgedDevice, this));
+  bridgedDevice->SetPromiscReceiveCallback (MakeCallback (&TapBridge::ReceiveFromBridgedDevice, this));
   m_bridgedDevice = bridgedDevice;
 }
 
-void
+bool
+TapBridge::DiscardFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &src)
+{
+  NS_LOG_FUNCTION (device << packet << protocol << src);
+  NS_LOG_LOGIC ("Discarding packet stolen from bridged device " << device);
+  return true;
+}
+
+bool
 TapBridge::ReceiveFromBridgedDevice (
   Ptr<NetDevice> device, 
   Ptr<const Packet> packet, 
   uint16_t protocol,
-  Address const &src, 
-  Address const &dst, 
+  const Address &src, 
+  const Address &dst, 
   PacketType packetType)
 {
   NS_LOG_FUNCTION (device << packet << protocol << src << dst << packetType);
@@ -913,35 +927,11 @@
       // we want to act like a bridge and forward these PACKET_OTHERHOST 
       // packets.
       //
-      return;
+      return true;
     }
 
-  //
-  // We have received a packet from the ns-3 net device that has been associated
-  // with this bridge.  We want to take these bits and send them off to the tap
-  // device on the Linux host.  The only question we have to answer is, what 
-  // should the destination address be?
-  //
-  // If we are in CONFIGURE_LOCAL mode, then the destination address is just
-  // left alone since it can only be the shared single MAC address, broadcast
-  // or multicast.
-  //
-  // If we are in USE_LOCAL mode, then we need to spoof the destination 
-  // address with the one we saved.
-  //
-  // If we are in USE_BRIDGE mode, then we need to do the equvalent of a 
-  // SendFrom and leave the source and destination alone.
-  //
   Mac48Address from = Mac48Address::ConvertFrom (src);
-  Mac48Address to;
-  if (m_mode == USE_LOCAL)
-    {
-      to = Mac48Address::ConvertFrom (m_learnedMac);
-    }
-  else 
-    {
-      to = Mac48Address::ConvertFrom (dst);
-    }
+  Mac48Address to = Mac48Address::ConvertFrom (dst);
 
   Ptr<Packet> p = packet->Copy ();
   EthernetHeader header = EthernetHeader (false);
@@ -956,9 +946,11 @@
   NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ());
   NS_LOG_LOGIC ("Pkt LengthType is " << header.GetLengthType ());
   NS_LOG_LOGIC ("Pkt size is " << p->GetSize ());
+  NS_LOG_LOGIC ("End of receive packet handling on node " << m_node->GetId ());
 
   uint32_t bytesWritten = write (m_sock, p->PeekData (), p->GetSize ());
   NS_ABORT_MSG_IF (bytesWritten != p->GetSize (), "TapBridge::ReceiveFromBridgedDevice(): Write error.");
+  return true;
 }
 
 void 
@@ -982,6 +974,13 @@
   return 0;
 }
 
+void
+TapBridge::SetAddress (Address address)
+{
+  NS_LOG_FUNCTION (address);
+  m_address = Mac48Address::ConvertFrom (address);
+}
+
 Address 
 TapBridge::GetAddress (void) const
 {
--- a/src/devices/tap-bridge/tap-bridge.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/tap-bridge/tap-bridge.h	Fri Jul 03 09:59:04 2009 +0400
@@ -176,6 +176,7 @@
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
@@ -208,8 +209,11 @@
    */
   virtual void DoDispose (void);
 
-  void ReceiveFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
+  bool ReceiveFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
                                  Address const &src, Address const &dst, PacketType packetType);
+
+  bool DiscardFromBridgedDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, Address const &src);
+
 private:
 
   /**
@@ -443,13 +447,10 @@
   /**
    * \internal
    *
-   * The MAC address of the local tap device is stored in this variable.
-   * When in UseLocal mode, this address is added back to the destination 
-   * Mac address for frames destined to the tap device.  It is learned from
-   * the first frame sent from the host to the TapBridge device.  In the
-   * other modes of this device, this value is unused.  
+   * Whether the MAC address of the underlying ns-3 device has already been
+   * rewritten is stored in this variable (for UseLocal mode only).
    */
-  Mac48Address m_learnedMac;
+  bool m_ns3AddressRewritten;
 
 };
 
--- a/src/devices/virtual-net-device/virtual-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/virtual-net-device/virtual-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -114,17 +114,11 @@
                 PacketType packetType);
 
 
-  /**
-   * Set the MAC address of the the network device.
-   *
-   * \param addr The Address to use as the address of the device.
-   */
-  void SetAddress (Address addr);
-
   // inherited from NetDevice base class.
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual uint16_t GetMtu (void) const;
   virtual bool IsLinkUp (void) const;
--- a/src/devices/wifi/dcf-manager-test.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/dcf-manager-test.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -75,6 +75,8 @@
   void ExpectCollision (uint64_t time, uint32_t from, uint32_t nSlots);
   void AddRxOkEvt (uint64_t at, uint64_t duration);
   void AddRxErrorEvt (uint64_t at, uint64_t duration);
+  void AddRxInsideSifsEvt (uint64_t at, uint64_t duration);
+  void AddTxEvt (uint64_t at, uint64_t duration);
   void AddNavReset (uint64_t at, uint64_t duration);
   void AddNavStart (uint64_t at, uint64_t duration);
   void AddAckTimeoutReset (uint64_t at);
@@ -143,6 +145,13 @@
       m_result = result;
     }
 }
+void
+DcfManagerTest::AddTxEvt (uint64_t at, uint64_t duration)
+{
+  Simulator::Schedule (MicroSeconds (at) - Now (), 
+                       &DcfManager::NotifyTxStartNow, m_dcfManager, 
+                       MicroSeconds (duration));
+}
 void 
 DcfManagerTest::NotifyInternalCollision (uint32_t i)
 {
@@ -244,6 +253,13 @@
   Simulator::Schedule (MicroSeconds (at+duration) - Now (), 
                        &DcfManager::NotifyRxEndOkNow, m_dcfManager);
 }
+void
+DcfManagerTest::AddRxInsideSifsEvt (uint64_t at, uint64_t duration)
+{
+  Simulator::Schedule (MicroSeconds (at) - Now (), 
+                       &DcfManager::NotifyRxStartNow, m_dcfManager, 
+                       MicroSeconds (duration));
+}
 void 
 DcfManagerTest::AddRxErrorEvt (uint64_t at, uint64_t duration)
 {
@@ -321,6 +337,18 @@
   AddAccessRequest (1, 1, 4, 0);
   AddAccessRequest (10, 2, 10, 0);
   EndTest ();
+  // Check that receiving inside SIFS shall be cancelled properly:
+  //  0      3       4    5      8     9     12       13 14
+  //  | sifs | aifsn | tx | sifs | ack | sifs | aifsn |  |tx | 
+  //
+  StartTest (1, 3, 10);
+  AddDcfState (1);
+  AddAccessRequest (1, 1, 4, 0);
+  AddRxInsideSifsEvt (6, 10);
+  AddTxEvt(8, 1);
+  AddAccessRequest (14, 2, 14, 0);
+  EndTest ();
+
 
   // The test below mainly intends to test the case where the medium
   // becomes busy in the middle of a backoff slot: the backoff counter
--- a/src/devices/wifi/dcf-manager.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/dcf-manager.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -572,6 +572,17 @@
 void 
 DcfManager::NotifyTxStartNow (Time duration)
 {
+  if (m_rxing)
+  {
+    //this may be caused only if PHY has started to receive a packet
+    //inside SIFS, so, we check that lastRxStart was maximum a SIFS
+    //ago
+    NS_ASSERT(Simulator::Now () - m_lastRxStart <= m_sifs);
+    m_lastRxEnd = Simulator::Now ();
+    m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
+    m_lastRxReceivedOk = true;
+    m_rxing = false;
+  }
   MY_DEBUG ("tx start for "<<duration);
   UpdateBackoff ();
   m_lastTxStart = Simulator::Now ();
--- a/src/devices/wifi/mac-rx-middle.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/mac-rx-middle.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -128,24 +128,22 @@
 }
 
 bool
-MacRxMiddle::SequenceControlSmaller (int seqca, int seqcb)
+MacRxMiddle::SequenceControlSmaller (uint16_t seqca, uint16_t seqcb)
 {
   NS_LOG_FUNCTION (seqca << seqcb);
-  int seqa = seqca >> 4;
-  int seqb = seqcb >> 4;
-  int delta = seqb - seqa;
+  int16_t seqa = seqca >> 4;
+  int16_t seqb = seqcb >> 4;
+  int16_t delta = seqb - seqa;
+  bool sign = seqa <= seqb;
+  uint16_t absDelta = (delta < 0)?-delta:delta;
   NS_LOG_DEBUG ("seqb="<<seqb<<", seqa="<<seqa<<", delta="<<delta);
-  if (delta <= 0 && delta < -2048) 
+  if (absDelta < 2048)
     {
-      return true;
-    } 
-  else if (delta >= 0 && delta < 2048) 
+      return sign;
+    }
+  else
     {
-      return true;
-    } 
-  else 
-    {
-      return false;
+      return !sign;
     }
 }
 
@@ -301,3 +299,54 @@
 }
 
 } // namespace ns3
+
+#ifdef RUN_SELF_TESTS
+
+#include "ns3/test.h"
+
+namespace ns3 {
+
+class MacRxMiddleTest : public Test
+{
+public:
+  MacRxMiddleTest () : Test ("MacRxMiddle") {}
+  virtual bool RunTests (void) 
+  {
+    bool result = true;
+    MacRxMiddle middle;
+    // 0 < 1
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (0 << 4, 1 << 4));
+    // 0 < 2047
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (0 << 4, 2047 << 4));
+    // 0 > 2048
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (0 << 4, 2048 << 4));
+    // 0 > 2049
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (0 << 4, 2049 << 4));
+    // 0 > 4095
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (0 << 4, 4095 << 4));
+
+    // 1 > 0
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (1 << 4, 0 << 4));
+    // 2047 > 0
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (2047 << 4, 0 << 4));
+    // 2048 < 0
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (2048 << 4, 0 << 4));
+    // 2049 < 0
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (2049 << 4, 0 << 4));
+    // 4095 < 0 
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (4095 << 4, 0 << 4));
+
+    // 2048 < 2049
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (2048 << 4, 2049 << 4));
+    // 2048 < 4095
+    NS_TEST_ASSERT (middle.SequenceControlSmaller (2048 << 4, 4095 << 4));
+    // 2047 > 4095
+    NS_TEST_ASSERT (!middle.SequenceControlSmaller (2047 << 4, 4095 << 4));
+
+    return result;
+  }
+} g_macRxMiddleTest;
+
+} // namespace ns3
+
+#endif /* RUN_SELF_TESTS */
--- a/src/devices/wifi/mac-rx-middle.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/mac-rx-middle.h	Fri Jul 03 09:59:04 2009 +0400
@@ -44,11 +44,12 @@
 
   void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
 private:
+  friend class MacRxMiddleTest;
   OriginatorRxStatus *Lookup (WifiMacHeader const*hdr);
   bool IsDuplicate (WifiMacHeader const *hdr, OriginatorRxStatus *originator) const;
   Ptr<Packet> HandleFragments (Ptr<Packet> packet, WifiMacHeader const*hdr,
                                OriginatorRxStatus *originator);
-  bool SequenceControlSmaller (int seqa, int seqb);
+  bool SequenceControlSmaller (uint16_t seqa, uint16_t seqb);
 
   typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
   typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
--- a/src/devices/wifi/nqsta-wifi-mac.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/nqsta-wifi-mac.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -453,9 +453,15 @@
     }
 }
 bool
-NqstaWifiMac::IsAssociated (void)
+NqstaWifiMac::IsAssociated (void) const
 {
-  return (m_state == ASSOCIATED)?true:false;
+  return m_state == ASSOCIATED;
+}
+
+bool 
+NqstaWifiMac::IsWaitAssocResp (void) const
+{
+  return m_state == WAIT_ASSOC_RESP;
 }
 
 void 
@@ -553,7 +559,7 @@
         {
           goodBeacon = true;
         }
-      if (IsAssociated () && hdr->GetAddr3 () != GetBssid ())
+      if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
         {
           goodBeacon = false;
         }
--- a/src/devices/wifi/nqsta-wifi-mac.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/nqsta-wifi-mac.h	Fri Jul 03 09:59:04 2009 +0400
@@ -130,7 +130,8 @@
   void TryToEnsureAssociated (void);
   void AssocRequestTimeout (void);
   void ProbeRequestTimeout (void);
-  bool IsAssociated (void);
+  bool IsAssociated (void) const;
+  bool IsWaitAssocResp (void) const;
   void MissedBeacons (void);
   void RestartBeaconWatchdog (Time delay);
   SupportedRates GetSupportedRates (void) const;
--- a/src/devices/wifi/qsta-wifi-mac.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/qsta-wifi-mac.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -484,9 +484,15 @@
 }
 
 bool
-QstaWifiMac::IsAssociated ()
+QstaWifiMac::IsAssociated (void) const
 {
-  return (m_state == ASSOCIATED)?true:false;
+  return m_state == ASSOCIATED;
+}
+
+bool 
+QstaWifiMac::IsWaitAssocResp (void) const
+{
+  return m_state == WAIT_ASSOC_RESP;
 }
 
 void
@@ -593,7 +599,7 @@
         {
           goodBeacon = true;
         }
-      if (IsAssociated () && hdr->GetAddr3 () != GetBssid ())
+      if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
         {
           goodBeacon = false;
         }
--- a/src/devices/wifi/qsta-wifi-mac.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/qsta-wifi-mac.h	Fri Jul 03 09:59:04 2009 +0400
@@ -101,7 +101,8 @@
   void SendAssociationRequest (void);
   void SendProbeRequest (void);
   void TryToEnsureAssociated (void);
-  bool IsAssociated (void);
+  bool IsAssociated (void) const;
+  bool IsWaitAssocResp (void) const;
   virtual void DoDispose (void);
 
  /**
--- a/src/devices/wifi/wifi-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/wifi-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -157,6 +157,11 @@
 {
   return m_phy->GetChannel ();
 }
+void 
+WifiNetDevice::SetAddress (Address address)
+{
+  m_mac->SetAddress (Mac48Address::ConvertFrom (address));
+}
 Address 
 WifiNetDevice::GetAddress (void) const
 {
--- a/src/devices/wifi/wifi-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/wifi-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -78,6 +78,7 @@
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
--- a/src/devices/wifi/wifi-phy.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/wifi-phy.h	Fri Jul 03 09:59:04 2009 +0400
@@ -309,7 +309,7 @@
    * on a nearby channel.
    * @param rate the PHY data rate in units of 500kbps (i.e., the same
    * units used both for the radiotap and for the prism header) 
-   * @param isPreambleShort true if short preamble is used, false otherwise
+   * @param isShortPreamble true if short preamble is used, false otherwise
    * @param signalDbm signal power in dBm
    * @param noiseDbm  noise power in dBm
    */
@@ -331,7 +331,7 @@
    * on a nearby channel.
    * @param rate the PHY data rate in units of 500kbps (i.e., the same
    * units used both for the radiotap and for the prism header) 
-   * @param isPreambleShort true if short preamble is used, false otherwise
+   * @param isShortPreamble true if short preamble is used, false otherwise
    */
   void NotifyPromiscSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble);
   
--- a/src/devices/wifi/wifi.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/devices/wifi/wifi.h	Fri Jul 03 09:59:04 2009 +0400
@@ -94,17 +94,20 @@
  *     used by Qos high MACs and performs also QoS operations like 802.11n MSDU
  *     aggregation.
  *
- * The PHY layer implements a single model in the ns3::WifiPhy class: the
+ * The PHY layer implements a single 802.11a model in the ns3::WifiPhy class: the
  * physical layer model implemented there is described fully in a paper titled
- * "Yet Another Network Simulator", available at: http://cutebugs.net/files/wns2-yans.pdf and recently extended to cover 802.11b physical layer.
+ * "Yet Another Network Simulator", available at: http://cutebugs.net/files/wns2-yans.pdf 
+ * and recently extended to cover 802.11b physical layer.
  * 
  * The Wifi Model also provides a set of Rate control algorithms:
- *   - ns3::ArfMacStations 
- *   - ns3::AArfMacStations
- *   - ns3::IdealMacStations
- *   - ns3::CrMacStations
- *   - ns3::OnoeMacStations
- *   - ns3::AmrrMacStations
+ *   - ns3::ArfWifiManager
+ *   - ns3::AarfWifiManager
+ *   - ns3::IdealWifiManager
+ *   - ns3::CrWifiManager
+ *   - ns3::OnoeWifiManager
+ *   - ns3::AmrrWifiManager
+ *   - ns3::CaraWifiManager
+ *   - ns3::AarfcdWifiManager
  *
  * \section WifiTracingModel Wifi Tracing Model
  *
--- a/src/helper/internet-stack-helper.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/internet-stack-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -153,7 +153,6 @@
 #include "ns3/object.h"
 #include "ns3/names.h"
 #include "ns3/ipv4.h"
-#include "internet-stack-helper.h"
 #include "ns3/packet-socket-factory.h"
 #include "ns3/config.h"
 #include "ns3/simulator.h"
@@ -162,8 +161,10 @@
 #include "ns3/callback.h"
 #include "ns3/node.h"
 #include "ns3/core-config.h"
-#include "ns3/ipv4-list-routing-impl.h"
-#include "ns3/ipv4-static-routing-impl.h"
+#include "internet-stack-helper.h"
+#include "ipv4-list-routing-helper.h"
+#include "ipv4-static-routing-helper.h"
+#include "ipv4-global-routing-helper.h"
 #include <limits>
 
 namespace ns3 {
@@ -174,6 +175,18 @@
 InternetStackHelper::InternetStackHelper ()
 {
   SetTcp ("ns3::TcpL4Protocol");
+  static Ipv4StaticRoutingHelper staticRouting;
+  static Ipv4GlobalRoutingHelper globalRouting;
+  static Ipv4ListRoutingHelper listRouting;
+  listRouting.Add (staticRouting, 0);
+  listRouting.Add (globalRouting, -10);
+  SetRoutingHelper (listRouting);
+}
+
+void 
+InternetStackHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing)
+{
+  m_routing = &routing;
 }
 
 void
@@ -213,8 +226,14 @@
     }
 }
 
-static void
-CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
+void 
+InternetStackHelper::InstallAll (void) const
+{
+  Install (NodeContainer::GetGlobal ());
+}
+
+void
+InternetStackHelper::CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
 {
   ObjectFactory factory;
   factory.SetTypeId(typeId);
@@ -241,13 +260,8 @@
   node->AggregateObject (factory);
   // Set routing
   Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
-  // XXX cut this over to use of TypeIds and factories
-  Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
-  Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
-  ipv4staticRoutingImpl->SetNode (node);
-  ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
-  ipv4->SetRoutingProtocol (ipv4RoutingImpl);
-  ipv4RoutingImpl->SetNode (node);
+  Ptr<Ipv4RoutingProtocol> ipv4Routing = m_routing->Create (node);
+  ipv4->SetRoutingProtocol (ipv4Routing);
 }
 
 void
--- a/src/helper/internet-stack-helper.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/internet-stack-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -31,6 +31,7 @@
 namespace ns3 {
 
 class Node;
+class Ipv4RoutingHelper;
 
 /**
  * \brief aggregate IP/TCP/UDP functionality to existing Nodes.
@@ -38,9 +39,29 @@
 class InternetStackHelper
 {
 public:
+  /**
+   * Create a new InternetStackHelper which uses a mix of static routing
+   * and global routing by default. The static routing protocol 
+   * (ns3::Ipv4StaticRouting) and the global routing protocol are
+   * stored in an ns3::Ipv4ListRouting protocol with priorities 0, and -10
+   * by default. If you wish to use different priorites and different
+   * routing protocols, you need to use an adhoc ns3::Ipv4RoutingHelper, 
+   * such as ns3::OlsrHelper
+   */
   InternetStackHelper(void);
 
   /**
+   * \param routing a new routing helper
+   *
+   * Set the routing helper to use during Install. The routing
+   * helper is really an object factory which is used to create 
+   * an object of type ns3::Ipv4RoutingProtocol per node. This routing
+   * object is then associated to a single ns3::Ipv4 object through its 
+   * ns3::Ipv4::SetRoutingProtocol.
+   */
+  void SetRoutingHelper (const Ipv4RoutingHelper &routing);
+
+  /**
    * Aggregate implementations of the ns3::Ipv4, ns3::Udp, and ns3::Tcp classes
    * onto the provided node.  This method will assert if called on a node that 
    * already has an Ipv4 object aggregated to it.
@@ -69,6 +90,11 @@
    */
   void Install (NodeContainer c) const;
 
+  /**
+   * Aggregate ip, udp, and tcp stacks to all nodes in the simulation
+   */
+  void InstallAll (void) const;
+
  /**
    * \brief set the Tcp stack which will not need any other parameter.  
    *
@@ -132,6 +158,8 @@
 
 private:
   ObjectFactory m_tcpFactory;
+  const Ipv4RoutingHelper *m_routing;
+  static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
   static void Cleanup (void);
   static void LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
   static void LogTxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-global-routing-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,63 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ipv4-global-routing-helper.h"
+#include "ns3/global-router-interface.h"
+#include "ns3/ipv4-global-routing.h"
+#include "ns3/ipv4-list-routing.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE("GlobalRoutingHelper");
+
+namespace ns3 {
+
+Ipv4GlobalRoutingHelper::Ipv4GlobalRoutingHelper ()
+{}
+Ptr<Ipv4RoutingProtocol> 
+Ipv4GlobalRoutingHelper::Create (Ptr<Node> node) const
+{
+  NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << 
+		node->GetId ());
+
+  Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> ();
+  node->AggregateObject (globalRouter);
+
+  NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
+  Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
+  globalRouter->SetRoutingProtocol (globalRouting);
+
+  return globalRouting;
+}
+
+void 
+Ipv4GlobalRoutingHelper::PopulateRoutingTables (void)
+{
+  GlobalRouteManager::BuildGlobalRoutingDatabase ();
+  GlobalRouteManager::InitializeRoutes ();
+}
+void 
+Ipv4GlobalRoutingHelper::RecomputeRoutingTables (void)
+{
+  GlobalRouteManager::DeleteGlobalRoutes ();
+  GlobalRouteManager::BuildGlobalRoutingDatabase ();
+  GlobalRouteManager::InitializeRoutes ();
+}
+
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-global-routing-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,70 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef IPV4_GLOBAL_ROUTING_HELPER_H
+#define IPV4_GLOBAL_ROUTING_HELPER_H
+
+#include "node-container.h"
+#include "ipv4-routing-helper.h"
+
+namespace ns3 {
+
+/**
+ * \brief Helper class that adds ns3::Ipv4GlobalRouting objects
+ */
+class Ipv4GlobalRoutingHelper  : public Ipv4RoutingHelper
+{
+public:
+  Ipv4GlobalRoutingHelper ();
+  /**
+   * \param node the node on which the routing protocol will run
+   * \returns a newly-created routing protocol
+   *
+   * This method will be called by ns3::InternetStackHelper::Install
+   */
+  virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const;
+
+  /**
+   * @brief Build a routing database and initialize the routing tables of
+   * the nodes in the simulation.  Makes all nodes in the simulation into
+   * routers.
+   *
+   * All this function does is call the functions
+   * BuildGlobalRoutingDatabase () and  InitializeRoutes ().
+   *
+   */
+  static void PopulateRoutingTables (void);
+  /**
+   *@brief Remove all routes that were previously installed in a prior call
+   * to either PopulateRoutingTables() or RecomputeRoutingTables(), and 
+   * add a new set of routes.  
+   * 
+   * This method does not change the set of nodes
+   * over which GlobalRouting is being used, but it will dynamically update
+   * its representation of the global topology before recomputing routes.
+   * Users must first call PopulateRoutingTables() and then may subsequently
+   * call RecomputeRoutingTables() at any later time in the simulation.
+   *
+   */
+  static void RecomputeRoutingTables (void);
+};
+
+} // namespace ns3
+
+#endif /* IPV4_GLOBAL_ROUTING_HELPER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-list-routing-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,46 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ipv4-list-routing-helper.h"
+#include "ns3/ipv4-list-routing.h"
+#include "ns3/node.h"
+
+namespace ns3 {
+
+Ipv4ListRoutingHelper::Ipv4ListRoutingHelper()
+{}
+void 
+Ipv4ListRoutingHelper::Add (const Ipv4RoutingHelper &routing, int16_t priority)
+{
+  m_list.push_back (std::make_pair(&routing,priority));
+}
+Ptr<Ipv4RoutingProtocol> 
+Ipv4ListRoutingHelper::Create (Ptr<Node> node) const
+{
+  Ptr<Ipv4ListRouting> list = CreateObject<Ipv4ListRouting> ();
+  for (std::list<std::pair<const Ipv4RoutingHelper *,int16_t> >::const_iterator i = m_list.begin ();
+       i != m_list.end (); ++i)
+    {
+      Ptr<Ipv4RoutingProtocol> prot = i->first->Create (node);
+      list->AddRoutingProtocol (prot,i->second);
+    }
+  return list;
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-list-routing-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,60 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef IPV4_LIST_ROUTING_HELPER_H
+#define IPV4_LIST_ROUTING_HELPER_H
+
+#include "ipv4-routing-helper.h"
+#include <stdint.h>
+#include <list>
+
+namespace ns3 {
+
+/**
+ * \brief Helper class that adds ns3::Ipv4ListRouting objects
+ */
+class Ipv4ListRoutingHelper : public Ipv4RoutingHelper
+{
+public:
+  Ipv4ListRoutingHelper();
+  /**
+   * \param routing a routing helper
+   * \param priority the priority of the associated helper
+   *
+   * Store in the internal list a reference to the input routing helper
+   * and associated priority. These helpers will be used later by
+   * the ns3::Ipv4ListRoutingHelper::Create method to create
+   * an ns3::Ipv4ListRouting object and add in it routing protocols
+   * created with the helpers.
+   */
+  void Add (const Ipv4RoutingHelper &routing, int16_t priority);
+  /**
+   * \param node the node on which the routing protocol will run
+   * \returns a newly-created routing protocol
+   *
+   * This method will be called by ns3::InternetStackHelper::Install
+   */
+  virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const;
+private:
+  std::list<std::pair<const Ipv4RoutingHelper *,int16_t> > m_list;
+};
+
+} // namespace ns3
+
+#endif /* IPV4_LIST_ROUTING_HELPER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-routing-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,27 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#include "ipv4-routing-helper.h"
+
+namespace ns3 {
+
+Ipv4RoutingHelper::~Ipv4RoutingHelper ()
+{}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/helper/ipv4-routing-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef IPV4_ROUTING_HELPER_H
+#define IPV4_ROUTING_HELPER_H
+
+#include "ns3/ptr.h"
+
+namespace ns3 {
+
+class Ipv4RoutingProtocol;
+class Node;
+
+/**
+ * \brief a factory to create ns3::Ipv4RoutingProtocol objects
+ *
+ * For each new routing protocol created as a subclass of 
+ * ns3::Ipv4RoutingProtocol, you need to create a subclass of 
+ * ns3::Ipv4RoutingHelper which can be used by 
+ * ns3::InternetStackHelper::SetRoutingProtocol and 
+ * ns3::InternetStackHelper::Install.
+ */
+class Ipv4RoutingHelper
+{
+public:
+  virtual ~Ipv4RoutingHelper ();
+  /**
+   * \param node the node within which the new routing protocol will run
+   * \returns a newly-created routing protocol
+   */
+  virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const = 0;
+};
+
+} // namespace ns3
+
+
+#endif /* IPV4_ROUTING_HELPER_H */
--- a/src/helper/ipv4-static-routing-helper.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/ipv4-static-routing-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -33,6 +33,15 @@
 
 namespace ns3 {
 
+Ipv4StaticRoutingHelper::Ipv4StaticRoutingHelper()
+{}
+Ptr<Ipv4RoutingProtocol> 
+Ipv4StaticRoutingHelper::Create (Ptr<Node> node) const
+{
+  return CreateObject<Ipv4StaticRouting> ();
+}
+
+
 Ptr<Ipv4StaticRouting>
 Ipv4StaticRoutingHelper::GetStaticRouting (Ptr<Ipv4> ipv4) const
 {
--- a/src/helper/ipv4-static-routing-helper.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/ipv4-static-routing-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -25,14 +25,28 @@
 #include "ns3/ipv4-address.h"
 #include "ns3/node.h"
 #include "ns3/net-device.h"
+#include "ipv4-routing-helper.h"
 #include "node-container.h"
 #include "net-device-container.h"
 
 namespace ns3 {
 
-class Ipv4StaticRoutingHelper
+/**
+ * \brief Helper class that adds ns3::Ipv4StaticRouting objects
+ */
+class Ipv4StaticRoutingHelper : public Ipv4RoutingHelper
 {
 public:
+  Ipv4StaticRoutingHelper();
+
+  /**
+   * \param node the node on which the routing protocol will run
+   * \returns a newly-created routing protocol
+   *
+   * This method will be called by ns3::InternetStackHelper::Install
+   */
+  virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const;
+
   Ptr<Ipv4StaticRouting> GetStaticRouting (Ptr<Ipv4> ipv4) const;
 
   void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,  
--- a/src/helper/olsr-helper.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/olsr-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -30,65 +30,18 @@
   m_agentFactory.SetTypeId ("ns3::olsr::RoutingProtocol");
 }
 
-void 
-OlsrHelper::SetAgent (std::string tid,
-                      std::string n0, const AttributeValue &v0,
-                      std::string n1, const AttributeValue &v1,
-                      std::string n2, const AttributeValue &v2,
-                      std::string n3, const AttributeValue &v3,
-                      std::string n4, const AttributeValue &v4,
-                      std::string n5, const AttributeValue &v5,
-                      std::string n6, const AttributeValue &v6,
-                      std::string n7, const AttributeValue &v7)
+Ptr<Ipv4RoutingProtocol> 
+OlsrHelper::Create (Ptr<Node> node) const
 {
-  m_agentFactory.SetTypeId (tid);
-  m_agentFactory.Set (n0, v0);
-  m_agentFactory.Set (n1, v1);
-  m_agentFactory.Set (n2, v2);
-  m_agentFactory.Set (n3, v3);
-  m_agentFactory.Set (n4, v4);
-  m_agentFactory.Set (n5, v5);
-  m_agentFactory.Set (n6, v6);
-  m_agentFactory.Set (n7, v7);
+  Ptr<olsr::RoutingProtocol> agent = m_agentFactory.Create<olsr::RoutingProtocol> ();
+  node->AggregateObject (agent);
+  return agent;
 }
 
 void 
-OlsrHelper::Install (NodeContainer container)
-{
-  for (NodeContainer::Iterator i = container.Begin (); i != container.End (); ++i)
-    {
-      Ptr<Node> node = *i;
-      Install (node);
-    }
-}
-void 
-OlsrHelper::Install (Ptr<Node> node)
+OlsrHelper::Set (std::string name, const AttributeValue &value)
 {
-  if (node->GetObject<olsr::RoutingProtocol> () != 0)
-    {
-      NS_FATAL_ERROR ("OlsrHelper::Install(): Aggregating "
-         "an Olsr Agent to a node with an existing Olsr RoutingProtocol");
-      return;
-    }
-  Ptr<olsr::RoutingProtocol> agent = m_agentFactory.Create<olsr::RoutingProtocol> ();
-  node->AggregateObject (agent);
-  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
-  Ptr<Ipv4ListRouting> ipv4Routing = DynamicCast<Ipv4ListRouting> (ipv4->GetRoutingProtocol ());
-  NS_ASSERT (ipv4Routing);
-  ipv4Routing->AddRoutingProtocol (agent, 10);
-  agent->SetNode (node);
-  agent->Start ();
-}
-void 
-OlsrHelper::Install (std::string nodeName)
-{
-  Ptr<Node> node = Names::Find<Node> (nodeName);
-  Install (node);
-}
-void 
-OlsrHelper::InstallAll (void)
-{
-  Install (NodeContainer::GetGlobal ());
+  m_agentFactory.Set (name, value);
 }
 
 } // namespace ns3
--- a/src/helper/olsr-helper.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/olsr-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -21,48 +21,35 @@
 #define OLSR_HELPER_H
 
 #include "ns3/object-factory.h"
-#include "ns3/node-container.h"
 #include "ns3/node.h"
+#include "node-container.h"
+#include "ipv4-routing-helper.h"
 
 namespace ns3 {
 
 /**
  * \brief Helper class that adds OLSR routing to nodes.
  */
-class OlsrHelper
+class OlsrHelper : public Ipv4RoutingHelper
 {
 public:
   OlsrHelper ();
 
   /**
-   * \brief Set default OLSR routing agent attributes
+   * \param node the node on which the routing protocol will run
+   * \returns a newly-created routing protocol
+   *
+   * This method will be called by ns3::InternetStackHelper::Install
    */
-  void SetAgent (std::string tid,
-                 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
-                 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
-                 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
-                 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
-                 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
-                 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
-                 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
-                 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
+  virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const;
 
   /**
-   * \brief Enable OLSR routing for a set of nodes
-   */
-  void Install (NodeContainer container);
-  /**
-   * \brief Enable OLSR routing for a single node
+   * \param name the name of the attribute to set
+   * \param value the value of the attribute to set.
+   *
+   * This method controls the attributes of ns3::olsr::RoutingProtocol
    */
-  void Install (Ptr<Node> node);
-  /**
-   * \brief Enable OLSR routing for a single node
-   */
-  void Install (std::string nodeName);
-  /**
-   * \brief Enable OLSR routing for all nodes
-   */
-  void InstallAll (void);
+  void Set (std::string name, const AttributeValue &value);
 private:
   ObjectFactory m_agentFactory;
 };
--- a/src/helper/udp-echo-helper.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/udp-echo-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -88,6 +88,24 @@
   m_factory.Set (name, value);
 }
 
+void
+UdpEchoClientHelper::SetFill (Ptr<Application> app, std::string fill)
+{
+  app->GetObject<UdpEchoClient>()->SetFill (fill);
+}
+
+void
+UdpEchoClientHelper::SetFill (Ptr<Application> app, uint8_t fill, uint32_t dataLength)
+{
+  app->GetObject<UdpEchoClient>()->SetFill (fill, dataLength);
+}
+
+void
+UdpEchoClientHelper::SetFill (Ptr<Application> app, uint8_t *fill, uint32_t fillLength, uint32_t dataLength)
+{
+  app->GetObject<UdpEchoClient>()->SetFill (fill, fillLength, dataLength);
+}
+
 ApplicationContainer
 UdpEchoClientHelper::Install (Ptr<Node> node) const
 {
--- a/src/helper/udp-echo-helper.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/udp-echo-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -52,6 +52,57 @@
 
   void SetAttribute (std::string name, const AttributeValue &value);
 
+  /**
+   * Given a pointer to a UdpEchoClient application, set the data fill of the 
+   * packet (what is sent as data to the server) to the contents of the fill
+   * string (including the trailing zero terminator).
+   *
+   * \warn The size of resulting echo packets will be automatically adjusted
+   * to reflect the size of the fill string -- this means that the PacketSize
+   * attribute may be changed as a result of this call.
+   *
+   * \param app Smart pointer to the application (real type must be UdpEchoClient).
+   * \param fill The string to use as the actual echo data bytes.
+   */
+  void SetFill (Ptr<Application> app, std::string fill);
+
+  /**
+   * Given a pointer to a UdpEchoClient application, set the data fill of the 
+   * packet (what is sent as data to the server) to the contents of the fill
+   * byte.
+   *
+   * The fill byte will be used to initialize the contents of the data packet.
+   * 
+   * \warn The size of resulting echo packets will be automatically adjusted
+   * to reflect the dataLength parameter -- this means that the PacketSize
+   * attribute may be changed as a result of this call.
+   *
+   * \param app Smart pointer to the application (real type must be UdpEchoClient).
+   * \param fill The byte to be repeated in constructing the packet data..
+   * \param dataLength The desired length of the resulting echo packet data.
+   */
+  void SetFill (Ptr<Application> app, uint8_t fill, uint32_t dataLength);
+
+  /**
+   * Given a pointer to a UdpEchoClient application, set the data fill of the 
+   * packet (what is sent as data to the server) to the contents of the fill
+   * buffer, repeated as many times as is required.
+   *
+   * Initializing the fill to the contents of a single buffer is accomplished
+   * by providing a complete buffer with fillLength set to your desired 
+   * dataLength
+   *
+   * \warn The size of resulting echo packets will be automatically adjusted
+   * to reflect the dataLength parameter -- this means that the PacketSize
+   * attribute of the Application may be changed as a result of this call.
+   *
+   * \param app Smart pointer to the application (real type must be UdpEchoClient).
+   * \param fill The fill pattern to use when constructing packets.
+   * \param fillLength The number of bytes in the provided fill pattern.
+   * \param dataLength The desired length of the final echo data.
+   */
+  void SetFill (Ptr<Application> app, uint8_t *fill, uint32_t fillLength, uint32_t dataLength);
+
   ApplicationContainer Install (Ptr<Node> node) const;
   ApplicationContainer Install (std::string nodeName) const;
   ApplicationContainer Install (NodeContainer c) const;
--- a/src/helper/wifi-helper.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/wifi-helper.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -117,4 +117,39 @@
   return Install (phy, mac, NodeContainer (node));
 }
 
+void
+WifiHelper::EnableLogComponents (void)
+{
+  LogComponentEnable ("Aarfcd", LOG_LEVEL_ALL);
+  LogComponentEnable ("AdhocWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("AmrrWifiRemoteStation", LOG_LEVEL_ALL);
+  LogComponentEnable ("ns3::ArfWifiManager", LOG_LEVEL_ALL);
+  LogComponentEnable ("Cara", LOG_LEVEL_ALL);
+  LogComponentEnable ("DcaTxop", LOG_LEVEL_ALL);
+  LogComponentEnable ("DcfManager", LOG_LEVEL_ALL);
+  LogComponentEnable ("EdcaTxopN", LOG_LEVEL_ALL);
+  LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL);
+  LogComponentEnable ("Jakes", LOG_LEVEL_ALL);
+  LogComponentEnable ("MacLow", LOG_LEVEL_ALL);
+  LogComponentEnable ("MacRxMiddle", LOG_LEVEL_ALL);
+  LogComponentEnable ("MsduAggregator", LOG_LEVEL_ALL);
+  LogComponentEnable ("MsduStandardAggregator", LOG_LEVEL_ALL);
+  LogComponentEnable ("NqapWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("NqstaWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("OnoeWifiRemoteStation", LOG_LEVEL_ALL);
+  LogComponentEnable ("PropagationLossModel", LOG_LEVEL_ALL);
+  LogComponentEnable ("QadhocWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("QapWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("QstaWifiMac", LOG_LEVEL_ALL);
+  LogComponentEnable ("RraaWifiManager", LOG_LEVEL_ALL);
+  LogComponentEnable ("SupportedRates", LOG_LEVEL_ALL);
+  LogComponentEnable ("WifiChannel", LOG_LEVEL_ALL);
+  LogComponentEnable ("WifiPhyStateHelper", LOG_LEVEL_ALL);
+  LogComponentEnable ("WifiPhy", LOG_LEVEL_ALL);
+  LogComponentEnable ("WifiRemoteStationManager", LOG_LEVEL_ALL);
+  LogComponentEnable ("YansErrorRateModel", LOG_LEVEL_ALL);
+  LogComponentEnable ("YansWifiChannel", LOG_LEVEL_ALL);
+  LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL);
+}
+
 } // namespace ns3
--- a/src/helper/wifi-helper.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/wifi-helper.h	Fri Jul 03 09:59:04 2009 +0400
@@ -155,6 +155,11 @@
   NetDeviceContainer Install (const WifiPhyHelper &phy,
                               const WifiMacHelper &mac, std::string nodeName) const;
 
+  /**
+   * Helper to enable all WifiNetDevice log components with one statement 
+   */
+  static void EnableLogComponents (void);
+
 private:
   ObjectFactory m_stationManager;
 };
--- a/src/helper/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/helper/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -25,6 +25,9 @@
         'v4ping-helper.cc',
         'nqos-wifi-mac-helper.cc',
         'qos-wifi-mac-helper.cc',
+        'ipv4-global-routing-helper.cc',
+        'ipv4-list-routing-helper.cc',
+        'ipv4-routing-helper.cc',
         'mesh-interface-helper.cc',
         'mesh-helper.cc',
         ]
@@ -54,6 +57,9 @@
         'v4ping-helper.h',
         'nqos-wifi-mac-helper.h',
         'qos-wifi-mac-helper.h',
+        'ipv4-global-routing-helper.h',
+        'ipv4-list-routing-helper.h',
+        'ipv4-routing-helper.h',
         'mesh-interface-helper.h',
         'mesh-helper.h',
         ]
--- a/src/internet-stack/arp-l3-protocol.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/arp-l3-protocol.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -23,6 +23,7 @@
 #include "ns3/net-device.h"
 #include "ns3/object-vector.h"
 #include "ns3/trace-source-accessor.h"
+#include "ns3/ipv4-route.h"
 
 #include "ipv4-l3-protocol.h"
 #include "arp-l3-protocol.h"
@@ -160,73 +161,82 @@
       NS_LOG_LOGIC ("ARP: Cannot remove ARP header");
       return;
     }
-  // XXX multi-address case  
   NS_LOG_LOGIC ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") <<
             " node="<<m_node->GetId ()<<", got request from " <<
             arp.GetSourceIpv4Address () << " for address " <<
-            arp.GetDestinationIpv4Address () << "; we have address " <<
-            cache->GetInterface ()->GetAddress (0).GetLocal ());
+            arp.GetDestinationIpv4Address () << "; we have addresses: ");
+  for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
+    {
+      NS_LOG_LOGIC (cache->GetInterface ()->GetAddress (i).GetLocal () << ", ");
+    }
 
   /**
    * Note: we do not update the ARP cache when we receive an ARP request
    * from an unknown node. See bug #107
    */
-  // XXX multi-address case
-  if (arp.IsRequest () && 
-      arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress (0).GetLocal ()) 
-    {
-      NS_LOG_LOGIC ("node="<<m_node->GetId () <<", got request from " << 
-                arp.GetSourceIpv4Address () << " -- send reply");
-      SendArpReply (cache, arp.GetSourceIpv4Address (),
-                    arp.GetSourceHardwareAddress ());
-    } 
-  // XXX multi-address case
-  else if (arp.IsReply () &&
-           arp.GetDestinationIpv4Address ().IsEqual (cache->GetInterface ()->GetAddress (0).GetLocal ()) &&
-           arp.GetDestinationHardwareAddress () == device->GetAddress ()) 
+  bool found = false;
+  for (uint32_t i = 0; i < cache->GetInterface ()->GetNAddresses (); i++)
     {
-      Ipv4Address from = arp.GetSourceIpv4Address ();
-      ArpCache::Entry *entry = cache->Lookup (from);
-      if (entry != 0)
+      if (arp.IsRequest () && arp.GetDestinationIpv4Address () == 
+        cache->GetInterface ()->GetAddress (i).GetLocal ()) 
         {
-          if (entry->IsWaitReply ()) 
+          found = true;
+          NS_LOG_LOGIC ("node="<<m_node->GetId () <<", got request from " << 
+                arp.GetSourceIpv4Address () << " -- send reply");
+          SendArpReply (cache, arp.GetSourceIpv4Address (),
+                    arp.GetSourceHardwareAddress ());
+          break;
+        } 
+      else if (arp.IsReply () && 
+        arp.GetDestinationIpv4Address ().IsEqual (cache->GetInterface ()->GetAddress (i).GetLocal ()) &&
+        arp.GetDestinationHardwareAddress () == device->GetAddress ()) 
+        {
+          found = true;
+          Ipv4Address from = arp.GetSourceIpv4Address ();
+          ArpCache::Entry *entry = cache->Lookup (from);
+          if (entry != 0)
             {
-              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply from " << 
-                        arp.GetSourceIpv4Address ()
+              if (entry->IsWaitReply ()) 
+                {
+                  NS_LOG_LOGIC ("node="<< m_node->GetId () << 
+                    ", got reply from " << arp.GetSourceIpv4Address ()
                      << " for waiting entry -- flush");
-              Address from_mac = arp.GetSourceHardwareAddress ();
-              entry->MarkAlive (from_mac);
-              Ptr<Packet> pending = entry->DequeuePending();
-              while (pending != 0)
+                  Address from_mac = arp.GetSourceHardwareAddress ();
+                  entry->MarkAlive (from_mac);
+                  Ptr<Packet> pending = entry->DequeuePending();
+                  while (pending != 0)
+                    {
+                      cache->GetInterface ()->Send (pending,
+                                                arp.GetSourceIpv4Address ());
+                      pending = entry->DequeuePending();
+                    }
+                } 
+              else 
                 {
-                  cache->GetInterface ()->Send (pending,
-                                                arp.GetSourceIpv4Address ());
-                  pending = entry->DequeuePending();
+                  // ignore this reply which might well be an attempt 
+                  // at poisening my arp cache.
+                  NS_LOG_LOGIC("node="<<m_node->GetId ()<<", got reply from " << 
+                        arp.GetSourceIpv4Address () << 
+                        " for non-waiting entry -- drop");
+                  m_dropTrace (packet);
                 }
             } 
           else 
             {
-              // ignore this reply which might well be an attempt 
-              // at poisening my arp cache.
-              NS_LOG_LOGIC("node="<<m_node->GetId ()<<", got reply from " << 
-                        arp.GetSourceIpv4Address () << 
-                        " for non-waiting entry -- drop");
+              NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop");
               m_dropTrace (packet);
             }
-        } 
-      else 
-        {
-          NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop");
-          m_dropTrace (packet);
+          break;
         }
     }
-  else
+  if (found == false)
     {
       NS_LOG_LOGIC ("node="<<m_node->GetId ()<<", got request from " <<
                 arp.GetSourceIpv4Address () << " for unknown address " <<
                 arp.GetDestinationIpv4Address () << " -- drop");
     }
 }
+
 bool 
 ArpL3Protocol::Lookup (Ptr<Packet> packet, Ipv4Address destination, 
                        Ptr<NetDevice> device,
@@ -301,17 +311,25 @@
 {
   NS_LOG_FUNCTION (this << cache << to);
   ArpHeader arp;
+  // need to pick a source address; use routing implementation to select
+  Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
+  int32_t interface = ipv4->GetInterfaceForDevice (cache->GetDevice ());
+  NS_ASSERT (interface >= 0);
+  Ipv4Header header;
+  header.SetDestination (to);
+  Socket::SocketErrno errno_;
+  Ptr<Packet> packet = Create<Packet> ();
+  Ptr<Ipv4Route> route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, interface, errno_);
+  NS_ASSERT (route != 0);
   NS_LOG_LOGIC ("ARP: sending request from node "<<m_node->GetId ()<<
             " || src: " << cache->GetDevice ()->GetAddress () <<
-            " / " << cache->GetInterface ()->GetAddress (0).GetLocal () <<
+            " / " << route->GetSource () <<
             " || dst: " << cache->GetDevice ()->GetBroadcast () <<
             " / " << to);
-  // XXX multi-address case
   arp.SetRequest (cache->GetDevice ()->GetAddress (),
-		  cache->GetInterface ()->GetAddress (0).GetLocal (), 
+		  route->GetSource (),
                   cache->GetDevice ()->GetBroadcast (),
                   to);
-  Ptr<Packet> packet = Create<Packet> ();
   packet->AddHeader (arp);
   cache->GetDevice ()->Send (packet, cache->GetDevice ()->GetBroadcast (), PROT_NUMBER);
 }
@@ -321,15 +339,22 @@
 {
   NS_LOG_FUNCTION (this << cache << toIp << toMac);
   ArpHeader arp;
+  // need to pick a source address; use routing implementation to select
+  Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
+  int32_t interface = ipv4->GetInterfaceForDevice (cache->GetDevice ());
+  NS_ASSERT (interface >= 0);
+  Ipv4Header header;
+  header.SetDestination (toIp);
+  Socket::SocketErrno errno_;
+  Ptr<Packet> packet = Create<Packet> ();
+  Ptr<Ipv4Route> route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, interface, errno_);
+  NS_ASSERT (route != 0);
   NS_LOG_LOGIC ("ARP: sending reply from node "<<m_node->GetId ()<<
             "|| src: " << cache->GetDevice ()->GetAddress () << 
-            " / " << cache->GetInterface ()->GetAddress (0).GetLocal () <<
+            " / " << route->GetSource () <<
             " || dst: " << toMac << " / " << toIp);
-  // XXX multi-address case
   arp.SetReply (cache->GetDevice ()->GetAddress (),
-                cache->GetInterface ()->GetAddress (0).GetLocal (),
-                toMac, toIp);
-  Ptr<Packet> packet = Create<Packet> ();
+                route->GetSource (), toMac, toIp);
   packet->AddHeader (arp);
   cache->GetDevice ()->Send (packet, toMac, PROT_NUMBER);
 }
--- a/src/internet-stack/icmpv4-l4-protocol.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/icmpv4-l4-protocol.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -16,9 +16,7 @@
 NS_OBJECT_ENSURE_REGISTERED (Icmpv4L4Protocol);
 
   // see rfc 792
-enum {
- ICMP_PROTOCOL = 1
-};
+const uint8_t Icmpv4L4Protocol::PROT_NUMBER = 1;
 
 TypeId 
 Icmpv4L4Protocol::GetTypeId (void)
@@ -68,13 +66,13 @@
 uint16_t 
 Icmpv4L4Protocol::GetStaticProtocolNumber (void)
 {
-  return ICMP_PROTOCOL;
+  return PROT_NUMBER;
 }
 
 int 
 Icmpv4L4Protocol::GetProtocolNumber (void) const
 {
-  return ICMP_PROTOCOL;
+  return PROT_NUMBER;
 }
 void
 Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t type, uint8_t code)
@@ -83,10 +81,10 @@
   NS_ASSERT (ipv4 != 0 && ipv4->GetRoutingProtocol () != 0);
   Ipv4Header header;
   header.SetDestination (dest);
-  Socket::SocketErrno errno;
+  Socket::SocketErrno errno_;
   Ptr<Ipv4Route> route;
   uint32_t oif = 0; //specify non-zero if bound to a source address
-  route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+  route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_);
   if (route != 0)
     {
       NS_LOG_LOGIC ("Route exists");
@@ -111,7 +109,7 @@
       icmp.EnableChecksum ();
     }
   packet->AddHeader (icmp);
-  ipv4->Send (packet, source, dest, ICMP_PROTOCOL, route);
+  ipv4->Send (packet, source, dest, PROT_NUMBER, route);
 }
 void 
 Icmpv4L4Protocol::SendDestUnreachFragNeeded (Ipv4Header header, 
--- a/src/internet-stack/icmpv4-l4-protocol.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/icmpv4-l4-protocol.h	Fri Jul 03 09:59:04 2009 +0400
@@ -15,6 +15,8 @@
 {
 public:
   static TypeId GetTypeId (void);
+  static const uint8_t PROT_NUMBER;
+
   Icmpv4L4Protocol ();
   virtual ~Icmpv4L4Protocol ();
 
--- a/src/internet-stack/icmpv4.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/icmpv4.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -1,3 +1,23 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
 #include "icmpv4.h"
 #include "ns3/packet.h"
 
@@ -94,7 +114,6 @@
 /********************************************************
  *        Icmpv4Echo
  ********************************************************/
-
 void 
 Icmpv4Echo::SetIdentifier (uint16_t id)
 {
@@ -108,9 +127,21 @@
 void 
 Icmpv4Echo::SetData (Ptr<const Packet> data)
 {
-  uint32_t size = (data->GetSize ()>16)?16:data->GetSize();
+  uint32_t size = data->GetSize ();
+  //
+  // All kinds of optimizations are possible, but let's not get carried away
+  // since this is probably a very uncommon thing in the big picture.
+  //
+  // N.B. Zero is a legal size for the alloc below even though a hardcoded zero
+  // would result in  warning.
+  //
+  if (size != m_dataSize)
+    {
+      delete [] m_data;
+      m_data = new uint8_t[size];
+      m_dataSize = size;
+    }
   data->CopyData (m_data, size);
-  m_dataSize = size;
 }
 uint16_t 
 Icmpv4Echo::GetIdentifier (void) const
@@ -123,13 +154,16 @@
   return m_sequence;
 }
 uint32_t
-Icmpv4Echo::GetData (uint8_t data[16]) const
+Icmpv4Echo::GetDataSize (void) const
 {
-  memcpy (data, m_data, m_dataSize);
   return m_dataSize;
 }
-
-
+uint32_t
+Icmpv4Echo::GetData (uint8_t payload[]) const
+{
+  memcpy (payload, m_data, m_dataSize);
+  return m_dataSize;
+}
 TypeId 
 Icmpv4Echo::GetTypeId (void)
 {
@@ -144,14 +178,18 @@
     m_sequence (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;
-    }
+  //
+  // After construction, m_data is always valid until destruction.  This is true
+  // even if m_dataSize is zero.
+  //
+  m_data = new uint8_t[m_dataSize];
 }
 Icmpv4Echo::~Icmpv4Echo ()
-{}
+{
+  delete [] m_data;
+  m_data = 0;
+  m_dataSize = 0;
+}
 TypeId 
 Icmpv4Echo::GetInstanceTypeId (void) const
 {
@@ -175,9 +213,15 @@
   m_identifier = start.ReadNtohU16 ();
   m_sequence = start.ReadNtohU16 ();
   NS_ASSERT (start.GetSize () >= 4);
-  m_dataSize = start.GetSize () - 4;
+  uint32_t size = start.GetSize () - 4;
+  if (size != m_dataSize)
+    {
+      delete [] m_data;
+      m_data = new uint8_t[size];
+      m_dataSize = size;
+    }
   start.Read (m_data, m_dataSize);
-  return start.GetSize ();
+  return m_dataSize;
 }
 void 
 Icmpv4Echo::Print (std::ostream &os) const
--- a/src/internet-stack/icmpv4.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/icmpv4.h	Fri Jul 03 09:59:04 2009 +0400
@@ -50,7 +50,8 @@
   void SetData (Ptr<const Packet> data);
   uint16_t GetIdentifier (void) const;
   uint16_t GetSequenceNumber (void) const;
-  uint32_t GetData (uint8_t payload[16]) const;
+  uint32_t GetDataSize (void) const;
+  uint32_t GetData (uint8_t payload[]) const;
 
 
   static TypeId GetTypeId (void);
@@ -64,7 +65,7 @@
 private:
   uint16_t m_identifier;
   uint16_t m_sequence;
-  uint8_t m_data[16];
+  uint8_t *m_data;
   uint32_t m_dataSize;
 };
 
--- a/src/internet-stack/ipv4-end-point-demux.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-end-point-demux.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -219,11 +219,19 @@
                         << " does not match packet dport " << dport);
           continue;
         }
-      // XXX handle multi-address case
-      bool isBroadcast = (daddr.IsBroadcast () ||
-         daddr.IsSubnetDirectedBroadcast (
-             incomingInterface->GetAddress (0).GetMask ()));
-      Ipv4Address incomingInterfaceAddr = incomingInterface->GetAddress (0).GetLocal ();
+      bool subnetDirected = false;
+      Ipv4Address incomingInterfaceAddr = daddr;  // may be a broadcast
+      for (uint32_t i = 0; i < incomingInterface->GetNAddresses (); i++)
+        {
+          Ipv4InterfaceAddress addr = incomingInterface->GetAddress (i);
+          if (addr.GetLocal ().CombineMask (addr.GetMask ()) == daddr.CombineMask (addr.GetMask ()) &&
+            daddr.IsSubnetDirectedBroadcast (addr.GetMask ()))
+            {
+              subnetDirected = true;
+              incomingInterfaceAddr = addr.GetLocal ();
+            }
+        }
+      bool isBroadcast = (daddr.IsBroadcast () || subnetDirected == true);
       NS_LOG_DEBUG ("dest addr " << daddr << " broadcast? " << isBroadcast);
       bool localAddressMatchesWildCard = 
         endP->GetLocalAddress() == Ipv4Address::GetAny();
--- a/src/internet-stack/ipv4-interface.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-interface.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -43,7 +43,7 @@
                    "The arp cache for this ipv4 interface",
                    PointerValue (0),
                    MakePointerAccessor (&Ipv4Interface::m_cache),
-                   MakePointerChecker<Ipv4Interface> ())
+                   MakePointerChecker<ArpCache> ())
     ;
     ;
   return tid;
@@ -56,6 +56,7 @@
  */
 Ipv4Interface::Ipv4Interface () 
   : m_ifup (false),
+    m_forwarding (true),
     m_metric (1),
     m_node (0), 
     m_device (0),
@@ -127,13 +128,6 @@
   return m_metric;
 }
 
-uint16_t 
-Ipv4Interface::GetMtu (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_device->GetMtu ();
-}
-
 /**
  * These are IP interface states and may be distinct from 
  * NetDevice states, such as found in real implementations
@@ -167,6 +161,20 @@
   m_ifup = false;
 }
 
+bool 
+Ipv4Interface::IsForwarding (void) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  return m_forwarding;
+}
+
+void 
+Ipv4Interface::SetForwarding (bool val)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  m_forwarding = val;
+}
+
 void
 Ipv4Interface::Send (Ptr<Packet> p, Ipv4Address dest)
 {
@@ -262,13 +270,12 @@
   return m_ifaddrs.size();
 }
 
-uint32_t
+bool
 Ipv4Interface::AddAddress (Ipv4InterfaceAddress addr)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  uint32_t index = m_ifaddrs.size ();
   m_ifaddrs.push_back (addr);
-  return index;
+  return true;
 }
 
 Ipv4InterfaceAddress
@@ -292,7 +299,7 @@
   return (addr);  // quiet compiler
 }
 
-void
+Ipv4InterfaceAddress
 Ipv4Interface::RemoveAddress (uint32_t index)
 {
   NS_LOG_FUNCTION_NOARGS ();
@@ -306,12 +313,15 @@
     {
       if (tmp  == index)
         {
+          Ipv4InterfaceAddress addr = *i;
           m_ifaddrs.erase (i);
-          return;
+          return addr;
         }
        ++tmp;
     }
   NS_ASSERT_MSG (false, "Address " << index << " not found");
+  Ipv4InterfaceAddress addr;
+  return (addr);  // quiet compiler
 }
 
 }; // namespace ns3
--- a/src/internet-stack/ipv4-interface.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-interface.h	Fri Jul 03 09:59:04 2009 +0400
@@ -81,15 +81,6 @@
   uint16_t GetMetric (void) const;
 
   /**
-   * This function a pass-through to NetDevice GetMtu, modulo
-   * the  LLC/SNAP header i.e., ipv4MTU = NetDeviceMtu - LLCSNAPSIZE
-   * \returns the Maximum Transmission Unit associated to this interface.
-   *
-   * XXX deprecated?  This is duplicate API to GetDevice ()->GetMtu ()
-   */
-  uint16_t GetMtu (void) const;
-
-  /**
    * These are IP interface states and may be distinct from 
    * NetDevice states, such as found in real implementations
    * (where the device may be down but IP interface state is still up).
@@ -115,6 +106,16 @@
   void SetDown (void);
 
   /**
+   * \returns true if this interface is enabled for IP forwarding of input datagrams
+   */
+  bool IsForwarding (void) const;
+  
+  /**
+   * \param val Whether to enable or disable IP forwarding for input datagrams
+   */
+  void SetForwarding (bool val);
+
+  /**
    * \param p packet to send
    * \param dest next hop address of packet.
    *
@@ -125,9 +126,9 @@
 
   /**
    * \param address The Ipv4InterfaceAddress to add to the interface
-   * \returns The index of the newly-added Ipv4InterfaceAddress
+   * \returns true if succeeded
    */
-  uint32_t AddAddress (Ipv4InterfaceAddress address);
+  bool AddAddress (Ipv4InterfaceAddress address);
 
   /**
    * \param index Index of Ipv4InterfaceAddress to return
@@ -141,9 +142,10 @@
   uint32_t GetNAddresses (void) const;
 
   /**
-   * \param index index of Ipv4InterfaceAddress to remove from address list.
+   * \param index Index of Ipv4InterfaceAddress to remove
+   * \returns The Ipv4InterfaceAddress address whose index is index 
    */
-  void RemoveAddress (uint32_t index);
+  Ipv4InterfaceAddress RemoveAddress (uint32_t index);
 
 protected:
   virtual void DoDispose (void);
@@ -154,6 +156,7 @@
   typedef std::list<Ipv4InterfaceAddress>::iterator Ipv4InterfaceAddressListI;
 
   bool m_ifup;
+  bool m_forwarding;  // IN_DEV_FORWARD
   uint16_t m_metric;
   Ipv4InterfaceAddressList m_ifaddrs;
   Ptr<Node> m_node;
--- a/src/internet-stack/ipv4-l3-protocol.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-l3-protocol.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -32,13 +32,11 @@
 #include "ns3/ipv4-header.h"
 #include "ns3/boolean.h"
 #include "ns3/ipv4-routing-table-entry.h"
-#include "ns3/ipv4-static-routing.h"
 
 #include "loopback-net-device.h"
 #include "arp-l3-protocol.h"
 #include "ipv4-l3-protocol.h"
 #include "ipv4-l4-protocol.h"
-#include "ipv4-list-routing-impl.h"
 #include "icmpv4-l4-protocol.h"
 #include "ipv4-interface.h"
 #include "ipv4-raw-socket-impl.h"
@@ -163,12 +161,7 @@
 {
   NS_LOG_FUNCTION (this);
   m_routingProtocol = routingProtocol;
-  // XXX should check all interfaces to see if any were set to Up state
-  // prior to a routing protocol being added
-  if (GetStaticRouting () != 0)
-    {
-      GetStaticRouting ()->AddHostRouteTo (Ipv4Address::GetLoopback (), 0);
-    }
+  m_routingProtocol->SetIpv4 (this);
 }
 
 
@@ -194,11 +187,7 @@
     }
   m_interfaces.clear ();
   m_node = 0;
-  if (m_routingProtocol)
-    {
-      m_routingProtocol->Dispose ();
-      m_routingProtocol = 0;
-    }
+  m_routingProtocol = 0;
   Object::DoDispose ();
 }
 
@@ -230,11 +219,11 @@
   Ptr<Node> node = GetObject<Node> ();
   node->RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, this), 
                                  Ipv4L3Protocol::PROT_NUMBER, device);
-  if (GetStaticRouting () != 0)
+  interface->SetUp ();
+  if (m_routingProtocol != 0)
     {
-      GetStaticRouting ()->AddHostRouteTo (Ipv4Address::GetLoopback (), index);
+      m_routingProtocol->NotifyInterfaceUp (index);
     }
-  interface->SetUp ();
 }
 
 void 
@@ -244,26 +233,6 @@
   m_defaultTtl = ttl;
 }
     
-// XXX need to remove dependencies on Ipv4StaticRouting from this class
-Ptr<Ipv4StaticRouting>
-Ipv4L3Protocol::GetStaticRouting (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ptr<Ipv4StaticRouting> staticRouting;
-  if (m_routingProtocol != 0)
-    {
-      Ptr<Ipv4StaticRoutingImpl> sr = DynamicCast<Ipv4StaticRoutingImpl> (m_routingProtocol);
-      if (sr != 0)
-        {
-          return sr;
-        }
-      Ptr<Ipv4ListRoutingImpl> lr = DynamicCast<Ipv4ListRoutingImpl> (m_routingProtocol);
-      NS_ASSERT (lr);
-      staticRouting = lr->GetStaticRouting ();
-    }
-  return staticRouting;
-}
-
 uint32_t 
 Ipv4L3Protocol::AddInterface (Ptr<NetDevice> device)
 {
@@ -278,6 +247,7 @@
   Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface> ();
   interface->SetNode (m_node);
   interface->SetDevice (device);
+  interface->SetForwarding (m_ipForward);
   return AddIpv4Interface (interface);
 }
 
@@ -439,7 +409,7 @@
     MakeCallback (&Ipv4L3Protocol::IpForward, this),
     MakeCallback (&Ipv4L3Protocol::IpMulticastForward, this),
     MakeCallback (&Ipv4L3Protocol::LocalDeliver, this),
-    MakeNullCallback <void, Ptr<const Packet>, const Ipv4Header &> ()
+    MakeCallback (&Ipv4L3Protocol::RouteInputError, this)
   );
 
 }
@@ -481,7 +451,6 @@
   if (found)
     {
       ttl = tag.GetTtl ();
-      // XXX remove tag here?  
     }
 
   // Handle a few cases:
@@ -504,7 +473,7 @@
           Ptr<Ipv4Interface> outInterface = *ifaceIter;
           Ptr<Packet> packetCopy = packet->Copy ();
 
-          NS_ASSERT (packetCopy->GetSize () <= outInterface->GetMtu ());
+          NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice()->GetMtu ());
           packetCopy->AddHeader (ipHeader);
           m_txTrace (packetCopy, ifaceIndex);
           outInterface->Send (packetCopy, destination);
@@ -552,15 +521,15 @@
       // This could arise because the synchronous RouteOutput() call
       // returned to the transport protocol with a source address but
       // there was no next hop available yet (since a route may need
-      // to be queried).  So, call asynchronous version of RouteOutput?
-      NS_FATAL_ERROR("XXX This case not yet implemented");
+      // to be queried).  
+      NS_FATAL_ERROR ("This case not yet implemented");
     }
   // 5) packet is not broadcast, and route is NULL (e.g., a raw socket call)
   NS_LOG_LOGIC ("Ipv4L3Protocol::Send case 4:  passed in with no route " << destination);
-  Socket::SocketErrno errno; 
+  Socket::SocketErrno errno_; 
   uint32_t oif = 0; // unused for now
   ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
-  Ptr<Ipv4Route> newRoute = m_routingProtocol->RouteOutput (ipHeader, oif, errno);
+  Ptr<Ipv4Route> newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_);
   if (newRoute)
     {
       SendRealOut (newRoute, packet, ipHeader);
@@ -634,7 +603,7 @@
   Ptr<Ipv4Interface> outInterface = GetInterface (interface);
   NS_LOG_LOGIC ("Send via NetDevice ifIndex " << outDev->GetIfIndex () << " ipv4InterfaceIndex " << interface);
 
-  NS_ASSERT (packet->GetSize () <= outInterface->GetMtu ());
+  NS_ASSERT (packet->GetSize () <= outInterface->GetDevice ()->GetMtu ());
   if (!route->GetGateway ().IsEqual (Ipv4Address ("0.0.0.0"))) 
     {
       if (outInterface->IsUp ())
@@ -708,13 +677,12 @@
   Ipv4Header ipHeader = header;
   Ptr<Packet> packet = p->Copy ();
   ipHeader.SetTtl (ipHeader.GetTtl () - 1);
-  // XXX handle multi-interfaces
   if (ipHeader.GetTtl () == 0)
     {
-      Ptr<NetDevice> outDev = rtentry->GetOutputDevice ();
-      int32_t interface = GetInterfaceForDevice (outDev);
-      NS_ASSERT (interface >= 0);
-      if (IsUnicast (ipHeader.GetDestination (), GetInterface (interface)->GetAddress (0).GetMask ()))
+      // Do not reply to ICMP or to multicast/broadcast IP address 
+      if (ipHeader.GetProtocol () != Icmpv4L4Protocol::PROT_NUMBER && 
+        ipHeader.GetDestination ().IsBroadcast () == false && 
+        ipHeader.GetDestination ().IsMulticast () == false)
         {
           Ptr<Icmpv4L4Protocol> icmp = GetIcmp ();
           icmp->SendTimeExceededTtl (ipHeader, packet);
@@ -746,22 +714,41 @@
       case Ipv4L4Protocol::RX_CSUM_FAILED:
         break;
       case Ipv4L4Protocol::RX_ENDPOINT_UNREACH:
-        // XXX handle multi-interfaces
-        if (IsUnicast (ip.GetDestination (), GetInterface (iif)->GetAddress (0).GetMask ()))
+        if (ip.GetDestination ().IsBroadcast () == true || 
+          ip.GetDestination ().IsMulticast () == true)
+          {
+            break;  // Do not reply to broadcast or multicast
+          }
+        // Another case to suppress ICMP is a subnet-directed broadcast
+        bool subnetDirected = false;
+        for (uint32_t i = 0; i < GetNAddresses (iif); i++)
+          {
+            Ipv4InterfaceAddress addr = GetAddress (iif, i);
+            if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination().CombineMask (addr.GetMask ()) &&
+              ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
+              {
+                subnetDirected = true;
+              }
+          }
+        if (subnetDirected == false)
           {
             GetIcmp ()->SendDestUnreachPort (ip, copy);
           }
-        break;
       }
     }
 }
 
-uint32_t 
+bool
 Ipv4L3Protocol::AddAddress (uint32_t i, Ipv4InterfaceAddress address)
 {
   NS_LOG_FUNCTION (this << i << address);
   Ptr<Ipv4Interface> interface = GetInterface (i);
-  return interface->AddAddress (address);
+  bool retVal = interface->AddAddress (address);
+  if (m_routingProtocol != 0)
+    {
+      m_routingProtocol->NotifyAddAddress (i, address);
+    }
+  return retVal;
 }
 
 Ipv4InterfaceAddress 
@@ -780,6 +767,23 @@
   return iface->GetNAddresses ();
 }
 
+bool
+Ipv4L3Protocol::RemoveAddress (uint32_t i, uint32_t addressIndex)
+{
+  NS_LOG_FUNCTION (this << i << addressIndex);
+  Ptr<Ipv4Interface> interface = GetInterface (i);
+  Ipv4InterfaceAddress address = interface->RemoveAddress (addressIndex);
+  if (address != Ipv4InterfaceAddress ())
+    {
+      if (m_routingProtocol != 0)
+        {
+          m_routingProtocol->NotifyRemoveAddress (i, address);
+        }
+      return true;
+    }
+  return false;
+}
+
 void 
 Ipv4L3Protocol::SetMetric (uint32_t i, uint16_t metric)
 {
@@ -801,7 +805,7 @@
 {
   NS_LOG_FUNCTION (this << i);
   Ptr<Ipv4Interface> interface = GetInterface (i);
-  return interface->GetMtu ();
+  return interface->GetDevice ()->GetMtu ();
 }
 
 bool 
@@ -819,18 +823,9 @@
   Ptr<Ipv4Interface> interface = GetInterface (i);
   interface->SetUp ();
 
-  // If interface address and network mask have been set, add a route
-  // to the network of the interface (like e.g. ifconfig does on a
-  // Linux box)
-  for (uint32_t j = 0; j < interface->GetNAddresses (); j++)
+  if (m_routingProtocol != 0)
     {
-      if (((interface->GetAddress (j).GetLocal ()) != (Ipv4Address ()))
-          && (interface->GetAddress (j).GetMask ()) != (Ipv4Mask ()))
-        {
-          NS_ASSERT_MSG (GetStaticRouting(), "SetUp:: No static routing");
-          GetStaticRouting ()->AddNetworkRouteTo (interface->GetAddress (j).GetLocal ().CombineMask (interface->GetAddress (j).GetMask ()),
-            interface->GetAddress (j).GetMask (), i);
-        }
+      m_routingProtocol->NotifyInterfaceUp (i);
     }
 }
 
@@ -841,34 +836,45 @@
   Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
   interface->SetDown ();
 
-  // Remove all static routes that are going through this interface
-  bool modified = true;
-  while (modified)
+  if (m_routingProtocol != 0)
     {
-      modified = false;
-      for (uint32_t i = 0; i < GetStaticRouting ()->GetNRoutes (); i++)
-        {
-          Ipv4RoutingTableEntry route = GetStaticRouting ()->GetRoute (i);
-          if (route.GetInterface () == ifaceIndex)
-            {
-              GetStaticRouting ()->RemoveRoute (i);
-              modified = true;
-              break;
-            }
-        }
+      m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
     }
 }
 
+bool 
+Ipv4L3Protocol::IsForwarding (uint32_t i) const
+{
+  NS_LOG_FUNCTION (this << i);
+  Ptr<Ipv4Interface> interface = GetInterface (i);
+  NS_LOG_LOGIC ("Forwarding state: " << interface->IsForwarding ());
+  return interface->IsForwarding ();
+}
+
+void 
+Ipv4L3Protocol::SetForwarding (uint32_t i, bool val)
+{
+  NS_LOG_FUNCTION (this << i);
+  Ptr<Ipv4Interface> interface = GetInterface (i);
+  interface->SetForwarding (val);
+}
+
 Ptr<NetDevice>
 Ipv4L3Protocol::GetNetDevice (uint32_t i)
 {
+  NS_LOG_FUNCTION (this << i);
   return GetInterface (i)-> GetDevice ();
 }
 
 void 
 Ipv4L3Protocol::SetIpForward (bool forward) 
 {
+  NS_LOG_FUNCTION (this << forward);
   m_ipForward = forward;
+  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
+    {
+      (*i)->SetForwarding (forward);
+    }
 }
 
 bool 
@@ -877,5 +883,13 @@
   return m_ipForward;
 }
 
+void
+Ipv4L3Protocol::RouteInputError (Ptr<const Packet> p, const Ipv4Header & ipHeader, Socket::SocketErrno sockErrno)
+{
+  NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
+  NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno); 
+  m_dropTrace (p);
+}
+
 
 }//namespace ns3
--- a/src/internet-stack/ipv4-l3-protocol.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-l3-protocol.h	Fri Jul 03 09:59:04 2009 +0400
@@ -30,7 +30,6 @@
 #include "ns3/traced-callback.h"
 #include "ns3/ipv4-header.h"
 #include "ns3/ipv4-routing-protocol.h"
-#include "ipv4-static-routing-impl.h"
 
 namespace ns3 {
 
@@ -142,9 +141,10 @@
   int32_t GetInterfaceForPrefix (Ipv4Address addr, Ipv4Mask mask) const;
   int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
 
-  uint32_t AddAddress (uint32_t i, Ipv4InterfaceAddress address);
+  bool AddAddress (uint32_t i, Ipv4InterfaceAddress address);
   Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
   uint32_t GetNAddresses (uint32_t interface) const;
+  bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
 
   void SetMetric (uint32_t i, uint16_t metric);
   uint16_t GetMetric (uint32_t i) const;
@@ -152,12 +152,11 @@
   bool IsUp (uint32_t i) const;
   void SetUp (uint32_t i);
   void SetDown (uint32_t i);
+  bool IsForwarding (uint32_t i) const;
+  void SetForwarding (uint32_t i, bool val);
 
   Ptr<NetDevice> GetNetDevice (uint32_t i);
 
-  void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol,
-                           int16_t priority);
-
 protected:
 
   virtual void DoDispose (void);
@@ -167,6 +166,7 @@
    */
   virtual void NotifyNewAggregate ();
 private:
+  friend class Ipv4L3ProtocolTest;
   Ipv4L3Protocol(const Ipv4L3Protocol &);
   Ipv4L3Protocol &operator = (const Ipv4L3Protocol &);
 
@@ -197,6 +197,8 @@
                       const Ipv4Header &header);
 
   void LocalDeliver (Ptr<const Packet> p, Ipv4Header const&ip, uint32_t iif);
+  void RouteInputError (Ptr<const Packet> p, const Ipv4Header & ipHeader, Socket::SocketErrno sockErrno);
+
   uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
   void SetupLoopback (void);
   Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
@@ -218,7 +220,6 @@
   TracedCallback<Ptr<const Packet> > m_dropTrace;
 
   Ptr<Ipv4RoutingProtocol> m_routingProtocol;
-  Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
 
   SocketList m_sockets;
 };
--- a/src/internet-stack/ipv4-list-routing-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 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/ipv4.h"
-#include "ns3/ipv4-route.h"
-#include "ns3/node.h"
-#include "ns3/ipv4-static-routing.h"
-#include "ipv4-list-routing-impl.h"
-
-NS_LOG_COMPONENT_DEFINE ("Ipv4ListRoutingImpl");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4ListRoutingImpl);
-
-TypeId
-Ipv4ListRoutingImpl::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::Ipv4ListRoutingImpl")
-    .SetParent<Ipv4ListRouting> ()
-    .AddConstructor<Ipv4ListRoutingImpl> ()
-    ;
-  return tid;
-}
-
-
-Ipv4ListRoutingImpl::Ipv4ListRoutingImpl () 
- : m_node (0)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-Ipv4ListRoutingImpl::~Ipv4ListRoutingImpl () 
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-void
-Ipv4ListRoutingImpl::DoDispose (void)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
-       rprotoIter != m_routingProtocols.end (); rprotoIter++)
-    {
-      // Note:  Calling dispose on these protocols causes memory leak
-      //        The routing protocols should not maintain a pointer to
-      //        this object, so Dispose() shouldn't be necessary.
-      (*rprotoIter).second = 0;
-    }
-  m_routingProtocols.clear ();
-  m_node = 0;
-}
-
-Ptr<Ipv4Route>
-Ipv4ListRoutingImpl::RouteOutput (const Ipv4Header &header, uint32_t oif, enum Socket::SocketErrno &sockerr)
-{
-  NS_LOG_FUNCTION (this << header.GetDestination () << " " << header.GetSource () << " " << oif);
-  Ptr<Ipv4Route> route;
-
-  for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
-       i != m_routingProtocols.end ();
-       i++)
-    {
-      NS_LOG_LOGIC ("Checking protocol " << (*i).second->GetInstanceTypeId () << " with priority " << (*i).first);
-      NS_LOG_LOGIC ("Requesting source address for destination " << header.GetDestination ());
-      route = (*i).second->RouteOutput (header, oif, sockerr);
-      if (route)
-        {
-          NS_LOG_LOGIC ("Found route " << route);
-          sockerr = Socket::ERROR_NOTERROR;
-          return route;
-        }
-    }
-  NS_LOG_LOGIC ("Done checking " << GetTypeId ());
-  NS_LOG_LOGIC ("");
-  sockerr = Socket::ERROR_NOROUTETOHOST;
-  return 0;
-}
-
-// Patterned after Linux ip_route_input and ip_route_input_slow
-bool 
-Ipv4ListRoutingImpl::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, 
-                             UnicastForwardCallback ucb, MulticastForwardCallback mcb, 
-                             LocalDeliverCallback lcb, ErrorCallback ecb)
-{
-  bool retVal = false;
-  NS_LOG_FUNCTION (p << header << idev);
-  NS_LOG_LOGIC ("RouteInput logic for node: " << m_node->GetId ());
-
-  Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-  NS_ASSERT (ipv4);
-  uint32_t iif = ipv4->GetInterfaceForDevice (idev); 
-
-  // Multicast recognition; handle local delivery here
-  //
-  if (header.GetDestination().IsMulticast ())
-    {
-#ifdef NOTYET
-      if (ipv4->MulticastCheckGroup (iif, header.GetDestination ()))
-#endif
-      if (true)
-        {
-          NS_LOG_LOGIC ("Multicast packet for me-- local deliver");
-          Ptr<Packet> packetCopy = p->Copy();
-          // Here may want to disable lcb callback in recursive RouteInput
-          // call below
-          lcb (packetCopy, header, iif);
-          // Fall through-- we may also need to forward this
-          retVal = true;
-        }
-      for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
-         m_routingProtocols.begin ();
-           rprotoIter != m_routingProtocols.end ();
-           rprotoIter++)
-        {
-          NS_LOG_LOGIC ("Multicast packet for me-- trying to forward");
-          if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
-            {
-              retVal = true;
-            }
-        }
-      return retVal;
-    }
-
-  if (header.GetDestination ().IsBroadcast ())
-    {
-      NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
-      // TODO:  Local Deliver for broadcast
-      // TODO:  Forward broadcast
-    }
-
- // TODO:  Configurable option to enable RFC 1222 Strong End System Model
- // Right now, we will be permissive and allow a source to send us
- // a packet to one of our other interface addresses; that is, the
- // destination unicast address does not match one of the iif addresses,
- // but we check our other interfaces.  This could be an option
- // (to remove the outer loop immediately below and just check iif).
-  for (uint32_t j = 0; j < ipv4->GetNInterfaces (); j++)
-    {
-      for (uint32_t i = 0; i < ipv4->GetNAddresses (j); i++)
-        {
-          Ipv4InterfaceAddress iaddr = ipv4->GetAddress (j, i);
-          Ipv4Address addr = iaddr.GetLocal ();
-          if (addr.IsEqual (header.GetDestination ()))
-            {
-              if (j == iif)
-                {
-                  NS_LOG_LOGIC ("For me (destination " << addr << " match)");
-                }
-              else
-                {
-                  NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
-                }
-              lcb (p, header, iif);
-              return true;
-            }
-          if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
-            {
-              NS_LOG_LOGIC ("For me (interface broadcast address)");
-              lcb (p, header, iif);
-              return true;
-            }
-          NS_LOG_LOGIC ("Address "<< addr << " not a match");
-        }
-    }
- // Next, try to find a route
-  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
-         m_routingProtocols.begin ();
-       rprotoIter != m_routingProtocols.end ();
-       rprotoIter++)
-    {
-      if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
-        {
-          return true;
-        }
-    }
-  // No routing protocol has found a route.  
-  return retVal;
-}
-
-void
-Ipv4ListRoutingImpl::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority)
-{
-  NS_LOG_FUNCTION (this << routingProtocol->GetInstanceTypeId () << priority);
-  m_routingProtocols.push_back
-    (std::pair<int, Ptr<Ipv4RoutingProtocol> > (-priority, routingProtocol));
-  m_routingProtocols.sort ();
-}
-
-uint32_t 
-Ipv4ListRoutingImpl::GetNRoutingProtocols (void) const
-{
-  NS_LOG_FUNCTION (this);
-  return m_routingProtocols.size (); 
-}
-
-Ptr<Ipv4RoutingProtocol> 
-Ipv4ListRoutingImpl::GetRoutingProtocol (uint32_t index, int16_t& priority) const
-{
-  NS_LOG_FUNCTION (index);
-  if (index > m_routingProtocols.size ())
-    {
-      NS_FATAL_ERROR ("Ipv4ListRoutingImpl::GetRoutingProtocol():  index " << index << " out of range");
-    }
-  uint32_t i = 0;
-  for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin ();
-       rprotoIter != m_routingProtocols.end (); rprotoIter++, i++)
-    {
-      if (i == index)
-        {
-          priority = (*rprotoIter).first;
-          return (*rprotoIter).second;
-        }
-    }
-  return 0;
-}
-
-Ptr<Ipv4StaticRouting>
-Ipv4ListRoutingImpl::GetStaticRouting (void) const
-{
-  NS_LOG_FUNCTION (this);
-  Ipv4StaticRouting* srp;
-  for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin ();
-       rprotoIter != m_routingProtocols.end (); rprotoIter++)
-    {
-      NS_LOG_LOGIC ("Searching for static routing");
-      srp = dynamic_cast<Ipv4StaticRouting*> (PeekPointer((*rprotoIter).second));
-      if (srp)
-        {
-          NS_LOG_LOGIC ("Found static routing");
-          return Ptr<Ipv4StaticRouting> (srp);
-        }
-    }
-  NS_LOG_LOGIC ("Static routing not found");
-  return 0;
-
-}
-
-void
-Ipv4ListRoutingImpl::SetNode (Ptr<Node> node)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  m_node = node;
-}
-
-Ptr<Node> 
-Ipv4ListRoutingImpl::GetNode (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_node;
-}
-
-
-}//namespace ns3
--- a/src/internet-stack/ipv4-list-routing-impl.h	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 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_LIST_ROUTING_IMPL_H
-#define IPV4_LIST_ROUTING_IMPL_H
-
-#include <list>
-#include "ns3/ipv4-list-routing.h"
-
-namespace ns3 {
-
-class Ipv4StaticRouting;
-
-class Ipv4ListRoutingImpl : public Ipv4ListRouting
-{
-public:
-  static TypeId GetTypeId (void);
-
-  Ipv4ListRoutingImpl ();
-  ~Ipv4ListRoutingImpl ();
-
-  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);
-
-  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
-
-  virtual uint32_t GetNRoutingProtocols (void) const;
-
-  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
-  virtual Ptr<Ipv4StaticRouting> GetStaticRouting (void) const;
-
-
-  void SetNode (Ptr<Node> node);
-  Ptr<Node> GetNode (void) const;
-
-protected:
-  void DoDispose (void);
-private:
-  typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
-  Ipv4RoutingProtocolList m_routingProtocols;
-  Ptr<Node> m_node;
-
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_LIST_ROUTING_IMPL_H */
--- a/src/internet-stack/ipv4-raw-socket-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/ipv4-raw-socket-impl.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -174,11 +174,11 @@
     {
       Ipv4Header header;
       header.SetDestination (dst);
-      SocketErrno errno = ERROR_NOTERROR;;
+      SocketErrno errno_ = ERROR_NOTERROR;//do not use errno as it is the standard C last error number 
       Ptr<Ipv4Route> route;
       uint32_t oif = 0; //specify non-zero if bound to a source address
       // TBD-- we could cache the route and just check its validity
-      route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+      route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
       if (route != 0)
         {
           NS_LOG_LOGIC ("Route exists");
--- a/src/internet-stack/ipv4-static-routing-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,571 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-//
-// 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
-//
-// Author: George F. Riley<riley@ece.gatech.edu>
-//         Gustavo Carneiro <gjc@inescporto.pt>
-
-#include "ns3/log.h"
-#include "ns3/packet.h"
-#include "ns3/node.h"
-#include "ns3/ipv4-route.h"
-#include "ipv4-static-routing-impl.h"
-#include "ns3/ipv4-routing-table-entry.h"
-
-NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRoutingImpl");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRoutingImpl);
-
-TypeId
-Ipv4StaticRoutingImpl::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::Ipv4StaticRoutingImpl")
-    .SetParent<Ipv4StaticRouting> ()
-    .AddConstructor<Ipv4StaticRoutingImpl> ()
-    ;
-  return tid;
-}
-
-Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl () 
-: m_defaultRoute (0), m_node (0)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-void 
-Ipv4StaticRoutingImpl::AddHostRouteTo (Ipv4Address dest, 
-                                   Ipv4Address nextHop, 
-                                   uint32_t interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
-  m_hostRoutes.push_back (route);
-}
-
-void 
-Ipv4StaticRoutingImpl::AddHostRouteTo (Ipv4Address dest, 
-                                   uint32_t interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
-  m_hostRoutes.push_back (route);
-}
-
-void 
-Ipv4StaticRoutingImpl::AddNetworkRouteTo (Ipv4Address network, 
-                                      Ipv4Mask networkMask, 
-                                      Ipv4Address nextHop, 
-                                      uint32_t interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
-                                            networkMask,
-                                            nextHop,
-                                            interface);
-  m_networkRoutes.push_back (route);
-}
-
-void 
-Ipv4StaticRoutingImpl::AddNetworkRouteTo (Ipv4Address network, 
-                                      Ipv4Mask networkMask, 
-                                      uint32_t interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
-                                            networkMask,
-                                            interface);
-  m_networkRoutes.push_back (route);
-}
-
-void 
-Ipv4StaticRoutingImpl::SetDefaultRoute (Ipv4Address nextHop, 
-                                    uint32_t interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  *route = Ipv4RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
-  delete m_defaultRoute;
-  m_defaultRoute = route;
-}
-
-void 
-Ipv4StaticRoutingImpl::AddMulticastRoute(Ipv4Address origin,
-                                     Ipv4Address group,
-                                     uint32_t inputInterface,
-                                     std::vector<uint32_t> outputInterfaces)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4MulticastRoutingTableEntry *route = new Ipv4MulticastRoutingTableEntry ();
-  *route = Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (origin, group, 
-    inputInterface, outputInterfaces);
-  m_multicastRoutes.push_back (route);
-}
-
-// default multicast routes are stored as a network route
-// these routes are _not_ consulted in the forwarding process-- only
-// for originating packets
-void 
-Ipv4StaticRoutingImpl::SetDefaultMulticastRoute(uint32_t outputInterface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
-  Ipv4Address network = Ipv4Address ("224.0.0.0");
-  Ipv4Mask networkMask = Ipv4Mask ("240.0.0.0");
-  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
-                                            networkMask,
-                                            outputInterface);
-  m_networkRoutes.push_back (route);
-}
-
-uint32_t 
-Ipv4StaticRoutingImpl::GetNMulticastRoutes (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_multicastRoutes.size ();
-}
-
-Ipv4MulticastRoutingTableEntry
-Ipv4StaticRoutingImpl::GetMulticastRoute (uint32_t index) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  NS_ASSERT_MSG(index < m_multicastRoutes.size (),
-    "Ipv4StaticRoutingImpl::GetMulticastRoute ():  Index out of range");
-
-  if (index < m_multicastRoutes.size ())
-    {
-      uint32_t tmp = 0;
-      for (MulticastRoutesCI i = m_multicastRoutes.begin (); 
-           i != m_multicastRoutes.end (); 
-           i++) 
-        {
-          if (tmp  == index)
-            {
-              return *i;
-            }
-          tmp++;
-        }
-    }
-  return 0;
-}
-
-bool
-Ipv4StaticRoutingImpl::RemoveMulticastRoute(Ipv4Address origin,
-                                        Ipv4Address group,
-                                        uint32_t inputInterface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
-       i != m_multicastRoutes.end (); 
-       i++) 
-    {
-      Ipv4MulticastRoutingTableEntry *route = *i;
-      if (origin == route->GetOrigin () &&
-          group == route->GetGroup () &&
-          inputInterface == route->GetInputInterface ())
-        {
-          delete *i;
-          m_multicastRoutes.erase (i);
-          return true;
-        }
-    }
-  return false;
-}
-
-void 
-Ipv4StaticRoutingImpl::RemoveMulticastRoute(uint32_t index)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  uint32_t tmp = 0;
-  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
-       i != m_multicastRoutes.end (); 
-       i++) 
-    {
-      if (tmp  == index)
-        {
-          delete *i;
-          m_multicastRoutes.erase (i);
-          return;
-        }
-      tmp++;
-    }
-}
-
-Ptr<Ipv4Route>
-Ipv4StaticRoutingImpl::LookupStatic (Ipv4Address dest)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ptr<Ipv4Route> rtentry = 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);
-          Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-          Ipv4RoutingTableEntry* route = (*i);
-          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;
-        }
-    }
-  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);
-          Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-          Ipv4RoutingTableEntry* route = (*j);
-          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;
-        }
-    }
-  if (m_defaultRoute != 0) 
-    {
-      NS_ASSERT (m_defaultRoute->IsDefault ());
-      NS_LOG_LOGIC ("Found global network route" << m_defaultRoute);
-      Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-      Ipv4RoutingTableEntry* route = m_defaultRoute;
-      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;
-    }
-  return 0;
-}
-
-Ptr<Ipv4MulticastRoute>
-Ipv4StaticRoutingImpl::LookupStatic (
-  Ipv4Address origin, 
-  Ipv4Address group,
-  uint32_t    interface)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  Ptr<Ipv4MulticastRoute> mrtentry = 0;
-
-  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
-       i != m_multicastRoutes.end (); 
-       i++) 
-    {
-      Ipv4MulticastRoutingTableEntry *route = *i;
-//
-// We've been passed an origin address, a multicast group address and an 
-// interface index.  We have to decide if the current route in the list is
-// a match.
-//
-// The first case is the restrictive case where the origin, group and index
-// matches.  
-//
-      if (origin == route->GetOrigin () && group == route->GetGroup ())
-        {
-          // Skipping this case (SSM) for now
-          NS_LOG_LOGIC ("Found multicast source specific route" << *i);
-        }
-      if (group == route->GetGroup ())
-        {
-          if (interface == Ipv4::IF_ANY || 
-              interface == route->GetInputInterface ())
-            {
-              NS_LOG_LOGIC ("Found multicast route" << *i);
-              Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-              mrtentry = Create<Ipv4MulticastRoute> ();
-              mrtentry->SetGroup (route->GetGroup ());
-              mrtentry->SetOrigin (route->GetOrigin ());
-              mrtentry->SetParent (route->GetInputInterface ());
-              for (uint32_t j = 0; j < route->GetNOutputInterfaces (); j++)
-                {
-                  if (route->GetOutputInterface (j))
-                    {
-                      NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
-                      mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv4MulticastRoute::MAX_TTL - 1);
-                    }
-                }
-              return mrtentry;
-            }
-        }
-    }
-  return mrtentry;
-}
-
-uint32_t 
-Ipv4StaticRoutingImpl::GetNRoutes (void)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  uint32_t n = 0;
-  if (m_defaultRoute != 0)
-    {
-      n++;
-    }
-  n += m_hostRoutes.size ();
-  n += m_networkRoutes.size ();
-  return n;
-}
-
-Ipv4RoutingTableEntry
-Ipv4StaticRoutingImpl::GetDefaultRoute ()
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  if (m_defaultRoute != 0)
-    {
-      return *m_defaultRoute;
-    }
-  else
-    {
-      return Ipv4RoutingTableEntry ();
-    }
-}
-
-Ipv4RoutingTableEntry 
-Ipv4StaticRoutingImpl::GetRoute (uint32_t index)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  if (index == 0 && m_defaultRoute != 0)
-    {
-      return *m_defaultRoute;
-    }
-  if (index > 0 && m_defaultRoute != 0)
-    {
-      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 
-Ipv4StaticRoutingImpl::RemoveRoute (uint32_t index)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  if (index == 0 && m_defaultRoute != 0)
-    {
-      delete m_defaultRoute;
-      m_defaultRoute = 0;
-    }
-  if (index > 0 && m_defaultRoute != 0)
-    {
-      index--;
-    }
-  if (index < m_hostRoutes.size ())
-    {
-      uint32_t tmp = 0;
-      for (HostRoutesI i = m_hostRoutes.begin (); 
-           i != m_hostRoutes.end (); 
-           i++) 
-        {
-          if (tmp  == index)
-            {
-              delete *i;
-              m_hostRoutes.erase (i);
-              return;
-            }
-          tmp++;
-        }
-    }
-  index -= m_hostRoutes.size ();
-  uint32_t tmp = 0;
-  for (NetworkRoutesI j = m_networkRoutes.begin (); 
-       j != m_networkRoutes.end (); 
-       j++) 
-    {
-      if (tmp == index)
-        {
-          delete *j;
-          m_networkRoutes.erase (j);
-          return;
-        }
-      tmp++;
-    }
-  NS_ASSERT (false);
-}
-
-Ptr<Ipv4Route> 
-Ipv4StaticRoutingImpl::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
-{
-  NS_LOG_FUNCTION (this << header << oif);
-  Ipv4Address destination = header.GetDestination ();
-  Ptr<Ipv4Route> rtentry = 0;
-
-  // Multicast goes here
-  if (destination.IsMulticast ())
-    {
-      // Note:  Multicast routes for outbound packets are stored in the
-      // normal unicast table.  An implication of this is that it is not
-      // possible to source multicast datagrams on multiple interfaces.
-      // This is a well-known property of sockets implementation on 
-      // many Unix variants.
-      // So, we just log it and fall through to LookupStatic ()
-      NS_LOG_LOGIC ("RouteOutput()::Multicast destination");
-    }
-  rtentry = LookupStatic (destination);
-  if (rtentry)
-    { 
-      sockerr = Socket::ERROR_NOTERROR;
-    }
-  else
-    { 
-      sockerr = Socket::ERROR_NOROUTETOHOST;
-    }
-  return rtentry;
-}
-
-// XXX this method not robust enough to work independent of ListRouting
-bool 
-Ipv4StaticRoutingImpl::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);
-  Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
-
-  if (ipHeader.GetDestination ().IsMulticast ())
-    {
-      NS_LOG_LOGIC ("Multicast destination");
-      Ptr<Ipv4MulticastRoute> mrtentry =  LookupStatic(ipHeader.GetSource (),
-        ipHeader.GetDestination (), ipv4->GetInterfaceForDevice (idev));
-
-      if (mrtentry)
-        {
-          NS_LOG_LOGIC ("Multicast route found");
-          mcb (mrtentry, p, ipHeader); // multicast forwarding callback
-          return true;
-        }
-      else
-        {
-          NS_LOG_LOGIC ("Multicast route not found");
-          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");
-  Ptr<Ipv4Route> rtentry = LookupStatic (ipHeader.GetDestination ());
-  if (rtentry != 0)
-    {
-      NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
-      ucb (rtentry, p, ipHeader);  // unicast forwarding callback
-      return true;
-    }
-  else
-    {
-      NS_LOG_LOGIC ("Did not find unicast destination- returning false");
-      return false; // Let other routing protocols try to handle this
-    }
-}
-
-Ipv4StaticRoutingImpl::~Ipv4StaticRoutingImpl ()
-{
-  NS_LOG_FUNCTION_NOARGS ();
-}
-
-void
-Ipv4StaticRoutingImpl::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);
-    }
-  if (m_defaultRoute != 0)
-    {
-      delete m_defaultRoute;
-      m_defaultRoute = 0;
-    }
-  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
-       i != m_multicastRoutes.end (); 
-       i = m_multicastRoutes.erase (i)) 
-    {
-      delete (*i);
-    }
-  Ipv4RoutingProtocol::DoDispose ();
-}
-
-void
-Ipv4StaticRoutingImpl::SetNode (Ptr<Node> node)
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  m_node = node;
-}
-
-Ptr<Node>
-Ipv4StaticRoutingImpl::GetNode (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_node; 
-} 
-
-
-}//namespace ns3
--- a/src/internet-stack/ipv4-static-routing-impl.h	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-//
-// 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
-//
-// Author: George F. Riley<riley@ece.gatech.edu>
-//         Gustavo Carneiro <gjc@inescporto.pt>
-//
-
-#ifndef IPV4_STATIC_ROUTING_IMPL_H
-#define IPV4_STATIC_ROUTING_IMPL_H
-
-#include <list>
-#include <stdint.h>
-#include "ns3/ipv4-address.h"
-#include "ns3/ipv4-header.h"
-#include "ns3/socket.h"
-#include "ns3/ptr.h"
-#include "ns3/ipv4.h"
-#include "ns3/ipv4-static-routing.h"
-
-namespace ns3 {
-
-class Packet;
-class NetDevice;
-class Ipv4Interface;
-class Ipv4Address;
-class Ipv4Header;
-class Ipv4RoutingTableEntry;
-class Ipv4MulticastRoutingTableEntry;
-class Node;
-
-class Ipv4StaticRoutingImpl : public Ipv4StaticRouting
-{
-public:
-  static TypeId GetTypeId (void);
-
-  Ipv4StaticRoutingImpl ();
-  virtual ~Ipv4StaticRoutingImpl ();
-
-  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 static 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 static 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 static 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 static 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 Add a default route to the static routing table.
- *
- * This method tells the routing system what to do in the case where a specific
- * route to a destination is not found.  The system forwards packets to the
- * specified node in the hope that it knows better how to route the packet.
- * 
- * If the default route is set, it is returned as the selected route from 
- * LookupStatic irrespective of destination address if no specific route is
- * found.
- *
- * \param nextHop The Ipv4Address to send packets to in the hope that they
- * will be forwarded correctly.
- * \param interface The network interface index used to send packets.
- *
- * \see Ipv4Address
- * \see Ipv4StaticRouting::Lookup
- */
-  void SetDefaultRoute (Ipv4Address nextHop, 
-                        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 the default route from the static routing table.
- *
- * \return If the default route is set, a pointer to that Ipv4RoutingTableEntry is
- * returned, otherwise a zero pointer is returned.
- *
- * \see Ipv4RoutingTableEntry
- */
-  Ipv4RoutingTableEntry GetDefaultRoute (void);
-
-/**
- * \brief Get a route from the static unicast routing table.
- *
- * Externally, the unicast static 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 Ipv4StaticRouting::RemoveRoute
- */
-  Ipv4RoutingTableEntry GetRoute (uint32_t i);
-
-/**
- * \brief Remove a route from the static unicast routing table.
- *
- * Externally, the unicast static 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 Ipv4StaticRouting::GetRoute
- * \see Ipv4StaticRouting::AddRoute
- */
-  void RemoveRoute (uint32_t i);
-
-/**
- * \brief Add a multicast route to the static routing table.
- *
- * A multicast route must specify an origin IP address, a multicast group and
- * an input network interface index as conditions and provide a vector of
- * output network interface indices over which packets matching the conditions
- * are sent.
- *
- * Typically there are two main types of multicast routes:  routes of the 
- * first kind are used during forwarding.  All of the conditions must be
- * exlicitly provided.  The second kind of routes are used to get packets off
- * of a local node.  The difference is in the input interface.  Routes for
- * forwarding will always have an explicit input interface specified.  Routes
- * off of a node will always set the input interface to a wildcard specified
- * by the index Ipv4RoutingProtocol::INTERFACE_ANY.
- *
- * For routes off of a local node wildcards may be used in the origin and
- * multicast group addresses.  The wildcard used for Ipv4Adresses is that 
- * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0".  Usage
- * of a wildcard allows one to specify default behavior to varying degrees.
- *
- * For example, making the origin address a wildcard, but leaving the 
- * multicast group specific allows one (in the case of a node with multiple
- * interfaces) to create different routes using different output interfaces
- * for each multicast group.
- *
- * If the origin and multicast addresses are made wildcards, you have created
- * essentially a default multicast address that can forward to multiple 
- * interfaces.  Compare this to the actual default multicast address that is
- * limited to specifying a single output interface for compatibility with
- * existing functionality in other systems.
- * 
- * \param origin The Ipv4Address of the origin of packets for this route.  May
- * be Ipv4Address:GetAny for open groups.
- * \param group The Ipv4Address of the multicast group or this route.
- * \param inputInterface The input network interface index over which to 
- * expect packets destined for this route.  May be
- * Ipv4RoutingProtocol::INTERFACE_ANY for packets of local origin.
- * \param outputInterfaces A vector of network interface indices used to specify
- * how to send packets to the destination(s).
- *
- * \see Ipv4Address
- */
-  void AddMulticastRoute (Ipv4Address origin,
-                          Ipv4Address group,
-                          uint32_t inputInterface,
-                          std::vector<uint32_t> outputInterfaces);
-
-/**
- * \brief Add a default multicast route to the static routing table.
- *
- * This is the multicast equivalent of the unicast version SetDefaultRoute.
- * We tell the routing system what to do in the case where a specific route
- * to a destination multicast group is not found.  The system forwards 
- * packets out the specified interface in the hope that "something out there"
- * knows better how to route the packet.  This method is only used in 
- * initially sending packets off of a host.  The default multicast route is
- * not consulted during forwarding -- exact routes must be specified using
- * AddMulticastRoute for that case.
- *
- * Since we're basically sending packets to some entity we think may know
- * better what to do, we don't pay attention to "subtleties" like origin
- * address, nor do we worry about forwarding out multiple  interfaces.  If the
- * default multicast route is set, it is returned as the selected route from 
- * LookupStatic irrespective of origin or multicast group if another specific
- * route is not found.
- *
- * \param outputInterface The network interface index used to specify where
- * to send packets in the case of unknown routes.
- *
- * \see Ipv4Address
- */
-  void SetDefaultMulticastRoute (uint32_t outputInterface);
-
-/**
- * \brief Get the number of individual multicast routes that have been added
- * to the routing table.
- *
- * \warning The default multicast route counts as one of the routes.
- */
-  uint32_t GetNMulticastRoutes (void) const;
-
-/**
- * \brief Get a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- * 
- * \param i The index (into the routing table) of the multicast route to
- * retrieve.  
- * \return If route \e i is set, a pointer to that Ipv4MulticastRoutingTableEntry is
- * returned, otherwise a zero pointer is returned.
- *
- * \see Ipv4MulticastRoutingTableEntry
- * \see Ipv4StaticRouting::RemoveRoute
- */
-  Ipv4MulticastRoutingTableEntry GetMulticastRoute (uint32_t i) const;
-
-/**
- * \brief Remove a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- * This method causes the multicast routing table to be searched for the first
- * route that matches the parameters and removes it.
- *
- * Wildcards may be provided to this function, but the wildcards are used to
- * exacly match wildcards in the routes (see AddMulticastRoute).  That is,
- * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not
- * remove routes with any address in the origin, but will only remove routes
- * with "0.0.0.0" set as the the origin.
- *
- * \param origin The IP address specified as the origin of packets for the
- * route.
- * \param group The IP address specified as the multicast group addres of
- * the route.
- * \param inputInterface The network interface index specified as the expected
- * input interface for the route.
- * \returns true if a route was found and removed, false otherwise.
- *
- * \see Ipv4MulticastRoutingTableEntry
- * \see Ipv4StaticRouting::AddMulticastRoute
- */
-  bool RemoveMulticastRoute (Ipv4Address origin,
-                             Ipv4Address group,
-                             uint32_t inputInterface);
-
-/**
- * \brief Remove a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- *
- * \param index The index (into the multicast routing table) of the route to
- * remove.  
- *
- * \see Ipv4RoutingTableEntry
- * \see Ipv4StaticRouting::GetRoute
- * \see Ipv4StaticRouting::AddRoute
- */
-  void RemoveMulticastRoute (uint32_t index);
-
-  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;
-
-  typedef std::list<Ipv4MulticastRoutingTableEntry *> MulticastRoutes;
-  typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
-  typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
-  
-  Ptr<Ipv4Route> LookupStatic (Ipv4Address dest);
-  Ptr<Ipv4MulticastRoute> LookupStatic (Ipv4Address origin, Ipv4Address group,
-                                    uint32_t interface);
-
-  HostRoutes m_hostRoutes;
-  NetworkRoutes m_networkRoutes;
-  Ipv4RoutingTableEntry *m_defaultRoute;
-  MulticastRoutes m_multicastRoutes;
-
-  Ptr<Node> m_node;
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_STATIC_ROUTING_IMPL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet-stack/ipv4-test.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,87 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/**
+ * This is the test code for ipv4-l3-protocol.cc  
+ */
+#ifdef RUN_SELF_TESTS
+
+#include "ns3/simulator.h"
+#include "ns3/test.h"
+#include "ns3/log.h"
+#include "ns3/inet-socket-address.h"
+#include "ns3/node.h"
+
+#include "ipv4-l3-protocol.h"
+#include "arp-l3-protocol.h"
+#include "ipv4-interface.h"
+#include "loopback-net-device.h"
+
+namespace ns3 {
+
+
+class Ipv4L3ProtocolTest: public Test
+{
+public:
+  virtual bool RunTests (void);
+  Ipv4L3ProtocolTest ();
+
+};
+
+
+Ipv4L3ProtocolTest::Ipv4L3ProtocolTest ()
+  : Test ("Ipv4L3Protocol") 
+{
+}
+
+bool
+Ipv4L3ProtocolTest::RunTests (void)
+{
+  bool result = true;
+  Ptr<Node> node = CreateObject<Node> ();
+  Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
+  Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface> ();
+  Ptr<LoopbackNetDevice> device = CreateObject<LoopbackNetDevice> ();
+  node->AddDevice (device);
+  interface->SetDevice (device);
+  interface->SetNode (node);
+  uint32_t index = ipv4->AddIpv4Interface (interface);
+  NS_TEST_ASSERT_EQUAL (index, 0);
+  interface->SetUp ();
+  Ipv4InterfaceAddress ifaceAddr1 = Ipv4InterfaceAddress ("192.168.0.1", "255.255.255.0");
+  interface->AddAddress (ifaceAddr1);
+  Ipv4InterfaceAddress ifaceAddr2 = Ipv4InterfaceAddress ("192.168.0.2", "255.255.255.0");
+  interface->AddAddress (ifaceAddr2);
+  Ipv4InterfaceAddress ifaceAddr3 = Ipv4InterfaceAddress ("10.30.0.1", "255.255.255.0");
+  interface->AddAddress (ifaceAddr3);
+  Ipv4InterfaceAddress ifaceAddr4 = Ipv4InterfaceAddress ("250.0.0.1", "255.255.255.0");
+  interface->AddAddress (ifaceAddr4);
+  uint32_t num = interface->GetNAddresses ();
+  NS_TEST_ASSERT_EQUAL (num, 4);
+  interface->RemoveAddress (2);
+  num = interface->GetNAddresses ();
+  NS_TEST_ASSERT_EQUAL (num, 3);
+  Ipv4InterfaceAddress output = interface->GetAddress (2);
+  NS_TEST_ASSERT_EQUAL (ifaceAddr4, output);
+  
+  return result;
+}
+
+static Ipv4L3ProtocolTest gIpv4L3ProtocolTest;
+
+}; // namespace ns3
+
+#endif /* RUN_SELF_TESTS */
--- a/src/internet-stack/loopback-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/loopback-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -93,6 +93,12 @@
   return 0;
 }
 
+void 
+LoopbackNetDevice::SetAddress (Address address)
+{
+  m_address = Mac48Address::ConvertFrom (address);
+}
+
 Address 
 LoopbackNetDevice::GetAddress (void) const
 {
--- a/src/internet-stack/loopback-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/loopback-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -45,6 +45,7 @@
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
--- a/src/internet-stack/tcp-l4-protocol.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/tcp-l4-protocol.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -544,10 +544,10 @@
       // should be cached.
       Ipv4Header header;
       header.SetDestination (daddr);
-      Socket::SocketErrno errno;
+      Socket::SocketErrno errno_;
       Ptr<Ipv4Route> route;
       uint32_t oif = 0; //specify non-zero if bound to a source address
-      route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+      route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_);
       ipv4->Send (packet, saddr, daddr, PROT_NUMBER, route);
     }
 }
@@ -582,10 +582,10 @@
       // should be cached.
       Ipv4Header header;
       header.SetDestination (daddr);
-      Socket::SocketErrno errno;
+      Socket::SocketErrno errno_;
       Ptr<Ipv4Route> route;
       uint32_t oif = 0; //specify non-zero if bound to a source address
-      route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+      route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_);
       ipv4->Send (packet, saddr, daddr, PROT_NUMBER, route);
     }
   else
--- a/src/internet-stack/tcp-socket-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/tcp-socket-impl.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -19,21 +19,23 @@
  */
 
 
+#include "ns3/abort.h"
 #include "ns3/node.h"
 #include "ns3/inet-socket-address.h"
 #include "ns3/log.h"
 #include "ns3/ipv4.h"
 #include "ns3/ipv4-interface-address.h"
 #include "ns3/ipv4-route.h"
-#include "tcp-socket-impl.h"
-#include "tcp-l4-protocol.h"
-#include "ipv4-end-point.h"
+#include "ns3/ipv4-routing-protocol.h"
 #include "ns3/simulation-singleton.h"
-#include "tcp-typedefs.h"
 #include "ns3/simulator.h"
 #include "ns3/packet.h"
 #include "ns3/uinteger.h"
 #include "ns3/trace-source-accessor.h"
+#include "tcp-typedefs.h"
+#include "tcp-socket-impl.h"
+#include "tcp-l4-protocol.h"
+#include "ipv4-end-point.h"
 
 #include <algorithm>
 
@@ -83,7 +85,9 @@
     m_rxAvailable (0),
     m_rxBufSize (0),
     m_pendingData (0),
+    m_segmentSize (0),          // For attribute initialization consistency (quiet valgrind)
     m_rxWindowSize (0),
+    m_initialCWnd (0),          // For attribute initialization consistency (quiet valgrind)
     m_persistTime (Seconds(6)), //XXX hook this into attributes?
     m_rtt (0),
     m_lastMeasuredRtt (Seconds(0.0))
@@ -171,13 +175,19 @@
   if (m_endPoint != 0)
     {
       NS_ASSERT (m_tcp != 0);
-      /**
-       * Note that this piece of code is a bit tricky:
-       * when DeAllocate is called, it will call into
-       * Ipv4EndPointDemux::Deallocate which triggers
-       * a delete of the associated endPoint which triggers
-       * in turn a call to the method ::Destroy below
-       * will will zero the m_endPoint field.
+      /*
+       * Note that this piece of code is seriously convoluted: When we do a 
+       * Bind we allocate an Ipv4Endpoint.  Immediately thereafter we always do
+       * a FinishBind which sets the DestroyCallback of that endpoint to be
+       * TcpSocketImpl::Destroy, below.  When m_tcp->DeAllocate is called, it 
+       * will in turn call into Ipv4EndpointDemux::DeAllocate with the endpoint
+       * (m_endPoint).  The demux will look up the endpoint and destroy it (the
+       * corollary is that we don't own the object pointed to by m_endpoint, we
+       * just borrowed it).  The destructor for the endpoint will call the 
+       * DestroyCallback which will then invoke TcpSocketImpl::Destroy below. 
+       * Destroy will zero m_node, m_tcp and m_endpoint.  The zero of m_node and
+       * m_tcp need to be here also in case the endpoint is deallocated before 
+       * shutdown.
        */
       NS_ASSERT (m_endPoint != 0);
       m_tcp->DeAllocate (m_endPoint);
@@ -192,7 +202,13 @@
 TcpSocketImpl::SetNode (Ptr<Node> node)
 {
   m_node = node;
-  // Initialize some variables 
+  /*
+   * Set the congestion window to IW.  This method is called from the L4 
+   * Protocol after it creates the socket.  The Attribute system takes
+   * care of setting m_initialCWnd and m_segmentSize to their default
+   * values.  m_cWnd depends on m_initialCwnd and m_segmentSize so it
+   * also needs to be updated in SetInitialCwnd and SetSegSize.
+   */
   m_cWnd = m_initialCWnd * m_segmentSize;
 }
 
@@ -321,7 +337,6 @@
 
   Actions_t action  = ProcessEvent (APP_CLOSE);
   ProcessAction (action);
-  ShutdownSend ();
   return 0;
 }
 
@@ -349,11 +364,11 @@
     {
       Ipv4Header header;
       header.SetDestination (m_remoteAddress);
-      Socket::SocketErrno errno;
+      Socket::SocketErrno errno_;
       Ptr<Ipv4Route> route;
       uint32_t oif = 0; //specify non-zero if bound to a source address
       // XXX here, cache the route in the endpoint?
-      route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+      route = ipv4->GetRoutingProtocol ()->RouteOutput (Ptr<Packet> (), header, oif, errno_);
       if (route != 0)
         {
           NS_LOG_LOGIC ("Route exists");
@@ -362,8 +377,8 @@
       else
         {
           NS_LOG_LOGIC ("TcpSocketImpl::Connect():  Route to " << m_remoteAddress << " does not exist");
-          NS_LOG_ERROR (errno);
-          m_errno = errno;
+          NS_LOG_ERROR (errno_);
+          m_errno = errno_;
           return -1;
         }
     }
@@ -654,6 +669,7 @@
   // simulation singleton is a way to get a single global static instance of a
   // class intended to be a singleton; see simulation-singleton.h
   SA stateAction = SimulationSingleton<TcpStateMachine>::Get ()->Lookup (m_state,e);
+  NS_LOG_LOGIC ("TcpSocketImpl::ProcessEvent stateAction " << stateAction.action);
   // debug
   if (stateAction.action == RST_TX)
     {
@@ -679,6 +695,11 @@
       m_endPoint->SetPeer (m_remoteAddress, m_remotePort);
       NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!");
     }
+  if (saveState < CLOSING && (m_state == CLOSING || m_state == TIMED_WAIT) )
+    {
+      NS_LOG_LOGIC ("TcpSocketImpl peer closing, send EOF to application");
+      NotifyDataRecv ();
+    }
 
   if (needCloseNotify && !m_closeNotified)
     {
@@ -693,6 +714,24 @@
           << m_state << " event " << e
           << " set CloseNotif ");
     }
+
+  if (m_state == CLOSED && saveState != CLOSED && m_endPoint != 0)
+    {
+      NS_ASSERT (m_tcp != 0);
+      /*
+       * We want to deallocate the endpoint now.  We can't just naively call
+       * Deallocate (see the comment in TcpSocketImpl::~TcpSocketImpl), we 
+       * have to turn off the DestroyCallback to keep it from calling back 
+       * into TcpSocketImpl::Destroy and closing pretty much everything down.
+       * Once we have the callback disconnected, we can DeAllocate the
+       * endpoint which actually deals with destroying the actual endpoint,
+       * and then zero our member varible on general principles.
+       */
+      m_endPoint->SetDestroyCallback(MakeNullCallback<void>());
+      m_tcp->DeAllocate (m_endPoint);
+      m_endPoint = 0;
+    }
+    
   return stateAction.action;
 }
 
@@ -821,6 +860,7 @@
   switch (a)
   {
     case ACK_TX:
+      NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX");
       if(tcpHeader.GetFlags() & TcpHeader::FIN)
       {
         ++m_nextRxSequence; //bump this to account for the FIN
@@ -850,11 +890,11 @@
         if (ipv4->GetRoutingProtocol () != 0)
           {
             Ipv4Header header;
-            Socket::SocketErrno errno;
+            Socket::SocketErrno errno_;
             Ptr<Ipv4Route> route;
             uint32_t oif = 0; //specify non-zero if bound to a source address
             header.SetDestination (m_remoteAddress);
-            route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno);
+            route = ipv4->GetRoutingProtocol ()->RouteOutput (Ptr<Packet> (), header, oif, errno_);
             if (route != 0)
               {
                 NS_LOG_LOGIC ("Route exists");
@@ -862,8 +902,8 @@
               }
             else
               {
-                NS_LOG_ERROR (errno);
-                m_errno = errno;
+                NS_LOG_ERROR (errno_);
+                m_errno = errno_;
                 return -1;
               }
           }
@@ -1153,11 +1193,6 @@
                 << " seq " << tcpHeader.GetSequenceNumber()
                 << " ack " << tcpHeader.GetAckNumber()
                 << " p.size is " << p->GetSize () );
-  NS_LOG_DEBUG ("TcpSocketImpl " << this <<
-                " NewRx," <<
-                " seq " << tcpHeader.GetSequenceNumber() <<
-                " ack " << tcpHeader.GetAckNumber() <<
-                " p.size is " << p->GetSize());
   States_t origState = m_state;
   if (RxBufferFreeSpace() < p->GetSize()) 
     { //if not enough room, fragment
@@ -1625,6 +1660,13 @@
 TcpSocketImpl::SetSegSize (uint32_t size)
 {
   m_segmentSize = size;
+  /*
+   * Make sure that the congestion window is initialized for IW properly.  We
+   * can't do this after the connection starts up or would would most likely 
+   * change m_cWnd out from under the protocol.  That would be Bad (TM).
+   */
+  NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpSocketImpl::SetSegSize(): Cannot change segment size dynamically.");
+  m_cWnd = m_initialCWnd * m_segmentSize;
 }
 
 uint32_t
@@ -1649,6 +1691,13 @@
 TcpSocketImpl::SetInitialCwnd (uint32_t cwnd)
 {
   m_initialCWnd = cwnd;
+  /*
+   * Make sure that the congestion window is initialized for IW properly.  We
+   * can't do this after the connection starts up or would would most likely 
+   * change m_cWnd out from under the protocol.  That would be Bad (TM).
+   */
+  NS_ABORT_MSG_UNLESS (m_state == CLOSED, "TcpSocketImpl::SetInitialCwnd(): Cannot change initial cwnd dynamically.");
+  m_cWnd = m_initialCWnd * m_segmentSize;
 }
 
 uint32_t
--- a/src/internet-stack/tcp-test.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/tcp-test.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -37,8 +37,8 @@
 #include "icmpv4-l4-protocol.h"
 #include "udp-l4-protocol.h"
 #include "tcp-l4-protocol.h"
-#include "ipv4-static-routing-impl.h"
-#include "ipv4-list-routing-impl.h"
+#include "ns3/ipv4-static-routing.h"
+#include "ns3/ipv4-list-routing.h"
 
 #include "ns3/node.h"
 #include "ns3/inet-socket-address.h"
@@ -56,13 +56,10 @@
   //IPV4
   Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
   //Routing for Ipv4
-  //Routing for Ipv4
-  Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
-  ipv4->SetRoutingProtocol (ipv4RoutingImpl);
-  ipv4RoutingImpl->SetNode (node);
-  Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
-  ipv4staticRoutingImpl->SetNode (node);
-  ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
+  Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> ();
+  ipv4->SetRoutingProtocol (ipv4Routing);
+  Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> ();
+  ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
   node->AggregateObject(ipv4);
   //ICMP
   Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
@@ -303,7 +300,7 @@
 TcpSocketImplTest::AddSimpleNetDevice (Ptr<Node> node, const char* ipaddr, const char* netmask)
 {
   Ptr<SimpleNetDevice> dev = CreateObject<SimpleNetDevice> ();
-  dev->SetAddress (Mac48Address::Allocate ());
+  dev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
   node->AddDevice (dev);
   Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
   uint32_t ndid = ipv4->AddInterface (dev);
--- a/src/internet-stack/udp-header.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/udp-header.h	Fri Jul 03 09:59:04 2009 +0400
@@ -48,7 +48,7 @@
   ~UdpHeader ();
 
   /**
-   * \brief Enable checksum calculation for UDP (XXX currently has no effect)
+   * \brief Enable checksum calculation for UDP 
    */
   void EnableChecksums (void);
   /**
--- a/src/internet-stack/udp-socket-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/udp-socket-impl.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -396,11 +396,11 @@
     {
       Ipv4Header header;
       header.SetDestination (dest);
-      Socket::SocketErrno errno;
+      Socket::SocketErrno errno_;
       Ptr<Ipv4Route> route;
       uint32_t oif = 0; //specify non-zero if bound to a source address
       // TBD-- we could cache the route and just check its validity
-      route = ipv4->GetRoutingProtocol ()->RouteOutput (header, oif, errno); 
+      route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_); 
       if (route != 0)
         {
           NS_LOG_LOGIC ("Route exists");
@@ -413,8 +413,8 @@
       else 
         {
           NS_LOG_LOGIC ("No route to destination");
-          NS_LOG_ERROR (errno);
-          m_errno = errno;
+          NS_LOG_ERROR (errno_);
+          m_errno = errno_;
           return -1;
         }
     }
--- a/src/internet-stack/udp-test.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/udp-test.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -41,8 +41,8 @@
 #include "icmpv4-l4-protocol.h"
 #include "udp-l4-protocol.h"
 #include "tcp-l4-protocol.h"
-#include "ipv4-list-routing-impl.h"
-#include "ipv4-static-routing-impl.h"
+#include "ns3/ipv4-list-routing.h"
+#include "ns3/ipv4-static-routing.h"
 
 #include <string>
 #include <limits>
@@ -57,12 +57,10 @@
   //IPV4
   Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
   //Routing for Ipv4
-  Ptr<Ipv4ListRoutingImpl> ipv4RoutingImpl = CreateObject<Ipv4ListRoutingImpl> ();
-  ipv4->SetRoutingProtocol (ipv4RoutingImpl);
-  ipv4RoutingImpl->SetNode (node);
-  Ptr<Ipv4StaticRoutingImpl> ipv4staticRoutingImpl = CreateObject<Ipv4StaticRoutingImpl> ();
-  ipv4staticRoutingImpl->SetNode (node);
-  ipv4RoutingImpl->AddRoutingProtocol (ipv4staticRoutingImpl, 0);
+  Ptr<Ipv4ListRouting> ipv4Routing = CreateObject<Ipv4ListRouting> ();
+  ipv4->SetRoutingProtocol (ipv4Routing);
+  Ptr<Ipv4StaticRouting> ipv4staticRouting = CreateObject<Ipv4StaticRouting> ();
+  ipv4Routing->AddRoutingProtocol (ipv4staticRouting, 0);
   node->AggregateObject(ipv4);
   //ICMP
   Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
@@ -136,7 +134,7 @@
   Ptr<SimpleNetDevice> rxDev1, rxDev2;
   { // first interface
     rxDev1 = CreateObject<SimpleNetDevice> ();
-    rxDev1->SetAddress (Mac48Address::Allocate ());
+    rxDev1->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
     rxNode->AddDevice (rxDev1);
     Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
     uint32_t netdev_idx = ipv4->AddInterface (rxDev1);
@@ -147,7 +145,7 @@
 
   { // second interface
     rxDev2 = CreateObject<SimpleNetDevice> ();
-    rxDev2->SetAddress (Mac48Address::Allocate ());
+    rxDev2->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
     rxNode->AddDevice (rxDev2);
     Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
     uint32_t netdev_idx = ipv4->AddInterface (rxDev2);
@@ -162,7 +160,7 @@
   Ptr<SimpleNetDevice> txDev1;
   {
     txDev1 = CreateObject<SimpleNetDevice> ();
-    txDev1->SetAddress (Mac48Address::Allocate ());
+    txDev1->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
     txNode->AddDevice (txDev1);
     Ptr<Ipv4> ipv4 = txNode->GetObject<Ipv4> ();
     uint32_t netdev_idx = ipv4->AddInterface (txDev1);
@@ -173,7 +171,7 @@
   Ptr<SimpleNetDevice> txDev2;
   {
     txDev2 = CreateObject<SimpleNetDevice> ();
-    txDev2->SetAddress (Mac48Address::Allocate ());
+    txDev2->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ()));
     txNode->AddDevice (txDev2);
     Ptr<Ipv4> ipv4 = txNode->GetObject<Ipv4> ();
     uint32_t netdev_idx = ipv4->AddInterface (txDev2);
--- a/src/internet-stack/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/internet-stack/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -74,14 +74,13 @@
     obj.source = [
         'tcp-test.cc',
         'udp-test.cc',
+        'ipv4-test.cc',
         'ipv4-l4-protocol.cc',
         'udp-header.cc',
         'tcp-header.cc',
         'ipv4-checksum.cc',
         'ipv4-interface.cc',
         'ipv4-l3-protocol.cc',
-        'ipv4-static-routing-impl.cc',
-        'ipv4-list-routing-impl.cc',
         'ipv4-end-point.cc',
         'udp-l4-protocol.cc',
         'tcp-l4-protocol.cc',
@@ -109,8 +108,6 @@
         'udp-header.h',
         'tcp-header.h',
         'sequence-number.h',
-        'ipv4-list-routing-impl.h',
-        'ipv4-static-routing-impl.h',
         'icmpv4.h',
         ]
 
--- a/src/node/ipv4-interface-address.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/ipv4-interface-address.h	Fri Jul 03 09:59:04 2009 +0400
@@ -77,10 +77,25 @@
 
   InterfaceAddressScope_e m_scope;   
   bool m_secondary;        // For use in multihoming
+
+  friend bool operator == (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b);
+  friend bool operator != (Ipv4InterfaceAddress const &a, Ipv4InterfaceAddress const &b);
 };
 
 std::ostream& operator<< (std::ostream& os, const Ipv4InterfaceAddress &addr);
 
+inline bool operator == (const Ipv4InterfaceAddress &a, const Ipv4InterfaceAddress &b)
+{
+  return (a.m_local == b.m_local && a.m_mask == b.m_mask &&
+    a.m_broadcast == b.m_broadcast && a.m_scope == b.m_scope && a.m_secondary == b.m_secondary);
+}
+inline bool operator != (const Ipv4InterfaceAddress &a, const Ipv4InterfaceAddress &b)
+{
+  return (a.m_local != b.m_local || a.m_mask != b.m_mask ||
+    a.m_broadcast != b.m_broadcast || a.m_scope != b.m_scope || a.m_secondary != b.m_secondary);
+}
+
+
 } // namespace ns3
 
 #endif /* IPV4_ADDRESS_H */
--- a/src/node/ipv4-list-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 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 "ipv4-list-routing.h"
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4ListRouting);
-
-TypeId 
-Ipv4ListRouting::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::Ipv4ListRouting")
-    .SetParent<Ipv4RoutingProtocol> ()
-    ;
-  return tid;
-}
-
-} // namespace ns3
--- a/src/node/ipv4-list-routing.h	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 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_LIST_ROUTING_H
-#define IPV4_LIST_ROUTING_H
-
-#include "ipv4-routing-protocol.h"
-
-namespace ns3 {
-
-/**
- * \ingroup ipv4Routing 
- *
- * This class is a specialization of Ipv4RoutingProtocol that allows 
- * other instances of Ipv4RoutingProtocol to be inserted in a 
- * prioritized list.  Routing protocols in the list are consulted one
- * by one, from highest to lowest proirity, until a routing protocol
- * is found that will take the packet (this corresponds to a non-zero
- * return value to RouteOutput, or a return value of true to RouteInput).
- * The order by which routing protocols with the same priority value 
- * are consulted is undefined.
- * 
- */
-class Ipv4ListRouting : public Ipv4RoutingProtocol
-{
-public:
-  static TypeId GetTypeId (void);
-  /**
-   * \brief Register a new routing protocol to be used in this IPv4 stack
-   *
-   * \param routingProtocol new routing protocol implementation object
-   * \param priority priority to give to this routing protocol.
-   * Values may range between -32768 and +32767.  
-   */
-  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority) = 0;
-  /**
-   * \return number of routing protocols in the list
-   */
-  virtual uint32_t GetNRoutingProtocols (void) const = 0;
-  /**
-   * \return pointer to routing protocol indexed by 
-   * \param index index of protocol to return
-   * \param priority output parameter, set to the priority of the protocol
-            being returned
-   */
-  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const = 0;
-};
-
-} //namespace ns3
-
-#endif /* IPV4_LIST_ROUTING_H */
--- a/src/node/ipv4-routing-protocol.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/ipv4-routing-protocol.h	Fri Jul 03 09:59:04 2009 +0400
@@ -23,6 +23,8 @@
 #include "ns3/object.h"
 #include "ns3/socket.h"
 #include "ipv4-header.h"
+#include "ipv4-interface-address.h"
+#include "ipv4.h"
 
 namespace ns3 {
 
@@ -49,7 +51,7 @@
   typedef Callback<void, Ptr<Ipv4Route>, Ptr<const Packet>, const Ipv4Header &> UnicastForwardCallback;
   typedef Callback<void, Ptr<Ipv4MulticastRoute>, Ptr<const Packet>, const Ipv4Header &> MulticastForwardCallback;
   typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, uint32_t > LocalDeliverCallback;
-  typedef Callback<void, Ptr<const Packet>, const Ipv4Header &> ErrorCallback;
+  typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno > ErrorCallback;
   
   /**
    * \brief Query routing cache for an existing route, for an outbound packet
@@ -58,6 +60,8 @@
    * packet to be forwarded, and is synchronous.  Can be used for
    * multicast or unicast.  The Linux equivalent is ip_route_output()
    *
+   * \param p packet to be routed.  Note that this method may modify the packet.
+   *          Callers may also pass in a null pointer. 
    * \param header input parameter (used to form key to search for the route)
    * \param oif Output interface index.  May be zero, or may be bound via
    *            socket options to a particular output interface.
@@ -65,7 +69,7 @@
    *
    * \returns a code that indicates what happened in the lookup
    */
-  virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr) = 0;
+  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr) = 0;
   
   /**
    * \brief Route an input packet (to be forwarded or locally delivered)
@@ -91,6 +95,48 @@
   virtual bool RouteInput  (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, 
                              UnicastForwardCallback ucb, MulticastForwardCallback mcb, 
                              LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
+
+  /**
+   * \param interface the index of the interface we are being notified about
+   *
+   * Protocols are expected to implement this method to be notified of the state change of
+   * an interface in a node.
+   */
+  virtual void NotifyInterfaceUp (uint32_t interface) = 0;
+  /**
+   * \param interface the index of the interface we are being notified about
+   *
+   * Protocols are expected to implement this method to be notified of the state change of
+   * an interface in a node.
+   */
+  virtual void NotifyInterfaceDown (uint32_t interface) = 0;
+
+  /**
+   * \param interface the index of the interface we are being notified about
+   * \param address a new address being added to an interface
+   *
+   * Protocols are expected to implement this method to be notified whenever
+   * a new address is added to an interface. Typically used to add a 'network route' on an
+   * interface. Can be invoked on an up or down interface.
+   */
+  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
+
+  /**
+   * \param interface the index of the interface we are being notified about
+   * \param address a new address being added to an interface
+   *
+   * Protocols are expected to implement this method to be notified whenever
+   * a new address is removed from an interface. Typically used to remove the 'network route' of an
+   * interface. Can be invoked on an up or down interface.
+   */
+  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
+
+  /**
+   * \param ipv4 the ipv4 object this routing protocol is being associated with
+   * 
+   * Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
+   */
+  virtual void SetIpv4 (Ptr<Ipv4> ipv4) = 0;
 };
 
 } //namespace ns3
--- a/src/node/ipv4-routing-table-entry.cc	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- *
- * 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include "ipv4-routing-table-entry.h"
-#include "ns3/assert.h"
-
-namespace ns3 {
-
-/*****************************************************
- *     Network Ipv4RoutingTableEntry
- *****************************************************/
-
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry ()
-{}
-
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route)
-  : m_dest (route.m_dest),
-    m_destNetworkMask (route.m_destNetworkMask),
-    m_gateway (route.m_gateway),
-    m_interface (route.m_interface)
-{}
-
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route)
-  : m_dest (route->m_dest),
-    m_destNetworkMask (route->m_destNetworkMask),
-    m_gateway (route->m_gateway),
-    m_interface (route->m_interface)
-{}
-
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
-                      Ipv4Address gateway,
-                      uint32_t interface)
-  : m_dest (dest),
-    m_destNetworkMask (Ipv4Mask::GetZero ()),
-    m_gateway (gateway),
-    m_interface (interface)
-{}
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
-                      uint32_t interface)
-  : m_dest (dest),
-    m_destNetworkMask (Ipv4Mask::GetZero ()),
-    m_gateway (Ipv4Address::GetZero ()),
-    m_interface (interface)
-{}
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
-                      Ipv4Mask networkMask,
-                      Ipv4Address gateway,
-                      uint32_t interface)
-  : m_dest (network),
-    m_destNetworkMask (networkMask),
-    m_gateway (gateway),
-    m_interface (interface)
-{}
-Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
-                      Ipv4Mask networkMask,
-                      uint32_t interface)
-  : m_dest (network),
-    m_destNetworkMask (networkMask),
-    m_gateway (Ipv4Address::GetZero ()),
-    m_interface (interface)
-{}
-
-bool 
-Ipv4RoutingTableEntry::IsHost (void) const
-{
-  if (m_destNetworkMask.IsEqual (Ipv4Mask::GetZero ())) 
-    {
-      return true;
-    } 
-  else 
-    {
-      return false;
-    }
-}
-Ipv4Address 
-Ipv4RoutingTableEntry::GetDest (void) const
-{
-  return m_dest;
-}
-bool 
-Ipv4RoutingTableEntry::IsNetwork (void) const
-{
-  return !IsHost ();
-}
-bool 
-Ipv4RoutingTableEntry::IsDefault (void) const
-{
-  if (m_dest.IsEqual (Ipv4Address::GetZero ())) 
-    {
-      return true;
-    } 
-  else 
-    {
-      return false;
-    }
-}
-Ipv4Address 
-Ipv4RoutingTableEntry::GetDestNetwork (void) const
-{
-  return m_dest;
-}
-Ipv4Mask 
-Ipv4RoutingTableEntry::GetDestNetworkMask (void) const
-{
-  return m_destNetworkMask;
-}
-bool 
-Ipv4RoutingTableEntry::IsGateway (void) const
-{
-  if (m_gateway.IsEqual (Ipv4Address::GetZero ())) 
-    {
-      return false;
-    } 
-  else 
-    {
-      return true;
-    }
-}
-Ipv4Address 
-Ipv4RoutingTableEntry::GetGateway (void) const
-{
-  return m_gateway;
-}
-uint32_t
-Ipv4RoutingTableEntry::GetInterface (void) const
-{
-  return m_interface;
-}
-
-Ipv4RoutingTableEntry 
-Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest, 
-			      Ipv4Address nextHop, 
-			      uint32_t interface)
-{
-  return Ipv4RoutingTableEntry (dest, nextHop, interface);
-}
-Ipv4RoutingTableEntry 
-Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
-			      uint32_t interface)
-{
-  return Ipv4RoutingTableEntry (dest, interface);
-}
-Ipv4RoutingTableEntry 
-Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
-				 Ipv4Mask networkMask, 
-				 Ipv4Address nextHop, 
-				 uint32_t interface)
-{
-  return Ipv4RoutingTableEntry (network, networkMask, 
-                    nextHop, interface);
-}
-Ipv4RoutingTableEntry 
-Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
-				 Ipv4Mask networkMask, 
-				 uint32_t interface)
-{
-  return Ipv4RoutingTableEntry (network, networkMask, 
-                    interface);
-}
-Ipv4RoutingTableEntry 
-Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop, 
-			       uint32_t interface)
-{
-  return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
-}
-
-
-std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route)
-{
-  if (route.IsDefault ())
-    {
-      NS_ASSERT (route.IsGateway ());
-      os << "default out=" << route.GetInterface () << ", next hop=" << route.GetGateway ();
-    }
-  else if (route.IsHost ())
-    {
-      if (route.IsGateway ())
-        {
-          os << "host="<< route.GetDest () << 
-            ", out=" << route.GetInterface () << 
-            ", next hop=" << route.GetGateway ();
-        }
-      else
-        {
-          os << "host="<< route.GetDest () << 
-            ", out=" << route.GetInterface ();
-        }
-    }
-  else if (route.IsNetwork ()) 
-    {
-      if (route.IsGateway ())
-        {
-          os << "network=" << route.GetDestNetwork () <<
-            ", mask=" << route.GetDestNetworkMask () <<
-            ",out=" << route.GetInterface () <<
-            ", next hop=" << route.GetGateway ();
-        }
-      else
-        {
-          os << "network=" << route.GetDestNetwork () <<
-            ", mask=" << route.GetDestNetworkMask () <<
-            ",out=" << route.GetInterface ();
-        }
-    }
-  else
-    {
-      NS_ASSERT (false);
-    }
-  return os;
-}
-
-/*****************************************************
- *     Ipv4MulticastRoutingTableEntry
- *****************************************************/
-
-Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry ()
-{
-}
-
-Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route)
-: 
-  m_origin (route.m_origin),
-  m_group (route.m_group),
-  m_inputInterface (route.m_inputInterface),
-  m_outputInterfaces (route.m_outputInterfaces)
-{
-}
-
-Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route)
-: 
-  m_origin (route->m_origin),
-  m_group (route->m_group),
-  m_inputInterface (route->m_inputInterface),
-  m_outputInterfaces (route->m_outputInterfaces)
-{
-}
-
-Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (
-  Ipv4Address origin, 
-  Ipv4Address group, 
-  uint32_t inputInterface, 
-  std::vector<uint32_t> outputInterfaces)
-{
-  m_origin = origin;
-  m_group = group;
-  m_inputInterface = inputInterface;
-  m_outputInterfaces = outputInterfaces;
-}
-
-Ipv4Address 
-Ipv4MulticastRoutingTableEntry::GetOrigin (void) const
-{
-  return m_origin;
-}
-
-Ipv4Address 
-Ipv4MulticastRoutingTableEntry::GetGroup (void) const
-{
-  return m_group;
-}
-
-uint32_t 
-Ipv4MulticastRoutingTableEntry::GetInputInterface (void) const
-{
-  return m_inputInterface;
-}
-
-uint32_t
-Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces (void) const
-{
-  return m_outputInterfaces.size ();
-}
-
-uint32_t
-Ipv4MulticastRoutingTableEntry::GetOutputInterface (uint32_t n) const
-{
-  NS_ASSERT_MSG(n < m_outputInterfaces.size (), 
-    "Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds");
-
-  return m_outputInterfaces[n];
-}
-
-std::vector<uint32_t>
-Ipv4MulticastRoutingTableEntry::GetOutputInterfaces (void) const
-{
-  return m_outputInterfaces;
-}
-
-Ipv4MulticastRoutingTableEntry 
-Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (
-  Ipv4Address origin, 
-  Ipv4Address group, 
-  uint32_t inputInterface,
-  std::vector<uint32_t> outputInterfaces)
-{
-  return Ipv4MulticastRoutingTableEntry (origin, group, inputInterface, outputInterfaces);
-}
-
-std::ostream& 
-operator<< (std::ostream& os, Ipv4MulticastRoutingTableEntry const& route)
-{
-  os << "origin=" << route.GetOrigin () << 
-    ", group=" << route.GetGroup () <<
-    ", input interface=" << route.GetInputInterface () <<
-    ", output interfaces=";
-
-  for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i)
-    {
-      os << route.GetOutputInterface (i) << " ";
-
-    }
-
-  return os;
-}
-
-}//namespace ns3
--- a/src/node/ipv4-routing-table-entry.h	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- *
- * 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
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef IPV4_ROUTING_TABLE_ENTRY_H
-#define IPV4_ROUTING_TABLE_ENTRY_H
-
-#include <list>
-#include <vector>
-#include <ostream>
-
-#include "ns3/ipv4-address.h"
-
-namespace ns3 {
-
-/**
- * \ingroup ipv4Routing
- *
- * A record of an IPv4 routing table entry for Ipv4GlobalRouting and 
- * Ipv4StaticRouting.  This is not a reference counted object.
- */
-class Ipv4RoutingTableEntry {
-public:
-  /**
-   * \brief This constructor does nothing
-   */
-  Ipv4RoutingTableEntry ();
-  /**
-   * \brief Copy Constructor
-   * \param route The route to copy
-   */
-  Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route);
-  /**
-   * \brief Copy Constructor
-   * \param route The route to copy
-   */
-  Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route);
-  /**
-   * \return True if this route is a host route; false otherwise
-   */
-  bool IsHost (void) const;
-  /**
-   * \return The IPv4 address of the destination of this route
-   */
-  bool IsNetwork (void) const;
-  /**
-   * \return True if this route is a default route; false otherwise
-   */
-  bool IsDefault (void) const;
-  /**
-   * \return True if this route is a gateway route; false otherwise
-   */
-  bool IsGateway (void) const;
-  /**
-   * \return address of the gateway stored in this entry
-   */
-  Ipv4Address GetGateway (void) const;
-  /**
-   * \return The IPv4 address of the destination of this route
-   */
-  Ipv4Address GetDest (void) const;
-  /**
-   * \return The IPv4 network number of the destination of this route
-   */
-  Ipv4Address GetDestNetwork (void) const;
-  /**
-   * \return The IPv4 network mask of the destination of this route
-   */
-  Ipv4Mask GetDestNetworkMask (void) const;
-  /**
-   * \return The Ipv4 interface number used for sending outgoing packets
-   */
-  uint32_t GetInterface (void) const;
-  /**
-   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
-   * \param dest Ipv4Address of the destination
-   * \param nextHop Ipv4Address of the next hop
-   * \param interface Outgoing interface 
-   */
-  static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest, 
-				      Ipv4Address nextHop, 
-				      uint32_t interface);
-  /**
-   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
-   * \param dest Ipv4Address of the destination
-   * \param interface Outgoing interface 
-   */
-  static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest, 
-				      uint32_t interface);
-  /**
-   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
-   * \param network Ipv4Address of the destination network
-   * \param networkMask Ipv4Mask of the destination network mask
-   * \param nextHop Ipv4Address of the next hop
-   * \param interface Outgoing interface 
-   */
-  static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network, 
-					 Ipv4Mask networkMask, 
-					 Ipv4Address nextHop, 
-					 uint32_t interface);
-  /**
-   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
-   * \param network Ipv4Address of the destination network
-   * \param networkMask Ipv4Mask of the destination network mask
-   * \param interface Outgoing interface 
-   */
-  static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network, 
-					 Ipv4Mask networkMask, 
-					 uint32_t interface);
-  /**
-   * \return An Ipv4RoutingTableEntry object corresponding to the input 
-   * parameters.  This route is distinguished; it will match any 
-   * destination for which a more specific route does not exist.
-   * \param nextHop Ipv4Address of the next hop
-   * \param interface Outgoing interface 
-   */
-  static Ipv4RoutingTableEntry CreateDefaultRoute (Ipv4Address nextHop, 
-				       uint32_t interface);
-  
-private:
-  Ipv4RoutingTableEntry (Ipv4Address network,
-	     Ipv4Mask mask,
-	     Ipv4Address gateway,
-	     uint32_t interface);
-  Ipv4RoutingTableEntry (Ipv4Address dest,
-	     Ipv4Mask mask,
-	     uint32_t interface);
-  Ipv4RoutingTableEntry (Ipv4Address dest,
-	     Ipv4Address gateway,
-	     uint32_t interface);
-  Ipv4RoutingTableEntry (Ipv4Address dest,
-	     uint32_t interface);
-
-  Ipv4Address m_dest;
-  Ipv4Mask m_destNetworkMask;
-  Ipv4Address m_gateway;
-  uint32_t m_interface;
-};
-
-std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route);
-
-/**
- * \ingroup ipv4Routing
- *
- * \brief A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting
- */
-class Ipv4MulticastRoutingTableEntry {
-public:
-  /**
-   * \brief This constructor does nothing
-   */
-  Ipv4MulticastRoutingTableEntry ();
-
-  /**
-   * \brief Copy Constructor
-   * \param route The route to copy
-   */
-  Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route);
-  /**
-   * \brief Copy Constructor
-   * \param route The route to copy
-   */
-  Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route);
-  /**
-   * \return The IPv4 address of the source of this route
-   */
-  Ipv4Address GetOrigin (void) const;
-  /**
-   * \return The IPv4 address of the multicast group of this route
-   */
-  Ipv4Address GetGroup (void) const;
-  /**
-   * \return The IPv4 address of the input interface of this route
-   */
-  uint32_t GetInputInterface (void) const;
-  /**
-   * \return The number of output interfaces of this route
-   */
-  uint32_t GetNOutputInterfaces (void) const;
-  /**
-   * \return A specified output interface.
-   */
-  uint32_t GetOutputInterface (uint32_t n) const;
-  /**
-   * \return A vector of all of the output interfaces of this route.
-   */
-  std::vector<uint32_t> GetOutputInterfaces (void) const;
-  /**
-   * \return Ipv4MulticastRoutingTableEntry corresponding to the input parameters.
-   * \param origin Source address for the multicast route 
-   * \param group Group destination address for the multicast route
-   * \param inputInterface Input interface that multicast datagram must be received on
-   * \param outputInterfaces vector of output interfaces to copy and forward the datagram to
-   */
-  static Ipv4MulticastRoutingTableEntry CreateMulticastRoute (Ipv4Address origin, 
-    Ipv4Address group, uint32_t inputInterface,
-    std::vector<uint32_t> outputInterfaces);
-
-private:
-  Ipv4MulticastRoutingTableEntry (Ipv4Address origin, Ipv4Address group, 
-    uint32_t inputInterface, std::vector<uint32_t> outputInterfaces);
-
-  Ipv4Address m_origin;
-  Ipv4Address m_group;
-  uint32_t m_inputInterface;
-  std::vector<uint32_t> m_outputInterfaces;
-};
-
-std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoutingTableEntry const& route);
-
-}//namespace ns3
-
-#endif /* IPV4_ROUTING_TABLE_ENTRY_H */
--- a/src/node/ipv4-static-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2009 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 "ipv4-static-routing.h"
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRouting);
-
-TypeId 
-Ipv4StaticRouting::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::Ipv4StaticRouting")
-    .SetParent<Ipv4RoutingProtocol> ()
-    ;
-  return tid;
-}
-
-} // namespace ns3
--- a/src/node/ipv4-static-routing.h	Wed Jul 01 21:54:24 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2006 Georgia Tech Research Corporation
- *
- * 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
- *
- * Author: George F. Riley<riley@ece.gatech.edu>
- *         Gustavo Carneiro <gjc@inescporto.pt>
- */
-
-#ifndef IPV4_STATIC_ROUTING_H
-#define IPV4_STATIC_ROUTING_H
-
-#include <list>
-#include <stdint.h>
-#include "ns3/ipv4-address.h"
-#include "ns3/ipv4-header.h"
-#include "ns3/socket.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 Node;
-
-class Ipv4RoutingTableEntry;
-class Ipv4MulticastRoutingTableEntry;
-
-/**
- * \ingroup ipv4Routing
- * 
- * \brief Static 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).
- *
- * The Ipv4StaticRouting class inherits from the abstract base class 
- * Ipv4RoutingProtocol that defines the interface methods that a routing 
- * protocol must support.
- *
- * When a packet arrives in the Ipv4L3Protocol for transmission, it comes
- * either from a local source via Ipv4L3Protocol::Send or from a remote 
- * source via Ipv4L3Protocol::Forwarding.  In both cases, a function is called
- * (Ipv4L3Protocol::Lookup) to look up the routing information for the packet.
- *
- * The lookup function iterates through the list of routing protocols asking
- * each to see if it can find a route and send the packet.  A callback is 
- * provided during each of these calls that should be considered a pre-
- * packaged send call.  This is done to allow asynchronous calls into 
- * routing subsystems in order to support on-demand routing, for example.  The
- * method for requesting this operation is Ipv4StaticRouting::RequestRoute for
- * the static routing protocol.
- *
- * Each routing protocol is also free to implement its own methods for managing
- * routes which you will find below.  This class manages a set of "static" or
- * manually configured routes for host, network and multicast routes.
- *
- * \see Ipv4RoutingProtocol
- * \see Ipv4L3Protocol::AddRoutingProtocol
- * \see Ipv4L3Protocol::Ipv4L3Protocol
- */
-class Ipv4StaticRouting : public Ipv4RoutingProtocol
-{
-public:
-  static TypeId GetTypeId (void);
-
-/**
- * \brief Add a host route to the static 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
- */
-  virtual void AddHostRouteTo (Ipv4Address dest, 
-                       Ipv4Address nextHop, 
-                       uint32_t interface) = 0;
-/**
- * \brief Add a host route to the static 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
- */
-  virtual void AddHostRouteTo (Ipv4Address dest, uint32_t interface) = 0;
-
-/**
- * \brief Add a network route to the static 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
- */
-  virtual void AddNetworkRouteTo (Ipv4Address network, 
-                          Ipv4Mask networkMask, 
-                          Ipv4Address nextHop, 
-                          uint32_t interface) = 0;
-
-/**
- * \brief Add a network route to the static 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
- */
-  virtual void AddNetworkRouteTo (Ipv4Address network, 
-                          Ipv4Mask networkMask, 
-                          uint32_t interface) = 0;
-
-/**
- * \brief Add a default route to the static routing table.
- *
- * This method tells the routing system what to do in the case where a specific
- * route to a destination is not found.  The system forwards packets to the
- * specified node in the hope that it knows better how to route the packet.
- * 
- * If the default route is set, it is returned as the selected route from 
- * LookupStatic irrespective of destination address if no specific route is
- * found.
- *
- * \param nextHop The Ipv4Address to send packets to in the hope that they
- * will be forwarded correctly.
- * \param interface The network interface index used to send packets.
- *
- * \see Ipv4Address
- * \see Ipv4StaticRouting::Lookup
- */
-  virtual void SetDefaultRoute (Ipv4Address nextHop, uint32_t interface) = 0;
-
-/**
- * \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.
- */
-  virtual uint32_t GetNRoutes (void) = 0;
-
-/**
- * \brief Get the default route from the static routing table.
- *
- * \return If the default route is set, a pointer to that Ipv4RoutingTableEntry is
- * returned, otherwise a zero pointer is returned.
- *
- * \see Ipv4RoutingTableEntry
- */
-  virtual Ipv4RoutingTableEntry GetDefaultRoute (void) = 0;
-
-/**
- * \brief Get a route from the static unicast routing table.
- *
- * Externally, the unicast static 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 Ipv4StaticRouting::RemoveRoute
- */
-  virtual Ipv4RoutingTableEntry GetRoute (uint32_t i) = 0;
-
-/**
- * \brief Remove a route from the static unicast routing table.
- *
- * Externally, the unicast static 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 Ipv4StaticRouting::GetRoute
- * \see Ipv4StaticRouting::AddRoute
- */
-  virtual void RemoveRoute (uint32_t i) = 0;
-
-/**
- * \brief Add a multicast route to the static routing table.
- *
- * A multicast route must specify an origin IP address, a multicast group and
- * an input network interface index as conditions and provide a vector of
- * output network interface indices over which packets matching the conditions
- * are sent.
- *
- * Typically there are two main types of multicast routes:  routes of the 
- * first kind are used during forwarding.  All of the conditions must be
- * exlicitly provided.  The second kind of routes are used to get packets off
- * of a local node.  The difference is in the input interface.  Routes for
- * forwarding will always have an explicit input interface specified.  Routes
- * off of a node will always set the input interface to a wildcard specified
- * by the index Ipv4RoutingProtocol::INTERFACE_ANY.
- *
- * For routes off of a local node wildcards may be used in the origin and
- * multicast group addresses.  The wildcard used for Ipv4Adresses is that 
- * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0".  Usage
- * of a wildcard allows one to specify default behavior to varying degrees.
- *
- * For example, making the origin address a wildcard, but leaving the 
- * multicast group specific allows one (in the case of a node with multiple
- * interfaces) to create different routes using different output interfaces
- * for each multicast group.
- *
- * If the origin and multicast addresses are made wildcards, you have created
- * essentially a default multicast address that can forward to multiple 
- * interfaces.  Compare this to the actual default multicast address that is
- * limited to specifying a single output interface for compatibility with
- * existing functionality in other systems.
- * 
- * \param origin The Ipv4Address of the origin of packets for this route.  May
- * be Ipv4Address:GetAny for open groups.
- * \param group The Ipv4Address of the multicast group or this route.
- * \param inputInterface The input network interface index over which to 
- * expect packets destined for this route.  May be
- * Ipv4RoutingProtocol::INTERFACE_ANY for packets of local origin.
- * \param outputInterfaces A vector of network interface indices used to specify
- * how to send packets to the destination(s).
- *
- * \see Ipv4Address
- */
-  virtual void AddMulticastRoute (Ipv4Address origin,
-                          Ipv4Address group,
-                          uint32_t inputInterface,
-                          std::vector<uint32_t> outputInterfaces) = 0;
-
-/**
- * \brief Add a default multicast route to the static routing table.
- *
- * This is the multicast equivalent of the unicast version SetDefaultRoute.
- * We tell the routing system what to do in the case where a specific route
- * to a destination multicast group is not found.  The system forwards 
- * packets out the specified interface in the hope that "something out there"
- * knows better how to route the packet.  This method is only used in 
- * initially sending packets off of a host.  The default multicast route is
- * not consulted during forwarding -- exact routes must be specified using
- * AddMulticastRoute for that case.
- *
- * Since we're basically sending packets to some entity we think may know
- * better what to do, we don't pay attention to "subtleties" like origin
- * address, nor do we worry about forwarding out multiple  interfaces.  If the
- * default multicast route is set, it is returned as the selected route from 
- * LookupStatic irrespective of origin or multicast group if another specific
- * route is not found.
- *
- * \param outputInterface The network interface index used to specify where
- * to send packets in the case of unknown routes.
- *
- * \see Ipv4Address
- */
-  virtual void SetDefaultMulticastRoute (uint32_t outputInterface) = 0;
-
-/**
- * \brief Get the number of individual multicast routes that have been added
- * to the routing table.
- *
- * \warning The default multicast route counts as one of the routes.
- */
-  virtual uint32_t GetNMulticastRoutes (void) const = 0;
-
-/**
- * \brief Get a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- * 
- * \param i The index (into the routing table) of the multicast route to
- * retrieve.  
- * \return If route \e i is set, a pointer to that Ipv4MulticastRoutingTableEntry is
- * returned, otherwise a zero pointer is returned.
- *
- * \see Ipv4MulticastRoutingTableEntry
- * \see Ipv4StaticRouting::RemoveRoute
- */
-  virtual Ipv4MulticastRoutingTableEntry GetMulticastRoute (uint32_t i) const = 0;
-
-/**
- * \brief Remove a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- * This method causes the multicast routing table to be searched for the first
- * route that matches the parameters and removes it.
- *
- * Wildcards may be provided to this function, but the wildcards are used to
- * exacly match wildcards in the routes (see AddMulticastRoute).  That is,
- * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not
- * remove routes with any address in the origin, but will only remove routes
- * with "0.0.0.0" set as the the origin.
- *
- * \param origin The IP address specified as the origin of packets for the
- * route.
- * \param group The IP address specified as the multicast group addres of
- * the route.
- * \param inputInterface The network interface index specified as the expected
- * input interface for the route.
- * \returns true if a route was found and removed, false otherwise.
- *
- * \see Ipv4MulticastRoutingTableEntry
- * \see Ipv4StaticRouting::AddMulticastRoute
- */
-  virtual bool RemoveMulticastRoute (Ipv4Address origin,
-                             Ipv4Address group,
-                             uint32_t inputInterface) = 0;
-
-/**
- * \brief Remove a route from the static multicast routing table.
- *
- * Externally, the multicast static routing table appears simply as a table 
- * with n entries.  
- *
- * \param index The index (into the multicast routing table) of the route to
- * remove.  
- *
- * \see Ipv4RoutingTableEntry
- * \see Ipv4StaticRouting::GetRoute
- * \see Ipv4StaticRouting::AddRoute
- */
-  virtual void RemoveMulticastRoute (uint32_t index) = 0;
-
-  virtual void SetNode (Ptr<Node> node) = 0;
-  virtual Ptr<Node> GetNode (void) const = 0;
-
-};
-
-} // Namespace ns3
-
-#endif /* IPV4_STATIC_ROUTING_H */
--- a/src/node/ipv4.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/ipv4.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -32,7 +32,7 @@
 {
   static TypeId tid = TypeId ("ns3::Ipv4")
     .SetParent<Object> ()
-    .AddAttribute ("IpForward", "If enabled, node can act as unicast router.",
+    .AddAttribute ("IpForward", "Globally enable or disable IP forwarding for all current and future Ipv4 devices.",
                    BooleanValue (true),
                    MakeBooleanAccessor (&Ipv4::SetIpForward,
                                         &Ipv4::GetIpForward),
--- a/src/node/ipv4.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/ipv4.h	Fri Jul 03 09:59:04 2009 +0400
@@ -24,7 +24,6 @@
 #include "ns3/object.h"
 #include "ns3/socket.h"
 #include "ns3/callback.h"
-#include "ipv4-routing-protocol.h"
 #include "ipv4-address.h"
 #include "ipv4-interface-address.h"
 
@@ -33,6 +32,7 @@
 class Node;
 class NetDevice;
 class Packet;
+class Ipv4RoutingProtocol;
 
 /**
  * \ingroup node
@@ -159,9 +159,9 @@
   /**
    * \param interface Interface number of an Ipv4 interface
    * \param address Ipv4InterfaceAddress address to associate with the underlying Ipv4 interface
-   * \returns The address index of the newly-added address
+   * \returns true if the operation succeeded
    */
-  virtual uint32_t AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
+  virtual bool AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
 
   /**
    * \param interface Interface number of an Ipv4 interface
@@ -170,6 +170,9 @@
   virtual uint32_t GetNAddresses (uint32_t interface) const = 0;
 
   /**
+   * Because addresses can be removed, the addressIndex is not guaranteed
+   * to be static across calls to this method.
+   * 
    * \param interface Interface number of an Ipv4 interface
    * \param addressIndex index of Ipv4InterfaceAddress 
    * \returns the Ipv4InterfaceAddress associated to the interface and addresIndex
@@ -177,6 +180,18 @@
   virtual Ipv4InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0;
 
   /**
+   * Remove the address at addressIndex on named interface.  The addressIndex
+   * for all higher indices will decrement by one after this method is called;
+   * so, for example, to remove 5 addresses from an interface i, one could
+   * call RemoveAddress (i, 0); 5 times.  
+   * 
+   * \param interface Interface number of an Ipv4 interface
+   * \param addressIndex index of Ipv4InterfaceAddress to remove 
+   * \returns true if the operation succeeded
+   */
+  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
+
+  /**
    * \param interface The interface number of an Ipv4 interface
    * \param metric routing metric (cost) associated to the underlying 
    *          Ipv4 interface
@@ -220,6 +235,20 @@
    */
   virtual void SetDown (uint32_t interface) = 0;
 
+  /**
+   * \param interface Interface number of Ipv4 interface
+   * \returns true if IP forwarding enabled for input datagrams on this device
+   */
+  virtual bool IsForwarding (uint32_t interface) const = 0;
+
+  /**
+   * \param interface Interface number of Ipv4 interface
+   * \param val Value to set the forwarding flag
+   * 
+   * If set to true, IP forwarding is enabled for input datagrams on this device
+   */
+  virtual void SetForwarding (uint32_t interface, bool val) = 0;
+
   static const uint32_t IF_ANY = 0xffffffff;
 
 private:
--- a/src/node/net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -98,9 +98,15 @@
   virtual Ptr<Channel> GetChannel (void) const = 0;
 
   /**
+   * Set the address of this interface
+   */
+  virtual void SetAddress (Address address) = 0;
+
+  /**
    * \return the current Address of this interface.
    */
   virtual Address GetAddress (void) const = 0;
+
   /**
    * \param mtu MTU value, in bytes, to set for the device
    * \return whether the MTU value was within legal bounds
--- a/src/node/node.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/node.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -192,23 +192,12 @@
                i != m_devices.end (); i++)
             {
               Ptr<NetDevice> dev = *i;
-              if (dev->SupportsSendFrom ())
-                {
-                  dev->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
-                }
+              dev->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
             }
         }
       else
         {
-          if (device->SupportsSendFrom ())
-            {
-              device->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
-            }
-          else
-            {
-              NS_LOG_WARN ("Protocol handler request promiscuous mode for a specific netdevice,"
-                           " but netdevice does not support promiscuous mode.");
-            }
+          device->SetPromiscReceiveCallback (MakeCallback (&Node::PromiscReceiveFromDevice, this));
         }
     }
 
--- a/src/node/simple-net-device.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/simple-net-device.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -77,12 +77,6 @@
 }
 
 void 
-SimpleNetDevice::SetAddress (Mac48Address address)
-{
-  m_address = address;
-}
-
-void 
 SimpleNetDevice::SetIfIndex(const uint32_t index)
 {
   m_ifIndex = index;
@@ -97,9 +91,17 @@
 {
   return m_channel;
 }
+void
+SimpleNetDevice::SetAddress (Address address)
+{
+  m_address = Mac48Address::ConvertFrom(address);
+}
 Address 
 SimpleNetDevice::GetAddress (void) const
 {
+  //
+  // Implicit conversion from Mac48Address to Address
+  //
   return m_address;
 }
 bool 
--- a/src/node/simple-net-device.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/simple-net-device.h	Fri Jul 03 09:59:04 2009 +0400
@@ -43,12 +43,12 @@
 
   void Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from);
   void SetChannel (Ptr<SimpleChannel> channel);
-  void SetAddress (Mac48Address address);
 
   // inherited from NetDevice base class.
   virtual void SetIfIndex(const uint32_t index);
   virtual uint32_t GetIfIndex(void) const;
   virtual Ptr<Channel> GetChannel (void) const;
+  virtual void SetAddress (Address address);
   virtual Address GetAddress (void) const;
   virtual bool SetMtu (const uint16_t mtu);
   virtual uint16_t GetMtu (void) const;
--- a/src/node/tcp-socket.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/tcp-socket.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -39,7 +39,7 @@
     .SetParent<Socket> ()
     .AddAttribute ("SndBufSize",
                    "TcpSocket maximum transmit buffer size (bytes)",
-                   UintegerValue (0xffffffffl),
+                   UintegerValue (131072), // 128k
                    MakeUintegerAccessor (&TcpSocket::GetSndBufSize,
                                          &TcpSocket::SetSndBufSize),
                    MakeUintegerChecker<uint32_t> ())
--- a/src/node/udp-socket.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/udp-socket.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -58,13 +58,13 @@
     .AddAttribute ("IpMulticastIf",
                    "interface index for outgoing multicast on this socket; -1 indicates to use default interface",
                    IntegerValue (-1),
-                   MakeUintegerAccessor (&UdpSocket::GetIpMulticastTtl,
-                                         &UdpSocket::SetIpMulticastTtl),
+                   MakeIntegerAccessor (&UdpSocket::GetIpMulticastIf,
+                                         &UdpSocket::SetIpMulticastIf),
                    MakeIntegerChecker<int32_t> ())
     .AddAttribute ("IpMulticastLoop",
                    "whether outgoing multicast sent also to loopback interface",
                    BooleanValue (false),
-                   MakeUintegerAccessor (&UdpSocket::GetIpMulticastLoop,
+                   MakeBooleanAccessor (&UdpSocket::GetIpMulticastLoop,
                                          &UdpSocket::SetIpMulticastLoop),
                    MakeBooleanChecker ())
     .AddAttribute ("MtuDiscover", "If enabled, every outgoing ip packet will have the DF flag set.",
--- a/src/node/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/node/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -20,9 +20,6 @@
         'ethernet-trailer.cc',
         'ipv4-route.cc',
         'ipv4-routing-protocol.cc',
-        'ipv4-list-routing.cc',
-        'ipv4-static-routing.cc',
-        'ipv4-routing-table-entry.cc',
         'queue.cc',
         'drop-tail-queue.cc',
         'channel.cc',
@@ -62,9 +59,6 @@
 	'address-utils.h',
         'ipv4-route.h',
         'ipv4-routing-protocol.h',
-        'ipv4-list-routing.h',
-        'ipv4-static-routing.h',
-        'ipv4-routing-table-entry.h',
         'queue.h',
         'drop-tail-queue.h',
         'llc-snap-header.h',
--- a/src/routing/global-routing/global-route-manager-impl.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-route-manager-impl.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -374,7 +374,12 @@
   for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
     {
       Ptr<Node> node = *i;
-      Ptr<Ipv4GlobalRouting> gr = GetGlobalRoutingProtocol (node->GetId ());
+      Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
+      if (router == 0)
+        {
+          continue;
+        }
+      Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
       uint32_t j = 0;
       uint32_t nRoutes = gr->GetNRoutes ();
       NS_LOG_LOGIC ("Deleting " << gr->GetNRoutes ()<< " routes from node " << node->GetId ());
@@ -397,80 +402,6 @@
 }
 
 //
-// In order to build the routing database, we need at least one of the nodes
-// to participate as a router.  This is a convenience function that makes
-// all nodes routers.  We do this by walking the list of nodes in the system
-// and aggregating a Global Router Interface to each of the nodes.
-//
-  void
-GlobalRouteManagerImpl::SelectRouterNodes () 
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); i++)
-    {
-      Ptr<Node> node = *i;
-      NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << node->GetId ());
-
-      Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> ();
-      node->AggregateObject (globalRouter);
-
-      NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
-      Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
-      globalRouting->SetNode (node);
-      // Here, we check whether there is an existing Ipv4RoutingProtocol object
-      // to add this protocol to.
-      Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
-      NS_ASSERT_MSG (ipv4, "GlobalRouteManagerImpl::SelectRouterNodes (): GetObject for <Ipv4> interface failed");
-      // Now, we add this to an Ipv4ListRouting object.  
-      // XXX in the future, we may want to allow this to be added to Ipv4
-      // directly
-      Ptr<Ipv4ListRouting> ipv4ListRouting = DynamicCast<Ipv4ListRouting> (ipv4->GetRoutingProtocol ());
-      NS_ASSERT_MSG (ipv4ListRouting, "GlobalRouteManagerImpl::SelectRouterNodes (): Ipv4ListRouting not found"); 
-      // This is the object that will keep the global routes.  We insert it
-      // at slightly higher priority than static routing (which is at zero).
-      // This means that global routes (e.g. host routes) will be consulted
-      // before static routes
-      // XXX make the below  priority value an attribute
-      ipv4ListRouting->AddRoutingProtocol (globalRouting, 3);  
-      // Locally cache the globalRouting pointer; we'll need it later
-      // when we add routes
-      AddGlobalRoutingProtocol (node->GetId (), globalRouting);
-    }
-}
-
-  void
-GlobalRouteManagerImpl::SelectRouterNodes (NodeContainer c) 
-{
-  NS_LOG_FUNCTION (&c);
-  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
-    {
-      Ptr<Node> node = *i;
-      NS_LOG_LOGIC ("Adding GlobalRouter interface to node " << 
-        node->GetId ());
-
-      Ptr<GlobalRouter> globalRouter = CreateObject<GlobalRouter> ();
-      node->AggregateObject (globalRouter);
-
-      NS_LOG_LOGIC ("Adding GlobalRouting Protocol to node " << node->GetId ());
-      Ptr<Ipv4GlobalRouting> globalRouting = CreateObject<Ipv4GlobalRouting> ();
-      // This is the object that will keep the global routes.  We insert it
-      // at slightly higher priority than static routing (which is at zero).
-      // This means that global routes (e.g. host routes) will be consulted
-      // before static routes
-      Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
-      NS_ASSERT_MSG (ipv4, "GlobalRouteManagerImpl::SelectRouterNodes (): "
-        "GetObject for <Ipv4> interface failed");
-      Ptr<Ipv4ListRouting> ipv4ListRouting = DynamicCast<Ipv4ListRouting> (ipv4->GetRoutingProtocol ());
-      NS_ASSERT_MSG (ipv4ListRouting, "GlobalRouteManagerImpl::SelectRouterNodes (): Ipv4ListRouting not found"); 
-      // XXX make the below  priority value an attribute
-      ipv4ListRouting->AddRoutingProtocol (globalRouting, 3);  
-      // Locally cache the globalRouting pointer; we'll need it later
-      // when we add routes
-      AddGlobalRoutingProtocol (node->GetId (), globalRouting);
-    }
-}
-
-//
 // In order to build the routing database, we need to walk the list of nodes
 // in the system and look for those that support the GlobalRouter interface.
 // These routers will export a number of Link State Advertisements (LSAs)
@@ -1069,6 +1000,93 @@
   SPFCalculate (root);
 }
 
+//
+// Used to test if a node is a stub, from an OSPF sense.
+// If there is only one link of type 1 or 2, then a default route
+// can safely be added to the next-hop router and SPF does not need
+// to be run
+//
+bool
+GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root)
+{
+  NS_LOG_FUNCTION (root);
+  GlobalRoutingLSA *rlsa = m_lsdb->GetLSA (root);
+  Ipv4Address myRouterId = rlsa->GetLinkStateId ();
+  int transits = 0;
+  GlobalRoutingLinkRecord *transitLink = 0;
+  for (uint32_t i = 0; i < rlsa->GetNLinkRecords (); i++)
+    {
+      GlobalRoutingLinkRecord *l = rlsa->GetLinkRecord (i);
+      if (l->GetLinkType () == GlobalRoutingLinkRecord::TransitNetwork)
+        {
+          transits++;
+          transitLink = l;
+        }
+      else if (l->GetLinkType () == GlobalRoutingLinkRecord::PointToPoint)
+        {
+          transits++;
+          transitLink = l;
+        }
+    }
+  if (transits == 0)
+    {
+      // This router is not connected to any router.  Probably, global
+      // routing should not be called for this node, but we can just raise
+      // a warning here and return true.
+      NS_LOG_WARN ("all nodes should have at least one transit link:" << root );
+      return true;
+    }
+  if (transits == 1)
+    {
+      if (transitLink->GetLinkType () == GlobalRoutingLinkRecord::TransitNetwork)
+        {
+          // Install default route to next hop router
+          // What is the next hop?  We need to check all neighbors on the link.
+          // If there is a single router that has two transit links, then
+          // that is the default next hop.  If there are more than one
+          // routers on link with multiple transit links, return false.
+          // Not yet implemented, so simply return false
+          NS_LOG_LOGIC ("TBD: Would have inserted default for transit");
+          return false;
+        }
+      else if (transitLink->GetLinkType () == GlobalRoutingLinkRecord::PointToPoint)
+        {
+          // Install default route to next hop
+          // The link record LinkID is the router ID of the peer.
+          // The Link Data is the local IP interface address
+          GlobalRoutingLSA *w_lsa = m_lsdb->GetLSA (transitLink->GetLinkId ());
+          uint32_t nLinkRecords = w_lsa->GetNLinkRecords ();
+          for (uint32_t j = 0; j < nLinkRecords; ++j)
+            {
+              //
+              // We are only concerned about point-to-point links
+              //
+              GlobalRoutingLinkRecord *lr = w_lsa->GetLinkRecord (j);
+              if (lr->GetLinkType () != GlobalRoutingLinkRecord::PointToPoint)
+                {
+                  continue;
+                }
+              // Find the link record that corresponds to our routerId
+              if (lr->GetLinkId () == myRouterId)
+                {
+                  // Next hop is stored in the LinkID field of lr
+                  Ptr<GlobalRouter> router = rlsa->GetNode ()->GetObject<GlobalRouter> ();
+                  NS_ASSERT (router);
+                  Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
+                  NS_ASSERT (gr);
+                  gr->AddNetworkRouteTo (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), lr->GetLinkData (), 
+                                         FindOutgoingInterfaceId (transitLink->GetLinkData ()));
+                  NS_LOG_LOGIC ("Inserting default route for node " << myRouterId << " to next hop " << 
+                                lr->GetLinkData () << " via interface " << 
+                                FindOutgoingInterfaceId(transitLink->GetLinkData()));
+                  return true;
+                }
+            }
+        }
+    }
+  return false;
+}
+
 // quagga ospf_spf_calculate
   void
 GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
@@ -1102,6 +1120,20 @@
   v->GetLSA ()->SetStatus (GlobalRoutingLSA::LSA_SPF_IN_SPFTREE);
   NS_LOG_LOGIC ("Starting SPFCalculate for node " << root);
 
+//
+// Optimize SPF calculation, for ns-3.
+// We do not need to calculate SPF for every node in the network if this
+// node has only one interface through which another router can be 
+// reached.  Instead, short-circuit this computation and just install
+// a default route in the CheckForStubNode() method.
+//
+  if (NodeList::GetNNodes () > 0 && CheckForStubNode (root))
+    {
+      NS_LOG_LOGIC ("SPFCalculate truncated for stub node " << root);
+      delete m_spfroot;
+      return;
+    }
+
   for (;;)
     {
 //
@@ -1353,7 +1385,13 @@
 // Similarly, the vertex <v> has an m_rootOif (outbound interface index) to
 // which the packets should be send for forwarding.
 //
-          Ptr<Ipv4GlobalRouting> gr = GetGlobalRoutingProtocol (node->GetId ());
+          
+          Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
+          if (router == 0)
+            {
+              continue;
+            }
+          Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
           NS_ASSERT (gr);
           if (v->GetOutgoingInterfaceId () >= 0)
             {
@@ -1577,7 +1615,12 @@
 // Similarly, the vertex <v> has an m_rootOif (outbound interface index) to
 // which the packets should be send for forwarding.
 //
-              Ptr<Ipv4GlobalRouting> gr = GetGlobalRoutingProtocol (node->GetId ());
+              Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
+              if (router == 0)
+                {
+                  continue;
+                }
+              Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
               NS_ASSERT (gr);
               if (v->GetOutgoingInterfaceId () >= 0)
                 {
@@ -1675,7 +1718,12 @@
           Ipv4Mask tempmask = lsa->GetNetworkLSANetworkMask ();
           Ipv4Address tempip = lsa->GetLinkStateId ();
           tempip = tempip.CombineMask (tempmask);
-          Ptr<Ipv4GlobalRouting> gr = GetGlobalRoutingProtocol (node->GetId ());
+          Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
+          if (router == 0)
+            {
+              continue;
+            }
+          Ptr<Ipv4GlobalRouting> gr = router->GetRoutingProtocol ();
           NS_ASSERT (gr);
           if (v->GetOutgoingInterfaceId () >= 0)
             {
@@ -1715,29 +1763,6 @@
   v->GetParent ()->AddChild (v);
 }
 
-  void 
-GlobalRouteManagerImpl::AddGlobalRoutingProtocol (uint32_t nodeId, Ptr<Ipv4GlobalRouting> proto)
-{
-  NS_LOG_FUNCTION (nodeId);
-  m_routingProtocols.push_back
-    (std::pair<uint32_t, Ptr<Ipv4GlobalRouting> > (nodeId, proto));
-  m_routingProtocols.sort ();
-}
-
-  Ptr<Ipv4GlobalRouting>
-GlobalRouteManagerImpl::GetGlobalRoutingProtocol (uint32_t nodeId)
-{
-  for (Ipv4GlobalRoutingList::const_iterator rprotoIter = m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end (); rprotoIter++)
-    {
-      if ((*rprotoIter).first == nodeId)
-        {
-          return (*rprotoIter).second;
-        }
-    }
-  return 0;
-}
-
-
 } // namespace ns3
 
 #ifdef RUN_SELF_TESTS
--- a/src/routing/global-routing/global-route-manager-impl.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-route-manager-impl.h	Fri Jul 03 09:59:04 2009 +0400
@@ -29,7 +29,6 @@
 #include "ns3/object.h"
 #include "ns3/ptr.h"
 #include "ns3/ipv4-address.h"
-#include "ns3/node-container.h"
 #include "global-router-interface.h"
 
 namespace ns3 {
@@ -729,21 +728,6 @@
  *
  */
   virtual void DeleteGlobalRoutes ();
-/**
- * @brief Select which nodes in the system are to be router nodes and 
- * aggregate the appropriate interfaces onto those nodes.
- * @internal
- *
- */
-  virtual void SelectRouterNodes ();
-
-/**
- * @brief Select which nodes in the system are to be router nodes and 
- * aggregate the appropriate interfaces onto those nodes.
- * @internal
- *
- */
-  virtual void SelectRouterNodes (NodeContainer c);
 
 /**
  * @brief Build the routing database by gathering Link State Advertisements
@@ -788,6 +772,7 @@
 
   SPFVertex* m_spfroot;
   GlobalRouteManagerLSDB* m_lsdb;
+  bool CheckForStubNode (Ipv4Address root);
   void SPFCalculate (Ipv4Address root);
   void SPFProcessStubs (SPFVertex* v);
   void SPFNext (SPFVertex*, CandidateQueue&);
@@ -801,12 +786,6 @@
   void SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex* v);
   int32_t FindOutgoingInterfaceId (Ipv4Address a, 
     Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
-
-  // Local cache of the Ipv4GlobalRouting objects, indexed by nodeId
-  typedef std::list< std::pair< uint32_t, Ptr<Ipv4GlobalRouting> > > Ipv4GlobalRoutingList;
-  void AddGlobalRoutingProtocol (uint32_t nodeId, Ptr<Ipv4GlobalRouting> proto);
-  Ptr<Ipv4GlobalRouting> GetGlobalRoutingProtocol (uint32_t nodeId);
-  Ipv4GlobalRoutingList m_routingProtocols;
 };
 
 } // namespace ns3
--- a/src/routing/global-routing/global-route-manager.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-route-manager.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -21,7 +21,6 @@
 #include "ns3/assert.h"
 #include "ns3/log.h"
 #include "ns3/simulation-singleton.h"
-#include "ns3/node-container.h"
 #include "global-route-manager.h"
 #include "global-route-manager-impl.h"
 
@@ -36,15 +35,6 @@
   void
 GlobalRouteManager::PopulateRoutingTables (void) 
 {
-  SelectRouterNodes ();
-  BuildGlobalRoutingDatabase ();
-  InitializeRoutes ();
-}
-
-  void
-GlobalRouteManager::PopulateRoutingTables (NodeContainer c) 
-{
-  SelectRouterNodes (c);
   BuildGlobalRoutingDatabase ();
   InitializeRoutes ();
 }
@@ -65,20 +55,6 @@
 }
 
   void
-GlobalRouteManager::SelectRouterNodes (void) 
-{
-  SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
-    SelectRouterNodes ();
-}
-
-  void
-GlobalRouteManager::SelectRouterNodes (NodeContainer c) 
-{
-  SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
-    SelectRouterNodes (c);
-}
-
-  void
 GlobalRouteManager::BuildGlobalRoutingDatabase (void) 
 {
   SimulationSingleton<GlobalRouteManagerImpl>::Get ()->
--- a/src/routing/global-routing/global-route-manager.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-route-manager.h	Fri Jul 03 09:59:04 2009 +0400
@@ -22,7 +22,7 @@
 #ifndef GLOBAL_ROUTE_MANAGER_H
 #define GLOBAL_ROUTE_MANAGER_H
 
-#include "ns3/node-container.h"
+#include "ns3/deprecated.h"
 
 namespace ns3 {
 
@@ -45,30 +45,13 @@
  * the nodes in the simulation.  Makes all nodes in the simulation into
  * routers.
  *
- * All this function does is call the three functions
- * SelectRouterNodes (), BuildGlobalRoutingDatabase (), and
- * InitializeRoutes ().
+ * All this function does is call the functions
+ * BuildGlobalRoutingDatabase () and  InitializeRoutes ().
  *
- * @see SelectRouterNodes ();
  * @see BuildGlobalRoutingDatabase ();
  * @see InitializeRoutes ();
  */
-  static void PopulateRoutingTables ();
-
-/**
- * @brief Build a routing database and initialize the routing tables of
- * the nodes in the simulation.  Makes the nodes in the provided container
- * into routers.
- *
- * All this function does is call the three functions
- * SelectRouterNodes (), BuildGlobalRoutingDatabase (), and
- * InitializeRoutes ().
- *
- * @see SelectRouterNodes (Node Container c);
- * @see BuildGlobalRoutingDatabase ();
- * @see InitializeRoutes ();
- */
-  static void PopulateRoutingTables (NodeContainer c);
+  static void PopulateRoutingTables () NS_DEPRECATED;
 
  /**
   *@brief Remove all routes that were previously installed in a prior call
@@ -85,7 +68,13 @@
  * @see BuildGlobalRoutingDatabase ();
  * @see InitializeRoutes ();
  */
- static void RecomputeRoutingTables ();
+ static void RecomputeRoutingTables () NS_DEPRECATED;
+
+public:
+/**
+ * @brief Allocate a 32-bit router ID from monotonically increasing counter.
+ */
+  static uint32_t AllocateRouterId ();
 
 /**
  * @brief Delete all static routes on all nodes that have a 
@@ -95,29 +84,6 @@
   static void DeleteGlobalRoutes ();
 
 /**
- * @brief Select which nodes in the system are to be router nodes and 
- * aggregate the appropriate interfaces onto those nodes.
- * @internal
- *
- */
-  static void SelectRouterNodes ();
-
-/**
- * @brief Select which nodes in the system are to be router nodes and 
- * aggregate the appropriate interfaces onto those nodes.
- * @internal
- *
- */
-  static void SelectRouterNodes (NodeContainer c);
-
-/**
- * @brief Allocate a 32-bit router ID from monotonically increasing counter.
- */
-  static uint32_t AllocateRouterId ();
-
-private:
-
-/**
  * @brief Build the routing database by gathering Link State Advertisements
  * from each node exporting a GlobalRouter interface.
  * @internal
@@ -132,6 +98,7 @@
  */
   static void InitializeRoutes ();
 
+private:
 /**
  * @brief Global Route Manager copy construction is disallowed.  There's no 
  * need for it and a compiler provided shallow copy would be wrong.
--- a/src/routing/global-routing/global-router-interface.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-router-interface.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -24,9 +24,10 @@
 #include "ns3/channel.h"
 #include "ns3/net-device.h"
 #include "ns3/node.h"
+#include "ns3/node-list.h"
 #include "ns3/ipv4.h"
 #include "ns3/bridge-net-device.h"
-#include "ns3/net-device-container.h"
+#include "ipv4-global-routing.h"
 #include "global-router-interface.h"
 #include <vector>
 
@@ -140,7 +141,8 @@
   m_linkRecords(),
   m_networkLSANetworkMask("0.0.0.0"),
   m_attachedRouters(),
-  m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED)
+  m_status(GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED),
+  m_node_id(0)
 {
   NS_LOG_FUNCTION_NOARGS ();
 }
@@ -156,7 +158,8 @@
   m_linkRecords(),
   m_networkLSANetworkMask("0.0.0.0"),
   m_attachedRouters(),
-  m_status(status)
+  m_status(status),
+  m_node_id(0)
 {
   NS_LOG_FUNCTION (this << status << linkStateId << advertisingRtr);
 }
@@ -165,7 +168,8 @@
   : m_lsType(lsa.m_lsType), m_linkStateId(lsa.m_linkStateId), 
     m_advertisingRtr(lsa.m_advertisingRtr), 
     m_networkLSANetworkMask(lsa.m_networkLSANetworkMask), 
-    m_status(lsa.m_status)
+    m_status(lsa.m_status),
+    m_node_id(lsa.m_node_id)
 {
   NS_LOG_FUNCTION_NOARGS ();
   NS_ASSERT_MSG(IsEmpty(), 
@@ -182,6 +186,7 @@
   m_advertisingRtr = lsa.m_advertisingRtr;
   m_networkLSANetworkMask = lsa.m_networkLSANetworkMask, 
   m_status = lsa.m_status;
+  m_node_id = lsa.m_node_id;
 
   ClearLinkRecords ();
   CopyLinkRecords (lsa);
@@ -380,6 +385,20 @@
   m_status = status;
 }
 
+  Ptr<Node>
+GlobalRoutingLSA::GetNode (void) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  return NodeList::GetNode (m_node_id);
+}
+
+  void
+GlobalRoutingLSA::SetNode (Ptr<Node> node)
+{
+  NS_LOG_FUNCTION (node);
+  m_node_id = node->GetId ();
+}
+
   void 
 GlobalRoutingLSA::Print (std::ostream &os) const
 {
@@ -497,10 +516,22 @@
   ClearLSAs();
 }
 
+void 
+GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing)
+{
+  m_routingProtocol = routing;
+}
+Ptr<Ipv4GlobalRouting> 
+GlobalRouter::GetRoutingProtocol (void)
+{
+  return m_routingProtocol;
+}
+
 void
 GlobalRouter::DoDispose ()
 {
   NS_LOG_FUNCTION_NOARGS ();
+  m_routingProtocol = 0;
   Object::DoDispose ();
 }
 
@@ -570,6 +601,7 @@
   pLSA->SetLinkStateId (m_routerId);
   pLSA->SetAdvertisingRouter (m_routerId);
   pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED);
+  pLSA->SetNode (node);
 
   //
   // Ask the node for the number of net devices attached. This isn't necessarily 
@@ -605,19 +637,20 @@
       // associated with a bridge.  We are only going to involve devices with 
       // IP addresses in routing.
       //
-      bool isIp = false;
+      bool isForwarding = false;
       for (uint32_t j = 0; j < ipv4Local->GetNInterfaces (); ++j )
         {
-          if (ipv4Local->GetNetDevice (j) == ndLocal && ipv4Local->IsUp (j)) 
+          if (ipv4Local->GetNetDevice (j) == ndLocal && ipv4Local->IsUp (j) &&
+              ipv4Local->IsForwarding (j)) 
             {
-              isIp = true;
+              isForwarding = true;
               break;
             }
         }
 
-      if (!isIp)
+      if (!isForwarding)
         {
-          NS_LOG_LOGIC ("Net device " << ndLocal << "has no IP interface, skipping");
+          NS_LOG_LOGIC ("Net device " << ndLocal << "has no IP interface or is not enabled for forwarding, skipping");
           continue;
         }
 
@@ -628,8 +661,9 @@
       // the segment.  We add the appropriate link record to the LSA.
       //
       // If the device is a point to point link, we treat it separately.  In
-      // that case, there may be one or two link records added.
+      // that case, there may be zero, one, or two link records added.
       //
+
       if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () )
         {
           NS_LOG_LOGIC ("Broadcast link");
@@ -1009,9 +1043,11 @@
   // interface aggregated.
   //
   Ptr<GlobalRouter> rtrRemote = nodeRemote->GetObject<GlobalRouter> ();
-  NS_ABORT_MSG_UNLESS(rtrRemote, 
-                      "GlobalRouter::ProcessPointToPointLinks(): GetObject for remote <GlobalRouter> failed");
-
+  if (rtrRemote == 0)
+    {
+      // This case is possible if the remote does not participate in global routing
+      return;
+    }
   //
   // We're going to need the remote router ID, so we might as well get it now.
   //
@@ -1107,6 +1143,7 @@
       pLSA->SetAdvertisingRouter (m_routerId);
       pLSA->SetNetworkLSANetworkMask (maskLocal);
       pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED);
+      pLSA->SetNode (node);
 
       //
       // Build a list of AttachedRouters by walking the devices in the channel
--- a/src/routing/global-routing/global-router-interface.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/global-router-interface.h	Fri Jul 03 09:59:04 2009 +0400
@@ -36,6 +36,7 @@
 namespace ns3 {
 
 class GlobalRouter;
+class Ipv4GlobalRouting;
 
 /**
  * @brief A single link record for a link state advertisement.
@@ -476,6 +477,18 @@
  */
   void SetStatus (SPFStatus status);
 
+/**
+ * @brief Get the Node pointer of the node that originated this LSA
+ * @returns Node pointer
+ */
+  Ptr<Node> GetNode (void) const;
+
+/**
+ * @brief Set the Node pointer of the node that originated this LSA
+ * @param node Node pointer
+ */
+  void SetNode (Ptr<Node> node);
+
 private:
 /**
  * The type of the LSA.  Each LSA type has a separate advertisement
@@ -544,6 +557,7 @@
  * proper position in the tree.
  */
   SPFStatus m_status;
+  uint32_t m_node_id;
 };
 
 std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa);
@@ -572,6 +586,10 @@
  */
   GlobalRouter ();
 
+
+  void SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing);
+  Ptr<Ipv4GlobalRouting> GetRoutingProtocol (void);
+
 /**
  * @brief Get the Router ID associated with this Global Router.
  *
@@ -660,6 +678,7 @@
   ListOfLSAs_t m_LSAs;
 
   Ipv4Address m_routerId;
+  Ptr<Ipv4GlobalRouting> m_routingProtocol;
 
   // inherited from Object
   virtual void DoDispose (void);
--- a/src/routing/global-routing/ipv4-global-routing.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/ipv4-global-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -19,7 +19,7 @@
 #include "ns3/log.h"
 #include "ns3/object.h"
 #include "ns3/packet.h"
-#include "ns3/node.h"
+#include "ns3/net-device.h"
 #include "ns3/ipv4-route.h"
 #include "ns3/ipv4-routing-table-entry.h"
 #include "ipv4-global-routing.h"
@@ -125,7 +125,7 @@
            j != m_networkRoutes.end (); 
            j++) 
         {
-          NS_ASSERT ((*j)->IsNetwork ());
+          NS_ASSERT ((*j)->IsNetwork () || (*j)->IsDefault ());
           Ipv4Mask mask = (*j)->GetDestNetworkMask ();
           Ipv4Address entry = (*j)->GetDestNetwork ();
           if (mask.IsMatch (dest, entry)) 
@@ -139,14 +139,13 @@
     }
   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->SetSource (m_ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
       rtentry->SetGateway (route->GetGateway ());
       uint32_t interfaceIdx = route->GetInterface ();
-      rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
+      rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
       return rtentry;
     }
   else 
@@ -260,7 +259,7 @@
 }
 
 Ptr<Ipv4Route>
-Ipv4GlobalRouting::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
+Ipv4GlobalRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
 {      
 
 //
@@ -318,21 +317,25 @@
                     // route request.
     }
 }
-
-void
-Ipv4GlobalRouting::SetNode (Ptr<Node> node)
+void 
+Ipv4GlobalRouting::NotifyInterfaceUp (uint32_t i)
+{}
+void 
+Ipv4GlobalRouting::NotifyInterfaceDown (uint32_t i)
+{}
+void 
+Ipv4GlobalRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{}
+void 
+Ipv4GlobalRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{}
+void 
+Ipv4GlobalRouting::SetIpv4 (Ptr<Ipv4> ipv4)
 {
-  NS_LOG_FUNCTION_NOARGS ();
-  m_node = node;
-}
-
-Ptr<Node>
-Ipv4GlobalRouting::GetNode (void) const
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  return m_node;
+  NS_LOG_FUNCTION(this << ipv4);
+  NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
+  m_ipv4 = ipv4;
 }
 
 
-
 }//namespace ns3
--- a/src/routing/global-routing/ipv4-global-routing.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/ipv4-global-routing.h	Fri Jul 03 09:59:04 2009 +0400
@@ -80,11 +80,16 @@
   Ipv4GlobalRouting ();
   virtual ~Ipv4GlobalRouting ();
 
-  virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
+  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, 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);
+  virtual void NotifyInterfaceUp (uint32_t interface);
+  virtual void NotifyInterfaceDown (uint32_t interface);
+  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
 
 /**
  * \brief Add a host route to the global routing table.
@@ -189,9 +194,6 @@
  */
   void RemoveRoute (uint32_t i);
 
-  void SetNode (Ptr<Node> node);
-  Ptr<Node> GetNode (void) const;
-
 protected:
   void DoDispose (void);
 
@@ -208,7 +210,7 @@
   HostRoutes m_hostRoutes;
   NetworkRoutes m_networkRoutes;
 
-  Ptr<Node> m_node;
+  Ptr<Ipv4> m_ipv4;
 };
 
 } // Namespace ns3
--- a/src/routing/global-routing/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/global-routing/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -14,5 +14,6 @@
     headers.source = [
         'global-router-interface.h',
         'global-route-manager.h',
+        'ipv4-global-routing.h',
         ]
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/list-routing/ipv4-list-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,399 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 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/ipv4.h"
+#include "ns3/ipv4-route.h"
+#include "ns3/node.h"
+#include "ns3/ipv4-static-routing.h"
+#include "ipv4-list-routing.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4ListRouting");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (Ipv4ListRouting);
+
+TypeId
+Ipv4ListRouting::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::Ipv4ListRouting")
+    .SetParent<Ipv4RoutingProtocol> ()
+    .AddConstructor<Ipv4ListRouting> ()
+    ;
+  return tid;
+}
+
+
+Ipv4ListRouting::Ipv4ListRouting () 
+ : m_ipv4 (0)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+Ipv4ListRouting::~Ipv4ListRouting () 
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+void
+Ipv4ListRouting::DoDispose (void)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end (); rprotoIter++)
+    {
+      // Note:  Calling dispose on these protocols causes memory leak
+      //        The routing protocols should not maintain a pointer to
+      //        this object, so Dispose() shouldn't be necessary.
+      (*rprotoIter).second = 0;
+    }
+  m_routingProtocols.clear ();
+  m_ipv4 = 0;
+}
+
+Ptr<Ipv4Route>
+Ipv4ListRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, enum Socket::SocketErrno &sockerr)
+{
+  NS_LOG_FUNCTION (this << header.GetDestination () << " " << header.GetSource () << " " << oif);
+  Ptr<Ipv4Route> route;
+
+  for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
+       i != m_routingProtocols.end (); i++)
+    {
+      NS_LOG_LOGIC ("Checking protocol " << (*i).second->GetInstanceTypeId () << " with priority " << (*i).first);
+      NS_LOG_LOGIC ("Requesting source address for destination " << header.GetDestination ());
+      route = (*i).second->RouteOutput (p, header, oif, sockerr);
+      if (route)
+        {
+          NS_LOG_LOGIC ("Found route " << route);
+          sockerr = Socket::ERROR_NOTERROR;
+          return route;
+        }
+    }
+  NS_LOG_LOGIC ("Done checking " << GetTypeId ());
+  NS_LOG_LOGIC ("");
+  sockerr = Socket::ERROR_NOROUTETOHOST;
+  return 0;
+}
+
+// Patterned after Linux ip_route_input and ip_route_input_slow
+bool 
+Ipv4ListRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, 
+                             UnicastForwardCallback ucb, MulticastForwardCallback mcb, 
+                             LocalDeliverCallback lcb, ErrorCallback ecb)
+{
+  bool retVal = false;
+  NS_LOG_FUNCTION (p << header << idev);
+  NS_LOG_LOGIC ("RouteInput logic for node: " << m_ipv4->GetObject<Node> ()->GetId ());
+
+  NS_ASSERT (m_ipv4 != 0);
+  // Check if input device supports IP 
+  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
+  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev); 
+
+  // Multicast recognition; handle local delivery here
+  //
+  if (header.GetDestination().IsMulticast ())
+    {
+#ifdef NOTYET
+      if (m_ipv4->MulticastCheckGroup (iif, header.GetDestination ()))
+#endif
+      if (true)
+        {
+          NS_LOG_LOGIC ("Multicast packet for me-- local deliver");
+          Ptr<Packet> packetCopy = p->Copy();
+          // Here may want to disable lcb callback in recursive RouteInput
+          // call below
+          lcb (packetCopy, header, iif);
+          // Fall through-- we may also need to forward this
+          retVal = true;
+        }
+      for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin (); rprotoIter != m_routingProtocols.end ();
+           rprotoIter++)
+        {
+          NS_LOG_LOGIC ("Multicast packet for me-- trying to forward");
+          if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
+            {
+              retVal = true;
+            }
+        }
+      return retVal;
+    }
+
+  if (header.GetDestination ().IsBroadcast ())
+    {
+      NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
+      // TODO:  Local Deliver for broadcast
+      // TODO:  Forward broadcast
+    }
+
+ // TODO:  Configurable option to enable RFC 1222 Strong End System Model
+ // Right now, we will be permissive and allow a source to send us
+ // a packet to one of our other interface addresses; that is, the
+ // destination unicast address does not match one of the iif addresses,
+ // but we check our other interfaces.  This could be an option
+ // (to remove the outer loop immediately below and just check iif).
+  for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
+    {
+      for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
+        {
+          Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
+          Ipv4Address addr = iaddr.GetLocal ();
+          if (addr.IsEqual (header.GetDestination ()))
+            {
+              if (j == iif)
+                {
+                  NS_LOG_LOGIC ("For me (destination " << addr << " match)");
+                }
+              else
+                {
+                  NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
+                }
+              lcb (p, header, iif);
+              return true;
+            }
+          if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
+            {
+              NS_LOG_LOGIC ("For me (interface broadcast address)");
+              lcb (p, header, iif);
+              return true;
+            }
+          NS_LOG_LOGIC ("Address "<< addr << " not a match");
+        }
+    }
+  // Check if input device supports IP forwarding
+  if (m_ipv4->IsForwarding (iif) == false)
+    {
+      NS_LOG_LOGIC ("Forwarding disabled for this interface");
+      ecb (p, header, Socket::ERROR_NOROUTETOHOST);
+      return false;
+    }
+  // Next, try to find a route
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      if ((*rprotoIter).second->RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
+        {
+          return true;
+        }
+    }
+  // No routing protocol has found a route.  
+  return retVal;
+}
+
+void 
+Ipv4ListRouting::NotifyInterfaceUp (uint32_t interface)
+{
+  NS_LOG_FUNCTION (this << interface);
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      (*rprotoIter).second->NotifyInterfaceUp (interface);
+    }  
+}
+void 
+Ipv4ListRouting::NotifyInterfaceDown (uint32_t interface)
+{
+  NS_LOG_FUNCTION (this << interface);
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      (*rprotoIter).second->NotifyInterfaceDown (interface);
+    }  
+}
+void 
+Ipv4ListRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{
+  NS_LOG_FUNCTION(this << interface << address);
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      (*rprotoIter).second->NotifyAddAddress (interface, address);
+    }  
+}
+void 
+Ipv4ListRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{
+  NS_LOG_FUNCTION(this << interface << address);
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      (*rprotoIter).second->NotifyRemoveAddress (interface, address);
+    }  
+}
+void 
+Ipv4ListRouting::SetIpv4 (Ptr<Ipv4> ipv4)
+{
+  NS_LOG_FUNCTION(this << ipv4);
+  NS_ASSERT (m_ipv4 == 0);
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
+         m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end ();
+       rprotoIter++)
+    {
+      (*rprotoIter).second->SetIpv4 (ipv4);
+    }  
+  m_ipv4 = ipv4;
+}
+
+void
+Ipv4ListRouting::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority)
+{
+  NS_LOG_FUNCTION (this << routingProtocol->GetInstanceTypeId () << priority);
+  m_routingProtocols.push_back (std::make_pair (priority, routingProtocol));
+  m_routingProtocols.sort ( Compare );
+  if (m_ipv4 != 0)
+    {
+      routingProtocol->SetIpv4 (m_ipv4);
+    }
+}
+
+uint32_t 
+Ipv4ListRouting::GetNRoutingProtocols (void) const
+{
+  NS_LOG_FUNCTION (this);
+  return m_routingProtocols.size (); 
+}
+
+Ptr<Ipv4RoutingProtocol> 
+Ipv4ListRouting::GetRoutingProtocol (uint32_t index, int16_t& priority) const
+{
+  NS_LOG_FUNCTION (index);
+  if (index > m_routingProtocols.size ())
+    {
+      NS_FATAL_ERROR ("Ipv4ListRouting::GetRoutingProtocol():  index " << index << " out of range");
+    }
+  uint32_t i = 0;
+  for (Ipv4RoutingProtocolList::const_iterator rprotoIter = m_routingProtocols.begin ();
+       rprotoIter != m_routingProtocols.end (); rprotoIter++, i++)
+    {
+      if (i == index)
+        {
+          priority = (*rprotoIter).first;
+          return (*rprotoIter).second;
+        }
+    }
+  return 0;
+}
+
+bool 
+Ipv4ListRouting::Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b)
+{
+  return a.first > b.first;
+}
+
+
+} // namespace ns3
+
+#ifdef RUN_SELF_TESTS
+
+#include "ns3/test.h"
+#include "ipv4-list-routing.h"
+#include "ns3/ipv4-routing-protocol.h"
+
+namespace ns3 {
+
+class Ipv4ARouting : public Ipv4RoutingProtocol {
+public:
+  Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)  { return 0;}
+  bool RouteInput  (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
+                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+                             LocalDeliverCallback lcb, ErrorCallback ecb) {return false;}
+  void NotifyInterfaceUp (uint32_t interface) {}
+  void NotifyInterfaceDown (uint32_t interface) {}
+  void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
+  void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
+  void SetIpv4 (Ptr<Ipv4> ipv4) {}
+};
+
+class Ipv4BRouting : public Ipv4RoutingProtocol {
+public:
+  Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)  { return 0;}
+  bool RouteInput  (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
+                             UnicastForwardCallback ucb, MulticastForwardCallback mcb,
+                             LocalDeliverCallback lcb, ErrorCallback ecb) {return false;}
+  void NotifyInterfaceUp (uint32_t interface) {}
+  void NotifyInterfaceDown (uint32_t interface) {}
+  void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
+  void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) {}
+  void SetIpv4 (Ptr<Ipv4> ipv4) {}
+};
+
+class Ipv4ListRoutingTest: public Test {
+public:
+  virtual bool RunTests (void);
+  Ipv4ListRoutingTest ();
+};
+
+Ipv4ListRoutingTest::Ipv4ListRoutingTest ()
+  : Test ("Ipv4ListRouting") {}
+
+bool
+Ipv4ListRoutingTest::RunTests (void)
+{
+  bool result = true;
+  Ptr<Ipv4ListRouting> lr = CreateObject<Ipv4ListRouting> ();
+  Ptr<Ipv4RoutingProtocol> aRouting = CreateObject<Ipv4ARouting> ();
+  Ptr<Ipv4RoutingProtocol> bRouting = CreateObject<Ipv4BRouting> ();
+  // The Ipv4ARouting should be added with higher priority (larger integer 
+  // value) and will be fetched first below
+  lr->AddRoutingProtocol (aRouting, 10);
+  lr->AddRoutingProtocol (bRouting, 5);
+  int16_t first = 3;
+  int16_t second = 3;
+  uint32_t num = lr->GetNRoutingProtocols ();
+  NS_TEST_ASSERT_EQUAL (num, 2);
+  Ptr<Ipv4RoutingProtocol> firstRp = lr->GetRoutingProtocol (0, first);
+  NS_TEST_ASSERT_EQUAL (10, first);
+  NS_TEST_ASSERT_EQUAL (firstRp, aRouting);
+  Ptr<Ipv4RoutingProtocol> secondRp = lr->GetRoutingProtocol (1, second);
+  NS_TEST_ASSERT_EQUAL (5, second);
+  NS_TEST_ASSERT_EQUAL (secondRp, bRouting);
+
+  // Test negative values
+  lr = CreateObject<Ipv4ListRouting> ();
+  // The Ipv4BRouting should be added with higher priority (larger integer value)
+  lr->AddRoutingProtocol (aRouting, -10);
+  lr->AddRoutingProtocol (bRouting, -5);
+  num = lr->GetNRoutingProtocols ();
+  NS_TEST_ASSERT_EQUAL (num, 2);
+  firstRp = lr->GetRoutingProtocol (0, first);
+  NS_TEST_ASSERT_EQUAL (-5, first);
+  NS_TEST_ASSERT_EQUAL (firstRp, bRouting);
+  
+  return result;
+}
+
+static Ipv4ListRoutingTest gIpv4ListRoutingTest;
+
+} // namespace ns3
+
+#endif /* RUN_SELF_TESTS */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/list-routing/ipv4-list-routing.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,98 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 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_LIST_ROUTING_H
+#define IPV4_LIST_ROUTING_H
+
+#include <list>
+#include "ns3/ipv4-routing-protocol.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup ipv4Routing 
+ *
+ * This class is a specialization of Ipv4RoutingProtocol that allows 
+ * other instances of Ipv4RoutingProtocol to be inserted in a 
+ * prioritized list.  Routing protocols in the list are consulted one
+ * by one, from highest to lowest priority, until a routing protocol
+ * is found that will take the packet (this corresponds to a non-zero
+ * return value to RouteOutput, or a return value of true to RouteInput).
+ * The order by which routing protocols with the same priority value 
+ * are consulted is undefined.
+ * 
+ */
+class Ipv4ListRouting : public Ipv4RoutingProtocol
+{
+public:
+  static TypeId GetTypeId (void);
+
+  Ipv4ListRouting ();  
+  virtual ~Ipv4ListRouting ();  
+
+  /**
+   * \brief Register a new routing protocol to be used in this IPv4 stack
+   *
+   * \param routingProtocol new routing protocol implementation object
+   * \param priority priority to give to this routing protocol.
+   * Values may range between -32768 and +32767.  
+   */
+  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
+  /**
+   * \return number of routing protocols in the list
+   */
+  virtual uint32_t GetNRoutingProtocols (void) const;
+  /**
+   * Return pointer to routing protocol stored at index, with the
+   * first protocol (index 0) the highest priority, the next one (index 1)
+   * the second highest priority, and so on.  The priority parameter is an
+   * output parameter and it returns the integer priority of the protocol.
+   * 
+   * \return pointer to routing protocol indexed by 
+   * \param index index of protocol to return
+   * \param priority output parameter, set to the priority of the protocol
+            being returned
+   */
+  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
+
+  // Below are from Ipv4RoutingProtocol
+  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, 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);
+  virtual void NotifyInterfaceUp (uint32_t interface);
+  virtual void NotifyInterfaceDown (uint32_t interface);
+  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+
+protected:
+  void DoDispose (void);
+private:
+  typedef std::pair<int16_t, Ptr<Ipv4RoutingProtocol> > Ipv4RoutingProtocolEntry;
+  typedef std::list<Ipv4RoutingProtocolEntry> Ipv4RoutingProtocolList;
+  Ipv4RoutingProtocolList m_routingProtocols;
+  static bool Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b);
+  Ptr<Ipv4> m_ipv4;
+
+};
+
+} //namespace ns3
+
+#endif /* IPV4_LIST_ROUTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/list-routing/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,13 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+    module = bld.create_ns3_module('list-routing', ['node'])
+    module.source = [
+        'ipv4-list-routing.cc',
+        ]
+    headers = bld.new_task_gen('ns3header')
+    headers.module = 'list-routing'
+    headers.source = [
+        'ipv4-list-routing.h',
+        ]
+
--- a/src/routing/olsr/olsr-routing-protocol.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/olsr/olsr-routing-protocol.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -185,19 +185,21 @@
 
 
 RoutingProtocol::RoutingProtocol ()
-  :
-  m_helloTimer (Timer::CANCEL_ON_DESTROY),
-  m_tcTimer (Timer::CANCEL_ON_DESTROY),
-  m_midTimer (Timer::CANCEL_ON_DESTROY),
-  m_queuedMessagesTimer (Timer::CANCEL_ON_DESTROY)
+  : m_ipv4 (0),
+    m_helloTimer (Timer::CANCEL_ON_DESTROY),
+    m_tcTimer (Timer::CANCEL_ON_DESTROY),
+    m_midTimer (Timer::CANCEL_ON_DESTROY),
+    m_queuedMessagesTimer (Timer::CANCEL_ON_DESTROY)
 {}
 
 RoutingProtocol::~RoutingProtocol ()
 {}
 
 void
-RoutingProtocol::SetNode (Ptr<Node> node)
+RoutingProtocol::SetIpv4 (Ptr<Ipv4> ipv4)
 {
+  NS_ASSERT (ipv4 != 0);
+  NS_ASSERT (m_ipv4 == 0);
   NS_LOG_DEBUG ("Created olsr::RoutingProtocol");
   m_helloTimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
   m_tcTimer.SetFunction (&RoutingProtocol::TcTimerExpire, this);
@@ -210,8 +212,9 @@
 
   m_linkTupleTimerFirstTime = true;
 
-  m_ipv4 = node->GetObject<Ipv4> ();
-  NS_ASSERT (m_ipv4);
+  m_ipv4 = ipv4;
+
+  Simulator::ScheduleNow (&RoutingProtocol::Start, this);
 }
 
 void RoutingProtocol::DoDispose ()
@@ -2550,7 +2553,7 @@
 }
 
 Ptr<Ipv4Route>
-RoutingProtocol::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
+RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
 {  
   NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId() << " " << header.GetDestination () << " " << oif);
   // TBD:  oif is unused; can be used to restrict the outgoing interface
@@ -2651,6 +2654,18 @@
       return false;
     }
 }
+void 
+RoutingProtocol::NotifyInterfaceUp (uint32_t i)
+{}
+void 
+RoutingProtocol::NotifyInterfaceDown (uint32_t i)
+{}
+void 
+RoutingProtocol::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{}
+void 
+RoutingProtocol::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{}
 
 
 ///
--- a/src/routing/olsr/olsr-routing-protocol.h	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/routing/olsr/olsr-routing-protocol.h	Fri Jul 03 09:59:04 2009 +0400
@@ -36,6 +36,7 @@
 #include "ns3/timer.h"
 #include "ns3/traced-callback.h"
 #include "ns3/ipv4.h"
+#include "ns3/ipv4-routing-protocol.h"
 
 #include <vector>
 #include <map>
@@ -67,9 +68,6 @@
   RoutingProtocol ();
   virtual ~RoutingProtocol ();
 
-  void SetNode (Ptr<Node> node);
-
-  void Start ();
   void SetMainInterface (uint32_t interface);
 
 private:
@@ -102,7 +100,7 @@
   Ptr<Ipv4> m_ipv4;
 	
 private:
-
+  void Start ();
   void Clear ();
   uint32_t GetSize () const { return m_table.size (); }
   std::vector<RoutingTableEntry> GetEntries () const;
@@ -121,10 +119,16 @@
                       RoutingTableEntry &outEntry) const;
 
   // From Ipv4RoutingProtocol
-  virtual Ptr<Ipv4Route> RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr);
+  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, 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);  
+  virtual void NotifyInterfaceUp (uint32_t interface);
+  virtual void NotifyInterfaceDown (uint32_t interface);
+  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+
 
   void DoDispose ();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/static-routing/ipv4-routing-table-entry.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,333 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include "ipv4-routing-table-entry.h"
+#include "ns3/assert.h"
+
+namespace ns3 {
+
+/*****************************************************
+ *     Network Ipv4RoutingTableEntry
+ *****************************************************/
+
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry ()
+{}
+
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route)
+  : m_dest (route.m_dest),
+    m_destNetworkMask (route.m_destNetworkMask),
+    m_gateway (route.m_gateway),
+    m_interface (route.m_interface)
+{}
+
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route)
+  : m_dest (route->m_dest),
+    m_destNetworkMask (route->m_destNetworkMask),
+    m_gateway (route->m_gateway),
+    m_interface (route->m_interface)
+{}
+
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
+                      Ipv4Address gateway,
+                      uint32_t interface)
+  : m_dest (dest),
+    m_destNetworkMask (Ipv4Mask::GetZero ()),
+    m_gateway (gateway),
+    m_interface (interface)
+{}
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
+                      uint32_t interface)
+  : m_dest (dest),
+    m_destNetworkMask (Ipv4Mask::GetZero ()),
+    m_gateway (Ipv4Address::GetZero ()),
+    m_interface (interface)
+{}
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
+                      Ipv4Mask networkMask,
+                      Ipv4Address gateway,
+                      uint32_t interface)
+  : m_dest (network),
+    m_destNetworkMask (networkMask),
+    m_gateway (gateway),
+    m_interface (interface)
+{}
+Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
+                      Ipv4Mask networkMask,
+                      uint32_t interface)
+  : m_dest (network),
+    m_destNetworkMask (networkMask),
+    m_gateway (Ipv4Address::GetZero ()),
+    m_interface (interface)
+{}
+
+bool 
+Ipv4RoutingTableEntry::IsHost (void) const
+{
+  if (m_destNetworkMask.IsEqual (Ipv4Mask::GetZero ())) 
+    {
+      return true;
+    } 
+  else 
+    {
+      return false;
+    }
+}
+Ipv4Address 
+Ipv4RoutingTableEntry::GetDest (void) const
+{
+  return m_dest;
+}
+bool 
+Ipv4RoutingTableEntry::IsNetwork (void) const
+{
+  return !IsHost ();
+}
+bool 
+Ipv4RoutingTableEntry::IsDefault (void) const
+{
+  if (m_dest.IsEqual (Ipv4Address::GetZero ())) 
+    {
+      return true;
+    } 
+  else 
+    {
+      return false;
+    }
+}
+Ipv4Address 
+Ipv4RoutingTableEntry::GetDestNetwork (void) const
+{
+  return m_dest;
+}
+Ipv4Mask 
+Ipv4RoutingTableEntry::GetDestNetworkMask (void) const
+{
+  return m_destNetworkMask;
+}
+bool 
+Ipv4RoutingTableEntry::IsGateway (void) const
+{
+  if (m_gateway.IsEqual (Ipv4Address::GetZero ())) 
+    {
+      return false;
+    } 
+  else 
+    {
+      return true;
+    }
+}
+Ipv4Address 
+Ipv4RoutingTableEntry::GetGateway (void) const
+{
+  return m_gateway;
+}
+uint32_t
+Ipv4RoutingTableEntry::GetInterface (void) const
+{
+  return m_interface;
+}
+
+Ipv4RoutingTableEntry 
+Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest, 
+			      Ipv4Address nextHop, 
+			      uint32_t interface)
+{
+  return Ipv4RoutingTableEntry (dest, nextHop, interface);
+}
+Ipv4RoutingTableEntry 
+Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
+			      uint32_t interface)
+{
+  return Ipv4RoutingTableEntry (dest, interface);
+}
+Ipv4RoutingTableEntry 
+Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
+				 Ipv4Mask networkMask, 
+				 Ipv4Address nextHop, 
+				 uint32_t interface)
+{
+  return Ipv4RoutingTableEntry (network, networkMask, 
+                    nextHop, interface);
+}
+Ipv4RoutingTableEntry 
+Ipv4RoutingTableEntry::CreateNetworkRouteTo (Ipv4Address network, 
+				 Ipv4Mask networkMask, 
+				 uint32_t interface)
+{
+  return Ipv4RoutingTableEntry (network, networkMask, 
+                    interface);
+}
+Ipv4RoutingTableEntry 
+Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop, 
+			       uint32_t interface)
+{
+  return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
+}
+
+
+std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route)
+{
+  if (route.IsDefault ())
+    {
+      NS_ASSERT (route.IsGateway ());
+      os << "default out=" << route.GetInterface () << ", next hop=" << route.GetGateway ();
+    }
+  else if (route.IsHost ())
+    {
+      if (route.IsGateway ())
+        {
+          os << "host="<< route.GetDest () << 
+            ", out=" << route.GetInterface () << 
+            ", next hop=" << route.GetGateway ();
+        }
+      else
+        {
+          os << "host="<< route.GetDest () << 
+            ", out=" << route.GetInterface ();
+        }
+    }
+  else if (route.IsNetwork ()) 
+    {
+      if (route.IsGateway ())
+        {
+          os << "network=" << route.GetDestNetwork () <<
+            ", mask=" << route.GetDestNetworkMask () <<
+            ",out=" << route.GetInterface () <<
+            ", next hop=" << route.GetGateway ();
+        }
+      else
+        {
+          os << "network=" << route.GetDestNetwork () <<
+            ", mask=" << route.GetDestNetworkMask () <<
+            ",out=" << route.GetInterface ();
+        }
+    }
+  else
+    {
+      NS_ASSERT (false);
+    }
+  return os;
+}
+
+/*****************************************************
+ *     Ipv4MulticastRoutingTableEntry
+ *****************************************************/
+
+Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry ()
+{
+}
+
+Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route)
+: 
+  m_origin (route.m_origin),
+  m_group (route.m_group),
+  m_inputInterface (route.m_inputInterface),
+  m_outputInterfaces (route.m_outputInterfaces)
+{
+}
+
+Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route)
+: 
+  m_origin (route->m_origin),
+  m_group (route->m_group),
+  m_inputInterface (route->m_inputInterface),
+  m_outputInterfaces (route->m_outputInterfaces)
+{
+}
+
+Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (
+  Ipv4Address origin, 
+  Ipv4Address group, 
+  uint32_t inputInterface, 
+  std::vector<uint32_t> outputInterfaces)
+{
+  m_origin = origin;
+  m_group = group;
+  m_inputInterface = inputInterface;
+  m_outputInterfaces = outputInterfaces;
+}
+
+Ipv4Address 
+Ipv4MulticastRoutingTableEntry::GetOrigin (void) const
+{
+  return m_origin;
+}
+
+Ipv4Address 
+Ipv4MulticastRoutingTableEntry::GetGroup (void) const
+{
+  return m_group;
+}
+
+uint32_t 
+Ipv4MulticastRoutingTableEntry::GetInputInterface (void) const
+{
+  return m_inputInterface;
+}
+
+uint32_t
+Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces (void) const
+{
+  return m_outputInterfaces.size ();
+}
+
+uint32_t
+Ipv4MulticastRoutingTableEntry::GetOutputInterface (uint32_t n) const
+{
+  NS_ASSERT_MSG(n < m_outputInterfaces.size (), 
+    "Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds");
+
+  return m_outputInterfaces[n];
+}
+
+std::vector<uint32_t>
+Ipv4MulticastRoutingTableEntry::GetOutputInterfaces (void) const
+{
+  return m_outputInterfaces;
+}
+
+Ipv4MulticastRoutingTableEntry 
+Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (
+  Ipv4Address origin, 
+  Ipv4Address group, 
+  uint32_t inputInterface,
+  std::vector<uint32_t> outputInterfaces)
+{
+  return Ipv4MulticastRoutingTableEntry (origin, group, inputInterface, outputInterfaces);
+}
+
+std::ostream& 
+operator<< (std::ostream& os, Ipv4MulticastRoutingTableEntry const& route)
+{
+  os << "origin=" << route.GetOrigin () << 
+    ", group=" << route.GetGroup () <<
+    ", input interface=" << route.GetInputInterface () <<
+    ", output interfaces=";
+
+  for (uint32_t i = 0; i < route.GetNOutputInterfaces (); ++i)
+    {
+      os << route.GetOutputInterface (i) << " ";
+
+    }
+
+  return os;
+}
+
+}//namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/static-routing/ipv4-routing-table-entry.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,228 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005 INRIA
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef IPV4_ROUTING_TABLE_ENTRY_H
+#define IPV4_ROUTING_TABLE_ENTRY_H
+
+#include <list>
+#include <vector>
+#include <ostream>
+
+#include "ns3/ipv4-address.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup ipv4Routing
+ *
+ * A record of an IPv4 routing table entry for Ipv4GlobalRouting and 
+ * Ipv4StaticRouting.  This is not a reference counted object.
+ */
+class Ipv4RoutingTableEntry {
+public:
+  /**
+   * \brief This constructor does nothing
+   */
+  Ipv4RoutingTableEntry ();
+  /**
+   * \brief Copy Constructor
+   * \param route The route to copy
+   */
+  Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route);
+  /**
+   * \brief Copy Constructor
+   * \param route The route to copy
+   */
+  Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route);
+  /**
+   * \return True if this route is a host route; false otherwise
+   */
+  bool IsHost (void) const;
+  /**
+   * \return The IPv4 address of the destination of this route
+   */
+  bool IsNetwork (void) const;
+  /**
+   * \return True if this route is a default route; false otherwise
+   */
+  bool IsDefault (void) const;
+  /**
+   * \return True if this route is a gateway route; false otherwise
+   */
+  bool IsGateway (void) const;
+  /**
+   * \return address of the gateway stored in this entry
+   */
+  Ipv4Address GetGateway (void) const;
+  /**
+   * \return The IPv4 address of the destination of this route
+   */
+  Ipv4Address GetDest (void) const;
+  /**
+   * \return The IPv4 network number of the destination of this route
+   */
+  Ipv4Address GetDestNetwork (void) const;
+  /**
+   * \return The IPv4 network mask of the destination of this route
+   */
+  Ipv4Mask GetDestNetworkMask (void) const;
+  /**
+   * \return The Ipv4 interface number used for sending outgoing packets
+   */
+  uint32_t GetInterface (void) const;
+  /**
+   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
+   * \param dest Ipv4Address of the destination
+   * \param nextHop Ipv4Address of the next hop
+   * \param interface Outgoing interface 
+   */
+  static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest, 
+				      Ipv4Address nextHop, 
+				      uint32_t interface);
+  /**
+   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
+   * \param dest Ipv4Address of the destination
+   * \param interface Outgoing interface 
+   */
+  static Ipv4RoutingTableEntry CreateHostRouteTo (Ipv4Address dest, 
+				      uint32_t interface);
+  /**
+   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
+   * \param network Ipv4Address of the destination network
+   * \param networkMask Ipv4Mask of the destination network mask
+   * \param nextHop Ipv4Address of the next hop
+   * \param interface Outgoing interface 
+   */
+  static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network, 
+					 Ipv4Mask networkMask, 
+					 Ipv4Address nextHop, 
+					 uint32_t interface);
+  /**
+   * \return An Ipv4RoutingTableEntry object corresponding to the input parameters.
+   * \param network Ipv4Address of the destination network
+   * \param networkMask Ipv4Mask of the destination network mask
+   * \param interface Outgoing interface 
+   */
+  static Ipv4RoutingTableEntry CreateNetworkRouteTo (Ipv4Address network, 
+					 Ipv4Mask networkMask, 
+					 uint32_t interface);
+  /**
+   * \return An Ipv4RoutingTableEntry object corresponding to the input 
+   * parameters.  This route is distinguished; it will match any 
+   * destination for which a more specific route does not exist.
+   * \param nextHop Ipv4Address of the next hop
+   * \param interface Outgoing interface 
+   */
+  static Ipv4RoutingTableEntry CreateDefaultRoute (Ipv4Address nextHop, 
+				       uint32_t interface);
+  
+private:
+  Ipv4RoutingTableEntry (Ipv4Address network,
+	     Ipv4Mask mask,
+	     Ipv4Address gateway,
+	     uint32_t interface);
+  Ipv4RoutingTableEntry (Ipv4Address dest,
+	     Ipv4Mask mask,
+	     uint32_t interface);
+  Ipv4RoutingTableEntry (Ipv4Address dest,
+	     Ipv4Address gateway,
+	     uint32_t interface);
+  Ipv4RoutingTableEntry (Ipv4Address dest,
+	     uint32_t interface);
+
+  Ipv4Address m_dest;
+  Ipv4Mask m_destNetworkMask;
+  Ipv4Address m_gateway;
+  uint32_t m_interface;
+};
+
+std::ostream& operator<< (std::ostream& os, Ipv4RoutingTableEntry const& route);
+
+/**
+ * \ingroup ipv4Routing
+ *
+ * \brief A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting
+ */
+class Ipv4MulticastRoutingTableEntry {
+public:
+  /**
+   * \brief This constructor does nothing
+   */
+  Ipv4MulticastRoutingTableEntry ();
+
+  /**
+   * \brief Copy Constructor
+   * \param route The route to copy
+   */
+  Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route);
+  /**
+   * \brief Copy Constructor
+   * \param route The route to copy
+   */
+  Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route);
+  /**
+   * \return The IPv4 address of the source of this route
+   */
+  Ipv4Address GetOrigin (void) const;
+  /**
+   * \return The IPv4 address of the multicast group of this route
+   */
+  Ipv4Address GetGroup (void) const;
+  /**
+   * \return The IPv4 address of the input interface of this route
+   */
+  uint32_t GetInputInterface (void) const;
+  /**
+   * \return The number of output interfaces of this route
+   */
+  uint32_t GetNOutputInterfaces (void) const;
+  /**
+   * \return A specified output interface.
+   */
+  uint32_t GetOutputInterface (uint32_t n) const;
+  /**
+   * \return A vector of all of the output interfaces of this route.
+   */
+  std::vector<uint32_t> GetOutputInterfaces (void) const;
+  /**
+   * \return Ipv4MulticastRoutingTableEntry corresponding to the input parameters.
+   * \param origin Source address for the multicast route 
+   * \param group Group destination address for the multicast route
+   * \param inputInterface Input interface that multicast datagram must be received on
+   * \param outputInterfaces vector of output interfaces to copy and forward the datagram to
+   */
+  static Ipv4MulticastRoutingTableEntry CreateMulticastRoute (Ipv4Address origin, 
+    Ipv4Address group, uint32_t inputInterface,
+    std::vector<uint32_t> outputInterfaces);
+
+private:
+  Ipv4MulticastRoutingTableEntry (Ipv4Address origin, Ipv4Address group, 
+    uint32_t inputInterface, std::vector<uint32_t> outputInterfaces);
+
+  Ipv4Address m_origin;
+  Ipv4Address m_group;
+  uint32_t m_inputInterface;
+  std::vector<uint32_t> m_outputInterfaces;
+};
+
+std::ostream& operator<< (std::ostream& os, Ipv4MulticastRoutingTableEntry const& route);
+
+}//namespace ns3
+
+#endif /* IPV4_ROUTING_TABLE_ENTRY_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/static-routing/ipv4-static-routing.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,668 @@
+// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
+//
+// Copyright (c) 2006 Georgia Tech Research Corporation
+//
+// 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
+//
+// Author: George F. Riley<riley@ece.gatech.edu>
+//         Gustavo Carneiro <gjc@inescporto.pt>
+
+#include "ns3/log.h"
+#include "ns3/packet.h"
+#include "ns3/node.h"
+#include "ns3/ipv4-route.h"
+#include "ipv4-static-routing.h"
+#include "ipv4-routing-table-entry.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRouting);
+
+TypeId
+Ipv4StaticRouting::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::Ipv4StaticRouting")
+    .SetParent<Ipv4RoutingProtocol> ()
+    .AddConstructor<Ipv4StaticRouting> ()
+    ;
+  return tid;
+}
+
+Ipv4StaticRouting::Ipv4StaticRouting () 
+: m_defaultRoute (0), m_ipv4 (0)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+void 
+Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, 
+                                   Ipv4Address nextHop, 
+                                   uint32_t interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
+  m_hostRoutes.push_back (route);
+}
+
+void 
+Ipv4StaticRouting::AddHostRouteTo (Ipv4Address dest, 
+                                   uint32_t interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
+  m_hostRoutes.push_back (route);
+}
+
+void 
+Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, 
+                                      Ipv4Mask networkMask, 
+                                      Ipv4Address nextHop, 
+                                      uint32_t interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
+                                            networkMask,
+                                            nextHop,
+                                            interface);
+  m_networkRoutes.push_back (route);
+}
+
+void 
+Ipv4StaticRouting::AddNetworkRouteTo (Ipv4Address network, 
+                                      Ipv4Mask networkMask, 
+                                      uint32_t interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
+                                            networkMask,
+                                            interface);
+  m_networkRoutes.push_back (route);
+}
+
+void 
+Ipv4StaticRouting::SetDefaultRoute (Ipv4Address nextHop, 
+                                    uint32_t interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  *route = Ipv4RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
+  delete m_defaultRoute;
+  m_defaultRoute = route;
+}
+
+void 
+Ipv4StaticRouting::AddMulticastRoute(Ipv4Address origin,
+                                     Ipv4Address group,
+                                     uint32_t inputInterface,
+                                     std::vector<uint32_t> outputInterfaces)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4MulticastRoutingTableEntry *route = new Ipv4MulticastRoutingTableEntry ();
+  *route = Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (origin, group, 
+    inputInterface, outputInterfaces);
+  m_multicastRoutes.push_back (route);
+}
+
+// default multicast routes are stored as a network route
+// these routes are _not_ consulted in the forwarding process-- only
+// for originating packets
+void 
+Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
+  Ipv4Address network = Ipv4Address ("224.0.0.0");
+  Ipv4Mask networkMask = Ipv4Mask ("240.0.0.0");
+  *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
+                                            networkMask,
+                                            outputInterface);
+  m_networkRoutes.push_back (route);
+}
+
+uint32_t 
+Ipv4StaticRouting::GetNMulticastRoutes (void) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  return m_multicastRoutes.size ();
+}
+
+Ipv4MulticastRoutingTableEntry
+Ipv4StaticRouting::GetMulticastRoute (uint32_t index) const
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  NS_ASSERT_MSG(index < m_multicastRoutes.size (),
+    "Ipv4StaticRouting::GetMulticastRoute ():  Index out of range");
+
+  if (index < m_multicastRoutes.size ())
+    {
+      uint32_t tmp = 0;
+      for (MulticastRoutesCI i = m_multicastRoutes.begin (); 
+           i != m_multicastRoutes.end (); 
+           i++) 
+        {
+          if (tmp  == index)
+            {
+              return *i;
+            }
+          tmp++;
+        }
+    }
+  return 0;
+}
+
+bool
+Ipv4StaticRouting::RemoveMulticastRoute(Ipv4Address origin,
+                                        Ipv4Address group,
+                                        uint32_t inputInterface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
+       i != m_multicastRoutes.end (); 
+       i++) 
+    {
+      Ipv4MulticastRoutingTableEntry *route = *i;
+      if (origin == route->GetOrigin () &&
+          group == route->GetGroup () &&
+          inputInterface == route->GetInputInterface ())
+        {
+          delete *i;
+          m_multicastRoutes.erase (i);
+          return true;
+        }
+    }
+  return false;
+}
+
+void 
+Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  uint32_t tmp = 0;
+  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
+       i != m_multicastRoutes.end (); 
+       i++) 
+    {
+      if (tmp  == index)
+        {
+          delete *i;
+          m_multicastRoutes.erase (i);
+          return;
+        }
+      tmp++;
+    }
+}
+
+Ptr<Ipv4Route>
+Ipv4StaticRouting::LookupStatic (Ipv4Address dest)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ptr<Ipv4Route> rtentry = 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);
+          Ipv4RoutingTableEntry* route = (*i);
+          rtentry = Create<Ipv4Route> ();
+          uint32_t interfaceIdx = route->GetInterface ();
+          rtentry->SetDestination (route->GetDest ());
+          rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
+          rtentry->SetGateway (route->GetGateway ());
+          rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
+          return rtentry;
+        }
+    }
+  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);
+          Ipv4RoutingTableEntry* route = (*j);
+          rtentry = Create<Ipv4Route> ();
+          uint32_t interfaceIdx = route->GetInterface ();
+          rtentry->SetDestination (route->GetDest ());
+          rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
+          rtentry->SetGateway (route->GetGateway ());
+          rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
+          return rtentry;
+        }
+    }
+  if (m_defaultRoute != 0) 
+    {
+      NS_ASSERT (m_defaultRoute->IsDefault ());
+      NS_LOG_LOGIC ("Found global network route" << m_defaultRoute);
+      Ipv4RoutingTableEntry* route = m_defaultRoute;
+      rtentry = Create<Ipv4Route> ();
+      uint32_t interfaceIdx = route->GetInterface ();
+      rtentry->SetDestination (route->GetDest ());
+      rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
+      rtentry->SetGateway (route->GetGateway ());
+      rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
+      return rtentry;
+    }
+  return 0;
+}
+
+Ptr<Ipv4MulticastRoute>
+Ipv4StaticRouting::LookupStatic (
+  Ipv4Address origin, 
+  Ipv4Address group,
+  uint32_t    interface)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  Ptr<Ipv4MulticastRoute> mrtentry = 0;
+
+  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
+       i != m_multicastRoutes.end (); 
+       i++) 
+    {
+      Ipv4MulticastRoutingTableEntry *route = *i;
+//
+// We've been passed an origin address, a multicast group address and an 
+// interface index.  We have to decide if the current route in the list is
+// a match.
+//
+// The first case is the restrictive case where the origin, group and index
+// matches.  
+//
+      if (origin == route->GetOrigin () && group == route->GetGroup ())
+        {
+          // Skipping this case (SSM) for now
+          NS_LOG_LOGIC ("Found multicast source specific route" << *i);
+        }
+      if (group == route->GetGroup ())
+        {
+          if (interface == Ipv4::IF_ANY || 
+              interface == route->GetInputInterface ())
+            {
+              NS_LOG_LOGIC ("Found multicast route" << *i);
+              mrtentry = Create<Ipv4MulticastRoute> ();
+              mrtentry->SetGroup (route->GetGroup ());
+              mrtentry->SetOrigin (route->GetOrigin ());
+              mrtentry->SetParent (route->GetInputInterface ());
+              for (uint32_t j = 0; j < route->GetNOutputInterfaces (); j++)
+                {
+                  if (route->GetOutputInterface (j))
+                    {
+                      NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
+                      mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv4MulticastRoute::MAX_TTL - 1);
+                    }
+                }
+              return mrtentry;
+            }
+        }
+    }
+  return mrtentry;
+}
+
+uint32_t 
+Ipv4StaticRouting::GetNRoutes (void)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  uint32_t n = 0;
+  if (m_defaultRoute != 0)
+    {
+      n++;
+    }
+  n += m_hostRoutes.size ();
+  n += m_networkRoutes.size ();
+  return n;
+}
+
+Ipv4RoutingTableEntry
+Ipv4StaticRouting::GetDefaultRoute ()
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  if (m_defaultRoute != 0)
+    {
+      return *m_defaultRoute;
+    }
+  else
+    {
+      return Ipv4RoutingTableEntry ();
+    }
+}
+
+Ipv4RoutingTableEntry 
+Ipv4StaticRouting::GetRoute (uint32_t index)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  if (index == 0 && m_defaultRoute != 0)
+    {
+      return *m_defaultRoute;
+    }
+  if (index > 0 && m_defaultRoute != 0)
+    {
+      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 
+Ipv4StaticRouting::RemoveRoute (uint32_t index)
+{
+  NS_LOG_FUNCTION_NOARGS ();
+  if (index == 0 && m_defaultRoute != 0)
+    {
+      delete m_defaultRoute;
+      m_defaultRoute = 0;
+    }
+  if (index > 0 && m_defaultRoute != 0)
+    {
+      index--;
+    }
+  if (index < m_hostRoutes.size ())
+    {
+      uint32_t tmp = 0;
+      for (HostRoutesI i = m_hostRoutes.begin (); 
+           i != m_hostRoutes.end (); 
+           i++) 
+        {
+          if (tmp  == index)
+            {
+              delete *i;
+              m_hostRoutes.erase (i);
+              return;
+            }
+          tmp++;
+        }
+    }
+  index -= m_hostRoutes.size ();
+  uint32_t tmp = 0;
+  for (NetworkRoutesI j = m_networkRoutes.begin (); 
+       j != m_networkRoutes.end (); 
+       j++) 
+    {
+      if (tmp == index)
+        {
+          delete *j;
+          m_networkRoutes.erase (j);
+          return;
+        }
+      tmp++;
+    }
+  NS_ASSERT (false);
+}
+
+Ptr<Ipv4Route> 
+Ipv4StaticRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
+{
+  NS_LOG_FUNCTION (this << header << oif);
+  Ipv4Address destination = header.GetDestination ();
+  Ptr<Ipv4Route> rtentry = 0;
+
+  // Multicast goes here
+  if (destination.IsMulticast ())
+    {
+      // Note:  Multicast routes for outbound packets are stored in the
+      // normal unicast table.  An implication of this is that it is not
+      // possible to source multicast datagrams on multiple interfaces.
+      // This is a well-known property of sockets implementation on 
+      // many Unix variants.
+      // So, we just log it and fall through to LookupStatic ()
+      NS_LOG_LOGIC ("RouteOutput()::Multicast destination");
+    }
+  rtentry = LookupStatic (destination);
+  if (rtentry)
+    { 
+      sockerr = Socket::ERROR_NOTERROR;
+    }
+  else
+    { 
+      sockerr = Socket::ERROR_NOROUTETOHOST;
+    }
+  return rtentry;
+}
+
+// XXX this method not robust enough to work outside of ListRouting context
+// because it will not perform local delivery
+bool 
+Ipv4StaticRouting::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");
+      Ptr<Ipv4MulticastRoute> mrtentry =  LookupStatic(ipHeader.GetSource (),
+        ipHeader.GetDestination (), m_ipv4->GetInterfaceForDevice (idev));
+
+      if (mrtentry)
+        {
+          NS_LOG_LOGIC ("Multicast route found");
+          mcb (mrtentry, p, ipHeader); // multicast forwarding callback
+          return true;
+        }
+      else
+        {
+          NS_LOG_LOGIC ("Multicast route not found");
+          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");
+  Ptr<Ipv4Route> rtentry = LookupStatic (ipHeader.GetDestination ());
+  if (rtentry != 0)
+    {
+      NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
+      ucb (rtentry, p, ipHeader);  // unicast forwarding callback
+      return true;
+    }
+  else
+    {
+      NS_LOG_LOGIC ("Did not find unicast destination- returning false");
+      return false; // Let other routing protocols try to handle this
+    }
+}
+
+Ipv4StaticRouting::~Ipv4StaticRouting ()
+{
+  NS_LOG_FUNCTION_NOARGS ();
+}
+
+void
+Ipv4StaticRouting::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);
+    }
+  if (m_defaultRoute != 0)
+    {
+      delete m_defaultRoute;
+      m_defaultRoute = 0;
+    }
+  for (MulticastRoutesI i = m_multicastRoutes.begin (); 
+       i != m_multicastRoutes.end (); 
+       i = m_multicastRoutes.erase (i)) 
+    {
+      delete (*i);
+    }
+  m_ipv4 = 0;
+  Ipv4RoutingProtocol::DoDispose ();
+}
+
+void 
+Ipv4StaticRouting::NotifyInterfaceUp (uint32_t i)
+{
+  // If interface address and network mask have been set, add a route
+  // to the network of the interface (like e.g. ifconfig does on a
+  // Linux box)
+  for (uint32_t j = 0; j < m_ipv4->GetNAddresses (i); j++)
+    {
+      if (m_ipv4->GetAddress (i,j).GetLocal () != Ipv4Address () &&
+          m_ipv4->GetAddress (i,j).GetMask () != Ipv4Mask ())
+        {
+          AddNetworkRouteTo (m_ipv4->GetAddress (i,j).GetLocal ().CombineMask (m_ipv4->GetAddress (i,j).GetMask ()),
+                             m_ipv4->GetAddress (i,j).GetMask (), i);
+        }
+    }
+}
+
+void 
+Ipv4StaticRouting::NotifyInterfaceDown (uint32_t i)
+{
+  // Remove all static routes that are going through this interface
+  for (uint32_t j = 0; j < GetNRoutes (); j++)
+    {
+      Ipv4RoutingTableEntry route = GetRoute (j);
+      if (route.GetInterface () == i)
+        {
+          RemoveRoute (j);
+        }
+    }
+}
+
+void 
+Ipv4StaticRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{
+  NS_LOG_FUNCTION (this << interface);
+  if (!m_ipv4->IsUp (interface))
+    {
+      return;
+    }
+
+  Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
+  Ipv4Mask networkMask = address.GetMask ();
+  if (address.GetLocal () != Ipv4Address () &&
+      address.GetMask () != Ipv4Mask ())
+    {
+      AddNetworkRouteTo (networkAddress,
+                         networkMask, interface);
+    }
+}
+void 
+Ipv4StaticRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
+{
+  if (!m_ipv4->IsUp (interface))
+    {
+      return;
+    }
+  Ipv4Address networkAddress = address.GetLocal ().CombineMask (address.GetMask ());
+  Ipv4Mask networkMask = address.GetMask ();
+  // Remove all static routes that are going through this interface
+  // which reference this network
+  for (uint32_t j = 0; j < GetNRoutes (); j++)
+    {
+      Ipv4RoutingTableEntry route = GetRoute (j);
+      if (route.GetInterface () == interface &&
+          route.IsNetwork () && 
+          route.GetDestNetwork () == networkAddress &&
+          route.GetDestNetworkMask () == networkMask)
+        {
+          RemoveRoute (j);
+        }
+    }
+}
+
+void 
+Ipv4StaticRouting::SetIpv4 (Ptr<Ipv4> ipv4)
+{
+  NS_LOG_FUNCTION (this << ipv4);
+  NS_ASSERT (m_ipv4 == 0 && ipv4 != 0);
+  m_ipv4 = ipv4;
+  for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++)
+    {
+      if (m_ipv4->IsUp (i))
+        {
+          NotifyInterfaceUp (i);
+        }
+      else
+        {
+          NotifyInterfaceDown (i);
+        }
+    }
+}
+
+Ipv4Address
+Ipv4StaticRouting::SourceAddressSelection (uint32_t interfaceIdx, Ipv4Address dest)
+{
+  if (m_ipv4->GetNAddresses (interfaceIdx) == 1)  // common case
+    {
+      return m_ipv4->GetAddress (interfaceIdx, 0).GetLocal ();
+    }
+  // no way to determine the scope of the destination, so adopt the
+  // following rule:  pick the first available address (index 0) unless
+  // a subsequent address is on link (in which case, pick the primary
+  // address if there are multiple)
+  Ipv4Address candidate = m_ipv4->GetAddress (interfaceIdx, 0).GetLocal ();
+  for (uint32_t i = 0; i < m_ipv4->GetNAddresses (interfaceIdx); i++)
+    {
+      Ipv4InterfaceAddress test = m_ipv4->GetAddress (interfaceIdx, i);
+      if (test.GetLocal ().CombineMask (test.GetMask ()) == dest.CombineMask (test.GetMask ()))
+        {
+          if (test.IsSecondary () == false) 
+            {
+              return test.GetLocal ();
+            }
+        }
+    }
+  return candidate;
+}
+
+}//namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/static-routing/ipv4-static-routing.h	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,392 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006 Georgia Tech Research Corporation
+ *
+ * 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
+ *
+ * Author: George F. Riley<riley@ece.gatech.edu>
+ *         Gustavo Carneiro <gjc@inescporto.pt>
+ */
+
+#ifndef IPV4_STATIC_ROUTING_H
+#define IPV4_STATIC_ROUTING_H
+
+#include <list>
+#include <stdint.h>
+#include "ns3/ipv4-address.h"
+#include "ns3/ipv4-header.h"
+#include "ns3/socket.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;
+
+/**
+ * \ingroup ipv4Routing
+ * 
+ * \brief Static routing protocol for IP version 4 stacks.
+ *
+ * This class provides a basic set of methods for inserting static
+ * unicast and multicast routes into the Ipv4 routing system.  
+ * This particular protocol is designed to be inserted into an 
+ * Ipv4ListRouting protocol and at present cannot be inserted as the
+ * only routing protocol into Ipv4 (i.e. it must be added to an 
+ * Ipv4ListRouting).
+ * 
+ * The Ipv4StaticRouting class inherits from the abstract base class 
+ * Ipv4RoutingProtocol that defines the interface methods that a routing 
+ * protocol must support.
+ *
+ * \see Ipv4RoutingProtocol
+ * \see Ipv4ListRouting
+ * \see Ipv4ListRouting::AddRoutingProtocol
+ */
+class Ipv4StaticRouting : public Ipv4RoutingProtocol
+{
+public:
+  static TypeId GetTypeId (void);
+
+  Ipv4StaticRouting ();
+  virtual ~Ipv4StaticRouting ();
+
+  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, 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);
+
+  virtual void NotifyInterfaceUp (uint32_t interface);
+  virtual void NotifyInterfaceDown (uint32_t interface);
+  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
+  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
+
+/**
+ * \brief Add a host route to the static 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 static 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 static 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 static 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 Add a default route to the static routing table.
+ *
+ * This method tells the routing system what to do in the case where a specific
+ * route to a destination is not found.  The system forwards packets to the
+ * specified node in the hope that it knows better how to route the packet.
+ * 
+ * If the default route is set, it is returned as the selected route from 
+ * LookupStatic irrespective of destination address if no specific route is
+ * found.
+ *
+ * \param nextHop The Ipv4Address to send packets to in the hope that they
+ * will be forwarded correctly.
+ * \param interface The network interface index used to send packets.
+ *
+ * \see Ipv4Address
+ * \see Ipv4StaticRouting::Lookup
+ */
+  void SetDefaultRoute (Ipv4Address nextHop, 
+                        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 the default route from the static routing table.
+ *
+ * \return If the default route is set, a pointer to that Ipv4RoutingTableEntry is
+ * returned, otherwise a zero pointer is returned.
+ *
+ * \see Ipv4RoutingTableEntry
+ */
+  Ipv4RoutingTableEntry GetDefaultRoute (void);
+
+/**
+ * \brief Get a route from the static unicast routing table.
+ *
+ * Externally, the unicast static 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 Ipv4StaticRouting::RemoveRoute
+ */
+  Ipv4RoutingTableEntry GetRoute (uint32_t i);
+
+/**
+ * \brief Remove a route from the static unicast routing table.
+ *
+ * Externally, the unicast static 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 Ipv4StaticRouting::GetRoute
+ * \see Ipv4StaticRouting::AddRoute
+ */
+  void RemoveRoute (uint32_t i);
+
+/**
+ * \brief Add a multicast route to the static routing table.
+ *
+ * A multicast route must specify an origin IP address, a multicast group and
+ * an input network interface index as conditions and provide a vector of
+ * output network interface indices over which packets matching the conditions
+ * are sent.
+ *
+ * Typically there are two main types of multicast routes:  routes of the 
+ * first kind are used during forwarding.  All of the conditions must be
+ * exlicitly provided.  The second kind of routes are used to get packets off
+ * of a local node.  The difference is in the input interface.  Routes for
+ * forwarding will always have an explicit input interface specified.  Routes
+ * off of a node will always set the input interface to a wildcard specified
+ * by the index Ipv4RoutingProtocol::INTERFACE_ANY.
+ *
+ * For routes off of a local node wildcards may be used in the origin and
+ * multicast group addresses.  The wildcard used for Ipv4Adresses is that 
+ * address returned by Ipv4Address::GetAny () -- typically "0.0.0.0".  Usage
+ * of a wildcard allows one to specify default behavior to varying degrees.
+ *
+ * For example, making the origin address a wildcard, but leaving the 
+ * multicast group specific allows one (in the case of a node with multiple
+ * interfaces) to create different routes using different output interfaces
+ * for each multicast group.
+ *
+ * If the origin and multicast addresses are made wildcards, you have created
+ * essentially a default multicast address that can forward to multiple 
+ * interfaces.  Compare this to the actual default multicast address that is
+ * limited to specifying a single output interface for compatibility with
+ * existing functionality in other systems.
+ * 
+ * \param origin The Ipv4Address of the origin of packets for this route.  May
+ * be Ipv4Address:GetAny for open groups.
+ * \param group The Ipv4Address of the multicast group or this route.
+ * \param inputInterface The input network interface index over which to 
+ * expect packets destined for this route.  May be
+ * Ipv4RoutingProtocol::INTERFACE_ANY for packets of local origin.
+ * \param outputInterfaces A vector of network interface indices used to specify
+ * how to send packets to the destination(s).
+ *
+ * \see Ipv4Address
+ */
+  void AddMulticastRoute (Ipv4Address origin,
+                          Ipv4Address group,
+                          uint32_t inputInterface,
+                          std::vector<uint32_t> outputInterfaces);
+
+/**
+ * \brief Add a default multicast route to the static routing table.
+ *
+ * This is the multicast equivalent of the unicast version SetDefaultRoute.
+ * We tell the routing system what to do in the case where a specific route
+ * to a destination multicast group is not found.  The system forwards 
+ * packets out the specified interface in the hope that "something out there"
+ * knows better how to route the packet.  This method is only used in 
+ * initially sending packets off of a host.  The default multicast route is
+ * not consulted during forwarding -- exact routes must be specified using
+ * AddMulticastRoute for that case.
+ *
+ * Since we're basically sending packets to some entity we think may know
+ * better what to do, we don't pay attention to "subtleties" like origin
+ * address, nor do we worry about forwarding out multiple  interfaces.  If the
+ * default multicast route is set, it is returned as the selected route from 
+ * LookupStatic irrespective of origin or multicast group if another specific
+ * route is not found.
+ *
+ * \param outputInterface The network interface index used to specify where
+ * to send packets in the case of unknown routes.
+ *
+ * \see Ipv4Address
+ */
+  void SetDefaultMulticastRoute (uint32_t outputInterface);
+
+/**
+ * \brief Get the number of individual multicast routes that have been added
+ * to the routing table.
+ *
+ * \warning The default multicast route counts as one of the routes.
+ */
+  uint32_t GetNMulticastRoutes (void) const;
+
+/**
+ * \brief Get a route from the static multicast routing table.
+ *
+ * Externally, the multicast static routing table appears simply as a table 
+ * with n entries.  
+ * 
+ * \param i The index (into the routing table) of the multicast route to
+ * retrieve.  
+ * \return If route \e i is set, a pointer to that Ipv4MulticastRoutingTableEntry is
+ * returned, otherwise a zero pointer is returned.
+ *
+ * \see Ipv4MulticastRoutingTableEntry
+ * \see Ipv4StaticRouting::RemoveRoute
+ */
+  Ipv4MulticastRoutingTableEntry GetMulticastRoute (uint32_t i) const;
+
+/**
+ * \brief Remove a route from the static multicast routing table.
+ *
+ * Externally, the multicast static routing table appears simply as a table 
+ * with n entries.  
+ * This method causes the multicast routing table to be searched for the first
+ * route that matches the parameters and removes it.
+ *
+ * Wildcards may be provided to this function, but the wildcards are used to
+ * exacly match wildcards in the routes (see AddMulticastRoute).  That is,
+ * calling RemoveMulticastRoute with the origin set to "0.0.0.0" will not
+ * remove routes with any address in the origin, but will only remove routes
+ * with "0.0.0.0" set as the the origin.
+ *
+ * \param origin The IP address specified as the origin of packets for the
+ * route.
+ * \param group The IP address specified as the multicast group addres of
+ * the route.
+ * \param inputInterface The network interface index specified as the expected
+ * input interface for the route.
+ * \returns true if a route was found and removed, false otherwise.
+ *
+ * \see Ipv4MulticastRoutingTableEntry
+ * \see Ipv4StaticRouting::AddMulticastRoute
+ */
+  bool RemoveMulticastRoute (Ipv4Address origin,
+                             Ipv4Address group,
+                             uint32_t inputInterface);
+
+/**
+ * \brief Remove a route from the static multicast routing table.
+ *
+ * Externally, the multicast static routing table appears simply as a table 
+ * with n entries.  
+ *
+ * \param index The index (into the multicast routing table) of the route to
+ * remove.  
+ *
+ * \see Ipv4RoutingTableEntry
+ * \see Ipv4StaticRouting::GetRoute
+ * \see Ipv4StaticRouting::AddRoute
+ */
+  void RemoveMulticastRoute (uint32_t index);
+
+protected:
+  virtual 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;
+
+  typedef std::list<Ipv4MulticastRoutingTableEntry *> MulticastRoutes;
+  typedef std::list<Ipv4MulticastRoutingTableEntry *>::const_iterator MulticastRoutesCI;
+  typedef std::list<Ipv4MulticastRoutingTableEntry *>::iterator MulticastRoutesI;
+  
+  Ptr<Ipv4Route> LookupStatic (Ipv4Address dest);
+  Ptr<Ipv4MulticastRoute> LookupStatic (Ipv4Address origin, Ipv4Address group,
+                                    uint32_t interface);
+
+  Ipv4Address SourceAddressSelection (uint32_t interface, Ipv4Address dest);
+
+  HostRoutes m_hostRoutes;
+  NetworkRoutes m_networkRoutes;
+  Ipv4RoutingTableEntry *m_defaultRoute;
+  MulticastRoutes m_multicastRoutes;
+
+  Ptr<Ipv4> m_ipv4;
+};
+
+} // Namespace ns3
+
+#endif /* IPV4_STATIC_ROUTING_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/routing/static-routing/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -0,0 +1,15 @@
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+    module = bld.create_ns3_module('static-routing', ['node'])
+    module.source = [
+        'ipv4-static-routing.cc',
+        'ipv4-routing-table-entry.cc',
+        ]
+    headers = bld.new_task_gen('ns3header')
+    headers.module = 'static-routing'
+    headers.source = [
+        'ipv4-static-routing.h',
+        'ipv4-routing-table-entry.h',
+        ]
+
--- a/src/simulator/simulator.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/simulator/simulator.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -292,7 +292,7 @@
 void
 Simulator::SetImplementation (Ptr<SimulatorImpl> impl)
 {
-  if (PeekImpl () != 0)
+  if (*PeekImpl () != 0)
     {
       NS_FATAL_ERROR ("It is not possible to set the implementation after calling any Simulator:: function. Call Simulator::SetImplementation earlier or after Simulator::Destroy.");
     }
--- a/src/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/src/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -29,6 +29,8 @@
     'applications/udp-echo',
     'routing/olsr',
     'routing/global-routing',
+    'routing/static-routing',
+    'routing/list-routing',
     'mobility',
     'devices/wifi',
     'helper',
--- a/utils/print-introspected-doxygen.cc	Wed Jul 01 21:54:24 2009 +0400
+++ b/utils/print-introspected-doxygen.cc	Fri Jul 03 09:59:04 2009 +0400
@@ -83,6 +83,7 @@
   void DoGather (TypeId tid);
   void RecordOutput (TypeId tid);
   bool HasAlreadyBeenProcessed (TypeId tid) const;
+  void find_and_replace (std::string &source, const std::string find, std::string replace );
   std::vector<std::pair<TypeId,std::string> > m_output;
   std::vector<std::string> m_currentPath;
   std::vector<TypeId> m_alreadyProcessed;
@@ -174,62 +175,88 @@
       Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i);
       const PointerChecker *ptrChecker = dynamic_cast<const PointerChecker *> (PeekPointer (checker));
       if (ptrChecker != 0)
-	{
-	  TypeId pointee = ptrChecker->GetPointeeTypeId ();
-	  m_currentPath.push_back (tid.GetAttributeName (i));
-	  m_alreadyProcessed.push_back (tid);
-	  DoGather (pointee);
-	  m_alreadyProcessed.pop_back ();
-	  m_currentPath.pop_back ();
-	  continue;
-	}
+        {
+          TypeId pointee = ptrChecker->GetPointeeTypeId ();
+          m_currentPath.push_back (tid.GetAttributeName (i));
+          m_alreadyProcessed.push_back (tid);
+          DoGather (pointee);
+          m_alreadyProcessed.pop_back ();
+          m_currentPath.pop_back ();
+          continue;
+        }
       // attempt to cast to an object vector.
       const ObjectVectorChecker *vectorChecker = dynamic_cast<const ObjectVectorChecker *> (PeekPointer (checker));
       if (vectorChecker != 0)
-	{
-	  TypeId item = vectorChecker->GetItemTypeId ();
-	  m_currentPath.push_back (tid.GetAttributeName (i) + "/[i]");
-	  m_alreadyProcessed.push_back (tid);
-	  DoGather (item);
-	  m_alreadyProcessed.pop_back ();
-	  m_currentPath.pop_back ();
-	  continue;
-	}
+        {
+          TypeId item = vectorChecker->GetItemTypeId ();
+          m_currentPath.push_back (tid.GetAttributeName (i) + "/[i]");
+          m_alreadyProcessed.push_back (tid);
+          DoGather (item);
+          m_alreadyProcessed.pop_back ();
+          m_currentPath.pop_back ();
+          continue;
+        }
     }
   for (uint32_t j = 0; j < TypeId::GetRegisteredN (); j++)
     {
       TypeId child = TypeId::GetRegistered (j);
       if (child.IsChildOf (tid))
-	{
-	  m_currentPath.push_back ("$%" + child.GetName ());
-	  m_alreadyProcessed.push_back (tid);
-	  DoGather (child);
-	  m_alreadyProcessed.pop_back ();
-	  m_currentPath.pop_back ();
-	}
+        {
+          //please take a look at the following note for an explanation 
+          std::string childName = "$%" + child.GetName ();
+          find_and_replace(childName,"::","::%");
+          m_currentPath.push_back (childName);
+          m_alreadyProcessed.push_back (tid);
+          DoGather (child);
+          m_alreadyProcessed.pop_back ();
+          m_currentPath.pop_back ();
+        }
     }
   for (uint32_t k = 0; k < m_aggregates.size (); ++k)
     {
       std::pair<TypeId,TypeId> tmp = m_aggregates[k];
       if (tmp.first == tid || tmp.second == tid)
-	{
-	  TypeId other;
-	  if (tmp.first == tid)
-	    {
-	      other = tmp.second;
-	    }
-	  if (tmp.second == tid)
-	    {
-	      other = tmp.first;
-	    }
-	  // Note: we insert a % in the path below to ensure that doxygen does not
-	  // attempt to resolve the typeid names included in the string.
-	  m_currentPath.push_back ("$%" + other.GetName ());
-	  m_alreadyProcessed.push_back (tid);
-	  DoGather (other);
-	  m_alreadyProcessed.pop_back ();
-	  m_currentPath.pop_back ();	  
-	}
+        {
+          TypeId other;
+          if (tmp.first == tid)
+            {
+              other = tmp.second;
+            }
+          if (tmp.second == tid)
+            {
+              other = tmp.first;
+            }
+          /**
+           * Note: we insert a % in the path below to ensure that doxygen does not
+           * attempt to resolve the typeid names included in the string.
+           * if the name contains ::, using the % sign will remove that sign
+           * resulting for instance in $ns3MobilityModel instead of $ns3::MobilityModel
+           * hence the output must be in the form $%ns3::%MobilityModel in order to
+           * show correctly $ns3::MobilityModel
+           * We add at the beginning of the name $% and we replace all the :: in the
+           * string by ::%.
+           */  
+          std::string name = "$%" + other.GetName ();
+          //finding and replacing :: by ::%
+          find_and_replace(name,"::","::%");
+          m_currentPath.push_back (name);
+          m_alreadyProcessed.push_back (tid);
+          DoGather (other);
+          m_alreadyProcessed.pop_back ();
+          m_currentPath.pop_back ();	  
+        }
+    }
+}
+
+void 
+StaticInformation::find_and_replace( std::string &source, const std::string find, std::string replace )
+{
+  size_t j; 
+  j = source.find (find);
+  while (j != std::string::npos ) 
+    {
+      source.replace (j, find.length (),replace);
+      j = source.find (find,j+1);
     }
 }
 
@@ -375,7 +402,7 @@
     {
       StringValue val;
       (*i)->GetValue (val);
-      std::cout << "  <li><b>" << (*i)->GetName () << "</b>: " << (*i)->GetHelp () << "(" << val.Get () << ")</li>" << std::endl;
+      std::cout << "  <li><b>\\anchor GlobalValue" << (*i)->GetName () << " " << (*i)->GetName () << "</b>: " << (*i)->GetHelp () << "(" << val.Get () << ")</li>" << std::endl;
     }
   std::cout << "</ul>" << std::endl
 	    << "*/" << std::endl;
--- a/wscript	Wed Jul 01 21:54:24 2009 +0400
+++ b/wscript	Fri Jul 03 09:59:04 2009 +0400
@@ -60,6 +60,30 @@
 srcdir = '.'
 blddir = 'build'
 
+def load_env():
+    bld_cls = getattr(Utils.g_module, 'build_context', Utils.Context)
+    bld_ctx = bld_cls()
+    bld_ctx.load_dirs(os.path.abspath(os.path.join (srcdir,'..')),
+                      os.path.abspath(os.path.join (srcdir,'..', blddir)))
+    bld_ctx.load_envs()
+    env = bld_ctx.get_env()
+    return env
+
+def get_files(base_dir):
+    retval = []
+    reference=os.path.dirname(base_dir)
+    for root, dirs, files in os.walk(base_dir):
+        if root.find('.hg') != -1:
+            continue
+        for file in files:
+            if file.find('.hg') != -1:
+                continue
+            fullname = os.path.join(root,file)
+            # we can't use os.path.relpath because it's new in python 2.6
+            relname = fullname.replace(reference + '/','')
+            retval.append([fullname,relname])
+    return retval
+
 
 def dist_hook():
     import tarfile
@@ -69,18 +93,19 @@
 
     ## build the name of the traces subdirectory.  Will be something like
     ## ns-3-dev-ref-traces
-    traces_name = APPNAME + '-' + VERSION + regression.REGRESSION_SUFFIX
+    traces_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX
     ## Create a tar.bz2 file with the traces
-    traces_dir = os.path.join(regression.REGRESSION_DIR, traces_name)
-    if not os.path.isdir(traces_dir):
-        Logs.warn("Not creating traces archive: the %s directory does not exist" % traces_dir)
+    env = load_env()
+    regression_dir = env['REGRESSION_TRACES']
+    if not os.path.isdir(regression_dir):
+        Logs.warn("Not creating traces archive: the %s directory does not exist" % regression_dir)
     else:
         traceball = traces_name + wutils.TRACEBALL_SUFFIX
         tar = tarfile.open(os.path.join("..", traceball), 'w:bz2')
-        tar.add(traces_dir)
+        files = get_files(regression_dir)
+        for fullfilename,relfilename in files:
+            tar.add(fullfilename,arcname=relfilename)
         tar.close()
-        ## Now remove it; we do not ship the traces with the main tarball...
-        shutil.rmtree(traces_dir, True)
 
 def set_options(opt):
     # options provided by the modules
@@ -209,24 +234,24 @@
         pass
     conf.check_tool('command')
 
-    # create the second environment, set the variant and set its name
-    variant_env = conf.env.copy()
-    variant_name = Options.options.build_profile
-
     # Check for the location of regression reference traces
     if Options.options.regression_traces is not None:
         if os.path.isdir(Options.options.regression_traces):
             conf.check_message("regression traces location", '', True, ("%s (given)" % Options.options.regression_traces))
-            variant_env['REGRESSION_TRACES'] = os.path.abspath(Options.options.regression_traces)
+            conf.env['REGRESSION_TRACES'] = os.path.abspath(Options.options.regression_traces)
     else:
         traces = os.path.join('..', "%s-%s%s" % (APPNAME, VERSION, REGRESSION_SUFFIX))
         if os.path.isdir(traces):
             conf.check_message("regression reference traces", '', True, ("%s (guessed)" % traces))
-            variant_env['REGRESSION_TRACES'] = os.path.abspath(traces)
+            conf.env['REGRESSION_TRACES'] = os.path.abspath(traces)
         del traces
-    if not variant_env['REGRESSION_TRACES']:
+    if not conf.env['REGRESSION_TRACES']:
         conf.check_message("regression reference traces", '', False)
 
+    # create the second environment, set the variant and set its name
+    variant_env = conf.env.copy()
+    variant_name = Options.options.build_profile
+
     if Options.options.enable_gcov:
         variant_name += '-gcov'
         variant_env.append_value('CCFLAGS', '-fprofile-arcs')
@@ -707,12 +732,14 @@
         return Task.RUN_ME
 
     def run(self):
-        failed = 0
+        failed_tasks = []
         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)
+                failed_tasks.append(task)
+        if failed_tasks:
+            print "C++ UNIT TESTS: %i tests passed, %i failed (%s)." % \
+                (len(self.test_tasks) - len(failed_tasks), len(failed_tasks),
+                 ', '.join(t.name_of_test for t in failed_tasks))
             return 1
         else:
             print "C++ UNIT TESTS: all %i tests passed." % (len(self.test_tasks),)
--- a/wutils.py	Wed Jul 01 21:54:24 2009 +0400
+++ b/wutils.py	Fri Jul 03 09:59:04 2009 +0400
@@ -136,7 +136,15 @@
         if retval == 0 and error:
             retval = 1
     else:
-        retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+        try:
+            WindowsError
+        except NameError:
+            retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+        else:
+            try:
+                retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
+            except WindowsError, ex:
+                raise Utils.WafError("Command %s raised exception %s" % (argv, ex))
     if retval:
         raise Utils.WafError("Command %s exited with code %i" % (argv, retval))
     return retval
@@ -151,6 +159,7 @@
 
     if command_template in (None, '%s'):
         argv = shlex.split(program_string)
+        #print "%r ==shlex.split==> %r" % (program_string, argv)
         program_name = argv[0]
 
         try:
@@ -180,7 +189,9 @@
         #except AttributeError:
         #    raise Utils.WafError("%s does not appear to be a program" % (program_name,))
 
-        execvec = shlex.split(command_template % (program_node.abspath(env),))
+        tmpl = command_template % (program_node.abspath(env),)
+        execvec = shlex.split(tmpl.replace('\\', '\\\\'))
+        #print "%r ==shlex.split==> %r" % (command_template % (program_node.abspath(env),), execvec)
     return program_name, execvec
 
 def run_program(program_string, env, command_template=None, cwd=None):