|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
57 #include "ns3/core-module.h"
58 #include "ns3/internet-apps-module.h"
59 #include "ns3/csma-module.h"
60 #include "ns3/internet-module.h"
61 #include "ns3/point-to-point-module.h"
62 #include "ns3/applications-module.h"
69 main (
int argc,
char *argv[])
75 cmd.AddValue (
"verbose",
"turn on the logs",
verbose);
76 cmd.AddValue (
"tracing",
"turn on the tracing",
tracing);
78 cmd.Parse (argc, argv);
124 address.SetBase (
"172.30.1.0",
"255.255.255.0");
135 NS_LOG_INFO (
"Setup the IP addresses and create DHCP applications.");
141 fixedNodes.
Get (0).first->SetAttribute (
"IpForward",
BooleanValue (
true));
157 dhcpClientNetDevs.
Add (devNet.
Get (0));
158 dhcpClientNetDevs.
Add (devNet.
Get (1));
159 dhcpClientNetDevs.
Add (devNet.
Get (2));
184 csma.EnablePcapAll (
"dhcp-csma");
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
Parse command-line arguments.
AttributeValue implementation for Boolean.
@ LOG_LEVEL_INFO
LOG_INFO and above.
virtual Address GetAddress(void) const =0
bool tracing
Flag to enable/disable generation of tracing files.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
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.
@ LOG_LEVEL_ALL
Print everything.
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.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
build a set of CsmaNetDevice objects
Access to the IPv4 forwarding table, interfaces, and configuration.
Helper class that adds ns3::Ipv4StaticRouting objects.
Smart pointer class similar to boost::intrusive_ptr.
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...
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Simulation virtual time values and global simulation resolution.
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice.
The helper class used to configure and install DHCP applications on nodes.
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.
static void Run(void)
Run the simulation.
Hold variables of type string.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Time Seconds(double value)
Construct a Time in the indicated unit.
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.
a class to represent an Ipv4 address mask
Hold an unsigned integer type.
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.
Ipv4InterfaceContainer InstallFixedAddress(Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask)
Assign a fixed IP addresses to a net device.
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.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.