|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
49 #include "ns3/core-module.h"
50 #include "ns3/internet-module.h"
51 #include "ns3/network-module.h"
52 #include "ns3/applications-module.h"
53 #include "ns3/mesh-module.h"
54 #include "ns3/mobility-module.h"
55 #include "ns3/mesh-helper.h"
56 #include "ns3/yans-wifi-helper.h"
77 void Configure (
int argc,
char ** argv);
109 void InstallInternetStack ();
111 void InstallApplication ();
121 m_packetInterval (0.1),
128 m_root (
"ff:ff:ff:ff:ff:ff")
135 cmd.AddValue (
"x-size",
"Number of nodes in a row grid",
m_xSize);
136 cmd.AddValue (
"y-size",
"Number of rows in a grid",
m_ySize);
137 cmd.AddValue (
"step",
"Size of edge in our grid (meters)",
m_step);
139 cmd.AddValue (
"start",
"Maximum random start delay for beacon jitter (sec)",
m_randomStart);
141 cmd.AddValue (
"packet-interval",
"Interval between packets in UDP ping (sec)",
m_packetInterval);
142 cmd.AddValue (
"packet-size",
"Size of packets in UDP ping (bytes)",
m_packetSize);
143 cmd.AddValue (
"interfaces",
"Number of radio interfaces used by each mesh point",
m_nIfaces);
144 cmd.AddValue (
"channels",
"Use different frequency channels for different interfaces",
m_chan);
145 cmd.AddValue (
"pcap",
"Enable PCAP traces on interfaces",
m_pcap);
146 cmd.AddValue (
"ascii",
"Enable Ascii traces on interfaces",
m_ascii);
147 cmd.AddValue (
"stack",
"Type of protocol stack. ns3::Dot11sStack by default",
m_stack);
148 cmd.AddValue (
"root",
"Mac address of root mesh point in HWMP",
m_root);
150 cmd.Parse (argc, argv);
155 PacketMetadata::Enable ();
174 mesh = MeshHelper::Default ();
200 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
207 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
223 address.SetBase (
"10.1.1.0",
"255.255.255.0");
250 Simulator::Destroy ();
259 std::ostringstream os;
260 os <<
"mp-report-" <<
n <<
".xml";
261 std::cerr <<
"Printing mesh point device #" <<
n <<
" diagnostics to " << os.str () <<
"\n";
263 of.open (os.str ().c_str ());
266 std::cerr <<
"Error: Can't open file " << os.str () <<
"\n";
274 main (
int argc,
char *argv[])
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void InstallApplication()
Install applications.
Make it easy to create and manage PHY objects for the YANS model.
Parse command-line arguments.
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 SetMacType(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 CreateNodes()
Create nodes and setup their mobility.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
uint16_t m_packetSize
packet size
Create an application which sends a UDP packet and waits for an echo of this packet.
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 ...
void Configure(int argc, char **argv)
Configure test from command line arguments.
uint32_t m_nIfaces
number interfaces
Ipv4InterfaceContainer interfaces
Addresses of interfaces:
AttributeValue implementation for Mac48Address.
void SetChannel(Ptr< YansWifiChannel > channel)
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Helper to create IEEE 802.11s mesh networks.
void SetSpreadInterfaceChannels(ChannelPolicy policy)
set the channel policy
NodeContainer nodes
List of network nodes.
MeshHelper mesh
MeshHelper. Report is not static methods.
void InstallInternetStack()
Install internet m_stack on nodes.
void Report()
Print mesh devices diagnostics.
double m_randomStart
random start
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Ptr< YansWifiChannel > Create(void) const
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
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.
double m_totalTime
total time
bool IsBroadcast(void) const
double m_packetInterval
packet interval
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetNumberOfInterfaces(uint32_t nInterfaces)
Set a number of interfaces in a mesh network.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Hold variables of type string.
NetDeviceContainer Install(const WifiPhyHelper &phyHelper, NodeContainer c) const
Install 802.11s mesh device & protocols on given node list.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Manage ASCII trace files for device models.
void SetStackInstaller(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())
#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.
holds a vector of ns3::Application pointers.
AttributeValue implementation for Time.
keep track of a set of node pointers.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
manage and create wifi channel objects for the YANS model.
Create a server application which waits for input UDP packets and sends them back to the original sen...
void Report(const ns3::Ptr< ns3::NetDevice > &device, std::ostream &os)
Print statistics.
NetDeviceContainer meshDevices
List of all mesh point devices.
aggregate IP/TCP/UDP functionality to existing Nodes.
Helper class used to assign positions and mobility models to nodes.