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"
47 std::ostringstream oss;
68 std::ostringstream node0Oss;
73 static uint32_t index = 0;
78 for (uint32_t nodeId = 4; nodeId < 12; ++nodeId)
88 int main (
int argc,
char *argv[])
93 uint32_t nLeftLeaf = 5;
94 uint32_t nRightLeaf = 5;
96 std::string animFile =
"dynamic_linknode.xml" ;
99 cmd.
AddValue (
"nLeftLeaf",
"Number of left side leaf nodes", nLeftLeaf);
100 cmd.
AddValue (
"nRightLeaf",
"Number of right side leaf nodes", nRightLeaf);
101 cmd.
AddValue (
"nLeaf",
"Number of left and right side leaf nodes", nLeaf);
102 cmd.
AddValue (
"animFile",
"File Name for Animation Output", animFile);
104 cmd.
Parse (argc,argv);
120 nRightLeaf, pointToPointLeaf,
136 (
"OnTime",
StringValue (
"ns3::UniformRandomVariable[Min=0.,Max=1.]"));
138 (
"OffTime",
StringValue (
"ns3::UniformRandomVariable[Min=0.,Max=1.]"));
141 for (uint32_t i = 0; i < d.
RightCount (); ++i)
149 clientApps.
Start (Seconds (0.0));
150 clientApps.
Stop (Seconds (10.0));
163 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. Makes all nodes in the simulation into routers.
hold variables of type string
void BoundingBox(double ulx, double uly, double lrx, double lry)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
AnimationInterface * pAnim
aggregate IP/TCP/UDP functionality to existing Nodes.
Ptr< Node > GetRight() const
Build a set of PointToPointNetDevice objects.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
void SetDeviceAttribute(std::string name, const AttributeValue &value)
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
a polymophic address class
double GetSeconds(void) const
Hold an unsigned integer type.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
static void Destroy(void)
void SetDefault(std::string name, const AttributeValue &value)
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
void AssignIpv4Addresses(Ipv4AddressHelper leftIp, Ipv4AddressHelper rightIp, Ipv4AddressHelper routerIp)
void SetChannelAttribute(std::string name, const AttributeValue &value)
uint32_t RightCount() const
hold objects of type ns3::Address
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
int main(int argc, char *argv[])
void AddValue(const std::string &name, const std::string &help, T &value)
void InstallStack(InternetStackHelper stack)
Interface to network animator.
A helper to make it easier to create a dumbbell topology with p2p links.
void Parse(int argc, char *argv[])
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void ShowNode(uint32_t nodeId, bool show=true)
Helper function to show/hide a node.
Ipv4Address GetLeftIpv4Address(uint32_t i) const
ApplicationContainer Install(NodeContainer c) const
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void SetAttribute(std::string name, const AttributeValue &value)