18 #include "ns3/core-module.h"
19 #include "ns3/network-module.h"
20 #include "ns3/netanim-module.h"
21 #include "ns3/internet-module.h"
22 #include "ns3/point-to-point-module.h"
23 #include "ns3/applications-module.h"
24 #include "ns3/point-to-point-layout-module.h"
43 main (
int argc,
char *argv[])
58 std::string animFile =
"star-animation.xml";
64 cmd.
AddValue (
"nSpokes",
"Number of spoke nodes to place in the star", nSpokes);
65 cmd.
AddValue (
"animFile",
"File Name for Animation Output", animFile);
66 cmd.
AddValue (
"useIpv6",
"use Ipv6", useIpv6);
68 cmd.
Parse (argc, argv);
76 NS_LOG_INFO (
"Install internet stack on all nodes.");
78 star.InstallStack (internet);
87 star.AssignIpv6Addresses (ipv6AddressBase, ipv6AddressPrefix);
94 uint16_t port = 50000;
104 PacketSinkHelper packetSinkHelper (
"ns3::TcpSocketFactory", hubLocalAddress);
113 onOffHelper.SetAttribute (
"OnTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=1]"));
114 onOffHelper.SetAttribute (
"OffTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=0]"));
118 for (uint32_t i = 0; i < star.SpokeCount (); ++i)
129 onOffHelper.SetAttribute (
"Remote", remoteAddress);
130 spokeApps.
Add (onOffHelper.Install (star.GetSpokeNode (i)));
145 star.BoundingBox (1, 1, 100, 100);
holds a vector of ns3::Application pointers.
static Ipv4Address GetAny(void)
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 Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
A helper to make it easier to create a star topology with PointToPoint links.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
#define NS_LOG_COMPONENT_DEFINE(name)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
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.
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 argumentsInstances of this class can be used to parse command-line arguments: user...
static void Destroy(void)
void SetDefault(std::string name, const AttributeValue &value)
void SetChannelAttribute(std::string name, const AttributeValue &value)
Describes an IPv6 address.
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...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
void AddValue(const std::string &name, const std::string &help, T &value)
void Parse(int argc, char *argv[]) const
Interface to network animator.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.