51 #include "ns3/core-module.h" 
   52 #include "ns3/network-module.h" 
   53 #include "ns3/applications-module.h" 
   54 #include "ns3/mobility-module.h" 
   55 #include "ns3/stats-module.h" 
   56 #include "ns3/random-variable-stream.h" 
   57 #include "ns3/wifi-module.h" 
   58 #include "ns3/internet-module.h" 
   59 #include "ns3/flow-monitor-helper.h" 
   60 #include "ns3/olsr-helper.h" 
   61 #include "ns3/ipv4-static-routing-helper.h" 
   62 #include "ns3/ipv4-list-routing-helper.h" 
   80   bool CommandSetup (
int argc, 
char **argv);
 
   81   bool IsRouting () { 
return (enableRouting == 1) ? 1 : 0; }
 
   82   bool IsMobility () { 
return (enableMobility == 1) ? 1 : 0; }
 
   99   void CheckThroughput ();
 
  141   enableTracing (true),
 
  142   enableFlowMon (false),
 
  143   enableRouting (false),
 
  144   enableMobility (false),
 
  145   rtsThreshold (
"2200"), 
 
  146   rateManager (
"ns3::MinstrelWifiManager"),
 
  147   outputFileName (
"minstrel")
 
  155   TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
 
  156   Ptr<Socket> sink = Socket::CreateSocket (node, tid);
 
  168   while ((packet = socket->
Recv ()))
 
  194   uint32_t totalNodes = c.
GetN ();
 
  195   for (uint32_t i=0; i< totalNodes; i++)
 
  197       if ( (i % 
gridSize) <= (gridSize/2 - 1))
 
  200           if ( i < totalNodes/2 )
 
  206           if ( i >= (uint32_t)(4*totalNodes)/10 )
 
  211       if ( (i % gridSize) >= (gridSize/2 - 1))
 
  214           if ( i < totalNodes/2 )
 
  220           if ( i >= (uint32_t)(4*totalNodes)/10  )
 
  236   uint32_t limit = senderId + 2;
 
  237   for (uint32_t i= senderId - 2; i <= limit; i++)
 
  257   uint32_t totalNodes = c.
GetN ();
 
  265   for (uint32_t i=0; i < totalNodes/3; i++)
 
  294   for (uint32_t i=0; i < c.
GetN (); i++)
 
  300           destIndex = (uint32_t) uv->
GetValue ();
 
  301         } 
while ( (c.
Get (destIndex))->GetId () == sender->
GetId ());
 
  321 static inline std::string
 
  333   Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
 
  336   std::ostringstream oss;
 
  337   oss << 
"Set up Server Device " <<  (server->
GetDevice (0))->GetAddress ()
 
  338                                  << 
" with ip " << ipv4AddrServer
 
  339                                  << 
" position (" << serverPos.x << 
"," << serverPos.y << 
"," << serverPos.z << 
")";
 
  341   oss << 
"Set up Client Device " <<  (client->
GetDevice (0))->GetAddress ()
 
  342                                  << 
" with ip " << ipv4AddrClient
 
  343                                  << 
" position (" << clientPos.x << 
"," << clientPos.y << 
"," << clientPos.z << 
")" 
  354   Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
 
  396       list.
Add (staticRouting, 0);
 
  410   address.
SetBase (
"10.0.0.0", 
"255.255.255.0");
 
  413   ipInterfaces = address.
Assign (devices);
 
  431                               "Speed", 
StringValue (
"ns3::ConstantRandomVariable[Constant=10]"),
 
  432                               "Pause", 
StringValue (
"ns3::ConstantRandomVariable[Constant=0.2]"));
 
  447       for (uint32_t i = 0; i < nodeSize - 1; i = i+2)
 
  526   Simulator::Destroy ();
 
  556   cmd.
Parse (argc, argv);
 
  560 int main (
int argc, 
char *argv[])
 
  585   wifiMac.
SetType (
"ns3::AdhocWifiMac",
 
  597   dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility);
 
Helper class for UAN CW MAC example. 
 
holds a vector of ns3::Application pointers. 
 
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism. 
 
Manage ASCII trace files for device models. 
 
