From 6d1fbb99fa619020dad136244645d7f847f2d708 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 30 Apr 2007 10:21:49 +0200 Subject: [PATCH] remove external NetDeviceList and use the Node's integrated list --- SConstruct | 3 -- src/devices/p2p/p2p-topology.cc | 10 ++----- src/node/internet-node.cc | 11 -------- src/node/internet-node.h | 2 -- src/node/net-device-list.cc | 50 --------------------------------- src/node/net-device-list.h | 50 --------------------------------- src/node/node.cc | 6 ---- src/node/node.h | 2 -- 8 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 src/node/net-device-list.cc delete mode 100644 src/node/net-device-list.h diff --git a/SConstruct b/SConstruct index 1f243a4a5..46006b023 100644 --- a/SConstruct +++ b/SConstruct @@ -213,7 +213,6 @@ node.add_sources ([ '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 @@ node.add_headers ([ '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 @@ node.add_inst_headers ([ 'datagram-socket.h', 'ipv4-address.h', 'net-device.h', - 'net-device-list.h', 'ipv4-interface.h', 'mac-address.h', 'ipv4.h', diff --git a/src/devices/p2p/p2p-topology.cc b/src/devices/p2p/p2p-topology.cc index 02e116f5a..1e76cec45 100644 --- a/src/devices/p2p/p2p-topology.cc +++ b/src/devices/p2p/p2p-topology.cc @@ -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 @@ PointToPointTopology::AddPointToPointLink( 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 @@ PointToPointTopology::AddPointToPointLink( 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 @@ PointToPointTopology::AddPointToPointLink( 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); diff --git a/src/node/internet-node.cc b/src/node/internet-node.cc index 44345c40e..2971cdbbf 100644 --- a/src/node/internet-node.cc +++ b/src/node/internet-node.cc @@ -44,7 +44,6 @@ public: 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::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::InternetNode (InternetNode const &o) 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::operator = (InternetNode const &o) InternetNode::~InternetNode () { - delete m_netDevices; delete m_applicationList; delete m_l3Demux; delete m_ipv4L4Demux; @@ -112,12 +107,6 @@ InternetNode::CreateTraceResolver (TraceContext const &context) } -NetDeviceList* -InternetNode::GetNetDeviceList() const -{ - return m_netDevices; -} - ApplicationList* InternetNode::GetApplicationList() const { diff --git a/src/node/internet-node.h b/src/node/internet-node.h index 1a7d3f20a..adc0caec4 100644 --- a/src/node/internet-node.h +++ b/src/node/internet-node.h @@ -47,7 +47,6 @@ public: 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 @@ public: private: virtual void DoAddDevice (NetDevice *device) const; // Capabilities - NetDeviceList* m_netDevices; ApplicationList* m_applicationList; L3Demux* m_l3Demux; Ipv4L4Demux* m_ipv4L4Demux; diff --git a/src/node/net-device-list.cc b/src/node/net-device-list.cc deleted file mode 100644 index 0d4e6d3e5..000000000 --- a/src/node/net-device-list.cc +++ /dev/null @@ -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 -// -// 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 diff --git a/src/node/net-device-list.h b/src/node/net-device-list.h deleted file mode 100644 index 7a1583893..000000000 --- a/src/node/net-device-list.h +++ /dev/null @@ -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 -// -// 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 - -namespace ns3{ - -class NetDevice; - -class NetDeviceList { -public: - typedef std::vector::const_iterator Iterator; - - NetDeviceList(); - ~NetDeviceList(); - // Manage the list - void Add(NetDevice *device); - NetDeviceList::Iterator Begin () const; - NetDeviceList::Iterator End () const; -public: - typedef std::vector NetDevices_t; - NetDevices_t m_netdevices; -}; - -} //namespace ns3 -#endif - diff --git a/src/node/node.cc b/src/node/node.cc index a0f95cc79..2e34fb8d5 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -148,12 +148,6 @@ ApplicationList* Node::GetApplicationList() const return 0; } -NetDeviceList* -Node::GetNetDeviceList() const -{ - return 0; -} - Ipv4 * Node::GetIpv4 (void) const { diff --git a/src/node/node.h b/src/node/node.h index 6a488c608..b48ab43af 100644 --- a/src/node/node.h +++ b/src/node/node.h @@ -88,7 +88,6 @@ namespace ns3 { class NodeList; -class NetDeviceList; class ApplicationList; // The below five may be encapsulated/abstracted in a Kernel or Stack class @@ -180,7 +179,6 @@ public: // 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;