|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/core-module.h"
23 #include "ns3/network-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/point-to-point-module.h"
26 #include "ns3/applications-module.h"
27 #include "ns3/ipv4-static-routing-helper.h"
28 #include "ns3/ipv4-list-routing-helper.h"
29 #include "ns3/nix-vector-helper.h"
138 main (
int argc,
char *argv[])
141 cmd.Parse (argc, argv);
150 nodes23.
Add (nodes12.
Get (1));
154 nodes34.
Add (nodes23.
Get (1));
167 stack.SetRoutingHelper (nixRouting);
168 stack.Install (allNodes);
178 address1.
SetBase (
"10.1.1.0",
"255.255.255.0");
180 address2.
SetBase (
"10.1.2.0",
"255.255.255.0");
182 address3.
SetBase (
"10.1.3.0",
"255.255.255.0");
184 address4.
SetBase (
"10.2.1.0",
"255.255.255.0");
186 address5.
SetBase (
"10.2.3.0",
"255.255.255.0");
188 address1.
Assign (devices12);
189 address2.
Assign (devices23);
210 Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (
"nix-simple-multi-address.routes", std::ios::out);
214 nixRouting.PrintRoutingTableAllAt (
Seconds (4), routingStream);
223 nixRouting.PrintRoutingTableAllAt (
Seconds (6), routingStream);
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Parse command-line arguments.
@ LOG_LEVEL_INFO
LOG_INFO and above.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Create an application which sends a UDP packet and waits for an echo of this packet.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Ipv4 addresses are stored in host order in this class.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Helper class that adds Nix-vector routing to nodes.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
static void Run(void)
Run the simulation.
Hold variables of type string.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
holds a vector of ns3::Application pointers.
AttributeValue implementation for Time.
Build a set of PointToPointNetDevice objects.
keep track of a set of node pointers.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
Create a server application which waits for input UDP packets and sends them back to the original sen...
aggregate IP/TCP/UDP functionality to existing Nodes.
void PrintRoutingPathAt(Time printTime, Ptr< Node > source, IpAddress dest, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing path for a source and destination at a particular time.