Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill dat code, pal
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 25 Mar 2016 13:28:12 +0000 (14:28 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 25 Mar 2016 13:28:16 +0000 (14:28 +0100)
Separate the dead code removal from the change that make it useless
for sake of diff readability.

src/surf/ns3/my-point-to-point-helper.cc [deleted file]
src/surf/ns3/my-point-to-point-helper.h [deleted file]
tools/cmake/DefinePackages.cmake

diff --git a/src/surf/ns3/my-point-to-point-helper.cc b/src/surf/ns3/my-point-to-point-helper.cc
deleted file mode 100644 (file)
index 1f92ccf..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-/* Copyright (c) 2011, 2014. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/*
- * 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 <ns3/abort.h>
-#include "ns3/simulator.h"
-#include "ns3/point-to-point-net-device.h"
-#include "ns3/point-to-point-channel.h"
-#include "ns3/point-to-point-remote-channel.h"
-#include "ns3/queue.h"
-#include "ns3/config.h"
-#include "ns3/packet.h"
-#include "ns3/names.h"
-#include "ns3/string.h"
-#include "ns3/mpi-interface.h"
-#include "ns3/mpi-receiver.h"
-
-#include "ns3/trace-helper.h"
-#include "my-point-to-point-helper.h"
-
-#include "xbt/log.h"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
-
-std::string qMode = "Bytes";
-std::string qBurst = "6";
-std::string qAvPkt = "1024";
-std::string qLimit = "25600"; //"100000";
-std::string qthMin = "5120";  // 1024 x 5 bytes
-std::string qthMax = "15360"; // 1024 x 15 bytes
-std::string qIdleRate = "1500000";  //1.5 Mbps
-std::string qProb = "0.02";
-
-namespace ns3 {
-
-MyPointToPointHelper::MyPointToPointHelper ()
-{
-  m_queueFactory.SetTypeId ("ns3::DropTailQueue");
-  m_deviceFactory.SetTypeId ("ns3::PointToPointNetDevice");
-  m_channelFactory.SetTypeId ("ns3::PointToPointChannel");
-  m_remoteChannelFactory.SetTypeId ("ns3::PointToPointRemoteChannel");
-}
-
-void 
-MyPointToPointHelper::SetQueue (std::string type,
-                              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,
-                              std::string n8, const AttributeValue &v8)
-{
-  m_queueFactory.SetTypeId (type);
-  m_queueFactory.Set (n1, v1);
-  m_queueFactory.Set (n2, v2);
-  m_queueFactory.Set (n3, v3);
-  m_queueFactory.Set (n4, v4);
-  m_queueFactory.Set (n5, v5);
-  m_queueFactory.Set (n6, v6);
-  m_queueFactory.Set (n7, v7);
-  m_queueFactory.Set (n8, v8);
-}
-
-void 
-MyPointToPointHelper::SetDeviceAttribute (std::string n1, const AttributeValue &v1)
-{
-  m_deviceFactory.Set (n1, v1);
-}
-
-void 
-MyPointToPointHelper::SetChannelAttribute (std::string n1, const AttributeValue &v1)
-{
-  m_channelFactory.Set (n1, v1);
-  m_remoteChannelFactory.Set (n1, v1);
-}
-
-void 
-MyPointToPointHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
-{
-  //
-  // All of the Pcap enable functions vector through here including the ones
-  // that are wandering through all of devices on perhaps all of the nodes in
-  // the system.  We can only deal with devices of type PointToPointNetDevice.
-  //
-  Ptr<PointToPointNetDevice> device = nd->GetObject<PointToPointNetDevice> ();
-  if (device == 0)
-    {
-      XBT_INFO ("MyPointToPointHelper::EnablePcapInternal(): Device not of type ns3::PointToPointNetDevice");
-      return;
-    }
-
-  PcapHelper pcapHelper;
-
-  std::string filename;
-  if (explicitFilename)
-    {
-      filename = prefix;
-    }
-  else
-    {
-      filename = pcapHelper.GetFilenameFromDevice (prefix, device);
-    }
-
-  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, 
-                                                     PcapHelper::DLT_PPP);
-  pcapHelper.HookDefaultSink<PointToPointNetDevice> (device, "PromiscSniffer", file);
-}
-
-void 
-MyPointToPointHelper::EnableAsciiInternal (
-  Ptr<OutputStreamWrapper> stream, 
-  std::string prefix, 
-  Ptr<NetDevice> nd,
-  bool explicitFilename)
-{
-  //
-  // All of the ascii enable functions vector through here including the ones
-  // that are wandering through all of devices on perhaps all of the nodes in
-  // the system.  We can only deal with devices of type PointToPointNetDevice.
-  //
-  Ptr<PointToPointNetDevice> device = nd->GetObject<PointToPointNetDevice> ();
-  if (device == 0)
-    {
-      XBT_INFO ("MyPointToPointHelper::EnableAsciiInternal(): Device not of type ns3::PointToPointNetDevice");
-      return;
-    }
-
-  //
-  // Our default trace sinks are going to use packet printing, so we have to 
-  // make sure that is turned on.
-  //
-  Packet::EnablePrinting ();
-
-  //
-  // If we are not provided an OutputStreamWrapper, we are expected to create 
-  // one using the usual trace filename conventions and do a Hook*WithoutContext
-  // since there will be one file per context and therefore the context would
-  // be redundant.
-  //
-  if (stream == 0)
-    {
-      //
-      // Set up an output stream object to deal with private ofstream copy 
-      // constructor and lifetime issues.  Let the helper decide the actual
-      // name of the file given the prefix.
-      //
-      AsciiTraceHelper asciiTraceHelper;
-
-      std::string filename;
-      if (explicitFilename)
-        {
-          filename = prefix;
-        }
-      else
-        {
-          filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
-        }
-
-      Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
-
-      //
-      // The MacRx trace source provides our "r" event.
-      //
-      asciiTraceHelper.HookDefaultReceiveSinkWithoutContext<PointToPointNetDevice> (device, "MacRx", theStream);
-
-      //
-      // The "+", '-', and 'd' events are driven by trace sources actually in the
-      // transmit queue.
-      //
-      Ptr<Queue> queue = device->GetQueue ();
-      asciiTraceHelper.HookDefaultEnqueueSinkWithoutContext<Queue> (queue, "Enqueue", theStream);
-      asciiTraceHelper.HookDefaultDropSinkWithoutContext<Queue> (queue, "Drop", theStream);
-      asciiTraceHelper.HookDefaultDequeueSinkWithoutContext<Queue> (queue, "Dequeue", theStream);
-
-      // PhyRxDrop trace source for "d" event
-      asciiTraceHelper.HookDefaultDropSinkWithoutContext<PointToPointNetDevice> (device, "PhyRxDrop", theStream);
-
-      return;
-    }
-
-  //
-  // If we are provided an OutputStreamWrapper, we are expected to use it, and
-  // to provide a context.  We are free to come up with our own context if we
-  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for 
-  // compatibility and simplicity, we just use Config::Connect and let it deal
-  // with the context.
-  //
-  // Note that we are going to use the default trace sinks provided by the 
-  // ascii trace helper.  There is actually no AsciiTraceHelper in sight here,
-  // but the default trace sinks are actually publicly available static 
-  // functions that are always there waiting for just such a case.
-  //
-  uint32_t nodeid = nd->GetNode ()->GetId ();
-  uint32_t deviceid = nd->GetIfIndex ();
-  std::ostringstream oss;
-
-  oss << "/NodeList/" << nd->GetNode ()->GetId () << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/MacRx";
-  Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultReceiveSinkWithContext, stream));
-
-  oss.str ("");
-  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Enqueue";
-  Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultEnqueueSinkWithContext, stream));
-
-  oss.str ("");
-  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Dequeue";
-  Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDequeueSinkWithContext, stream));
-
-  oss.str ("");
-  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Drop";
-  Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
-
-  oss.str ("");
-  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/PhyRxDrop";
-  Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
-}
-
-NetDeviceContainer 
-MyPointToPointHelper::Install (NodeContainer c)
-{
-  NS_ASSERT (c.GetN () == 2);
-  return Install (c.Get (0), c.Get (1));
-}
-
-NetDeviceContainer 
-MyPointToPointHelper::Install (Ptr<Node> a, Ptr<Node> b)
-{
-  NetDeviceContainer container;
-
-  Ptr<PointToPointNetDevice> devA = m_deviceFactory.Create<PointToPointNetDevice> ();
-  devA->SetAddress (Mac48Address::Allocate ());
-  a->AddDevice (devA);
-  Ptr<Queue> queueA = m_queueFactory.Create<Queue> ();
-  devA->SetQueue (queueA);
-  Ptr<PointToPointNetDevice> devB = m_deviceFactory.Create<PointToPointNetDevice> ();
-  devB->SetAddress (Mac48Address::Allocate ());
-  b->AddDevice (devB);
-  Ptr<Queue> queueB = m_queueFactory.Create<Queue> ();
-  devB->SetQueue (queueB);
-  // If MPI is enabled, we need to see if both nodes have the same system id
-  // (rank), and the rank is the same as this instance.  If both are true,
-  //use a normal p2p channel, otherwise use a remote channel
-  bool useNormalChannel = true;
-  Ptr<PointToPointChannel> channel = 0;
-  if (MpiInterface::IsEnabled ()) {
-      uint32_t n1SystemId = a->GetSystemId ();
-      uint32_t n2SystemId = b->GetSystemId ();
-      uint32_t currSystemId = MpiInterface::GetSystemId ();
-      if (n1SystemId != currSystemId || n2SystemId != currSystemId)
-          useNormalChannel = false;
-  }
-  if (useNormalChannel)
-      channel = m_channelFactory.Create<PointToPointChannel> ();
-  else {
-      channel = m_remoteChannelFactory.Create<PointToPointRemoteChannel> ();
-      Ptr<MpiReceiver> mpiRecA = CreateObject<MpiReceiver> ();
-      Ptr<MpiReceiver> mpiRecB = CreateObject<MpiReceiver> ();
-      mpiRecA->SetReceiveCallback (MakeCallback (&PointToPointNetDevice::Receive, devA));
-      mpiRecB->SetReceiveCallback (MakeCallback (&PointToPointNetDevice::Receive, devB));
-      devA->AggregateObject (mpiRecA);
-      devB->AggregateObject (mpiRecB);
-    }
-
-  devA->Attach (channel);
-  devB->Attach (channel);
-  container.Add (devA);
-  container.Add (devB);
-
-  return container;
-}
-
-NetDeviceContainer
-MyPointToPointHelper::Install (Ptr<Node> a, std::string bName)
-{
-  Ptr<Node> b = Names::Find<Node> (bName);
-  return Install (a, b);
-}
-
-NetDeviceContainer 
-MyPointToPointHelper::Install (std::string aName, Ptr<Node> b)
-{
-  Ptr<Node> a = Names::Find<Node> (aName);
-  return Install (a, b);
-}
-
-NetDeviceContainer 
-MyPointToPointHelper::Install (std::string aName, std::string bName)
-{
-  Ptr<Node> a = Names::Find<Node> (aName);
-  Ptr<Node> b = Names::Find<Node> (bName);
-  return Install (a, b);
-}
-
-} // namespace ns3
diff --git a/src/surf/ns3/my-point-to-point-helper.h b/src/surf/ns3/my-point-to-point-helper.h
deleted file mode 100644 (file)
index 9a2acf3..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Copyright (c) 2011, 2014. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/*
- * 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 POINT_TO_POINT_HELPER_H
-#define POINT_TO_POINT_HELPER_H
-
-#include <string>
-
-#include "ns3/object-factory.h"
-#include "ns3/net-device-container.h"
-#include "ns3/node-container.h"
-#include "ns3/deprecated.h"
-
-#include "ns3/trace-helper.h"
-
-#include "ns3_interface.h"
-
-namespace ns3 {
-
-class Queue;
-class NetDevice;
-class Node;
-
-/**
- * \brief Build a set of PointToPointNetDevice objects
- *
- * Normally we eschew multiple inheritance, however, the classes 
- * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
- * "mixins".
- */
-class MyPointToPointHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice
-{
-public:
-  /**
-   * Create a MyPointToPointHelper to make life easier when creating point to
-   * point networks.
-   */
-  MyPointToPointHelper ();
-  virtual ~MyPointToPointHelper () {}
-
-  /**
-   * Each point to point net device must have a queue to pass packets through.
-   * This method allows one to set the type of the queue that is automatically
-   * created when the device is created and attached to a node.
-   *
-   * \param type the type of queue
-   * \param n1 the name of the attribute to set on the queue
-   * \param v1 the value of the attribute to set on the queue
-   * \param n2 the name of the attribute to set on the queue
-   * \param v2 the value of the attribute to set on the queue
-   * \param n3 the name of the attribute to set on the queue
-   * \param v3 the value of the attribute to set on the queue
-   * \param n4 the name of the attribute to set on the queue
-   * \param v4 the value of the attribute to set on the queue
-   *
-   * Set the type of queue to create and associated to each
-   * PointToPointNetDevice created through MyPointToPointHelper::Install.
-   */
-  void SetQueue (std::string type,
-                 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 (),
-                 std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue ());
-
-  /**
-   * Set an attribute value to be propagated to each NetDevice created by the
-   * helper.
-   *
-   * \param name the name of the attribute to set
-   * \param value the value of the attribute to set
-   *
-   * Set these attributes on each ns3::PointToPointNetDevice created
-   * by MyPointToPointHelper::Install
-   */
-  void SetDeviceAttribute (std::string name, const AttributeValue &value);
-
-  /**
-   * Set an attribute value to be propagated to each Channel created by the
-   * helper.
-   *
-   * \param name the name of the attribute to set
-   * \param value the value of the attribute to set
-   *
-   * Set these attribute on each ns3::PointToPointChannel created
-   * by MyPointToPointHelper::Install
-   */
-  void SetChannelAttribute (std::string name, const AttributeValue &value);
-
-  /**
-   * \param c a set of nodes
-   *
-   * This method creates a ns3::PointToPointChannel with the
-   * attributes configured by MyPointToPointHelper::SetChannelAttribute,
-   * then, for each node in the input container, we create a 
-   * ns3::PointToPointNetDevice with the requested attributes, 
-   * a queue for this ns3::NetDevice, and associate the resulting 
-   * ns3::NetDevice with the ns3::Node and ns3::PointToPointChannel.
-   */
-  NetDeviceContainer Install (NodeContainer c);
-
-  /**
-   * \param a first node
-   * \param b second node
-   *
-   * Saves you from having to construct a temporary NodeContainer. 
-   * Also, if MPI is enabled, for distributed simulations, 
-   * appropriate remote point-to-point channels are created.
-   */
-  NetDeviceContainer Install (Ptr<Node> a, Ptr<Node> b);
-
-  /**
-   * \param a first node
-   * \param bName name of second node
-   *
-   * Saves you from having to construct a temporary NodeContainer.
-   */
-  NetDeviceContainer Install (Ptr<Node> a, std::string bName);
-
-  /**
-   * \param aName Name of first node
-   * \param b second node
-   *
-   * Saves you from having to construct a temporary NodeContainer.
-   */
-  NetDeviceContainer Install (std::string aName, Ptr<Node> b);
-
-  /**
-   * \param aNode Name of first node
-   * \param bNode Name of second node
-   *
-   * Saves you from having to construct a temporary NodeContainer.
-   */
-  NetDeviceContainer Install (std::string aNode, std::string bNode);
-
-private:
-  /**
-   * \brief Enable pcap output the indicated net device.
-   *
-   * NetDevice-specific implementation mechanism for hooking the trace and
-   * writing to the trace file.
-   *
-   * \param prefix Filename prefix to use for pcap files.
-   * \param nd Net device for which you want to enable tracing.
-   * \param promiscuous If true capture all possible packets available at the device.
-   * \param explicitFilename Treat the prefix as an explicit filename if true
-   */
-  virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
-
-  /**
-   * \brief Enable ascii trace output on the indicated net device.
-   * \internal
-   *
-   * NetDevice-specific implementation mechanism for hooking the trace and
-   * writing to the trace file.
-   *
-   * \param stream The output stream object to use when logging ascii traces.
-   * \param prefix Filename prefix to use for ascii trace files.
-   * \param nd Net device for which you want to enable tracing.
-   */
-  virtual void EnableAsciiInternal (
-    Ptr<OutputStreamWrapper> stream,
-    std::string prefix,
-    Ptr<NetDevice> nd,
-    bool explicitFilename);
-
-  ObjectFactory m_queueFactory;
-  ObjectFactory m_channelFactory;
-  ObjectFactory m_remoteChannelFactory;
-  ObjectFactory m_deviceFactory;
-};
-
-} // namespace ns3
-
-#endif /* POINT_TO_POINT_HELPER_H */
index 1b07297..5e47863 100644 (file)
@@ -49,7 +49,6 @@ set(EXTRA_DIST
   src/surf/network_ns3.hpp
   src/surf/network_smpi.hpp
   src/surf/network_ib.hpp
   src/surf/network_ns3.hpp
   src/surf/network_smpi.hpp
   src/surf/network_ib.hpp
-  src/surf/ns3/my-point-to-point-helper.h
   src/surf/ns3/ns3_interface.h
   src/surf/ns3/ns3_simulator.h
   src/surf/plugins/energy.hpp
   src/surf/ns3/ns3_interface.h
   src/surf/ns3/ns3_simulator.h
   src/surf/plugins/energy.hpp
@@ -283,7 +282,6 @@ endif()
 
 set(NS3_SRC
   src/surf/network_ns3.cpp
 
 set(NS3_SRC
   src/surf/network_ns3.cpp
-  src/surf/ns3/my-point-to-point-helper.cc
   src/surf/ns3/ns3_simulator.cc
   )
 
   src/surf/ns3/ns3_simulator.cc
   )