48#include "ns3/core-module.h"
49#include "ns3/internet-stack-helper.h"
50#include "ns3/ipv4-address-helper.h"
51#include "ns3/ipv4-global-routing-helper.h"
52#include "ns3/ipv4-list-routing-helper.h"
53#include "ns3/ipv4-static-routing-helper.h"
54#include "ns3/mpi-interface.h"
55#include "ns3/network-module.h"
56#include "ns3/nix-vector-helper.h"
57#include "ns3/on-off-helper.h"
58#include "ns3/packet-sink-helper.h"
59#include "ns3/packet-sink.h"
60#include "ns3/point-to-point-helper.h"
116 bool testing =
false;
120 cmd.AddValue(
"nix",
"Enable the use of nix-vector or global routing",
nix);
121 cmd.AddValue(
"nullmsg",
122 "Enable the use of null-message synchronization (instead of granted time window)",
124 cmd.AddValue(
"tracing",
"Enable pcap tracing",
tracing);
125 cmd.AddValue(
"init",
"ns-3 should initialize MPI by calling MPI_Init", init);
126 cmd.AddValue(
"verbose",
"verbose output",
verbose);
127 cmd.AddValue(
"test",
"Enable regression test output", testing);
164 RANK0COUT(
"This simulation requires exactly 2 logical processors if --init is not set."
171 RANK0COUT(
"This simulation requires 2 or more logical processors." << std::endl);
191 std::stringstream
ss;
193 ss <<
"MPI_COMM_WORLD (" <<
worldSize <<
" ranks)";
211 std::stringstream
ss;
212 ss <<
"Split [1-2] (out of " <<
worldSize <<
" ranks) from MPI_COMM_WORLD";
229 RANK0COUT(
"Routing: " << (
nix ?
"nix-vector" :
"global") <<
"\n");
230 RANK0COUT(
"Synchronization: " << (
nullmsg ?
"null-message" :
"granted time window (YAWNS)")
233 << (init ?
"explicitly by this program" :
"implicitly by ns3::MpiInterface::Enable()")
238 RANK0COUT(
"Rank assignments:" << std::endl);
308 RANK0COUT(
"This simulation requires at least 2 logical processors." << std::endl);
372 list.Add(nixRouting, 10);
376 stack.SetRoutingHelper(list);
444 uint16_t
port = 50000;
457 sink->TraceConnectWithoutContext(
"RxWithAddresses",
472 StringValue(
"ns3::ConstantRandomVariable[Constant=0]"));
a polymophic address class
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
Parse command-line arguments.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
static Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours.
Helper class that adds ns3::Ipv4ListRouting objects.
Helper class that adds ns3::Ipv4StaticRouting objects.
static uint32_t GetSystemId()
Get the id number of this rank.
static uint32_t GetSize()
Get the number of ranks used by ns-3.
static void Disable()
Clean up the ns-3 parallel communications interface.
static void Enable(int *pargc, char ***pargv)
Setup the parallel communication interface.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Helper class that adds Nix-vector routing to nodes.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
static void SinkTrace(const ns3::Ptr< const ns3::Packet > packet, const ns3::Address &srcAddress, const ns3::Address &destAddress)
PacketSink receive trace callback.
static void Verify(unsigned long expectedCount)
Verify the sink trace count observed matches the expected count.
static void Init()
PacketSink Init.
static int GetWorldSize()
Get the MPI size of the world communicator.
static int GetWorldRank()
Get the MPI rank in the world communicator.
Hold variables of type string.
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define RANK0COUT(x)
Write to std::cout only from rank 0.
#define RANK0COUTAPPEND(x)
Append to std::cout only from rank 0.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Common methods for MPI examples.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
@ LOG_LEVEL_INFO
LOG_INFO and above.
void ReportRank(int color, MPI_Comm splitComm)
Report my rank, in both MPI_COMM_WORLD and the split communicator.
const int NS_COLOR
Tag for whether this rank should go into a new communicator ns-3 ranks will have color == 1.
const int NOT_NS_COLOR
Tag for whether this rank should go into a new communicator ns-3 ranks will have color == 1.
bool tracing
Flag to enable/disable generation of tracing files.
Ptr< PacketSink > sink
Pointer to the packet sink application.