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[])
60 cmd.AddValue (
"nSpokes",
"Number of nodes to place in the star", nSpokes);
61 cmd.Parse (argc, argv);
69 NS_LOG_INFO (
"Install internet stack on all nodes.");
71 star.InstallStack (internet);
80 uint16_t
port = 50000;
82 PacketSinkHelper packetSinkHelper (
"ns3::TcpSocketFactory", hubLocalAddress);
91 onOffHelper.SetAttribute (
"OnTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=1]"));
92 onOffHelper.SetAttribute (
"OffTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=0]"));
96 for (uint32_t i = 0; i < star.SpokeCount (); ++i)
99 onOffHelper.SetAttribute (
"Remote", remoteAddress);
100 spokeApps.
Add (onOffHelper.Install (star.GetSpokeNode (i)));
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.
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 void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
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 arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Every class exported by the ns3 library is enclosed in the ns3 namespace.
AttributeValue implementation for 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 value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
A helper class to make life easier while doing simple IPv4 address assignment in scripts.