18#include "ns3/applications-module.h"
19#include "ns3/core-module.h"
20#include "ns3/internet-module.h"
21#include "ns3/netanim-module.h"
22#include "ns3/network-module.h"
23#include "ns3/point-to-point-layout-module.h"
24#include "ns3/point-to-point-module.h"
31main(
int argc,
char* argv[])
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);
70 d.InstallStack(
stack);
79 clientHelper.SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable"));
80 clientHelper.SetAttribute(
"OffTime",
StringValue(
"ns3::UniformRandomVariable"));
83 for (
uint32_t i = 0; i < ((d.RightCount() < d.LeftCount()) ? d.RightCount() : d.LeftCount());
88 clientHelper.SetAttribute(
"Remote", remoteAddress);
89 clientApps.Add(clientHelper.Install(d.GetRight(i)));
96 d.BoundingBox(1, 1, 100, 100);
104 Ipv4GlobalRoutingHelper::PopulateRoutingTables();
107 std::cout <<
"Animation Trace file created:" << animFile << std::endl;
108 Simulator::Destroy();
a polymophic address class
AttributeValue implementation for Address.
Interface to network animator.
void EnableIpv4L3ProtocolCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Ipv4 L3 Protocol Counters such as Tx, Rx, Drop.
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
holds a vector of ns3::Application pointers.
Parse command-line arguments.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to create a dumbbell topology with p2p links.
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.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Hold variables of type string.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
Time Seconds(double value)
Construct a Time in the indicated unit.
AnimationInterface * anim
Every class exported by the ns3 library is enclosed in the ns3 namespace.