diff --git a/src/devices/csma/csma-ipv4-topology.cc b/src/devices/csma/csma-ipv4-topology.cc deleted file mode 100644 index 1138c5334..000000000 --- a/src/devices/csma/csma-ipv4-topology.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2007 Emmanuelle Laprise -// -// 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: Emmanuelle Laprise -// - -#include -#include "ns3/assert.h" -#include "ns3/fatal-error.h" -#include "ns3/nstime.h" -#include "ns3/internet-node.h" -#include "ns3/ipv4-address.h" -#include "ns3/ipv4.h" -#include "ns3/queue.h" -#include "ns3/drop-tail-queue.h" -#include "ns3/string.h" - -#include "csma-channel.h" -#include "csma-net-device.h" -#include "csma-ipv4-topology.h" - -namespace ns3 { - -uint32_t -CsmaIpv4Topology::AddIpv4CsmaNetDevice( - Ptr node, - Ptr channel, - Mac48Address addr) -{ - Ptr q = CreateObject (); - - // assume full-duplex - Ptr nd = CreateObject ("Address", addr, - "EncapsulationMode", String ("IpArp")); - node->AddDevice (nd); - - nd->AddQueue(q); - nd->Attach (channel); - return nd->GetIfIndex (); -} - - -void -CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr n1, - Ptr ch, - Mac48Address addr) -{ - Ptr q = CreateObject (); - - Ptr nd0 = CreateObject ("Address", addr, - "EncapsulationMode", String ("Llc")); - n1->AddDevice (nd0); - nd0->SetSendEnable (true); - nd0->SetReceiveEnable (false); - nd0->AddQueue(q); - nd0->Attach (ch); - - Ptr nd1 = CreateObject ("Address", addr, - "EncapsulationMode", String ("Llc")); - n1->AddDevice (nd1); - nd1->SetSendEnable (false); - nd1->SetReceiveEnable (true); - nd1->AddQueue(q); - nd1->Attach (ch); -} - -void -CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr n1, - Ptr ch, - Mac48Address addr) -{ - Ptr q = CreateObject (); - - Ptr nd0 = CreateObject ("Address", addr, - "EncapsulationMode", String ("Raw")); - n1->AddDevice (nd0); - nd0->SetSendEnable (true); - nd0->SetReceiveEnable (false); - nd0->AddQueue(q); - nd0->Attach (ch); - - Ptr nd1 = CreateObject ("Address", addr, - "EncapsulationMode", String ("Raw")); - n1->AddDevice (nd1); - nd1->SetSendEnable (false); - nd1->SetReceiveEnable (true); - - nd1->AddQueue(q); - nd1->Attach (ch); -} - -uint32_t -CsmaIpv4Topology::AddIpv4Address( - Ptr node, - uint32_t netDeviceNumber, - const Ipv4Address address, - const Ipv4Mask mask, - uint16_t metric) -{ - Ptr nd = node->GetDevice(netDeviceNumber); - - Ptr ipv4 = node->GetObject (); - uint32_t ifIndex = ipv4->AddInterface (nd); - - ipv4->SetAddress (ifIndex, address); - ipv4->SetNetworkMask (ifIndex, mask); - ipv4->SetMetric (ifIndex, metric); - ipv4->SetUp (ifIndex); - return ifIndex; -} - -void -CsmaIpv4Topology::AddIpv4Routes ( - Ptr nd1, Ptr nd2) -{ - // Assert that both are Ipv4 nodes - Ptr ip1 = nd1->GetNode ()->GetObject (); - Ptr ip2 = nd2->GetNode ()->GetObject (); - NS_ASSERT(ip1 != 0 && ip2 != 0); - - // Get interface indexes for both nodes corresponding to the right channel - uint32_t index1 = 0; - bool found = false; - for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++) - { - if (ip1 ->GetNetDevice (i) == nd1) - { - index1 = i; - found = true; - } - } - NS_ASSERT (found); - - uint32_t index2 = 0; - found = false; - for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++) - { - if (ip2 ->GetNetDevice (i) == nd2) - { - index2 = i; - found = true; - } - } - NS_ASSERT (found); - - ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); - ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); -} - -} // namespace ns3 - diff --git a/src/devices/csma/csma-ipv4-topology.h b/src/devices/csma/csma-ipv4-topology.h deleted file mode 100644 index 2da75ac66..000000000 --- a/src/devices/csma/csma-ipv4-topology.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2007 Emmanuelle Laprise -// -// 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: Emmanuelle Laprise -// - -#ifndef __CSMA_IPV4_TOPOLOGY_H__ -#define __CSMA_IPV4_TOPOLOGY_H__ - -#include "ns3/ptr.h" -#include "ns3/ipv4-address.h" -#include "ns3/ipv4.h" -#include "ns3/ipv4-route.h" -#include "ns3/internet-node.h" -#include "ns3/csma-net-device.h" - -// The topology class consists of only static methods thar are used to -// create the topology and data flows for an ns3 simulation - -namespace ns3 { - -class CsmaIpv4Channel; -class Node; -class IPAddr; -class DataRate; -class Queue; - -/** - * \brief A helper class to create Topologies based on the - * InternetNodes and CsmaChannels. Either the - * SimpleCsmaNetDevice or the LLCCsmaNetDevice can be used - * when constructing these topologies. - */ -class CsmaIpv4Topology { -public: - - /** - * \param node Node to be attached to the Csma channel - * \param channel CsmaChannel to which node n1 should be attached - * \param addr Mac address of the node - * - * Add a Csma node to a Csma channel. This function adds - * a EthernetCsmaNetDevice to the nodes so that they can - * connect to a CsmaChannel. This means that Ethernet headers - * and trailers will be added to the packet before sending out on - * the net device. - * - * \return ifIndex of the device - */ - static uint32_t AddIpv4CsmaNetDevice(Ptr node, - Ptr channel, - Mac48Address addr); - - /** - * \param n1 Node to be attached to the Csma channel - * \param ch CsmaChannel to which node n1 should be attached - * \param addr Mac address of the node - * - * Add a Csma node to a Csma channel. This function adds - * a RawCsmaNetDevice to the nodes so that they can connect - * to a CsmaChannel. - */ - static void AddIpv4RawCsmaNode( Ptr n1, - Ptr ch, - Mac48Address addr); - - /** - * \param n1 Node to be attached to the Csma channel - * \param ch CsmaChannel to which node n1 should be attached - * \param addr Mac address of the node - * - * Add a Csma node to a Csma channel. This function adds - * a LlcCsmaNetDevice to the nodes so that they can connect - * to a CsmaChannel. - */ - static void AddIpv4LlcCsmaNode( Ptr n1, - Ptr ch, - Mac48Address addr); - - - - /** - * \brief Create an Ipv4 interface for a net device and assign an - * Ipv4Address to that interface. - * - * \param node The node to which to add the new address and corresponding - * interface. - * \param netDeviceNumber The NetDevice index number with which to associate - * the address. - * \param address The Ipv4 Address for the interface. - * \param mask The network mask for the interface - * \param metric (optional) metric (cost) to assign for routing calculations - * - * Add an Ipv4Address to the Ipv4 interface associated with the - * ndNum CsmaIpv4NetDevices on the provided CsmaIpv4Channel - */ - static uint32_t AddIpv4Address(Ptr node, - uint32_t netDeviceNumber, - const Ipv4Address address, - const Ipv4Mask mask, - uint16_t metric = 1); - - /** - * \param nd1 Node - * \param nd2 Node - * - * Add an IPV4 host route between the two specified net devices - */ - static void AddIpv4Routes (Ptr nd1, Ptr nd2); -}; - -} // namespace ns3 - -#endif - diff --git a/src/devices/csma/csma-topology.cc b/src/devices/csma/csma-topology.cc deleted file mode 100644 index c03ef68a9..000000000 --- a/src/devices/csma/csma-topology.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2007 Emmanuelle Laprise -// -// 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: Emmanuelle Laprise -// - -// -// Topology helper for Csma channels in ns3. - -#include "ns3/assert.h" -#include "ns3/queue.h" - -#include "csma-channel.h" -#include "csma-net-device.h" -#include "csma-topology.h" -#include "ns3/socket-factory.h" - -namespace ns3 { - -Ptr -CsmaTopology::CreateCsmaChannel( - const DataRate& bps, - const Time& delay) -{ - Ptr channel = CreateObject ("BitRate", bps, "Delay", delay); - - return channel; -} - -#if 0 -Ptr -CsmaTopology::AddCsmaEthernetNode( - Ptr n1, - Ptr ch, - Mac48Address addr) -{ - Ptr nd1 = CreateObject ("Address", addr, - "EncapsulationMode", "EthernetV1"); - - Ptr q = Queue::CreateDefault (); - nd1->AddQueue(q); - nd1->Attach (ch); - - return nd1; -} - -Ptr -CsmaTopology::ConnectPacketSocket(Ptr app, - Ptr ndSrc, - Ptr ndDest) -{ - Ptr socket = CreateObject (); - socket->Bind(ndSrc); - socket->Connect(ndDest->GetAddress()); - app->Connect(socket); - - return socket; -} - -Ptr -CsmaTopology::ConnectPacketSocket(Ptr app, - Ptr ndSrc, - MacAddress macAddr) -{ - Ptr socket = CreateObject (); - socket->Bind(ndSrc); - socket->Connect(macAddr); - app->Connect(socket); - - return socket; -} - -Ptr -CsmaTopology::CreatePacketSocket(Ptr n1, std::string tid_name) -{ - TypeId tid = TypeId::LookupByName (tid_name); - - Ptr socketFactory = - n1->GetObject (tid); - - Ptr socket = socketFactory->CreateSocket (); - - return socket; -} -#endif - -} // namespace ns3 - diff --git a/src/devices/csma/csma-topology.h b/src/devices/csma/csma-topology.h deleted file mode 100644 index e7e2fe065..000000000 --- a/src/devices/csma/csma-topology.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -// -// Copyright (c) 2007 Emmanuelle Laprise -// -// 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: Emmanuelle Laprise -// -// Topology helper for multipoint channels in ns3. -// -#ifndef CSMA_TOPOLOGY_H -#define CSMA_TOPOLOGY_H - -#include "ns3/ptr.h" -#include "ns3/csma-net-device.h" -#include "ns3/node.h" - -// The topology class consists of only static methods thar are used to -// create the topology and data flows for an ns3 simulation - -namespace ns3 { - -class CsmaChannel; -class Node; -class DataRate; -class Queue; - -/** - * \brief A helper class to create Csma Topologies - * - * Csma topologies are created based on the - * ns3::CsmaNetDevice subclasses and ns3::CsmaChannel - * objects. This class uses the EthernetNetDevice and - * PacketSocket classes in order to create logical connections between - * net devices. The PacketSocket class generates the data and the - * EthernetNetDevice class creates ethernet packets from the - * data, filling in source and destination addresses. The - * EthernetNetDevice class filters received data packets - * according to its destination Mac addresses. - */ -class CsmaTopology { -public: - /** - * \param dataRate Maximum transmission link rate - * \param delay propagation delay between any two nodes - * \return Pointer to the created CsmaChannel - * - * Create a CsmaChannel. All nodes connected to a multipoint - * channels will receive all packets written to that channel - */ - static Ptr CreateCsmaChannel( - const DataRate& dataRate, const Time& delay); - -#if 0 - /** - * \param n1 Node to be attached to the multipoint channel - * \param ch CsmaChannel to which node n1 should be attached - * \param addr MacAddress that should be assigned to the - * EthernetNetDevice that will be added to the node. - * - * Add a multipoint node to a multipoint channel - */ - static Ptr AddCsmaEthernetNode(Ptr n1, - Ptr ch, - MacAddress addr); - - /** - * \param app Application that will be sending data to the agent - * \param ndSrc Net Device that will be sending the packets onto the - * network - * \param ndDest Net Device to which ndSrc will be sending the packets - * \return A pointer to the PacketSocket - * - * Creates an PacketSocket and configure it to send packets between - * two net devices - */ -static Ptr ConnectPacketSocket(Ptr app, - Ptr ndSrc, - Ptr ndDest); - - /** - * \param app Application that will be sending data to the agent - * \param ndSrc Net Device that will be sending the packets onto the - * network - * \param macAddr Mac destination address for the packets send by - * the ndSrc net device \return a Pointer to the created - * PacketSocket - * - * Creates an PacketSocket and configure it to send packets from a - * net device to a destination MacAddress - */ -static Ptr ConnectPacketSocket(Ptr app, - Ptr ndSrc, - MacAddress macAddr); - - /** - * \param n1 Node from which socketfactory should be tested. - * \param tid_name Interface identifier ("ns3::PacketSocketFactory", in this case) - * - * This is a test function to make sure that a socket can be created - * by using the socketfactory interface provided in the - * netdevicenode. - */ -static Ptr CreatePacketSocket(Ptr n1, - std::string tid_name); -#endif - -}; -} // namespace ns3 - -#endif - diff --git a/src/devices/csma/wscript b/src/devices/csma/wscript index 60d8e6a8f..a90ac5bd3 100644 --- a/src/devices/csma/wscript +++ b/src/devices/csma/wscript @@ -6,8 +6,6 @@ def build(bld): 'backoff.cc', 'csma-net-device.cc', 'csma-channel.cc', - 'csma-topology.cc', - 'csma-ipv4-topology.cc', ] headers = bld.create_obj('ns3header') headers.module = 'csma' @@ -15,6 +13,4 @@ def build(bld): 'backoff.h', 'csma-net-device.h', 'csma-channel.h', - 'csma-topology.h', - 'csma-ipv4-topology.h', ] diff --git a/src/devices/point-to-point/point-to-point-topology.cc b/src/devices/point-to-point/point-to-point-topology.cc deleted file mode 100644 index 65aa1e649..000000000 --- a/src/devices/point-to-point/point-to-point-topology.cc +++ /dev/null @@ -1,252 +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 -// - -// -// Topology helper for ns3. -// George F. Riley, Georgia Tech, Spring 2007 - -#include -#include "ns3/assert.h" -#include "ns3/log.h" -#include "ns3/fatal-error.h" -#include "ns3/nstime.h" -#include "ns3/internet-node.h" -#include "ns3/ipv4-address.h" -#include "ns3/ipv4.h" -#include "ns3/queue.h" -#include "ns3/drop-tail-queue.h" - -#include "point-to-point-channel.h" -#include "point-to-point-net-device.h" -#include "point-to-point-topology.h" - -namespace ns3 { - -Ptr -PointToPointTopology::AddPointToPointLink( - Ptr n1, - Ptr n2, - const DataRate& bps, - const Time& delay) -{ - Ptr channel = CreateObject ("BitRate", bps, "Delay", delay); - - Ptr net1 = CreateObject ("Address", Mac48Address::Allocate ()); - n1->AddDevice (net1); - - Ptr q = CreateObject (); - net1->AddQueue(q); - net1->Attach (channel); - - Ptr net2 = CreateObject ("Address", Mac48Address::Allocate ()); - n2->AddDevice (net2); - - q = CreateObject (); - net2->AddQueue(q); - net2->Attach (channel); - - return channel; -} - -Ptr -PointToPointTopology::GetNetDevice (Ptr n, Ptr chan) -{ - Ptr found = 0; - - // The PointToPoint channel is used to find the relevant NetDevice - NS_ASSERT (chan->GetNDevices () == 2); - Ptr nd1 = chan->GetPointToPointDevice (0); - Ptr nd2 = chan->GetPointToPointDevice (1); - if ( nd1->GetNode ()->GetId () == n->GetId () ) - { - found = nd1; - } - else if ( nd2->GetNode ()->GetId () == n->GetId () ) - { - found = nd2; - } - else - { - NS_ASSERT (found); - } - return found; -} - -void -PointToPointTopology::AddIpv4Addresses( - Ptr chan, - Ptr n1, const Ipv4Address& addr1, - Ptr n2, const Ipv4Address& addr2) -{ - - // Duplex link is assumed to be subnetted as a /30 - // May run this unnumbered in the future? - Ipv4Mask netmask("255.255.255.252"); - NS_ASSERT (netmask.IsMatch(addr1,addr2)); - - // The PointToPoint channel is used to find the relevant NetDevices - NS_ASSERT (chan->GetNDevices () == 2); - Ptr nd1 = chan->GetDevice (0); - Ptr nd2 = chan->GetDevice (1); - // Make sure that nd1 belongs to n1 and nd2 to n2 - if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && - (nd2->GetNode ()->GetId () == n1->GetId () ) ) - { - std::swap(nd1, nd2); - } - NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); - NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); - - Ptr ip1 = n1->GetObject (); - uint32_t index1 = ip1->AddInterface (nd1); - - ip1->SetAddress (index1, addr1); - ip1->SetNetworkMask (index1, netmask); - ip1->SetUp (index1); - - Ptr ip2 = n2->GetObject (); - uint32_t index2 = ip2->AddInterface (nd2); - - ip2->SetAddress (index2, addr2); - ip2->SetNetworkMask (index2, netmask); - ip2->SetUp (index2); - -} - -void -PointToPointTopology::SetIpv4Metric( - Ptr chan, - Ptr n1, Ptr n2, uint16_t metric) -{ - - // The PointToPoint channel is used to find the relevant NetDevices - NS_ASSERT (chan->GetNDevices () == 2); - Ptr nd1 = chan->GetDevice (0); - Ptr nd2 = chan->GetDevice (1); - // Make sure that nd1 belongs to n1 and nd2 to n2 - if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && - (nd2->GetNode ()->GetId () == n1->GetId () ) ) - { - std::swap(nd1, nd2); - } - NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); - NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); - - // The NetDevice ifIndex does not correspond to the - // ifIndex used by Ipv4. Therefore, we have to iterate - // through the NetDevices until we find the Ipv4 ifIndex - // that corresponds to NetDevice nd1 - // Get interface indexes for both nodes corresponding to the right channel - uint32_t index = 0; - bool found = false; - Ptr ip1 = n1->GetObject (); - for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++) - { - if (ip1 ->GetNetDevice (i) == nd1) - { - index = i; - found = true; - } - } - NS_ASSERT(found); - ip1->SetMetric (index, metric); - - index = 0; - found = false; - Ptr ip2 = n2->GetObject (); - for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++) - { - if (ip2 ->GetNetDevice (i) == nd2) - { - index = i; - found = true; - } - } - NS_ASSERT(found); - ip2->SetMetric (index, metric); -} - -void -PointToPointTopology::AddIpv4Routes ( - Ptr n1, Ptr n2, Ptr chan) -{ - // The PointToPoint channel is used to find the relevant NetDevices - NS_ASSERT (chan->GetNDevices () == 2); - Ptr nd1 = chan->GetDevice (0); - Ptr nd2 = chan->GetDevice (1); - - // Assert that n1 is the Node owning one of the two NetDevices - // and make sure that nd1 corresponds to it - if (nd1->GetNode ()->GetId () == n1->GetId ()) - { - ; // Do nothing - } - else if (nd2->GetNode ()->GetId () == n1->GetId ()) - { - std::swap(nd1, nd2); - } - else - { - NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); - } - - // Assert that n2 is the Node owning one of the two NetDevices - // and make sure that nd2 corresponds to it - if (nd2->GetNode ()->GetId () != n2->GetId ()) - { - NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); - } - - // Assert that both are Ipv4 nodes - Ptr ip1 = nd1->GetNode ()->GetObject (); - Ptr ip2 = nd2->GetNode ()->GetObject (); - NS_ASSERT(ip1 != 0 && ip2 != 0); - - // Get interface indexes for both nodes corresponding to the right channel - uint32_t index1 = 0; - bool found = false; - for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++) - { - if (ip1 ->GetNetDevice (i) == nd1) - { - index1 = i; - found = true; - } - } - NS_ASSERT(found); - - uint32_t index2 = 0; - found = false; - for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++) - { - if (ip2 ->GetNetDevice (i) == nd2) - { - index2 = i; - found = true; - } - } - NS_ASSERT(found); - - ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1); - ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2); -} - -} // namespace ns3 - diff --git a/src/devices/point-to-point/point-to-point-topology.h b/src/devices/point-to-point/point-to-point-topology.h deleted file mode 100644 index c5b364a0e..000000000 --- a/src/devices/point-to-point/point-to-point-topology.h +++ /dev/null @@ -1,112 +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 -// -// Topology helper for ns3. -// George F. Riley, Georgia Tech, Spring 2007 -#ifndef __POINT_TO_POINT_TOPOLOGY_H__ -#define __POINT_TO_POINT_TOPOLOGY_H__ - -#include "ns3/ptr.h" - -// The topology class consists of only static methods thar are used to -// create the topology and data flows for an ns3 simulation - -namespace ns3 { - -class PointToPointChannel; -class Node; -class IPAddr; -class DataRate; -class Queue; - -/** - * \brief A helper class to create Topologies based on the - * ns3::PointToPointNetDevice and ns3::PointToPointChannel objects. - */ -class PointToPointTopology { -public: - /** - * \param n1 Node - * \param n2 Node - * \param dataRate Maximum transmission link rate - * \param delay one-way propagation delay - * \return Pointer to the underlying PointToPointChannel - * - * Add a full-duplex point-to-point link between two nodes - * and attach PointToPointNetDevices to the resulting - * PointToPointChannel. - */ - static Ptr AddPointToPointLink( - Ptr n1, Ptr n2, const DataRate& dataRate, const Time& delay); - - /** - * \param n Node - * \param chan PointToPointChannel connected to node n - * \return Pointer to the corresponding PointToPointNetDevice - * - * Utility function to retrieve a PointToPointNetDevice pointer - * corresponding to the input parameters - */ - static Ptr GetNetDevice( - Ptr n, Ptr chan); - - /** - * \param chan PointToPointChannel to use - * \param n1 Node - * \param addr1 Ipv4 Address for n1 - * \param n2 Node - * \param addr2 Ipv4 Address for n2 - * - * Add Ipv4Addresses to the Ipv4 interfaces associated with the - * two PointToPointNetDevices on the provided PointToPointChannel - */ - static void AddIpv4Addresses( - Ptr chan, - Ptr n1, const Ipv4Address& addr1, - Ptr n2, const Ipv4Address& addr2); - - /** - * \param chan PointToPointChannel to use - * \param n1 Node - * \param n2 Node - * \param metric link metric to assign on Ipv4Link on chan between n1 and n2 - * - * Add a non-unit-cost link metric (bidirectionally) to the Ipv4 - * interfaces associated with the two PointToPointNetDevices on the - * provided PointToPointChannel - */ - static void SetIpv4Metric( - Ptr chan, - Ptr n1, Ptr n2, uint16_t metric); - - /** - * \param channel PointToPointChannel to use - * \param n1 Node - * \param n2 Node - * - * For the given PointToPointChannel, for each Node, add an - * IPv4 host route to the IPv4 address of the peer node. - */ - static void AddIpv4Routes (Ptr n1, Ptr n2, Ptr channel); -}; - -} // namespace ns3 - -#endif - diff --git a/src/devices/point-to-point/wscript b/src/devices/point-to-point/wscript index 7ca9c15df..d7ad3005b 100644 --- a/src/devices/point-to-point/wscript +++ b/src/devices/point-to-point/wscript @@ -6,7 +6,6 @@ def build(bld): module.source = [ 'point-to-point-net-device.cc', 'point-to-point-channel.cc', - 'point-to-point-topology.cc', 'point-to-point-test.cc', ] headers = bld.create_obj('ns3header') @@ -14,6 +13,5 @@ def build(bld): headers.source = [ 'point-to-point-net-device.h', 'point-to-point-channel.h', - 'point-to-point-topology.h', ] diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc deleted file mode 100644 index 02b296065..000000000 --- a/src/internet-node/internet-node.cc +++ /dev/null @@ -1,38 +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 -// -// Implementation of the InternetNode class for ns3. -// George F. Riley, Georgia Tech, Fall 2006 - -#include "ns3/net-device.h" -#include "ns3/callback.h" -#include "internet-node.h" -#include "internet-stack.h" - - -namespace ns3 { - -InternetNode::InternetNode() -{ - AddInternetStack (this); -} - - -}//namespace ns3 diff --git a/src/internet-node/internet-node.h b/src/internet-node/internet-node.h deleted file mode 100644 index 85ca02a84..000000000 --- a/src/internet-node/internet-node.h +++ /dev/null @@ -1,65 +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 -// -// Define a basic "Internet" node, with a protocol stack (l3 and l4), -// network device list, process list, and routing. - -#ifndef INTERNET_NODE_H -#define INTERNET_NODE_H - -#include -#include - -#include "ns3/node.h" - -namespace ns3 { - -/** - * \ingroup internetNode - * - * \section InternetNode Overview - * - * The InternetNode module contains an implementation of TCP, UDP, and - * IPv4. ns-3 Applications sit above this module, and ns-3 NetDevices - * sit below it... - * - * InternetNode is implemented as a subclass of Node but this may be - * refactored in the future to - */ - -/* - * \brief Container class for various TCP/IP objects and interfaces - * aggregated to a Node. - * - * This class exists primarily to assemble the layer-3/4 stack of a Node - * from constituent parts, including implementations of TCP, IPv4, UDP, - * and ARP. It provides only constructors and destructors as its public - * API. Internally, the various protocols are instantiated, aggregated - * to a Node, and plumbed together. - */ -class InternetNode : public Node -{ -public: - InternetNode(); -}; - -}//namespace ns3 - -#endif /* INTERNET_NODE_H */ diff --git a/src/internet-node/wscript b/src/internet-node/wscript index c48d3910d..2d03561ff 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -4,7 +4,6 @@ def build(bld): obj = bld.create_ns3_module('internet-node', ['node']) obj.source = [ - 'internet-node.cc', 'internet-stack.cc', 'ipv4-l4-demux.cc', 'ipv4-l4-protocol.cc', @@ -39,7 +38,6 @@ def build(bld): headers = bld.create_obj('ns3header') headers.module = 'internet-node' headers.source = [ - 'internet-node.h', 'internet-stack.h', 'ascii-trace.h', 'pcap-trace.h',