diff -r e9ca5b2838e7 examples/matrix-topology/wscript --- a/examples/matrix-topology/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/matrix-topology/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -2,5 +2,5 @@ def build(bld): obj = bld.create_ns3_program('matrix-topology', - ['network', 'internet', 'netanim', 'mobility', 'applications']) + ['network', 'internet', 'netanim', 'point-to-point', 'mobility', 'applications']) obj.source = 'matrix-topology.cc' diff -r e9ca5b2838e7 examples/naming/object-names.cc --- a/examples/naming/object-names.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/naming/object-names.cc Fri Apr 22 12:41:15 2011 -0700 @@ -25,6 +25,7 @@ #include "ns3/core-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/realtime/realtime-udp-echo.cc --- a/examples/realtime/realtime-udp-echo.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/realtime/realtime-udp-echo.cc Fri Apr 22 12:41:15 2011 -0700 @@ -29,6 +29,7 @@ #include "ns3/core-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/routing/mixed-global-routing.cc --- a/examples/routing/mixed-global-routing.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/routing/mixed-global-routing.cc Fri Apr 22 12:41:15 2011 -0700 @@ -41,7 +41,7 @@ #include "ns3/point-to-point-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/socket/wscript --- a/examples/socket/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/socket/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -1,8 +1,8 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - obj = bld.create_ns3_program('socket-bound-static-routing', ['network', 'csma', 'internet']) + obj = bld.create_ns3_program('socket-bound-static-routing', ['network', 'csma', 'point-to-point', 'internet']) obj.source = 'socket-bound-static-routing.cc' - obj = bld.create_ns3_program('socket-bound-tcp-static-routing', ['network', 'csma', 'internet']) + obj = bld.create_ns3_program('socket-bound-tcp-static-routing', ['network', 'csma', 'point-to-point', 'internet']) obj.source = 'socket-bound-tcp-static-routing.cc' diff -r e9ca5b2838e7 examples/tcp/star.cc --- a/examples/tcp/star.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/tcp/star.cc Fri Apr 22 12:41:15 2011 -0700 @@ -21,7 +21,7 @@ #include "ns3/internet-module.h" #include "ns3/point-to-point-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/point-to-point-layout-module.h" // Network topology (default) // diff -r e9ca5b2838e7 examples/tcp/tcp-nsc-zoo.cc --- a/examples/tcp/tcp-nsc-zoo.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/tcp/tcp-nsc-zoo.cc Fri Apr 22 12:41:15 2011 -0700 @@ -34,7 +34,7 @@ #include "ns3/applications-module.h" #include "ns3/network-module.h" #include "ns3/csma-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/tcp/wscript --- a/examples/tcp/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/tcp/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -18,7 +18,7 @@ obj.source = 'tcp-star-server.cc' obj = bld.create_ns3_program('star', - ['netanim', 'point-to-point', 'applications', 'internet']) + ['netanim', 'point-to-point', 'point-to-point-layout', 'applications', 'internet']) obj.source = 'star.cc' obj = bld.create_ns3_program('tcp-bulk-send', diff -r e9ca5b2838e7 examples/tutorial/third.cc --- a/examples/tutorial/third.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/tutorial/third.cc Fri Apr 22 12:41:15 2011 -0700 @@ -21,7 +21,7 @@ #include "ns3/wifi-module.h" #include "ns3/mobility-module.h" #include "ns3/csma-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/internet-module.h" // Default Network Topology // diff -r e9ca5b2838e7 examples/udp-client-server/udp-client-server.cc --- a/examples/udp-client-server/udp-client-server.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/udp-client-server/udp-client-server.cc Fri Apr 22 12:41:15 2011 -0700 @@ -28,6 +28,7 @@ #include "ns3/core-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/udp-client-server/udp-trace-client-server.cc --- a/examples/udp-client-server/udp-trace-client-server.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/udp-client-server/udp-trace-client-server.cc Fri Apr 22 12:41:15 2011 -0700 @@ -27,6 +27,7 @@ #include "ns3/core-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/udp/udp-echo.cc --- a/examples/udp/udp-echo.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/udp/udp-echo.cc Fri Apr 22 12:41:15 2011 -0700 @@ -29,6 +29,7 @@ #include "ns3/core-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/wireless/mixed-wireless.cc --- a/examples/wireless/mixed-wireless.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/wireless/mixed-wireless.cc Fri Apr 22 12:41:15 2011 -0700 @@ -68,7 +68,7 @@ #include "ns3/wifi-module.h" #include "ns3/csma-module.h" #include "ns3/olsr-helper.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 examples/wireless/wifi-wired-bridging.cc --- a/examples/wireless/wifi-wired-bridging.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/examples/wireless/wifi-wired-bridging.cc Fri Apr 22 12:41:15 2011 -0700 @@ -49,6 +49,7 @@ #include "ns3/wifi-module.h" #include "ns3/network-module.h" #include "ns3/csma-module.h" +#include "ns3/internet-module.h" #include "ns3/bridge-helper.h" #include #include diff -r e9ca5b2838e7 src/bridge/examples/csma-bridge-one-hop.cc --- a/src/bridge/examples/csma-bridge-one-hop.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/bridge/examples/csma-bridge-one-hop.cc Fri Apr 22 12:41:15 2011 -0700 @@ -74,7 +74,7 @@ #include "ns3/applications-module.h" #include "ns3/bridge-module.h" #include "ns3/csma-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/bridge/examples/csma-bridge.cc --- a/src/bridge/examples/csma-bridge.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/bridge/examples/csma-bridge.cc Fri Apr 22 12:41:15 2011 -0700 @@ -37,6 +37,7 @@ #include "ns3/applications-module.h" #include "ns3/bridge-module.h" #include "ns3/csma-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma-layout/examples/csma-star.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/examples/csma-star.cc Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,195 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + * + */ + +#include "ns3/core-module.h" +#include "ns3/network-module.h" +#include "ns3/csma-module.h" +#include "ns3/csma-star-helper.h" +#include "ns3/applications-module.h" +#include "ns3/csma-module.h" +#include "ns3/internet-module.h" + +// Network topology (default) +// +// n2 + + n3 . +// | ... |\ /| ... | . +// ======= \ / ======= . +// CSMA \ / CSMA . +// \ / . +// n1 +--- n0 ---+ n4 . +// | ... | / \ | ... | . +// ======= / \ ======= . +// CSMA / \ CSMA . +// / \ . +// n6 + + n5 . +// | ... | | ... | . +// ======= ======= . +// CSMA CSMA . +// + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("CsmaStar"); + +int +main (int argc, char *argv[]) +{ + + // + // Set up some default values for the simulation. + // + Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (137)); + + // ??? try and stick 15kb/s into the data rate + Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("14kb/s")); + + // + // Default number of nodes in the star. Overridable by command line argument. + // + uint32_t nSpokes = 7; + + CommandLine cmd; + cmd.AddValue("nSpokes", "Number of spoke nodes to place in the star", nSpokes); + cmd.Parse (argc, argv); + + NS_LOG_INFO ("Build star topology."); + CsmaHelper csma; + csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); + csma.SetChannelAttribute ("Delay", StringValue ("1ms")); + CsmaStarHelper star (nSpokes, csma); + + NodeContainer fillNodes; + + // + // Just to be nasy, hang some more nodes off of the CSMA channel for each + // spoke, so that there are a total of 16 nodes on each channel. Stash + // all of these new devices into a container. + // + NetDeviceContainer fillDevices; + + uint32_t nFill = 14; + for (uint32_t i = 0; i < star.GetSpokeDevices ().GetN (); ++i) + { + Ptr channel = star.GetSpokeDevices ().Get (i)->GetChannel (); + Ptr csmaChannel = channel->GetObject (); + NodeContainer newNodes; + newNodes.Create (nFill); + fillNodes.Add (newNodes); + fillDevices.Add (csma.Install (newNodes, csmaChannel)); + } + + NS_LOG_INFO ("Install internet stack on all nodes."); + InternetStackHelper internet; + star.InstallStack (internet); + internet.Install (fillNodes); + + NS_LOG_INFO ("Assign IP Addresses."); + star.AssignIpv4Addresses (Ipv4AddressHelper ("10.1.0.0", "255.255.255.0")); + + // + // We assigned addresses to the logical hub and the first "drop" of the + // CSMA network that acts as the spoke, but we also have a number of fill + // devices (nFill) also hanging off the CSMA network. We have got to + // assign addresses to them as well. We put all of the fill devices into + // a single device container, so the first nFill devices are associated + // with the channel connected to spokeDevices.Get (0), the second nFill + // devices afe associated with the channel connected to spokeDevices.Get (1) + // etc. + // + Ipv4AddressHelper address; + for(uint32_t i = 0; i < star.SpokeCount (); ++i) + { + std::ostringstream subnet; + subnet << "10.1." << i << ".0"; + NS_LOG_INFO ("Assign IP Addresses for CSMA subnet " << subnet.str ()); + address.SetBase (subnet.str ().c_str (), "255.255.255.0", "0.0.0.3"); + + for (uint32_t j = 0; j < nFill; ++j) + { + address.Assign (fillDevices.Get (i * nFill + j)); + } + } + + NS_LOG_INFO ("Create applications."); + // + // Create a packet sink on the star "hub" to receive packets. + // + uint16_t port = 50000; + Address hubLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port)); + PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", hubLocalAddress); + ApplicationContainer hubApp = packetSinkHelper.Install (star.GetHub ()); + hubApp.Start (Seconds (1.0)); + hubApp.Stop (Seconds (10.0)); + + // + // Create OnOff applications to send TCP to the hub, one on each spoke node. + // + OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ()); + onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); + onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); + + ApplicationContainer spokeApps; + + for (uint32_t i = 0; i < star.SpokeCount (); ++i) + { + AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i), port)); + onOffHelper.SetAttribute ("Remote", remoteAddress); + spokeApps.Add (onOffHelper.Install (star.GetSpokeNode (i))); + } + + spokeApps.Start (Seconds (1.0)); + spokeApps.Stop (Seconds (10.0)); + + // + // Because we are evil, we also add OnOff applications to send TCP to the hub + // from the fill devices on each CSMA link. The first nFill nodes in the + // fillNodes container are on the CSMA network talking to the zeroth device + // on the hub node. The next nFill nodes are on the CSMA network talking to + // the first device on the hub node, etc. So the ith fillNode is associated + // with the hub address found on the (i / nFill)th device on the hub node. + // + ApplicationContainer fillApps; + + for (uint32_t i = 0; i < fillNodes.GetN (); ++i) + { + AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i / nFill), port)); + onOffHelper.SetAttribute ("Remote", remoteAddress); + fillApps.Add (onOffHelper.Install (fillNodes.Get (i))); + } + + fillApps.Start (Seconds (1.0)); + fillApps.Stop (Seconds (10.0)); + + NS_LOG_INFO ("Enable static global routing."); + // + // Turn on global static routing so we can actually be routed across the star. + // + Ipv4GlobalRoutingHelper::PopulateRoutingTables (); + + NS_LOG_INFO ("Enable pcap tracing."); + // + // Do pcap tracing on all devices on all nodes. + // + csma.EnablePcapAll ("csma-star", false); + + NS_LOG_INFO ("Run Simulation."); + Simulator::Run (); + Simulator::Destroy (); + NS_LOG_INFO ("Done."); + + return 0; +} diff -r e9ca5b2838e7 src/csma-layout/examples/waf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/examples/waf Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,1 @@ +exec "`dirname "$0"`"/../../waf "$@" diff -r e9ca5b2838e7 src/csma-layout/examples/wscript --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/examples/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,5 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_program('csma-star', ['csma', 'csma-layout', 'internet', 'applications']) + obj.source = 'csma-star.cc' diff -r e9ca5b2838e7 src/csma-layout/model/csma-star-helper.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/model/csma-star-helper.cc Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,109 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include +#include + +// ns3 includes +#include "ns3/animation-interface.h" +#include "ns3/csma-star-helper.h" +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/vector.h" + +NS_LOG_COMPONENT_DEFINE("CsmaStarHelper"); + +namespace ns3 { + +CsmaStarHelper::CsmaStarHelper (uint32_t numSpokes, + CsmaHelper csmaHelper) +{ + m_hub.Create (1); + m_spokes.Create (numSpokes); + + for (uint32_t i = 0; i < m_spokes.GetN (); ++i) + { + NodeContainer nodes (m_hub.Get (0), m_spokes.Get (i)); + NetDeviceContainer nd = csmaHelper.Install (nodes); + m_hubDevices.Add (nd.Get (0)); + m_spokeDevices.Add (nd.Get (1)); + } +} + +CsmaStarHelper::~CsmaStarHelper () +{} + +Ptr +CsmaStarHelper::GetHub () const +{ + return m_hub.Get (0); +} + +Ptr +CsmaStarHelper::GetSpokeNode (uint32_t i) const +{ + return m_spokes.Get (i); +} + +NetDeviceContainer +CsmaStarHelper::GetHubDevices () const +{ + return m_spokeDevices; +} + +NetDeviceContainer +CsmaStarHelper::GetSpokeDevices () const +{ + return m_spokeDevices; +} + +Ipv4Address +CsmaStarHelper::GetHubIpv4Address (uint32_t i) const +{ + return m_hubInterfaces.GetAddress (i); +} + +Ipv4Address +CsmaStarHelper::GetSpokeIpv4Address (uint32_t i) const +{ + return m_spokeInterfaces.GetAddress (i); +} + +uint32_t +CsmaStarHelper::SpokeCount () const +{ + return m_spokes.GetN (); +} + +void +CsmaStarHelper::InstallStack (InternetStackHelper stack) +{ + stack.Install (m_hub); + stack.Install (m_spokes); +} + +void +CsmaStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) +{ + for (uint32_t i = 0; i < m_spokes.GetN (); ++i) + { + m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); + m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); + address.NewNetwork (); + } +} + +} // namespace ns3 diff -r e9ca5b2838e7 src/csma-layout/model/csma-star-helper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/model/csma-star-helper.h Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,123 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Define an object to create a dumbbell topology. + +#ifndef CSMA_STAR_HELPER_H +#define CSMA_STAR_HELPER_H + +#include + +#include "csma-helper.h" +#include "ipv4-address-helper.h" +#include "internet-stack-helper.h" +#include "ipv4-interface-container.h" + +namespace ns3 { + +/** + * \brief A helper to make it easier to create a star topology + * with Csma links + */ +class CsmaStarHelper +{ +public: + /** + * Create a CsmaStarHelper in order to easily create + * star topologies using Csma links + * + * \param numSpokes the number of links attached to + * the hub node, creating a total of + * numSpokes + 1 nodes + * + * \param csmaHelper the link helper for Csma links, + * used to link nodes together + */ + CsmaStarHelper (uint32_t numSpokes, + CsmaHelper csmaHelper); + + ~CsmaStarHelper (); + +public: + /** + * \returns a node pointer to the hub node in the + * star, i.e., the center node + */ + Ptr GetHub () const; + + /** + * \param i an index into the spokes of the star + * + * \returns a node pointer to the node at the indexed spoke + */ + Ptr GetSpokeNode (uint32_t i) const; + + /** + * \returns the net-device container which contains all of + * the devices on the hub node + */ + NetDeviceContainer GetHubDevices () const; + + /** + * \returns the net-device container which contains all of + * the spoke node devices + */ + NetDeviceContainer GetSpokeDevices () const; + + /** + * \param i index into the hub interfaces + * + * \returns Ipv4Address according to indexed hub interface + */ + Ipv4Address GetHubIpv4Address (uint32_t i) const; + + /** + * \param i index into the spoke interfaces + * + * \returns Ipv4Address according to indexed spoke interface + */ + Ipv4Address GetSpokeIpv4Address (uint32_t i) const; + + /** + * \returns the total number of spokes in the star + */ + uint32_t SpokeCount () const; + + /** + * \param stack an InternetStackHelper which is used to install + * on every node in the star + */ + void InstallStack (InternetStackHelper stack); + + /** + * \param address an Ipv4AddressHelper which is used to install + * Ipv4 addresses on all the node interfaces in + * the star + */ + void AssignIpv4Addresses (Ipv4AddressHelper address); + +private: + NodeContainer m_hub; + NetDeviceContainer m_hubDevices; + NodeContainer m_spokes; + NetDeviceContainer m_spokeDevices; + Ipv4InterfaceContainer m_hubInterfaces; + Ipv4InterfaceContainer m_spokeInterfaces; +}; + +} // namespace ns3 + +#endif /* CSMA_STAR_HELPER_H */ diff -r e9ca5b2838e7 src/csma-layout/waf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/waf Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff -r e9ca5b2838e7 src/csma-layout/wscript --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/csma-layout/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,18 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + obj = bld.create_ns3_module('csma-layout', ['csma', 'network', 'applications']) + obj.source = [ + 'model/csma-star-helper.cc', + ] + headers = bld.new_task_gen('ns3header') + headers.module = 'csma-layout' + headers.source = [ + 'model/csma-star-helper.h', + ] + + if bld.env['ENABLE_EXAMPLES']: + bld.add_subdirs('examples') + + #bld.ns3_python_bindings() + diff -r e9ca5b2838e7 src/csma/examples/csma-broadcast.cc --- a/src/csma/examples/csma-broadcast.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/csma-broadcast.cc Fri Apr 22 12:41:15 2011 -0700 @@ -36,6 +36,7 @@ #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma/examples/csma-multicast.cc --- a/src/csma/examples/csma-multicast.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/csma-multicast.cc Fri Apr 22 12:41:15 2011 -0700 @@ -36,8 +36,7 @@ #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma/examples/csma-one-subnet.cc --- a/src/csma/examples/csma-one-subnet.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/csma-one-subnet.cc Fri Apr 22 12:41:15 2011 -0700 @@ -32,6 +32,7 @@ #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma/examples/csma-ping.cc --- a/src/csma/examples/csma-ping.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/csma-ping.cc Fri Apr 22 12:41:15 2011 -0700 @@ -32,6 +32,7 @@ #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma/examples/csma-raw-ip-socket.cc --- a/src/csma/examples/csma-raw-ip-socket.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/csma-raw-ip-socket.cc Fri Apr 22 12:41:15 2011 -0700 @@ -35,6 +35,7 @@ #include "ns3/network-module.h" #include "ns3/csma-module.h" #include "ns3/applications-module.h" +#include "ns3/internet-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/csma/examples/wscript --- a/src/csma/examples/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/examples/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -13,9 +13,6 @@ obj = bld.create_ns3_program('csma-multicast', ['csma', 'internet']) obj.source = 'csma-multicast.cc' - obj = bld.create_ns3_program('csma-star', ['csma', 'internet']) - obj.source = 'csma-star.cc' - obj = bld.create_ns3_program('csma-raw-ip-socket', ['csma', 'internet']) obj.source = 'csma-raw-ip-socket.cc' diff -r e9ca5b2838e7 src/csma/wscript --- a/src/csma/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/src/csma/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -1,13 +1,12 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - obj = bld.create_ns3_module('csma', ['network', 'point-to-point', 'applications', 'netanim']) + obj = bld.create_ns3_module('csma', ['network', 'applications']) obj.source = [ 'model/backoff.cc', 'model/csma-net-device.cc', 'model/csma-channel.cc', 'helper/csma-helper.cc', - 'helper/csma-star-helper.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'csma' @@ -16,7 +15,6 @@ 'model/csma-net-device.h', 'model/csma-channel.h', 'helper/csma-helper.h', - 'helper/csma-star-helper.h', ] if bld.env['ENABLE_EXAMPLES']: diff -r e9ca5b2838e7 src/netanim/examples/dumbbell-animation.cc --- a/src/netanim/examples/dumbbell-animation.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/examples/dumbbell-animation.cc Fri Apr 22 12:41:15 2011 -0700 @@ -24,7 +24,7 @@ #include "ns3/point-to-point-module.h" #include "ns3/netanim-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/point-to-point-layout-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/netanim/examples/grid-animation.cc --- a/src/netanim/examples/grid-animation.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/examples/grid-animation.cc Fri Apr 22 12:41:15 2011 -0700 @@ -24,7 +24,7 @@ #include "ns3/point-to-point-module.h" #include "ns3/netanim-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/point-to-point-layout-module.h" using namespace ns3; diff -r e9ca5b2838e7 src/netanim/examples/star-animation.cc --- a/src/netanim/examples/star-animation.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/examples/star-animation.cc Fri Apr 22 12:41:15 2011 -0700 @@ -21,7 +21,7 @@ #include "ns3/internet-module.h" #include "ns3/point-to-point-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-global-routing-helper.h" +#include "ns3/point-to-point-layout-module.h" // Network topology (default) // diff -r e9ca5b2838e7 src/netanim/examples/wscript --- a/src/netanim/examples/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/examples/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -2,13 +2,13 @@ def build(bld): obj = bld.create_ns3_program('dumbbell-animation', - ['netanim', 'applications']) + ['netanim', 'applications', 'point-to-point-layout']) obj.source = 'dumbbell-animation.cc' obj = bld.create_ns3_program('grid-animation', - ['netanim', 'applications']) + ['netanim', 'applications', 'point-to-point-layout']) obj.source = 'grid-animation.cc' obj = bld.create_ns3_program('star-animation', - ['netanim', 'applications']) + ['netanim', 'applications', 'point-to-point-layout']) obj.source = 'star-animation.cc' diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-dumbbell-helper.cc --- a/src/netanim/helper/point-to-point-dumbbell-helper.cc Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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 - */ - -// Implement an object to create a dumbbell topology. - -#include -#include - -// ns3 includes -#include "ns3/animation-interface.h" -#include "ns3/point-to-point-dumbbell-helper.h" -#include "ns3/constant-position-mobility-model.h" - -#include "ns3/node-list.h" -#include "ns3/point-to-point-net-device.h" -#include "ns3/vector.h" - -NS_LOG_COMPONENT_DEFINE("PointToPointDumbbellHelper"); - -namespace ns3 { - -PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf, - PointToPointHelper leftHelper, - uint32_t nRightLeaf, - PointToPointHelper rightHelper, - PointToPointHelper bottleneckHelper) -{ - // Create the bottleneck routers - m_routers.Create (2); - // Create the leaf nodes - m_leftLeaf.Create (nLeftLeaf); - m_rightLeaf.Create (nRightLeaf); - - // Add the link connecting routers - m_routerDevices = bottleneckHelper.Install (m_routers); - // Add the left side links - for (uint32_t i = 0; i < nLeftLeaf; ++i) - { - NetDeviceContainer c = leftHelper.Install (m_routers.Get (0), - m_leftLeaf.Get (i)); - m_leftRouterDevices.Add (c.Get (0)); - m_leftLeafDevices.Add (c.Get(1)); - } - // Add the right side links - for (uint32_t i = 0; i < nRightLeaf; ++i) - { - NetDeviceContainer c = rightHelper.Install (m_routers.Get (1), - m_rightLeaf.Get (i)); - m_rightRouterDevices.Add (c.Get (0)); - m_rightLeafDevices.Add (c.Get (1)); - } -} - -PointToPointDumbbellHelper::~PointToPointDumbbellHelper () -{} - -Ptr PointToPointDumbbellHelper::GetLeft () const -{ // Get the left side bottleneck router - return m_routers.Get (0); -} - -Ptr PointToPointDumbbellHelper::GetLeft (uint32_t i) const -{ // Get the i'th left side leaf - return m_leftLeaf.Get (i); -} - -Ptr PointToPointDumbbellHelper::GetRight () const -{ // Get the right side bottleneck router - return m_routers.Get (1); -} - -Ptr PointToPointDumbbellHelper::GetRight (uint32_t i) const -{ // Get the i'th right side leaf - return m_rightLeaf.Get (i); -} - -Ipv4Address PointToPointDumbbellHelper::GetLeftIpv4Address (uint32_t i) const -{ - return m_leftLeafInterfaces.GetAddress (i); -} - -Ipv4Address PointToPointDumbbellHelper::GetRightIpv4Address (uint32_t i) const -{ - return m_rightLeafInterfaces.GetAddress (i); -} - -uint32_t PointToPointDumbbellHelper::LeftCount () const -{ // Number of left side nodes - return m_leftLeaf.GetN (); -} - -uint32_t PointToPointDumbbellHelper::RightCount () const -{ // Number of right side nodes - return m_rightLeaf.GetN (); -} - -void PointToPointDumbbellHelper::InstallStack (InternetStackHelper stack) -{ - stack.Install (m_routers); - stack.Install (m_leftLeaf); - stack.Install (m_rightLeaf); -} - -void PointToPointDumbbellHelper::AssignIpv4Addresses (Ipv4AddressHelper leftIp, - Ipv4AddressHelper rightIp, - Ipv4AddressHelper routerIp) -{ - // Assign the router network - m_routerInterfaces = routerIp.Assign (m_routerDevices); - // Assign to left side - for (uint32_t i = 0; i < LeftCount (); ++i) - { - NetDeviceContainer ndc; - ndc.Add (m_leftLeafDevices.Get (i)); - ndc.Add (m_leftRouterDevices.Get (i)); - Ipv4InterfaceContainer ifc = leftIp.Assign(ndc); - m_leftLeafInterfaces.Add (ifc.Get (0)); - m_leftRouterInterfaces.Add (ifc.Get (1)); - leftIp.NewNetwork (); - } - // Assign to right side - for (uint32_t i = 0; i < RightCount (); ++i) - { - NetDeviceContainer ndc; - ndc.Add (m_rightLeafDevices.Get (i)); - ndc.Add (m_rightRouterDevices.Get (i)); - Ipv4InterfaceContainer ifc = rightIp.Assign (ndc); - m_rightLeafInterfaces.Add (ifc.Get (0)); - m_rightRouterInterfaces.Add (ifc.Get (1)); - rightIp.NewNetwork (); - } -} - - -void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper left x/y - double lrx, double lry) // Lower right y -{ - double xDist; - double yDist; - if (lrx > ulx) - { - xDist = lrx - ulx; - } - else - { - xDist = ulx - lrx; - } - if (lry > uly) - { - yDist = lry - uly; - } - else - { - yDist = uly - lry; - } - - double xAdder = xDist / 3.0; - double thetaL = M_PI / (LeftCount () + 1.0); - double thetaR = M_PI / (RightCount () + 1.0); - - // Place the left router - Ptr lr = GetLeft (); - Ptr loc = lr->GetObject (); - if (loc == 0) - { - loc = CreateObject (); - lr->AggregateObject (loc); - } - Vector lrl (ulx + xAdder, uly + yDist/2.0, 0); - loc->SetPosition (lrl); - - // Place the right router - Ptr rr = GetRight (); - loc = rr->GetObject (); - if (loc == 0) - { - loc = CreateObject (); - rr->AggregateObject (loc); - } - Vector rrl (ulx + xAdder * 2, uly + yDist/2.0, 0); // Right router location - loc->SetPosition (rrl); - - // Place the left leaf nodes - double theta = -M_PI_2 + thetaL; - for (uint32_t l = 0; l < LeftCount (); ++l) - { - // Make them in a circular pattern to make all line lengths the same - // Special case when theta = 0, to be sure we get a straight line - if ((LeftCount () % 2) == 1) - { // Count is odd, see if we are in middle - if (l == (LeftCount () / 2)) - { - theta = 0.0; - } - } - Ptr ln = GetLeft (l); - loc = ln->GetObject (); - if (loc == 0) - { - loc = CreateObject (); - ln->AggregateObject (loc); - } - Vector lnl (lrl.x - cos (theta) * xAdder, - lrl.y + sin (theta) * xAdder, 0); // Left Node Location - // Insure did not exceed bounding box - if (lnl.y < uly) - { - lnl.y = uly; // Set to upper right y - } - if (lnl.y > lry) - { - lnl.y = lry; // Set to lower right y - } - loc->SetPosition (lnl); - theta += thetaL; - } - // Place the right nodes - theta = -M_PI_2 + thetaR; - for (uint32_t r = 0; r < RightCount (); ++r) - { - // Special case when theta = 0, to be sure we get a straight line - if ((RightCount () % 2) == 1) - { // Count is odd, see if we are in middle - if (r == (RightCount () / 2)) - { - theta = 0.0; - } - } - Ptr rn = GetRight (r); - loc = rn->GetObject (); - if (loc == 0) - { - loc = CreateObject (); - rn->AggregateObject (loc); - } - Vector rnl (rrl.x + cos (theta) * xAdder, // Right node location - rrl.y + sin (theta) * xAdder, 0); - // Insure did not exceed bounding box - if (rnl.y < uly) - { - rnl.y = uly; // Set to upper right y - } - if (rnl.y > lry) - { - rnl.y = lry; // Set to lower right y - } - loc->SetPosition (rnl); - theta += thetaR; - } -} - -} // namespace ns3 diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-dumbbell-helper.h --- a/src/netanim/helper/point-to-point-dumbbell-helper.h Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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 an object to create a dumbbell topology. - -#ifndef POINT_TO_POINT_DUMBBELL_HELPER_H -#define POINT_TO_POINT_DUMBBELL_HELPER_H - -#include - -#include "point-to-point-helper.h" -#include "ipv4-address-helper.h" -#include "internet-stack-helper.h" -#include "ipv4-interface-container.h" - -namespace ns3 { - -/** - * \brief A helper to make it easier to create a dumbbell topology - * with p2p links - */ -class PointToPointDumbbellHelper -{ -public: - /** - * Create a PointToPointDumbbellHelper in order to easily create - * dumbbell topologies using p2p links - * - * \param nLeftLeaf number of left side leaf nodes in the dumbbell - * - * \param leftHelper PointToPointHelper used to install the links - * between the left leaf nodes and the left-most - * router - * - * \param nRightLeaf number of right side leaf nodes in the dumbbell - * - * \param rightHelper PointToPointHelper used to install the links - * between the right leaf nodes and the right-most - * router - * - * \param bottleneckHelper PointToPointHelper used to install the link - * between the inner-routers, usually known as - * the bottleneck link - */ - PointToPointDumbbellHelper (uint32_t nLeftLeaf, - PointToPointHelper leftHelper, - uint32_t nRightLeaf, - PointToPointHelper rightHelper, - PointToPointHelper bottleneckHelper); - - ~PointToPointDumbbellHelper (); - -public: - /** - * \returns pointer to the node of the left side bottleneck - * router - */ - Ptr GetLeft () const; - - /** - * \returns pointer to the i'th left side leaf node - */ - Ptr GetLeft (uint32_t i) const; - - /** - * \returns pointer to the node of the right side bottleneck - * router - */ - Ptr GetRight () const; - - /** - * \returns pointer to the i'th left side leaf node - */ - Ptr GetRight (uint32_t i) const; - - /** - * \returns an Ipv4Address of the i'th left leaf - */ - Ipv4Address GetLeftIpv4Address (uint32_t i ) const; // Get left leaf address - - /** - * \returns an Ipv4Address of the i'th right leaf - */ - Ipv4Address GetRightIpv4Address (uint32_t i) const; // Get right leaf address - - /** - * \returns total number of left side leaf nodes - */ - uint32_t LeftCount () const; - - /** - * \returns total number of right side leaf nodes - */ - uint32_t RightCount () const; - - /** - * \param stack an InternetStackHelper which is used to install - * on every node in the dumbbell - */ - void InstallStack (InternetStackHelper stack); - - /** - * \param leftIp Ipv4AddressHelper to assign Ipv4 addresses to the - * interfaces on the left side of the dumbbell - * - * \param rightIp Ipv4AddressHelper to assign Ipv4 addresses to the - * interfaces on the right side of the dumbbell - * - * \param routerIp Ipv4AddressHelper to assign Ipv4 addresses to the - * interfaces on the bottleneck link - */ - void AssignIpv4Addresses (Ipv4AddressHelper leftIp, - Ipv4AddressHelper rightIp, - Ipv4AddressHelper routerIp); - - /** - * Sets up the node canvas locations for every node in the dumbbell. - * This is needed for use with the animation interface - * - * \param ulx upper left x value - * \param uly upper left y value - * \param lrx lower right x value - * \param lry lower right y value - */ - void BoundingBox (double ulx, double uly, double lrx, double lry); - -private: - NodeContainer m_leftLeaf; - NetDeviceContainer m_leftLeafDevices; - NodeContainer m_rightLeaf; - NetDeviceContainer m_rightLeafDevices; - NodeContainer m_routers; - NetDeviceContainer m_routerDevices; // just two connecting the routers - NetDeviceContainer m_leftRouterDevices; - NetDeviceContainer m_rightRouterDevices; - Ipv4InterfaceContainer m_leftLeafInterfaces; - Ipv4InterfaceContainer m_leftRouterInterfaces; - Ipv4InterfaceContainer m_rightLeafInterfaces; - Ipv4InterfaceContainer m_rightRouterInterfaces; - Ipv4InterfaceContainer m_routerInterfaces; -}; - -} // namespace ns3 - -#endif /* POINT_TO_POINT_DUMBBELL_HELPER_H */ diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-grid-helper.cc --- a/src/netanim/helper/point-to-point-grid-helper.cc Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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: Josh Pelkey - */ - -#include "ns3/point-to-point-grid-helper.h" -#include "ns3/animation-interface.h" -#include "ns3/internet-stack-helper.h" -#include "ns3/point-to-point-helper.h" -#include "ns3/constant-position-mobility-model.h" -#include "ns3/string.h" -#include "ns3/vector.h" -#include "ns3/log.h" - -NS_LOG_COMPONENT_DEFINE("PointToPointGridHelper"); - -namespace ns3 { - -PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows, - uint32_t nCols, - PointToPointHelper pointToPoint) - : m_xSize (nCols), m_ySize (nRows) -{ - // Bounds check - if (m_xSize < 1 || m_ySize < 1 || (m_xSize < 2 && m_ySize < 2)) - { - NS_FATAL_ERROR ("Need more nodes for grid."); - } - - InternetStackHelper stack; - - for (uint32_t y = 0; y < nRows; ++y) - { - NodeContainer rowNodes; - NetDeviceContainer rowDevices; - NetDeviceContainer colDevices; - - for (uint32_t x = 0; x < nCols; ++x) - { - rowNodes.Create (1); - - // install p2p links across the row - if (x > 0) - { - rowDevices.Add (pointToPoint. - Install (rowNodes.Get (x-1), rowNodes.Get (x))); - } - - // install vertical p2p links - if (y > 0) - { - colDevices.Add(pointToPoint. - Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x))); - } - } - - m_nodes.push_back (rowNodes); - m_rowDevices.push_back (rowDevices); - - if (y > 0) - m_colDevices.push_back (colDevices); - } -} - -PointToPointGridHelper::~PointToPointGridHelper () -{} - -void -PointToPointGridHelper::InstallStack (InternetStackHelper stack) -{ - for (uint32_t i = 0; i < m_nodes.size (); ++i) - { - NodeContainer rowNodes = m_nodes[i]; - for (uint32_t j = 0; j < rowNodes.GetN (); ++j) - { - stack.Install (rowNodes.Get (j)); - } - } -} - -void -PointToPointGridHelper::AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp) -{ - // Assign addresses to all row devices in the grid. - // These devices are stored in a vector. Each row - // of the grid has all the row devices in one entry - // of the vector. These entries come in pairs. - for (uint32_t i = 0; i < m_rowDevices.size (); ++i) - { - Ipv4InterfaceContainer rowInterfaces; - NetDeviceContainer rowContainer = m_rowDevices[i]; - for (uint32_t j = 0; j < rowContainer.GetN (); j+=2) - { - rowInterfaces.Add (rowIp.Assign (rowContainer.Get (j))); - rowInterfaces.Add (rowIp.Assign (rowContainer.Get (j+1))); - rowIp.NewNetwork (); - } - m_rowInterfaces.push_back (rowInterfaces); - } - - // Assign addresses to all col devices in the grid. - // These devices are stored in a vector. Each col - // of the grid has all the col devices in one entry - // of the vector. These entries come in pairs. - for (uint32_t i = 0; i < m_colDevices.size (); ++i) - { - Ipv4InterfaceContainer colInterfaces; - NetDeviceContainer colContainer = m_colDevices[i]; - for (uint32_t j = 0; j < colContainer.GetN (); j+=2) - { - colInterfaces.Add (colIp.Assign (colContainer.Get (j))); - colInterfaces.Add (colIp.Assign (colContainer.Get (j+1))); - colIp.NewNetwork (); - } - m_colInterfaces.push_back (colInterfaces); - } -} - -void -PointToPointGridHelper::BoundingBox (double ulx, double uly, - double lrx, double lry) -{ - double xDist; - double yDist; - if (lrx > ulx) - { - xDist = lrx - ulx; - } - else - { - xDist = ulx - lrx; - } - if (lry > uly) - { - yDist = lry - uly; - } - else - { - yDist = uly - lry; - } - double xAdder = xDist / m_xSize; - double yAdder = yDist / m_ySize; - double yLoc = yDist / 2; - for (uint32_t i = 0; i < m_ySize; ++i) - { - double xLoc = xDist / 2; - for (uint32_t j = 0; j < m_xSize; ++j) - { - Ptr node = GetNode (i, j); - Ptr loc = node->GetObject (); - if (loc ==0) - { - loc = CreateObject (); - node->AggregateObject (loc); - } - Vector locVec (xLoc, yLoc, 0); - loc->SetPosition (locVec); - - xLoc += xAdder; - } - yLoc += yAdder; - } -} - -Ptr -PointToPointGridHelper::GetNode (uint32_t row, uint32_t col) -{ - if (row > m_nodes.size () - 1 || - col > m_nodes.at (row).GetN () - 1) - { - NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetNode."); - } - - return (m_nodes.at (row)).Get (col); -} - -Ipv4Address -PointToPointGridHelper::GetIpv4Address (uint32_t row, uint32_t col) -{ - if (row > m_nodes.size () - 1 || - col > m_nodes.at (row).GetN () - 1) - { - NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetIpv4Address."); - } - - // Right now this just gets one of the addresses of the - // specified node. The exact device can't be specified. - // If you picture the grid, the address returned is the - // address of the left (row) device of all nodes, with - // the exception of the left-most nodes in the grid; - // in which case the right (row) device address is - // returned - if (col == 0) - { - return (m_rowInterfaces.at (row)).GetAddress (0); - } - else - { - return (m_rowInterfaces.at (row)).GetAddress ((2*col)-1); - } -} - -} // namespace ns3 diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-grid-helper.h --- a/src/netanim/helper/point-to-point-grid-helper.h Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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: Josh Pelkey - */ - -#ifndef POINT_TO_POINT_GRID_HELPER_H -#define POINT_TO_POINT_GRID_HELPER_H - -#include - -#include "internet-stack-helper.h" -#include "point-to-point-helper.h" -#include "ipv4-address-helper.h" -#include "ipv4-interface-container.h" -#include "net-device-container.h" - -namespace ns3 { - -/** - * \brief A helper to make it easier to create a grid topology - * with p2p links - */ -class PointToPointGridHelper -{ -public: - /** - * Create a PointToPointGridHelper in order to easily create - * grid topologies using p2p links - * - * \param nRows total number of rows in the grid - * - * \param nCols total number of colums in the grid - * - * \param pointToPoint the PointToPointHelper which is used - * to connect all of the nodes together - * in the grid - */ - PointToPointGridHelper (uint32_t nRows, - uint32_t nCols, - PointToPointHelper pointToPoint); - - ~PointToPointGridHelper (); - - /** - * \param row the row address of the node desired - * - * \param col the column address of the node desired - * - * \returns a pointer to the node specified by the - * (row, col) address - */ - Ptr GetNode (uint32_t row, uint32_t col); - - /** - * This returns an Ipv4 address at the node specified by - * the (row, col) address. Technically, a node will have - * multiple interfaces in the grid; therefore, it also has - * multiple Ipv4 addresses. This method only returns one of - * the addresses. If you picture the grid, the address returned - * is the left row device of all the nodes, except the left-most - * grid nodes, which returns the right row device. - * - * \param row the row address of the node desired - * - * \param col the column address of the node desired - * - * \returns Ipv4Address of one of the interfaces of the node - * specified by the (row, col) address - */ - Ipv4Address GetIpv4Address (uint32_t row, uint32_t col); - - /** - * \param stack an InternetStackHelper which is used to install - * on every node in the grid - */ - void InstallStack (InternetStackHelper stack); - - /** - * Assigns Ipv4 addresses to all the row and column interfaces - * - * \param rowIp the Ipv4AddressHelper used to assign Ipv4 addresses - * to all of the row interfaces in the grid - * - * \param colIp the Ipv4AddressHelper used to assign Ipv4 addresses - * to all of the row interfaces in the grid - */ - void AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp); - - /** - * Sets up the node canvas locations for every node in the grid. - * This is needed for use with the animation interface - * - * \param ulx upper left x value - * \param uly upper left y value - * \param lrx lower right x value - * \param lry lower right y value - */ - void BoundingBox (double ulx, double uly, double lrx, double lry); - -private: - uint32_t m_xSize; - uint32_t m_ySize; - std::vector m_rowDevices; - std::vector m_colDevices; - std::vector m_rowInterfaces; - std::vector m_colInterfaces; - std::vector m_nodes; -}; - -} // namespace ns3 - -#endif /* POINT_TO_POINT_GRID_HELPER_H */ diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-star-helper.cc --- a/src/netanim/helper/point-to-point-star-helper.cc Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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 - */ - -#include -#include - -// ns3 includes -#include "ns3/animation-interface.h" -#include "ns3/point-to-point-star-helper.h" -#include "ns3/constant-position-mobility-model.h" - -#include "ns3/node-list.h" -#include "ns3/point-to-point-net-device.h" -#include "ns3/vector.h" - -NS_LOG_COMPONENT_DEFINE("PointToPointStarHelper"); - -namespace ns3 { - -PointToPointStarHelper::PointToPointStarHelper (uint32_t numSpokes, - PointToPointHelper p2pHelper) -{ - m_hub.Create (1); - m_spokes.Create (numSpokes); - - for (uint32_t i = 0; i < m_spokes.GetN (); ++i) - { - NetDeviceContainer nd = p2pHelper.Install (m_hub.Get (0), m_spokes.Get (i)); - m_hubDevices.Add (nd.Get (0)); - m_spokeDevices.Add (nd.Get (1)); - } -} - -PointToPointStarHelper::~PointToPointStarHelper () -{} - -Ptr -PointToPointStarHelper::GetHub () const -{ - return m_hub.Get (0); -} - -Ptr -PointToPointStarHelper::GetSpokeNode (uint32_t i) const -{ - return m_spokes.Get (i); -} - -Ipv4Address -PointToPointStarHelper::GetHubIpv4Address (uint32_t i) const -{ - return m_hubInterfaces.GetAddress (i); -} - -Ipv4Address -PointToPointStarHelper::GetSpokeIpv4Address (uint32_t i) const -{ - return m_spokeInterfaces.GetAddress (i); -} - -uint32_t -PointToPointStarHelper::SpokeCount () const -{ - return m_spokes.GetN (); -} - -void -PointToPointStarHelper::InstallStack (InternetStackHelper stack) -{ - stack.Install (m_hub); - stack.Install (m_spokes); -} - -void -PointToPointStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) -{ - for (uint32_t i = 0; i < m_spokes.GetN (); ++i) - { - m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); - m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); - address.NewNetwork (); - } -} - -void -PointToPointStarHelper::BoundingBox (double ulx, double uly, - double lrx, double lry) -{ - double xDist; - double yDist; - if (lrx > ulx) - { - xDist = lrx - ulx; - } - else - { - xDist = ulx - lrx; - } - if (lry > uly) - { - yDist = lry - uly; - } - else - { - yDist = uly - lry; - } - - // Place the hub - Ptr hub = m_hub.Get (0); - Ptr hubLoc = hub->GetObject (); - if (hubLoc == 0) - { - hubLoc = CreateObject (); - hub->AggregateObject (hubLoc); - } - Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0); - hubLoc->SetPosition (hubVec); - - double spokeDist; - if (xDist > yDist) - { - spokeDist = yDist/4.0; - } - else - { - spokeDist = xDist/4.0; - } - - double theta = 2*M_PI/m_spokes.GetN (); - for (uint32_t i = 0; i < m_spokes.GetN (); ++i) - { - Ptr spokeNode = m_spokes.Get (i); - Ptr spokeLoc = spokeNode->GetObject (); - if (spokeLoc == 0) - { - spokeLoc = CreateObject (); - spokeNode->AggregateObject (spokeLoc); - } - Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, - hubVec.y + sin (theta*i) * spokeDist, - 0); - spokeLoc->SetPosition (spokeVec); - } -} - -} // namespace ns3 diff -r e9ca5b2838e7 src/netanim/helper/point-to-point-star-helper.h --- a/src/netanim/helper/point-to-point-star-helper.h Thu Apr 21 13:51:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * 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 - */ - -// Define an object to create a dumbbell topology. - -#ifndef POINT_TO_POINT_STAR_HELPER_H -#define POINT_TO_POINT_STAR_HELPER_H - -#include - -#include "point-to-point-helper.h" -#include "ipv4-address-helper.h" -#include "internet-stack-helper.h" -#include "ipv4-interface-container.h" - -namespace ns3 { - -/** - * \brief A helper to make it easier to create a star topology - * with PointToPoint links - */ -class PointToPointStarHelper -{ -public: - /** - * Create a PointToPointStarHelper in order to easily create - * star topologies using p2p links - * - * \param numSpokes the number of links attached to - * the hub node, creating a total of - * numSpokes + 1 nodes - * - * \param p2pHelper the link helper for p2p links, - * used to link nodes together - */ - PointToPointStarHelper (uint32_t numSpokes, - PointToPointHelper p2pHelper); - - ~PointToPointStarHelper (); - -public: - /** - * \returns a node pointer to the hub node in the - * star, i.e., the center node - */ - Ptr GetHub () const; - - /** - * \param i an index into the spokes of the star - * - * \returns a node pointer to the node at the indexed spoke - */ - Ptr GetSpokeNode (uint32_t i) const; - - /** - * \param i index into the hub interfaces - * - * \returns Ipv4Address according to indexed hub interface - */ - Ipv4Address GetHubIpv4Address (uint32_t i) const; - - /** - * \param i index into the spoke interfaces - * - * \returns Ipv4Address according to indexed spoke interface - */ - Ipv4Address GetSpokeIpv4Address (uint32_t i) const; - - /** - * \returns the total number of spokes in the star - */ - uint32_t SpokeCount () const; - - /** - * \param stack an InternetStackHelper which is used to install - * on every node in the star - */ - void InstallStack (InternetStackHelper stack); - - /** - * \param address an Ipv4AddressHelper which is used to install - * Ipv4 addresses on all the node interfaces in - * the star - */ - void AssignIpv4Addresses (Ipv4AddressHelper address); - - /** - * Sets up the node canvas locations for every node in the star. - * This is needed for use with the animation interface - * - * \param ulx upper left x value - * \param uly upper left y value - * \param lrx lower right x value - * \param lry lower right y value - */ - void BoundingBox (double ulx, double uly, double lrx, double lry); - -private: - NodeContainer m_hub; - NetDeviceContainer m_hubDevices; - NodeContainer m_spokes; - NetDeviceContainer m_spokeDevices; - Ipv4InterfaceContainer m_hubInterfaces; - Ipv4InterfaceContainer m_spokeInterfaces; -}; - -} // namespace ns3 - -#endif /* POINT_TO_POINT_STAR_HELPER_H */ diff -r e9ca5b2838e7 src/netanim/model/animation-interface.cc --- a/src/netanim/model/animation-interface.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/model/animation-interface.cc Fri Apr 22 12:41:15 2011 -0700 @@ -21,8 +21,6 @@ #include #include -#include "ns3/netanim-config.h" - // Socket related includes #if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H) #include diff -r e9ca5b2838e7 src/netanim/wscript --- a/src/netanim/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/src/netanim/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -1,22 +1,16 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - module = bld.create_ns3_module('netanim', ['internet', 'point-to-point', 'mobility']) + module = bld.create_ns3_module('netanim', ['internet', 'mobility']) module.includes = '.' module.source = [ 'model/animation-interface.cc', - 'helper/point-to-point-dumbbell-helper.cc', - 'helper/point-to-point-grid-helper.cc', - 'helper/point-to-point-star-helper.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'netanim' headers.source = [ 'model/animation-interface.h', - 'helper/point-to-point-dumbbell-helper.h', - 'helper/point-to-point-grid-helper.h', - 'helper/point-to-point-star-helper.h', ] if (bld.env['ENABLE_EXAMPLES']): @@ -28,5 +22,4 @@ def configure(conf): conf.check(header_name='sys/socket.h', define_name='HAVE_SYS_SOCKET_H') conf.check(header_name='netinet/in.h', define_name='HAVE_NETINET_IN_H') - conf.write_config_header('ns3/netanim-config.h', top=True) diff -r e9ca5b2838e7 src/olsr/examples/olsr-hna.cc --- a/src/olsr/examples/olsr-hna.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/olsr/examples/olsr-hna.cc Fri Apr 22 12:41:15 2011 -0700 @@ -56,11 +56,9 @@ #include "ns3/config-store-module.h" #include "ns3/wifi-module.h" #include "ns3/csma-module.h" -#include "ns3/ipv4-list-routing.h" +#include "ns3/internet-module.h" #include "ns3/olsr-routing-protocol.h" #include "ns3/olsr-helper.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include #include diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-dumbbell.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-dumbbell.cc Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,267 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Implement an object to create a dumbbell topology. + +#include +#include + +// ns3 includes +#include "ns3/animation-interface.h" +#include "ns3/point-to-point-dumbbell.h" +#include "ns3/constant-position-mobility-model.h" + +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/vector.h" + +NS_LOG_COMPONENT_DEFINE("PointToPointDumbbellHelper"); + +namespace ns3 { + +PointToPointDumbbellHelper::PointToPointDumbbellHelper (uint32_t nLeftLeaf, + PointToPointHelper leftHelper, + uint32_t nRightLeaf, + PointToPointHelper rightHelper, + PointToPointHelper bottleneckHelper) +{ + // Create the bottleneck routers + m_routers.Create (2); + // Create the leaf nodes + m_leftLeaf.Create (nLeftLeaf); + m_rightLeaf.Create (nRightLeaf); + + // Add the link connecting routers + m_routerDevices = bottleneckHelper.Install (m_routers); + // Add the left side links + for (uint32_t i = 0; i < nLeftLeaf; ++i) + { + NetDeviceContainer c = leftHelper.Install (m_routers.Get (0), + m_leftLeaf.Get (i)); + m_leftRouterDevices.Add (c.Get (0)); + m_leftLeafDevices.Add (c.Get(1)); + } + // Add the right side links + for (uint32_t i = 0; i < nRightLeaf; ++i) + { + NetDeviceContainer c = rightHelper.Install (m_routers.Get (1), + m_rightLeaf.Get (i)); + m_rightRouterDevices.Add (c.Get (0)); + m_rightLeafDevices.Add (c.Get (1)); + } +} + +PointToPointDumbbellHelper::~PointToPointDumbbellHelper () +{} + +Ptr PointToPointDumbbellHelper::GetLeft () const +{ // Get the left side bottleneck router + return m_routers.Get (0); +} + +Ptr PointToPointDumbbellHelper::GetLeft (uint32_t i) const +{ // Get the i'th left side leaf + return m_leftLeaf.Get (i); +} + +Ptr PointToPointDumbbellHelper::GetRight () const +{ // Get the right side bottleneck router + return m_routers.Get (1); +} + +Ptr PointToPointDumbbellHelper::GetRight (uint32_t i) const +{ // Get the i'th right side leaf + return m_rightLeaf.Get (i); +} + +Ipv4Address PointToPointDumbbellHelper::GetLeftIpv4Address (uint32_t i) const +{ + return m_leftLeafInterfaces.GetAddress (i); +} + +Ipv4Address PointToPointDumbbellHelper::GetRightIpv4Address (uint32_t i) const +{ + return m_rightLeafInterfaces.GetAddress (i); +} + +uint32_t PointToPointDumbbellHelper::LeftCount () const +{ // Number of left side nodes + return m_leftLeaf.GetN (); +} + +uint32_t PointToPointDumbbellHelper::RightCount () const +{ // Number of right side nodes + return m_rightLeaf.GetN (); +} + +void PointToPointDumbbellHelper::InstallStack (InternetStackHelper stack) +{ + stack.Install (m_routers); + stack.Install (m_leftLeaf); + stack.Install (m_rightLeaf); +} + +void PointToPointDumbbellHelper::AssignIpv4Addresses (Ipv4AddressHelper leftIp, + Ipv4AddressHelper rightIp, + Ipv4AddressHelper routerIp) +{ + // Assign the router network + m_routerInterfaces = routerIp.Assign (m_routerDevices); + // Assign to left side + for (uint32_t i = 0; i < LeftCount (); ++i) + { + NetDeviceContainer ndc; + ndc.Add (m_leftLeafDevices.Get (i)); + ndc.Add (m_leftRouterDevices.Get (i)); + Ipv4InterfaceContainer ifc = leftIp.Assign(ndc); + m_leftLeafInterfaces.Add (ifc.Get (0)); + m_leftRouterInterfaces.Add (ifc.Get (1)); + leftIp.NewNetwork (); + } + // Assign to right side + for (uint32_t i = 0; i < RightCount (); ++i) + { + NetDeviceContainer ndc; + ndc.Add (m_rightLeafDevices.Get (i)); + ndc.Add (m_rightRouterDevices.Get (i)); + Ipv4InterfaceContainer ifc = rightIp.Assign (ndc); + m_rightLeafInterfaces.Add (ifc.Get (0)); + m_rightRouterInterfaces.Add (ifc.Get (1)); + rightIp.NewNetwork (); + } +} + + +void PointToPointDumbbellHelper::BoundingBox (double ulx, double uly, // Upper left x/y + double lrx, double lry) // Lower right y +{ + double xDist; + double yDist; + if (lrx > ulx) + { + xDist = lrx - ulx; + } + else + { + xDist = ulx - lrx; + } + if (lry > uly) + { + yDist = lry - uly; + } + else + { + yDist = uly - lry; + } + + double xAdder = xDist / 3.0; + double thetaL = M_PI / (LeftCount () + 1.0); + double thetaR = M_PI / (RightCount () + 1.0); + + // Place the left router + Ptr lr = GetLeft (); + Ptr loc = lr->GetObject (); + if (loc == 0) + { + loc = CreateObject (); + lr->AggregateObject (loc); + } + Vector lrl (ulx + xAdder, uly + yDist/2.0, 0); + loc->SetPosition (lrl); + + // Place the right router + Ptr rr = GetRight (); + loc = rr->GetObject (); + if (loc == 0) + { + loc = CreateObject (); + rr->AggregateObject (loc); + } + Vector rrl (ulx + xAdder * 2, uly + yDist/2.0, 0); // Right router location + loc->SetPosition (rrl); + + // Place the left leaf nodes + double theta = -M_PI_2 + thetaL; + for (uint32_t l = 0; l < LeftCount (); ++l) + { + // Make them in a circular pattern to make all line lengths the same + // Special case when theta = 0, to be sure we get a straight line + if ((LeftCount () % 2) == 1) + { // Count is odd, see if we are in middle + if (l == (LeftCount () / 2)) + { + theta = 0.0; + } + } + Ptr ln = GetLeft (l); + loc = ln->GetObject (); + if (loc == 0) + { + loc = CreateObject (); + ln->AggregateObject (loc); + } + Vector lnl (lrl.x - cos (theta) * xAdder, + lrl.y + sin (theta) * xAdder, 0); // Left Node Location + // Insure did not exceed bounding box + if (lnl.y < uly) + { + lnl.y = uly; // Set to upper right y + } + if (lnl.y > lry) + { + lnl.y = lry; // Set to lower right y + } + loc->SetPosition (lnl); + theta += thetaL; + } + // Place the right nodes + theta = -M_PI_2 + thetaR; + for (uint32_t r = 0; r < RightCount (); ++r) + { + // Special case when theta = 0, to be sure we get a straight line + if ((RightCount () % 2) == 1) + { // Count is odd, see if we are in middle + if (r == (RightCount () / 2)) + { + theta = 0.0; + } + } + Ptr rn = GetRight (r); + loc = rn->GetObject (); + if (loc == 0) + { + loc = CreateObject (); + rn->AggregateObject (loc); + } + Vector rnl (rrl.x + cos (theta) * xAdder, // Right node location + rrl.y + sin (theta) * xAdder, 0); + // Insure did not exceed bounding box + if (rnl.y < uly) + { + rnl.y = uly; // Set to upper right y + } + if (rnl.y > lry) + { + rnl.y = lry; // Set to lower right y + } + loc->SetPosition (rnl); + theta += thetaR; + } +} + +} // namespace ns3 diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-dumbbell.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-dumbbell.h Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,160 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 an object to create a dumbbell topology. + +#ifndef POINT_TO_POINT_DUMBBELL_HELPER_H +#define POINT_TO_POINT_DUMBBELL_HELPER_H + +#include + +#include "point-to-point-helper.h" +#include "ipv4-address-helper.h" +#include "internet-stack-helper.h" +#include "ipv4-interface-container.h" + +namespace ns3 { + +/** + * \brief A helper to make it easier to create a dumbbell topology + * with p2p links + */ +class PointToPointDumbbellHelper +{ +public: + /** + * Create a PointToPointDumbbellHelper in order to easily create + * dumbbell topologies using p2p links + * + * \param nLeftLeaf number of left side leaf nodes in the dumbbell + * + * \param leftHelper PointToPointHelper used to install the links + * between the left leaf nodes and the left-most + * router + * + * \param nRightLeaf number of right side leaf nodes in the dumbbell + * + * \param rightHelper PointToPointHelper used to install the links + * between the right leaf nodes and the right-most + * router + * + * \param bottleneckHelper PointToPointHelper used to install the link + * between the inner-routers, usually known as + * the bottleneck link + */ + PointToPointDumbbellHelper (uint32_t nLeftLeaf, + PointToPointHelper leftHelper, + uint32_t nRightLeaf, + PointToPointHelper rightHelper, + PointToPointHelper bottleneckHelper); + + ~PointToPointDumbbellHelper (); + +public: + /** + * \returns pointer to the node of the left side bottleneck + * router + */ + Ptr GetLeft () const; + + /** + * \returns pointer to the i'th left side leaf node + */ + Ptr GetLeft (uint32_t i) const; + + /** + * \returns pointer to the node of the right side bottleneck + * router + */ + Ptr GetRight () const; + + /** + * \returns pointer to the i'th left side leaf node + */ + Ptr GetRight (uint32_t i) const; + + /** + * \returns an Ipv4Address of the i'th left leaf + */ + Ipv4Address GetLeftIpv4Address (uint32_t i ) const; // Get left leaf address + + /** + * \returns an Ipv4Address of the i'th right leaf + */ + Ipv4Address GetRightIpv4Address (uint32_t i) const; // Get right leaf address + + /** + * \returns total number of left side leaf nodes + */ + uint32_t LeftCount () const; + + /** + * \returns total number of right side leaf nodes + */ + uint32_t RightCount () const; + + /** + * \param stack an InternetStackHelper which is used to install + * on every node in the dumbbell + */ + void InstallStack (InternetStackHelper stack); + + /** + * \param leftIp Ipv4AddressHelper to assign Ipv4 addresses to the + * interfaces on the left side of the dumbbell + * + * \param rightIp Ipv4AddressHelper to assign Ipv4 addresses to the + * interfaces on the right side of the dumbbell + * + * \param routerIp Ipv4AddressHelper to assign Ipv4 addresses to the + * interfaces on the bottleneck link + */ + void AssignIpv4Addresses (Ipv4AddressHelper leftIp, + Ipv4AddressHelper rightIp, + Ipv4AddressHelper routerIp); + + /** + * Sets up the node canvas locations for every node in the dumbbell. + * This is needed for use with the animation interface + * + * \param ulx upper left x value + * \param uly upper left y value + * \param lrx lower right x value + * \param lry lower right y value + */ + void BoundingBox (double ulx, double uly, double lrx, double lry); + +private: + NodeContainer m_leftLeaf; + NetDeviceContainer m_leftLeafDevices; + NodeContainer m_rightLeaf; + NetDeviceContainer m_rightLeafDevices; + NodeContainer m_routers; + NetDeviceContainer m_routerDevices; // just two connecting the routers + NetDeviceContainer m_leftRouterDevices; + NetDeviceContainer m_rightRouterDevices; + Ipv4InterfaceContainer m_leftLeafInterfaces; + Ipv4InterfaceContainer m_leftRouterInterfaces; + Ipv4InterfaceContainer m_rightLeafInterfaces; + Ipv4InterfaceContainer m_rightRouterInterfaces; + Ipv4InterfaceContainer m_routerInterfaces; +}; + +} // namespace ns3 + +#endif /* POINT_TO_POINT_DUMBBELL_HELPER_H */ diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-grid.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-grid.cc Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,216 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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: Josh Pelkey + */ + +#include "ns3/point-to-point-grid.h" +#include "ns3/animation-interface.h" +#include "ns3/internet-stack-helper.h" +#include "ns3/point-to-point-helper.h" +#include "ns3/constant-position-mobility-model.h" +#include "ns3/string.h" +#include "ns3/vector.h" +#include "ns3/log.h" + +NS_LOG_COMPONENT_DEFINE("PointToPointGridHelper"); + +namespace ns3 { + +PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows, + uint32_t nCols, + PointToPointHelper pointToPoint) + : m_xSize (nCols), m_ySize (nRows) +{ + // Bounds check + if (m_xSize < 1 || m_ySize < 1 || (m_xSize < 2 && m_ySize < 2)) + { + NS_FATAL_ERROR ("Need more nodes for grid."); + } + + InternetStackHelper stack; + + for (uint32_t y = 0; y < nRows; ++y) + { + NodeContainer rowNodes; + NetDeviceContainer rowDevices; + NetDeviceContainer colDevices; + + for (uint32_t x = 0; x < nCols; ++x) + { + rowNodes.Create (1); + + // install p2p links across the row + if (x > 0) + { + rowDevices.Add (pointToPoint. + Install (rowNodes.Get (x-1), rowNodes.Get (x))); + } + + // install vertical p2p links + if (y > 0) + { + colDevices.Add(pointToPoint. + Install ((m_nodes.at (y-1)).Get (x), rowNodes.Get (x))); + } + } + + m_nodes.push_back (rowNodes); + m_rowDevices.push_back (rowDevices); + + if (y > 0) + m_colDevices.push_back (colDevices); + } +} + +PointToPointGridHelper::~PointToPointGridHelper () +{} + +void +PointToPointGridHelper::InstallStack (InternetStackHelper stack) +{ + for (uint32_t i = 0; i < m_nodes.size (); ++i) + { + NodeContainer rowNodes = m_nodes[i]; + for (uint32_t j = 0; j < rowNodes.GetN (); ++j) + { + stack.Install (rowNodes.Get (j)); + } + } +} + +void +PointToPointGridHelper::AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp) +{ + // Assign addresses to all row devices in the grid. + // These devices are stored in a vector. Each row + // of the grid has all the row devices in one entry + // of the vector. These entries come in pairs. + for (uint32_t i = 0; i < m_rowDevices.size (); ++i) + { + Ipv4InterfaceContainer rowInterfaces; + NetDeviceContainer rowContainer = m_rowDevices[i]; + for (uint32_t j = 0; j < rowContainer.GetN (); j+=2) + { + rowInterfaces.Add (rowIp.Assign (rowContainer.Get (j))); + rowInterfaces.Add (rowIp.Assign (rowContainer.Get (j+1))); + rowIp.NewNetwork (); + } + m_rowInterfaces.push_back (rowInterfaces); + } + + // Assign addresses to all col devices in the grid. + // These devices are stored in a vector. Each col + // of the grid has all the col devices in one entry + // of the vector. These entries come in pairs. + for (uint32_t i = 0; i < m_colDevices.size (); ++i) + { + Ipv4InterfaceContainer colInterfaces; + NetDeviceContainer colContainer = m_colDevices[i]; + for (uint32_t j = 0; j < colContainer.GetN (); j+=2) + { + colInterfaces.Add (colIp.Assign (colContainer.Get (j))); + colInterfaces.Add (colIp.Assign (colContainer.Get (j+1))); + colIp.NewNetwork (); + } + m_colInterfaces.push_back (colInterfaces); + } +} + +void +PointToPointGridHelper::BoundingBox (double ulx, double uly, + double lrx, double lry) +{ + double xDist; + double yDist; + if (lrx > ulx) + { + xDist = lrx - ulx; + } + else + { + xDist = ulx - lrx; + } + if (lry > uly) + { + yDist = lry - uly; + } + else + { + yDist = uly - lry; + } + double xAdder = xDist / m_xSize; + double yAdder = yDist / m_ySize; + double yLoc = yDist / 2; + for (uint32_t i = 0; i < m_ySize; ++i) + { + double xLoc = xDist / 2; + for (uint32_t j = 0; j < m_xSize; ++j) + { + Ptr node = GetNode (i, j); + Ptr loc = node->GetObject (); + if (loc ==0) + { + loc = CreateObject (); + node->AggregateObject (loc); + } + Vector locVec (xLoc, yLoc, 0); + loc->SetPosition (locVec); + + xLoc += xAdder; + } + yLoc += yAdder; + } +} + +Ptr +PointToPointGridHelper::GetNode (uint32_t row, uint32_t col) +{ + if (row > m_nodes.size () - 1 || + col > m_nodes.at (row).GetN () - 1) + { + NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetNode."); + } + + return (m_nodes.at (row)).Get (col); +} + +Ipv4Address +PointToPointGridHelper::GetIpv4Address (uint32_t row, uint32_t col) +{ + if (row > m_nodes.size () - 1 || + col > m_nodes.at (row).GetN () - 1) + { + NS_FATAL_ERROR ("Index out of bounds in PointToPointGridHelper::GetIpv4Address."); + } + + // Right now this just gets one of the addresses of the + // specified node. The exact device can't be specified. + // If you picture the grid, the address returned is the + // address of the left (row) device of all nodes, with + // the exception of the left-most nodes in the grid; + // in which case the right (row) device address is + // returned + if (col == 0) + { + return (m_rowInterfaces.at (row)).GetAddress (0); + } + else + { + return (m_rowInterfaces.at (row)).GetAddress ((2*col)-1); + } +} + +} // namespace ns3 diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-grid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-grid.h Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,125 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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: Josh Pelkey + */ + +#ifndef POINT_TO_POINT_GRID_HELPER_H +#define POINT_TO_POINT_GRID_HELPER_H + +#include + +#include "internet-stack-helper.h" +#include "point-to-point-helper.h" +#include "ipv4-address-helper.h" +#include "ipv4-interface-container.h" +#include "net-device-container.h" + +namespace ns3 { + +/** + * \brief A helper to make it easier to create a grid topology + * with p2p links + */ +class PointToPointGridHelper +{ +public: + /** + * Create a PointToPointGridHelper in order to easily create + * grid topologies using p2p links + * + * \param nRows total number of rows in the grid + * + * \param nCols total number of colums in the grid + * + * \param pointToPoint the PointToPointHelper which is used + * to connect all of the nodes together + * in the grid + */ + PointToPointGridHelper (uint32_t nRows, + uint32_t nCols, + PointToPointHelper pointToPoint); + + ~PointToPointGridHelper (); + + /** + * \param row the row address of the node desired + * + * \param col the column address of the node desired + * + * \returns a pointer to the node specified by the + * (row, col) address + */ + Ptr GetNode (uint32_t row, uint32_t col); + + /** + * This returns an Ipv4 address at the node specified by + * the (row, col) address. Technically, a node will have + * multiple interfaces in the grid; therefore, it also has + * multiple Ipv4 addresses. This method only returns one of + * the addresses. If you picture the grid, the address returned + * is the left row device of all the nodes, except the left-most + * grid nodes, which returns the right row device. + * + * \param row the row address of the node desired + * + * \param col the column address of the node desired + * + * \returns Ipv4Address of one of the interfaces of the node + * specified by the (row, col) address + */ + Ipv4Address GetIpv4Address (uint32_t row, uint32_t col); + + /** + * \param stack an InternetStackHelper which is used to install + * on every node in the grid + */ + void InstallStack (InternetStackHelper stack); + + /** + * Assigns Ipv4 addresses to all the row and column interfaces + * + * \param rowIp the Ipv4AddressHelper used to assign Ipv4 addresses + * to all of the row interfaces in the grid + * + * \param colIp the Ipv4AddressHelper used to assign Ipv4 addresses + * to all of the row interfaces in the grid + */ + void AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp); + + /** + * Sets up the node canvas locations for every node in the grid. + * This is needed for use with the animation interface + * + * \param ulx upper left x value + * \param uly upper left y value + * \param lrx lower right x value + * \param lry lower right y value + */ + void BoundingBox (double ulx, double uly, double lrx, double lry); + +private: + uint32_t m_xSize; + uint32_t m_ySize; + std::vector m_rowDevices; + std::vector m_colDevices; + std::vector m_rowInterfaces; + std::vector m_colInterfaces; + std::vector m_nodes; +}; + +} // namespace ns3 + +#endif /* POINT_TO_POINT_GRID_HELPER_H */ diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-star.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-star.cc Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,159 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +#include +#include + +// ns3 includes +#include "ns3/animation-interface.h" +#include "ns3/point-to-point-star.h" +#include "ns3/constant-position-mobility-model.h" + +#include "ns3/node-list.h" +#include "ns3/point-to-point-net-device.h" +#include "ns3/vector.h" + +NS_LOG_COMPONENT_DEFINE("PointToPointStarHelper"); + +namespace ns3 { + +PointToPointStarHelper::PointToPointStarHelper (uint32_t numSpokes, + PointToPointHelper p2pHelper) +{ + m_hub.Create (1); + m_spokes.Create (numSpokes); + + for (uint32_t i = 0; i < m_spokes.GetN (); ++i) + { + NetDeviceContainer nd = p2pHelper.Install (m_hub.Get (0), m_spokes.Get (i)); + m_hubDevices.Add (nd.Get (0)); + m_spokeDevices.Add (nd.Get (1)); + } +} + +PointToPointStarHelper::~PointToPointStarHelper () +{} + +Ptr +PointToPointStarHelper::GetHub () const +{ + return m_hub.Get (0); +} + +Ptr +PointToPointStarHelper::GetSpokeNode (uint32_t i) const +{ + return m_spokes.Get (i); +} + +Ipv4Address +PointToPointStarHelper::GetHubIpv4Address (uint32_t i) const +{ + return m_hubInterfaces.GetAddress (i); +} + +Ipv4Address +PointToPointStarHelper::GetSpokeIpv4Address (uint32_t i) const +{ + return m_spokeInterfaces.GetAddress (i); +} + +uint32_t +PointToPointStarHelper::SpokeCount () const +{ + return m_spokes.GetN (); +} + +void +PointToPointStarHelper::InstallStack (InternetStackHelper stack) +{ + stack.Install (m_hub); + stack.Install (m_spokes); +} + +void +PointToPointStarHelper::AssignIpv4Addresses (Ipv4AddressHelper address) +{ + for (uint32_t i = 0; i < m_spokes.GetN (); ++i) + { + m_hubInterfaces.Add (address.Assign (m_hubDevices.Get (i))); + m_spokeInterfaces.Add (address.Assign (m_spokeDevices.Get (i))); + address.NewNetwork (); + } +} + +void +PointToPointStarHelper::BoundingBox (double ulx, double uly, + double lrx, double lry) +{ + double xDist; + double yDist; + if (lrx > ulx) + { + xDist = lrx - ulx; + } + else + { + xDist = ulx - lrx; + } + if (lry > uly) + { + yDist = lry - uly; + } + else + { + yDist = uly - lry; + } + + // Place the hub + Ptr hub = m_hub.Get (0); + Ptr hubLoc = hub->GetObject (); + if (hubLoc == 0) + { + hubLoc = CreateObject (); + hub->AggregateObject (hubLoc); + } + Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0); + hubLoc->SetPosition (hubVec); + + double spokeDist; + if (xDist > yDist) + { + spokeDist = yDist/4.0; + } + else + { + spokeDist = xDist/4.0; + } + + double theta = 2*M_PI/m_spokes.GetN (); + for (uint32_t i = 0; i < m_spokes.GetN (); ++i) + { + Ptr spokeNode = m_spokes.Get (i); + Ptr spokeLoc = spokeNode->GetObject (); + if (spokeLoc == 0) + { + spokeLoc = CreateObject (); + spokeNode->AggregateObject (spokeLoc); + } + Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, + hubVec.y + sin (theta*i) * spokeDist, + 0); + spokeLoc->SetPosition (spokeVec); + } +} + +} // namespace ns3 diff -r e9ca5b2838e7 src/point-to-point-layout/model/point-to-point-star.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/model/point-to-point-star.h Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,122 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * 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 + */ + +// Define an object to create a dumbbell topology. + +#ifndef POINT_TO_POINT_STAR_HELPER_H +#define POINT_TO_POINT_STAR_HELPER_H + +#include + +#include "point-to-point-helper.h" +#include "ipv4-address-helper.h" +#include "internet-stack-helper.h" +#include "ipv4-interface-container.h" + +namespace ns3 { + +/** + * \brief A helper to make it easier to create a star topology + * with PointToPoint links + */ +class PointToPointStarHelper +{ +public: + /** + * Create a PointToPointStarHelper in order to easily create + * star topologies using p2p links + * + * \param numSpokes the number of links attached to + * the hub node, creating a total of + * numSpokes + 1 nodes + * + * \param p2pHelper the link helper for p2p links, + * used to link nodes together + */ + PointToPointStarHelper (uint32_t numSpokes, + PointToPointHelper p2pHelper); + + ~PointToPointStarHelper (); + +public: + /** + * \returns a node pointer to the hub node in the + * star, i.e., the center node + */ + Ptr GetHub () const; + + /** + * \param i an index into the spokes of the star + * + * \returns a node pointer to the node at the indexed spoke + */ + Ptr GetSpokeNode (uint32_t i) const; + + /** + * \param i index into the hub interfaces + * + * \returns Ipv4Address according to indexed hub interface + */ + Ipv4Address GetHubIpv4Address (uint32_t i) const; + + /** + * \param i index into the spoke interfaces + * + * \returns Ipv4Address according to indexed spoke interface + */ + Ipv4Address GetSpokeIpv4Address (uint32_t i) const; + + /** + * \returns the total number of spokes in the star + */ + uint32_t SpokeCount () const; + + /** + * \param stack an InternetStackHelper which is used to install + * on every node in the star + */ + void InstallStack (InternetStackHelper stack); + + /** + * \param address an Ipv4AddressHelper which is used to install + * Ipv4 addresses on all the node interfaces in + * the star + */ + void AssignIpv4Addresses (Ipv4AddressHelper address); + + /** + * Sets up the node canvas locations for every node in the star. + * This is needed for use with the animation interface + * + * \param ulx upper left x value + * \param uly upper left y value + * \param lrx lower right x value + * \param lry lower right y value + */ + void BoundingBox (double ulx, double uly, double lrx, double lry); + +private: + NodeContainer m_hub; + NetDeviceContainer m_hubDevices; + NodeContainer m_spokes; + NetDeviceContainer m_spokeDevices; + Ipv4InterfaceContainer m_hubInterfaces; + Ipv4InterfaceContainer m_spokeInterfaces; +}; + +} // namespace ns3 + +#endif /* POINT_TO_POINT_STAR_HELPER_H */ diff -r e9ca5b2838e7 src/point-to-point-layout/waf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/waf Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,1 @@ +exec "`dirname "$0"`"/../../waf "$@" \ No newline at end of file diff -r e9ca5b2838e7 src/point-to-point-layout/wscript --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/point-to-point-layout/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -0,0 +1,23 @@ +## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + +def build(bld): + module = bld.create_ns3_module('point-to-point-layout', ['internet', 'point-to-point', 'mobility']) + module.includes = '.' + module.source = [ + 'model/point-to-point-dumbbell.cc', + 'model/point-to-point-grid.cc', + 'model/point-to-point-star.cc', + ] + + headers = bld.new_task_gen('ns3header') + headers.module = 'point-to-point-layout' + headers.source = [ + 'model/point-to-point-dumbbell.h', + 'model/point-to-point-grid.h', + 'model/point-to-point-star.h', + ] + + bld.ns3_python_bindings() + + + diff -r e9ca5b2838e7 src/wimax/examples/wimax-multicast.cc --- a/src/wimax/examples/wimax-multicast.cc Thu Apr 21 13:51:07 2011 -0700 +++ b/src/wimax/examples/wimax-multicast.cc Fri Apr 22 12:41:15 2011 -0700 @@ -59,11 +59,8 @@ #include "ns3/csma-module.h" #include #include "ns3/global-route-manager.h" -#include "ns3/constant-position-mobility-model.h" -#include "ns3/random-waypoint-mobility-model.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" - +#include "ns3/mobility-module.h" +#include "ns3/internet-module.h" #include "ns3/vector.h" NS_LOG_COMPONENT_DEFINE ("WimaxMulticastSimulation"); diff -r e9ca5b2838e7 src/wscript --- a/src/wscript Thu Apr 21 13:51:07 2011 -0700 +++ b/src/wscript Fri Apr 22 12:41:15 2011 -0700 @@ -57,6 +57,8 @@ 'energy', 'tools', 'visualizer', + 'point-to-point-layout', + 'csma-layout', ) def set_options(opt):