Merge with ns-3-dev

This commit is contained in:
Kirill Andreev
2009-04-29 18:26:25 +04:00
97 changed files with 7132 additions and 401 deletions

217
examples/emu-ping.cc Normal file
View File

@@ -0,0 +1,217 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Allow ns-3 to ping a real host somewhere, using emulation mode
//
// ------------
// | node n0 |
// | |
// | --- |
// | | | |
// | |emu| |
// | | | |
// | --- |
// | | |
// ----|-------
// |
// (device on host system, set to promiscuous mode)
// |
// --------- (Internet) -------
//
// To use this example:
// 1) You need to decide on a physical device on your real system, and either
// overwrite the hard-configured device name below (eth0) or pass this
// device name in as a command-line argument
// 2) The host device must be set to promiscuous mode
// (e.g. "sudo ifconfig eth0 promisc")
// 3) Be aware that ns-3 will generate a fake mac address, and that in
// some enterprise networks, this may be considered bad form to be
// sending packets out of your device with "unauthorized" mac addresses
// 4) You will need to assign an IP address to the ns-3 simulation node that
// is consistent with the subnet that is active on the host device's link.
// That is, you will have to assign an IP address to the ns-3 node as if
// it were on your real subnet. Search for "Ipv4Address localIp" and
// replace the string "1.2.3.4" with a valid IP address.
// 5) You will need to configure a default route in the ns-3 node to tell it
// how to get off of your subnet. One thing you could do is a
// 'netstat -rn' command and find the IP address of the default gateway
// on your host. Search for "Ipv4Address gateway" and replace the string
// "1.2.3.4" string with the gateway IP address.
#include "ns3/abort.h"
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/internet-stack-module.h"
#include "ns3/emu-module.h"
#include "ns3/v4ping-module.h"
#include "ns3/helper-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("PingEmulationExample");
static void
PingRtt (std::string context, Time rtt)
{
NS_LOG_UNCOND ("Received Response with RTT = " << rtt);
}
int
main (int argc, char *argv[])
{
NS_LOG_INFO ("Ping Emulation Example");
std::string deviceName ("eth0");
std::string remote ("208.77.188.166"); // example.com
//
// Allow the user to override any of the defaults at run-time, via
// command-line arguments
//
CommandLine cmd;
cmd.AddValue("deviceName", "Device name", deviceName);
cmd.AddValue("remote", "Remote IP address (dotted decimal only please)", remote);
cmd.Parse (argc, argv);
Ipv4Address remoteIp (remote.c_str ());
Ipv4Address localIp ("1.2.3.4");
NS_ABORT_MSG_IF (localIp == "1.2.3.4", "You must change the local IP address before running this example");
Ipv4Mask localMask ("255.255.255.0");
//
// Since we are using a real piece of hardware we need to use the realtime
// simulator.
//
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
//
// Since we are going to be talking to real-world machines, we need to enable
// calculation of checksums in our protocols.
//
Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true));
Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true));
Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true));
Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true));
//
// In such a simple topology, the use of the helper API can be a hindrance
// so we drop down into the low level API and do it manually.
//
// First we need a single node.
//
NS_LOG_INFO ("Create Node");
Ptr<Node> node = CreateObject<Node> ();
//
// Create an emu device, allocate a MAC address and point the device to the
// Linux device name. The device needs a transmit queueing discipline so
// create a droptail queue and give it to the device. Finally, "install"
// the device into the node.
//
// Do understand that the ns-3 allocated MAC address will be sent out over
// your network since the emu net device will spoof it. By default, this
// address will have an Organizationally Unique Identifier (OUI) of zero.
// The Internet Assigned Number Authority IANA
//
// http://www.iana.org/assignments/ethernet-numbers
//
// reports that this OUI is unassigned, and so should not conflict with
// real hardware on your net. It may raise all kinds of red flags in a
// real environment to have packets from a device with an obviously bogus
// OUI flying around. Be aware.
//
NS_LOG_INFO ("Create Device");
Ptr<EmuNetDevice> device = CreateObject<EmuNetDevice> ();
device->SetAttribute ("Address", Mac48AddressValue (Mac48Address::Allocate ()));
device->SetAttribute ("DeviceName", StringValue (deviceName));
Ptr<Queue> queue = CreateObject<DropTailQueue> ();
device->SetQueue (queue);
node->AddDevice (device);
//
// Add a default internet stack to the node. This gets us the ns-3 versions
// of ARP, IPv4, ICMP, UDP and TCP.
//
NS_LOG_INFO ("Add Internet Stack");
AddInternetStack (node);
NS_LOG_INFO ("Create IPv4 Interface");
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
uint32_t interface = ipv4->AddInterface (device);
Ipv4InterfaceAddress address = Ipv4InterfaceAddress (localIp, localMask);
ipv4->AddAddress (interface, address);
ipv4->SetMetric (interface, 1);
ipv4->SetUp (interface);
//
// When the ping appliation sends its ICMP packet, it will happily send it
// down the ns-3 protocol stack. We set the IP address of the destination
// to the address corresponding to example.com above. This address is off
// our local network so we have got to provide some kind of default route
// to ns-3 to be able to get that ICMP packet forwarded off of our network.
//
// You have got to provide an IP address of a real host that you can send
// real packets to and have them forwarded off of your local network. One
// thing you could do is a 'netstat -rn' command and find the IP address of
// the default gateway on your host and add it below, replacing the
// "1.2.3.4" string.
//
Ipv4Address gateway ("1.2.3.4");
NS_ABORT_MSG_IF (gateway == "1.2.3.4", "You must change the gateway IP address before running this example");
ipv4->SetDefaultRoute (gateway, interface);
//
// Create the ping application. This application knows how to send
// ICMP echo requests. Setting up the packet sink manually is a bit
// of a hassle and since there is no law that says we cannot mix the
// helper API with the low level API, let's just use the helper.
//
NS_LOG_INFO ("Create V4Ping Appliation");
Ptr<V4Ping> app = CreateObject<V4Ping> ();
app->SetAttribute ("Remote", Ipv4AddressValue (remoteIp));
node->AddApplication (app);
app->Start (Seconds (1.0));
app->Stop (Seconds (5.0));
//
// Give the application a name. This makes life much easier when constructing
// config paths.
//
Names::Add ("app", app);
//
// Hook a trace to print something when the response comes back.
//
Config::Connect ("/Names/app/Rtt", MakeCallback (&PingRtt));
//
// Enable a promiscuous pcap trace to see what is coming and going on our device.
//
EmuHelper::EnablePcap ("emu-ping", device, true);
//
// Now, do the actual emulation.
//
NS_LOG_INFO ("Run Emulation.");
Simulator::Stop (Seconds (5.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}

View File

@@ -44,7 +44,7 @@ main (int argc, char *argv[])
double step = 100.0;
double randomStart = 0.1;
double totalTime = 100.0;
double packetInterval = 0.001;
double packetInterval = 0.1;
uint16_t packetSize = 1024;
uint32_t nIfaces = 1;
bool chan = true;

View File

@@ -144,13 +144,14 @@ main (int argc, char *argv[])
// our container
//
WifiHelper wifi;
wifi.SetMac ("ns3::AdhocWifiMac");
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
mac.SetType ("ns3::AdhocWifiMac");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-54mbs"));
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, backbone);
NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone);
//
// Add the IPv4 protocol stack to the nodes in our container
//
@@ -258,6 +259,7 @@ main (int argc, char *argv[])
// Create an infrastructure network
//
WifiHelper wifiInfra = WifiHelper::Default ();
NqosWifiMacHelper macInfra = NqosWifiMacHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
// Create unique ssids for these networks
std::string ssidString("wifi-infra");
@@ -267,15 +269,15 @@ main (int argc, char *argv[])
Ssid ssid = Ssid (ssidString);
wifiInfra.SetRemoteStationManager ("ns3::ArfWifiManager");
// setup stas
wifiInfra.SetMac ("ns3::NqstaWifiMac",
macInfra.SetType ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, stas);
NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, macInfra, stas);
// setup ap.
wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
macInfra.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i));
NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i));
// Collect all of these new devices
NetDeviceContainer infraDevices (apDevices, staDevices);

