remove external NetDeviceList and use the Node's integrated list
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 30 Apr 2007 10:21:49 +0200
changeset 448 a0f005b96cfc
parent 447 180117abfb04
child 449 56d307a88918
remove external NetDeviceList and use the Node's integrated list
SConstruct
src/devices/p2p/p2p-topology.cc
src/node/internet-node.cc
src/node/internet-node.h
src/node/net-device-list.cc
src/node/net-device-list.h
src/node/node.cc
src/node/node.h
--- a/SConstruct	Mon Apr 30 10:16:04 2007 +0200
+++ b/SConstruct	Mon Apr 30 10:21:49 2007 +0200
@@ -213,7 +213,6 @@
     'ipv4-loopback-interface.cc',
     'llc-snap-header.cc',
     'header-utils.cc',
-    'net-device-list.cc',
     'queue.cc',
     'drop-tail.cc',
     'channel.cc',
@@ -235,7 +234,6 @@
     'ipv4-loopback-interface.h',
     'l3-demux.h',
     'ipv4-l4-demux.h',
-    'net-device-list.h',
     'header-utils.h',
     'protocol.h',
     'queue.h',
@@ -247,7 +245,6 @@
     'datagram-socket.h',
     'ipv4-address.h',
     'net-device.h',
-    'net-device-list.h',
     'ipv4-interface.h',
     'mac-address.h',
     'ipv4.h',
--- a/src/devices/p2p/p2p-topology.cc	Mon Apr 30 10:16:04 2007 +0200
+++ b/src/devices/p2p/p2p-topology.cc	Mon Apr 30 10:21:49 2007 +0200
@@ -31,7 +31,6 @@
 #include "ns3/ipv4-address.h"
 #include "ns3/drop-tail.h"
 #include "ns3/ipv4.h"
-#include "ns3/net-device-list.h"
 
 #include "p2p-channel.h"
 #include "p2p-net-device.h"
