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"
49 std::ostringstream oss;
64 std::ostringstream node0Oss;
76 for (
uint32_t nodeId = 4; nodeId < 12; ++nodeId)
89main(
int argc,
char* argv[])
97 std::string animFile =
"dynamic_linknode.xml";
100 cmd.AddValue(
"nLeftLeaf",
"Number of left side leaf nodes", nLeftLeaf);
101 cmd.AddValue(
"nRightLeaf",
"Number of right side leaf nodes", nRightLeaf);
102 cmd.AddValue(
"nLeaf",
"Number of left and right side leaf nodes", nLeaf);
103 cmd.AddValue(
"animFile",
"File Name for Animation Output", animFile);
105 cmd.Parse(argc, argv);
128 d.InstallStack(
stack);
135 d.BoundingBox(1, 1, 100, 100);
138 clientHelper.SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
139 clientHelper.SetAttribute(
"OffTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
142 for (
uint32_t i = 0; i < d.RightCount(); ++i)
146 clientHelper.SetAttribute(
"Remote", remoteAddress);
147 clientApps.Add(clientHelper.Install(d.GetRight(i)));
160 Ipv4GlobalRoutingHelper::PopulateRoutingTables();
163 std::cout <<
"Animation Trace file created:" << animFile << std::endl;
164 Simulator::Destroy();
a polymophic address class
AttributeValue implementation for Address.
Interface to network animator.
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
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.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Hold an unsigned integer type.
AnimationInterface * pAnim
void SetDefault(std::string name, const AttributeValue &value)
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.