#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/mpls-module.h"
#include "ns3/ipv4-global-routing-helper.h"
The code starts with various include statements for easy implementation of
the code. We include many predefined modules in the program so that all the
functionalities of the classes that are specified in the module are loaded
and are available while the code executes. By importing all the modules at
the beginning of the code makes the code organized, efficient and productive.
The advantage of providing a single include file is that, it will load a
group of files at a large…show more content… The ns-3 logging statements are
typically used to log various program execution events, such as the
occurrence of simulation events or the use of a particular function. There
are two ways that can typically control log output. The first is by setting
the NS_LOG environment variable. The second way is by the use of explicit
statements like LogComponentEnable command which enables recording of all the
functions your server and clients use and the packets they receive. The use
of LOG_LEVEL_INFO displays only informational messages.
NodeContainer class keeps track of a set of node pointers. It also used to
address each of these nodes by using the Get command e.g. hosts.Get(0),
routers.Get(1) which we have used later in the program.
PointToPointHelper pointToPoint;
Ipv4AddressHelper address;
NetDeviceContainer devices;
InternetStackHelper internet;
MplsNetworkConfigurator network;
routers = network.CreateAndInstall (8);
hosts.Create (5);
internet.Install (hosts);