10#include "ns3/applications-module.h"
11#include "ns3/core-module.h"
12#include "ns3/internet-module.h"
13#include "ns3/ipv4-list-routing-helper.h"
14#include "ns3/ipv4-static-routing-helper.h"
15#include "ns3/ipv6-list-routing-helper.h"
16#include "ns3/ipv6-static-routing-helper.h"
17#include "ns3/network-module.h"
18#include "ns3/nix-vector-helper.h"
19#include "ns3/point-to-point-module.h"
173main(
int argc,
char* argv[])
175 bool useIpv6 =
false;
178 cmd.AddValue(
"useIPv6",
"Use IPv6 instead of IPv4", useIpv6);
179 cmd.Parse(argc, argv);
208 stack.SetRoutingHelper(nixRouting);
212 address1.
SetBase(
"10.1.1.0",
"255.255.255.0");
214 address2.
SetBase(
"10.1.2.0",
"255.255.255.0");
216 address3.
SetBase(
"10.1.3.0",
"255.255.255.0");
218 address4.
SetBase(
"10.1.4.0",
"255.255.255.0");
225 udpServerAddress = interfaces23.
GetAddress(1);
247 Ipv4NixVectorHelper::PrintRoutingTableAllAt(
Seconds(8), routingStream);
255 stack.SetRoutingHelper(nixRouting);
272 udpServerAddress = interfaces23.
GetAddress(1, 1);
294 Ipv6NixVectorHelper::PrintRoutingTableAllAt(
Seconds(8), routingStream);
a polymophic address class
holds a vector of ns3::Application pointers.
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.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
Keep track of a set of IPv6 interfaces.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
Helper class that adds Nix-vector routing to nodes.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
Hold variables of type string.
Create an application which sends a UDP packet and waits for an echo of this packet.
Create a server application which waits for input UDP packets and sends them back to the original sen...
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
@ LOG_LEVEL_INFO
LOG_INFO and above.