43 #include <sys/socket.h>
46 #include "ns3/core-module.h"
47 #include "ns3/network-module.h"
48 #include "ns3/internet-module.h"
49 #include "ns3/fd-net-device-module.h"
50 #include "ns3/applications-module.h"
57 main (
int argc,
char *argv[])
61 uint16_t sinkPort = 8000;
62 uint32_t packetSize = 10000;
63 std::string dataRate(
"10Mb/s");
74 if (socketpair (AF_UNIX, SOCK_DGRAM, 0, sv) < 0)
90 internetStackHelper.
Install (nodes);
94 addresses.
SetBase (
"10.0.0.0",
"255.255.255.0");
105 sinkApp.
Start (Seconds (0.0));
106 sinkApp.
Stop (Seconds (30.0));
107 fd.
EnablePcap (
"fd2fd-onoff-server", serverDevice);
118 clientApps.
Start (Seconds (2.0));
119 clientApps.
Stop (Seconds (29.0));
120 fd.
EnablePcap (
"fd2fd-onoff-client", clientDevice);
holds a vector of ns3::Application pointers.
virtual NetDeviceContainer Install(Ptr< Node > node) const
smart pointer class similar to boost::intrusive_ptr
holds a vector of std::pair of Ptr and interface index.
void SetFileDescriptor(int fd)
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
aggregate IP/TCP/UDP functionality to existing Nodes.
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however, the classes PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are treated as "mixins". A mixin is a self-contained class that encapsulates a general attribute or a set of functionality that may be of interest to many other classes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
#define NS_FATAL_ERROR(msg)
fatal error handling
a polymophic address class
Hold an unsigned integer type.
void SetIpv4StackInstall(bool enable)
Enable/disable IPv4 stack install.
holds a vector of ns3::NetDevice pointers
static void Bind(std::string name, const AttributeValue &value)
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
keep track of a set of node pointers.
void Install(std::string nodeName) const
Ipv4 addresses are stored in host order in this class.
hold objects of type ns3::Address
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
ApplicationContainer Install(NodeContainer c) const
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
a NetDevice to read/write network traffic from/into a file descriptor.
void EnablePcap(std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
Enable pcap output the indicated net device.
int main(int argc, char *argv[])
Ptr< T > GetObject(void) const
ApplicationContainer Install(NodeContainer c) const
void SetAttribute(std::string name, const AttributeValue &value)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const