|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
24 #include "ns3/core-module.h"
25 #include "ns3/point-to-point-module.h"
26 #include "ns3/network-module.h"
27 #include "ns3/applications-module.h"
28 #include "ns3/mobility-module.h"
29 #include "ns3/csma-module.h"
30 #include "ns3/internet-module.h"
31 #include "ns3/wifi-module.h"
33 #include "ns3/nix-vector-routing-module.h"
89 main (
int argc,
char *argv[])
92 bool enableNixLog =
false;
95 cmd.AddValue (
"useIPv6",
"Use IPv6 instead of IPv4", useIpv6);
96 cmd.AddValue (
"enableNixLog",
"Enable NixVectorRouting logging", enableNixLog);
97 cmd.Parse (argc,argv);
129 wifi.SetRemoteStationManager (
"ns3::AarfWifiManager");
133 mac.SetType (
"ns3::StaWifiMac",
138 staDevices1 =
wifi.Install (
phy,
mac, wifiStaNodes1);
140 mac.SetType (
"ns3::ApWifiMac",
144 apDevices1 =
wifi.Install (
phy,
mac, wifiApNode1);
147 mac.SetType (
"ns3::StaWifiMac",
152 staDevices2 =
wifi.Install (
phy,
mac, wifiStaNodes2);
154 mac.SetType (
"ns3::ApWifiMac",
158 apDevices2 =
wifi.Install (
phy,
mac, wifiApNode2);
162 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
170 mobility.SetMobilityModel (
"ns3::RandomWalk2dMobilityModel",
175 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
185 stack.SetRoutingHelper (nixRouting);
186 stack.Install (wifiApNode1);
187 stack.Install (wifiStaNodes1);
188 stack.Install (wifiApNode2);
189 stack.Install (wifiStaNodes2);
193 address.SetBase (
"10.1.1.0",
"255.255.255.0");
197 address.SetBase (
"10.1.2.0",
"255.255.255.0");
201 address.SetBase (
"10.1.3.0",
"255.255.255.0");
203 staDevicesInterfaces2 =
address.Assign (staDevices2);
206 udpServerAddress = staDevicesInterfaces2.
GetAddress (2);
208 Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (
"nix-double-wifi-ipv4.routes", std::ios::out);
215 stack.SetRoutingHelper (nixRouting);
216 stack.Install (wifiApNode1);
217 stack.Install (wifiStaNodes1);
218 stack.Install (wifiApNode2);
219 stack.Install (wifiStaNodes2);
233 staDevicesInterfaces2 =
address.Assign (staDevices2);
236 udpServerAddress = staDevicesInterfaces2.
GetAddress (2, 1);
238 Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (
"nix-double-wifi-ipv6.routes", std::ios::out);
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.
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.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Describes an IPv6 address.
Helper class to auto-assign global IPv6 unicast addresses.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
AttributeValue implementation for Ssid.
The IEEE 802.11 SSID Information Element.
Helper class that adds Nix-vector routing to nodes.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
a polymophic address class
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Keep track of a set of IPv6 interfaces.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given 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.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
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...
Describes an IPv6 prefix.
aggregate IP/TCP/UDP functionality to existing Nodes.
void PrintRoutingPathAt(Time printTime, Ptr< Node > source, IpAddress dest, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the routing path for a source and destination at a particular time.
@ LOG_LEVEL_LOGIC
LOG_LOGIC and above.
Helper class used to assign positions and mobility models to nodes.