|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
19 #include "ns3/core-module.h"
20 #include "ns3/point-to-point-module.h"
21 #include "ns3/csma-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/applications-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/netanim-module.h"
27 #include "ns3/basic-energy-source.h"
28 #include "ns3/simple-device-energy-model.h"
29 #include "ns3/yans-wifi-helper.h"
31 #include "ns3/wifi-radio-energy-model.h"
38 main (
int argc,
char *argv[])
42 cmd.AddValue (
"nWifi",
"Number of wifi STA devices",
nWifi);
44 cmd.Parse (argc,argv);
58 wifi.SetRemoteStationManager (
"ns3::AarfWifiManager");
62 mac.SetType (
"ns3::StaWifiMac",
68 mac.SetType (
"ns3::ApWifiMac",
102 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
109 mobility.SetMobilityModel (
"ns3::RandomWalk2dMobilityModel",
112 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
125 wifiApNode.Get (0)->AggregateObject (energySource);
130 stack.Install (allNodes);
135 address.SetBase (
"10.1.1.0",
"255.255.255.0");
138 address.SetBase (
"10.1.2.0",
"255.255.255.0");
141 address.SetBase (
"10.1.3.0",
"255.255.255.0");
167 anim.UpdateNodeDescription (
wifiStaNodes.Get (i),
"STA");
170 for (uint32_t i = 0; i <
wifiApNode.GetN (); ++i)
172 anim.UpdateNodeDescription (
wifiApNode.Get (i),
"AP");
173 anim.UpdateNodeColor (
wifiApNode.Get (i), 0, 255, 0);
175 for (uint32_t i = 0; i <
csmaNodes.GetN (); ++i)
177 anim.UpdateNodeDescription (
csmaNodes.Get (i),
"CSMA");
178 anim.UpdateNodeColor (
csmaNodes.Get (i), 0, 0, 255);
181 anim.EnablePacketMetadata ();
182 anim.EnableIpv4RouteTracking (
"routingtable-wireless.xml",
Seconds (0),
Seconds (5),
Seconds (0.25));
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
Parse command-line arguments.
AttributeValue implementation for Boolean.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
helps to create WifiNetDevice objects
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Create an application which sends a UDP packet and waits for an echo of this packet.
AttributeValue implementation for Rectangle.
Interface to network animator.
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
void SetInitialEnergy(double initialEnergyJ)
This class can be used to hold variables of floating point type such as 'double' or 'float'.
AttributeValue implementation for Ssid.
build a set of CsmaNetDevice objects
The IEEE 802.11 SSID Information Element.
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
void SetEnergySource(const Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
static void Run(void)
Run the simulation.
Hold variables of type string.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
holds a vector of ns3::Application pointers.
AttributeValue implementation for Time.
Build a set of PointToPointNetDevice objects.
keep track of a set of node pointers.
Hold an unsigned integer type.
manage and create wifi channel objects for the YANS model.
create MAC layers for a ns3::WifiNetDevice.
Create a server application which waits for input UDP packets and sends them back to the original sen...
aggregate IP/TCP/UDP functionality to existing Nodes.
Helper class used to assign positions and mobility models to nodes.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)