70 #include "ns3/core-module.h" 
   71 #include "ns3/network-module.h" 
   72 #include "ns3/internet-module.h" 
   73 #include "ns3/mobility-module.h" 
   74 #include "ns3/wifi-module.h" 
   75 #include "ns3/aodv-module.h" 
   76 #include "ns3/olsr-module.h" 
   77 #include "ns3/dsdv-module.h" 
   78 #include "ns3/dsr-module.h" 
   79 #include "ns3/applications-module.h" 
   90   void Run (
int nSinks, 
double txp, std::string CSVfileName);
 
   93   std::string CommandSetup (
int argc, 
char **argv);
 
   98   void CheckThroughput ();
 
  116     m_CSVfileName (
"manet-routing.output.csv"),
 
  117     m_traceMobility (false),
 
  122 static inline std::string
 
  128   std::ostringstream oss;
 
  135       oss << 
" received one packet from " << addr.
GetIpv4 ();
 
  139       oss << 
" received one packet!";
 
  148   while ((packet = socket->
Recv ()))
 
  180   TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
 
  181   Ptr<Socket> sink = Socket::CreateSocket (node, tid);
 
  196   cmd.
Parse (argc, argv);
 
  201 main (
int argc, 
char *argv[])
 
  204   std::string CSVfileName = experiment.
CommandSetup (argc,argv);
 
  207   std::ofstream out (CSVfileName.c_str ());
 
  208   out << 
"SimulationSecond," <<
 
  210   "PacketsReceived," <<
 
  212   "RoutingProtocol," <<
 
  213   "TransmissionPower" <<
 
  220   experiment.
Run (nSinks, txp, CSVfileName);
 
  226   Packet::EnablePrinting ();
 
  233   double TotalTime = 200.0;
 
  234   std::string rate (
"2048bps");
 
  235   std::string phyMode (
"DsssRate11Mbps");
 
  236   std::string tr_name (
"manet-routing-compare");
 
  248   adhocNodes.
Create (nWifis);
 
  269   wifiMac.
SetType (
"ns3::AdhocWifiMac");
 
  273   int64_t streamIndex = 0; 
 
  276   pos.
SetTypeId (
"ns3::RandomRectanglePositionAllocator");
 
  277   pos.
Set (
"X", 
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=300.0]"));
 
  278   pos.
Set (
"Y", 
StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1500.0]"));
 
  283   std::stringstream ssSpeed;
 
  284   ssSpeed << 
"ns3::UniformRandomVariable[Min=0.0|Max=" << nodeSpeed << 
"]";
 
  285   std::stringstream ssPause;
 
  286   ssPause << 
"ns3::ConstantRandomVariable[Constant=" << nodePause << 
"]";
 
  292   mobilityAdhoc.
Install (adhocNodes);
 
  293   streamIndex += mobilityAdhoc.
AssignStreams (adhocNodes, streamIndex);
 
  306       list.
Add (olsr, 100);
 
  310       list.
Add (aodv, 100);
 
  314       list.
Add (dsdv, 100);
 
  332       dsrMain.
Install (dsr, adhocNodes);
 
  338   addressAdhoc.
SetBase (
"10.1.1.0", 
"255.255.255.0");
 
  340   adhocInterfaces = addressAdhoc.
Assign (adhocDevices);
 
  346   for (
int i = 0; i < nSinks; i++)
 
  356       temp.Stop (
Seconds (TotalTime));
 
  359   std::stringstream ss;
 
  361   std::string 
nodes = ss.str ();
 
  363   std::stringstream ss2;
 
  365   std::string sNodeSpeed = ss2.str ();
 
  367   std::stringstream ss3;
 
  369   std::string sNodePause = ss3.str ();
 
  371   std::stringstream ss4;
 
  373   std::string sRate = ss4.str ();
 
  393   Simulator::Stop (
Seconds (TotalTime));
 
  398   Simulator::Destroy ();
 
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. 
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism. 
Manage ASCII trace files for device models. 
Ipv4Address GetIpv4(void) const 
std::string m_CSVfileName
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())
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
Hold variables of type string. 
Make it easy to create and manage PHY objects for the yans model. 
std::string CommandSetup(int argc, char **argv)
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())
Helper class that adds DSR routing to nodes. 
void ReceivePacket(Ptr< Socket > socket)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory. 
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). 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
void ReceivePacket(Ptr< Socket > socket)
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. ...
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models (inc...
void Set(std::string name, const AttributeValue &v)
helps to create WifiNetDevice objects 
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes. 
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const 
a polymophic address class 
void SetChannel(Ptr< YansWifiChannel > channel)
double GetSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
bool PeekPacketTag(Tag &tag) const 
Search a matching tag and call Tag::Deserialize if it is found. 
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
static std::string PrintReceivedPacket(Ptr< Socket > socket, Ptr< Packet > packet)
Ptr< Object > Create(void) const 
Create an Object instance of the configured TypeId. 
holds a vector of ns3::NetDevice pointers 
virtual void SetStandard(enum WifiPhyStandard standard)
This class implements a tag that carries an address of a packet across the socket interface...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read. 
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. 
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Ptr< Socket > SetupPacketReceive(Ipv4Address addr, 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. 
keep track of a set of node pointers. 
Hold objects of type Ptr. 
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) 
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 
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionaly. 
void Run(int nSinks, double txp, std::string CSVfileName)
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction. 
manage and create wifi channel objects for the yans model. 
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
Helper class used to assign positions and mobility models to nodes. 
Instantiate subclasses of ns3::Object. 
Ipv4 addresses are stored in host order in this class. 
AttributeValue implementation for Address. 
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
uint32_t GetId(void) const 
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with. 
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD. 
Address GetAddress(void) const 
Get the tag's address. 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
void SetDefault(std::string name, const AttributeValue &value)
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. 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
Helper class that adds AODV routing to nodes. 
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())
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Helper class that adds DSDV routing to nodes. 
void Install(DsrHelper &dsrHelper, NodeContainer nodes)
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. 
std::string m_protocolName
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. 
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const 
Allocate a set of positions. 
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...