32 #include "ns3/core-module.h" 
   33 #include "ns3/network-module.h" 
   34 #include "ns3/applications-module.h" 
   35 #include "ns3/mobility-module.h" 
   36 #include "ns3/config-store-module.h" 
   37 #include "ns3/wifi-module.h" 
   38 #include "ns3/internet-module.h" 
   39 #include "ns3/dsr-module.h" 
   46 main (
int argc, 
char *argv[])
 
   80   double TotalTime = 600.0;
 
   81   double dataTime = 500.0;
 
   83   uint32_t packetSize = 64;
 
   84   double dataStart = 100.0; 
 
   87   double pauseTime = 0.0;
 
   88   double nodeSpeed = 20.0;
 
   89   double txpDistance = 250.0;
 
   91   std::string rate = 
"0.512kbps";
 
   92   std::string dataMode (
"DsssRate11Mbps");
 
   93   std::string phyMode (
"DsssRate11Mbps");
 
   97   cmd.
AddValue (
"nWifis", 
"Number of wifi nodes", nWifis);
 
   98   cmd.
AddValue (
"nSinks", 
"Number of SINK traffic nodes", nSinks);
 
   99   cmd.
AddValue (
"rate", 
"CBR traffic rate(in kbps), Default:8", rate);
 
  100   cmd.
AddValue (
"nodeSpeed", 
"Node speed in RandomWayPoint model, Default:20", nodeSpeed);
 
  101   cmd.
AddValue (
"packetSize", 
"The packet size", packetSize);
 
  102   cmd.
AddValue (
"txpDistance", 
"Specify node's transmit range, Default:300", txpDistance);
 
  103   cmd.
AddValue (
"pauseTime", 
"pauseTime for mobility model, Default: 0", pauseTime);
 
  104   cmd.
Parse (argc, argv);
 
  110   adhocNodes.
Create (nWifis);
 
  113   NS_LOG_INFO (
"setting the default phy and channel parameters");
 
  119   NS_LOG_INFO (
"setting the default phy and channel parameters ");
 
  134   wifiMac.
SetType (
"ns3::AdhocWifiMac");
 
  135   allDevices = wifi.
Install (wifiPhy, wifiMac, adhocNodes);
 
  145   pos.
SetTypeId (
"ns3::RandomRectanglePositionAllocator");
 
  146   pos.
Set (
"X", 
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=300.0]"));
 
  147   pos.
Set (
"Y", 
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1500.0]"));
 
  150   std::ostringstream speedUniformRandomVariableStream;
 
  151   speedUniformRandomVariableStream << 
"ns3::UniformRandomVariable[Min=0.0|Max=" 
  155   std::ostringstream pauseConstantRandomVariableStream;
 
  156   pauseConstantRandomVariableStream << 
"ns3::ConstantRandomVariable[Constant=" 
  162                                   "Speed", 
StringValue (speedUniformRandomVariableStream.str ()),
 
  163                                   "Pause", 
StringValue (pauseConstantRandomVariableStream.str ()),
 
  166   adhocMobility.
Install (adhocNodes);
 
  172   dsrMain.Install (dsr, adhocNodes);
 
  176   address.
SetBase (
"10.1.1.0", 
"255.255.255.0");
 
  178   allInterfaces = address.
Assign (allDevices);
 
  181   double randomStartTime = (1 / ppers) / nSinks; 
 
  183   for (uint32_t i = 0; i < nSinks; ++i)
 
  192       onoff1.SetAttribute (
"OffTime", 
StringValue (
"ns3::ConstantRandomVariable[Constant=0.0]"));
 
  193       onoff1.SetAttribute (
"PacketSize", 
UintegerValue (packetSize));
 
  197       apps1.
Start (
Seconds (dataStart + i * randomStartTime));
 
  198       apps1.
Stop (
Seconds (dataTime + i * randomStartTime));
 
void AddPropagationLoss(std::string name, 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())
holds a vector of ns3::Application pointers. 
Manage ASCII trace files for device models. 
static Ipv4Address GetAny(void)
holds a vector of std::pair of Ptr<Ipv4> 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())
hold variables of type string 
Make it easy to create and manage PHY objects for the yans model. 
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())
Helper class that adds DSR routing to nodes. 
#define NS_LOG_COMPONENT_DEFINE(name)
void SetTypeId(TypeId tid)
aggregate IP/TCP/UDP functionality to existing Nodes. 
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
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. ...
static YansWifiPhyHelper Default(void)
helps to create WifiNetDevice objects 
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes. 
static void SetRun(uint64_t run)
Set the run number of simulation. 
NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const 
a polymophic address class 
Class for representing data rates. 
void SetChannel(Ptr< YansWifiChannel > channel)
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
Ptr< Object > Create(void) const 
Hold an unsigned integer type. 
holds a vector of ns3::NetDevice pointers 
void SetStandard(enum WifiPhyStandard standard)
static NqosWifiMacHelper Default(void)
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 argumentsInstances of this class can be used to parse command-line arguments: user...
static void Destroy(void)
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers. 
hold objects of type Ptr<T> 
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())
void Install(std::string nodeName) const 
void Set(std::string name, const AttributeValue &value)
manage and create wifi channel objects for the yans model. 
static void SetSeed(uint32_t seed)
set the seed it will duplicate the seed value 6 times 
Helper class used to assign positions and mobility models to nodes. 
instantiate subclasses of ns3::Object. 
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...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds. 
hold objects of type ns3::DataRate 
void AddValue(const std::string &name, const std::string &help, T &value)
Ptr< Node > Get(uint32_t i) const 
Get the Ptr<Node> stored in this container at a given index. 
void Parse(int argc, char *argv[]) const 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
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. 
void SetPropagationDelay(std::string name, 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())
Hold an floating point type. 
Ptr< T > GetObject(void) 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. 
void LogComponentEnable(char const *name, enum LogLevel level)
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const 
Allocate a set of positions. The allocation strategy is implemented in subclasses.