View File

@@ -0,0 +1,151 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 MIRKO BANCHI
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/global-routing-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
//This is a simple example in order to show how 802.11n frame aggregation feature (A-MSDU) works.
//
//Network topology:
//
// Wifi 192.168.1.0
//
// AP
// * * *
// | | |
// n1 n2 n3
//
//Packets in this simulation aren't marked with a QosTag so they are considered
//belonging to BestEffort Access Class (AC_BE).
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SimpleWifiFrameAggregation");
int main (int argc, char *argv[])
{
//LogComponentEnable ("EdcaTxopN", LOG_LEVEL_DEBUG);
LogComponentEnable ("MsduAggregator", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
uint32_t nWifi = 1;
CommandLine cmd;
cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
cmd.Parse (argc,argv);
NodeContainer wifiNodes;
wifiNodes.Create (2);
NodeContainer wifiApNode;
wifiApNode.Create (1);
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
WifiHelper wifi = WifiHelper::Default ();
QosWifiMacHelper mac = QosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "FragmentationThreshold", UintegerValue (2500));
Ssid ssid = Ssid ("ns-3-802.11n");
mac.SetType ("ns3::QstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator",
"MaxAmsduSize", UintegerValue (3839));
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiNodes);
mac.SetType ("ns3::QapWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator",
"MaxAmsduSize", UintegerValue (7935));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
/* Setting mobility model */
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (3),
"LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
mobility.Install (wifiNodes);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNode);
/* Internet stack*/
InternetStackHelper stack;
stack.Install (wifiApNode);
stack.Install (wifiNodes);
Ipv4AddressHelper address;
address.SetBase ("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer wifiNodesInterfaces;
Ipv4InterfaceContainer apNodeInterface;
wifiNodesInterfaces = address.Assign (staDevices);
apNodeInterface = address.Assign (apDevice);
/* Setting applications */
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (wifiNodes.Get (1));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (wifiNodesInterfaces.GetAddress (1), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (3));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.000001)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1500));
ApplicationContainer clientApps =
echoClient.Install (wifiNodes.Get (0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
GlobalRouteManager::PopulateRoutingTables ();
Simulator::Stop (Seconds (10.0));
YansWifiPhyHelper::EnablePcap ("test-802.11n",
wifiNodes.Get (nWifi - 1)->GetId (), 0);
Simulator::Run ();
Simulator::Destroy ();
return 0;
}

View File

@@ -128,11 +128,12 @@ int main(int argc, char *argv[]) {
NS_LOG_INFO("Installing WiFi and Internet stack.");
WifiHelper wifi = WifiHelper::Default ();
wifi.SetMac("ns3::AdhocWifiMac");
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifiMac.SetType ("ns3::AdhocWifiMac");
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, nodes);
NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, wifiMac, nodes);
InternetStackHelper internet;
internet.Install(nodes);