@@ -50,11 +49,6 @@
   const DataRate& bps,
   const Time& delay)
 {
-  // First get the NetDeviceList capability from each node
-  NetDeviceList* ndl1 = n1->GetNetDeviceList();
-  NetDeviceList* ndl2 = n2->GetNetDeviceList();
-  if (!ndl1 || !ndl2) return nil;  // Both ends must have NetDeviceList
-
   // Duplex link is assumed to be subnetted as a /30
   // May run this unnumbered in the future?
   Ipv4Mask netmask("255.255.255.252");
@@ -65,7 +59,7 @@
 
   PointToPointNetDevice* net1 = new PointToPointNetDevice(n1);
   net1->AddQueue(Queue::Default().Copy());
-  ndl1->Add(net1);
+  n1->AddDevice (net1);
   Ipv4 *ip1 = n1->GetIpv4 ();
   uint32_t index1 = ip1->AddInterface (net1);
   net1->Attach (channel);
@@ -76,7 +70,7 @@
 
   PointToPointNetDevice* net2 = new PointToPointNetDevice(n2);
   net2->AddQueue(Queue::Default().Copy());
-  ndl2->Add(net2);
+  n2->AddDevice (net2);
   Ipv4 *ip2 = n2->GetIpv4 ();
   uint32_t index2 = ip2->AddInterface (net2);
   net2->Attach (channel);
--- a/src/node/internet-node.cc	Mon Apr 30 10:16:04 2007 +0200
+++ b/src/node/internet-node.cc	Mon Apr 30 10:21:49 2007 +0200
@@ -44,7 +44,6 @@
 InternetNode::InternetNode()
 {
   // Instantiate the capabilities
-  m_netDevices = new NetDeviceList();
   m_applicationList = new ApplicationList();
   m_l3Demux = new L3Demux(this);
   m_ipv4L4Demux = new Ipv4L4Demux(this);
@@ -55,7 +54,6 @@
 
 InternetNode::InternetNode (InternetNode const &o)
 {
-  m_netDevices = new NetDeviceList ();
   m_applicationList = new ApplicationList();
   m_l3Demux = o.m_l3Demux->Copy (this);
   m_ipv4L4Demux = o.m_ipv4L4Demux->Copy (this);
@@ -63,11 +61,9 @@
 InternetNode const &
 InternetNode::operator = (InternetNode const &o)
 {
-  delete m_netDevices;
   delete m_applicationList;
   delete m_l3Demux;
   delete m_ipv4L4Demux;
-  m_netDevices = new NetDeviceList ();
   m_l3Demux = o.m_l3Demux->Copy (this);
   m_ipv4L4Demux = o.m_ipv4L4Demux->Copy (this);
   return *this;
@@ -75,7 +71,6 @@
 
 InternetNode::~InternetNode ()
 {
-  delete m_netDevices;
   delete m_applicationList;
   delete m_l3Demux;
   delete m_ipv4L4Demux;
@@ -112,12 +107,6 @@
 }
 
 
-NetDeviceList*   
-InternetNode::GetNetDeviceList() const
-{
-  return m_netDevices;
-}
-
 ApplicationList* 
 InternetNode::GetApplicationList() const
 { 
--- a/src/node/internet-node.h	Mon Apr 30 10:16:04 2007 +0200
+++ b/src/node/internet-node.h	Mon Apr 30 10:21:49 2007 +0200
@@ -47,7 +47,6 @@
   virtual InternetNode* Copy() const;
   virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
   // Capability access
-  virtual NetDeviceList*   GetNetDeviceList() const;
   virtual ApplicationList* GetApplicationList() const;
   virtual L3Demux*         GetL3Demux() const;
   virtual Ipv4L4Demux*     GetIpv4L4Demux() const;
@@ -59,7 +58,6 @@
 private:
   virtual void DoAddDevice (NetDevice *device) const;
   // Capabilities
-  NetDeviceList*   m_netDevices;
   ApplicationList* m_applicationList;
   L3Demux*         m_l3Demux;
   Ipv4L4Demux*     m_ipv4L4Demux;
--- a/src/node/net-device-list.cc	Mon Apr 30 10:16:04 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-// All rights reserved.
-//
-// 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>
-//
-// Manages the list of network device interfaces associated with a node.
-// George F. Riley, Georgia Tech, Spring 2007
-
-#include "net-device-list.h"
-
-namespace ns3 {
-
-NetDeviceList::NetDeviceList()
-{}
-NetDeviceList::~NetDeviceList()
-{
-  // XXX shall I delete each NetDevice ?
-}
-void
-NetDeviceList::Add(NetDevice *device)
-{
-  m_netdevices.push_back (device);
-}
-NetDeviceList::Iterator 
-NetDeviceList::Begin () const
-{
-  return m_netdevices.begin ();
-}
-NetDeviceList::Iterator 
-NetDeviceList::End () const
-{
-  return m_netdevices.end ();
-}
-
-}//namespace ns3
--- a/src/node/net-device-list.h	Mon Apr 30 10:16:04 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-// All rights reserved.
-//
-// 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>
-//
-// Manages the list of network device interfaces associated with a node.
-// George F. Riley, Georgia Tech, Spring 2007
-
-#ifndef NET_DEVICE_LIST_H
-#define NET_DEVICE_LIST_H
-
-#include <vector>
-
-namespace ns3{
-
-class NetDevice;
-
-class NetDeviceList {
-public:
-  typedef std::vector<NetDevice *>::const_iterator Iterator;
-
-  NetDeviceList();
-  ~NetDeviceList();
-  // Manage the list
-  void Add(NetDevice *device);
-  NetDeviceList::Iterator Begin () const;
-  NetDeviceList::Iterator End () const;
-public:
-  typedef std::vector<NetDevice *> NetDevices_t;
-  NetDevices_t m_netdevices;
-};
-
-} //namespace ns3
-#endif
-
--- a/src/node/node.cc	Mon Apr 30 10:16:04 2007 +0200
+++ b/src/node/node.cc	Mon Apr 30 10:21:49 2007 +0200
@@ -148,12 +148,6 @@
   return 0;
 }
 
-NetDeviceList*
-Node::GetNetDeviceList() const
-{
-  return 0;
-}
-
 Ipv4 *
 Node::GetIpv4 (void) const
 {
--- a/src/node/node.h	Mon Apr 30 10:16:04 2007 +0200
+++ b/src/node/node.h	Mon Apr 30 10:21:49 2007 +0200
@@ -88,7 +88,6 @@
 
 class NodeList;
 
-class NetDeviceList;
 class ApplicationList;
 
 // The below five may be encapsulated/abstracted in a Kernel or Stack class
@@ -180,7 +179,6 @@
   // null capability exists.
   virtual L3Demux*         GetL3Demux() const;
   virtual Ipv4L4Demux*     GetIpv4L4Demux() const;
-  virtual NetDeviceList*   GetNetDeviceList() const;
   virtual ApplicationList* GetApplicationList() const;
   virtual Ipv4 *           GetIpv4 (void) const;
   virtual Udp *            GetUdp (void) const;