6#include "ns3/applications-module.h"
7#include "ns3/core-module.h"
8#include "ns3/internet-module.h"
9#include "ns3/netanim-module.h"
10#include "ns3/network-module.h"
11#include "ns3/point-to-point-layout-module.h"
12#include "ns3/point-to-point-module.h"
30main(
int argc,
char* argv[])
44 std::string animFile =
"star-animation.xml";
50 cmd.AddValue(
"nSpokes",
"Number of spoke nodes to place in the star", nSpokes);
51 cmd.AddValue(
"animFile",
"File Name for Animation Output", animFile);
52 cmd.AddValue(
"useIpv6",
"use Ipv6", useIpv6);
54 cmd.Parse(argc, argv);
62 NS_LOG_INFO(
"Install internet stack on all nodes.");
64 star.InstallStack(internet);
73 star.AssignIpv6Addresses(ipv6AddressBase, ipv6AddressPrefix);
80 uint16_t
port = 50000;
104 for (
uint32_t i = 0; i < star.SpokeCount(); ++i)
131 star.BoundingBox(1, 1, 100, 100);
a polymophic address class
Interface to network animator.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
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 Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
Describes an IPv6 address.
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Describes an IPv6 prefix.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
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 create a star topology with PointToPoint links.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
Hold variables of type string.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time Seconds(double value)
Construct a Time in the indicated unit.
AnimationInterface * anim
Every class exported by the ns3 library is enclosed in the ns3 namespace.