View File

@@ -151,19 +151,20 @@ main (int argc, char *argv[])
Ssid ssid = Ssid ("left");
WifiHelper wifi = WifiHelper::Default ();
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
wifi.SetMac ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, nodesLeft.Get (0));
wifiMac.SetType ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, wifiMac, nodesLeft.Get (0));
wifi.SetMac ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
devicesLeft.Add (wifi.Install (wifiPhy, NodeContainer (nodesLeft.Get (1), nodesLeft.Get (2), nodesLeft.Get (3))));
wifiMac.SetType ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
devicesLeft.Add (wifi.Install (wifiPhy, wifiMac, NodeContainer (nodesLeft.Get (1), nodesLeft.Get (2), nodesLeft.Get (3))));
MobilityHelper mobility;
mobility.Install (nodesLeft);

View File

@@ -89,21 +89,23 @@ main (int argc, char *argv[])
WifiHelper wifi = WifiHelper::Default ();
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
Ssid ssid = Ssid ("ns-3-ssid");
wifi.SetMac ("ns3::NqstaWifiMac",
mac.SetType ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, wifiStaNodes);
staDevices = wifi.Install (phy, mac, wifiStaNodes);
wifi.SetMac ("ns3::NqapWifiMac",
mac.SetType ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
NetDeviceContainer apDevices;
apDevices = wifi.Install (phy, wifiApNode);
apDevices = wifi.Install (phy, mac, wifiApNode);
MobilityHelper mobility;

View File

@@ -36,7 +36,8 @@ class Experiment
public:
Experiment ();
Experiment (std::string name);
Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel);
Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel);
private:
void ReceivePacket (Ptr<Socket> socket);
void SetPosition (Ptr<Node> node, Vector position);
@@ -109,7 +110,8 @@ Experiment::SetupPacketReceive (Ptr<Node> node)
}
Gnuplot2dDataset
Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel)
Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
{
m_bytesTotal = 0;
@@ -121,7 +123,9 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const
YansWifiPhyHelper phy = wifiPhy;
phy.SetChannel (wifiChannel.Create ());
NetDeviceContainer devices = wifi.Install (phy, c);
NqosWifiMacHelper mac = wifiMac;
NetDeviceContainer devices = wifi.Install (phy, mac, c);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
@@ -170,66 +174,67 @@ int main (int argc, char *argv[])
Experiment experiment;
WifiHelper wifi = WifiHelper::Default ();
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
Gnuplot2dDataset dataset;
wifi.SetMac ("ns3::AdhocWifiMac");
wifiMac.SetType ("ns3::AdhocWifiMac");
NS_LOG_DEBUG ("54");
experiment = Experiment ("54mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-54mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("48");
experiment = Experiment ("48mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-48mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("36");
experiment = Experiment ("36mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-36mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("24");
experiment = Experiment ("24mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-24mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("18");
experiment = Experiment ("18mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-18mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("12");
experiment = Experiment ("12mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-12mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("9");
experiment = Experiment ("9mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-9mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("6");
experiment = Experiment ("6mb");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue ("wifia-6mbs"));
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
gnuplot.GenerateOutput (std::cout);
@@ -242,37 +247,37 @@ int main (int argc, char *argv[])
NS_LOG_DEBUG ("arf");
experiment = Experiment ("arf");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("aarf");
experiment = Experiment ("aarf");
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("aarf-cd");
experiment = Experiment ("aarf-cd");
wifi.SetRemoteStationManager ("ns3::AarfcdWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("cara");
experiment = Experiment ("cara");
wifi.SetRemoteStationManager ("ns3::CaraWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("rraa");
experiment = Experiment ("rraa");
wifi.SetRemoteStationManager ("ns3::RraaWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
NS_LOG_DEBUG ("ideal");
experiment = Experiment ("ideal");
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
dataset = experiment.Run (wifi, wifiPhy, wifiChannel);
dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
gnuplot.AddDataset (dataset);
gnuplot.GenerateOutput (std::cout);

View File

@@ -131,21 +131,22 @@ int main (int argc, char *argv[])
packetSocket.Install (stas);
packetSocket.Install (ap);
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ssid ssid = Ssid ("wifi-default");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
// setup stas.
wifi.SetMac ("ns3::NqstaWifiMac",
wifiMac.SetType ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
staDevs = wifi.Install (wifiPhy, stas);
staDevs = wifi.Install (wifiPhy, wifiMac, stas);
// setup ap.
wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
wifi.Install (wifiPhy, ap);
wifi.Install (wifiPhy, wifiMac, ap);
// mobility.
mobility.Install (stas);

View File

@@ -104,6 +104,7 @@ int main (int argc, char *argv[])
MobilityHelper mobility;
BridgeHelper bridge;
WifiHelper wifi = WifiHelper::Default ();
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
@@ -121,11 +122,11 @@ int main (int argc, char *argv[])
// setup the AP.
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (backboneNodes.Get (i));
wifi.SetMac ("ns3::NqapWifiMac",
wifiMac.SetType ("ns3::NqapWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
apDev = wifi.Install (wifiPhy, backboneNodes.Get (i));
apDev = wifi.Install (wifiPhy, wifiMac, backboneNodes.Get (i));
NetDeviceContainer bridgeDev;
bridgeDev = bridge.Install (backboneNodes.Get (i), NetDeviceContainer (apDev, backboneDevices.Get (i)));
@@ -141,10 +142,10 @@ int main (int argc, char *argv[])
"Speed", StringValue ("Constant:1.0"),
"Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0, (nStas+1)*5.0)));
mobility.Install (sta);
wifi.SetMac ("ns3::NqstaWifiMac",
wifiMac.SetType ("ns3::NqstaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
staDev = wifi.Install (wifiPhy, sta);
staDev = wifi.Install (wifiPhy, wifiMac, sta);
staInterface = ip.Assign (staDev);
// save everything in containers.

View File

@@ -145,11 +145,17 @@ def build(bld):
env = bld.env_of_name('default')
if env['ENABLE_EMU']:
obj = bld.create_ns3_program('emu-udp-echo',
['emu', 'internet-stack'])
obj = bld.create_ns3_program('emu-udp-echo', ['emu', 'internet-stack'])
obj.source = 'emu-udp-echo.cc'
obj = bld.create_ns3_program('emu-ping', ['emu', 'internet-stack'])
obj.source = 'emu-ping.cc'
if env['ENABLE_TAP']:
obj = bld.create_ns3_program('tap-wifi-dumbbell',
['wifi', 'csma', 'point-to-point', 'tap-bridge', 'internet-stack'])
obj.source = 'tap-wifi-dumbbell.cc'
obj = bld.create_ns3_program('simple-wifi-frame-aggregation',
['core', 'simulator', 'mobility', 'wifi'])
obj.source = 'simple-wifi-frame-aggregation.cc'