21 #include "ns3/core-module.h" 22 #include "ns3/network-module.h" 23 #include "ns3/internet-module.h" 24 #include "ns3/point-to-point-module.h" 25 #include "ns3/netanim-module.h" 26 #include "ns3/applications-module.h" 27 #include "ns3/point-to-point-layout-module.h" 31 int main (
int argc,
char *argv[])
36 uint32_t nLeftLeaf = 5;
37 uint32_t nRightLeaf = 5;
39 std::string animFile =
"dumbbell-animation.xml" ;
42 cmd.AddValue (
"nLeftLeaf",
"Number of left side leaf nodes", nLeftLeaf);
43 cmd.AddValue (
"nRightLeaf",
"Number of right side leaf nodes", nRightLeaf);
44 cmd.AddValue (
"nLeaf",
"Number of left and right side leaf nodes", nLeaf);
45 cmd.AddValue (
"animFile",
"File Name for Animation Output", animFile);
47 cmd.Parse (argc,argv);
63 nRightLeaf, pointToPointLeaf,
68 d.InstallStack (
stack);
77 clientHelper.SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable"));
78 clientHelper.SetAttribute (
"OffTime",
StringValue (
"ns3::UniformRandomVariable"));
81 for (uint32_t i = 0; i < ((d.RightCount () < d.LeftCount ()) ? d.RightCount () : d.LeftCount ()); ++i)
85 clientHelper.SetAttribute (
"Remote", remoteAddress);
86 clientApps.Add (clientHelper.Install (d.GetRight (i)));
93 d.BoundingBox (1, 1, 100, 100);
97 anim.EnablePacketMetadata ();
104 std::cout <<
"Animation Trace file created:" << animFile.c_str ()<< std::endl;
holds a vector of ns3::Application pointers.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
Hold variables of type string.
static void Run(void)
Run the simulation.
aggregate IP/TCP/UDP functionality to existing 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.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
Hold an unsigned integer type.
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
AttributeValue implementation for Address.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
Interface to network animator.
A helper to make it easier to create a dumbbell topology with p2p links.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.