49#include "ns3/animation-interface.h"
50#include "ns3/command-line.h"
51#include "ns3/csma-helper.h"
52#include "ns3/internet-stack-helper.h"
53#include "ns3/ipv4-address-helper.h"
54#include "ns3/mobility-helper.h"
55#include "ns3/olsr-helper.h"
56#include "ns3/on-off-helper.h"
57#include "ns3/packet-sink-helper.h"
58#include "ns3/qos-txop.h"
60#include "ns3/string.h"
61#include "ns3/yans-wifi-channel.h"
62#include "ns3/yans-wifi-helper.h"
81 Vector position =
model->GetPosition();
82 std::cout <<
"CourseChange " << path <<
" x=" << position.x <<
", y=" << position.y
83 <<
", z=" << position.z << std::endl;
113 cmd.AddValue(
"infraNodes",
"number of leaf nodes",
infraNodes);
114 cmd.AddValue(
"lanNodes",
"number of LAN nodes",
lanNodes);
115 cmd.AddValue(
"stopTime",
"simulation stop time (seconds)",
stopTime);
116 cmd.AddValue(
"useCourseChangeCallback",
117 "whether to enable course change tracing",
128 std::cout <<
"Use a simulation stop time >= 10 seconds" << std::endl;
149 mac.SetType(
"ns3::AdhocWifiMac");
150 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
161 NS_LOG_INFO(
"Enabling OLSR routing on all backbone nodes");
183 mobility.SetPositionAllocator(
"ns3::GridPositionAllocator",
196 mobility.SetMobilityModel(
"ns3::RandomDirection2dMobilityModel",
200 StringValue(
"ns3::ConstantRandomVariable[Constant=2]"),
202 StringValue(
"ns3::ConstantRandomVariable[Constant=0.2]"));
213 ipAddrs.SetBase(
"172.16.0.0",
"255.255.255.0");
217 NS_LOG_INFO(
"Configuring local area network for backbone node " <<
i);
261 mobilityLan.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
273 ipAddrs.SetBase(
"10.0.0.0",
"255.255.255.0");
277 NS_LOG_INFO(
"Configuring wireless network for backbone node " <<
i);
295 std::stringstream
ss;
332 mobility.SetMobilityModel(
"ns3::RandomDirection2dMobilityModel",
336 StringValue(
"ns3::ConstantRandomVariable[Constant=3]"),
338 StringValue(
"ns3::ConstantRandomVariable[Constant=0.4]"));
395 wifiPhy.EnableAsciiAll(stream);
396 csma.EnableAsciiAll(stream);
397 internet.EnableAsciiIpv4All(stream);
400 csma.EnablePcapAll(
"mixed-wireless",
false);
a polymophic address class
Interface to network animator.
holds a vector of ns3::Application pointers.
Manage ASCII trace files for device models.
Parse command-line arguments.
build a set of CsmaNetDevice objects
Class for representing data rates.
AttributeValue implementation for DataRate.
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.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
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.
static Ptr< Node > GetNode(uint32_t n)
Helper class that adds OLSR routing to nodes.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Rectangle.
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.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
AnimationInterface * anim
static void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
This function will be used below as a trace sink, if the command-line argument or default value "useC...
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...
Ptr< PacketSink > sink
Pointer to the packet sink application.