17 #include "ns3/core-module.h" 18 #include "ns3/point-to-point-module.h" 19 #include "ns3/network-module.h" 20 #include "ns3/applications-module.h" 21 #include "ns3/mobility-module.h" 22 #include "ns3/csma-module.h" 23 #include "ns3/internet-module.h" 24 #include "ns3/mpi-module.h" 25 #include "ns3/yans-wifi-helper.h" 49 main (
int argc,
char *argv[])
58 cmd.AddValue (
"nCsma",
"Number of \"extra\" CSMA nodes/devices",
nCsma);
59 cmd.AddValue (
"nWifi",
"Number of wifi STA devices",
nWifi);
60 cmd.AddValue (
"verbose",
"Tell echo applications to log if true",
verbose);
61 cmd.AddValue (
"tracing",
"Enable pcap tracing", tracing);
62 cmd.AddValue (
"nullmsg",
"Enable the use of null-message synchronization", nullmsg);
64 cmd.Parse (argc,argv);
71 std::cout <<
"nWifi should be 18 or less; otherwise grid layout exceeds the bounding box" << std::endl;
82 uint32_t systemId = 0;
83 uint32_t systemCount = 1;
106 if (systemCount != 2)
108 std::cout <<
"This simulation requires 2 and only 2 logical processors." << std::endl;
115 uint32_t systemWifi = 0;
118 uint32_t systemCsma = systemCount - 1;
122 Ptr<Node> p2pNode1 = CreateObject<Node> (systemWifi);
123 Ptr<Node> p2pNode2 = CreateObject<Node> (systemCsma);
156 wifi.SetRemoteStationManager (
"ns3::AarfWifiManager");
160 mac.SetType (
"ns3::StaWifiMac",
167 mac.SetType (
"ns3::ApWifiMac",
175 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
183 mobility.SetMobilityModel (
"ns3::RandomWalk2dMobilityModel",
187 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
197 address.SetBase (
"10.1.1.0",
"255.255.255.0");
201 address.SetBase (
"10.1.2.0",
"255.255.255.0");
205 address.SetBase (
"10.1.3.0",
"255.255.255.0");
212 if (systemId == systemCsma)
224 if (systemId == systemWifi)
248 if (systemId == systemCsma)
251 phy.EnablePcap (
"third-distributed-csma",
apDevices.Get (0));
257 phy.EnablePcap (
"third-distributed-wifi",
apDevices.Get (0));
holds a vector of ns3::Application pointers.
AttributeValue implementation for Boolean.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
Hold variables of type string.
Make it easy to create and manage PHY objects for the yans model.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
Create an application which sends a UDP packet and waits for an echo of this packet.
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
static void Disable()
Terminates the parallel environment.
Build a set of PointToPointNetDevice objects.
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
helps to create WifiNetDevice objects
AttributeValue implementation for Rectangle.
Create a server application which waits for input UDP packets and sends them back to the original sen...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
AttributeValue implementation for Time.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
static void Enable(int *pargc, char ***pargv)
Sets up parallel communication interface.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
The IEEE 802.11 SSID Information Element.
build a set of CsmaNetDevice objects
Helper class used to assign positions and mobility models to nodes.
static uint32_t GetSystemId()
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Ssid.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
static uint32_t GetSize()