21 #include "ns3/core-module.h"
22 #include "ns3/fd-net-device-module.h"
23 #include "ns3/internet-apps-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/network-module.h"
28 #include <sys/socket.h>
35 main(
int argc,
char* argv[])
38 cmd.Parse(argc, argv);
53 if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sv) < 0)
60 device1->SetFileDescriptor(sv[0]);
64 device2->SetFileDescriptor(sv[1]);
67 addresses.
SetBase(
"10.0.0.0",
"255.255.255.0");
71 app->SetAttribute(
"Destination", AddressValue(
interfaces.GetAddress(0)));
72 app->SetAttribute(
"VerboseMode",
EnumValue(Ping::VerboseMode::VERBOSE));
Parse command-line arguments.
Hold variables of type enum.
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
a NetDevice to read/write network traffic from/into a file descriptor.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
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.
holds a vector of ns3::NetDevice pointers
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.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
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.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.