void AssignNeighbors(NodeContainer c)
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific conta...
 
Class to represent a 2D points plot. 
 
holds a vector of std::pair of Ptr and interface index. 
 
Ptr< YansWifiChannel > Create(void) const 
 
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
 
Ipv4Address GetLocal(void) const 
Get the local address. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
void SendMultiDestinations(Ptr< Node > sender, NodeContainer c)
A sender node will set up a flow to each of the its neighbors in its quadrant randomly. 
 
Hold variables of type string. 
 
Make it easy to create and manage PHY objects for the yans model. 
 
static Vector GetPosition(Ptr< Node > node)
 
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
 
void ReceivePacket(Ptr< Socket > socket)
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
aggregate IP/TCP/UDP functionality to existing Nodes. 
 
Helper class that adds OLSR routing to nodes. 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
Vector GetPosition(void) const 
 
void AddDataset(const GnuplotDataset &dataset)
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
 
helps to create WifiNetDevice objects 
 
void ReceivePacket(Ptr< Socket > socket)
 
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes. 
 
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead. 
 
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const 
 
a polymophic address class 
 
uint32_t GetN(void) const 
Get the number of Ptr stored in this container. 
 
AttributeValue implementation for Rectangle. 
 
Class for representing data rates. 
 
Keep track of the current position and velocity of an object. 
 
void SetChannel(Ptr< YansWifiChannel > channel)
 
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution. 
 
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
 
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 ...
 
a simple class to generate gnuplot-ready plotting commands from a set of datasets. 
 
Hold an unsigned integer type. 
 
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
 
holds a vector of ns3::NetDevice pointers 
 
virtual void SetStandard(enum WifiPhyStandard standard)
 
Ptr< NetDevice > GetDevice(uint32_t index) const 
Retrieve the index-th NetDevice associated to this node. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream. 
 
void Add(double x, double y)
 
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read. 
 
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes. 
 
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
 
create non QoS-enabled MAC layers for a ns3::WifiNetDevice. 
 
Parse command-line arguments. 
 
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
 
void SelectSrcDest(NodeContainer c)
Sources and destinations are randomly selected such that a node may be the source for multiple destin...
 
Access to the Ipv4 forwarding table, interfaces, and configuration. 
 
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
 
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
std::string outputFileName
 
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source. 
 
keep track of a set of node pointers. 
 
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
 
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
 
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId)
Generate 1-hop and 2-hop neighbors of a node in grid topology. 
 
void Install(std::string nodeName) const 
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
 
Helper to enable IP flow monitoring on a set of Nodes. 
 
Gnuplot2dDataset m_output
 
manage and create wifi channel objects for the yans model. 
 
void SetStyle(enum Style style)
 
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
 
The IEEE 802.11 SSID Information Element. 
 
Helper class used to assign positions and mobility models to nodes. 
 
void ApplicationSetup(Ptr< Node > client, Ptr< Node > server, double start, double stop)
 
Ipv4 addresses are stored in host order in this class. 
 
AttributeValue implementation for 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...
 
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container. 
 
uint32_t GetId(void) const 
 
a class to store IPv4 address information on an interface 
 
Helper class that adds ns3::Ipv4StaticRouting objects. 
 
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD. 
 
virtual Ipv4InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Because addresses can be removed, the addressIndex is not guaranteed to be static across calls to thi...
 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
AttributeValue implementation for Ssid. 
 
void SetDefault(std::string name, const AttributeValue &value)
 
static std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
 
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
 
std::string GetOutputFileName()
 
std::string GetRtsThreshold()
 
Helper class that adds ns3::Ipv4ListRouting objects. 
 
void Parse(int argc, char *argv[])
Parse the program arguments. 
 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
 
Time Now(void)
create an ns3::Time instance which contains the current simulation time. 
 
bool CommandSetup(int argc, char **argv)
 
void EnableAsciiAll(std::string prefix)
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes c...
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
static const uint32_t packetSize
 
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
 
std::string GetRateManager()
 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
 
ApplicationContainer Install(NodeContainer c) const 
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
 
a unique identifier for an interface. 
 
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
 
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
 
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes. 
 
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.