|
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/network-module.h"
22 #include "ns3/applications-module.h"
23 #include "ns3/mobility-module.h"
24 #include "ns3/csma-module.h"
25 #include "ns3/internet-module.h"
26 #include "ns3/mpi-module.h"
27 #include "ns3/yans-wifi-helper.h"
60 main (
int argc,
char *argv[])
70 cmd.AddValue (
"nCsma",
"Number of \"extra\" CSMA nodes/devices",
nCsma);
71 cmd.AddValue (
"nWifi",
"Number of wifi STA devices",
nWifi);
72 cmd.AddValue (
"verbose",
"Tell echo applications to log if true",
verbose);
73 cmd.AddValue (
"tracing",
"Enable pcap tracing",
tracing);
74 cmd.AddValue (
"nullmsg",
"Enable the use of null-message synchronization", nullmsg);
75 cmd.AddValue (
"test",
"Enable regression test output", testing);
77 cmd.Parse (argc,argv);
84 std::cout <<
"nWifi should be 18 or less; otherwise grid layout exceeds the bounding box" << std::endl;
95 uint32_t systemId = 0;
96 uint32_t systemCount = 1;
119 if (systemCount != 2)
121 std::cout <<
"This simulation requires 2 and only 2 logical processors." << std::endl;
126 uint32_t systemWifi = 0;
129 uint32_t systemCsma = systemCount - 1;
133 Ptr<Node> p2pNode1 = CreateObject<Node> (systemWifi);
134 Ptr<Node> p2pNode2 = CreateObject<Node> (systemCsma);
167 wifi.SetRemoteStationManager (
"ns3::AarfWifiManager");
171 mac.SetType (
"ns3::StaWifiMac",
178 mac.SetType (
"ns3::ApWifiMac",
186 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
194 mobility.SetMobilityModel (
"ns3::RandomWalk2dMobilityModel",
198 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
208 address.SetBase (
"10.1.1.0",
"255.255.255.0");
212 address.SetBase (
"10.1.2.0",
"255.255.255.0");
216 address.SetBase (
"10.1.3.0",
"255.255.255.0");
223 if (systemId == systemCsma)
240 if (systemId == systemWifi)
269 if (systemId == systemCsma)
272 phy.EnablePcap (
"third-distributed-csma",
apDevices.Get (0));
278 phy.EnablePcap (
"third-distributed-wifi",
apDevices.Get (0));
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.
@ LOG_LEVEL_INFO
LOG_INFO and above.
bool tracing
Flag to enable/disable generation of tracing files.
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.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
AttributeValue implementation for Rectangle.
static void Disable()
Clean up the ns-3 parallel communications interface.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static void Verify(unsigned long expectedCount)
Verify the sink trace count observed matches the expected count.
AttributeValue implementation for Ssid.
build a set of CsmaNetDevice objects
The IEEE 802.11 SSID Information Element.
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.
Common methods for MPI examples.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
static void Enable(int *pargc, char ***pargv)
Setup the parallel communication interface.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static void Run(void)
Run the simulation.
Hold variables of type string.
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...
static void SinkTrace(const ns3::Ptr< const ns3::Packet > packet, const ns3::Address &srcAddress, const ns3::Address &destAddress)
PacketSink receive trace callback.
static void Init(void)
PacketSink receive trace callback.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
LogLevel
Logging severity classes and levels.
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.
static uint32_t GetSystemId()
Get the id number of this rank.
Helper class used to assign positions and mobility models to nodes.
static uint32_t GetSize()
Get the number of ranks used by ns-3.