bug 282: remove Ipv4L4Demux
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 02 Sep 2008 17:20:32 -0700
changeset 3588ad0a36bfdb62
parent 3587 53e2e87aebd0
child 3589 701de46de742
bug 282: remove Ipv4L4Demux
bindings/python/ns3_module_helper.py
bindings/python/ns3_module_internet_stack.py
bindings/python/ns3_module_wifi.py
src/internet-stack/internet-stack.cc
src/internet-stack/ipv4-l3-protocol.cc
src/internet-stack/ipv4-l3-protocol.h
src/internet-stack/ipv4-l4-demux.cc
src/internet-stack/ipv4-l4-demux.h
src/internet-stack/ipv4-l4-protocol.cc
src/internet-stack/ipv4-l4-protocol.h
src/internet-stack/tcp-l4-protocol.cc
src/internet-stack/tcp-l4-protocol.h
src/internet-stack/tcp-socket-impl.cc
src/internet-stack/udp-l4-protocol.cc
src/internet-stack/udp-l4-protocol.h
src/internet-stack/udp-socket-impl.cc
src/internet-stack/wscript
utils/print-introspected-doxygen.cc
     1.1 --- a/bindings/python/ns3_module_helper.py	Tue Sep 02 15:17:54 2008 -0700
     1.2 +++ b/bindings/python/ns3_module_helper.py	Tue Sep 02 17:20:32 2008 -0700
     1.3 @@ -168,6 +168,10 @@
     1.4      cls.add_method('Install', 
     1.5                     'void', 
     1.6                     [param('ns3::NodeContainer', 'c')])
     1.7 +    ## internet-stack-helper.h: void ns3::InternetStackHelper::SetNscStack(std::string soname) [member function]
     1.8 +    cls.add_method('SetNscStack', 
     1.9 +                   'void', 
    1.10 +                   [param('std::string', 'soname')])
    1.11      ## internet-stack-helper.h: static void ns3::InternetStackHelper::EnablePcapAll(std::string filename) [member function]
    1.12      cls.add_method('EnablePcapAll', 
    1.13                     'void', 
     2.1 --- a/bindings/python/ns3_module_internet_stack.py	Tue Sep 02 15:17:54 2008 -0700
     2.2 +++ b/bindings/python/ns3_module_internet_stack.py	Tue Sep 02 17:20:32 2008 -0700
     2.3 @@ -343,8 +343,6 @@
     2.4  def register_Ns3Ipv4L3Protocol_methods(root_module, cls):
     2.5      ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::PROT_NUMBER [variable]
     2.6      cls.add_static_attribute('PROT_NUMBER', 'uint16_t const', is_const=True)
     2.7 -    ## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::Ipv4L3Protocol(ns3::Ipv4L3Protocol const & arg0) [copy constructor]
     2.8 -    cls.add_constructor([param('ns3::Ipv4L3Protocol const &', 'arg0')])
     2.9      ## ipv4-l3-protocol.h: static ns3::TypeId ns3::Ipv4L3Protocol::GetTypeId() [member function]
    2.10      cls.add_method('GetTypeId', 
    2.11                     'ns3::TypeId', 
    2.12 @@ -356,6 +354,18 @@
    2.13      cls.add_method('SetNode', 
    2.14                     'void', 
    2.15                     [param('ns3::Ptr< ns3::Node >', 'node')])
    2.16 +    ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Insert(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
    2.17 +    cls.add_method('Insert', 
    2.18 +                   'void', 
    2.19 +                   [param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
    2.20 +    ## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4L4Protocol> ns3::Ipv4L3Protocol::GetProtocol(int protocolNumber) [member function]
    2.21 +    cls.add_method('GetProtocol', 
    2.22 +                   'ns3::Ptr< ns3::Ipv4L4Protocol >', 
    2.23 +                   [param('int', 'protocolNumber')])
    2.24 +    ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Remove(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
    2.25 +    cls.add_method('Remove', 
    2.26 +                   'void', 
    2.27 +                   [param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
    2.28      ## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultTtl(uint8_t ttl) [member function]
    2.29      cls.add_method('SetDefaultTtl', 
    2.30                     'void', 
    2.31 @@ -627,6 +637,10 @@
    2.32      module.add_function('AddInternetStack', 
    2.33                          'void', 
    2.34                          [param('ns3::Ptr< ns3::Node >', 'node')])
    2.35 +    ## internet-stack.h: extern void ns3::AddNscInternetStack(ns3::Ptr<ns3::Node> node, std::string const & soname) [free function]
    2.36 +    module.add_function('AddNscInternetStack', 
    2.37 +                        'void', 
    2.38 +                        [param('ns3::Ptr< ns3::Node >', 'node'), param('std::string const &', 'soname')])
    2.39      register_functions_ns3_internal(module.get_submodule('internal'), root_module)
    2.40      register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
    2.41      register_functions_ns3_Config(module.get_submodule('Config'), root_module)
     3.1 --- a/bindings/python/ns3_module_wifi.py	Tue Sep 02 15:17:54 2008 -0700
     3.2 +++ b/bindings/python/ns3_module_wifi.py	Tue Sep 02 17:20:32 2008 -0700
     3.3 @@ -675,8 +675,8 @@
     3.4      cls.add_constructor([param('ns3::Ssid const &', 'arg0')])
     3.5      ## ssid.h: ns3::Ssid::Ssid() [constructor]
     3.6      cls.add_constructor([])
     3.7 -    ## ssid.h: ns3::Ssid::Ssid(char const * ssid) [constructor]
     3.8 -    cls.add_constructor([param('char const *', 'ssid')])
     3.9 +    ## ssid.h: ns3::Ssid::Ssid(std::string s) [constructor]
    3.10 +    cls.add_constructor([param('std::string', 's')])
    3.11      ## ssid.h: ns3::Ssid::Ssid(char const * ssid, uint8_t length) [constructor]
    3.12      cls.add_constructor([param('char const *', 'ssid'), param('uint8_t', 'length')])
    3.13      ## ssid.h: ns3::Buffer::Iterator ns3::Ssid::Deserialize(ns3::Buffer::Iterator i) [member function]
     4.1 --- a/src/internet-stack/internet-stack.cc	Tue Sep 02 15:17:54 2008 -0700
     4.2 +++ b/src/internet-stack/internet-stack.cc	Tue Sep 02 17:20:32 2008 -0700
     4.3 @@ -23,7 +23,6 @@
     4.4  #include "ns3/node.h"
     4.5  #include "ns3/core-config.h"
     4.6  
     4.7 -#include "ipv4-l4-demux.h"
     4.8  #include "udp-l4-protocol.h"
     4.9  #include "tcp-l4-protocol.h"
    4.10  #include "ipv4-l3-protocol.h"
    4.11 @@ -48,22 +47,22 @@
    4.12  }
    4.13  
    4.14  static void
    4.15 -AddUdpStack(Ptr<Node> node, Ptr<Ipv4L4Demux> ipv4L4Demux)
    4.16 +AddUdpStack(Ptr<Node> node, Ptr<Ipv4L3Protocol> ipv4)
    4.17  {
    4.18    Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
    4.19    udp->SetNode (node);
    4.20 -  ipv4L4Demux->Insert (udp);
    4.21 +  ipv4->Insert (udp);
    4.22    Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
    4.23    udpFactory->SetUdp (udp);
    4.24    node->AggregateObject (udpFactory);
    4.25  }
    4.26  
    4.27  static void
    4.28 -AddTcpStack(Ptr<Node> node, Ptr<Ipv4L4Demux> ipv4L4Demux)
    4.29 +AddTcpStack(Ptr<Node> node, Ptr<Ipv4L3Protocol> ipv4)
    4.30  {
    4.31    Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
    4.32    tcp->SetNode (node);
    4.33 -  ipv4L4Demux->Insert (tcp);
    4.34 +  ipv4->Insert (tcp);
    4.35    Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
    4.36    tcpFactory->SetTcp (tcp);
    4.37    node->AggregateObject (tcpFactory);
    4.38 @@ -74,7 +73,6 @@
    4.39  {
    4.40    Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> ();
    4.41    ipv4Impl->SetIpv4 (ipv4);
    4.42 -  node->AggregateObject (ipv4);
    4.43    node->AggregateObject (ipv4Impl);
    4.44  }
    4.45  
    4.46 @@ -85,25 +83,22 @@
    4.47    Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
    4.48    ipv4->SetNode (node);
    4.49  
    4.50 -  Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> ();
    4.51 -  ipv4L4Demux->SetNode (node);
    4.52 -
    4.53 -  AddUdpStack (node, ipv4L4Demux);
    4.54 -  AddTcpStack (node, ipv4L4Demux);
    4.55 +  AddUdpStack (node, ipv4);
    4.56 +  AddTcpStack (node, ipv4);
    4.57  
    4.58    AddIpv4Impl (node, ipv4);
    4.59 -  node->AggregateObject (ipv4L4Demux);
    4.60 +  node->AggregateObject (ipv4);
    4.61  }
    4.62  
    4.63  
    4.64  #ifdef NETWORK_SIMULATION_CRADLE
    4.65  static void
    4.66 -AddNscStack(Ptr<Node> node, Ptr<Ipv4L4Demux> ipv4L4Demux, const std::string &soname)
    4.67 +AddNscStack(Ptr<Node> node, Ptr<Ipv4L3Protocol> ipv4, const std::string &soname)
    4.68  {
    4.69    Ptr<NscTcpL4Protocol> tcp = CreateObject<NscTcpL4Protocol> ();
    4.70    tcp->SetNscLibrary(soname);
    4.71    tcp->SetNode (node);
    4.72 -  ipv4L4Demux->Insert (tcp);
    4.73 +  ipv4->Insert (tcp);
    4.74    Ptr<NscTcpSocketFactoryImpl> tcpFactory = CreateObject<NscTcpSocketFactoryImpl> ();
    4.75    tcpFactory->SetTcp (tcp);
    4.76    node->AggregateObject (tcpFactory);
    4.77 @@ -117,14 +112,10 @@
    4.78    Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
    4.79    ipv4->SetNode (node);
    4.80  
    4.81 -  Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> ();
    4.82 -  ipv4L4Demux->SetNode (node);
    4.83 -
    4.84 -  AddUdpStack (node, ipv4L4Demux);
    4.85 -  AddNscStack (node, ipv4L4Demux, soname);
    4.86 +  AddUdpStack (node, ipv4);
    4.87 +  AddNscStack (node, ipv4, soname);
    4.88  
    4.89    AddIpv4Impl (node, ipv4);
    4.90 -  node->AggregateObject (ipv4L4Demux);
    4.91  }
    4.92  #else
    4.93  void
     5.1 --- a/src/internet-stack/ipv4-l3-protocol.cc	Tue Sep 02 15:17:54 2008 -0700
     5.2 +++ b/src/internet-stack/ipv4-l3-protocol.cc	Tue Sep 02 17:20:32 2008 -0700
     5.3 @@ -38,7 +38,6 @@
     5.4  #include "ipv4-interface.h"
     5.5  #include "ipv4-loopback-interface.h"
     5.6  #include "arp-ipv4-interface.h"
     5.7 -#include "ipv4-l4-demux.h"
     5.8  
     5.9  NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol");
    5.10  
    5.11 @@ -92,6 +91,29 @@
    5.12  }
    5.13  
    5.14  void
    5.15 +Ipv4L3Protocol::Insert(Ptr<Ipv4L4Protocol> protocol)
    5.16 +{
    5.17 +  m_protocols.push_back (protocol);
    5.18 +}
    5.19 +Ptr<Ipv4L4Protocol>
    5.20 +Ipv4L3Protocol::GetProtocol(int protocolNumber)
    5.21 +{
    5.22 +  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
    5.23 +    {
    5.24 +      if ((*i)->GetProtocolNumber () == protocolNumber)
    5.25 +	{
    5.26 +	  return *i;
    5.27 +	}
    5.28 +    }
    5.29 +  return 0;
    5.30 +}
    5.31 +void
    5.32 +Ipv4L3Protocol::Remove (Ptr<Ipv4L4Protocol> protocol)
    5.33 +{
    5.34 +  m_protocols.remove (protocol);
    5.35 +}
    5.36 +
    5.37 +void
    5.38  Ipv4L3Protocol::SetNode (Ptr<Node> node)
    5.39  {
    5.40    m_node = node;
    5.41 @@ -102,6 +124,13 @@
    5.42  Ipv4L3Protocol::DoDispose (void)
    5.43  {
    5.44    NS_LOG_FUNCTION (this);
    5.45 +  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
    5.46 +    {
    5.47 +      (*i)->Dispose ();
    5.48 +      *i = 0;
    5.49 +    }
    5.50 +  m_protocols.clear ();
    5.51 +
    5.52    for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
    5.53      {
    5.54        Ptr<Ipv4Interface> interface = *i;
    5.55 @@ -699,8 +728,7 @@
    5.56  {
    5.57    NS_LOG_FUNCTION (this << p << &ip);
    5.58  
    5.59 -  Ptr<Ipv4L4Demux> demux = m_node->GetObject<Ipv4L4Demux> ();
    5.60 -  Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
    5.61 +  Ptr<Ipv4L4Protocol> protocol = GetProtocol (ip.GetProtocol ());
    5.62    protocol->Receive (p, ip.GetSource (), ip.GetDestination (), incomingInterface);
    5.63  }
    5.64  
     6.1 --- a/src/internet-stack/ipv4-l3-protocol.h	Tue Sep 02 15:17:54 2008 -0700
     6.2 +++ b/src/internet-stack/ipv4-l3-protocol.h	Tue Sep 02 17:20:32 2008 -0700
     6.3 @@ -40,6 +40,7 @@
     6.4  class Ipv4Header;
     6.5  class Ipv4Route;
     6.6  class Node;
     6.7 +class Ipv4L4Protocol;
     6.8  
     6.9  
    6.10  /**
    6.11 @@ -60,6 +61,35 @@
    6.12    void SetNode (Ptr<Node> node);
    6.13  
    6.14    /**
    6.15 +   * \param protocol a template for the protocol to add to this L4 Demux.
    6.16 +   * \returns the L4Protocol effectively added.
    6.17 +   *
    6.18 +   * Invoke Copy on the input template to get a copy of the input
    6.19 +   * protocol which can be used on the Node on which this L4 Demux 
    6.20 +   * is running. The new L4Protocol is registered internally as
    6.21 +   * a working L4 Protocol and returned from this method.
    6.22 +   * The caller does not get ownership of the returned pointer.
    6.23 +   */
    6.24 +  void Insert(Ptr<Ipv4L4Protocol> protocol);
    6.25 +  /**
    6.26 +   * \param protocolNumber number of protocol to lookup
    6.27 +   *        in this L4 Demux
    6.28 +   * \returns a matching L4 Protocol
    6.29 +   *
    6.30 +   * This method is typically called by lower layers
    6.31 +   * to forward packets up the stack to the right protocol.
    6.32 +   * It is also called from NodeImpl::GetUdp for example.
    6.33 +   */
    6.34 +  Ptr<Ipv4L4Protocol> GetProtocol(int protocolNumber);
    6.35 +  /**
    6.36 +   * \param protocol protocol to remove from this demux.
    6.37 +   *
    6.38 +   * The input value to this method should be the value
    6.39 +   * returned from the Ipv4L4Protocol::Insert method.
    6.40 +   */
    6.41 +  void Remove (Ptr<Ipv4L4Protocol> protocol);
    6.42 +
    6.43 +  /**
    6.44     * \param ttl default ttl to use
    6.45     *
    6.46     * When we need to send an ipv4 packet, we use this default
    6.47 @@ -187,12 +217,16 @@
    6.48    void ForwardUp (Ptr<Packet> p, Ipv4Header const&ip, Ptr<Ipv4Interface> incomingInterface);
    6.49    uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
    6.50    void SetupLoopback (void);
    6.51 +  Ipv4L3Protocol(const Ipv4L3Protocol &);
    6.52 +  Ipv4L3Protocol &operator = (const Ipv4L3Protocol &);
    6.53  
    6.54    typedef std::list<Ptr<Ipv4Interface> > Ipv4InterfaceList;
    6.55    typedef std::list<std::pair<Ipv4Address, Ipv4Address> > 
    6.56      Ipv4MulticastGroupList;
    6.57    typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList;
    6.58  
    6.59 +  typedef std::list<Ptr<Ipv4L4Protocol> > L4List_t;
    6.60 +  L4List_t m_protocols;
    6.61    Ipv4InterfaceList m_interfaces;
    6.62    uint32_t m_nInterfaces;
    6.63    uint8_t m_defaultTtl;
     7.1 --- a/src/internet-stack/ipv4-l4-demux.cc	Tue Sep 02 15:17:54 2008 -0700
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,97 +0,0 @@
     7.4 -// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
     7.5 -//
     7.6 -// Copyright (c) 2006 Georgia Tech Research Corporation
     7.7 -//
     7.8 -// This program is free software; you can redistribute it and/or modify
     7.9 -// it under the terms of the GNU General Public License version 2 as
    7.10 -// published by the Free Software Foundation;
    7.11 -//
    7.12 -// This program is distributed in the hope that it will be useful,
    7.13 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.15 -// GNU General Public License for more details.
    7.16 -//
    7.17 -// You should have received a copy of the GNU General Public License
    7.18 -// along with this program; if not, write to the Free Software
    7.19 -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    7.20 -//
    7.21 -// Author: George F. Riley<riley@ece.gatech.edu>
    7.22 -//
    7.23 -
    7.24 -// Define the layer 4 demultiplexer object for ns3.
    7.25 -// George F. Riley, Georgia Tech, Fall 2006
    7.26 -
    7.27 -#include <sstream>
    7.28 -#include "ns3/node.h"
    7.29 -#include "ns3/object-vector.h"
    7.30 -#include "ipv4-l4-demux.h"
    7.31 -#include "ipv4-l4-protocol.h"
    7.32 -
    7.33 -namespace ns3 {
    7.34 -
    7.35 -NS_OBJECT_ENSURE_REGISTERED (Ipv4L4Demux);
    7.36 -
    7.37 -TypeId 
    7.38 -Ipv4L4Demux::GetTypeId (void)
    7.39 -{
    7.40 -  static TypeId tid = TypeId ("ns3::Ipv4L4Demux")
    7.41 -    .SetParent<Object> ()
    7.42 -    .AddAttribute ("Protocols", "The set of protocols registered with this demux.",
    7.43 -                   ObjectVectorValue (),
    7.44 -                   MakeObjectVectorAccessor (&Ipv4L4Demux::m_protocols),
    7.45 -                   MakeObjectVectorChecker<Ipv4L4Protocol> ())
    7.46 -    ;
    7.47 -  return tid;
    7.48 -}
    7.49 -
    7.50 -Ipv4L4Demux::Ipv4L4Demux ()
    7.51 -{}
    7.52 -
    7.53 -Ipv4L4Demux::~Ipv4L4Demux()
    7.54 -{}
    7.55 -
    7.56 -void 
    7.57 -Ipv4L4Demux::SetNode (Ptr<Node> node)
    7.58 -{
    7.59 -  m_node = node;
    7.60 -}
    7.61 -
    7.62 -void
    7.63 -Ipv4L4Demux::DoDispose (void)
    7.64 -{
    7.65 -  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
    7.66 -    {
    7.67 -      (*i)->Dispose ();
    7.68 -      *i = 0;
    7.69 -    }
    7.70 -  m_protocols.clear ();
    7.71 -  m_node = 0;
    7.72 -  Object::DoDispose ();
    7.73 -}
    7.74 -
    7.75 -void
    7.76 -Ipv4L4Demux::Insert(Ptr<Ipv4L4Protocol> protocol)
    7.77 -{
    7.78 -  m_protocols.push_back (protocol);
    7.79 -}
    7.80 -Ptr<Ipv4L4Protocol>
    7.81 -Ipv4L4Demux::GetProtocol(int protocolNumber)
    7.82 -{
    7.83 -  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
    7.84 -    {
    7.85 -      if ((*i)->GetProtocolNumber () == protocolNumber)
    7.86 -	{
    7.87 -	  return *i;
    7.88 -	}
    7.89 -    }
    7.90 -  return 0;
    7.91 -}
    7.92 -void
    7.93 -Ipv4L4Demux::Remove (Ptr<Ipv4L4Protocol> protocol)
    7.94 -{
    7.95 -  m_protocols.remove (protocol);
    7.96 -}
    7.97 -
    7.98 -
    7.99 -
   7.100 -}//namespace ns3
     8.1 --- a/src/internet-stack/ipv4-l4-demux.h	Tue Sep 02 15:17:54 2008 -0700
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,88 +0,0 @@
     8.4 -// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
     8.5 -//
     8.6 -// Copyright (c) 2006 Georgia Tech Research Corporation
     8.7 -//
     8.8 -// This program is free software; you can redistribute it and/or modify
     8.9 -// it under the terms of the GNU General Public License version 2 as
    8.10 -// published by the Free Software Foundation;
    8.11 -//
    8.12 -// This program is distributed in the hope that it will be useful,
    8.13 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.15 -// GNU General Public License for more details.
    8.16 -//
    8.17 -// You should have received a copy of the GNU General Public License
    8.18 -// along with this program; if not, write to the Free Software
    8.19 -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.20 -//
    8.21 -// Author: George F. Riley<riley@ece.gatech.edu>
    8.22 -//
    8.23 -
    8.24 -// Define the layer 4 demultiplexer object for ns3.
    8.25 -// George F. Riley, Georgia Tech, Fall 2006
    8.26 -
    8.27 -#ifndef IPV4_L4_DEMUX_H
    8.28 -#define IPV4_L4_DEMUX_H
    8.29 -
    8.30 -#include <list>
    8.31 -#include "ns3/object.h"
    8.32 -#include "ns3/ptr.h"
    8.33 -
    8.34 -namespace ns3 {
    8.35 -
    8.36 -class Ipv4L4Protocol;
    8.37 -class Node;
    8.38 -
    8.39 -/**
    8.40 - * \brief L4 Ipv4 Demux
    8.41 - * 
    8.42 - * This class demultiplexes IP datagrams to the correct layer four protocol
    8.43 - * object.  This demux sits between IP and layer 4.
    8.44 - */
    8.45 -class Ipv4L4Demux : public Object
    8.46 -{
    8.47 -public:
    8.48 -  static TypeId GetTypeId (void);
    8.49 -  Ipv4L4Demux ();
    8.50 -  virtual ~Ipv4L4Demux();
    8.51 -
    8.52 -  void SetNode (Ptr<Node> node);
    8.53 -
    8.54 -  /**
    8.55 -   * \param protocol a template for the protocol to add to this L4 Demux.
    8.56 -   * \returns the L4Protocol effectively added.
    8.57 -   *
    8.58 -   * Invoke Copy on the input template to get a copy of the input
    8.59 -   * protocol which can be used on the Node on which this L4 Demux 
    8.60 -   * is running. The new L4Protocol is registered internally as
    8.61 -   * a working L4 Protocol and returned from this method.
    8.62 -   * The caller does not get ownership of the returned pointer.
    8.63 -   */
    8.64 -  void Insert(Ptr<Ipv4L4Protocol> protocol);
    8.65 -  /**
    8.66 -   * \param protocolNumber number of protocol to lookup
    8.67 -   *        in this L4 Demux
    8.68 -   * \returns a matching L4 Protocol
    8.69 -   *
    8.70 -   * This method is typically called by lower layers
    8.71 -   * to forward packets up the stack to the right protocol.
    8.72 -   * It is also called from NodeImpl::GetUdp for example.
    8.73 -   */
    8.74 -  Ptr<Ipv4L4Protocol> GetProtocol(int protocolNumber);
    8.75 -  /**
    8.76 -   * \param protocol protocol to remove from this demux.
    8.77 -   *
    8.78 -   * The input value to this method should be the value
    8.79 -   * returned from the Ipv4L4Protocol::Insert method.
    8.80 -   */
    8.81 -  void Remove (Ptr<Ipv4L4Protocol> protocol);
    8.82 -protected:
    8.83 -  virtual void DoDispose (void);
    8.84 -private:
    8.85 -  typedef std::list<Ptr<Ipv4L4Protocol> > L4List_t;
    8.86 -  L4List_t m_protocols;
    8.87 -  Ptr<Node> m_node;
    8.88 -};
    8.89 -
    8.90 -} //namespace ns3
    8.91 -#endif
     9.1 --- a/src/internet-stack/ipv4-l4-protocol.cc	Tue Sep 02 15:17:54 2008 -0700
     9.2 +++ b/src/internet-stack/ipv4-l4-protocol.cc	Tue Sep 02 17:20:32 2008 -0700
     9.3 @@ -37,10 +37,6 @@
     9.4                     UintegerValue (0),
     9.5                     MakeUintegerAccessor (&Ipv4L4Protocol::GetProtocolNumber),
     9.6                     MakeUintegerChecker<int> ())
     9.7 -    .AddAttribute ("Version", "The version of the protocol.",
     9.8 -                   UintegerValue (0),
     9.9 -                   MakeUintegerAccessor (&Ipv4L4Protocol::GetVersion),
    9.10 -                   MakeUintegerChecker<int> ())
    9.11      ;
    9.12    return tid;
    9.13  }
    10.1 --- a/src/internet-stack/ipv4-l4-protocol.h	Tue Sep 02 15:17:54 2008 -0700
    10.2 +++ b/src/internet-stack/ipv4-l4-protocol.h	Tue Sep 02 17:20:32 2008 -0700
    10.3 @@ -49,10 +49,6 @@
    10.4     * \returns the protocol number of this protocol.
    10.5     */
    10.6    virtual int GetProtocolNumber (void) const = 0;
    10.7 -  /**
    10.8 -   * \returns the version number of this protocol.
    10.9 -   */
   10.10 -  virtual int GetVersion (void) const = 0;
   10.11  
   10.12    /**
   10.13     * \param p packet to forward up
    11.1 --- a/src/internet-stack/tcp-l4-protocol.cc	Tue Sep 02 15:17:54 2008 -0700
    11.2 +++ b/src/internet-stack/tcp-l4-protocol.cc	Tue Sep 02 17:20:32 2008 -0700
    11.3 @@ -361,11 +361,6 @@
    11.4  {
    11.5    return PROT_NUMBER;
    11.6  }
    11.7 -int 
    11.8 -TcpL4Protocol::GetVersion (void) const
    11.9 -{
   11.10 -  return 2;
   11.11 -}
   11.12  
   11.13  void
   11.14  TcpL4Protocol::DoDispose (void)
    12.1 --- a/src/internet-stack/tcp-l4-protocol.h	Tue Sep 02 15:17:54 2008 -0700
    12.2 +++ b/src/internet-stack/tcp-l4-protocol.h	Tue Sep 02 17:20:32 2008 -0700
    12.3 @@ -62,7 +62,6 @@
    12.4    void SetNode (Ptr<Node> node);
    12.5  
    12.6    virtual int GetProtocolNumber (void) const;
    12.7 -  virtual int GetVersion (void) const;
    12.8  
    12.9    /**
   12.10     * \return A smart Socket pointer to a TcpSocketImpl, allocated by this instance
    13.1 --- a/src/internet-stack/tcp-socket-impl.cc	Tue Sep 02 15:17:54 2008 -0700
    13.2 +++ b/src/internet-stack/tcp-socket-impl.cc	Tue Sep 02 17:20:32 2008 -0700
    13.3 @@ -26,7 +26,6 @@
    13.4  #include "tcp-socket-impl.h"
    13.5  #include "tcp-l4-protocol.h"
    13.6  #include "ipv4-end-point.h"
    13.7 -#include "ipv4-l4-demux.h"
    13.8  #include "ns3/simulation-singleton.h"
    13.9  #include "tcp-typedefs.h"
   13.10  #include "ns3/simulator.h"
    14.1 --- a/src/internet-stack/udp-l4-protocol.cc	Tue Sep 02 15:17:54 2008 -0700
    14.2 +++ b/src/internet-stack/udp-l4-protocol.cc	Tue Sep 02 17:20:32 2008 -0700
    14.3 @@ -77,11 +77,6 @@
    14.4  {
    14.5    return PROT_NUMBER;
    14.6  }
    14.7 -int 
    14.8 -UdpL4Protocol::GetVersion (void) const
    14.9 -{
   14.10 -  return 2;
   14.11 -}
   14.12  
   14.13  
   14.14  void
    15.1 --- a/src/internet-stack/udp-l4-protocol.h	Tue Sep 02 15:17:54 2008 -0700
    15.2 +++ b/src/internet-stack/udp-l4-protocol.h	Tue Sep 02 17:20:32 2008 -0700
    15.3 @@ -47,7 +47,6 @@
    15.4    void SetNode (Ptr<Node> node);
    15.5  
    15.6    virtual int GetProtocolNumber (void) const;
    15.7 -  virtual int GetVersion (void) const;
    15.8  
    15.9    /**
   15.10     * \return A smart Socket pointer to a UdpSocket, allocated by this instance
    16.1 --- a/src/internet-stack/udp-socket-impl.cc	Tue Sep 02 15:17:54 2008 -0700
    16.2 +++ b/src/internet-stack/udp-socket-impl.cc	Tue Sep 02 17:20:32 2008 -0700
    16.3 @@ -30,7 +30,6 @@
    16.4  #include "udp-socket-impl.h"
    16.5  #include "udp-l4-protocol.h"
    16.6  #include "ipv4-end-point.h"
    16.7 -#include "ipv4-l4-demux.h"
    16.8  
    16.9  NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl");
   16.10  
    17.1 --- a/src/internet-stack/wscript	Tue Sep 02 15:17:54 2008 -0700
    17.2 +++ b/src/internet-stack/wscript	Tue Sep 02 17:20:32 2008 -0700
    17.3 @@ -62,7 +62,6 @@
    17.4      obj = bld.create_ns3_module('internet-stack', ['node'])
    17.5      obj.source = [
    17.6          'internet-stack.cc',
    17.7 -        'ipv4-l4-demux.cc',
    17.8          'ipv4-l4-protocol.cc',
    17.9          'udp-header.cc',
   17.10          'tcp-header.cc',
    18.1 --- a/utils/print-introspected-doxygen.cc	Tue Sep 02 15:17:54 2008 -0700
    18.2 +++ b/utils/print-introspected-doxygen.cc	Tue Sep 02 17:20:32 2008 -0700
    18.3 @@ -241,7 +241,6 @@
    18.4    info.RecordAggregationInfo ("ns3::Node", "ns3::PacketSocketFactory");
    18.5    info.RecordAggregationInfo ("ns3::Node", "ns3::olsr::Agent");
    18.6    info.RecordAggregationInfo ("ns3::Node", "ns3::MobilityModel");
    18.7 -  info.RecordAggregationInfo ("ns3::Node", "ns3::Ipv4L4Demux");
    18.8    info.RecordAggregationInfo ("ns3::Node", "ns3::Ipv4L3Protocol");
    18.9    info.RecordAggregationInfo ("ns3::Node", "ns3::ArpL3Protocol");
   18.10