61#include "ns3/applications-module.h"
62#include "ns3/core-module.h"
63#include "ns3/internet-module.h"
64#include "ns3/mesh-helper.h"
65#include "ns3/mesh-module.h"
66#include "ns3/mobility-module.h"
67#include "ns3/network-module.h"
68#include "ns3/yans-wifi-helper.h"
174 m_stack(
"ns3::Dot11sStack"),
175 m_root(
"ff:ff:ff:ff:ff:ff")
183 cmd.AddValue(
"x-size",
"Number of nodes in a row grid",
m_xSize);
184 cmd.AddValue(
"y-size",
"Number of rows in a grid",
m_ySize);
185 cmd.AddValue(
"step",
"Size of edge in our grid (meters)",
m_step);
187 cmd.AddValue(
"start",
"Maximum random start delay for beacon jitter (sec)",
m_randomStart);
188 cmd.AddValue(
"time",
"Simulation time (sec)",
m_totalTime);
189 cmd.AddValue(
"packet-interval",
"Interval between packets in UDP ping (sec)",
m_packetInterval);
190 cmd.AddValue(
"packet-size",
"Size of packets in UDP ping (bytes)",
m_packetSize);
191 cmd.AddValue(
"interfaces",
"Number of radio interfaces used by each mesh point",
m_nIfaces);
192 cmd.AddValue(
"channels",
"Use different frequency channels for different interfaces",
m_chan);
193 cmd.AddValue(
"pcap",
"Enable PCAP traces on interfaces",
m_pcap);
194 cmd.AddValue(
"ascii",
"Enable Ascii traces on interfaces",
m_ascii);
195 cmd.AddValue(
"stack",
"Type of protocol stack. ns3::Dot11sStack by default",
m_stack);
196 cmd.AddValue(
"root",
"Mac address of root mesh point in HWMP",
m_root);
198 cmd.Parse(argc, argv);
251 mobility.SetPositionAllocator(
"ns3::GridPositionAllocator",
264 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
265 mobility.Install(
nodes);
283 address.SetBase(
"10.1.1.0",
"255.255.255.0");
290 uint16_t portNumber = 9;
297 echoClient.SetAttribute(
"MaxPackets",
330 std::ostringstream os;
331 os <<
"mp-report-" << n <<
".xml";
332 std::cerr <<
"Printing mesh point device #" << n <<
" diagnostics to " << os.str() <<
"\n";
334 of.open(os.str().c_str());
337 std::cerr <<
"Error: Can't open file " << os.str() <<
"\n";
346main(
int argc,
char* argv[])
uint32_t m_nIfaces
number interfaces
void InstallInternetStack()
Install internet m_stack on nodes.
NodeContainer nodes
List of network nodes.
Ipv4InterfaceContainer interfaces
Addresses of interfaces:
uint16_t m_packetSize
packet size
void CreateNodes()
Create nodes and setup their mobility.
double m_packetInterval
packet interval
double m_randomStart
random start
NetDeviceContainer meshDevices
List of all mesh point devices.
void Report()
Print mesh devices diagnostics.
void Configure(int argc, char **argv)
Configure test from command line arguments.
MeshHelper mesh
MeshHelper. Report is not static methods.
double m_totalTime
total time
void InstallApplication()
Install applications.
holds a vector of ns3::Application pointers.
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...
Manage ASCII trace files for device models.
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.
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
AttributeValue implementation for Mac48Address.
Helper to create IEEE 802.11s mesh networks.
void SetSpreadInterfaceChannels(ChannelPolicy policy)
set the channel policy
void SetStackInstaller(std::string type, Ts &&... args)
Set the MeshStack type to use.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static MeshHelper Default()
Set the helper to the default values for the MAC type, remote station manager and channel policy.
void SetMacType(Ts &&... args)
Set the Mac Attributes.
NetDeviceContainer Install(const WifiPhyHelper &phyHelper, NodeContainer c) const
Install 802.11s mesh device & protocols on given node list.
void Report(const ns3::Ptr< ns3::NetDevice > &device, std::ostream &os)
Print statistics.
void SetNumberOfInterfaces(uint32_t nInterfaces)
Set a number of interfaces in a mesh network.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
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 ...
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
AttributeValue implementation for Time.
Create an application which sends a UDP packet and waits for an echo of this packet.
Create a server application which waits for input UDP packets and sends them back to the original sen...
Hold an unsigned integer type.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
Make it easy to create and manage PHY objects for the YANS model.
void SetChannel(Ptr< YansWifiChannel > channel)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.
uint32_t g_udpTxCount
Rx packet counter.
void TxTrace(Ptr< const Packet > p)
Transmission trace sink.
uint32_t g_udpRxCount
Tx packet counter.
void RxTrace(Ptr< const Packet > p)
Reception trace sink,.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...