45#include "ns3/applications-module.h"
46#include "ns3/core-module.h"
47#include "ns3/csma-module.h"
48#include "ns3/internet-apps-module.h"
49#include "ns3/internet-module.h"
50#include "ns3/network-module.h"
51#include "ns3/point-to-point-module.h"
58main(
int argc,
char* argv[])
64 cmd.AddValue(
"verbose",
"turn on the logs",
verbose);
65 cmd.AddValue(
"tracing",
"turn on the tracing",
tracing);
67 cmd.Parse(argc, argv);
113 address.SetBase(
"172.30.1.0",
"255.255.255.0");
121 staticRoutingA->AddNetworkRouteTo(
Ipv4Address(
"172.30.0.0"),
126 NS_LOG_INFO(
"Setup the IP addresses and create DHCP applications.");
133 fixedNodes.
Get(0).first->SetAttribute(
"IpForward",
BooleanValue(
true));
146 ->AddStaticDhcpEntry(devNet.
Get(2)->GetAddress(),
Ipv4Address(
"172.30.0.14"));
153 dhcpClientNetDevs.
Add(devNet.
Get(0));
154 dhcpClientNetDevs.
Add(devNet.
Get(1));
155 dhcpClientNetDevs.
Add(devNet.
Get(2));
180 csma.EnablePcapAll(
"dhcp-csma");
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.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Parse command-line arguments.
build a set of CsmaNetDevice objects
The helper class used to configure and install DHCP applications on nodes.
Ipv4InterfaceContainer InstallFixedAddress(Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask)
Assign a fixed IP addresses to a net device.
ApplicationContainer InstallDhcpServer(Ptr< NetDevice > netDevice, Ipv4Address serverAddr, Ipv4Address poolAddr, Ipv4Mask poolMask, Ipv4Address minAddr, Ipv4Address maxAddr, Ipv4Address gateway=Ipv4Address())
Install DHCP server of a node / NetDevice.
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index.
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
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.
#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.
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.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_LEVEL_INFO
LOG_INFO and above.
bool tracing
Flag to enable/disable generation of tracing files.