Bug 1105 Move topology helpers into separate per-device modules
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
//
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ def build(bld):
|
||||
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',
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
195
src/csma-layout/examples/csma-star.cc
Normal file
195
src/csma-layout/examples/csma-star.cc
Normal file
@@ -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> channel = star.GetSpokeDevices ().Get (i)->GetChannel ();
|
||||
Ptr<CsmaChannel> csmaChannel = channel->GetObject<CsmaChannel> ();
|
||||
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;
|
||||
}
|
||||
1
src/csma-layout/examples/waf
vendored
Normal file
1
src/csma-layout/examples/waf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exec "`dirname "$0"`"/../../waf "$@"
|
||||
5
src/csma-layout/examples/wscript
Normal file
5
src/csma-layout/examples/wscript
Normal file
@@ -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'
|
||||
109
src/csma-layout/model/csma-star-helper.cc
Normal file
109
src/csma-layout/model/csma-star-helper.cc
Normal file
@@ -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 <iostream>
|
||||
#include <sstream>
|
||||
|
||||
// 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<Node>
|
||||
CsmaStarHelper::GetHub () const
|
||||
{
|
||||
return m_hub.Get (0);
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
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
|
||||
123
src/csma-layout/model/csma-star-helper.h
Normal file
123
src/csma-layout/model/csma-star-helper.h
Normal file
@@ -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 <string>
|
||||
|
||||
#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<Node> GetHub () const;
|
||||
|
||||
/**
|
||||
* \param i an index into the spokes of the star
|
||||
*
|
||||
* \returns a node pointer to the node at the indexed spoke
|
||||
*/
|
||||
Ptr<Node> 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 */
|
||||
1
src/csma-layout/waf
vendored
Normal file
1
src/csma-layout/waf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exec "`dirname "$0"`"/../../waf "$@"
|
||||
18
src/csma-layout/wscript
Normal file
18
src/csma-layout/wscript
Normal file
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -13,9 +13,6 @@ def build(bld):
|
||||
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'
|
||||
|
||||
|
||||
@@ -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 @@ def build(bld):
|
||||
'model/csma-net-device.h',
|
||||
'model/csma-channel.h',
|
||||
'helper/csma-helper.h',
|
||||
'helper/csma-star-helper.h',
|
||||
]
|
||||
|
||||
if bld.env['ENABLE_EXAMPLES']:
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
//
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "ns3/netanim-config.h"
|
||||
|
||||
// Socket related includes
|
||||
#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -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 build(bld):
|
||||
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)
|
||||
|
||||
|
||||
@@ -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 <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
// ns3 includes
|
||||
#include "ns3/animation-interface.h"
|
||||
#include "ns3/point-to-point-dumbbell-helper.h"
|
||||
#include "ns3/point-to-point-dumbbell.h"
|
||||
#include "ns3/constant-position-mobility-model.h"
|
||||
|
||||
#include "ns3/node-list.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
* Author: Josh Pelkey <jpelkey@gatech.edu>
|
||||
*/
|
||||
|
||||
#include "ns3/point-to-point-grid-helper.h"
|
||||
#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"
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
// ns3 includes
|
||||
#include "ns3/animation-interface.h"
|
||||
#include "ns3/point-to-point-star-helper.h"
|
||||
#include "ns3/point-to-point-star.h"
|
||||
#include "ns3/constant-position-mobility-model.h"
|
||||
|
||||
#include "ns3/node-list.h"
|
||||
1
src/point-to-point-layout/waf
vendored
Normal file
1
src/point-to-point-layout/waf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exec "`dirname "$0"`"/../../waf "$@"
|
||||
23
src/point-to-point-layout/wscript
Normal file
23
src/point-to-point-layout/wscript
Normal file
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -59,11 +59,8 @@
|
||||
#include "ns3/csma-module.h"
|
||||
#include <iostream>
|
||||
#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");
|
||||
|
||||
@@ -57,6 +57,8 @@ all_modules = (
|
||||
'energy',
|
||||
'tools',
|
||||
'visualizer',
|
||||
'point-to-point-layout',
|
||||
'csma-layout',
|
||||
)
|
||||
|
||||
def set_options(opt):
|
||||
|
||||
Reference in New Issue
Block a user