7#include "ns3/applications-module.h"
8#include "ns3/core-module.h"
9#include "ns3/internet-module.h"
10#include "ns3/netanim-module.h"
11#include "ns3/network-module.h"
12#include "ns3/point-to-point-layout-module.h"
13#include "ns3/point-to-point-module.h"
44 std::ostringstream oss;
59 std::ostringstream node0Oss;
62 static double size = 2;
89 for (
uint32_t nodeId = 4; nodeId < 12; ++nodeId)
111main(
int argc,
char* argv[])
119 std::string animFile =
"resources_demo.xml";
122 cmd.AddValue(
"nLeftLeaf",
"Number of left side leaf nodes", nLeftLeaf);
123 cmd.AddValue(
"nRightLeaf",
"Number of right side leaf nodes", nRightLeaf);
124 cmd.AddValue(
"nLeaf",
"Number of left and right side leaf nodes", nLeaf);
125 cmd.AddValue(
"animFile",
"File Name for Animation Output", animFile);
127 cmd.Parse(argc, argv);
150 d.InstallStack(stack);
157 d.BoundingBox(1, 1, 100, 100);
160 clientHelper.SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
161 clientHelper.SetAttribute(
"OffTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
164 for (
uint32_t i = 0; i < d.RightCount(); ++i)
168 clientHelper.SetAttribute(
"Remote", remoteAddress);
169 clientApps.Add(clientHelper.Install(d.GetRight(i)));
203 std::cout <<
"Animation Trace file created:" << animFile << std::endl;
a polymophic address class
Interface to network animator.
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
void UpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
Helper function to update the image of a node.
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
uint32_t AddResource(std::string resourcePath)
Add a resource such as the path to an image file.
void UpdateNodeSize(Ptr< Node > n, double width, double height)
Helper function to update the size of a node.
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
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.
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
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.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
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.
void SetDefault(std::string name, const AttributeValue &value)
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t nodeCounterIdDouble2
AnimationInterface * pAnim
uint32_t nodeCounterIdDouble1
uint32_t nodeCounterIdUint32