17 #include "ns3/core-module.h" 18 #include "ns3/network-module.h" 19 #include "ns3/internet-module.h" 20 #include "ns3/point-to-point-module.h" 21 #include "ns3/applications-module.h" 22 #include "ns3/ipv4-static-routing-helper.h" 23 #include "ns3/ipv4-list-routing-helper.h" 24 #include "ns3/ipv4-nix-vector-helper.h" 116 main (
int argc,
char *argv[])
119 cmd.Parse (argc, argv);
128 nodes23.
Add (nodes12.
Get (1));
132 nodes34.
Add (nodes23.
Get (1));
136 nodes13.
Add (nodes12.
Get (0));
137 nodes13.
Add (nodes34.
Get (0));
149 stack.SetRoutingHelper (nixRouting);
150 stack.Install (allNodes);
162 address1.
SetBase (
"10.1.1.0",
"255.255.255.0");
164 address2.
SetBase (
"10.1.2.0",
"255.255.255.0");
166 address3.
SetBase (
"10.1.3.0",
"255.255.255.0");
168 address4.
SetBase (
"10.1.4.0",
"255.255.255.0");
192 nixRouting.PrintRoutingPathAt (
Seconds (3), nodes12.
Get (0), interfaces34.
GetAddress (1), routingStream);
193 nixRouting.PrintRoutingPathAt (
Seconds (5), nodes12.
Get (1), interfaces34.
GetAddress (1), routingStream);
194 nixRouting.PrintRoutingPathAt (
Seconds (6), nodes23.
Get (1), interfaces12.
GetAddress (0), routingStream);
195 nixRouting.PrintRoutingPathAt (
Seconds (7), nodes12.
Get (1), interfaces12.
GetAddress (1), routingStream);
197 nixRouting.PrintRoutingTableAllAt (
Seconds (8), routingStream);
holds a vector of ns3::Application pointers.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Hold variables of type string.
Create an application which sends a UDP packet and waits for an echo of this packet.
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Helper class that adds Nix-vector routing to nodes.
aggregate IP/TCP/UDP functionality to existing Nodes.
Build a set of PointToPointNetDevice objects.
Create a server application which waits for input UDP packets and sends them back to the original sen...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
AttributeValue implementation for Time.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
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.
keep track of a set of node pointers.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.