code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 Timo Bingmann
*
* 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: Timo Bingmann <timo.bingmann@student.kit.edu>
*/
#include "ns3/propagation-loss-model.h"
#include "ns3/jakes-propagation-loss-model.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/gnuplot.h"
#include "ns3/simulator.h"
#include <map>
using namespace ns3;
/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2
/// and dround(0.257, 0.1) = 0.3
static double dround (double number, double precision)
{
number /= precision;
if (number >= 0)
{
number = floor (number + 0.5);
}
else
{
number = ceil (number - 0.5);
}
number *= precision;
return number;
}
static Gnuplot
TestDeterministic (Ptr<PropagationLossModel> model)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Gnuplot plot;
plot.AppendExtra ("set xlabel 'Distance'");
plot.AppendExtra ("set ylabel 'rxPower (dBm)'");
plot.AppendExtra ("set key top right");
double txPowerDbm = +20; // dBm
Gnuplot2dDataset dataset;
dataset.SetStyle (Gnuplot2dDataset::LINES);
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
for (double distance = 0.0; distance < 2500.0; distance += 10.0)
{
b->SetPosition (Vector (distance, 0.0, 0.0));
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
dataset.Add (distance, rxPowerDbm);
Simulator::Stop (Seconds (1.0));
Simulator::Run ();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle (os.str ());
plot.AddDataset (dataset);
plot.AddDataset ( Gnuplot2dFunction ("-94 dBm CSThreshold", "-94.0") );
return plot;
}
static Gnuplot
TestProbabilistic (Ptr<PropagationLossModel> model, unsigned int samples = 100000)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Gnuplot plot;
plot.AppendExtra ("set xlabel 'Distance'");
plot.AppendExtra ("set ylabel 'rxPower (dBm)'");
plot.AppendExtra ("set zlabel 'Probability' offset 0,+10");
plot.AppendExtra ("set view 50, 120, 1.0, 1.0");
plot.AppendExtra ("set key top right");
plot.AppendExtra ("set ticslevel 0");
plot.AppendExtra ("set xtics offset -0.5,0");
plot.AppendExtra ("set ytics offset 0,-0.5");
plot.AppendExtra ("set xrange [100:]");
double txPowerDbm = +20; // dBm
Gnuplot3dDataset dataset;
dataset.SetStyle ("with linespoints");
dataset.SetExtra ("pointtype 3 pointsize 0.5");
typedef std::map<double, unsigned int> rxPowerMapType;
// Take given number of samples from CalcRxPower() and show probability
// density for discrete distances.
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
for (double distance = 100.0; distance < 2500.0; distance += 100.0)
{
b->SetPosition (Vector (distance, 0.0, 0.0));
rxPowerMapType rxPowerMap;
for (unsigned int samp = 0; samp < samples; ++samp)
{
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
rxPowerDbm = dround (rxPowerDbm, 1.0);
rxPowerMap[ rxPowerDbm ]++;
Simulator::Stop (Seconds (0.01));
Simulator::Run ();
}
for (rxPowerMapType::const_iterator i = rxPowerMap.begin ();
i != rxPowerMap.end (); ++i)
{
dataset.Add (distance, i->first, (double)i->second / (double)samples);
}
dataset.AddEmptyLine ();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle (os.str ());
plot.AddDataset (dataset);
return plot;
}
static Gnuplot
TestDeterministicByTime (Ptr<PropagationLossModel> model,
Time timeStep = Seconds (0.001),
Time timeTotal = Seconds (1.0),
double distance = 100.0)
{
Ptr<ConstantPositionMobilityModel> a = CreateObject<ConstantPositionMobilityModel> ();
Ptr<ConstantPositionMobilityModel> b = CreateObject<ConstantPositionMobilityModel> ();
Gnuplot plot;
plot.AppendExtra ("set xlabel 'Time (s)'");
plot.AppendExtra ("set ylabel 'rxPower (dBm)'");
plot.AppendExtra ("set key center right");
double txPowerDbm = +20; // dBm
Gnuplot2dDataset dataset;
dataset.SetStyle (Gnuplot2dDataset::LINES);
{
a->SetPosition (Vector (0.0, 0.0, 0.0));
b->SetPosition (Vector (distance, 0.0, 0.0));
Time start = Simulator::Now ();
while( Simulator::Now () < start + timeTotal )
{
// CalcRxPower() returns dBm.
double rxPowerDbm = model->CalcRxPower (txPowerDbm, a, b);
Time elapsed = Simulator::Now () - start;
dataset.Add (elapsed.GetSeconds (), rxPowerDbm);
Simulator::Stop (timeStep);
Simulator::Run ();
}
}
std::ostringstream os;
os << "txPower " << txPowerDbm << "dBm";
dataset.SetTitle (os.str ());
plot.AddDataset (dataset);
plot.AddDataset ( Gnuplot2dFunction ("-94 dBm CSThreshold", "-94.0") );
return plot;
}
int main (int argc, char *argv[])
{
GnuplotCollection gnuplots ("main-propagation-loss.pdf");
{
Ptr<FriisPropagationLossModel> friis = CreateObject<FriisPropagationLossModel> ();
Gnuplot plot = TestDeterministic (friis);
plot.SetTitle ("ns3::FriisPropagationLossModel (Default Parameters)");
gnuplots.AddPlot (plot);
}
{
Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
log->SetAttribute ("Exponent", DoubleValue (2.5));
Gnuplot plot = TestDeterministic (log);
plot.SetTitle ("ns3::LogDistancePropagationLossModel (Exponent = 2.5)");
gnuplots.AddPlot (plot);
}
{
Ptr<RandomPropagationLossModel> random = CreateObject<RandomPropagationLossModel> ();
random->SetAttribute ("Variable", RandomVariableValue (ExponentialVariable (50.0)));
Gnuplot plot = TestDeterministic (random);
plot.SetTitle ("ns3::RandomPropagationLossModel with Exponential Distribution");
gnuplots.AddPlot (plot);
}
{
Ptr<JakesPropagationLossModel> jakes = CreateObject<JakesPropagationLossModel> ();
// doppler frequency shift for 5.15 GHz at 100 km/h
jakes->SetAttribute ("DopplerFreq", DoubleValue (477.9));
Gnuplot plot = TestDeterministicByTime (jakes, Seconds (0.001), Seconds (1.0));
plot.SetTitle ("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 1 millisec resolution)");
gnuplots.AddPlot (plot);
}
{
Ptr<JakesPropagationLossModel> jakes = CreateObject<JakesPropagationLossModel> ();
// doppler frequency shift for 5.15 GHz at 100 km/h
jakes->SetAttribute ("DopplerFreq", DoubleValue (477.9));
Gnuplot plot = TestDeterministicByTime (jakes, Seconds (0.0001), Seconds (0.1));
plot.SetTitle ("ns3::JakesPropagationLossModel (with 477.9 Hz shift and 0.1 millisec resolution)");
gnuplots.AddPlot (plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
Gnuplot plot = TestDeterministic (log3);
plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel (Defaults)");
gnuplots.AddPlot (plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
// more prominent example values:
log3->SetAttribute ("Exponent0", DoubleValue (1.0));
log3->SetAttribute ("Exponent1", DoubleValue (3.0));
log3->SetAttribute ("Exponent2", DoubleValue (10.0));
Gnuplot plot = TestDeterministic (log3);
plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel (Exponents 1.0, 3.0 and 10.0)");
gnuplots.AddPlot (plot);
}
{
Ptr<NakagamiPropagationLossModel> nak = CreateObject<NakagamiPropagationLossModel> ();
Gnuplot plot = TestProbabilistic (nak);
plot.SetTitle ("ns3::NakagamiPropagationLossModel (Default Parameters)");
gnuplots.AddPlot (plot);
}
{
Ptr<ThreeLogDistancePropagationLossModel> log3 = CreateObject<ThreeLogDistancePropagationLossModel> ();
Ptr<NakagamiPropagationLossModel> nak = CreateObject<NakagamiPropagationLossModel> ();
log3->SetNext (nak);
Gnuplot plot = TestProbabilistic (log3);
plot.SetTitle ("ns3::ThreeLogDistancePropagationLossModel and ns3::NakagamiPropagationLossModel (Default Parameters)");
gnuplots.AddPlot (plot);
}
gnuplots.GenerateOutput (std::cout);
// produce clean valgrind
Simulator::Destroy ();
return 0;
}
| zy901002-gpsr | src/propagation/examples/main-propagation-loss.cc | C++ | gpl2 | 9,541 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
if not bld.env['ENABLE_EXAMPLES']:
return;
obj = bld.create_ns3_program('main-propagation-loss',
['core', 'mobility', 'config-store', 'tools', 'propagation'])
obj.source = 'main-propagation-loss.cc'
| zy901002-gpsr | src/propagation/examples/wscript | Python | gpl2 | 356 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
module = bld.create_ns3_module('propagation', ['network', 'mobility'])
module.includes = '.'
module.source = [
'model/propagation-delay-model.cc',
'model/propagation-loss-model.cc',
'model/jakes-propagation-loss-model.cc',
'model/cost231-propagation-loss-model.cc',
]
module_test = bld.create_ns3_module_test_library('propagation')
module_test.source = [
'test/propagation-loss-model-test-suite.cc',
]
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'propagation'
headers.source = [
'model/propagation-delay-model.h',
'model/propagation-loss-model.h',
'model/jakes-propagation-loss-model.h',
'model/cost231-propagation-loss-model.h',
]
if (bld.env['ENABLE_EXAMPLES']):
bld.add_subdirs('examples')
bld.ns3_python_bindings()
| zy901002-gpsr | src/propagation/wscript | Python | gpl2 | 992 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/test.h"
#include "ns3/simple-net-device.h"
#include "ns3/simple-channel.h"
#include "ns3/address.h"
#include "ns3/mac48-address.h"
#include "ns3/packet.h"
#include "ns3/callback.h"
#include "ns3/node.h"
#include "ns3/simulator.h"
#include "ns3/error-model.h"
#include "ns3/pointer.h"
#include "ns3/double.h"
#include "ns3/string.h"
using namespace ns3;
static void SendPacket (int num, Ptr<NetDevice> device, Address& addr)
{
for (int i = 0; i < num; i++)
{
Ptr<Packet> pkt = Create<Packet> (1000); // 1000 dummy bytes of data
device->Send (pkt, addr, 0);
}
}
// Two nodes, two devices, one channel
static void BuildSimpleTopology (Ptr<Node> a, Ptr<Node> b, Ptr<SimpleNetDevice> input, Ptr<SimpleNetDevice> output, Ptr<SimpleChannel> channel)
{
a->AddDevice (input);
b->AddDevice (output);
input->SetAddress (Mac48Address::Allocate ());
input->SetChannel (channel);
input->SetNode (a);
output->SetChannel (channel);
output->SetNode (b);
output->SetAddress (Mac48Address::Allocate ());
}
class ErrorModelSimple : public TestCase
{
public:
ErrorModelSimple ();
virtual ~ErrorModelSimple ();
private:
virtual void DoRun (void);
bool Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
ErrorModelSimple::ErrorModelSimple ()
: TestCase ("ErrorModel and PhyRxDrop trace for SimpleNetDevice"), m_count (0), m_drops (0)
{
}
ErrorModelSimple::~ErrorModelSimple ()
{
}
bool
ErrorModelSimple::Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr)
{
m_count++;
return true;
}
void
ErrorModelSimple::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
void
ErrorModelSimple::DoRun (void)
{
// Set some arbitrary deterministic values
SeedManager::SetSeed (7);
SeedManager::SetRun (5);
Ptr<Node> a = CreateObject<Node> ();
Ptr<Node> b = CreateObject<Node> ();
Ptr<SimpleNetDevice> input = CreateObject<SimpleNetDevice> ();
Ptr<SimpleNetDevice> output = CreateObject<SimpleNetDevice> ();
Ptr<SimpleChannel> channel = CreateObject<SimpleChannel> ();
BuildSimpleTopology (a, b, input, output, channel);
output->SetReceiveCallback (MakeCallback (&ErrorModelSimple::Receive, this));
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)));
em->SetAttribute ("ErrorRate", DoubleValue (0.001));
em->SetAttribute ("ErrorUnit", StringValue ("EU_PKT"));
// The below hooks will cause drops and receptions to be counted
output->SetAttribute ("ReceiveErrorModel", PointerValue (em));
output->TraceConnectWithoutContext ("PhyRxDrop", MakeCallback (&ErrorModelSimple::DropEvent, this));
// Send 10000 packets
Simulator::Schedule (Seconds (0), &SendPacket, 10000, input, output->GetAddress ());
Simulator::Run ();
Simulator::Destroy ();
// For this combination of values, we expect about 1 packet in 1000 to be
// dropped. For this specific RNG stream, we see 9992 receptions and 8 drops
NS_TEST_ASSERT_MSG_EQ (m_count, 9992, "Wrong number of receptions.");
NS_TEST_ASSERT_MSG_EQ (m_drops, 8, "Wrong number of drops.");
}
// This is the start of an error model test suite. For starters, this is
// just testing that the SimpleNetDevice is working but this can be
// extended to many more test cases in the future
class ErrorModelTestSuite : public TestSuite
{
public:
ErrorModelTestSuite ();
};
ErrorModelTestSuite::ErrorModelTestSuite ()
: TestSuite ("error-model", UNIT)
{
AddTestCase (new ErrorModelSimple);
}
// Do not forget to allocate an instance of this TestSuite
static ErrorModelTestSuite errorModelTestSuite;
| zy901002-gpsr | src/test/error-model-test-suite.cc | C++ | gpl2 | 3,904 |
/*
* Copyright (c) 2009 University of Washington
*
* 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
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "ns3/log.h"
#include "ns3/callback.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/double.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/propagation-loss-model.h"
#include "ns3/propagation-delay-model.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/yans-wifi-phy.h"
#include "ns3/wifi-net-device.h"
#include "ns3/mobility-helper.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/nqos-wifi-mac-helper.h"
#include "ns3/simulator.h"
NS_LOG_COMPONENT_DEFINE ("WifiInterferenceTestSuite");
using namespace ns3;
class WifiInterferenceTestCase : public TestCase
{
public:
WifiInterferenceTestCase ();
virtual ~WifiInterferenceTestCase ();
private:
virtual void DoRun (void);
void ReceivePacket (Ptr<Socket> socket);
static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval);
void PrintEndSync (std::string context, uint32_t dataRate, double snr, double per);
double WifiSimpleInterference (std::string phyMode, double Prss, double Irss, double delta, uint32_t PpacketSize,
uint32_t IpacketSize, bool verbose, InternetStackHelper internet);
double m_PER;
double m_SNR;
uint32_t m_DataRate;
};
// Add some help text to this case to describe what it is intended to test
WifiInterferenceTestCase::WifiInterferenceTestCase ()
: TestCase ("Test interference calculation when interfering frame exactly overlaps intended frame")
{
}
WifiInterferenceTestCase::~WifiInterferenceTestCase ()
{
}
void
WifiInterferenceTestCase::ReceivePacket (Ptr<Socket> socket)
{
Address addr;
socket->GetSockName (addr);
InetSocketAddress iaddr = InetSocketAddress::ConvertFrom (addr);
NS_LOG_UNCOND ("Received one packet! Socket: " << iaddr.GetIpv4 () << " port: " << iaddr.GetPort ());
//cast iaddr to void, to suppress 'iaddr' set but not used compiler warning
//in optimized builds
(void) iaddr;
}
void
WifiInterferenceTestCase::GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &WifiInterferenceTestCase::GenerateTraffic, socket, pktSize, pktCount-1, pktInterval);
}
else
{
socket->Close ();
}
}
void
WifiInterferenceTestCase::PrintEndSync (std::string context, uint32_t dataRate, double snr, double per)
{
NS_LOG_UNCOND ("EndSync: Received frame with dataRate=" << dataRate << ", SNR=" << snr << ", PER =" << per);
m_PER = per;
m_SNR = snr;
m_DataRate = dataRate;
}
double
WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prss, double Irss, double delta, uint32_t PpacketSize, uint32_t IpacketSize, bool verbose, InternetStackHelper internet)
{
uint32_t numPackets = 1;
double interval = 1.0; // seconds
double startTime = 10.0; // seconds
double distanceToRx = 100.0; // meters
double offset = 91; // This is a magic number used to set the
// transmit power, based on other configuration
m_PER = 0;
m_SNR = 0;
m_DataRate = 0;
// Convert to time object
Time interPacketInterval = Seconds (interval);
// disable fragmentation for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
// turn off RTS/CTS for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (phyMode));
NodeContainer c;
c.Create (3);
// The below set of helpers will help us to put together the wifi NICs we want
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This is one parameter that matters when using FixedRssLossModel
// set it to zero; otherwise, gain will be added
wifiPhy.Set ("RxGain", DoubleValue (0) );
wifiPhy.Set ("CcaMode1Threshold", DoubleValue (0.0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss ("ns3::LogDistancePropagationLossModel");
wifiPhy.SetChannel (wifiChannel.Create ());
// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0));
// This will disable these sending devices from detecting a signal
// so that they do not backoff
wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) );
wifiPhy.Set ("TxGain", DoubleValue (offset + Prss) );
devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (1)));
wifiPhy.Set ("TxGain", DoubleValue (offset + Irss) );
devices.Add (wifi.Install (wifiPhy, wifiMac, c.Get (2)));
// Note that with FixedRssLossModel, the positions below are not
// used for received signal strength.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (distanceToRx, 0.0, 0.0));
positionAlloc->Add (Vector (-1*distanceToRx, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (c);
// InternetStackHelper internet;
internet.Install (c);
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (devices);
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> recvSink = Socket::CreateSocket (c.Get (0), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address ("10.1.1.1"), 80);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&WifiInterferenceTestCase::ReceivePacket, this));
Ptr<Socket> source = Socket::CreateSocket (c.Get (1), tid);
InetSocketAddress remote = InetSocketAddress (Ipv4Address ("255.255.255.255"), 80);
source->Connect (remote);
// Interferer will send to a different port; we will not see a
// "Received packet" message
Ptr<Socket> interferer = Socket::CreateSocket (c.Get (2), tid);
InetSocketAddress interferingAddr = InetSocketAddress (Ipv4Address ("255.255.255.255"), 49000);
interferer->Connect (interferingAddr);
Config::Connect ("/NodeList/0/DeviceList/0/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/EndSync", MakeCallback (&WifiInterferenceTestCase::PrintEndSync, this));
// Tracing
// wifiPhy.EnablePcap ("wifi-simple-interference", devices.Get (0));
Simulator::ScheduleWithContext (source->GetNode ()->GetId (),
Seconds (startTime), &GenerateTraffic,
source, PpacketSize, numPackets, interPacketInterval);
Simulator::ScheduleWithContext (interferer->GetNode ()->GetId (),
Seconds (startTime + delta/1000000.0), &GenerateTraffic,
interferer, IpacketSize, numPackets, interPacketInterval);
Simulator::Run ();
Simulator::Destroy ();
return m_PER;
}
void
WifiInterferenceTestCase::DoRun (void)
{
std::string phyMode ("DsssRate1Mbps");
double Prss = -90; // -dBm
double Irss = -90; // -dBm
double delta = 0; // microseconds
uint32_t PpacketSize = 1000; // bytes
uint32_t IpacketSize = 1000; // bytes
bool verbose = false;
double PER, PER1, PER2;
InternetStackHelper internet;
// Compute the packet error rate (PER) when delta=0 microseconds. This
// means that the interferer arrives at exactly the same time as the
// intended packet
PER = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet);
// Now rerun this test case and compute the PER when the delta time between
// arrival of the intended frame and interferer is 1 microsecond.
delta = 1;
PER1 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet);
// Now rerun this test case and compute the PER when the delta time between
// arrival of the intended frame and interferer is 2 microseconds.
delta = 2;
PER2 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet);
double PERDiff1 = PER - PER1;
double PERDiff2 = PER1 - PER2;
NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2,
"The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival");
}
class WifiInterferenceTestSuite : public TestSuite
{
public:
WifiInterferenceTestSuite ();
};
WifiInterferenceTestSuite::WifiInterferenceTestSuite ()
: TestSuite ("ns3-wifi-interference", UNIT)
{
AddTestCase (new WifiInterferenceTestCase);
}
static WifiInterferenceTestSuite wifiInterferenceTestSuite;
| zy901002-gpsr | src/test/ns3wifi/wifi-interference-test-suite.cc | C++ | gpl2 | 10,488 |
/**
* \ingroup tests
* \defgroup Ns3WifiTests ns-3 Wifi Implementation Tests
*
* \section Ns3WifiTestsOverview ns-3 Wifi Implementation Tests Overview
*
* ns-3 has a Wifi implementation and we test it a little.
*/
| zy901002-gpsr | src/test/ns3wifi/ns3wifi.h | C | gpl2 | 221 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Dean Armstrong
*
* 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: Dean Armstrong <deanarm@gmail.com>
*/
#include "ns3/test.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/boolean.h"
#include "ns3/string.h"
#include "ns3/double.h"
#include "ns3/ssid.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/packet-sink.h"
#include "ns3/wifi-helper.h"
#include "ns3/qos-wifi-mac-helper.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/mobility-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/on-off-helper.h"
NS_LOG_COMPONENT_DEFINE ("WifiMsduAggregatorThroughputTest");
using namespace ns3;
class WifiMsduAggregatorThroughputTest : public TestCase
{
public:
WifiMsduAggregatorThroughputTest ();
virtual void DoRun (void);
private:
bool m_writeResults;
};
WifiMsduAggregatorThroughputTest::WifiMsduAggregatorThroughputTest ()
: TestCase ("MsduAggregator throughput test"),
m_writeResults (false)
{
}
void
WifiMsduAggregatorThroughputTest::DoRun (void)
{
WifiHelper wifi = WifiHelper::Default ();
QosWifiMacHelper wifiMac = QosWifiMacHelper::Default ();
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
Ssid ssid = Ssid ("wifi-amsdu-throughput");
// It may seem a little farcical running an 802.11n aggregation
// scenario with 802.11b rates (transmit rate fixed to 1 Mbps, no
// less), but this approach tests the bit we need to without unduly
// increasing the complexity of the simulation.
std::string phyMode ("DsssRate1Mbps");
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", StringValue (phyMode),
"ControlMode", StringValue (phyMode));
// Setup the AP, which will be the source of traffic for this test
// and thus has an aggregator on AC_BE.
NodeContainer ap;
ap.Create (1);
wifiMac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (MicroSeconds (102400)));
wifiMac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator",
"MaxAmsduSize", UintegerValue (4000));
NetDeviceContainer apDev = wifi.Install (wifiPhy, wifiMac, ap);
// Setup one STA, which will be the sink for traffic in this test.
NodeContainer sta;
sta.Create (1);
wifiMac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDev = wifi.Install (wifiPhy, wifiMac, sta);
// Our devices will have fixed positions
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (2),
"LayoutType", StringValue ("RowFirst"));
mobility.Install (sta);
mobility.Install (ap);
// Now we install internet stacks on our devices
InternetStackHelper stack;
stack.Install (ap);
stack.Install (sta);
Ipv4AddressHelper address;
address.SetBase ("192.168.0.0", "255.255.255.0");
Ipv4InterfaceContainer staNodeInterface, apNodeInterface;
staNodeInterface = address.Assign (staDev);
apNodeInterface = address.Assign (apDev);
// The applications for this test will see a unidirectional UDP
// stream from the AP to the STA. The following UDP port will be
// used (arbitrary choice).
uint16_t udpPort = 50000;
// The packet sink application is on the STA device, and is running
// right from the start. The traffic source will turn on at 1 second
// and then off at 9 seconds, so we turn the sink off at 9 seconds
// too in order to measure throughput in a fixed window.
PacketSinkHelper packetSink ("ns3::UdpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (),
udpPort));
ApplicationContainer sinkApp = packetSink.Install (sta.Get (0));
sinkApp.Start (Seconds (0));
sinkApp.Stop (Seconds (9.0));
// The packet source is an on-off application on the AP
// device. Given that we have fixed the transmit rate at 1 Mbps
// above, a 1 Mbps stream at the transport layer should be sufficent
// to determine whether aggregation is working or not.
//
// We configure this traffic stream to operate between 1 and 9 seconds.
OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (staNodeInterface.GetAddress (0),
udpPort));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("1Mbps")));
onoff.SetAttribute ("PacketSize", UintegerValue (100));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer sourceApp = onoff.Install (ap.Get (0));
sourceApp.Start (Seconds (1.0));
sourceApp.Stop (Seconds (9.0));
// Enable tracing at the AP
if (m_writeResults)
{
wifiPhy.EnablePcap ("wifi-amsdu-throughput", sta.Get (0)->GetId (), 0);
}
Simulator::Stop (Seconds (10.0));
Simulator::Run ();
Simulator::Destroy ();
// Now the simulation is complete we note the total number of octets
// receive at the packet sink so that we can shortly test that this
// is plausible.
uint32_t totalOctetsThrough =
DynamicCast<PacketSink>(sinkApp.Get (0))->GetTotalRx ();
// Check that throughput was acceptable. This threshold is set based
// on inspection of a trace where things are working. Basically, we
// there get 26 UDP packets (of size 100, as specified above)
// aggregated per A-MSDU, for which the complete frame exchange
// (including RTS/CTS and plus medium access) takes around 32
// ms. Over the eight seconds of the test this means we expect about
// 650 kilobytes, so a pass threshold of 600000 seems to provide a
// fair amount of margin to account for reduced utilisation around
// stream startup, and contention around AP beacon transmission.
//
// If aggregation is turned off, then we get about 350 kilobytes in
// the same test, so we'll definitely catch the major failures.
NS_TEST_ASSERT_MSG_GT (totalOctetsThrough, 600000,
"A-MSDU test fails for low throughput of "
<< totalOctetsThrough << " octets");
}
// For now the MSDU Aggregator Test Suite contains only the one test
// that is defined in this file, so it's class definition and
// instantiation can live here.
class WifiMsduAggregatorTestSuite : public TestSuite
{
public:
WifiMsduAggregatorTestSuite ();
};
WifiMsduAggregatorTestSuite::WifiMsduAggregatorTestSuite ()
: TestSuite ("ns3-wifi-msdu-aggregator", SYSTEM)
{
AddTestCase (new WifiMsduAggregatorThroughputTest);
}
static WifiMsduAggregatorTestSuite wifiMsduAggregatorTestSuite;
| zy901002-gpsr | src/test/ns3wifi/wifi-msdu-aggregator-test-suite.cc | C++ | gpl2 | 8,193 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys
def configure(conf):
# Add the ns3wifi module to the list of enabled modules that
# should not be built if this is a static build on Darwin. They
# don't work there for the ns3wifi module, and this is probably
# because the ns3wifi module has no source files.
if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin':
conf.env['MODULES_NOT_BUILT'].append('ns3wifi')
def build(bld):
# Don't do anything for this module if it should not be built.
if 'ns3wifi' in bld.env['MODULES_NOT_BUILT']:
return
ns3wifi = bld.create_ns3_module('ns3wifi', ['internet', 'mobility', 'propagation', 'wifi', 'applications'])
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'ns3wifi'
headers.source = [
'ns3wifi.h',
]
ns3wifi_test = bld.create_ns3_module_test_library('ns3wifi')
ns3wifi_test.source = [
'wifi-interference-test-suite.cc',
'wifi-msdu-aggregator-test-suite.cc',
]
| zy901002-gpsr | src/test/ns3wifi/wscript | Python | gpl2 | 1,093 |
/* -*- 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
*/
// This is not a test of CsmaNetDevice model behavior per-se, but
// instead is a roll up of several end-to-end examples in examples/csma
// directory, converted into system tests. Writing a test suite
// to test Csma itself is for further study.
#include <string>
#include "ns3/address.h"
#include "ns3/application-container.h"
#include "ns3/bridge-helper.h"
#include "ns3/callback.h"
#include "ns3/config.h"
#include "ns3/csma-helper.h"
#include "ns3/csma-star-helper.h"
#include "ns3/inet-socket-address.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/node.h"
#include "ns3/node-container.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-address.h"
#include "ns3/pointer.h"
#include "ns3/random-variable.h"
#include "ns3/simple-channel.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/test.h"
#include "ns3/uinteger.h"
#include "ns3/v4ping-helper.h"
using namespace ns3;
class CsmaBridgeTestCase : public TestCase
{
public:
CsmaBridgeTestCase ();
virtual ~CsmaBridgeTestCase ();
private:
virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
uint32_t m_count;
};
// Add some help text to this case to describe what it is intended to test
CsmaBridgeTestCase::CsmaBridgeTestCase ()
: TestCase ("Bridge example for Carrier Sense Multiple Access (CSMA) networks"), m_count (0)
{
}
CsmaBridgeTestCase::~CsmaBridgeTestCase ()
{
}
void
CsmaBridgeTestCase::SinkRx (Ptr<const Packet> p, const Address &ad)
{
m_count++;
}
// Network topology
//
// n0 n1
// | |
// ----------
// | Switch |
// ----------
// | |
// n2 n3
//
// - CBR/UDP test flow from n0 to n1; test that packets received on n1
//
void
CsmaBridgeTestCase::DoRun (void)
{
NodeContainer terminals;
terminals.Create (4);
NodeContainer csmaSwitch;
csmaSwitch.Create (1);
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer terminalDevices;
NetDeviceContainer switchDevices;
for (int i = 0; i < 4; i++)
{
NetDeviceContainer link = csma.Install (NodeContainer (terminals.Get (i), csmaSwitch));
terminalDevices.Add (link.Get (0));
switchDevices.Add (link.Get (1));
}
// Create the bridge netdevice, which will do the packet switching
Ptr<Node> switchNode = csmaSwitch.Get (0);
BridgeHelper bridge;
bridge.Install (switchNode, switchDevices);
InternetStackHelper internet;
internet.Install (terminals);
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
ipv4.Assign (terminalDevices);
uint16_t port = 9; // Discard port (RFC 863)
// Create the OnOff application to send UDP datagrams from n0 to n1.
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer app = onoff.Install (terminals.Get (0));
app.Start (Seconds (1.0));
app.Stop (Seconds (10.0));
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
app = sink.Install (terminals.Get (1));
app.Start (Seconds (0.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/1/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&CsmaBridgeTestCase::SinkRx, this));
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Bridge should have passed 10 packets");
}
class CsmaBroadcastTestCase : public TestCase
{
public:
CsmaBroadcastTestCase ();
virtual ~CsmaBroadcastTestCase ();
private:
virtual void DoRun (void);
void SinkRxNode1 (Ptr<const Packet> p, const Address &ad);
void SinkRxNode2 (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_countNode1;
uint32_t m_countNode2;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaBroadcastTestCase::CsmaBroadcastTestCase ()
: TestCase ("Broadcast example for Carrier Sense Multiple Access (CSMA) networks"), m_countNode1 (0), m_countNode2 (0), m_drops (0)
{
}
CsmaBroadcastTestCase::~CsmaBroadcastTestCase ()
{
}
void
CsmaBroadcastTestCase::SinkRxNode1 (Ptr<const Packet> p, const Address &ad)
{
m_countNode1++;
}
void
CsmaBroadcastTestCase::SinkRxNode2 (Ptr<const Packet> p, const Address &ad)
{
m_countNode2++;
}
void
CsmaBroadcastTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
//
// Example of the sending of a datagram to a broadcast address
//
// Network topology
// ==============
// | |
// n0 n1 n2
// | |
// ==========
//
// n0 originates UDP broadcast to 255.255.255.255/discard port, which
// is replicated and received on both n1 and n2
//
void
CsmaBroadcastTestCase::DoRun (void)
{
NodeContainer c;
c.Create (3);
NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1));
NodeContainer c1 = NodeContainer (c.Get (0), c.Get (2));
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer n0 = csma.Install (c0);
NetDeviceContainer n1 = csma.Install (c1);
InternetStackHelper internet;
internet.Install (c);
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.0.0", "255.255.255.0");
ipv4.Assign (n0);
ipv4.SetBase ("192.168.1.0", "255.255.255.0");
ipv4.Assign (n1);
// RFC 863 discard port ("9") indicates packet should be thrown away
// by the system. We allow this silent discard to be overridden
// by the PacketSink application.
uint16_t port = 9;
// Create the OnOff application to send UDP datagrams from n0.
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer app = onoff.Install (c0.Get (0));
// Start the application
app.Start (Seconds (1.0));
app.Stop (Seconds (10.0));
// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
app = sink.Install (c0.Get (1));
app.Add (sink.Install (c1.Get (1)));
app.Start (Seconds (1.0));
app.Stop (Seconds (10.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/1/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&CsmaBroadcastTestCase::SinkRxNode1, this));
Config::ConnectWithoutContext ("/NodeList/2/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&CsmaBroadcastTestCase::SinkRxNode2, this));
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_countNode1, 10, "Node 1 should have received 10 packets");
NS_TEST_ASSERT_MSG_EQ (m_countNode2, 10, "Node 2 should have received 10 packets");
}
class CsmaMulticastTestCase : public TestCase
{
public:
CsmaMulticastTestCase ();
virtual ~CsmaMulticastTestCase ();
private:
virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaMulticastTestCase::CsmaMulticastTestCase ()
: TestCase ("Multicast example for Carrier Sense Multiple Access (CSMA) networks"), m_count (0), m_drops (0)
{
}
CsmaMulticastTestCase::~CsmaMulticastTestCase ()
{
}
void
CsmaMulticastTestCase::SinkRx (Ptr<const Packet> p, const Address& ad)
{
m_count++;
}
void
CsmaMulticastTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
// Network topology
//
// Lan1
// ===========
// | | |
// n0 n1 n2 n3 n4
// | | |
// ===========
// Lan0
//
// - Multicast source is at node n0;
// - Multicast forwarded by node n2 onto LAN1;
// - Nodes n0, n1, n2, n3, and n4 receive the multicast frame.
// - Node n4 listens for the data
//
void
CsmaMulticastTestCase::DoRun (void)
{
//
// Set up default values for the simulation.
//
// Select DIX/Ethernet II-style encapsulation (no LLC/Snap header)
Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", StringValue ("Dix"));
NodeContainer c;
c.Create (5);
// We will later want two subcontainers of these nodes, for the two LANs
NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1), c.Get (2));
NodeContainer c1 = NodeContainer (c.Get (2), c.Get (3), c.Get (4));
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
// We will use these NetDevice containers later, for IP addressing
NetDeviceContainer nd0 = csma.Install (c0); // First LAN
NetDeviceContainer nd1 = csma.Install (c1); // Second LAN
InternetStackHelper internet;
internet.Install (c);
Ipv4AddressHelper ipv4Addr;
ipv4Addr.SetBase ("10.1.1.0", "255.255.255.0");
ipv4Addr.Assign (nd0);
ipv4Addr.SetBase ("10.1.2.0", "255.255.255.0");
ipv4Addr.Assign (nd1);
//
// Now we can configure multicasting. As described above, the multicast
// source is at node zero, which we assigned the IP address of 10.1.1.1
// earlier. We need to define a multicast group to send packets to. This
// can be any multicast address from 224.0.0.0 through 239.255.255.255
// (avoiding the reserved routing protocol addresses).
//
Ipv4Address multicastSource ("10.1.1.1");
Ipv4Address multicastGroup ("225.1.2.4");
// Now, we will set up multicast routing. We need to do three things:
// 1) Configure a (static) multicast route on node n2
// 2) Set up a default multicast route on the sender n0
// 3) Have node n4 join the multicast group
// We have a helper that can help us with static multicast
Ipv4StaticRoutingHelper multicast;
// 1) Configure a (static) multicast route on node n2 (multicastRouter)
Ptr<Node> multicastRouter = c.Get (2); // The node in question
Ptr<NetDevice> inputIf = nd0.Get (2); // The input NetDevice
NetDeviceContainer outputDevices; // A container of output NetDevices
outputDevices.Add (nd1.Get (0)); // (we only need one NetDevice here)
multicast.AddMulticastRoute (multicastRouter, multicastSource,
multicastGroup, inputIf, outputDevices);
// 2) Set up a default multicast route on the sender n0
Ptr<Node> sender = c.Get (0);
Ptr<NetDevice> senderIf = nd0.Get (0);
multicast.SetDefaultMulticastRoute (sender, senderIf);
//
// Create an OnOff application to send UDP datagrams from node zero to the
// multicast group (node four will be listening).
//
uint16_t multicastPort = 9; // Discard port (RFC 863)
// Configure a multicast packet generator.
//
// Make packets be sent about every defaultPacketSize / dataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (multicastGroup, multicastPort)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer srcC = onoff.Install (c0.Get (0));
//
// Tell the application when to start and stop.
//
srcC.Start (Seconds (1.));
srcC.Stop (Seconds (10.));
// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), multicastPort));
ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4
// Start the sink
sinkC.Start (Seconds (1.0));
sinkC.Stop (Seconds (10.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/4/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&CsmaMulticastTestCase::SinkRx, this));
//
// Now, do the actual simulation.
//
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 4 should have received 10 packets");
}
class CsmaOneSubnetTestCase : public TestCase
{
public:
CsmaOneSubnetTestCase ();
virtual ~CsmaOneSubnetTestCase ();
private:
virtual void DoRun (void);
void SinkRxNode0 (Ptr<const Packet> p, const Address &ad);
void SinkRxNode1 (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_countNode0;
uint32_t m_countNode1;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaOneSubnetTestCase::CsmaOneSubnetTestCase ()
: TestCase ("One subnet example for Carrier Sense Multiple Access (CSMA) networks"), m_countNode0 (0), m_countNode1 (0), m_drops (0)
{
}
CsmaOneSubnetTestCase::~CsmaOneSubnetTestCase ()
{
}
void
CsmaOneSubnetTestCase::SinkRxNode0 (Ptr<const Packet> p, const Address &ad)
{
m_countNode0++;
}
void
CsmaOneSubnetTestCase::SinkRxNode1 (Ptr<const Packet> p, const Address &ad)
{
m_countNode1++;
}
void
CsmaOneSubnetTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
// Network topology
//
// n0 n1 n2 n3
// | | | |
// =================
// LAN
//
// - CBR/UDP flows from n0 to n1 and from n3 to n0
// - DropTail queues
//
void
CsmaOneSubnetTestCase::DoRun (void)
{
NodeContainer nodes;
nodes.Create (4);
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
//
// Now fill out the topology by creating the net devices required to connect
// the nodes to the channels and hooking them up.
//
NetDeviceContainer devices = csma.Install (nodes);
InternetStackHelper internet;
internet.Install (nodes);
// We've got the "hardware" in place. Now we need to add IP addresses.
//
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = ipv4.Assign (devices);
uint16_t port = 9; // Discard port (RFC 863)
//
// Create an OnOff application to send UDP datagrams from node zero
// to node 1.
//
// Make packets be sent about every defaultPacketSize / dataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (interfaces.GetAddress (1), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer app = onoff.Install (nodes.Get (0));
// Start the application
app.Start (Seconds (1.0));
app.Stop (Seconds (10.0));
// Create an optional packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
app = sink.Install (nodes.Get (1));
app.Start (Seconds (0.0));
//
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
//
onoff.SetAttribute ("Remote",
AddressValue (InetSocketAddress (interfaces.GetAddress (0), port)));
app = onoff.Install (nodes.Get (3));
app.Start (Seconds (1.1));
app.Stop (Seconds (10.0));
app = sink.Install (nodes.Get (0));
app.Start (Seconds (0.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/0/ApplicationList/1/$ns3::PacketSink/Rx", MakeCallback (&CsmaOneSubnetTestCase::SinkRxNode0, this));
Config::ConnectWithoutContext ("/NodeList/1/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&CsmaOneSubnetTestCase::SinkRxNode1, this));
//
// Now, do the actual simulation.
//
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_countNode0, 10, "Node 0 should have received 10 packets");
NS_TEST_ASSERT_MSG_EQ (m_countNode1, 10, "Node 1 should have received 10 packets");
}
class CsmaPacketSocketTestCase : public TestCase
{
public:
CsmaPacketSocketTestCase ();
virtual ~CsmaPacketSocketTestCase ();
private:
virtual void DoRun (void);
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaPacketSocketTestCase::CsmaPacketSocketTestCase ()
: TestCase ("Packet socket example for Carrier Sense Multiple Access (CSMA) networks"), m_count (0), m_drops (0)
{
}
CsmaPacketSocketTestCase::~CsmaPacketSocketTestCase ()
{
}
void
CsmaPacketSocketTestCase::SinkRx (std::string path, Ptr<const Packet> p, const Address& address)
{
m_count++;
}
void
CsmaPacketSocketTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
//
// Network topology
//
// n0 n1 n2 n3
// | | | |
// =====================
//
// - Packet socket flow from n0 to n1 and from node n3 to n0
// -- We will test reception at node n0
// - Default 512 byte packets generated by traffic generator
//
void
CsmaPacketSocketTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
NodeContainer nodes;
nodes.Create (4);
PacketSocketHelper packetSocket;
packetSocket.Install (nodes);
// create the shared medium used by all csma devices.
Ptr<CsmaChannel> channel = CreateObjectWithAttributes<CsmaChannel> (
"DataRate", DataRateValue (DataRate (5000000)),
"Delay", TimeValue (MilliSeconds (2)));
// use a helper function to connect our nodes to the shared channel.
CsmaHelper csma;
csma.SetDeviceAttribute ("EncapsulationMode", StringValue ("Llc"));
NetDeviceContainer devs = csma.Install (nodes, channel);
// Create the OnOff application to send raw datagrams
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
PacketSocketAddress socket;
socket.SetSingleDevice (devs.Get (0)->GetIfIndex ());
socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
socket.SetProtocol (2);
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1.0)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer apps = onoff.Install (nodes.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
socket.SetSingleDevice (devs.Get (3)->GetIfIndex ());
socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
socket.SetProtocol (3);
onoff.SetAttribute ("Remote", AddressValue (socket));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
apps = onoff.Install (nodes.Get (3));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
PacketSinkHelper sink = PacketSinkHelper ("ns3::PacketSocketFactory",
socket);
apps = sink.Install (nodes.Get (0));
apps.Start (Seconds (0.0));
apps.Stop (Seconds (20.0));
// Trace receptions
Config::Connect ("/NodeList/0/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&CsmaPacketSocketTestCase::SinkRx, this));
Simulator::Run ();
Simulator::Destroy ();
// We should have received 10 packets on node 0
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 0 should have received 10 packets");
}
class CsmaPingTestCase : public TestCase
{
public:
CsmaPingTestCase ();
virtual ~CsmaPingTestCase ();
private:
virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void PingRtt (std::string context, Time rtt);
void DropEvent (Ptr<const Packet> p);
uint32_t m_countSinkRx;
uint32_t m_countPingRtt;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaPingTestCase::CsmaPingTestCase ()
: TestCase ("Ping example for Carrier Sense Multiple Access (CSMA) networks"), m_countSinkRx (0), m_countPingRtt (0), m_drops (0)
{
}
CsmaPingTestCase::~CsmaPingTestCase ()
{
}
void
CsmaPingTestCase::SinkRx (Ptr<const Packet> p, const Address &ad)
{
m_countSinkRx++;
}
void
CsmaPingTestCase::PingRtt (std::string context, Time rtt)
{
m_countPingRtt++;
}
void
CsmaPingTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
// Network topology
//
// n0 n1 n2 n3
// | | | |
// =====================
//
// node n0,n1,n3 pings to node n2
// node n0 generates protocol 2 (IGMP) to node n3
//
void
CsmaPingTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
NodeContainer c;
c.Create (4);
// connect all our nodes to a shared channel.
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("EncapsulationMode", StringValue ("Llc"));
NetDeviceContainer devs = csma.Install (c);
// add an ip stack to all nodes.
InternetStackHelper ipStack;
ipStack.Install (c);
// assign ip addresses
Ipv4AddressHelper ip;
ip.SetBase ("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer addresses = ip.Assign (devs);
// Create the OnOff application to send UDP datagrams from n0 to n1.
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1.0)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer apps = onoff.Install (c.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
PacketSinkHelper sink = PacketSinkHelper ("ns3::Ipv4RawSocketFactory", dst);
apps = sink.Install (c.Get (3));
apps.Start (Seconds (0.0));
apps.Stop (Seconds (11.0));
V4PingHelper ping = V4PingHelper (addresses.GetAddress (2));
NodeContainer pingers;
pingers.Add (c.Get (0));
pingers.Add (c.Get (1));
pingers.Add (c.Get (3));
apps = ping.Install (pingers);
apps.Start (Seconds (2.0));
apps.Stop (Seconds (5.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx",
MakeCallback (&CsmaPingTestCase::SinkRx, this));
// Trace pings
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::V4Ping/Rtt",
MakeCallback (&CsmaPingTestCase::PingRtt, this));
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_countSinkRx, 10, "Node 3 should have received 10 packets");
// We should have 3 pingers that ping every second for 3 seconds.
NS_TEST_ASSERT_MSG_EQ (m_countPingRtt, 9, "Node 2 should have been pinged 9 times");
}
class CsmaRawIpSocketTestCase : public TestCase
{
public:
CsmaRawIpSocketTestCase ();
virtual ~CsmaRawIpSocketTestCase ();
private:
virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaRawIpSocketTestCase::CsmaRawIpSocketTestCase ()
: TestCase ("Raw internet protocol socket example for Carrier Sense Multiple Access (CSMA) networks"), m_count (0), m_drops (0)
{
}
CsmaRawIpSocketTestCase::~CsmaRawIpSocketTestCase ()
{
}
void
CsmaRawIpSocketTestCase::SinkRx (Ptr<const Packet> p, const Address &ad)
{
m_count++;
}
void
CsmaRawIpSocketTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
//
// Network topology
// (sender) (receiver)
// n0 n1 n2 n3
// | | | |
// =====================
//
// Node n0 sends data to node n3 over a raw IP socket. The protocol
// number used is 2.
//
void
CsmaRawIpSocketTestCase::DoRun (void)
{
// Here, we will explicitly create four nodes.
NodeContainer c;
c.Create (4);
// connect all our nodes to a shared channel.
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("EncapsulationMode", StringValue ("Llc"));
NetDeviceContainer devs = csma.Install (c);
// add an ip stack to all nodes.
InternetStackHelper ipStack;
ipStack.Install (c);
// assign ip addresses
Ipv4AddressHelper ip;
ip.SetBase ("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer addresses = ip.Assign (devs);
// IP protocol configuration
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
Config::SetDefault ("ns3::Ipv4RawSocketImpl::Protocol", StringValue ("2"));
InetSocketAddress dst = InetSocketAddress (addresses.GetAddress (3));
OnOffHelper onoff = OnOffHelper ("ns3::Ipv4RawSocketFactory", dst);
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1.0)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0.0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer apps = onoff.Install (c.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
PacketSinkHelper sink = PacketSinkHelper ("ns3::Ipv4RawSocketFactory", dst);
apps = sink.Install (c.Get (3));
apps.Start (Seconds (0.0));
apps.Stop (Seconds (12.0));
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/3/ApplicationList/0/$ns3::PacketSink/Rx",
MakeCallback (&CsmaRawIpSocketTestCase::SinkRx, this));
Simulator::Run ();
Simulator::Destroy ();
// We should have sent and received 10 packets
NS_TEST_ASSERT_MSG_EQ (m_count, 10, "Node 3 should have received 10 packets");
}
class CsmaStarTestCase : public TestCase
{
public:
CsmaStarTestCase ();
virtual ~CsmaStarTestCase ();
private:
virtual void DoRun (void);
void SinkRx (Ptr<const Packet> p, const Address &ad);
void DropEvent (Ptr<const Packet> p);
uint32_t m_count;
uint32_t m_drops;
};
// Add some help text to this case to describe what it is intended to test
CsmaStarTestCase::CsmaStarTestCase ()
: TestCase ("Star example for Carrier Sense Multiple Access (CSMA) networks"), m_count (0), m_drops (0)
{
}
CsmaStarTestCase::~CsmaStarTestCase ()
{
}
void
CsmaStarTestCase::SinkRx (Ptr<const Packet> p, const Address& ad)
{
m_count++;
}
void
CsmaStarTestCase::DropEvent (Ptr<const Packet> p)
{
m_drops++;
}
// Network topology (default)
//
// n2 + + n3 .
// | ... |\ /| ... | .
// ======= \ / ======= .
// CSMA \ / CSMA .
// \ / .
// n1 +--- n0 ---+ n4 .
// | ... | / \ | ... | .
// ======= / \ ======= .
// CSMA / \ CSMA .
// / \ .
// n6 + + n5 .
// | ... | | ... | .
// ======= ======= .
// CSMA CSMA .
//
void
CsmaStarTestCase::DoRun (void)
{
//
// Default number of nodes in the star.
//
uint32_t nSpokes = 7;
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
csma.SetChannelAttribute ("Delay", StringValue ("1ms"));
CsmaStarHelper star (nSpokes, csma);
NodeContainer fillNodes;
//
// Just to be nasy, hang some more nodes off of the CSMA channel for each
// spoke, so that there are a total of 16 nodes on each channel. Stash
// all of these new devices into a container.
//
NetDeviceContainer fillDevices;
uint32_t nFill = 14;
for (uint32_t i = 0; i < star.GetSpokeDevices ().GetN (); ++i)
{
Ptr<Channel> channel = star.GetSpokeDevices ().Get (i)->GetChannel ();
Ptr<CsmaChannel> csmaChannel = channel->GetObject<CsmaChannel> ();
NodeContainer newNodes;
newNodes.Create (nFill);
fillNodes.Add (newNodes);
fillDevices.Add (csma.Install (newNodes, csmaChannel));
}
InternetStackHelper internet;
star.InstallStack (internet);
internet.Install (fillNodes);
star.AssignIpv4Addresses (Ipv4AddressHelper ("10.1.0.0", "255.255.255.0"));
//
// We assigned addresses to the logical hub and the first "drop" of the
// CSMA network that acts as the spoke, but we also have a number of fill
// devices (nFill) also hanging off the CSMA network. We have got to
// assign addresses to them as well. We put all of the fill devices into
// a single device container, so the first nFill devices are associated
// with the channel connected to spokeDevices.Get (0), the second nFill
// devices afe associated with the channel connected to spokeDevices.Get (1)
// etc.
//
Ipv4AddressHelper address;
for(uint32_t i = 0; i < star.SpokeCount (); ++i)
{
std::ostringstream subnet;
subnet << "10.1." << i << ".0";
address.SetBase (subnet.str ().c_str (), "255.255.255.0", "0.0.0.3");
for (uint32_t j = 0; j < nFill; ++j)
{
address.Assign (fillDevices.Get (i * nFill + j));
}
}
//
// Create a packet sink on the star "hub" to receive packets.
//
uint16_t port = 50000;
Address hubLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", hubLocalAddress);
ApplicationContainer hubApp = packetSinkHelper.Install (star.GetHub ());
hubApp.Start (Seconds (1.0));
hubApp.Stop (Seconds (10.0));
//
// Create OnOff applications to send TCP to the hub, one on each spoke node.
//
// Make packets be sent about every DefaultPacketSize / DataRate =
// 4096 bits / (5000 bits/second) = 0.82 second.
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onOffHelper.SetAttribute ("DataRate", DataRateValue (DataRate (5000)));
ApplicationContainer spokeApps;
for (uint32_t i = 0; i < star.SpokeCount (); ++i)
{
AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i), port));
onOffHelper.SetAttribute ("Remote", remoteAddress);
spokeApps.Add (onOffHelper.Install (star.GetSpokeNode (i)));
}
spokeApps.Start (Seconds (1.0));
spokeApps.Stop (Seconds (10.0));
//
// Because we are evil, we also add OnOff applications to send TCP to the hub
// from the fill devices on each CSMA link. The first nFill nodes in the
// fillNodes container are on the CSMA network talking to the zeroth device
// on the hub node. The next nFill nodes are on the CSMA network talking to
// the first device on the hub node, etc. So the ith fillNode is associated
// with the hub address found on the (i / nFill)th device on the hub node.
//
ApplicationContainer fillApps;
for (uint32_t i = 0; i < fillNodes.GetN (); ++i)
{
AddressValue remoteAddress (InetSocketAddress (star.GetHubIpv4Address (i / nFill), port));
onOffHelper.SetAttribute ("Remote", remoteAddress);
fillApps.Add (onOffHelper.Install (fillNodes.Get (i)));
}
fillApps.Start (Seconds (1.0));
fillApps.Stop (Seconds (10.0));
//
// Turn on global static routing so we can actually be routed across the star.
//
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Trace receptions
Config::ConnectWithoutContext ("/NodeList/0/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&CsmaStarTestCase::SinkRx, this));
Simulator::Run ();
Simulator::Destroy ();
// The hub node should have received 10 packets from the nFill + 1
// nodes on each spoke.
NS_TEST_ASSERT_MSG_EQ (m_count, 10 * ( nSpokes * (nFill + 1)), "Hub node did not receive the proper number of packets");
}
class CsmaSystemTestSuite : public TestSuite
{
public:
CsmaSystemTestSuite ();
};
CsmaSystemTestSuite::CsmaSystemTestSuite ()
: TestSuite ("csma-system", UNIT)
{
AddTestCase (new CsmaBridgeTestCase);
AddTestCase (new CsmaBroadcastTestCase);
AddTestCase (new CsmaMulticastTestCase);
AddTestCase (new CsmaOneSubnetTestCase);
AddTestCase (new CsmaPacketSocketTestCase);
AddTestCase (new CsmaPingTestCase);
AddTestCase (new CsmaRawIpSocketTestCase);
AddTestCase (new CsmaStarTestCase);
}
// Do not forget to allocate an instance of this TestSuite
static CsmaSystemTestSuite csmaSystemTestSuite;
| zy901002-gpsr | src/test/csma-system-test-suite.cc | C++ | gpl2 | 35,189 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright 2010 University of Washington
*
* 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
*
*/
/*
* This test suite is intended to test mobility use cases in general,
* as typically used by user programs (i.e. with the helper layer
* involved).
*/
#include "ns3/test.h"
#include "ns3/boolean.h"
#include "ns3/simulator.h"
#include "ns3/scheduler.h"
#include "ns3/vector.h"
#include "ns3/mobility-model.h"
#include "ns3/waypoint-mobility-model.h"
#include "ns3/mobility-helper.h"
using namespace ns3;
// Test whether course change notifications occur regardless of calls
// to Update() position (which are triggered by calls to GetPosition())
class WaypointLazyNotifyFalse : public TestCase
{
public:
WaypointLazyNotifyFalse ();
virtual ~WaypointLazyNotifyFalse ();
private:
void TestXPosition (double expectedXPos);
void CourseChangeCallback (std::string path, Ptr<const MobilityModel> model);
virtual void DoRun (void);
Ptr<Node> m_node;
Ptr<WaypointMobilityModel> m_mob;
int m_courseChanges;
};
WaypointLazyNotifyFalse::WaypointLazyNotifyFalse ()
: TestCase ("Test behavior when LazyNotify is false"),
m_courseChanges (0)
{
}
WaypointLazyNotifyFalse::~WaypointLazyNotifyFalse ()
{
}
void
WaypointLazyNotifyFalse::TestXPosition (double expectedXPos)
{
Vector pos = m_mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
}
void
WaypointLazyNotifyFalse::CourseChangeCallback (std::string path, Ptr<const MobilityModel> model)
{
// All waypoints (at 10 second intervals) should trigger a course change
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (m_courseChanges * 10.0, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly", __FILE__, __LINE__);
m_courseChanges++;
}
void
WaypointLazyNotifyFalse::DoRun (void)
{
m_node = CreateObject<Node> ();
m_mob = CreateObject<WaypointMobilityModel> ();
// LazyNotify should by default be false
m_node->AggregateObject (m_mob);
Waypoint wpt (Seconds (0.0), Vector (0.0, 0.0, 0.0));
m_mob->AddWaypoint (wpt);
Waypoint wpt2 (Seconds (10.0), Vector (10.0, 10.0, 10.0));
m_mob->AddWaypoint (wpt2);
Waypoint wpt3 (Seconds (20.0), Vector (20.0, 20.0, 20.0));
m_mob->AddWaypoint (wpt3);
Simulator::Schedule (Seconds (5.0), &WaypointLazyNotifyFalse::TestXPosition, this, 5);
Simulator::Run ();
Simulator::Destroy ();
}
class WaypointLazyNotifyTrue : public TestCase
{
public:
WaypointLazyNotifyTrue ();
virtual ~WaypointLazyNotifyTrue ();
private:
void TestXPosition (double expectedXPos);
void CourseChangeCallback (std::string path, Ptr<const MobilityModel> model);
virtual void DoRun (void);
Ptr<Node> m_node;
Ptr<WaypointMobilityModel> m_mob;
};
WaypointLazyNotifyTrue::WaypointLazyNotifyTrue ()
: TestCase ("Test behavior when LazyNotify is true")
{
}
WaypointLazyNotifyTrue::~WaypointLazyNotifyTrue ()
{
}
void
WaypointLazyNotifyTrue::TestXPosition (double expectedXPos)
{
Vector pos = m_mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
}
void
WaypointLazyNotifyTrue::CourseChangeCallback (std::string path, Ptr<const MobilityModel> model)
{
// This should trigger at time 15 only, since that is the first time that
// position is updated due to LazyNotify
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (15, Simulator::Now ().GetSeconds (), 0.001, "Course change not notified correctly", __FILE__, __LINE__);
}
void
WaypointLazyNotifyTrue::DoRun (void)
{
m_node = CreateObject<Node> ();
m_mob = CreateObject<WaypointMobilityModel> ();
m_mob->SetAttributeFailSafe ("LazyNotify", BooleanValue (true));
m_node->AggregateObject (m_mob);
Waypoint wpt (Seconds (0.0), Vector (0.0, 0.0, 0.0));
m_mob->AddWaypoint (wpt);
Waypoint wpt2 (Seconds (10.0), Vector (10.0, 10.0, 10.0));
m_mob->AddWaypoint (wpt2);
Waypoint wpt3 (Seconds (20.0), Vector (20.0, 20.0, 20.0));
m_mob->AddWaypoint (wpt3);
Simulator::Schedule (Seconds (15.0), &WaypointLazyNotifyTrue::TestXPosition, this, 15);
Simulator::Run ();
Simulator::Destroy ();
}
class WaypointInitialPositionIsWaypoint : public TestCase
{
public:
WaypointInitialPositionIsWaypoint ();
virtual ~WaypointInitialPositionIsWaypoint ();
private:
void TestXPosition (Ptr<const WaypointMobilityModel> model, double expectedXPos);
void TestNumWaypoints (Ptr<const WaypointMobilityModel> model, uint32_t num);
virtual void DoRun (void);
Ptr<WaypointMobilityModel> m_mob1;
Ptr<WaypointMobilityModel> m_mob2;
Ptr<WaypointMobilityModel> m_mob3;
Ptr<WaypointMobilityModel> m_mob4;
Ptr<WaypointMobilityModel> m_mob5;
};
WaypointInitialPositionIsWaypoint::WaypointInitialPositionIsWaypoint ()
: TestCase ("Test behavior of Waypoint InitialPositionIsWaypoint")
{
}
WaypointInitialPositionIsWaypoint::~WaypointInitialPositionIsWaypoint ()
{
}
void
WaypointInitialPositionIsWaypoint::TestXPosition (Ptr<const WaypointMobilityModel> model, double expectedXPos)
{
Vector pos = model->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
}
void
WaypointInitialPositionIsWaypoint::TestNumWaypoints (Ptr<const WaypointMobilityModel> model, uint32_t num)
{
NS_TEST_EXPECT_MSG_EQ (model->WaypointsLeft (), num, "Unexpected number of waypoints left");
}
void
WaypointInitialPositionIsWaypoint::DoRun (void)
{
// Case 1: InitialPositionIsWaypoint == false, and we call SetPosition
// without any waypoints added. There should be no waypoints after
// time 0
m_mob1 = CreateObject<WaypointMobilityModel> ();
m_mob1->SetAttributeFailSafe ("InitialPositionIsWaypoint", BooleanValue (false));
m_mob1->SetPosition (Vector (10.0, 10.0, 10.0));
// At time 1s, there should be no waypoints
Simulator::Schedule (Seconds (1.0), &WaypointInitialPositionIsWaypoint::TestNumWaypoints, this, m_mob1, 0);
// At time 15s, the model should still be at x position 10.0
Simulator::Schedule (Seconds (15.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob1, 10.0);
// Case 2: InitialPositionIsWaypoint == false, and we call SetPosition
// after adding a waypoint.
m_mob2 = CreateObject<WaypointMobilityModel> ();
m_mob2->SetAttributeFailSafe ("InitialPositionIsWaypoint", BooleanValue (false));
Waypoint wpt21 (Seconds (5.0), Vector (15.0, 15.0, 15.0));
m_mob2->AddWaypoint (wpt21);
Waypoint wpt22 (Seconds (10.0), Vector (20.0, 20.0, 20.0));
m_mob2->AddWaypoint (wpt22);
m_mob2->SetPosition (Vector (10.0, 10.0, 10.0));
// At time 3, no waypoints have been hit, so position should be 10 and
// numWaypoints should be 2, or 1 excluding the next one
Simulator::Schedule (Seconds (3.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob2, 10.0);
Simulator::Schedule (Seconds (3.0), &WaypointInitialPositionIsWaypoint::TestNumWaypoints, this, m_mob2, 1);
// At time 8, check that X position is 18 (i.e. position is interpolating
// between 15 and 20) and there is one waypoint left, but we exclude
// the next one so we test for zero waypoints
Simulator::Schedule (Seconds (8.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob2, 18.0);
Simulator::Schedule (Seconds (8.0), &WaypointInitialPositionIsWaypoint::TestNumWaypoints, this, m_mob2, 0);
// Case 3: InitialPositionIsWaypoint == true, and we call SetPosition
// without any waypoints added.
m_mob3 = CreateObject<WaypointMobilityModel> ();
m_mob3->SetAttributeFailSafe ("InitialPositionIsWaypoint", BooleanValue (true));
m_mob3->SetPosition (Vector (10.0, 10.0, 10.0));
// At time 1s, there should be zero waypoints not counting the next one
Simulator::Schedule (Seconds (1.0), &WaypointInitialPositionIsWaypoint::TestNumWaypoints, this, m_mob3, 0);
// At time 15s, the model should still be at x position 10.0
Simulator::Schedule (Seconds (15.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob3, 10.0);
// Case 4: InitialPositionIsWaypoint == true, and we call SetPosition
// after adding a waypoint.
m_mob4 = CreateObject<WaypointMobilityModel> ();
m_mob4->SetAttributeFailSafe ("InitialPositionIsWaypoint", BooleanValue (true));
Waypoint wpt41 (Seconds (5.0), Vector (15.0, 15.0, 15.0));
m_mob4->AddWaypoint (wpt41);
Waypoint wpt42 (Seconds (10.0), Vector (20.0, 20.0, 20.0));
m_mob4->AddWaypoint (wpt42);
// Here, SetPosition() is called after waypoints have been added. In
// this case, the initial position is set until the time of the first
// waypoint, at which time it jumps to the waypoint and begins moving
m_mob4->SetPosition (Vector (10.0, 10.0, 10.0));
// At time 3, position should be fixed still at 10
Simulator::Schedule (Seconds (3.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob4, 10.0);
Simulator::Schedule (Seconds (3.0), &WaypointInitialPositionIsWaypoint::TestNumWaypoints, this, m_mob4, 1);
// At time 6, we should be moving between 15 and 20
Simulator::Schedule (Seconds (6.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob4, 16.0);
// At time 15, we should be fixed at 20
Simulator::Schedule (Seconds (15.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob4, 20.0);
// case 5: If waypoint and SetPosition both called at time 0,
// SetPosition takes precedence
m_mob5 = CreateObject<WaypointMobilityModel> ();
m_mob5->SetAttributeFailSafe ("InitialPositionIsWaypoint", BooleanValue (true));
// Note: The below statement would result in a crash, because it would
// violate the rule that waypoints must increase in start time
// m_mob5->SetPosition (Vector (10.0, 10.0, 10.0));
Waypoint wpt51 (Seconds (0.0), Vector (200.0, 200.0, 200.0));
m_mob5->AddWaypoint (wpt51);
Waypoint wpt52 (Seconds (5.0), Vector (15.0, 15.0, 15.0));
m_mob5->AddWaypoint (wpt52);
Waypoint wpt53 (Seconds (10.0), Vector (20.0, 20.0, 20.0));
m_mob5->AddWaypoint (wpt53);
// Here, since waypoints already exist, the below SetPosition will cancel
// out wpt51 above, and model will stay at initial position until time 5
m_mob5->SetPosition (Vector (10.0, 10.0, 10.0));
Simulator::Schedule (Seconds (3.0), &WaypointInitialPositionIsWaypoint::TestXPosition, this, m_mob5, 10.0);
Simulator::Run ();
Simulator::Destroy ();
}
class WaypointMobilityModelViaHelper : public TestCase
{
public:
WaypointMobilityModelViaHelper ();
virtual ~WaypointMobilityModelViaHelper ();
private:
void TestXPosition (Ptr<const WaypointMobilityModel> mob, double expectedXPos);
virtual void DoRun (void);
};
WaypointMobilityModelViaHelper::WaypointMobilityModelViaHelper ()
: TestCase ("Test behavior using MobilityHelper and PositionAllocator")
{
}
WaypointMobilityModelViaHelper::~WaypointMobilityModelViaHelper ()
{
}
void
WaypointMobilityModelViaHelper::TestXPosition (Ptr<const WaypointMobilityModel> mob, double expectedXPos)
{
Vector pos = mob->GetPosition ();
NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL (pos.x, expectedXPos, 0.001, "Position not equal", __FILE__, __LINE__);
}
// WaypointMobilityModel tests using the helper
void
WaypointMobilityModelViaHelper::DoRun (void)
{
NodeContainer c;
c.Create (1);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
// When InitialPositionIsWaypoint is false (default), the position
// set by the position allocator is ignored. The first waypoint set will
// set the initial position (with velocity 0 until first waypoint time)
mobility.SetMobilityModel ("ns3::WaypointMobilityModel",
"InitialPositionIsWaypoint", BooleanValue (false));
mobility.Install (c);
// Get back a pointer to this
Ptr<WaypointMobilityModel> mob = c.Get (0)->GetObject<WaypointMobilityModel> ();
// Waypoint added at time 0 will override initial position
Waypoint wpt (Seconds (5.0), Vector (20.0, 20.0, 20.0));
Waypoint wpt2 (Seconds (10.0), Vector (10.0, 10.0, 10.0));
mob->AddWaypoint (wpt);
mob->AddWaypoint (wpt2);
// At time 3 (before first waypoint, position is 20
Simulator::Schedule (Seconds (3), &WaypointMobilityModelViaHelper::TestXPosition, this, mob, 20);
// At time 7.5 (midway between points 1 and 2, position is 15
Simulator::Schedule (Seconds (7.5), &WaypointMobilityModelViaHelper::TestXPosition, this, mob, 15);
// When InitialPositionIsWaypoint is true, the position allocator creates
// the first waypoint, and movement occurs between this origin and the
// initial waypoint below at 5 seconds
NodeContainer c2;
c2.Create (1);
MobilityHelper mobility2;
Ptr<ListPositionAllocator> positionAlloc2 = CreateObject<ListPositionAllocator> ();
positionAlloc2->Add (Vector (0.0, 0.0, 0.0));
mobility2.SetPositionAllocator (positionAlloc2);
mobility2.SetMobilityModel ("ns3::WaypointMobilityModel",
"InitialPositionIsWaypoint", BooleanValue (true));
mobility2.Install (c2);
Ptr<WaypointMobilityModel> mob2 = c2.Get (0)->GetObject<WaypointMobilityModel> ();
Waypoint wpt3 (Seconds (5.0), Vector (20.0, 20.0, 20.0));
mob2->AddWaypoint (wpt3);
// Move to position 12 at 3 seconds
Simulator::Schedule (Seconds (3), &WaypointMobilityModelViaHelper::TestXPosition, this, mob2, 12);
Simulator::Run ();
Simulator::Destroy ();
}
class MobilityTestSuite : public TestSuite
{
public:
MobilityTestSuite ();
};
MobilityTestSuite::MobilityTestSuite ()
: TestSuite ("mobility", UNIT)
{
AddTestCase (new WaypointLazyNotifyFalse);
AddTestCase (new WaypointLazyNotifyTrue);
AddTestCase (new WaypointInitialPositionIsWaypoint);
AddTestCase (new WaypointMobilityModelViaHelper);
}
static MobilityTestSuite mobilityTestSuite;
| zy901002-gpsr | src/test/mobility-test-suite.cc | C++ | gpl2 | 14,559 |
/* -*- 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
*/
// End-to-end tests for Ipv4 static routing
#include "ns3/boolean.h"
#include "ns3/config.h"
#include "ns3/csma-helper.h"
#include "ns3/csma-net-device.h"
#include "ns3/inet-socket-address.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/node.h"
#include "ns3/node-container.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/pointer.h"
#include "ns3/random-variable.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/test.h"
#include "ns3/uinteger.h"
using namespace ns3;
class StaticRoutingSlash32TestCase : public TestCase
{
public:
StaticRoutingSlash32TestCase ();
virtual ~StaticRoutingSlash32TestCase ();
private:
virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
StaticRoutingSlash32TestCase::StaticRoutingSlash32TestCase ()
: TestCase ("Slash 32 static routing example")
{
}
StaticRoutingSlash32TestCase::~StaticRoutingSlash32TestCase ()
{
}
// Test program for this 3-router scenario, using static routing
//
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
//
void
StaticRoutingSlash32TestCase::DoRun (void)
{
Ptr<Node> nA = CreateObject<Node> ();
Ptr<Node> nB = CreateObject<Node> ();
Ptr<Node> nC = CreateObject<Node> ();
NodeContainer c = NodeContainer (nA, nB, nC);
InternetStackHelper internet;
internet.Install (c);
// Point-to-point links
NodeContainer nAnB = NodeContainer (nA, nB);
NodeContainer nBnC = NodeContainer (nB, nC);
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> ();
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
// Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
ipv4.SetBase ("10.1.1.4", "255.255.255.252");
Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC);
Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
Ptr<Ipv4> ipv4B = nB->GetObject<Ipv4> ();
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("/32"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
ipv4A->SetUp (ifIndexA);
Ipv4InterfaceAddress ifInAddrC = Ipv4InterfaceAddress (Ipv4Address ("192.168.1.1"), Ipv4Mask ("/32"));
ipv4C->AddAddress (ifIndexC, ifInAddrC);
ipv4C->SetMetric (ifIndexC, 1);
ipv4C->SetUp (ifIndexC);
Ipv4StaticRoutingHelper ipv4RoutingHelper;
// Create static routes from A to C
Ptr<Ipv4StaticRouting> staticRoutingA = ipv4RoutingHelper.GetStaticRouting (ipv4A);
// The ifIndex for this outbound route is 1; the first p2p link added
staticRoutingA->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.2"), 1);
Ptr<Ipv4StaticRouting> staticRoutingB = ipv4RoutingHelper.GetStaticRouting (ipv4B);
// The ifIndex we want on node B is 2; 0 corresponds to loopback, and 1 to the first point to point link
staticRoutingB->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"), 2);
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
Simulator::Run ();
// Check that we received 13 * 512 = 6656 bytes
Ptr<PacketSink> sinkPtr = DynamicCast <PacketSink> (apps.Get (0));
NS_TEST_ASSERT_MSG_EQ (sinkPtr->GetTotalRx (), 6656, "Static routing with /32 did not deliver all packets");
Simulator::Destroy ();
}
class StaticRoutingTestSuite : public TestSuite
{
public:
StaticRoutingTestSuite ();
};
StaticRoutingTestSuite::StaticRoutingTestSuite ()
: TestSuite ("static-routing", UNIT)
{
AddTestCase (new StaticRoutingSlash32TestCase);
}
// Do not forget to allocate an instance of this TestSuite
static StaticRoutingTestSuite staticRoutingTestSuite;
| zy901002-gpsr | src/test/static-routing-test-suite.cc | C++ | gpl2 | 6,136 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def configure(conf):
pass
def build(bld):
obj = bld.create_ns3_program('perf-io', ['network'])
obj.source = 'perf-io.cc'
| zy901002-gpsr | src/test/perf/wscript | Python | gpl2 | 221 |
/* -*- 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
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/abort.h"
using namespace ns3;
using namespace std;
static const uint64_t US_PER_NS = (uint64_t)1000;
static const uint64_t US_PER_SEC = (uint64_t)1000000;
static const uint64_t NS_PER_SEC = (uint64_t)1000000000;
uint64_t
GetRealtimeInNs (void)
{
struct timeval tv;
gettimeofday (&tv, NULL);
uint64_t nsResult = tv.tv_sec * NS_PER_SEC + tv.tv_usec * US_PER_NS;
return nsResult;
}
void
PerfFile (FILE *file, uint32_t n, const char *buffer, uint32_t size)
{
for (uint32_t i = 0; i < n; ++i)
{
if (fwrite (buffer, 1, size, file) != size)
{
NS_ABORT_MSG ("PerfFile(): fwrite error");
}
}
}
void
PerfStream (ostream &stream, uint32_t n, const char *buffer, uint32_t size)
{
for (uint32_t i = 0; i < n; ++i)
{
stream.write (buffer, size);
}
}
int
main (int argc, char *argv[])
{
uint32_t n = 100000;
uint32_t iter = 50;
bool doStream = false;
bool binmode = true;
CommandLine cmd;
cmd.AddValue ("n", "How many times to write (defaults to 100000", n);
cmd.AddValue ("iter", "How many times to run the test looking for a min (defaults to 50)", iter);
cmd.AddValue ("doStream", "Run the C++ I/O benchmark otherwise the C I/O ", doStream);
cmd.AddValue ("binmode", "Select binary mode for the C++ I/O benchmark (defaults to true)", binmode);
cmd.Parse (argc, argv);
uint64_t result = std::numeric_limits<uint64_t>::max ();
char buffer[1024];
if (doStream)
{
//
// This will probably run on a machine doing other things. Run it some
// relatively large number of times and try to find a minimum, which
// will hopefully represent a time when it runs free of interference.
//
for (uint32_t i = 0; i < iter; ++i)
{
ofstream stream;
if (binmode)
{
stream.open ("streamtest", std::ios_base::binary | std::ios_base::out);
}
else
{
stream.open ("streamtest", std::ios_base::out);
}
uint64_t start = GetRealtimeInNs ();
PerfStream (stream, n, buffer, 1024);
uint64_t et = GetRealtimeInNs () - start;
result = min (result, et);
stream.close ();
cout << "."; std::cout.flush ();
}
cout << std::endl;
}
else
{
//
// This will probably run on a machine doing other things. Run it some
// relatively large number of times and try to find a minimum, which
// will hopefully represent a time when it runs free of interference.
//
for (uint32_t i = 0; i < iter; ++i)
{
FILE *file = fopen ("filetest", "w");
uint64_t start = GetRealtimeInNs ();
PerfFile (file, n, buffer, 1024);
uint64_t et = GetRealtimeInNs () - start;
result = std::min (result, et);
fclose (file);
file = 0;
std::cout << "."; std::cout.flush ();
}
std::cout << std::endl;
}
std::cout << argv[0] << ": " << result << "ns" << std::endl;
}
| zy901002-gpsr | src/test/perf/perf-io.cc | C++ | gpl2 | 3,992 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys
def configure(conf):
conf.sub_config('perf')
conf.sub_config('ns3tcp')
conf.sub_config('ns3wifi')
# Add the test module to the list of enabled modules that should
# not be built if this is a static build on Darwin. They don't
# work there for the test module, and this is probably because the
# test module has no source files.
if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin':
conf.env['MODULES_NOT_BUILT'].append('test')
def build(bld):
# Don't do anything for this module if it should not be built.
if 'test' in bld.env['MODULES_NOT_BUILT']:
return
test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor'])
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'test'
test_test = bld.create_ns3_module_test_library('test')
test_test.source = [
'csma-system-test-suite.cc',
'global-routing-test-suite.cc',
'static-routing-test-suite.cc',
'error-model-test-suite.cc',
'mobility-test-suite.cc',
]
| zy901002-gpsr | src/test/wscript | Python | gpl2 | 1,264 |
/* -*- 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
*/
#include <vector>
#include "ns3/boolean.h"
#include "ns3/config.h"
#include "ns3/csma-helper.h"
#include "ns3/flow-monitor.h"
#include "ns3/flow-monitor-helper.h"
#include "ns3/inet-socket-address.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/node.h"
#include "ns3/node-container.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-address.h"
#include "ns3/csma-net-device.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/pointer.h"
#include "ns3/random-variable.h"
#include "ns3/simple-channel.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/test.h"
#include "ns3/uinteger.h"
#include "ns3/ipv4-packet-info-tag.h"
using namespace ns3;
class DynamicGlobalRoutingTestCase : public TestCase
{
public:
DynamicGlobalRoutingTestCase ();
virtual ~DynamicGlobalRoutingTestCase ();
private:
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
void HandleRead (Ptr<Socket>);
virtual void DoRun (void);
int m_count;
std::vector<uint8_t> m_firstInterface;
std::vector<uint8_t> m_secondInterface;
};
// Add some help text to this case to describe what it is intended to test
DynamicGlobalRoutingTestCase::DynamicGlobalRoutingTestCase ()
: TestCase ("Dynamic global routing example"), m_count (0)
{
m_firstInterface.resize (16);
m_secondInterface.resize (16);
}
DynamicGlobalRoutingTestCase::~DynamicGlobalRoutingTestCase ()
{
}
void
DynamicGlobalRoutingTestCase::SinkRx (std::string path, Ptr<const Packet> p, const Address& address)
{
Ipv4PacketInfoTag tag;
bool found;
found = p->PeekPacketTag (tag);
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
if (found)
{
;
}
m_firstInterface[now]++;
m_count++;
}
void
DynamicGlobalRoutingTestCase::HandleRead (Ptr<Socket> socket)
{
Ptr<Packet> packet;
Address from;
while (packet = socket->RecvFrom (from))
{
if (packet->GetSize () == 0)
{ //EOF
break;
}
Ipv4PacketInfoTag tag;
bool found;
found = packet->PeekPacketTag (tag);
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
if (found)
{
if (tag.GetRecvIf () == 1)
{
m_firstInterface[now]++;
}
if (tag.GetRecvIf () == 2)
{
m_secondInterface[now]++;
}
m_count++;
}
}
}
// Test derived from examples/routing/dynamic-global-routing.cc
//
// Network topology
//
// n0
// \ p-p
// \ (shared csma/cd)
// n2 -------------------------n3
// / | |
// / p-p n4 n5 ---------- n6
// n1 p-p
// | |
// ----------------------------------------
// p-p
//
// Test that for node n6, the interface facing n5 receives packets at
// times (1-2), (4-6), (8-10), (11-12), (14-16) and the interface
// facing n1 receives packets at times (2-4), (6-8), (12-13)
//
void
DynamicGlobalRoutingTestCase::DoRun (void)
{
// The below value configures the default behavior of global routing.
// By default, it is disabled. To respond to interface events, set to true
Config::SetDefault ("ns3::Ipv4GlobalRouting::RespondToInterfaceEvents", BooleanValue (true));
NodeContainer c;
c.Create (7);
NodeContainer n0n2 = NodeContainer (c.Get (0), c.Get (2));
NodeContainer n1n2 = NodeContainer (c.Get (1), c.Get (2));
NodeContainer n5n6 = NodeContainer (c.Get (5), c.Get (6));
NodeContainer n1n6 = NodeContainer (c.Get (1), c.Get (6));
NodeContainer n2345 = NodeContainer (c.Get (2), c.Get (3), c.Get (4), c.Get (5));
InternetStackHelper internet;
internet.Install (c);
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer d0d2 = p2p.Install (n0n2);
NetDeviceContainer d1d6 = p2p.Install (n1n6);
NetDeviceContainer d1d2 = p2p.Install (n1n2);
p2p.SetDeviceAttribute ("DataRate", StringValue ("1500kbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("10ms"));
NetDeviceContainer d5d6 = p2p.Install (n5n6);
// We create the channels first without any IP addressing information
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer d2345 = csma.Install (n2345);
// Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
ipv4.Assign (d0d2);
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
ipv4.Assign (d1d2);
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
Ipv4InterfaceContainer i5i6 = ipv4.Assign (d5d6);
ipv4.SetBase ("10.250.1.0", "255.255.255.0");
ipv4.Assign (d2345);
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
Ipv4InterfaceContainer i1i6 = ipv4.Assign (d1d6);
// Create router nodes, initialize routing database and set up the routing
// tables in the nodes.
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (i5i6.GetAddress (1), port));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", StringValue ("2kbps"));
onoff.SetAttribute ("PacketSize", UintegerValue (50));
ApplicationContainer apps = onoff.Install (c.Get (1));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a second OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
OnOffHelper onoff2 ("ns3::UdpSocketFactory",
InetSocketAddress (i1i6.GetAddress (1), port));
onoff2.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff2.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff2.SetAttribute ("DataRate", StringValue ("2kbps"));
onoff2.SetAttribute ("PacketSize", UintegerValue (50));
ApplicationContainer apps2 = onoff2.Install (c.Get (1));
apps2.Start (Seconds (11.0));
apps2.Stop (Seconds (16.0));
// Create an optional packet sink to receive these packets
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> sink2 = Socket::CreateSocket (c.Get (6), tid);
sink2->Bind (Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
sink2->Listen ();
sink2->ShutdownSend ();
sink2->SetRecvPktInfo (true);
sink2->SetRecvCallback (MakeCallback (&DynamicGlobalRoutingTestCase::HandleRead, this));
Ptr<Node> n1 = c.Get (1);
Ptr<Ipv4> ipv41 = n1->GetObject<Ipv4> ();
// The first ifIndex is 0 for loopback, then the first p2p is numbered 1,
// then the next p2p is numbered 2
uint32_t ipv4ifIndex1 = 2;
// Trace receptions
Config::Connect ("/NodeList/6/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&DynamicGlobalRoutingTestCase::SinkRx, this));
Simulator::Schedule (Seconds (2),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
Simulator::Schedule (Seconds (4),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
Ptr<Node> n6 = c.Get (6);
Ptr<Ipv4> ipv46 = n6->GetObject<Ipv4> ();
// The first ifIndex is 0 for loopback, then the first p2p is numbered 1,
// then the next p2p is numbered 2
uint32_t ipv4ifIndex6 = 2;
Simulator::Schedule (Seconds (6),&Ipv4::SetDown,ipv46, ipv4ifIndex6);
Simulator::Schedule (Seconds (8),&Ipv4::SetUp,ipv46, ipv4ifIndex6);
Simulator::Schedule (Seconds (12),&Ipv4::SetDown,ipv41, ipv4ifIndex1);
Simulator::Schedule (Seconds (14),&Ipv4::SetUp,ipv41, ipv4ifIndex1);
Simulator::Run ();
NS_TEST_ASSERT_MSG_EQ (m_count, 68, "Dynamic global routing did not deliver all packets");
// Test that for node n6, the interface facing n5 receives packets at
// times (1-2), (4-6), (8-10), (11-12), (14-16) and the interface
// facing n1 receives packets at times (2-4), (6-8), (12-13)
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[1], 4, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[2], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[3], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[4], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[5], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[6], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[7], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[8], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[9], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[10], 0, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[11], 4, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[12], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_secondInterface[13], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[14], 5, "Dynamic global routing did not deliver all packets");
NS_TEST_ASSERT_MSG_EQ (m_firstInterface[15], 5, "Dynamic global routing did not deliver all packets");
Simulator::Destroy ();
}
class GlobalRoutingSlash32TestCase : public TestCase
{
public:
GlobalRoutingSlash32TestCase ();
virtual ~GlobalRoutingSlash32TestCase ();
private:
virtual void DoRun (void);
};
// Add some help text to this case to describe what it is intended to test
GlobalRoutingSlash32TestCase::GlobalRoutingSlash32TestCase ()
: TestCase ("Slash 32 global routing example")
{
}
GlobalRoutingSlash32TestCase::~GlobalRoutingSlash32TestCase ()
{
}
// Test program for this 3-router scenario, using global routing
//
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
//
void
GlobalRoutingSlash32TestCase::DoRun (void)
{
Ptr<Node> nA = CreateObject<Node> ();
Ptr<Node> nB = CreateObject<Node> ();
Ptr<Node> nC = CreateObject<Node> ();
NodeContainer c = NodeContainer (nA, nB, nC);
InternetStackHelper internet;
internet.Install (c);
// Point-to-point links
NodeContainer nAnB = NodeContainer (nA, nB);
NodeContainer nBnC = NodeContainer (nB, nC);
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> ();
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
// Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
ipv4.SetBase ("10.1.1.4", "255.255.255.252");
Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC);
Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
ipv4A->SetUp (ifIndexA);
Ipv4InterfaceAddress ifInAddrC = Ipv4InterfaceAddress (Ipv4Address ("192.168.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4C->AddAddress (ifIndexC, ifInAddrC);
ipv4C->SetMetric (ifIndexC, 1);
ipv4C->SetUp (ifIndexC);
// Create router nodes, initialize routing database and set up the routing
// tables in the nodes.
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
Simulator::Run ();
// Check that we received 13 * 512 = 6656 bytes
Ptr<PacketSink> sinkPtr = DynamicCast <PacketSink> (apps.Get (0));
NS_TEST_ASSERT_MSG_EQ (sinkPtr->GetTotalRx (), 6656, "Static routing with /32 did not deliver all packets");
Simulator::Destroy ();
}
class GlobalRoutingTestSuite : public TestSuite
{
public:
GlobalRoutingTestSuite ();
};
GlobalRoutingTestSuite::GlobalRoutingTestSuite ()
: TestSuite ("global-routing", UNIT)
{
AddTestCase (new DynamicGlobalRoutingTestCase);
AddTestCase (new GlobalRoutingSlash32TestCase);
}
// Do not forget to allocate an instance of this TestSuite
static GlobalRoutingTestSuite globalRoutingTestSuite;
| zy901002-gpsr | src/test/global-routing-test-suite.cc | C++ | gpl2 | 15,017 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* 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
*/
#include <string>
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-header.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/on-off-helper.h"
#include "ns3/simulator.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns3TcpInteropTest");
const bool WRITE_VECTORS = false; // set to true to write response vectors
const uint32_t PCAP_LINK_TYPE = 1187373553; // Some large random number -- we use to verify data was written by this program
const uint32_t PCAP_SNAPLEN = 64; // Don't bother to save much data
// ===========================================================================
// This is a simple test to demonstrate how a known good model (a reference
// implementation) may be used to test another model in a relatively simple
// way.
//
// Node zero contains the model under test, in this case the ns-3 TCP
// implementation. Node one contains the reference implementation that we
// assume will generate good test vectors for us. In this case, a Linux
// TCP implementation is used to stimulate the ns-3 TCP model with what we
// assume are perfectly good packets. We watch the ns-3 implementation to
// see what it does in the presence of these assumed good stimuli.
//
// The test is arranged as a typical ns-3 script, but we use the trace system
// to peek into the running system and monitor the ns-3 TCP.
//
// The topology is just two nodes communicating over a point-to-point network.
// The point-to-point network is chosen because it is simple and allows us to
// easily generate pcap traces we can use to separately verify that the ns-3
// implementation is responding correctly. Once the opration is verified, we
// capture a set of response vectors that are then checked in the test to
// ensure that the ns-3 TCP continues to respond correctly over time.
//
// node 0 node 1
// +----------------+ +----------------+
// | ns-3 TCP | | Linux TCP |
// +----------------+ +----------------+
// | 10.1.1.1 | | 10.1.1.2 |
// +----------------+ +----------------+
// | point-to-point | | point-to-point |
// +----------------+ +----------------+
// | |
// +---------------------+
// 5 Mbps, 2 ms
//
// ===========================================================================
class Ns3TcpInteroperabilityTestCase : public TestCase
{
public:
Ns3TcpInteroperabilityTestCase ();
virtual ~Ns3TcpInteroperabilityTestCase ();
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
void Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
std::string m_pcapFilename;
PcapFile m_pcapFile;
bool m_writeVectors;
};
Ns3TcpInteroperabilityTestCase::Ns3TcpInteroperabilityTestCase ()
: TestCase ("Check to see that the ns-3 TCP can work with liblinux2.6.26.so"), m_writeVectors (WRITE_VECTORS)
{
}
Ns3TcpInteroperabilityTestCase::~Ns3TcpInteroperabilityTestCase ()
{
}
void
Ns3TcpInteroperabilityTestCase::DoSetup (void)
{
//
// We expect there to be a file called tcp-interop-response-vectors.pcap in
// response-vectors/ of this directory
//
m_pcapFilename = static_cast<std::string> (NS_TEST_SOURCEDIR) +
static_cast<std::string> ("/response-vectors/ns3tcp-interop-response-vectors.pcap");
if (m_writeVectors)
{
m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary);
m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN);
}
else
{
m_pcapFile.Open (m_pcapFilename, std::ios::in|std::ios::binary);
NS_ABORT_MSG_UNLESS (m_pcapFile.GetDataLinkType () == PCAP_LINK_TYPE, "Wrong response vectors in directory");
}
}
void
Ns3TcpInteroperabilityTestCase::DoTeardown (void)
{
m_pcapFile.Close ();
}
void
Ns3TcpInteroperabilityTestCase::Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface)
{
//
// We're not testing IP so remove and toss the header. In order to do this,
// though, we need to copy the packet since we have a const version.
//
Ptr<Packet> p = packet->Copy ();
Ipv4Header ipHeader;
p->RemoveHeader (ipHeader);
//
// What is left is the TCP header and any data that may be sent. We aren't
// sending any TCP data, so we expect what remains is only TCP header, which
// is a small thing to save.
//
if (m_writeVectors)
{
//
// Save the TCP under test response for later testing.
//
Time tNow = Simulator::Now ();
int64_t tMicroSeconds = tNow.GetMicroSeconds ();
uint32_t size = p->GetSize ();
uint8_t *buf = new uint8_t[size];
p->CopyData (buf, size);
m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000),
uint32_t (tMicroSeconds % 1000000),
buf,
size);
delete [] buf;
}
else
{
//
// Read the TCP under test expected response from the expected vector
// file and see if it still does the right thing.
//
uint8_t expected[PCAP_SNAPLEN];
uint32_t tsSec, tsUsec, inclLen, origLen, readLen;
m_pcapFile.Read (expected, sizeof(expected), tsSec, tsUsec, inclLen, origLen, readLen);
uint8_t *actual = new uint8_t[readLen];
p->CopyData (actual, readLen);
uint32_t result = memcmp (actual, expected, readLen);
delete [] actual;
//
// Avoid streams of errors -- only report the first.
//
if (IsStatusSuccess ())
{
NS_TEST_EXPECT_MSG_EQ (result, 0, "Expected data comparison error");
}
}
}
void
Ns3TcpInteroperabilityTestCase::DoRun (void)
{
//
// Just create two nodes. One (node zero) will be the node with the TCP
// under test which is the ns-3 TCP implementation. The other node (node
// one) will be the node with the reference implementation we use to drive
// the tests.
//
NodeContainer nodes;
nodes.Create (2);
//
// For this test we'll use a point-to-point net device. It's not as simple
// as a simple-net-device, but it provides nice places to hook trace events
// so we can see what's moving between our nodes.
//
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
//
// Install the point-to-point devices on both nodes and connec them up.
//
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
//
// Install two variants of the internet stack. The first, on node zero
// uses the TCP under test, which is the default ns-3 TCP implementation.
//
InternetStackHelper stack;
stack.Install (nodes.Get (0));
//
// The other node, node one, is going to be set up to use a Linux TCP
// implementation that we consider a known good TCP.
//
std::string nscStack = "liblinux2.6.26.so";
stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so"));
stack.Install (nodes.Get (1));
//
// Assign the address 10.1.1.1 to the TCP implementation under test (index
// zero) and 10.1.1.2 to the reference implementation (index one).
//
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
//
// We need a place for the TCP data to go on the node with the TCP under
// test, so just create a sink on node zero.
//
uint16_t sinkPort = 8080;
Address sinkAddress (InetSocketAddress (interfaces.GetAddress (0), sinkPort));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (0));
sinkApps.Start (Seconds (0.));
//
// We need something to shove data down the pipe, so we create an on-off
// application on the soure node with the reference TCP implementation.
// The default behavior is to send for one second, then go quiet for one
// second, and repeat.
//
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", sinkAddress);
onOffHelper.SetAttribute ("MaxBytes", UintegerValue (100000));
ApplicationContainer sourceApps = onOffHelper.Install (nodes.Get (1));
sourceApps.Start (Seconds (1.));
sourceApps.Stop (Seconds (10.));
//
// There are currently a limited number of trace hooks in the ns-3 TCP code.
// Rather than editing TCP to insert a bunch of trace hooks, we can just
// intercept the packets at the IPv4 layer. See internet-stack-helper.cc
// for complete description of the trace hooks. We're interested in the
// responses of the TCP under test, which implies we need to hook the node
// zero Ipv4 layer three transmit trace source. We'll then get all of the
// responses we need
//
Config::Connect ("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
MakeCallback (&Ns3TcpInteroperabilityTestCase::Ipv4L3Tx, this));
//
// The idea here is that someone will look very closely at the all of the
// communications between the reference TCP and the TCP under test in this
// simulation and determine that all of the responses are correct. We expect
// that this means generating a pcap trace file from the point-to-point link
// and examining the packets closely using tcpdump, wireshark or some such
// program. So we provide the ability to generate a pcap trace of the
// test execution for your perusal.
//
// Once the validation test is determined to be running exactly as exptected,
// we allow you to generate a file that contains the response vectors that
// will be checked during the actual execution of the test.
//
if (m_writeVectors)
{
pointToPoint.EnablePcapAll ("tcp-interop");
}
Simulator::Stop (Seconds (20));
Simulator::Run ();
Simulator::Destroy ();
}
class Ns3TcpInteroperabilityTestSuite : public TestSuite
{
public:
Ns3TcpInteroperabilityTestSuite ();
};
Ns3TcpInteroperabilityTestSuite::Ns3TcpInteroperabilityTestSuite ()
: TestSuite ("ns3-tcp-interoperability", SYSTEM)
{
AddTestCase (new Ns3TcpInteroperabilityTestCase);
}
static Ns3TcpInteroperabilityTestSuite ns3TcpInteroperabilityTestSuite;
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-interop-test-suite.cc | C++ | gpl2 | 11,378 |
###
# *
# * Copyright (c) 2010 Adrian Sai-wah Tam
# *
# * 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
# *
# * This perl script is used within plot.gp, a gnuplot file also
# * in this directory, for parsing the Ns3TcpLossTest logging output.
# * It can also be used, stand-alone, to tidy up the logging output
# * from Ns3TcpStateTestCases, if logging is enabled in these tests.
###
while(<>) {
s|ns3::PppHeader \(Point-to-Point Protocol: IP \(0x0021\)\) ||;
s|/TxQueue||;
s|/TxQ/|Q|;
s|NodeList/|N|;
s|/DeviceList/|D|;
s|/MacRx||;
s|/Enqueue||;
s|/Dequeue||;
s|/\$ns3::QbbNetDevice||;
s|/\$ns3::PointToPointNetDevice||;
s| /|\t|;
s| ns3::|\t|g;
s|tos 0x0 ||;
s|protocol 6 ||;
s|offset 0 ||;
s|flags \[none\] ||;
s|length:|len|;
s|Header||g;
s|/PhyRxDrop||;
print;
};
| zy901002-gpsr | src/test/ns3tcp/trTidy.pl | Perl | gpl2 | 1,472 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* 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
*/
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/simulator.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns3CwndTest");
// ===========================================================================
// This is a simple test to demonstrate how a known good model (a reference
// implementation) may be used to test another model without resorting to
// storing stimulus or response vectors.
//
// Node zero contains the model under test, in this case the ns-3 TCP
// implementation. Node one contains the reference implementation that we
// assume will generate good test vectors for us. In this case, a Linux
// TCP implementation is used to stimulate the ns-3 TCP model with what we
// assume are perfectly good packets. We watch the ns-3 implementation to
// see what it does in the presence of these assumed good stimuli.
//
// The test is arranged as a typical ns-3 script, but we use the trace system
// to peek into the running system and monitor the ns-3 TCP.
//
// The topology is just two nodes communicating over a point-to-point network.
// The point-to-point network is chosen because it is simple and allows us to
// easily generate pcap traces we can use to separately verify that the ns-3
// implementation is responding correctly. Once the oopration is verified, we
// enter a list of responses that capture the response succinctly.
//
// node 0 node 1
// +----------------+ +----------------+
// | ns-3 TCP | | Linux TCP |
// +----------------+ +----------------+
// | 10.1.1.1 | | 10.1.1.2 |
// +----------------+ +----------------+
// | point-to-point | | point-to-point |
// +----------------+ +----------------+
// | |
// +---------------------+
// 5 Mbps, 2 ms
//
// ===========================================================================
//
class SimpleSource : public Application
{
public:
SimpleSource ();
virtual ~SimpleSource();
void Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate);
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
void ScheduleTx (void);
void SendPacket (void);
Ptr<Socket> m_socket;
Address m_peer;
uint32_t m_packetSize;
uint32_t m_nPackets;
DataRate m_dataRate;
EventId m_sendEvent;
bool m_running;
uint32_t m_packetsSent;
};
SimpleSource::SimpleSource ()
: m_socket (0),
m_peer (),
m_packetSize (0),
m_nPackets (0),
m_dataRate (0),
m_sendEvent (),
m_running (false),
m_packetsSent (0)
{
}
SimpleSource::~SimpleSource()
{
m_socket = 0;
}
void
SimpleSource::Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
{
m_socket = socket;
m_peer = address;
m_packetSize = packetSize;
m_nPackets = nPackets;
m_dataRate = dataRate;
}
void
SimpleSource::StartApplication (void)
{
m_running = true;
m_packetsSent = 0;
m_socket->Bind ();
m_socket->Connect (m_peer);
SendPacket ();
}
void
SimpleSource::StopApplication (void)
{
m_running = false;
if (m_sendEvent.IsRunning ())
{
Simulator::Cancel (m_sendEvent);
}
if (m_socket)
{
m_socket->Close ();
}
}
void
SimpleSource::SendPacket (void)
{
Ptr<Packet> packet = Create<Packet> (m_packetSize);
m_socket->Send (packet);
if (++m_packetsSent < m_nPackets)
{
ScheduleTx ();
}
}
void
SimpleSource::ScheduleTx (void)
{
if (m_running)
{
Time tNext (Seconds (m_packetSize * 8 / static_cast<double> (m_dataRate.GetBitRate ())));
m_sendEvent = Simulator::Schedule (tNext, &SimpleSource::SendPacket, this);
}
}
class Ns3TcpCwndTestCase1 : public TestCase
{
public:
Ns3TcpCwndTestCase1 ();
virtual ~Ns3TcpCwndTestCase1 ();
private:
virtual void DoRun (void);
bool m_writeResults;
class CwndEvent {
public:
uint32_t m_oldCwnd;
uint32_t m_newCwnd;
};
TestVectors<CwndEvent> m_responses;
void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
};
Ns3TcpCwndTestCase1::Ns3TcpCwndTestCase1 ()
: TestCase ("Check to see that the ns-3 TCP congestion window works as expected against liblinux2.6.26.so"),
m_writeResults (false)
{
}
Ns3TcpCwndTestCase1::~Ns3TcpCwndTestCase1 ()
{
}
void
Ns3TcpCwndTestCase1::CwndChange (uint32_t oldCwnd, uint32_t newCwnd)
{
CwndEvent event;
event.m_oldCwnd = oldCwnd;
event.m_newCwnd = newCwnd;
m_responses.Add (event);
}
void
Ns3TcpCwndTestCase1::DoRun (void)
{
//
// Just create two nodes. One (node zero) will be the node with the TCP
// under test which is the ns-3 TCP implementation. The other node (node
// one) will be the node with the reference implementation we use to drive
// the tests.
//
NodeContainer nodes;
nodes.Create (2);
//
// For this test we'll use a point-to-point net device. It's not as simple
// as a simple-net-device, but it provides nice places to hook trace events
// so we can see what's moving between our nodes.
//
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
//
// Install the point-to-point devices on both nodes and connec them up.
//
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
//
// Install two variants of the internet stack. The first, on node zero
// uses the TCP under test, which is the default ns-3 TCP implementation.
//
InternetStackHelper stack;
stack.Install (nodes.Get (0));
//
// The other node, node one, is going to be set up to use a Linux TCP
// implementation that we consider a known good TCP.
//
std::string nscStack = "liblinux2.6.26.so";
stack.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so"));
stack.Install (nodes.Get (1));
//
// Assign the address 10.1.1.1 to the TCP implementation under test (index
// zero) and 10.1.1.2 to the reference implementation (index one).
//
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
//
// We need a place to send our TCP data on the node with the reference TCP
// implementation. We aren't really concerned about what happens there, so
// just create a sink.
//
uint16_t sinkPort = 8080;
Address sinkAddress (InetSocketAddress (interfaces.GetAddress (1), sinkPort));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer sinkApps = packetSinkHelper.Install (nodes.Get (1));
sinkApps.Start (Seconds (0.));
sinkApps.Stop (Seconds (1.1));
//
// We want to look at changes in the ns-3 TCP congestion window. The
// congestion window is flow clontrol imposed by the sender, so we need
// to crank up a flow from the ns-3 TCP node to the NSC TCP node and hook the
// CongestionWindow attribute on the socket. Normally one would use an on-off
// application to generate a flow, but this has a couple of problems. First,
// the socket of the on-off application is not created until Application Start
// time, so we wouldn't be able to hook the socket now at configuration time.
// Second, even if we could arrange a call after start time, the socket is not
// public.
//
// So, we can cook up a simple version of the on-off application that does what
// we want. On the plus side we don't need all of the complexity of the on-off
// application. On the minus side, we don't have a helper, so we have to get
// a little more involved in the details, but this is trivial.
//
// So first, we create a socket and do the trace connect on it; then we pass this
// socket into the constructor of our simple application which we then install
// in the node with the ns-3 TCP.
//
Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (nodes.Get (0), TcpSocketFactory::GetTypeId ());
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&Ns3TcpCwndTestCase1::CwndChange, this));
Ptr<SimpleSource> app = CreateObject<SimpleSource> ();
app->Setup (ns3TcpSocket, sinkAddress, 1040, 10, DataRate ("5Mbps"));
nodes.Get (0)->AddApplication (app);
app->SetStartTime (Seconds (1.));
app->SetStopTime (Seconds (1.1));
//
// The idea here is that someone will look very closely at the all of the
// communications between the reference TCP and the TCP under test in this
// simulation and determine that all of the responses are correct. We expect
// that this means generating a pcap trace file from the point-to-point link
// and examining the packets closely using tcpdump, wireshark or some such
// program. So we provide the ability to generate a pcap trace of the
// test execution for your perusal.
//
// Once the validation test is determined to be running exactly as exptected,
// the set of congestion window changes is collected and hard coded into the
// test results which will then be checked during the actual execution of the
// test.
//
if (m_writeResults)
{
pointToPoint.EnablePcapAll ("tcp-cwnd");
}
Simulator::Stop (Seconds (2));
Simulator::Run ();
Simulator::Destroy ();
//
// As new acks are received by the TCP under test, the congestion window
// should be opened up by one segment (MSS bytes) each time. This should
// trigger a congestion window change event which we hooked and saved above.
// We should now be able to look through the saved response vectors and follow
// the congestion window as it opens up when the ns-3 TCP under test
// transmits its bits
//
// From inspecting the results, we know that we should see N_EVENTS congestion
// window change events. The window should expand N_EVENTS - 1 times (each
// time by MSS bytes) until it gets to its largest value. Then the application
// sending stops and the window should be slammed shut, with the last event
// reflecting the change from LARGEST_CWND back to MSS
//
const uint32_t MSS = 536;
const uint32_t N_EVENTS = 21;
CwndEvent event;
NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpectedly low number of cwnd change events");
// Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
for (uint32_t i = 1, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
}
// ===========================================================================
// Test case for cwnd changes due to out-of-order packets. A bottleneck
// link is created, and a limited droptail queue is used in order to
// force dropped packets, resulting in out-of-order packet delivery.
// This out-of-order delivery will result in a different congestion
// window behavior than testcase 1. Specifically, duplicate ACKs
// are encountered.
//
// Network topology
//
// 1Mb/s, 10ms 100kb/s, 10ms 1Mb/s, 10ms
// n0--------------n1-----------------n2---------------n3
//
// ===========================================================================
class Ns3TcpCwndTestCase2 : public TestCase
{
public:
Ns3TcpCwndTestCase2 ();
virtual ~Ns3TcpCwndTestCase2 ();
private:
virtual void DoRun (void);
bool m_writeResults;
class CwndEvent {
public:
uint32_t m_oldCwnd;
uint32_t m_newCwnd;
};
TestVectors<CwndEvent> m_responses;
void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
};
Ns3TcpCwndTestCase2::Ns3TcpCwndTestCase2 ()
: TestCase ("Check to see that the ns-3 TCP congestion window works as expected for out-of-order packet delivery"),
m_writeResults (false)
{
}
Ns3TcpCwndTestCase2::~Ns3TcpCwndTestCase2 ()
{
}
void
Ns3TcpCwndTestCase2::CwndChange (uint32_t oldCwnd, uint32_t newCwnd)
{
CwndEvent event;
event.m_oldCwnd = oldCwnd;
event.m_newCwnd = newCwnd;
m_responses.Add (event);
}
void
Ns3TcpCwndTestCase2::DoRun (void)
{
// Set up some default values for the simulation.
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (4));
NodeContainer n0n1;
n0n1.Create (2);
NodeContainer n1n2;
n1n2.Add (n0n1.Get (1));
n1n2.Create (1);
NodeContainer n2n3;
n2n3.Add (n1n2.Get (1));
n2n3.Create (1);
PointToPointHelper p2p1;
p2p1.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1000000)));
p2p1.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10)));
PointToPointHelper p2p2;
p2p2.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (100000)));
p2p2.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (10)));
// And then install devices and channels connecting our topology.
NetDeviceContainer dev0 = p2p1.Install (n0n1);
NetDeviceContainer dev1 = p2p2.Install (n1n2);
NetDeviceContainer dev2 = p2p1.Install (n2n3);
// Now add ip/tcp stack to all nodes.
InternetStackHelper internet;
internet.InstallAll ();
// Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
ipv4.Assign (dev0);
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
ipv4.Assign (dev1);
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev2);
// and setup ip routing tables to get total ip-level connectivity.
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Set up the apps
uint16_t servPort = 50000;
// Create a packet sink to receive these packets on n3
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), servPort));
ApplicationContainer apps = sink.Install (n2n3.Get (1));
apps.Start (Seconds (0.0));
apps.Stop (Seconds (5.4));
// Create the socket for n0
Address sinkAddress (InetSocketAddress (ipInterfs.GetAddress (1), servPort));
Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
ns3TcpSocket->TraceConnectWithoutContext ("CongestionWindow", MakeCallback (&Ns3TcpCwndTestCase2::CwndChange, this));
// Create and start the app for n0
Ptr<SimpleSource> app = CreateObject<SimpleSource> ();
app->Setup (ns3TcpSocket, sinkAddress, 1040, 1000, DataRate ("1Mbps"));
n0n1.Get (0)->AddApplication (app);
app->SetStartTime (Seconds (1.0));
app->SetStopTime (Seconds (5.4));
if (m_writeResults)
{
// Write a pcap for tcp cwnd testcase with out-of-order delivery
PointToPointHelper pointToPoint;
pointToPoint.EnablePcapAll ("tcp-cwnd-ood");
}
// Finally, set up the simulator to run.
Simulator::Stop (Seconds (5.4));
Simulator::Run ();
Simulator::Destroy ();
//
// As new acks are received by the TCP under test, the congestion window
// should be opened up by one segment (MSS bytes) each time. This should
// trigger a congestion window change event which we hooked and saved above.
// We should now be able to look through the saved response vectors and follow
// the congestion window as it opens up when the ns-3 TCP under test
// transmits its bits
//
// From inspecting the results, we know that we should see N_EVENTS congestion
// window change events. On the tenth change event, the window should
// be cut from 5360 to 4288 due to 3 dup acks (NewReno behavior is to
// cut in half, and then add 3 segments (5360/2 + 3*536 = 4288)
// It should then increment cwnd by one segment per ack throughout
// the fast recovery phase. The trace shows that three segments are lost
// within the fast recovery window (with sequence numbers starting at
// 9113, 10721, and 12329). This last segment (12329) is not recovered
// by a fast retransmit and consequently, a coarse timeout is taken and
// cwnd is reset to MSS at event index 32. It slow starts again, and takes
// another fast retransmit at index 42.
//
const uint32_t MSS = 536;
const uint32_t N_EVENTS = 44;
CwndEvent event;
NS_TEST_ASSERT_MSG_EQ (m_responses.GetN (), N_EVENTS, "Unexpected number of cwnd change events");
// Ignore the first event logged (i=0) when m_cWnd goes from 0 to MSS bytes
for (uint32_t i = 1, from = MSS, to = MSS * 2; i < 10; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
// Cwnd should be back to (10/2 + 3) = 8*MSS
event = m_responses.Get (10);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 10);
// Fast recovery
for (uint32_t i = 11, from = 8*MSS, to = 9 * MSS; i < 32; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
// Slow start again after coarse timeout
for (uint32_t i = 33, from = MSS, to = MSS * 2; i < 42; ++i, from += MSS, to += MSS)
{
event = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (event.m_oldCwnd, from, "Wrong old cwnd value in cwnd change event " << i);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, to, "Wrong new cwnd value in cwnd change event " << i);
}
// Fast retransmit again; cwnd should be back to 8*MSS
event = m_responses.Get (42);
NS_TEST_ASSERT_MSG_EQ (event.m_newCwnd, 8*MSS, "Wrong new cwnd value in cwnd change event " << 42);
}
class Ns3TcpCwndTestSuite : public TestSuite
{
public:
Ns3TcpCwndTestSuite ();
};
Ns3TcpCwndTestSuite::Ns3TcpCwndTestSuite ()
: TestSuite ("ns3-tcp-cwnd", SYSTEM)
{
AddTestCase (new Ns3TcpCwndTestCase1);
AddTestCase (new Ns3TcpCwndTestCase2);
}
Ns3TcpCwndTestSuite ns3TcpCwndTestSuite;
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-cwnd-test-suite.cc | C++ | gpl2 | 19,461 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include "ns3/application.h"
#include "ns3/node.h"
#include "ns3/ptr.h"
#include "ns3/socket.h"
#include "ns3/address.h"
namespace ns3
{
// Simple class to write data to sockets
class SocketWriter : public Application
{
public:
SocketWriter ();
virtual ~SocketWriter ();
void Setup (Ptr<Node> node, Address peer);
void Connect ();
void Write (uint32_t numBytes);
void Close ();
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
Address m_peer;
Ptr<Node> m_node;
Ptr<Socket> m_socket;
bool m_isSetup;
bool m_isConnected;
};
}
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-socket-writer.h | C++ | gpl2 | 1,360 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include "ns3tcp-socket-writer.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/packet.h"
namespace ns3
{
SocketWriter::SocketWriter () : m_node (0), m_socket (0), m_isSetup (false), m_isConnected (false)
{
}
SocketWriter::~SocketWriter ()
{
m_socket = 0;
m_node = 0;
}
void
SocketWriter::StartApplication ()
{
m_socket = Socket::CreateSocket (m_node, TcpSocketFactory::GetTypeId ());
m_socket->Bind ();
}
void
SocketWriter::StopApplication ()
{
}
void
SocketWriter::Setup (Ptr<Node> node, Address peer)
{
m_peer = peer;
m_node = node;
m_isSetup = true;
}
void
SocketWriter::Connect ()
{
if (!m_isSetup)
{
NS_FATAL_ERROR ("Forgot to call Setup() first");
}
m_socket->Connect (m_peer);
m_isConnected = true;
}
void
SocketWriter::Write (uint32_t numBytes)
{
if (!m_isConnected)
{
Connect ();
}
Ptr<Packet> packet = Create<Packet> (numBytes);
m_socket->Send (packet);
}
void
SocketWriter::Close ()
{
m_socket->Close ();
}
}
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-socket-writer.cc | C++ | gpl2 | 1,762 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include <iomanip>
#include <string>
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/node-container.h"
#include "ns3/simulator.h"
#include "ns3/error-model.h"
#include "ns3/pointer.h"
#include "ns3tcp-socket-writer.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns3TcpStateTest");
const bool WRITE_VECTORS = false; // set to true to write response vectors
const bool WRITE_LOGGING = false; // set to true to write logging
const uint32_t PCAP_LINK_TYPE = 1187373554; // Some large random number -- we use to verify data was written by this program
const uint32_t PCAP_SNAPLEN = 64; // Don't bother to save much data
// ===========================================================================
// Tests of TCP implementation loss behavior
// ===========================================================================
//
class Ns3TcpStateTestCase : public TestCase
{
public:
Ns3TcpStateTestCase ();
Ns3TcpStateTestCase (uint32_t testCase);
virtual ~Ns3TcpStateTestCase () {}
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
std::string m_pcapFilename;
PcapFile m_pcapFile;
uint32_t m_testCase;
uint32_t m_totalTxBytes;
uint32_t m_currentTxBytes;
bool m_writeVectors;
bool m_writeResults;
bool m_writeLogging;
bool m_needToClose;
void Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace);
void StartFlow (Ptr<Socket> localSocket,
Ipv4Address servAddress,
uint16_t servPort);
};
Ns3TcpStateTestCase::Ns3TcpStateTestCase ()
: TestCase ("Check the operation of the TCP state machine for several cases"),
m_testCase (0),
m_totalTxBytes (20000),
m_currentTxBytes (0),
m_writeVectors (WRITE_VECTORS),
m_writeResults (false),
m_writeLogging (WRITE_LOGGING),
m_needToClose (true)
{
}
Ns3TcpStateTestCase::Ns3TcpStateTestCase (uint32_t testCase)
: TestCase ("Check the operation of the TCP state machine for several cases"),
m_testCase (testCase),
m_totalTxBytes (20000),
m_currentTxBytes (0),
m_writeVectors (WRITE_VECTORS),
m_writeResults (false),
m_writeLogging (WRITE_LOGGING),
m_needToClose (true)
{
}
void
Ns3TcpStateTestCase::DoSetup (void)
{
//
// We expect there to be a file called ns3tcp-state-response-vectors.pcap in
// response-vectors/ of this directory
//
std::ostringstream oss;
oss << "/response-vectors/ns3tcp-state" << m_testCase << "-response-vectors.pcap";
m_pcapFilename = static_cast<std::string> (NS_TEST_SOURCEDIR) + oss.str ();
if (m_writeVectors)
{
m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary);
m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN);
}
else
{
m_pcapFile.Open (m_pcapFilename, std::ios::in|std::ios::binary);
NS_ABORT_MSG_UNLESS (m_pcapFile.GetDataLinkType () == PCAP_LINK_TYPE, "Wrong response vectors in directory");
}
}
void
Ns3TcpStateTestCase::DoTeardown (void)
{
m_pcapFile.Close ();
}
void
Ns3TcpStateTestCase::Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface)
{
//
// We're not testing IP so remove and toss the header. In order to do this,
// though, we need to copy the packet since we have a const version.
//
Ptr<Packet> p = packet->Copy ();
Ipv4Header ipHeader;
p->RemoveHeader (ipHeader);
//
// What is left is the TCP header and any data that may be sent. We aren't
// sending any TCP data, so we expect what remains is only TCP header, which
// is a small thing to save.
//
if (m_writeVectors)
{
//
// Save the TCP under test response for later testing.
//
Time tNow = Simulator::Now ();
int64_t tMicroSeconds = tNow.GetMicroSeconds ();
uint32_t size = p->GetSize ();
uint8_t *buf = new uint8_t[size];
p->CopyData (buf, size);
m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000),
uint32_t (tMicroSeconds % 1000000),
buf,
size);
delete [] buf;
}
else
{
//
// Read the TCP under test expected response from the expected vector
// file and see if it still does the right thing.
//
uint8_t expected[PCAP_SNAPLEN];
uint32_t tsSec, tsUsec, inclLen, origLen, readLen;
m_pcapFile.Read (expected, sizeof(expected), tsSec, tsUsec, inclLen, origLen, readLen);
uint8_t *actual = new uint8_t[readLen];
p->CopyData (actual, readLen);
uint32_t result = memcmp (actual, expected, readLen);
delete [] actual;
//
// Avoid streams of errors -- only report the first.
//
if (IsStatusSuccess ())
{
NS_TEST_EXPECT_MSG_EQ (result, 0, "Expected data comparison error");
}
}
}
////////////////////////////////////////////////////////////////////
// Implementing an "application" to send bytes over a TCP connection
void
Ns3TcpStateTestCase::WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
{
while (m_currentTxBytes < m_totalTxBytes)
{
uint32_t left = m_totalTxBytes - m_currentTxBytes;
uint32_t dataOffset = m_currentTxBytes % 1040;
uint32_t toWrite = 1040 - dataOffset;
uint32_t txAvail = localSocket->GetTxAvailable ();
toWrite = std::min (toWrite, left);
toWrite = std::min (toWrite, txAvail);
if (txAvail == 0)
{
return;
};
if (m_writeLogging)
{
std::clog << "Submitting "
<< toWrite << " bytes to TCP socket" << std::endl;
}
int amountSent = localSocket->Send (0, toWrite, 0);
NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
m_currentTxBytes += amountSent;
}
if (m_needToClose)
{
if (m_writeLogging)
{
std::clog << "Close socket at "
<< Simulator::Now ().GetSeconds ()
<< std::endl;
}
localSocket->Close ();
m_needToClose = false;
}
}
void
Ns3TcpStateTestCase::StartFlow (Ptr<Socket> localSocket,
Ipv4Address servAddress,
uint16_t servPort)
{
if (m_writeLogging)
{
std::clog << "Starting flow at time "
<< Simulator::Now ().GetSeconds ()
<< std::endl;
}
localSocket->Connect (InetSocketAddress (servAddress, servPort)); // connect
// tell the tcp implementation to call WriteUntilBufferFull again
// if we blocked and new tx buffer space becomes available
localSocket->SetSendCallback (MakeCallback
(&Ns3TcpStateTestCase::WriteUntilBufferFull,
this));
WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
}
void
Ns3TcpStateTestCase::DoRun (void)
{
// Network topology
//
// 10Mb/s, 0.1ms 10Mb/s, 0.1ms
// n0-----------------n1-----------------n2
std::string tcpModel ("ns3::TcpNewReno");
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue (tcpModel));
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000));
Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (20));
if (m_writeLogging)
{
LogComponentEnableAll (LOG_PREFIX_FUNC);
LogComponentEnable ("TcpTestCases", LOG_LEVEL_ALL);
LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
LogComponentEnable ("TcpTestCases", LOG_LEVEL_ALL);
LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
LogComponentEnable ("TcpReno", LOG_LEVEL_INFO);
LogComponentEnable ("TcpTahoe", LOG_LEVEL_INFO);
LogComponentEnable ("TcpSocketBase", LOG_LEVEL_INFO);
}
////////////////////////////////////////////////////////
// Topology construction
//
// Create three nodes
NodeContainer n0n1;
n0n1.Create (2);
NodeContainer n1n2;
n1n2.Add (n0n1.Get (1));
n1n2.Create (1);
// Set up TCP/IP stack to all nodes (and create loopback device at device 0)
InternetStackHelper internet;
internet.InstallAll ();
// Connect the nodes
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (1000000)));
p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.0001)));
NetDeviceContainer dev0 = p2p.Install (n0n1);
NetDeviceContainer dev1 = p2p.Install (n1n2);
// Add IP addresses to each network interfaces
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
ipv4.Assign (dev0);
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
// Set up routes to all nodes
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
////////////////////////////////////////////////////////
// A flow from node n0 to node n2
//
// Create a packet sink to receive packets on node n2
uint16_t servPort = 50000; // Destination port number
PacketSinkHelper sink ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), servPort));
ApplicationContainer sinkApps = sink.Install (n1n2.Get (1));
sinkApps.Start (Seconds (0.0));
sinkApps.Stop (Seconds (100.0));
// Create a data source to send packets on node n0
// Instead of full application, here use the socket directly by
// registering callbacks in function StarFlow().
Ptr<Socket> localSocket = Socket::CreateSocket (n0n1.Get (0),
TcpSocketFactory::GetTypeId ());
localSocket->Bind ();
Simulator::ScheduleNow (&Ns3TcpStateTestCase::StartFlow, this,
localSocket, ipInterfs.GetAddress (1), servPort);
Config::Connect ("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
MakeCallback (&Ns3TcpStateTestCase::Ipv4L3Tx, this));
////////////////////////////////////////////////////////
// Set up different test cases: Lost model at node n1, different file size
//
std::list<uint32_t> dropListN0;
std::list<uint32_t> dropListN1;
std::string caseDescription;
switch (m_testCase)
{
case 0:
m_totalTxBytes = 1000;
caseDescription = "Verify connection establishment";
break;
case 1:
m_totalTxBytes = 100*1000;
caseDescription = "Verify a bigger (100 pkts) transfer: Sliding window operation, etc.";
break;
case 2:
m_totalTxBytes = 1000;
caseDescription = "Survive a SYN lost";
dropListN0.push_back (0);
break;
case 3:
m_totalTxBytes = 2000;
caseDescription = "Survive a SYN+ACK lost";
dropListN1.push_back (0);
break;
case 4:
m_totalTxBytes = 2000;
caseDescription = "Survive a ACK (last packet in 3-way handshake) lost";
dropListN0.push_back (1);
break;
case 5:
m_totalTxBytes = 0;
caseDescription = "Immediate FIN upon SYN_RCVD";
m_needToClose = false;
dropListN0.push_back (1); // Hide the ACK in 3WHS
Simulator::Schedule (Seconds (0.002), &Socket::Close, localSocket);
break;
case 6:
m_totalTxBytes = 5000;
caseDescription = "Simulated simultaneous close";
dropListN1.push_back (5); // Hide the ACK-to-FIN from n2
break;
case 7:
m_totalTxBytes = 5000;
caseDescription = "FIN check 1: Loss of initiator's FIN. Wait until app close";
m_needToClose = false;
dropListN0.push_back (7); // Hide the FIN from n0
Simulator::Schedule (Seconds (0.04), &Socket::Close, localSocket);
break;
case 8:
m_totalTxBytes = 5000;
caseDescription = "FIN check 2: Loss responder's FIN. FIN will be resent after last ack timeout";
dropListN1.push_back (6); // Hide the FIN from n2
break;
default:
NS_FATAL_ERROR ("Program fatal error: specified test case not supported: "
<< m_testCase);
break;
}
Ptr<ReceiveListErrorModel> errN0 = CreateObject<ReceiveListErrorModel> ();
errN0->SetList (dropListN0);
dev0.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (errN0));
Ptr<ReceiveListErrorModel> errN1 = CreateObject<ReceiveListErrorModel> ();
errN1->SetList (dropListN1);
dev1.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (errN1));
std::ostringstream oss;
oss << "tcp-state" << m_testCase << "-test-case";
if (m_writeResults)
{
p2p.EnablePcapAll (oss.str ());
p2p.EnableAsciiAll (oss.str ());
}
if (m_writeLogging)
{
Ptr<OutputStreamWrapper> osw = Create<OutputStreamWrapper> (&std::clog);
*(osw->GetStream ()) << std::setprecision (9) << std::fixed;
p2p.EnableAsciiAll (osw);
std::clog << std::endl << "Running TCP test-case " << m_testCase << ": "
<< caseDescription << std::endl;
}
// Finally, set up the simulator to run. The 1000 second hard limit is a
// failsafe in case some change above causes the simulation to never end
Simulator::Stop (Seconds (1000));
Simulator::Run ();
Simulator::Destroy ();
}
class Ns3TcpStateTestSuite : public TestSuite
{
public:
Ns3TcpStateTestSuite ();
};
Ns3TcpStateTestSuite::Ns3TcpStateTestSuite ()
: TestSuite ("ns3-tcp-state", SYSTEM)
{
Packet::EnablePrinting (); // Enable packet metadata for all test cases
AddTestCase (new Ns3TcpStateTestCase (0));
AddTestCase (new Ns3TcpStateTestCase (1));
AddTestCase (new Ns3TcpStateTestCase (2));
AddTestCase (new Ns3TcpStateTestCase (3));
AddTestCase (new Ns3TcpStateTestCase (4));
AddTestCase (new Ns3TcpStateTestCase (5));
AddTestCase (new Ns3TcpStateTestCase (6));
AddTestCase (new Ns3TcpStateTestCase (7));
AddTestCase (new Ns3TcpStateTestCase (8));
}
static Ns3TcpStateTestSuite ns3TcpLossTestSuite;
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-state-test-suite.cc | C++ | gpl2 | 15,192 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/csma-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/node-container.h"
#include "ns3/simulator.h"
#include "ns3tcp-socket-writer.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns3SocketTest");
// ===========================================================================
// Tests of TCP implementations from the application/socket perspective
// ===========================================================================
//
//
class Ns3TcpSocketTestCase1 : public TestCase
{
public:
Ns3TcpSocketTestCase1 ();
virtual ~Ns3TcpSocketTestCase1 () {}
private:
virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
TestVectors<uint32_t> m_inputs;
TestVectors<uint32_t> m_responses;
};
Ns3TcpSocketTestCase1::Ns3TcpSocketTestCase1 ()
: TestCase ("Check that ns-3 TCP successfully transfers an application data write of various sizes (point-to-point)"),
m_writeResults (false)
{
}
void
Ns3TcpSocketTestCase1::SinkRx (std::string path, Ptr<const Packet> p, const Address &address)
{
m_responses.Add (p->GetSize ());
}
void
Ns3TcpSocketTestCase1::DoRun (void)
{
uint16_t sinkPort = 50000;
double sinkStopTime = 40; // sec; will trigger Socket::Close
double writerStopTime = 30; // sec; will trigger Socket::Close
double simStopTime = 60; // sec
Time sinkStopTimeObj = Seconds (sinkStopTime);
Time writerStopTimeObj = Seconds (writerStopTime);
Time simStopTimeObj= Seconds (simStopTime);
Ptr<Node> n0 = CreateObject<Node> ();
Ptr<Node> n1 = CreateObject<Node> ();
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (n0, n1);
InternetStackHelper internet;
internet.InstallAll ();
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer ifContainer = address.Assign (devices);
Ptr<SocketWriter> socketWriter = CreateObject<SocketWriter> ();
Address sinkAddress (InetSocketAddress (ifContainer.GetAddress (1), sinkPort));
socketWriter->Setup (n0, sinkAddress);
n0->AddApplication (socketWriter);
socketWriter->SetStartTime (Seconds (0.));
socketWriter->SetStopTime (writerStopTimeObj);
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer apps = sink.Install (n1);
// Start the sink application at time zero, and stop it at sinkStopTime
apps.Start (Seconds (0.0));
apps.Stop (sinkStopTimeObj);
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&Ns3TcpSocketTestCase1::SinkRx, this));
Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter);
// Send 1, 10, 100, 1000 bytes
Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 1);
m_inputs.Add (1);
Simulator::Schedule (Seconds (12), &SocketWriter::Write, socketWriter, 10);
m_inputs.Add (10);
Simulator::Schedule (Seconds (14), &SocketWriter::Write, socketWriter, 100);
m_inputs.Add (100);
Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1000);
m_inputs.Add (536);
m_inputs.Add (464); // ns-3 TCP default segment size of 536
Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
if (m_writeResults)
{
pointToPoint.EnablePcapAll ("tcp-socket-test-case-1");
}
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
// Compare inputs and outputs
NS_TEST_ASSERT_MSG_EQ (m_inputs.GetN (), m_responses.GetN (), "Incorrect number of expected receive events");
for (uint32_t i = 0; i < m_responses.GetN (); i++)
{
uint32_t in = m_inputs.Get (i);
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
}
class Ns3TcpSocketTestCase2 : public TestCase
{
public:
Ns3TcpSocketTestCase2 ();
virtual ~Ns3TcpSocketTestCase2 () {}
private:
virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
TestVectors<uint32_t> m_inputs;
TestVectors<uint32_t> m_responses;
};
Ns3TcpSocketTestCase2::Ns3TcpSocketTestCase2 ()
: TestCase ("Check to see that ns-3 TCP successfully transfers an application data write of various sizes (CSMA)"),
m_writeResults (false)
{
}
void
Ns3TcpSocketTestCase2::SinkRx (std::string path, Ptr<const Packet> p, const Address &address)
{
m_responses.Add (p->GetSize ());
}
void
Ns3TcpSocketTestCase2::DoRun (void)
{
uint16_t sinkPort = 50000;
double sinkStopTime = 40; // sec; will trigger Socket::Close
double writerStopTime = 30; // sec; will trigger Socket::Close
double simStopTime = 60; // sec
Time sinkStopTimeObj = Seconds (sinkStopTime);
Time writerStopTimeObj = Seconds (writerStopTime);
Time simStopTimeObj= Seconds (simStopTime);
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000));
NodeContainer nodes;
nodes.Create (2);
Ptr<Node> n0 = nodes.Get (0);
Ptr<Node> n1 = nodes.Get (1);
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices;
devices = csma.Install (nodes);
InternetStackHelper internet;
internet.InstallAll ();
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer ifContainer = address.Assign (devices);
Ptr<SocketWriter> socketWriter = CreateObject<SocketWriter> ();
Address sinkAddress (InetSocketAddress (ifContainer.GetAddress (1), sinkPort));
socketWriter->Setup (n0, sinkAddress);
n0->AddApplication (socketWriter);
socketWriter->SetStartTime (Seconds (0.));
socketWriter->SetStopTime (writerStopTimeObj);
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer apps = sink.Install (n1);
// Start the sink application at time zero, and stop it at sinkStopTime
apps.Start (Seconds (0.0));
apps.Stop (sinkStopTimeObj);
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&Ns3TcpSocketTestCase2::SinkRx, this));
Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter);
// Send 1, 10, 100, 1000 bytes
// PointToPoint default MTU is 576 bytes, which leaves 536 bytes for TCP
Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 1);
m_inputs.Add (1);
Simulator::Schedule (Seconds (12), &SocketWriter::Write, socketWriter, 10);
m_inputs.Add (10);
Simulator::Schedule (Seconds (14), &SocketWriter::Write, socketWriter, 100);
m_inputs.Add (100);
Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1000);
m_inputs.Add (1000);
// Next packet will fragment
Simulator::Schedule (Seconds (16), &SocketWriter::Write, socketWriter, 1001);
m_inputs.Add (1000);
m_inputs.Add (1);
Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
if (m_writeResults)
{
csma.EnablePcapAll ("tcp-socket-test-case-2", false);
}
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
// Compare inputs and outputs
NS_TEST_ASSERT_MSG_EQ (m_inputs.GetN (), m_responses.GetN (), "Incorrect number of expected receive events");
for (uint32_t i = 0; i < m_responses.GetN (); i++)
{
uint32_t in = m_inputs.Get (i);
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
}
class Ns3TcpSocketTestSuite : public TestSuite
{
public:
Ns3TcpSocketTestSuite ();
};
Ns3TcpSocketTestSuite::Ns3TcpSocketTestSuite ()
: TestSuite ("ns3-tcp-socket", SYSTEM)
{
AddTestCase (new Ns3TcpSocketTestCase1);
AddTestCase (new Ns3TcpSocketTestCase2);
}
static Ns3TcpSocketTestSuite ns3TcpSocketTestSuite;
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-socket-test-suite.cc | C++ | gpl2 | 9,428 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include <iomanip>
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/node-container.h"
#include "ns3/simulator.h"
#include "ns3/error-model.h"
#include "ns3/pointer.h"
#include "ns3tcp-socket-writer.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("Ns3TcpLossTest");
const bool WRITE_VECTORS = false; // set to true to write response vectors
const bool WRITE_LOGGING = false; // set to true to write logging
const uint32_t PCAP_LINK_TYPE = 1187373557; // Some large random number -- we use to verify data was written by this program
const uint32_t PCAP_SNAPLEN = 64; // Don't bother to save much data
// ===========================================================================
// Tests of TCP implementation loss behavior
// ===========================================================================
//
class Ns3TcpLossTestCase : public TestCase
{
public:
Ns3TcpLossTestCase ();
Ns3TcpLossTestCase (std::string tcpModel, uint32_t testCase);
virtual ~Ns3TcpLossTestCase () {}
private:
virtual void DoSetup (void);
virtual void DoRun (void);
virtual void DoTeardown (void);
Ptr<OutputStreamWrapper> m_osw;
std::string m_pcapFilename;
PcapFile m_pcapFile;
uint32_t m_testCase;
uint32_t m_totalTxBytes;
uint32_t m_currentTxBytes;
bool m_writeVectors;
bool m_writeResults;
bool m_writeLogging;
bool m_needToClose;
std::string m_tcpModel;
void Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface);
void CwndTracer (uint32_t oldval, uint32_t newval);
void WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace);
void StartFlow (Ptr<Socket> localSocket,
Ipv4Address servAddress,
uint16_t servPort);
};
Ns3TcpLossTestCase::Ns3TcpLossTestCase ()
: TestCase ("Check the operation of the TCP state machine for several cases"),
m_testCase (0),
m_totalTxBytes (200000),
m_currentTxBytes (0),
m_writeVectors (WRITE_VECTORS),
m_writeResults (false),
m_writeLogging (WRITE_LOGGING),
m_needToClose (true),
m_tcpModel ("ns3::TcpTahoe")
{
}
Ns3TcpLossTestCase::Ns3TcpLossTestCase (std::string tcpModel, uint32_t testCase)
: TestCase ("Check the behaviour of TCP upon packet losses"),
m_testCase (testCase),
m_totalTxBytes (200000),
m_currentTxBytes (0),
m_writeVectors (WRITE_VECTORS),
m_writeResults (false),
m_writeLogging (WRITE_LOGGING),
m_needToClose (true),
m_tcpModel (tcpModel)
{
}
void
Ns3TcpLossTestCase::DoSetup (void)
{
//
// We expect there to be a file called ns3tcp-state-response-vectors.pcap in
// response-vectors/ of this directory
//
std::ostringstream oss;
oss << "/response-vectors/ns3tcp-loss-" << m_tcpModel << m_testCase << "-response-vectors.pcap";
m_pcapFilename = CreateDataDirFilename(oss.str ());
if (m_writeVectors)
{
m_pcapFile.Open (m_pcapFilename, std::ios::out|std::ios::binary);
m_pcapFile.Init (PCAP_LINK_TYPE, PCAP_SNAPLEN);
}
else
{
m_pcapFile.Open (m_pcapFilename, std::ios::in|std::ios::binary);
NS_ABORT_MSG_UNLESS (m_pcapFile.GetDataLinkType () == PCAP_LINK_TYPE, "Wrong response vectors in directory");
}
}
void
Ns3TcpLossTestCase::DoTeardown (void)
{
m_pcapFile.Close ();
}
void
Ns3TcpLossTestCase::Ipv4L3Tx (std::string context, Ptr<const Packet> packet, Ptr<Ipv4> ipv4, uint32_t interface)
{
//
// We're not testing IP so remove and toss the header. In order to do this,
// though, we need to copy the packet since we have a const version.
//
Ptr<Packet> p = packet->Copy ();
Ipv4Header ipHeader;
p->RemoveHeader (ipHeader);
//
// What is left is the TCP header and any data that may be sent. We aren't
// sending any TCP data, so we expect what remains is only TCP header, which
// is a small thing to save.
//
if (m_writeVectors)
{
//
// Save the TCP under test response for later testing.
//
Time tNow = Simulator::Now ();
int64_t tMicroSeconds = tNow.GetMicroSeconds ();
uint32_t size = p->GetSize ();
uint8_t *buf = new uint8_t[size];
p->CopyData (buf, size);
m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000),
uint32_t (tMicroSeconds % 1000000),
buf,
size);
delete [] buf;
}
else
{
//
// Read the TCP under test expected response from the expected vector
// file and see if it still does the right thing.
//
uint8_t expected[PCAP_SNAPLEN];
uint32_t tsSec, tsUsec, inclLen, origLen, readLen;
m_pcapFile.Read (expected, sizeof(expected), tsSec, tsUsec, inclLen, origLen, readLen);
NS_LOG_DEBUG ("read " << readLen);
uint8_t *actual = new uint8_t[readLen];
p->CopyData (actual, readLen);
uint32_t result = memcmp (actual, expected, readLen);
delete [] actual;
//
// Avoid streams of errors -- only report the first.
//
if (IsStatusSuccess ())
{
NS_TEST_EXPECT_MSG_EQ (result, 0, "Expected data comparison error");
}
}
}
void
Ns3TcpLossTestCase::CwndTracer (uint32_t oldval, uint32_t newval)
{
if (m_writeLogging)
{
*(m_osw->GetStream ()) << "Moving cwnd from " << oldval << " to " << newval
<< " at time " << Simulator::Now ().GetSeconds ()
<< " seconds" << std::endl;
}
}
////////////////////////////////////////////////////////////////////
// Implementing an "application" to send bytes over a TCP connection
void
Ns3TcpLossTestCase::WriteUntilBufferFull (Ptr<Socket> localSocket, uint32_t txSpace)
{
while (m_currentTxBytes < m_totalTxBytes)
{
uint32_t left = m_totalTxBytes - m_currentTxBytes;
uint32_t dataOffset = m_currentTxBytes % 1040;
uint32_t toWrite = 1040 - dataOffset;
uint32_t txAvail = localSocket->GetTxAvailable ();
toWrite = std::min (toWrite, left);
toWrite = std::min (toWrite, txAvail);
if (txAvail == 0)
{
return;
};
if (m_writeLogging)
{
std::clog << "Submitting " << toWrite
<< " bytes to TCP socket" << std::endl;
}
int amountSent = localSocket->Send (0, toWrite, 0);
NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero
m_currentTxBytes += amountSent;
}
if (m_needToClose)
{
if (m_writeLogging)
{
std::clog << "Close socket at "
<< Simulator::Now ().GetSeconds () << std::endl;
}
localSocket->Close ();
m_needToClose = false;
}
}
void
Ns3TcpLossTestCase::StartFlow (Ptr<Socket> localSocket,
Ipv4Address servAddress,
uint16_t servPort)
{
if (m_writeLogging)
{
std::clog << "Starting flow at time "
<< Simulator::Now ().GetSeconds () << std::endl;
}
localSocket->Connect (InetSocketAddress (servAddress, servPort)); // connect
// tell the tcp implementation to call WriteUntilBufferFull again
// if we blocked and new tx buffer space becomes available
localSocket->SetSendCallback (MakeCallback
(&Ns3TcpLossTestCase::WriteUntilBufferFull,
this));
WriteUntilBufferFull (localSocket, localSocket->GetTxAvailable ());
}
void
Ns3TcpLossTestCase::DoRun (void)
{
// Network topology
//
// 8Mb/s, 0.1ms 0.8Mb/s, 100ms
// s1-----------------r1-----------------k1
//
// Example corresponding to simulations in the paper "Simulation-based
// Comparisons of Tahoe, Reno, and SACK TCP
std::ostringstream tcpModel;
tcpModel << "ns3::Tcp" << m_tcpModel;
Config::SetDefault ("ns3::TcpL4Protocol::SocketType",
StringValue (tcpModel.str ()));
Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000));
Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
if (m_writeLogging)
{
LogComponentEnableAll (LOG_PREFIX_FUNC);
LogComponentEnable ("TcpLossResponse", LOG_LEVEL_ALL);
LogComponentEnable ("ErrorModel", LOG_LEVEL_DEBUG);
LogComponentEnable ("TcpLossResponse", LOG_LEVEL_ALL);
LogComponentEnable ("TcpNewReno", LOG_LEVEL_INFO);
LogComponentEnable ("TcpReno", LOG_LEVEL_INFO);
LogComponentEnable ("TcpTahoe", LOG_LEVEL_INFO);
LogComponentEnable ("TcpSocketBase", LOG_LEVEL_INFO);
}
////////////////////////////////////////////////////////
// Topology construction
//
// Create three nodes: s1, r1, and k1
NodeContainer s1r1;
s1r1.Create (2);
NodeContainer r1k1;
r1k1.Add (s1r1.Get (1));
r1k1.Create (1);
// Set up TCP/IP stack to all nodes (and create loopback device at device 0)
InternetStackHelper internet;
internet.InstallAll ();
// Connect the nodes
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (8000000)));
p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.0001)));
NetDeviceContainer dev0 = p2p.Install (s1r1);
p2p.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (800000)));
p2p.SetChannelAttribute ("Delay", TimeValue (Seconds (0.1)));
NetDeviceContainer dev1 = p2p.Install (r1k1);
// Add IP addresses to each network interfaces
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
ipv4.Assign (dev0);
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer ipInterfs = ipv4.Assign (dev1);
// Set up routes to all nodes
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
////////////////////////////////////////////////////////
// Send 20000 (totalTxBytes) bytes from node s1 to node k1
//
// Create a packet sink to receive packets on node k1
uint16_t servPort = 50000; // Destination port number
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), servPort));
ApplicationContainer apps = sink.Install (r1k1.Get (1));
apps.Start (Seconds (0.0));
apps.Stop (Seconds (100.0));
// Create a data source to send packets on node s0.
// Instead of full application, here use the socket directly by
// registering callbacks in function StarFlow().
Ptr<Socket> localSocket = Socket::CreateSocket (s1r1.Get (0), TcpSocketFactory::GetTypeId ());
localSocket->Bind ();
Simulator::ScheduleNow (&Ns3TcpLossTestCase::StartFlow,
this,
localSocket,
ipInterfs.GetAddress (1),
servPort);
Config::Connect ("/NodeList/0/$ns3::Ipv4L3Protocol/Tx",
MakeCallback (&Ns3TcpLossTestCase::Ipv4L3Tx, this));
Config::ConnectWithoutContext
("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
MakeCallback (&Ns3TcpLossTestCase::CwndTracer, this));
////////////////////////////////////////////////////////
// Set up loss model at node k1
//
std::list<uint32_t> sampleList;
switch (m_testCase)
{
case 0:
break;
case 1:
// Force a loss for 15th data packet. TCP cwnd will be at 14 segments
// (14000 bytes) when duplicate acknowledgments start to come.
sampleList.push_back (16);
break;
case 2:
sampleList.push_back (16);
sampleList.push_back (17);
break;
case 3:
sampleList.push_back (16);
sampleList.push_back (17);
sampleList.push_back (18);
break;
case 4:
sampleList.push_back (16);
sampleList.push_back (17);
sampleList.push_back (18);
sampleList.push_back (19);
break;
default:
NS_FATAL_ERROR ("Program fatal error: loss value " << m_testCase << " not supported.");
break;
}
Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> ();
pem->SetList (sampleList);
dev1.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
// One can toggle the comment for the following line on or off to see the
// effects of finite send buffer modelling. One can also change the size of
// that buffer.
// localSocket->SetAttribute("SndBufSize", UintegerValue(4096));
std::ostringstream oss;
oss << "tcp-loss-" << m_tcpModel << m_testCase << "-test-case";
if (m_writeResults)
{
p2p.EnablePcapAll (oss.str ());
p2p.EnableAsciiAll (oss.str ());
}
std::ostringstream oss2;
oss2 << "src/test/ns3tcp/Tcp" << m_tcpModel << "." << m_testCase << ".log";
AsciiTraceHelper ascii;
if (m_writeLogging)
{
m_osw = ascii.CreateFileStream (oss2.str ());
*(m_osw->GetStream ()) << std::setprecision (9) << std::fixed;
p2p.EnableAsciiAll (m_osw);
}
// Finally, set up the simulator to run. The 1000 second hard limit is a
// failsafe in case some change above causes the simulation to never end
Simulator::Stop (Seconds (1000));
Simulator::Run ();
Simulator::Destroy ();
}
class Ns3TcpLossTestSuite : public TestSuite
{
public:
Ns3TcpLossTestSuite ();
};
Ns3TcpLossTestSuite::Ns3TcpLossTestSuite ()
: TestSuite ("ns3-tcp-loss", SYSTEM)
{
SetDataDir (NS_TEST_SOURCEDIR);
Packet::EnablePrinting (); // Enable packet metadata for all test cases
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 0));
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 1));
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 2));
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 3));
AddTestCase (new Ns3TcpLossTestCase ("Tahoe", 4));
AddTestCase (new Ns3TcpLossTestCase ("Reno", 0));
AddTestCase (new Ns3TcpLossTestCase ("Reno", 1));
AddTestCase (new Ns3TcpLossTestCase ("Reno", 2));
AddTestCase (new Ns3TcpLossTestCase ("Reno", 3));
AddTestCase (new Ns3TcpLossTestCase ("Reno", 4));
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 0));
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 1));
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 2));
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 3));
AddTestCase (new Ns3TcpLossTestCase ("NewReno", 4));
}
static Ns3TcpLossTestSuite ns3TcpLossTestSuite;
| zy901002-gpsr | src/test/ns3tcp/ns3tcp-loss-test-suite.cc | C++ | gpl2 | 15,467 |
/**
* \ingroup tests
* \defgroup Ns3TcpTests ns-3 TCP Implementation Tests
*
* \section Ns3TcpTestsOverview ns-3 Tcp Implementation Tests Overview
*
* Includes tests of ns-3 TCP as well as tests involving the mix
* of ns-3 and Network Simulation Cradle (nsc) TCP models.
*/
| zy901002-gpsr | src/test/ns3tcp/ns3tcp.h | C | gpl2 | 282 |
###
# *
# * Copyright (c) 2010 Adrian Sai-wah Tam
# *
# * 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
# *
# * This gnuplot file is used to plot a number of graphs from the
# * Ns3TcpLossTestCases. In order to run this properly, the
# * logging output from Ns3TcpLossTest case must first be enabled
# * by manually editing ns3-tcp-loss-test-suite.cc and setting
# * WRITE_LOGGING to true. Then, the test suite should be re-run
# * with ./waf --run "test-runner --suite='ns3-tcp-loss'"
# * This will generate a number of log files which are parsed
# * below for eventual plotting to .eps format using gnuplot.
# * To run this file in gnuplot, simply: gnuplot plot.gp
###
set key left
set terminal postscript eps enhanced color
set yrange [0:100000]
set xrange [0:3.5]
set xtics 0.5
set mxtics 2
set mytics 2
set grid mxtics xtics ytics mytics
set output "TcpNewReno.0.eps"
plot \
"< grep ^r TcpNewReno.0.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%100000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpNewReno.0.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpReno.0.eps"
plot \
"< grep ^r TcpReno.0.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%100000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpReno.0.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpTahoe.0.eps"
plot \
"< grep ^r TcpTahoe.0.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%100000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpTahoe.0.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set yrange [0:25000]
set xrange [0:5.5]
set output "TcpNewReno.1.eps"
plot \
"< grep ^r TcpNewReno.1.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%25000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpNewReno.1.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpReno.1.eps"
plot \
"< grep ^r TcpReno.1.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%25000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpReno.1.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpTahoe.1.eps"
plot \
"< grep ^r TcpTahoe.1.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%25000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpTahoe.1.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set yrange [0:30000]
set output "TcpNewReno.2.eps"
plot \
"< grep ^r TcpNewReno.2.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%30000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpNewReno.2.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpReno.2.eps"
plot \
"< grep ^r TcpReno.2.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%30000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpReno.2.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpTahoe.2.eps"
plot \
"< grep ^r TcpTahoe.2.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%30000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpTahoe.2.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set yrange [0:35000]
set xrange [0:6.0]
set output "TcpNewReno.3.eps"
plot \
"< grep ^r TcpNewReno.3.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%35000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpNewReno.3.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpReno.3.eps"
plot \
"< grep ^r TcpReno.3.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%35000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpReno.3.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpTahoe.3.eps"
plot \
"< grep ^r TcpTahoe.3.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%35000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpTahoe.3.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set yrange [0:40000]
set xrange [0:6.5]
set output "TcpNewReno.4.eps"
plot \
"< grep ^r TcpNewReno.4.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%40000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpNewReno.4.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpReno.4.eps"
plot \
"< grep ^r TcpReno.4.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%40000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpReno.4.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
set output "TcpTahoe.4.eps"
plot \
"< grep ^r TcpTahoe.4.log | perl trTidy.pl | grep N0 | perl -ne 's/^..//;s/\t.*Ack=/ /;s/ Win.*$//;split;print $_[0].q{ }.($_[1]%40000).q{\n}'" using 1:2 w p pt 2 lc rgb "#00FF00" title "ack", \
"< grep cwnd TcpTahoe.4.log | grep seconds | perl -pe 's/^.*to //;s/ at time / /;s/ seconds//'" using 2:1 w p pt 1 lc rgb "#FF0000" title "cwnd"
| zy901002-gpsr | src/test/ns3tcp/plot.gp | Gnuplot | gpl2 | 7,330 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 University of Washington
*
* 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
*/
#include "ns3/log.h"
#include "ns3/abort.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/data-rate.h"
#include "ns3/inet-socket-address.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/tcp-socket-factory.h"
#include "ns3/node-container.h"
#include "ns3/simulator.h"
#include "ns3/error-model.h"
#include "ns3/pointer.h"
#include "../ns3tcp/ns3tcp-socket-writer.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("NscTcpLossTest");
// ===========================================================================
// Tests of TCP implementation loss behavior
// ===========================================================================
//
class NscTcpLossTestCase1 : public TestCase
{
public:
NscTcpLossTestCase1 ();
virtual ~NscTcpLossTestCase1 () {}
private:
virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
TestVectors<uint32_t> m_inputs;
TestVectors<uint32_t> m_responses;
};
NscTcpLossTestCase1::NscTcpLossTestCase1 ()
: TestCase ("Check that nsc TCP survives loss of first two SYNs"),
m_writeResults (false)
{
}
void
NscTcpLossTestCase1::SinkRx (std::string path, Ptr<const Packet> p, const Address &address)
{
m_responses.Add (p->GetSize ());
}
void
NscTcpLossTestCase1::DoRun (void)
{
uint16_t sinkPort = 50000;
double sinkStopTime = 40; // sec; will trigger Socket::Close
double writerStopTime = 30; // sec; will trigger Socket::Close
double simStopTime = 60; // sec
Time sinkStopTimeObj = Seconds (sinkStopTime);
Time writerStopTimeObj = Seconds (writerStopTime);
Time simStopTimeObj= Seconds (simStopTime);
Ptr<Node> n0 = CreateObject<Node> ();
Ptr<Node> n1 = CreateObject<Node> ();
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("200ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (n0, n1);
InternetStackHelper internet;
internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so"));
internet.InstallAll ();
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer ifContainer = address.Assign (devices);
Ptr<SocketWriter> socketWriter = CreateObject<SocketWriter> ();
Address sinkAddress (InetSocketAddress (ifContainer.GetAddress (1), sinkPort));
socketWriter->Setup (n0, sinkAddress);
n0->AddApplication (socketWriter);
socketWriter->SetStartTime (Seconds (0.));
socketWriter->SetStopTime (writerStopTimeObj);
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer apps = sink.Install (n1);
// Start the sink application at time zero, and stop it at sinkStopTime
apps.Start (Seconds (0.0));
apps.Stop (sinkStopTimeObj);
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&NscTcpLossTestCase1::SinkRx, this));
Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter);
Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500);
m_inputs.Add (500);
Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
std::list<uint32_t> sampleList;
// Lose first two SYNs
sampleList.push_back (0);
sampleList.push_back (1);
// This time, we'll explicitly create the error model we want
Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> ();
pem->SetList (sampleList);
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
if (m_writeResults)
{
pointToPoint.EnablePcapAll ("nsc-tcp-loss-test-case-1");
pointToPoint.EnableAsciiAll ("nsc-tcp-loss-test-case-1");
}
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
// Compare inputs and outputs
NS_TEST_ASSERT_MSG_EQ (m_inputs.GetN (), m_responses.GetN (), "Incorrect number of expected receive events");
for (uint32_t i = 0; i < m_responses.GetN (); i++)
{
uint32_t in = m_inputs.Get (i);
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
}
class NscTcpLossTestCase2 : public TestCase
{
public:
NscTcpLossTestCase2 ();
virtual ~NscTcpLossTestCase2 () {}
private:
virtual void DoRun (void);
bool m_writeResults;
void SinkRx (std::string path, Ptr<const Packet> p, const Address &address);
TestVectors<uint32_t> m_inputs;
TestVectors<uint32_t> m_responses;
};
NscTcpLossTestCase2::NscTcpLossTestCase2 ()
: TestCase ("Check that nsc TCP survives loss of first data packet"),
m_writeResults (false)
{
}
void
NscTcpLossTestCase2::SinkRx (std::string path, Ptr<const Packet> p, const Address &address)
{
m_responses.Add (p->GetSize ());
}
void
NscTcpLossTestCase2::DoRun (void)
{
uint16_t sinkPort = 50000;
double sinkStopTime = 40; // sec; will trigger Socket::Close
double writerStopTime = 12; // sec; will trigger Socket::Close
double simStopTime = 60; // sec
Time sinkStopTimeObj = Seconds (sinkStopTime);
Time writerStopTimeObj = Seconds (writerStopTime);
Time simStopTimeObj= Seconds (simStopTime);
Ptr<Node> n0 = CreateObject<Node> ();
Ptr<Node> n1 = CreateObject<Node> ();
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("200ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (n0, n1);
InternetStackHelper internet;
internet.SetTcp ("ns3::NscTcpL4Protocol", "Library", StringValue ("liblinux2.6.26.so"));
internet.InstallAll ();
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer ifContainer = address.Assign (devices);
Ptr<SocketWriter> socketWriter = CreateObject<SocketWriter> ();
Address sinkAddress (InetSocketAddress (ifContainer.GetAddress (1), sinkPort));
socketWriter->Setup (n0, sinkAddress);
n0->AddApplication (socketWriter);
socketWriter->SetStartTime (Seconds (0.));
socketWriter->SetStopTime (writerStopTimeObj);
PacketSinkHelper sink ("ns3::TcpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), sinkPort));
ApplicationContainer apps = sink.Install (n1);
// Start the sink application at time zero, and stop it at sinkStopTime
apps.Start (Seconds (0.0));
apps.Stop (sinkStopTimeObj);
Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",
MakeCallback (&NscTcpLossTestCase2::SinkRx, this));
Simulator::Schedule (Seconds (2), &SocketWriter::Connect, socketWriter);
Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500);
m_inputs.Add (500);
Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
std::list<uint32_t> sampleList;
// Lose first data segment
sampleList.push_back (2);
// This time, we'll explicitly create the error model we want
Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> ();
pem->SetList (sampleList);
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem));
if (m_writeResults)
{
pointToPoint.EnablePcapAll ("nsc-tcp-loss-test-case-2");
pointToPoint.EnableAsciiAll ("nsc-tcp-loss-test-case-2");
}
Simulator::Stop (simStopTimeObj);
Simulator::Run ();
Simulator::Destroy ();
// Compare inputs and outputs
NS_TEST_ASSERT_MSG_EQ (m_inputs.GetN (), m_responses.GetN (), "Incorrect number of expected receive events");
for (uint32_t i = 0; i < m_responses.GetN (); i++)
{
uint32_t in = m_inputs.Get (i);
uint32_t out = m_responses.Get (i);
NS_TEST_ASSERT_MSG_EQ (in, out, "Mismatch: expected " << in << " bytes, got " << out << " bytes");
}
}
class NscTcpLossTestSuite : public TestSuite
{
public:
NscTcpLossTestSuite ();
};
NscTcpLossTestSuite::NscTcpLossTestSuite ()
: TestSuite ("nsc-tcp-loss", SYSTEM)
{
AddTestCase (new NscTcpLossTestCase1);
AddTestCase (new NscTcpLossTestCase2);
}
static NscTcpLossTestSuite nscTcpLossTestSuite;
| zy901002-gpsr | src/test/ns3tcp/nsctcp-loss-test-suite.cc | C++ | gpl2 | 9,283 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys
def configure(conf):
# Add the ns3tcp module to the list of enabled modules that
# should not be built if this is a static build on Darwin. They
# don't work there for the ns3tcp module, and this is probably
# because the ns3tcp module has no source files.
if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin':
conf.env['MODULES_NOT_BUILT'].append('ns3tcp')
def build(bld):
# Don't do anything for this module if it should not be built.
if 'ns3tcp' in bld.env['MODULES_NOT_BUILT']:
return
ns3tcp = bld.create_ns3_module('ns3tcp', ['internet', 'point-to-point', 'csma', 'applications'])
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'ns3tcp'
headers.source = [
'ns3tcp.h',
]
ns3tcp_test = bld.create_ns3_module_test_library('ns3tcp')
ns3tcp_test.source = [
'ns3tcp-socket-writer.cc',
'ns3tcp-socket-test-suite.cc',
'ns3tcp-loss-test-suite.cc',
'ns3tcp-state-test-suite.cc',
]
if bld.env['NSC_ENABLED']:
ns3tcp_test.source.append ('ns3tcp-interop-test-suite.cc')
ns3tcp_test.source.append ('ns3tcp-cwnd-test-suite.cc')
ns3tcp_test.source.append ('nsctcp-loss-test-suite.cc')
| zy901002-gpsr | src/test/ns3tcp/wscript | Python | gpl2 | 1,358 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// 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: George F. Riley <riley@ece.gatech.edu>
// Author: Lalith Suresh <suresh.lalith@gmail.com>
//
#ifndef IPV4_L3_CLICK_PROTOCOL_H
#define IPV4_L3_CLICK_PROTOCOL_H
#include "ns3/ipv4.h"
#include "ns3/net-device.h"
#include "ns3/packet.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/traced-callback.h"
#include "ns3/ipv4-interface.h"
#include "ns3/log.h"
namespace ns3 {
class Packet;
class NetDevice;
class Ipv4Interface;
class Ipv4Address;
class Ipv4Header;
class Ipv4RoutingTableEntry;
class Ipv4Route;
class Node;
class Socket;
class Ipv4RawSocketImpl;
class Ipv4L4Protocol;
class Icmpv4L4Protocol;
/**
* \brief Implement the Ipv4 layer specifically for Click nodes
* to allow a clean integration of Click.
* \ingroup click
*
* This is code is mostly repeated from the Ipv4L3Protocol implementation.
* Changes include:
* - A stripped down version of Send().
* - A stripped down version of Receive().
* - A public version of LocalDeliver().
* - Modifications to AddInterface().
*/
class Ipv4L3ClickProtocol : public Ipv4
{
#ifdef NS3_CLICK
public:
static TypeId GetTypeId (void);
/**
* Protocol number for Ipv4 L3 (0x0800).
*/
static const uint16_t PROT_NUMBER;
Ipv4L3ClickProtocol ();
virtual ~Ipv4L3ClickProtocol ();
/**
* \param protocol a template for the protocol to add to this L4 Demux.
* \returns the L4Protocol effectively added.
*
* Invoke Copy on the input template to get a copy of the input
* protocol which can be used on the Node on which this L4 Demux
* is running. The new L4Protocol is registered internally as
* a working L4 Protocol and returned from this method.
* The caller does not get ownership of the returned pointer.
*/
void Insert (Ptr<Ipv4L4Protocol> protocol);
/**
* \param protocolNumber number of protocol to lookup
* in this L4 Demux
* \returns a matching L4 Protocol
*
* This method is typically called by lower layers
* to forward packets up the stack to the right protocol.
* It is also called from NodeImpl::GetUdp for example.
*/
Ptr<Ipv4L4Protocol> GetProtocol (int protocolNumber) const;
/**
* \param ttl default ttl to use
*
* When we need to send an ipv4 packet, we use this default
* ttl value.
*/
void SetDefaultTtl (uint8_t ttl);
/**
* \param packet packet to send
* \param source source address of packet
* \param destination address of packet
* \param protocol number of packet
* \param route route entry
*
* Higher-level layers call this method to send a packet
* to Click
*/
void Send (Ptr<Packet> packet, Ipv4Address source,
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
/**
* \param packet packet to send down the stack
* \param ifid interface to be used for sending down packet
*
* Ipv4ClickRouting calls this method to send a packet further
* down the stack
*/
void SendDown (Ptr<Packet> packet, int ifid);
/**
* Lower layer calls this method to send a packet to Click
* \param device network device
* \param p the packet
* \param protocol protocol value
* \param from address of the correspondant
* \param to address of the destination
* \param packetType type of the packet
*/
void Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
const Address &to, NetDevice::PacketType packetType);
/**
* Ipv4ClickRouting calls this to locally deliver a packet
* \param p the packet
* \param ip The Ipv4Header of the packet
* \param iif The interface on which the packet was received
*/
void LocalDeliver (Ptr<const Packet> p, Ipv4Header const&ip, uint32_t iif);
/**
* Get a pointer to the i'th Ipv4Interface
* \param i index of interface, pointer to which is to be returned
* \returns Pointer to the i'th Ipv4Interface if any.
*/
Ptr<Ipv4Interface> GetInterface (uint32_t i) const;
/**
* Adds an Ipv4Interface to the interfaces list
* \param interface Pointer to the Ipv4Interface to be added
* \returns Index of the device which was added
*/
uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
/**
* Calls m_node = node and sets up Loopback if needed
* \param node Pointer to the node
*/
void SetNode (Ptr<Node> node);
/**
* Returns the Icmpv4L4Protocol for the node
* \returns Icmpv4L4Protocol instance of the node
*/
Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
/**
* Sets up a Loopback device
*/
void SetupLoopback (void);
/**
* Creates a raw-socket
* \returns Pointer to the created socket
*/
Ptr<Socket> CreateRawSocket (void);
/**
* Deletes a particular raw socket
* \param socket Pointer of socket to be deleted
*/
void DeleteRawSocket (Ptr<Socket> socket);
// functions defined in base class Ipv4
void SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol);
Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (void) const;
Ptr<NetDevice> GetNetDevice (uint32_t i);
uint32_t AddInterface (Ptr<NetDevice> device);
uint32_t GetNInterfaces (void) const;
int32_t GetInterfaceForAddress (Ipv4Address addr) const;
int32_t GetInterfaceForPrefix (Ipv4Address addr, Ipv4Mask mask) const;
int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
bool IsDestinationAddress (Ipv4Address address, uint32_t iif) const;
bool AddAddress (uint32_t i, Ipv4InterfaceAddress address);
Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
uint32_t GetNAddresses (uint32_t interface) const;
bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
Ipv4Address SelectSourceAddress (Ptr<const NetDevice> device,
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope);
void SetMetric (uint32_t i, uint16_t metric);
uint16_t GetMetric (uint32_t i) const;
uint16_t GetMtu (uint32_t i) const;
bool IsUp (uint32_t i) const;
void SetUp (uint32_t i);
void SetDown (uint32_t i);
bool IsForwarding (uint32_t i) const;
void SetForwarding (uint32_t i, bool val);
void SetPromisc (uint32_t i);
protected:
virtual void DoDispose (void);
/**
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
private:
Ipv4Header BuildHeader (
Ipv4Address source,
Ipv4Address destination,
uint8_t protocol,
uint16_t payloadSize,
uint8_t ttl,
bool mayFragment);
virtual void SetIpForward (bool forward);
virtual bool GetIpForward (void) const;
virtual void SetWeakEsModel (bool model);
virtual bool GetWeakEsModel (void) const;
typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
typedef std::list<Ptr<Ipv4L4Protocol> > L4List_t;
Ptr<Ipv4RoutingProtocol> m_routingProtocol;
bool m_ipForward;
bool m_weakEsModel;
L4List_t m_protocols;
Ipv4InterfaceList m_interfaces;
uint8_t m_defaultTtl;
uint16_t m_identification;
Ptr<Node> m_node;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_sendOutgoingTrace;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_unicastForwardTrace;
TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_localDeliverTrace;
SocketList m_sockets;
std::vector<bool> m_promiscDeviceList;
#endif /* NS3_CLICK */
};
} // namespace ns3
#endif /* IPV4_L3_CLICK_ROUTING_H */
| zy901002-gpsr | src/click/model/ipv4-l3-click-protocol.h | C++ | gpl2 | 8,471 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Lalith Suresh
*
* 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
#ifndef IPV4_CLICK_ROUTING_H
#define IPV4_CLICK_ROUTING_H
#include "ns3/object.h"
#include "ns3/packet.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/test.h"
#include <sys/time.h>
#include <sys/types.h>
#ifdef NS3_CLICK
#include <click/simclick.h>
#endif
#include <map>
#include <string>
namespace ns3 {
/**
* \defgroup click Click Routing
* This section documents the API of the ns-3 click module. For a generic functional description, please refer to the ns-3 manual.
*/
/**
* \ingroup click
* \brief Class to allow a node to use Click for external routing
*/
class Ipv4ClickRouting : public Ipv4RoutingProtocol
{
#ifdef NS3_CLICK
public:
// Allow test cases to access private members
friend class ClickTrivialTest;
friend class ClickIfidFromNameTest;
friend class ClickIpMacAddressFromNameTest;
static TypeId GetTypeId (void);
Ipv4ClickRouting ();
virtual ~Ipv4ClickRouting ();
protected:
virtual void DoStart (void);
public:
virtual void DoDispose ();
/**
* \brief Click configuration file to be used by the node's Click Instance.
* \param clickfile name of .click configuration file
*/
void SetClickFile (std::string clickfile);
/**
* \brief Name of the node as to be used by Click. Required for Click Dumps.
* \param name Name to be assigned to the node.
*/
void SetNodeName (std::string name);
/**
* \brief Name of the routing table element being used by Click. Required for RouteOutput ()
* \param name Name of the routing table element.
*/
void SetClickRoutingTableElement (std::string name);
/**
* \brief Read Handler interface for a node's Click Elements.
* Allows a user to read state information of a Click element.
* \param elementName name of the Click element
* \param handlerName name of the handler to be read
*/
std::string ReadHandler (std::string elementName, std::string handlerName);
/**
* \brief Write Handler interface for a node's Click Elements
* Allows a user to modify state information of a Click element.
* \param elementName name of the Click element
* \param handlerName name of the handler to be read
* \param writeString string to be written using the write handler
*/
int WriteHandler (std::string elementName, std::string handlerName, std::string writeString);
/**
*
* \brief Sets an interface to run on promiscuous mode.
*/
void SetPromisc (int ifid);
private:
simclick_node_t *m_simNode;
/**
* \brief Provide a mapping between the node reference used by Click and the corresponding Ipv4ClickRouting instance.
*/
static std::map < simclick_node_t *, Ptr<Ipv4ClickRouting> > m_clickInstanceFromSimNode;
public:
/**
* \brief Allows the Click service methods, which reside outside Ipv4ClickRouting, to get the required Ipv4ClickRouting instances.
* \param simnode The Click simclick_node_t instance for which the Ipv4ClickRouting instance is required
* \return A Ptr to the required Ipv4ClickRouting instance
*/
static Ptr<Ipv4ClickRouting> GetClickInstanceFromSimNode (simclick_node_t *simnode);
public:
/**
* \brief Provides for SIMCLICK_IFID_FROM_NAME
* \param ifname The name of the interface
* \return The interface ID which corresponds to ifname
*/
int GetInterfaceId (const char *ifname);
/**
* \brief Provides for SIMCLICK_IPADDR_FROM_NAME
* \param ifid The interface ID for which the IP Address is required
* \return The IP Address of the interface in string format
*/
std::string GetIpAddressFromInterfaceId (int ifid);
/**
* \brief Provides for SIMCLICK_IPPREFIX_FROM_NAME
* \param ifid The interface ID for which the IP Prefix is required
* \return The IP Prefix of the interface in string format
*/
std::string GetIpPrefixFromInterfaceId (int ifid);
/**
* \brief Provides for SIMCLICK_MACADDR_FROM_NAME
* \param ifid The interface ID for which the MAC Address is required
* \return The MAC Address of the interface in string format
*/
std::string GetMacAddressFromInterfaceId (int ifid);
/**
* \brief Provides for SIMCLICK_GET_NODE_NAME
* \return The Node name
*/
std::string GetNodeName ();
/**
* \brief Provides for SIMCLICK_IF_READY
* \return Returns 1, if the interface is ready, -1 if ifid is invalid
*/
bool IsInterfaceReady (int ifid);
/**
* \brief Set the Ipv4 instance to be used
* \param ipv4 The Ipv4 instance
*/
virtual void SetIpv4 (Ptr<Ipv4> ipv4);
private:
/**
* \brief Used internally in DoStart () to Add a mapping to m_clickInstanceFromSimNode mapping
*/
void AddSimNodeToClickMapping ();
/**
* \brief This method has to be scheduled everytime Click calls SIMCLICK_SCHEDULE
*/
void RunClickEvent ();
public:
/**
* \brief Schedules simclick_click_run to run at the given time
* \param when Time at which the simclick_click_run instance should be run
*/
void HandleScheduleFromClick (const struct timeval *when);
/**
* \brief Receives a packet from Click
* \param ifid The interface ID from which the packet is arriving
* \param type The type of packet as defined in click/simclick.h
* \param data The contents of the packet
* \param len The length of the packet
*/
void HandlePacketFromClick (int ifid, int type, const unsigned char *data, int len);
/**
* \brief Sends a packet to Click
* \param ifid The interface ID from which the packet is arriving
* \param type The type of packet as defined in click/simclick.h
* \param data The contents of the packet
* \param len The length of the packet
*/
void SendPacketToClick (int ifid, int type, const unsigned char *data, int len);
/**
* \brief Allow a higher layer to send data through Click. (From Ipv4ExtRouting)
* \param p The packet to be sent
* \param src The source IP Address
* \param dest The destination IP Address
*/
void Send (Ptr<Packet> p, Ipv4Address src, Ipv4Address dest);
/**
* \brief Allow a lower layer to send data to Click. (From Ipv4ExtRouting)
* \param p The packet to be sent
* \param receiverAddr Receiving interface's address
* \param dest The Destination MAC address
*/
void Receive (Ptr<Packet> p, Mac48Address receiverAddr, Mac48Address dest);
// From Ipv4RoutingProtocol
virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb);
virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
virtual void NotifyInterfaceUp (uint32_t interface);
virtual void NotifyInterfaceDown (uint32_t interface);
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
private:
std::string m_clickFile;
std::string m_nodeName;
std::string m_clickRoutingTableElement;
std::map < std::string, uint32_t > m_ifaceIdFromName;
std::map < std::string, Address > m_ifaceMacFromName;
std::map < std::string, Ipv4Address > m_ifaceAddrFromName;
bool m_clickInitialised;
bool m_nonDefaultName;
Ptr<Ipv4> m_ipv4;
#endif /* NS3_CLICK */
};
} // namespace ns3
#endif /* IPV4_CLICK_ROUTING_H */
| zy901002-gpsr | src/click/model/ipv4-click-routing.h | C++ | gpl2 | 8,351 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// 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: George F. Riley <riley@ece.gatech.edu>
// Author: Lalith Suresh <suresh.lalith@gmail.com>
//
#ifdef NS3_CLICK
#include "ipv4-l3-click-protocol.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/node.h"
#include "ns3/socket.h"
#include "ns3/ethernet-header.h"
#include "ns3/llc-snap-header.h"
#include "ns3/net-device.h"
#include "ns3/uinteger.h"
#include "ns3/object-vector.h"
#include "ns3/ipv4-raw-socket-impl.h"
#include "ns3/arp-l3-protocol.h"
#include "ns3/ipv4-l4-protocol.h"
#include "ns3/icmpv4-l4-protocol.h"
#include "ns3/loopback-net-device.h"
NS_LOG_COMPONENT_DEFINE ("Ipv4L3ClickProtocol");
namespace ns3 {
const uint16_t Ipv4L3ClickProtocol::PROT_NUMBER = 0x0800;
NS_OBJECT_ENSURE_REGISTERED (Ipv4L3ClickProtocol);
TypeId
Ipv4L3ClickProtocol::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4L3ClickProtocol")
.SetParent<Ipv4> ()
.AddConstructor<Ipv4L3ClickProtocol> ()
.AddAttribute ("DefaultTtl", "The TTL value set by default on all outgoing packets generated on this node.",
UintegerValue (64),
MakeUintegerAccessor (&Ipv4L3ClickProtocol::m_defaultTtl),
MakeUintegerChecker<uint8_t> ())
.AddAttribute ("InterfaceList", "The set of Ipv4 interfaces associated to this Ipv4 stack.",
ObjectVectorValue (),
MakeObjectVectorAccessor (&Ipv4L3ClickProtocol::m_interfaces),
MakeObjectVectorChecker<Ipv4Interface> ())
;
return tid;
}
Ipv4L3ClickProtocol::Ipv4L3ClickProtocol ()
: m_identification (0)
{
}
Ipv4L3ClickProtocol::~Ipv4L3ClickProtocol ()
{
}
void
Ipv4L3ClickProtocol::DoDispose (void)
{
NS_LOG_FUNCTION (this);
for (L4List_t::iterator i = m_protocols.begin (); i != m_protocols.end (); ++i)
{
*i = 0;
}
m_protocols.clear ();
for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
{
*i = 0;
}
m_interfaces.clear ();
m_sockets.clear ();
m_node = 0;
m_routingProtocol = 0;
Object::DoDispose ();
}
void
Ipv4L3ClickProtocol::NotifyNewAggregate ()
{
if (m_node == 0)
{
Ptr<Node>node = this->GetObject<Node> ();
// verify that it's a valid node and that
// the node has not been set before
if (node != 0)
{
this->SetNode (node);
}
}
Object::NotifyNewAggregate ();
}
void
Ipv4L3ClickProtocol::SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol)
{
NS_LOG_FUNCTION (this);
m_routingProtocol = routingProtocol;
m_routingProtocol->SetIpv4 (this);
}
Ptr<Ipv4RoutingProtocol>
Ipv4L3ClickProtocol::GetRoutingProtocol (void) const
{
return m_routingProtocol;
}
Ptr<Ipv4Interface>
Ipv4L3ClickProtocol::GetInterface (uint32_t index) const
{
NS_LOG_FUNCTION (this << index);
if (index < m_interfaces.size ())
{
return m_interfaces[index];
}
return 0;
}
uint32_t
Ipv4L3ClickProtocol::GetNInterfaces (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_interfaces.size ();
}
int32_t
Ipv4L3ClickProtocol::GetInterfaceForAddress (
Ipv4Address address) const
{
NS_LOG_FUNCTION (this << address);
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
i++, interface++)
{
for (uint32_t j = 0; j < (*i)->GetNAddresses (); j++)
{
if ((*i)->GetAddress (j).GetLocal () == address)
{
return interface;
}
}
}
return -1;
}
int32_t
Ipv4L3ClickProtocol::GetInterfaceForPrefix (
Ipv4Address address,
Ipv4Mask mask) const
{
NS_LOG_FUNCTION (this << address << mask);
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
i++, interface++)
{
for (uint32_t j = 0; j < (*i)->GetNAddresses (); j++)
{
if ((*i)->GetAddress (j).GetLocal ().CombineMask (mask) == address.CombineMask (mask))
{
return interface;
}
}
}
return -1;
}
int32_t
Ipv4L3ClickProtocol::GetInterfaceForDevice (
Ptr<const NetDevice> device) const
{
NS_LOG_FUNCTION (this << device->GetIfIndex ());
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
i++, interface++)
{
if ((*i)->GetDevice () == device)
{
return interface;
}
}
return -1;
}
bool
Ipv4L3ClickProtocol::IsDestinationAddress (Ipv4Address address, uint32_t iif) const
{
NS_LOG_FUNCTION (this << address << " " << iif);
// First check the incoming interface for a unicast address match
for (uint32_t i = 0; i < GetNAddresses (iif); i++)
{
Ipv4InterfaceAddress iaddr = GetAddress (iif, i);
if (address == iaddr.GetLocal ())
{
NS_LOG_LOGIC ("For me (destination " << address << " match)");
return true;
}
if (address == iaddr.GetBroadcast ())
{
NS_LOG_LOGIC ("For me (interface broadcast address)");
return true;
}
}
if (address.IsMulticast ())
{
#ifdef NOTYET
if (MulticastCheckGroup (iif, address ))
#endif
if (true)
{
NS_LOG_LOGIC ("For me (Ipv4Addr multicast address");
return true;
}
}
if (address.IsBroadcast ())
{
NS_LOG_LOGIC ("For me (Ipv4Addr broadcast address)");
return true;
}
if (GetWeakEsModel ()) // Check other interfaces
{
for (uint32_t j = 0; j < GetNInterfaces (); j++)
{
if (j == uint32_t (iif))
{
continue;
}
for (uint32_t i = 0; i < GetNAddresses (j); i++)
{
Ipv4InterfaceAddress iaddr = GetAddress (j, i);
if (address == iaddr.GetLocal ())
{
NS_LOG_LOGIC ("For me (destination " << address << " match) on another interface");
return true;
}
// This is a small corner case: match another interface's broadcast address
if (address == iaddr.GetBroadcast ())
{
NS_LOG_LOGIC ("For me (interface broadcast address on another interface)");
return true;
}
}
}
}
return false;
}
void
Ipv4L3ClickProtocol::SetIpForward (bool forward)
{
NS_LOG_FUNCTION (this << forward);
m_ipForward = forward;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
{
(*i)->SetForwarding (forward);
}
}
bool
Ipv4L3ClickProtocol::GetIpForward (void) const
{
return m_ipForward;
}
void
Ipv4L3ClickProtocol::SetWeakEsModel (bool model)
{
m_weakEsModel = model;
}
bool
Ipv4L3ClickProtocol::GetWeakEsModel (void) const
{
return m_weakEsModel;
}
Ptr<NetDevice>
Ipv4L3ClickProtocol::GetNetDevice (uint32_t i)
{
NS_LOG_FUNCTION (this << i);
return GetInterface (i)->GetDevice ();
}
void
Ipv4L3ClickProtocol::SetDefaultTtl (uint8_t ttl)
{
NS_LOG_FUNCTION_NOARGS ();
m_defaultTtl = ttl;
}
void
Ipv4L3ClickProtocol::SetupLoopback (void)
{
NS_LOG_FUNCTION_NOARGS ();
Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface> ();
Ptr<LoopbackNetDevice> device = 0;
// First check whether an existing LoopbackNetDevice exists on the node
for (uint32_t i = 0; i < m_node->GetNDevices (); i++)
{
if (device = DynamicCast<LoopbackNetDevice> (m_node->GetDevice (i)))
{
break;
}
}
if (device == 0)
{
device = CreateObject<LoopbackNetDevice> ();
m_node->AddDevice (device);
}
interface->SetDevice (device);
interface->SetNode (m_node);
Ipv4InterfaceAddress ifaceAddr = Ipv4InterfaceAddress (Ipv4Address::GetLoopback (), Ipv4Mask::GetLoopback ());
interface->AddAddress (ifaceAddr);
uint32_t index = AddIpv4Interface (interface);
Ptr<Node> node = GetObject<Node> ();
node->RegisterProtocolHandler (MakeCallback (&Ipv4L3ClickProtocol::Receive, this),
Ipv4L3ClickProtocol::PROT_NUMBER, device);
interface->SetUp ();
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyInterfaceUp (index);
}
}
Ptr<Socket>
Ipv4L3ClickProtocol::CreateRawSocket (void)
{
NS_LOG_FUNCTION (this);
Ptr<Ipv4RawSocketImpl> socket = CreateObject<Ipv4RawSocketImpl> ();
socket->SetNode (m_node);
m_sockets.push_back (socket);
return socket;
}
void
Ipv4L3ClickProtocol::DeleteRawSocket (Ptr<Socket> socket)
{
NS_LOG_FUNCTION (this << socket);
for (SocketList::iterator i = m_sockets.begin (); i != m_sockets.end (); ++i)
{
if ((*i) == socket)
{
m_sockets.erase (i);
return;
}
}
return;
}
void
Ipv4L3ClickProtocol::SetNode (Ptr<Node> node)
{
m_node = node;
// Add a LoopbackNetDevice if needed, and an Ipv4Interface on top of it
SetupLoopback ();
}
bool
Ipv4L3ClickProtocol::AddAddress (uint32_t i, Ipv4InterfaceAddress address)
{
NS_LOG_FUNCTION (this << i << address);
Ptr<Ipv4Interface> interface = GetInterface (i);
bool retVal = interface->AddAddress (address);
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyAddAddress (i, address);
}
return retVal;
}
Ipv4InterfaceAddress
Ipv4L3ClickProtocol::GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const
{
NS_LOG_FUNCTION (this << interfaceIndex << addressIndex);
Ptr<Ipv4Interface> interface = GetInterface (interfaceIndex);
return interface->GetAddress (addressIndex);
}
uint32_t
Ipv4L3ClickProtocol::GetNAddresses (uint32_t interface) const
{
NS_LOG_FUNCTION (this << interface);
Ptr<Ipv4Interface> iface = GetInterface (interface);
return iface->GetNAddresses ();
}
bool
Ipv4L3ClickProtocol::RemoveAddress (uint32_t i, uint32_t addressIndex)
{
NS_LOG_FUNCTION (this << i << addressIndex);
Ptr<Ipv4Interface> interface = GetInterface (i);
Ipv4InterfaceAddress address = interface->RemoveAddress (addressIndex);
if (address != Ipv4InterfaceAddress ())
{
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyRemoveAddress (i, address);
}
return true;
}
return false;
}
Ipv4Address
Ipv4L3ClickProtocol::SelectSourceAddress (Ptr<const NetDevice> device,
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope)
{
NS_LOG_FUNCTION (device << dst << scope);
Ipv4Address addr ("0.0.0.0");
Ipv4InterfaceAddress iaddr;
bool found = false;
if (device != 0)
{
int32_t i = GetInterfaceForDevice (device);
NS_ASSERT_MSG (i >= 0, "No device found on node");
for (uint32_t j = 0; j < GetNAddresses (i); j++)
{
iaddr = GetAddress (i, j);
if (iaddr.IsSecondary ())
{
continue;
}
if (iaddr.GetScope () > scope)
{
continue;
}
if (dst.CombineMask (iaddr.GetMask ()) == iaddr.GetLocal ().CombineMask (iaddr.GetMask ()) )
{
return iaddr.GetLocal ();
}
if (!found)
{
addr = iaddr.GetLocal ();
found = true;
}
}
}
if (found)
{
return addr;
}
// Iterate among all interfaces
for (uint32_t i = 0; i < GetNInterfaces (); i++)
{
for (uint32_t j = 0; j < GetNAddresses (i); j++)
{
iaddr = GetAddress (i, j);
if (iaddr.IsSecondary ())
{
continue;
}
if (iaddr.GetScope () != Ipv4InterfaceAddress::LINK
&& iaddr.GetScope () <= scope)
{
return iaddr.GetLocal ();
}
}
}
NS_LOG_WARN ("Could not find source address for " << dst << " and scope "
<< scope << ", returning 0");
return addr;
}
void
Ipv4L3ClickProtocol::SetMetric (uint32_t i, uint16_t metric)
{
NS_LOG_FUNCTION (i << metric);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetMetric (metric);
}
uint16_t
Ipv4L3ClickProtocol::GetMetric (uint32_t i) const
{
NS_LOG_FUNCTION (i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetMetric ();
}
uint16_t
Ipv4L3ClickProtocol::GetMtu (uint32_t i) const
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetDevice ()->GetMtu ();
}
bool
Ipv4L3ClickProtocol::IsUp (uint32_t i) const
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->IsUp ();
}
void
Ipv4L3ClickProtocol::SetUp (uint32_t i)
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetUp ();
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyInterfaceUp (i);
}
}
void
Ipv4L3ClickProtocol::SetDown (uint32_t ifaceIndex)
{
NS_LOG_FUNCTION (this << ifaceIndex);
Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
interface->SetDown ();
if (m_routingProtocol != 0)
{
m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
}
}
bool
Ipv4L3ClickProtocol::IsForwarding (uint32_t i) const
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
NS_LOG_LOGIC ("Forwarding state: " << interface->IsForwarding ());
return interface->IsForwarding ();
}
void
Ipv4L3ClickProtocol::SetForwarding (uint32_t i, bool val)
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetForwarding (val);
}
void
Ipv4L3ClickProtocol::SetPromisc (uint32_t i)
{
NS_ASSERT(i <= m_node->GetNDevices ());
Ptr<NetDevice> netdev = GetNetDevice (i);
NS_ASSERT (netdev);
Ptr<Node> node = GetObject<Node> ();
NS_ASSERT (node);
node->RegisterProtocolHandler (MakeCallback (&Ipv4L3ClickProtocol::Receive, this),
0, netdev,true);
}
uint32_t
Ipv4L3ClickProtocol::AddInterface (Ptr<NetDevice> device)
{
NS_LOG_FUNCTION (this << &device);
Ptr<Node> node = GetObject<Node> ();
node->RegisterProtocolHandler (MakeCallback (&Ipv4L3ClickProtocol::Receive, this),
Ipv4L3ClickProtocol::PROT_NUMBER, device);
node->RegisterProtocolHandler (MakeCallback (&Ipv4L3ClickProtocol::Receive, this),
ArpL3Protocol::PROT_NUMBER, device);
Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface> ();
interface->SetNode (m_node);
interface->SetDevice (device);
interface->SetForwarding (m_ipForward);
return AddIpv4Interface (interface);
}
uint32_t
Ipv4L3ClickProtocol::AddIpv4Interface (Ptr<Ipv4Interface>interface)
{
NS_LOG_FUNCTION (this << interface);
uint32_t index = m_interfaces.size ();
m_interfaces.push_back (interface);
return index;
}
// XXX when should we set ip_id? check whether we are incrementing
// m_identification on packets that may later be dropped in this stack
// and whether that deviates from Linux
Ipv4Header
Ipv4L3ClickProtocol::BuildHeader (
Ipv4Address source,
Ipv4Address destination,
uint8_t protocol,
uint16_t payloadSize,
uint8_t ttl,
bool mayFragment)
{
NS_LOG_FUNCTION_NOARGS ();
Ipv4Header ipHeader;
ipHeader.SetSource (source);
ipHeader.SetDestination (destination);
ipHeader.SetProtocol (protocol);
ipHeader.SetPayloadSize (payloadSize);
ipHeader.SetTtl (ttl);
if (mayFragment == true)
{
ipHeader.SetMayFragment ();
ipHeader.SetIdentification (m_identification);
m_identification++;
}
else
{
ipHeader.SetDontFragment ();
// TBD: set to zero here; will cause traces to change
ipHeader.SetIdentification (m_identification);
m_identification++;
}
if (Node::ChecksumEnabled ())
{
ipHeader.EnableChecksum ();
}
return ipHeader;
}
void
Ipv4L3ClickProtocol::Send (Ptr<Packet> packet,
Ipv4Address source,
Ipv4Address destination,
uint8_t protocol,
Ptr<Ipv4Route> route)
{
NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route);
Ipv4Header ipHeader;
bool mayFragment = true;
uint8_t ttl = m_defaultTtl;
SocketIpTtlTag tag;
bool found = packet->RemovePacketTag (tag);
if (found)
{
ttl = tag.GetTtl ();
}
ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
Ptr<Ipv4ClickRouting> click = DynamicCast<Ipv4ClickRouting> (m_routingProtocol);
if (Node::ChecksumEnabled ())
{
ipHeader.EnableChecksum ();
}
packet->AddHeader (ipHeader);
click->Send (packet->Copy (), source, destination);
return;
}
void
Ipv4L3ClickProtocol::SendDown (Ptr<Packet> p, int ifid)
{
// Called by Ipv4ClickRouting.
// NetDevice::Send () attaches ethernet headers,
// so the one that Click attaches isn't required
// but we need the destination address and
// protocol values from the header.
Ptr<NetDevice> netdev = GetNetDevice (ifid);
EthernetHeader header;
p->RemoveHeader (header);
uint16_t protocol;
if (header.GetLengthType () <= 1500)
{
LlcSnapHeader llc;
p->RemoveHeader (llc);
protocol = llc.GetType ();
}
else
{
protocol = header.GetLengthType ();
}
// Use the destination address and protocol obtained
// from above to send the packet.
netdev->Send (p, header.GetDestination (), protocol);
}
void
Ipv4L3ClickProtocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
const Address &to, NetDevice::PacketType packetType)
{
NS_LOG_FUNCTION (this << device << p << from << to);
Ptr<Packet> packet = p->Copy ();
// Add an ethernet frame. This allows
// Click to work with csma and wifi
EthernetHeader hdr;
hdr.SetSource (Mac48Address::ConvertFrom (from));
hdr.SetDestination (Mac48Address::ConvertFrom (to));
hdr.SetLengthType (protocol);
packet->AddHeader (hdr);
Ptr<Ipv4ClickRouting> click = DynamicCast<Ipv4ClickRouting> (GetRoutingProtocol ());
click->Receive (packet->Copy (), Mac48Address::ConvertFrom (device->GetAddress ()), Mac48Address::ConvertFrom (to));
}
void
Ipv4L3ClickProtocol::LocalDeliver (Ptr<const Packet> packet, Ipv4Header const&ip, uint32_t iif)
{
NS_LOG_FUNCTION (this << packet << &ip);
Ptr<Packet> p = packet->Copy (); // need to pass a non-const packet up
m_localDeliverTrace (ip, packet, iif);
Ptr<Ipv4L4Protocol> protocol = GetProtocol (ip.GetProtocol ());
if (protocol != 0)
{
// we need to make a copy in the unlikely event we hit the
// RX_ENDPOINT_UNREACH codepath
Ptr<Packet> copy = p->Copy ();
enum Ipv4L4Protocol::RxStatus status =
protocol->Receive (p, ip, GetInterface (iif));
switch (status)
{
case Ipv4L4Protocol::RX_OK:
// fall through
case Ipv4L4Protocol::RX_ENDPOINT_CLOSED:
// fall through
case Ipv4L4Protocol::RX_CSUM_FAILED:
break;
case Ipv4L4Protocol::RX_ENDPOINT_UNREACH:
if (ip.GetDestination ().IsBroadcast () == true
|| ip.GetDestination ().IsMulticast () == true)
{
break; // Do not reply to broadcast or multicast
}
// Another case to suppress ICMP is a subnet-directed broadcast
bool subnetDirected = false;
for (uint32_t i = 0; i < GetNAddresses (iif); i++)
{
Ipv4InterfaceAddress addr = GetAddress (iif, i);
if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ())
&& ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
{
subnetDirected = true;
}
}
if (subnetDirected == false)
{
GetIcmp ()->SendDestUnreachPort (ip, copy);
}
}
}
}
Ptr<Icmpv4L4Protocol>
Ipv4L3ClickProtocol::GetIcmp (void) const
{
Ptr<Ipv4L4Protocol> prot = GetProtocol (Icmpv4L4Protocol::GetStaticProtocolNumber ());
if (prot != 0)
{
return prot->GetObject<Icmpv4L4Protocol> ();
}
else
{
return 0;
}
}
void
Ipv4L3ClickProtocol::Insert (Ptr<Ipv4L4Protocol> protocol)
{
m_protocols.push_back (protocol);
}
Ptr<Ipv4L4Protocol>
Ipv4L3ClickProtocol::GetProtocol (int protocolNumber) const
{
for (L4List_t::const_iterator i = m_protocols.begin (); i != m_protocols.end (); ++i)
{
if ((*i)->GetProtocolNumber () == protocolNumber)
{
return *i;
}
}
return 0;
}
} // namespace ns3
#endif // NS3_CLICK
| zy901002-gpsr | src/click/model/ipv4-l3-click-protocol.cc | C++ | gpl2 | 21,709 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Lalith Suresh
*
* 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
#ifdef NS3_CLICK
#include "ns3/node.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/mac48-address.h"
#include "ns3/ipv4-interface.h"
#include "ns3/ipv4-l3-click-protocol.h"
#include "ipv4-click-routing.h"
#include <string>
#include <map>
#include <cstdlib>
#include <cstdarg>
NS_LOG_COMPONENT_DEFINE ("Ipv4ClickRouting");
namespace ns3 {
// Values from nsclick ExtRouter implementation
#define INTERFACE_ID_KERNELTAP 0
#define INTERFACE_ID_FIRST 1
#define INTERFACE_ID_FIRST_DROP 33
NS_OBJECT_ENSURE_REGISTERED (Ipv4ClickRouting);
std::map < simclick_node_t *, Ptr<Ipv4ClickRouting> > Ipv4ClickRouting::m_clickInstanceFromSimNode;
TypeId
Ipv4ClickRouting::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Ipv4ClickRouting")
.SetParent<Ipv4RoutingProtocol> ()
.AddConstructor<Ipv4ClickRouting> ()
;
return tid;
}
Ipv4ClickRouting::Ipv4ClickRouting ()
: m_nonDefaultName (false),
m_ipv4 (0)
{
}
Ipv4ClickRouting::~Ipv4ClickRouting ()
{
}
void
Ipv4ClickRouting::DoStart ()
{
uint32_t id = m_ipv4->GetObject<Node> ()->GetId ();
if (!m_nonDefaultName)
{
std::stringstream name;
name << "Node" << id;
m_nodeName = name.str ();
}
m_simNode = new simclick_node_t;
timerclear (&m_simNode->curtime);
AddSimNodeToClickMapping ();
NS_ASSERT (m_clickFile.length () > 0);
// Even though simclick_click_create() will halt programme execution
// if it is unable to initialise a Click router, we play safe
if (simclick_click_create (m_simNode, m_clickFile.c_str ()) >= 0)
{
NS_LOG_DEBUG (m_nodeName << " has initialised a Click Router");
m_clickInitialised = true;
}
else
{
NS_LOG_DEBUG ("Click Router Initialisation failed for " << m_nodeName);
m_clickInitialised = false;
}
NS_ASSERT (m_clickInitialised == true);
simclick_click_run (m_simNode);
}
void
Ipv4ClickRouting::SetIpv4 (Ptr<Ipv4> ipv4)
{
m_ipv4 = ipv4;
}
void
Ipv4ClickRouting::DoDispose ()
{
m_ipv4 = 0;
delete m_simNode;
Ipv4RoutingProtocol::DoDispose ();
}
void
Ipv4ClickRouting::SetClickFile (std::string clickfile)
{
m_clickFile = clickfile;
}
void
Ipv4ClickRouting::SetClickRoutingTableElement (std::string name)
{
m_clickRoutingTableElement = name;
}
void
Ipv4ClickRouting::SetNodeName (std::string name)
{
m_nodeName = name;
m_nonDefaultName = true;
}
std::string
Ipv4ClickRouting::GetNodeName ()
{
return m_nodeName;
}
int
Ipv4ClickRouting::GetInterfaceId (const char *ifname)
{
int retval = -1;
// The below hard coding of interface names follows the
// same approach as used in the original nsclick code for
// ns-2. The interface names map directly to what is to
// be used in the Click configuration files.
// Thus eth0 will refer to the first network device of
// the node, and is to be named so in the Click graph.
// This function is called by Click during the intialisation
// phase of the Click graph, during which it tries to map
// interface IDs to interface names. The return value
// corresponds to the interface ID that Click will use.
// Tap/tun devices refer to the kernel devices
if (strstr (ifname, "tap") || strstr (ifname, "tun"))
{
retval = 0;
}
else if (const char *devname = strstr (ifname, "eth"))
{
while (*devname && !isdigit ((unsigned char) *devname))
{
devname++;
}
if (*devname)
{
retval = atoi (devname) + INTERFACE_ID_FIRST;
}
}
else if (const char *devname = strstr (ifname, "drop"))
{
while (*devname && !isdigit ((unsigned char) *devname))
{
devname++;
}
if (*devname)
{
retval = atoi (devname) + INTERFACE_ID_FIRST_DROP;
}
}
// This protects against a possible inconsistency of having
// more interfaces defined in the Click graph
// for a Click node than are defined for it in
// the simulation script
if (retval >= (int) m_ipv4->GetNInterfaces ())
{
return -1;
}
return retval;
}
bool
Ipv4ClickRouting::IsInterfaceReady (int ifid)
{
if (ifid >= 0 && ifid < (int) m_ipv4->GetNInterfaces ())
{
return true;
}
else
{
return false;
}
}
std::string
Ipv4ClickRouting::GetIpAddressFromInterfaceId (int ifid)
{
std::stringstream addr;
m_ipv4->GetAddress (ifid, 0).GetLocal ().Print (addr);
return addr.str ();
}
std::string
Ipv4ClickRouting::GetIpPrefixFromInterfaceId (int ifid)
{
std::stringstream addr;
m_ipv4->GetAddress (ifid, 0).GetMask ().Print (addr);
return addr.str ();
}
std::string
Ipv4ClickRouting::GetMacAddressFromInterfaceId (int ifid)
{
std::stringstream addr;
Ptr<NetDevice> device = m_ipv4->GetNetDevice (ifid);
Address devAddr = device->GetAddress ();
addr << Mac48Address::ConvertFrom (devAddr);
return addr.str ();
}
void
Ipv4ClickRouting::AddSimNodeToClickMapping ()
{
m_clickInstanceFromSimNode.insert (std::make_pair (m_simNode, this));
}
Ptr<Ipv4ClickRouting>
Ipv4ClickRouting::GetClickInstanceFromSimNode (simclick_node_t *simnode)
{
return m_clickInstanceFromSimNode[simnode];
}
void
Ipv4ClickRouting::RunClickEvent ()
{
m_simNode->curtime.tv_sec = Simulator::Now ().GetSeconds ();
m_simNode->curtime.tv_usec = Simulator::Now ().GetMicroSeconds () % 1000000;
NS_LOG_DEBUG ("RunClickEvent at " << m_simNode->curtime.tv_sec << " " <<
m_simNode->curtime.tv_usec << " " << Simulator::Now ());
simclick_click_run (m_simNode);
}
void
Ipv4ClickRouting::HandleScheduleFromClick (const struct timeval *when)
{
NS_LOG_DEBUG ("HandleScheduleFromClick at " << when->tv_sec << " " << when->tv_usec << " " << Simulator::Now ());
Time simtime = Time::FromInteger(when->tv_sec, Time::S) + Time::FromInteger(when->tv_usec, Time::US);
Time simdelay = simtime - Simulator::Now();
Simulator::Schedule (simdelay, &Ipv4ClickRouting::RunClickEvent, this);
}
void
Ipv4ClickRouting::HandlePacketFromClick (int ifid, int ptype, const unsigned char* data, int len)
{
NS_LOG_DEBUG ("HandlePacketFromClick");
// Figure out packet's destination here:
// If ifid == 0, then the packet's going up
// else, the packet's going down
if (ifid == 0)
{
NS_LOG_DEBUG ("Incoming packet from tap0. Sending Packet up the stack.");
Ptr<Ipv4L3ClickProtocol> ipv4l3 = DynamicCast<Ipv4L3ClickProtocol> (m_ipv4);
Ptr<Packet> p = Create<Packet> (data, len);
Ipv4Header ipHeader;
p->RemoveHeader (ipHeader);
ipv4l3->LocalDeliver (p, ipHeader, (uint32_t) ifid);
}
else if (ifid)
{
NS_LOG_DEBUG ("Incoming packet from eth" << ifid - 1 << " of type " << ptype << ". Sending packet down the stack.");
Ptr<Packet> p = Create<Packet> (data, len);
DynamicCast<Ipv4L3ClickProtocol> (m_ipv4)->SendDown (p, ifid);
}
}
void
Ipv4ClickRouting::SendPacketToClick (int ifid, int ptype, const unsigned char* data, int len)
{
NS_LOG_FUNCTION (this << ifid);
m_simNode->curtime.tv_sec = Simulator::Now ().GetSeconds ();
m_simNode->curtime.tv_usec = Simulator::Now ().GetMicroSeconds () % 1000000;
// Since packets in ns-3 don't have global Packet ID's and Flow ID's, we
// feed dummy values into pinfo. This avoids the need to make changes in the Click code
simclick_simpacketinfo pinfo;
pinfo.id = 0;
pinfo.fid = 0;
simclick_click_send (m_simNode,ifid,ptype,data,len,&pinfo);
}
void
Ipv4ClickRouting::Send (Ptr<Packet> p, Ipv4Address src, Ipv4Address dst)
{
uint32_t ifid;
// Find out which interface holds the src address of the packet...
for (ifid = 0; ifid < m_ipv4->GetNInterfaces (); ifid++)
{
Ipv4Address addr = m_ipv4->GetAddress (ifid, 0).GetLocal ();
if (addr == src)
{
break;
}
}
int len = p->GetSize ();
uint8_t *buf = new uint8_t [len];
p->CopyData (buf, len);
// ... and send the packet on the corresponding Click interface.
SendPacketToClick (0, SIMCLICK_PTYPE_IP, buf, len);
delete [] buf;
}
void
Ipv4ClickRouting::Receive (Ptr<Packet> p, Mac48Address receiverAddr, Mac48Address dest)
{
NS_LOG_FUNCTION (this << p << receiverAddr << dest);
uint32_t ifid;
// Find out which device this packet was received from...
for (ifid = 0; ifid < m_ipv4->GetNInterfaces (); ifid++)
{
Ptr<NetDevice> device = m_ipv4->GetNetDevice (ifid);
if (Mac48Address::ConvertFrom (device->GetAddress ()) == receiverAddr)
{
break;
}
}
int len = p->GetSize ();
uint8_t *buf = new uint8_t [len];
p->CopyData (buf, len);
// ... and send the packet to the corresponding Click interface
SendPacketToClick (ifid, SIMCLICK_PTYPE_ETHER, buf, len);
delete [] buf;
}
std::string
Ipv4ClickRouting::ReadHandler (std::string elementName, std::string handlerName)
{
std::string s = simclick_click_read_handler (m_simNode, elementName.c_str (), handlerName.c_str (), 0, 0);
return s;
}
int
Ipv4ClickRouting::WriteHandler (std::string elementName, std::string handlerName, std::string writeString)
{
int r = simclick_click_write_handler (m_simNode, elementName.c_str (), handlerName.c_str (), writeString.c_str ());
// Note: There are probably use-cases for returning
// a write handler's error code, so don't assert.
// For example, the 'add' handler for IPRouteTable
// type elements fails if the route to be added
// already exists.
return r;
}
void
Ipv4ClickRouting::SetPromisc (int ifid)
{
Ptr<Ipv4L3ClickProtocol> ipv4l3 = DynamicCast<Ipv4L3ClickProtocol> (m_ipv4);
NS_ASSERT(ipv4l3);
ipv4l3->SetPromisc (ifid);
}
Ptr<Ipv4Route>
Ipv4ClickRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
{
Ptr<Ipv4Route> rtentry;
std::stringstream addr;
addr << "lookup ";
header.GetDestination ().Print (addr);
// Probe the Click Routing Table for the required IP
// This returns a string of the form "InterfaceID GatewayAddr"
std::string s = ReadHandler (m_clickRoutingTableElement, addr.str ());
int pos = s.find (" ");
int interfaceId = atoi (s.substr (0, pos).c_str ());
Ipv4Address destination (s.substr (pos + 1).c_str ());
if (interfaceId != -1)
{
rtentry = Create<Ipv4Route> ();
rtentry->SetDestination (header.GetDestination ());
// the source address is the interface address that matches
// the destination address (when multiple are present on the
// outgoing interface, one is selected via scoping rules)
NS_ASSERT (m_ipv4);
uint32_t numOifAddresses = m_ipv4->GetNAddresses (interfaceId);
NS_ASSERT (numOifAddresses > 0);
Ipv4InterfaceAddress ifAddr;
if (numOifAddresses == 1)
{
ifAddr = m_ipv4->GetAddress (interfaceId, 0);
}
else
{
NS_FATAL_ERROR ("XXX Not implemented yet: IP aliasing and Click");
}
rtentry->SetSource (ifAddr.GetLocal ());
rtentry->SetGateway (destination);
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceId));
sockerr = Socket::ERROR_NOTERROR;
NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination ()
<< " via nh " << rtentry->GetGateway ()
<< " with source addr " << rtentry->GetSource ()
<< " and output dev " << rtentry->GetOutputDevice ());
}
else
{
NS_LOG_DEBUG ("Click node " << m_nodeName
<< ": RouteOutput for dest=" << header.GetDestination ()
<< " No route to host");
sockerr = Socket::ERROR_NOROUTETOHOST;
}
return rtentry;
}
// This method should never be called since Click handles
// forwarding directly
bool
Ipv4ClickRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
Ptr<const NetDevice> idev, UnicastForwardCallback ucb,
MulticastForwardCallback mcb, LocalDeliverCallback lcb,
ErrorCallback ecb)
{
NS_FATAL_ERROR ("Click router does not have a RouteInput() interface!");
return false;
}
void
Ipv4ClickRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
}
void
Ipv4ClickRouting::NotifyInterfaceUp (uint32_t i)
{
}
void
Ipv4ClickRouting::NotifyInterfaceDown (uint32_t i)
{
}
void
Ipv4ClickRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
}
void
Ipv4ClickRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
{
}
} // namespace ns3
static int simstrlcpy (char *buf, int len, const std::string &s)
{
if (len)
{
len--;
if ((unsigned) len > s.length ())
{
len = s.length ();
}
s.copy (buf, len);
buf[len] = '\0';
}
return 0;
}
// Sends a Packet from Click to the Simulator: Defined in simclick.h. Click
// calls these methods.
int simclick_sim_send (simclick_node_t *simnode,
int ifid, int type, const unsigned char* data, int len,
simclick_simpacketinfo *pinfo)
{
NS_LOG_DEBUG ("simclick_sim_send called at " << ns3::Simulator::Now ().GetSeconds () << ": " << ifid << " " << type << " " << data << " " << len);
if (simnode == NULL)
{
return -1;
}
ns3::Ptr<ns3::Ipv4ClickRouting> clickInstance = ns3::Ipv4ClickRouting::GetClickInstanceFromSimNode (simnode);
clickInstance->HandlePacketFromClick (ifid, type, data, len);
return 0;
}
// Click Service Methods: Defined in simclick.h
int simclick_sim_command (simclick_node_t *simnode, int cmd, ...)
{
va_list val;
va_start (val, cmd);
int retval = 0;
ns3::Ptr<ns3::Ipv4ClickRouting> clickInstance = ns3::Ipv4ClickRouting::GetClickInstanceFromSimNode (simnode);
switch (cmd)
{
case SIMCLICK_VERSION:
{
retval = 0;
break;
}
case SIMCLICK_SUPPORTS:
{
int othercmd = va_arg (val, int);
retval = (othercmd >= SIMCLICK_VERSION && othercmd <= SIMCLICK_GET_NODE_ID);
break;
}
case SIMCLICK_IFID_FROM_NAME:
{
const char *ifname = va_arg (val, const char *);
retval = clickInstance->GetInterfaceId (ifname);
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IFID_FROM_NAME: " << ifname << " " << retval);
break;
}
case SIMCLICK_IPADDR_FROM_NAME:
{
const char *ifname = va_arg (val, const char *);
char *buf = va_arg (val, char *);
int len = va_arg (val, int);
int ifid = clickInstance->GetInterfaceId (ifname);
if (ifid >= 0)
{
retval = simstrlcpy (buf, len, clickInstance->GetIpAddressFromInterfaceId (ifid));
}
else
{
retval = -1;
}
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IPADDR_FROM_NAME: " << ifname << " " << buf << " " << len);
break;
}
case SIMCLICK_IPPREFIX_FROM_NAME:
{
const char *ifname = va_arg (val, const char *);
char *buf = va_arg (val, char *);
int len = va_arg (val, int);
int ifid = clickInstance->GetInterfaceId (ifname);
if (ifid >= 0)
{
retval = simstrlcpy (buf, len, clickInstance->GetIpPrefixFromInterfaceId (ifid));
}
else
{
retval = -1;
}
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IPPREFIX_FROM_NAME: " << ifname << " " << buf << " " << len);
break;
}
case SIMCLICK_MACADDR_FROM_NAME:
{
const char *ifname = va_arg (val, const char *);
char *buf = va_arg (val, char *);
int len = va_arg (val, int);
int ifid = clickInstance->GetInterfaceId (ifname);
if (ifid >= 0)
{
retval = simstrlcpy (buf, len, clickInstance->GetMacAddressFromInterfaceId (ifid));
}
else
{
retval = -1;
}
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_MACADDR_FROM_NAME: " << ifname << " " << buf << " " << len);
break;
}
case SIMCLICK_SCHEDULE:
{
const struct timeval *when = va_arg (val, const struct timeval *);
clickInstance->HandleScheduleFromClick (when);
retval = 0;
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_SCHEDULE at " << when->tv_sec << "s and " << when->tv_usec << "usecs.");
break;
}
case SIMCLICK_GET_NODE_NAME:
{
char *buf = va_arg (val, char *);
int len = va_arg (val, int);
retval = simstrlcpy (buf, len, clickInstance->GetNodeName ());
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_GET_NODE_NAME: " << buf << " " << len);
break;
}
case SIMCLICK_IF_PROMISC:
{
int ifid = va_arg(val, int);
clickInstance->SetPromisc (ifid);
retval = 0;
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IF_PROMISC: " << ifid << " " << ns3::Simulator::Now ());
break;
}
case SIMCLICK_IF_READY:
{
int ifid = va_arg (val, int); // Commented out so that optimized build works
// We're not using a ClickQueue, so we're always ready (for the timebeing)
retval = clickInstance->IsInterfaceReady (ifid);
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IF_READY: " << ifid << " " << ns3::Simulator::Now ());
break;
}
case SIMCLICK_TRACE:
{
// Used only for tracing
NS_LOG_DEBUG (clickInstance->GetNodeName () << " Received a call for SIMCLICK_TRACE");
break;
}
case SIMCLICK_GET_NODE_ID:
{
// Used only for tracing
NS_LOG_DEBUG (clickInstance->GetNodeName () << " Received a call for SIMCLICK_GET_NODE_ID");
break;
}
}
return retval;
}
#endif // NS3_CLICK
| zy901002-gpsr | src/click/model/ipv4-click-routing.cc | C++ | gpl2 | 18,871 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.click', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList', import_from_module='ns.core')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList'])
## buffer.h (module 'network'): ns3::Buffer [class]
module.add_class('Buffer', import_from_module='ns.network')
## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer'])
## packet.h (module 'network'): ns3::ByteTagIterator [class]
module.add_class('ByteTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
module.add_class('ByteTagList', import_from_module='ns.network')
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase', import_from_module='ns.core')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
module.add_class('Ipv4Address', import_from_module='ns.network')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
module.add_class('Ipv4InterfaceAddress', import_from_module='ns.internet')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e [enumeration]
module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'], import_from_module='ns.internet')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
module.add_class('Ipv4Mask', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
module.add_class('Ipv6Address', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter', import_from_module='ns.core')
## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
module.add_class('PacketMetadata', import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration]
module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet.h (module 'network'): ns3::PacketTagIterator [class]
module.add_class('PacketTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
module.add_class('PacketTagList', import_from_module='ns.network')
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
module.add_class('TagBuffer', import_from_module='ns.network')
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty', import_from_module='ns.core')
## chunk.h (module 'network'): ns3::Chunk [class]
module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## header.h (module 'network'): ns3::Header [class]
module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
module.add_class('Ipv4Header', import_from_module='ns.internet', parent=root_module['ns3::Header'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4MulticastRoute', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4MulticastRoute>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4Route', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4Route>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## socket.h (module 'network'): ns3::Socket [class]
module.add_class('Socket', import_from_module='ns.network', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::SocketType [enumeration]
module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::SocketAddressTag [class]
module.add_class('SocketAddressTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpTtlTag [class]
module.add_class('SocketIpTtlTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class]
module.add_class('SocketSetDontFragmentTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## trailer.h (module 'network'): ns3::Trailer [class]
module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ipv4.h (module 'internet'): ns3::Ipv4 [class]
module.add_class('Ipv4', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class]
module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class]
module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface [class]
module.add_class('Ipv4Interface', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol [class]
module.add_class('Ipv4L3ClickProtocol', parent=root_module['ns3::Ipv4'])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol [class]
module.add_class('Ipv4L4Protocol', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::RxStatus [enumeration]
module.add_enum('RxStatus', ['RX_OK', 'RX_CSUM_FAILED', 'RX_ENDPOINT_CLOSED', 'RX_ENDPOINT_UNREACH'], outer_class=root_module['ns3::Ipv4L4Protocol'], import_from_module='ns.internet')
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class]
module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute [class]
module.add_class('Ipv4MulticastRoute', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route [class]
module.add_class('Ipv4Route', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol [class]
module.add_class('Ipv4RoutingProtocol', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class]
module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class]
module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class]
module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network')
## nix-vector.h (module 'network'): ns3::NixVector [class]
module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class]
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## address.h (module 'network'): ns3::AddressChecker [class]
module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## address.h (module 'network'): ns3::AddressValue [class]
module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting [class]
module.add_class('Ipv4ClickRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
module.add_container('std::map< unsigned int, unsigned int >', ('unsigned int', 'unsigned int'), container_type='map')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer'])
register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator'])
register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator'])
register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item'])
register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList'])
register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator'])
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata'])
register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item'])
register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator'])
register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator'])
register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item'])
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
register_Ns3Ipv4Header_methods(root_module, root_module['ns3::Ipv4Header'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Socket_methods(root_module, root_module['ns3::Socket'])
register_Ns3SocketAddressTag_methods(root_module, root_module['ns3::SocketAddressTag'])
register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag'])
register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3Ipv4_methods(root_module, root_module['ns3::Ipv4'])
register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker'])
register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue'])
register_Ns3Ipv4Interface_methods(root_module, root_module['ns3::Ipv4Interface'])
register_Ns3Ipv4L3ClickProtocol_methods(root_module, root_module['ns3::Ipv4L3ClickProtocol'])
register_Ns3Ipv4L4Protocol_methods(root_module, root_module['ns3::Ipv4L4Protocol'])
register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker'])
register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue'])
register_Ns3Ipv4MulticastRoute_methods(root_module, root_module['ns3::Ipv4MulticastRoute'])
register_Ns3Ipv4Route_methods(root_module, root_module['ns3::Ipv4Route'])
register_Ns3Ipv4RoutingProtocol_methods(root_module, root_module['ns3::Ipv4RoutingProtocol'])
register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker'])
register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue'])
register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker'])
register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3Ipv4ClickRouting_methods(root_module, root_module['ns3::Ipv4ClickRouting'])
return
def register_Ns3Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## address.h (module 'network'): ns3::Address::Address() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor]
cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor]
cls.add_constructor([param('ns3::Address const &', 'address')])
## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function]
cls.add_method('CheckCompatible',
'bool',
[param('uint8_t', 'type'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyAllFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function]
cls.add_method('CopyAllTo',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'uint32_t',
[param('uint8_t *', 'buffer')],
is_const=True)
## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buffer')])
## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function]
cls.add_method('GetLength',
'uint8_t',
[],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function]
cls.add_method('IsInvalid',
'bool',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function]
cls.add_method('IsMatchingType',
'bool',
[param('uint8_t', 'type')],
is_const=True)
## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function]
cls.add_method('Register',
'uint8_t',
[],
is_static=True)
## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buffer')],
is_const=True)
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3Buffer_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor]
cls.add_constructor([param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function]
cls.add_method('AddAtEnd',
'bool',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function]
cls.add_method('AddAtStart',
'bool',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function]
cls.add_method('Begin',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Buffer',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function]
cls.add_method('CreateFullCopy',
'ns3::Buffer',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function]
cls.add_method('End',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function]
cls.add_method('GetCurrentEndOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function]
cls.add_method('GetCurrentStartOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3BufferIterator_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')])
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function]
cls.add_method('GetDistanceFrom',
'uint32_t',
[param('ns3::Buffer::Iterator const &', 'o')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function]
cls.add_method('IsEnd',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function]
cls.add_method('IsStart',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function]
cls.add_method('Next',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function]
cls.add_method('Next',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
cls.add_method('Prev',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function]
cls.add_method('Prev',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
cls.add_method('ReadLsbtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function]
cls.add_method('ReadLsbtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function]
cls.add_method('ReadLsbtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function]
cls.add_method('ReadNtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function]
cls.add_method('ReadNtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function]
cls.add_method('ReadNtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Write',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function]
cls.add_method('WriteHtolsbU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function]
cls.add_method('WriteHtolsbU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function]
cls.add_method('WriteHtolsbU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function]
cls.add_method('WriteHtonU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function]
cls.add_method('WriteHtonU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function]
cls.add_method('WriteHtonU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data'), param('uint32_t', 'len')])
return
def register_Ns3ByteTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagIterator::Item',
[])
return
def register_Ns3ByteTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function]
cls.add_method('GetEnd',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function]
cls.add_method('GetStart',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3ByteTagList_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor]
cls.add_constructor([])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function]
cls.add_method('Add',
'ns3::TagBuffer',
[param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function]
cls.add_method('Add',
'void',
[param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function]
cls.add_method('AddAtEnd',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function]
cls.add_method('AddAtStart',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function]
cls.add_method('Begin',
'ns3::ByteTagList::Iterator',
[param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')],
is_const=True)
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3ByteTagListIterator_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')])
## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function]
cls.add_method('GetOffsetStart',
'uint32_t',
[],
is_const=True)
## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagList::Iterator::Item',
[])
return
def register_Ns3ByteTagListIteratorItem_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor]
cls.add_constructor([param('ns3::TagBuffer', 'buf')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable]
cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable]
cls.add_instance_attribute('end', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable]
cls.add_instance_attribute('size', 'uint32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable]
cls.add_instance_attribute('start', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
return
def register_Ns3Ipv4Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor]
cls.add_constructor([param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('CombineMask',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv4Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv4Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('GetSubnetDirectedBroadcast',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Address const &', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function]
cls.add_method('IsLocalMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('IsSubnetDirectedBroadcast',
'bool',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
return
def register_Ns3Ipv4InterfaceAddress_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress() [constructor]
cls.add_constructor([])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4Address local, ns3::Ipv4Mask mask) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'local'), param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4InterfaceAddress const & o) [copy constructor]
cls.add_constructor([param('ns3::Ipv4InterfaceAddress const &', 'o')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetLocal() const [member function]
cls.add_method('GetLocal',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Mask ns3::Ipv4InterfaceAddress::GetMask() const [member function]
cls.add_method('GetMask',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e ns3::Ipv4InterfaceAddress::GetScope() const [member function]
cls.add_method('GetScope',
'ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): bool ns3::Ipv4InterfaceAddress::IsSecondary() const [member function]
cls.add_method('IsSecondary',
'bool',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetBroadcast(ns3::Ipv4Address broadcast) [member function]
cls.add_method('SetBroadcast',
'void',
[param('ns3::Ipv4Address', 'broadcast')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetLocal(ns3::Ipv4Address local) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv4Address', 'local')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetMask(ns3::Ipv4Mask mask) [member function]
cls.add_method('SetMask',
'void',
[param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetPrimary() [member function]
cls.add_method('SetPrimary',
'void',
[])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetScope(ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SetScope',
'void',
[param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetSecondary() [member function]
cls.add_method('SetSecondary',
'void',
[])
return
def register_Ns3Ipv4Mask_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor]
cls.add_constructor([param('uint32_t', 'mask')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor]
cls.add_constructor([param('char const *', 'mask')])
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function]
cls.add_method('GetInverse',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint16_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Mask', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'mask')])
return
def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor]
cls.add_constructor([param('uint8_t *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function]
cls.add_method('CombinePrefix',
'ns3::Ipv6Address',
[param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv6Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv6Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function]
cls.add_method('GetAllHostsMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function]
cls.add_method('GetAllNodesMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function]
cls.add_method('GetAllRoutersMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function]
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function]
cls.add_method('IsAllRoutersMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Address const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function]
cls.add_method('IsLinkLocal',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function]
cls.add_method('IsSolicitedMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function]
cls.add_method('MakeSolicitedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv6Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function]
cls.add_method('Set',
'void',
[param('uint8_t *', 'address')])
return
def register_Ns3Ipv6Prefix_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor]
cls.add_constructor([param('uint8_t *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor]
cls.add_constructor([param('char const *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor]
cls.add_constructor([param('uint8_t', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Prefix const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3PacketMetadata_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor]
cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[param('ns3::Buffer', 'buffer')],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function]
cls.add_method('CreateFragment',
'ns3::PacketMetadata',
[param('uint32_t', 'start'), param('uint32_t', 'end')],
is_const=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function]
cls.add_method('Enable',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('RemoveTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3PacketMetadataItem_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor]
cls.add_constructor([])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable]
cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable]
cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable]
cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable]
cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable]
cls.add_instance_attribute('isFragment', 'bool', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3PacketMetadataItemIterator_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor]
cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')])
## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketMetadata::Item',
[])
return
def register_Ns3PacketTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketTagIterator::Item',
[])
return
def register_Ns3PacketTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3PacketTagList_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList const &', 'o')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function]
cls.add_method('Add',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function]
cls.add_method('Head',
'ns3::PacketTagList::TagData const *',
[],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function]
cls.add_method('Peek',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function]
cls.add_method('Remove',
'bool',
[param('ns3::Tag &', 'tag')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3PacketTagListTagData_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable]
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable]
cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable]
cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Tag const &', 'arg0')])
## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_virtual=True)
## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TagBuffer_methods(root_module, cls):
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')])
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor]
cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function]
cls.add_method('CopyFrom',
'void',
[param('ns3::TagBuffer', 'o')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function]
cls.add_method('ReadDouble',
'double',
[])
## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function]
cls.add_method('TrimAtEnd',
'void',
[param('uint32_t', 'trim')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function]
cls.add_method('WriteDouble',
'void',
[param('double', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'v')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint32_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint32_t',
[],
is_static=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'tid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable]
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Chunk_methods(root_module, cls):
## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor]
cls.add_constructor([])
## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Chunk const &', 'arg0')])
## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Header_methods(root_module, cls):
cls.add_output_stream_operator()
## header.h (module 'network'): ns3::Header::Header() [constructor]
cls.add_constructor([])
## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Header const &', 'arg0')])
## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Ipv4Header_methods(root_module, cls):
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::Ipv4Header(ns3::Ipv4Header const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Header const &', 'arg0')])
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::Ipv4Header() [constructor]
cls.add_constructor([])
## ipv4-header.h (module 'internet'): uint32_t ns3::Ipv4Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::EnableChecksum() [member function]
cls.add_method('EnableChecksum',
'void',
[])
## ipv4-header.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Header::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetFragmentOffset() const [member function]
cls.add_method('GetFragmentOffset',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetIdentification() const [member function]
cls.add_method('GetIdentification',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): ns3::TypeId ns3::Ipv4Header::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetPayloadSize() const [member function]
cls.add_method('GetPayloadSize',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint32_t ns3::Ipv4Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Header::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): static ns3::TypeId ns3::Ipv4Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsChecksumOk() const [member function]
cls.add_method('IsChecksumOk',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsDontFragment() const [member function]
cls.add_method('IsDontFragment',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsLastFragment() const [member function]
cls.add_method('IsLastFragment',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetDestination(ns3::Ipv4Address destination) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'destination')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetDontFragment() [member function]
cls.add_method('SetDontFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetFragmentOffset(uint16_t offsetBytes) [member function]
cls.add_method('SetFragmentOffset',
'void',
[param('uint16_t', 'offsetBytes')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetIdentification(uint16_t identification) [member function]
cls.add_method('SetIdentification',
'void',
[param('uint16_t', 'identification')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetLastFragment() [member function]
cls.add_method('SetLastFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetMayFragment() [member function]
cls.add_method('SetMayFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetMoreFragments() [member function]
cls.add_method('SetMoreFragments',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetPayloadSize(uint16_t size) [member function]
cls.add_method('SetPayloadSize',
'void',
[param('uint16_t', 'size')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetProtocol(uint8_t num) [member function]
cls.add_method('SetProtocol',
'void',
[param('uint8_t', 'num')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetSource(ns3::Ipv4Address source) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'source')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Start() [member function]
cls.add_method('Start',
'void',
[])
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4MulticastRoute > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4Route > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Socket_methods(root_module, cls):
## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Socket const &', 'arg0')])
## socket.h (module 'network'): ns3::Socket::Socket() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function]
cls.add_method('BindToNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netdevice')],
is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function]
cls.add_method('GetBoundNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[])
## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Recv',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function]
cls.add_method('SendTo',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')])
## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function]
cls.add_method('SetAcceptCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')])
## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function]
cls.add_method('SetCloseCallbacks',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')])
## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function]
cls.add_method('SetConnectCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')])
## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function]
cls.add_method('SetDataSentCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')])
## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function]
cls.add_method('SetRecvCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')])
## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function]
cls.add_method('SetRecvPktInfo',
'void',
[param('bool', 'flag')])
## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function]
cls.add_method('SetSendCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')])
## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function]
cls.add_method('NotifyConnectionFailed',
'void',
[],
visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function]
cls.add_method('NotifyConnectionRequest',
'bool',
[param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function]
cls.add_method('NotifyConnectionSucceeded',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function]
cls.add_method('NotifyDataRecv',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function]
cls.add_method('NotifyDataSent',
'void',
[param('uint32_t', 'size')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function]
cls.add_method('NotifyErrorClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function]
cls.add_method('NotifyNewConnectionCreated',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function]
cls.add_method('NotifyNormalClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function]
cls.add_method('NotifySend',
'void',
[param('uint32_t', 'spaceAvailable')],
visibility='protected')
return
def register_Ns3SocketAddressTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag(ns3::SocketAddressTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketAddressTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketAddressTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::Address ns3::SocketAddressTag::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketAddressTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketAddressTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketAddressTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::SetAddress(ns3::Address addr) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'addr')])
return
def register_Ns3SocketIpTtlTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Trailer_methods(root_module, cls):
cls.add_output_stream_operator()
## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor]
cls.add_constructor([])
## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Trailer const &', 'arg0')])
## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_pure_virtual=True, is_virtual=True)
## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4_methods(root_module, cls):
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4(ns3::Ipv4 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4 const &', 'arg0')])
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4() [constructor]
cls.add_constructor([])
## ipv4.h (module 'internet'): bool ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddInterface',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4::GetAddress(uint32_t interface, uint32_t addressIndex) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForAddress(ns3::Ipv4Address address) const [member function]
cls.add_method('GetInterfaceForAddress',
'int32_t',
[param('ns3::Ipv4Address', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) const [member function]
cls.add_method('GetInterfaceForDevice',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice const >', 'device')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForPrefix(ns3::Ipv4Address address, ns3::Ipv4Mask mask) const [member function]
cls.add_method('GetInterfaceForPrefix',
'int32_t',
[param('ns3::Ipv4Address', 'address'), param('ns3::Ipv4Mask', 'mask')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMetric(uint32_t interface) const [member function]
cls.add_method('GetMetric',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMtu(uint32_t interface) const [member function]
cls.add_method('GetMtu',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNAddresses(uint32_t interface) const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNInterfaces() const [member function]
cls.add_method('GetNInterfaces',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4::GetNetDevice(uint32_t interface) [member function]
cls.add_method('GetNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4::GetRoutingProtocol() const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): static ns3::TypeId ns3::Ipv4::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Insert(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsDestinationAddress(ns3::Ipv4Address address, uint32_t iif) const [member function]
cls.add_method('IsDestinationAddress',
'bool',
[param('ns3::Ipv4Address', 'address'), param('uint32_t', 'iif')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsForwarding(uint32_t interface) const [member function]
cls.add_method('IsForwarding',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsUp(uint32_t interface) const [member function]
cls.add_method('IsUp',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::RemoveAddress(uint32_t interface, uint32_t addressIndex) [member function]
cls.add_method('RemoveAddress',
'bool',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4::SelectSourceAddress(ns3::Ptr<const ns3::NetDevice> device, ns3::Ipv4Address dst, ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SelectSourceAddress',
'ns3::Ipv4Address',
[param('ns3::Ptr< ns3::NetDevice const >', 'device'), param('ns3::Ipv4Address', 'dst'), param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol, ns3::Ptr<ns3::Ipv4Route> route) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol'), param('ns3::Ptr< ns3::Ipv4Route >', 'route')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetDown(uint32_t interface) [member function]
cls.add_method('SetDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetForwarding(uint32_t interface, bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('uint32_t', 'interface'), param('bool', 'val')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetMetric(uint32_t interface, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'interface'), param('uint16_t', 'metric')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol) [member function]
cls.add_method('SetRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetUp(uint32_t interface) [member function]
cls.add_method('SetUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4::IF_ANY [variable]
cls.add_static_attribute('IF_ANY', 'uint32_t const', is_const=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetIpForward() const [member function]
cls.add_method('GetIpForward',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetWeakEsModel() const [member function]
cls.add_method('GetWeakEsModel',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetIpForward(bool forward) [member function]
cls.add_method('SetIpForward',
'void',
[param('bool', 'forward')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetWeakEsModel(bool model) [member function]
cls.add_method('SetWeakEsModel',
'void',
[param('bool', 'model')],
is_pure_virtual=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4AddressChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv4AddressValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Address const &', 'value')])
return
def register_Ns3Ipv4Interface_methods(root_module, cls):
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface::Ipv4Interface(ns3::Ipv4Interface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Interface const &', 'arg0')])
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface::Ipv4Interface() [constructor]
cls.add_constructor([])
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::AddAddress(ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('ns3::Ipv4InterfaceAddress', 'address')])
## ipv4-interface.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4Interface::GetAddress(uint32_t index) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'index')],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ptr<ns3::ArpCache> ns3::Ipv4Interface::GetArpCache() const [member function]
cls.add_method('GetArpCache',
'ns3::Ptr< ns3::ArpCache >',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4Interface::GetDevice() const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): uint16_t ns3::Ipv4Interface::GetMetric() const [member function]
cls.add_method('GetMetric',
'uint16_t',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): uint32_t ns3::Ipv4Interface::GetNAddresses() const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): static ns3::TypeId ns3::Ipv4Interface::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsDown() const [member function]
cls.add_method('IsDown',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsForwarding() const [member function]
cls.add_method('IsForwarding',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsUp() const [member function]
cls.add_method('IsUp',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4Interface::RemoveAddress(uint32_t index) [member function]
cls.add_method('RemoveAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'index')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::Send(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetArpCache(ns3::Ptr<ns3::ArpCache> arg0) [member function]
cls.add_method('SetArpCache',
'void',
[param('ns3::Ptr< ns3::ArpCache >', 'arg0')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetDevice(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('SetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetDown() [member function]
cls.add_method('SetDown',
'void',
[])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetForwarding(bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('bool', 'val')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetMetric(uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint16_t', 'metric')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetUp() [member function]
cls.add_method('SetUp',
'void',
[])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3Ipv4L3ClickProtocol_methods(root_module, cls):
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol::Ipv4L3ClickProtocol() [constructor]
cls.add_constructor([])
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol::Ipv4L3ClickProtocol(ns3::Ipv4L3ClickProtocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4L3ClickProtocol const &', 'arg0')])
return
def register_Ns3Ipv4L4Protocol_methods(root_module, cls):
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::Ipv4L4Protocol() [constructor]
cls.add_constructor([])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::Ipv4L4Protocol(ns3::Ipv4L4Protocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4L4Protocol const &', 'arg0')])
## ipv4-l4-protocol.h (module 'internet'): ns3::Callback<void,ns3::Ptr<ns3::Packet>,ns3::Ipv4Address,ns3::Ipv4Address,unsigned char,ns3::Ptr<ns3::Ipv4Route>,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::Ipv4L4Protocol::GetDownTarget() const [member function]
cls.add_method('GetDownTarget',
'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr< ns3::Ipv4Route >, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): int ns3::Ipv4L4Protocol::GetProtocolNumber() const [member function]
cls.add_method('GetProtocolNumber',
'int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): static ns3::TypeId ns3::Ipv4L4Protocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::RxStatus ns3::Ipv4L4Protocol::Receive(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::Ipv4Interface> incomingInterface) [member function]
cls.add_method('Receive',
'ns3::Ipv4L4Protocol::RxStatus',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::Ipv4Interface >', 'incomingInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): void ns3::Ipv4L4Protocol::ReceiveIcmp(ns3::Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, ns3::Ipv4Address payloadSource, ns3::Ipv4Address payloadDestination, uint8_t const * payload) [member function]
cls.add_method('ReceiveIcmp',
'void',
[param('ns3::Ipv4Address', 'icmpSource'), param('uint8_t', 'icmpTtl'), param('uint8_t', 'icmpType'), param('uint8_t', 'icmpCode'), param('uint32_t', 'icmpInfo'), param('ns3::Ipv4Address', 'payloadSource'), param('ns3::Ipv4Address', 'payloadDestination'), param('uint8_t const *', 'payload')],
is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): void ns3::Ipv4L4Protocol::SetDownTarget(ns3::Callback<void,ns3::Ptr<ns3::Packet>,ns3::Ipv4Address,ns3::Ipv4Address,unsigned char,ns3::Ptr<ns3::Ipv4Route>,ns3::empty,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetDownTarget',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr< ns3::Ipv4Route >, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv4MaskChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')])
return
def register_Ns3Ipv4MaskValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Mask const &', 'value')])
return
def register_Ns3Ipv4MulticastRoute_methods(root_module, cls):
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetGroup() const [member function]
cls.add_method('GetGroup',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetOrigin() const [member function]
cls.add_method('GetOrigin',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): uint32_t ns3::Ipv4MulticastRoute::GetOutputTtl(uint32_t oif) [member function]
cls.add_method('GetOutputTtl',
'uint32_t',
[param('uint32_t', 'oif')],
deprecated=True)
## ipv4-route.h (module 'internet'): std::map<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > > ns3::Ipv4MulticastRoute::GetOutputTtlMap() const [member function]
cls.add_method('GetOutputTtlMap',
'std::map< unsigned int, unsigned int >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): uint32_t ns3::Ipv4MulticastRoute::GetParent() const [member function]
cls.add_method('GetParent',
'uint32_t',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetGroup(ns3::Ipv4Address const group) [member function]
cls.add_method('SetGroup',
'void',
[param('ns3::Ipv4Address const', 'group')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOrigin(ns3::Ipv4Address const origin) [member function]
cls.add_method('SetOrigin',
'void',
[param('ns3::Ipv4Address const', 'origin')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOutputTtl(uint32_t oif, uint32_t ttl) [member function]
cls.add_method('SetOutputTtl',
'void',
[param('uint32_t', 'oif'), param('uint32_t', 'ttl')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetParent(uint32_t iif) [member function]
cls.add_method('SetParent',
'void',
[param('uint32_t', 'iif')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_INTERFACES [variable]
cls.add_static_attribute('MAX_INTERFACES', 'uint32_t const', is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_TTL [variable]
cls.add_static_attribute('MAX_TTL', 'uint32_t const', is_const=True)
return
def register_Ns3Ipv4Route_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Route const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetGateway() const [member function]
cls.add_method('GetGateway',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4Route::GetOutputDevice() const [member function]
cls.add_method('GetOutputDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetDestination(ns3::Ipv4Address dest) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'dest')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetGateway(ns3::Ipv4Address gw) [member function]
cls.add_method('SetGateway',
'void',
[param('ns3::Ipv4Address', 'gw')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetOutputDevice(ns3::Ptr<ns3::NetDevice> outputDevice) [member function]
cls.add_method('SetOutputDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'outputDevice')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetSource(ns3::Ipv4Address src) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'src')])
return
def register_Ns3Ipv4RoutingProtocol_methods(root_module, cls):
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol() [constructor]
cls.add_constructor([])
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol(ns3::Ipv4RoutingProtocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4RoutingProtocol const &', 'arg0')])
## ipv4-routing-protocol.h (module 'internet'): static ns3::TypeId ns3::Ipv4RoutingProtocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyAddAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyRemoveAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('PrintRoutingTable',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): bool ns3::Ipv4RoutingProtocol::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4RoutingProtocol::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv6AddressValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Address const &', 'value')])
return
def register_Ns3Ipv6PrefixChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')])
return
def register_Ns3Ipv6PrefixValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Prefix',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Prefix const &', 'value')])
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback<bool,ns3::Ptr<ns3::NetDevice>,ns3::Ptr<const ns3::Packet>,short unsigned int,const ns3::Address&,const ns3::Address&,ns3::NetDevice::PacketType,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, short unsigned int, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::Callback<bool,ns3::Ptr<ns3::NetDevice>,ns3::Ptr<const ns3::Packet>,short unsigned int,const ns3::Address&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, short unsigned int, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NixVector_methods(root_module, cls):
cls.add_output_stream_operator()
## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor]
cls.add_constructor([])
## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor]
cls.add_constructor([param('ns3::NixVector const &', 'o')])
## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function]
cls.add_method('AddNeighborIndex',
'void',
[param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function]
cls.add_method('BitCount',
'uint32_t',
[param('uint32_t', 'numberOfNeighbors')],
is_const=True)
## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint32_t const *', 'buffer'), param('uint32_t', 'size')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function]
cls.add_method('ExtractNeighborIndex',
'uint32_t',
[param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function]
cls.add_method('GetRemainingBits',
'uint32_t',
[])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3OutputStreamWrapper_methods(root_module, cls):
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
[])
return
def register_Ns3Packet_methods(root_module, cls):
cls.add_output_stream_operator()
## packet.h (module 'network'): ns3::Packet::Packet() [constructor]
cls.add_constructor([])
## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor]
cls.add_constructor([param('ns3::Packet const &', 'o')])
## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor]
cls.add_constructor([param('uint32_t', 'size')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header')])
## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddPacketTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer')])
## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function]
cls.add_method('EnablePrinting',
'void',
[],
is_static=True)
## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function]
cls.add_method('FindFirstMatchingByteTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function]
cls.add_method('GetByteTagIterator',
'ns3::ByteTagIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function]
cls.add_method('GetNixVector',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function]
cls.add_method('GetPacketTagIterator',
'ns3::PacketTagIterator',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
deprecated=True, is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header')],
is_const=True)
## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function]
cls.add_method('PeekPacketTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('PeekTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function]
cls.add_method('PrintByteTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function]
cls.add_method('PrintPacketTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function]
cls.add_method('RemoveAllByteTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function]
cls.add_method('RemoveAllPacketTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header')])
## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function]
cls.add_method('RemovePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('RemoveTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function]
cls.add_method('SetNixVector',
'void',
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3AddressChecker_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')])
return
def register_Ns3AddressValue_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressValue const &', 'arg0')])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor]
cls.add_constructor([param('ns3::Address const &', 'value')])
## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Address',
[],
is_const=True)
## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Address const &', 'value')])
return
def register_Ns3Ipv4ClickRouting_methods(root_module, cls):
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting::Ipv4ClickRouting() [constructor]
cls.add_constructor([])
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting::Ipv4ClickRouting(ns3::Ipv4ClickRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4ClickRouting const &', 'arg0')])
return
def register_functions(root_module):
module = root_module
register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
return
def register_functions_ns3_FatalImpl(module, root_module):
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
| zy901002-gpsr | src/click/bindings/modulegen__gcc_ILP32.py | Python | gpl2 | 251,102 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.click', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE'], import_from_module='ns.core')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList', import_from_module='ns.core')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList'])
## buffer.h (module 'network'): ns3::Buffer [class]
module.add_class('Buffer', import_from_module='ns.network')
## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer'])
## packet.h (module 'network'): ns3::ByteTagIterator [class]
module.add_class('ByteTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
module.add_class('ByteTagList', import_from_module='ns.network')
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase', import_from_module='ns.core')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
module.add_class('Ipv4Address', import_from_module='ns.network')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
module.add_class('Ipv4InterfaceAddress', import_from_module='ns.internet')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e [enumeration]
module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'], import_from_module='ns.internet')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
module.add_class('Ipv4Mask', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
module.add_class('Ipv6Address', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter', import_from_module='ns.core')
## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
module.add_class('PacketMetadata', import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration]
module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet.h (module 'network'): ns3::PacketTagIterator [class]
module.add_class('PacketTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
module.add_class('PacketTagList', import_from_module='ns.network')
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
module.add_class('TagBuffer', import_from_module='ns.network')
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty', import_from_module='ns.core')
## chunk.h (module 'network'): ns3::Chunk [class]
module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## header.h (module 'network'): ns3::Header [class]
module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
module.add_class('Ipv4Header', import_from_module='ns.internet', parent=root_module['ns3::Header'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4MulticastRoute', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4MulticastRoute>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Ipv4Route', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Ipv4Route>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## socket.h (module 'network'): ns3::Socket [class]
module.add_class('Socket', import_from_module='ns.network', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::SocketType [enumeration]
module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::SocketAddressTag [class]
module.add_class('SocketAddressTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpTtlTag [class]
module.add_class('SocketIpTtlTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class]
module.add_class('SocketSetDontFragmentTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## trailer.h (module 'network'): ns3::Trailer [class]
module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ipv4.h (module 'internet'): ns3::Ipv4 [class]
module.add_class('Ipv4', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class]
module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class]
module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface [class]
module.add_class('Ipv4Interface', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol [class]
module.add_class('Ipv4L3ClickProtocol', parent=root_module['ns3::Ipv4'])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol [class]
module.add_class('Ipv4L4Protocol', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::RxStatus [enumeration]
module.add_enum('RxStatus', ['RX_OK', 'RX_CSUM_FAILED', 'RX_ENDPOINT_CLOSED', 'RX_ENDPOINT_UNREACH'], outer_class=root_module['ns3::Ipv4L4Protocol'], import_from_module='ns.internet')
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class]
module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute [class]
module.add_class('Ipv4MulticastRoute', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route [class]
module.add_class('Ipv4Route', import_from_module='ns.internet', parent=root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol [class]
module.add_class('Ipv4RoutingProtocol', import_from_module='ns.internet', parent=root_module['ns3::Object'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class]
module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class]
module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class]
module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network')
## nix-vector.h (module 'network'): ns3::NixVector [class]
module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class]
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## address.h (module 'network'): ns3::AddressChecker [class]
module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## address.h (module 'network'): ns3::AddressValue [class]
module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting [class]
module.add_class('Ipv4ClickRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
module.add_container('std::map< unsigned int, unsigned int >', ('unsigned int', 'unsigned int'), container_type='map')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogTimePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogTimePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogTimePrinter&')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *', 'ns3::LogNodePrinter')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) **', 'ns3::LogNodePrinter*')
typehandlers.add_type_alias('void ( * ) ( std::ostream & ) *&', 'ns3::LogNodePrinter&')
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer'])
register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator'])
register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator'])
register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item'])
register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList'])
register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator'])
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
register_Ns3Ipv4InterfaceAddress_methods(root_module, root_module['ns3::Ipv4InterfaceAddress'])
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata'])
register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item'])
register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator'])
register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator'])
register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item'])
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
register_Ns3Ipv4Header_methods(root_module, root_module['ns3::Ipv4Header'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >'])
register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >'])
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Socket_methods(root_module, root_module['ns3::Socket'])
register_Ns3SocketAddressTag_methods(root_module, root_module['ns3::SocketAddressTag'])
register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag'])
register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3Ipv4_methods(root_module, root_module['ns3::Ipv4'])
register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker'])
register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue'])
register_Ns3Ipv4Interface_methods(root_module, root_module['ns3::Ipv4Interface'])
register_Ns3Ipv4L3ClickProtocol_methods(root_module, root_module['ns3::Ipv4L3ClickProtocol'])
register_Ns3Ipv4L4Protocol_methods(root_module, root_module['ns3::Ipv4L4Protocol'])
register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker'])
register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue'])
register_Ns3Ipv4MulticastRoute_methods(root_module, root_module['ns3::Ipv4MulticastRoute'])
register_Ns3Ipv4Route_methods(root_module, root_module['ns3::Ipv4Route'])
register_Ns3Ipv4RoutingProtocol_methods(root_module, root_module['ns3::Ipv4RoutingProtocol'])
register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker'])
register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue'])
register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker'])
register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3Ipv4ClickRouting_methods(root_module, root_module['ns3::Ipv4ClickRouting'])
return
def register_Ns3Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## address.h (module 'network'): ns3::Address::Address() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor]
cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor]
cls.add_constructor([param('ns3::Address const &', 'address')])
## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function]
cls.add_method('CheckCompatible',
'bool',
[param('uint8_t', 'type'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyAllFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function]
cls.add_method('CopyAllTo',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'uint32_t',
[param('uint8_t *', 'buffer')],
is_const=True)
## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buffer')])
## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function]
cls.add_method('GetLength',
'uint8_t',
[],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function]
cls.add_method('IsInvalid',
'bool',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function]
cls.add_method('IsMatchingType',
'bool',
[param('uint8_t', 'type')],
is_const=True)
## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function]
cls.add_method('Register',
'uint8_t',
[],
is_static=True)
## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buffer')],
is_const=True)
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3Buffer_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor]
cls.add_constructor([param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function]
cls.add_method('AddAtEnd',
'bool',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function]
cls.add_method('AddAtStart',
'bool',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function]
cls.add_method('Begin',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Buffer',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function]
cls.add_method('CreateFullCopy',
'ns3::Buffer',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function]
cls.add_method('End',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function]
cls.add_method('GetCurrentEndOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function]
cls.add_method('GetCurrentStartOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3BufferIterator_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')])
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function]
cls.add_method('GetDistanceFrom',
'uint32_t',
[param('ns3::Buffer::Iterator const &', 'o')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function]
cls.add_method('IsEnd',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function]
cls.add_method('IsStart',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function]
cls.add_method('Next',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function]
cls.add_method('Next',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
cls.add_method('Prev',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function]
cls.add_method('Prev',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
cls.add_method('ReadLsbtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function]
cls.add_method('ReadLsbtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function]
cls.add_method('ReadLsbtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function]
cls.add_method('ReadNtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function]
cls.add_method('ReadNtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function]
cls.add_method('ReadNtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Write',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function]
cls.add_method('WriteHtolsbU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function]
cls.add_method('WriteHtolsbU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function]
cls.add_method('WriteHtolsbU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function]
cls.add_method('WriteHtonU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function]
cls.add_method('WriteHtonU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function]
cls.add_method('WriteHtonU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data'), param('uint32_t', 'len')])
return
def register_Ns3ByteTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagIterator::Item',
[])
return
def register_Ns3ByteTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function]
cls.add_method('GetEnd',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function]
cls.add_method('GetStart',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3ByteTagList_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor]
cls.add_constructor([])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function]
cls.add_method('Add',
'ns3::TagBuffer',
[param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function]
cls.add_method('Add',
'void',
[param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function]
cls.add_method('AddAtEnd',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function]
cls.add_method('AddAtStart',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function]
cls.add_method('Begin',
'ns3::ByteTagList::Iterator',
[param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')],
is_const=True)
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3ByteTagListIterator_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')])
## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function]
cls.add_method('GetOffsetStart',
'uint32_t',
[],
is_const=True)
## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagList::Iterator::Item',
[])
return
def register_Ns3ByteTagListIteratorItem_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor]
cls.add_constructor([param('ns3::TagBuffer', 'buf')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable]
cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable]
cls.add_instance_attribute('end', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable]
cls.add_instance_attribute('size', 'uint32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable]
cls.add_instance_attribute('start', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
return
def register_Ns3Ipv4Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor]
cls.add_constructor([param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('CombineMask',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv4Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv4Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('GetSubnetDirectedBroadcast',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Address const &', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function]
cls.add_method('IsLocalMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('IsSubnetDirectedBroadcast',
'bool',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
return
def register_Ns3Ipv4InterfaceAddress_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress() [constructor]
cls.add_constructor([])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4Address local, ns3::Ipv4Mask mask) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'local'), param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::Ipv4InterfaceAddress(ns3::Ipv4InterfaceAddress const & o) [copy constructor]
cls.add_constructor([param('ns3::Ipv4InterfaceAddress const &', 'o')])
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4InterfaceAddress::GetLocal() const [member function]
cls.add_method('GetLocal',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4Mask ns3::Ipv4InterfaceAddress::GetMask() const [member function]
cls.add_method('GetMask',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e ns3::Ipv4InterfaceAddress::GetScope() const [member function]
cls.add_method('GetScope',
'ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): bool ns3::Ipv4InterfaceAddress::IsSecondary() const [member function]
cls.add_method('IsSecondary',
'bool',
[],
is_const=True)
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetBroadcast(ns3::Ipv4Address broadcast) [member function]
cls.add_method('SetBroadcast',
'void',
[param('ns3::Ipv4Address', 'broadcast')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetLocal(ns3::Ipv4Address local) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv4Address', 'local')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetMask(ns3::Ipv4Mask mask) [member function]
cls.add_method('SetMask',
'void',
[param('ns3::Ipv4Mask', 'mask')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetPrimary() [member function]
cls.add_method('SetPrimary',
'void',
[])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetScope(ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SetScope',
'void',
[param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')])
## ipv4-interface-address.h (module 'internet'): void ns3::Ipv4InterfaceAddress::SetSecondary() [member function]
cls.add_method('SetSecondary',
'void',
[])
return
def register_Ns3Ipv4Mask_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor]
cls.add_constructor([param('uint32_t', 'mask')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor]
cls.add_constructor([param('char const *', 'mask')])
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function]
cls.add_method('GetInverse',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint16_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Mask', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'mask')])
return
def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor]
cls.add_constructor([param('uint8_t *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function]
cls.add_method('CombinePrefix',
'ns3::Ipv6Address',
[param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv6Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv6Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function]
cls.add_method('GetAllHostsMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function]
cls.add_method('GetAllNodesMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function]
cls.add_method('GetAllRoutersMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function]
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function]
cls.add_method('IsAllRoutersMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Address const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function]
cls.add_method('IsLinkLocal',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function]
cls.add_method('IsSolicitedMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function]
cls.add_method('MakeSolicitedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv6Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function]
cls.add_method('Set',
'void',
[param('uint8_t *', 'address')])
return
def register_Ns3Ipv6Prefix_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor]
cls.add_constructor([param('uint8_t *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor]
cls.add_constructor([param('char const *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor]
cls.add_constructor([param('uint8_t', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Prefix const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
return
def register_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel', 'level')])
## log.h (module 'core'): void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
cls.add_method('EnvVarCheck',
'void',
[param('char const *', 'name')])
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3PacketMetadata_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor]
cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[param('ns3::Buffer', 'buffer')],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function]
cls.add_method('CreateFragment',
'ns3::PacketMetadata',
[param('uint32_t', 'start'), param('uint32_t', 'end')],
is_const=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function]
cls.add_method('Enable',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('RemoveTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3PacketMetadataItem_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor]
cls.add_constructor([])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable]
cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable]
cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable]
cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable]
cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable]
cls.add_instance_attribute('isFragment', 'bool', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3PacketMetadataItemIterator_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor]
cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')])
## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketMetadata::Item',
[])
return
def register_Ns3PacketTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketTagIterator::Item',
[])
return
def register_Ns3PacketTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3PacketTagList_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList const &', 'o')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function]
cls.add_method('Add',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function]
cls.add_method('Head',
'ns3::PacketTagList::TagData const *',
[],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function]
cls.add_method('Peek',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function]
cls.add_method('Remove',
'bool',
[param('ns3::Tag &', 'tag')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3PacketTagListTagData_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable]
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable]
cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable]
cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Tag const &', 'arg0')])
## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_virtual=True)
## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TagBuffer_methods(root_module, cls):
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')])
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor]
cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function]
cls.add_method('CopyFrom',
'void',
[param('ns3::TagBuffer', 'o')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function]
cls.add_method('ReadDouble',
'double',
[])
## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function]
cls.add_method('TrimAtEnd',
'void',
[param('uint32_t', 'trim')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function]
cls.add_method('WriteDouble',
'void',
[param('double', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'v')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint32_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint32_t',
[],
is_static=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info')],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'tid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable]
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Chunk_methods(root_module, cls):
## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor]
cls.add_constructor([])
## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Chunk const &', 'arg0')])
## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Header_methods(root_module, cls):
cls.add_output_stream_operator()
## header.h (module 'network'): ns3::Header::Header() [constructor]
cls.add_constructor([])
## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Header const &', 'arg0')])
## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Ipv4Header_methods(root_module, cls):
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::Ipv4Header(ns3::Ipv4Header const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Header const &', 'arg0')])
## ipv4-header.h (module 'internet'): ns3::Ipv4Header::Ipv4Header() [constructor]
cls.add_constructor([])
## ipv4-header.h (module 'internet'): uint32_t ns3::Ipv4Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::EnableChecksum() [member function]
cls.add_method('EnableChecksum',
'void',
[])
## ipv4-header.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Header::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetFragmentOffset() const [member function]
cls.add_method('GetFragmentOffset',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetIdentification() const [member function]
cls.add_method('GetIdentification',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): ns3::TypeId ns3::Ipv4Header::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): uint16_t ns3::Ipv4Header::GetPayloadSize() const [member function]
cls.add_method('GetPayloadSize',
'uint16_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint32_t ns3::Ipv4Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Header::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): uint8_t ns3::Ipv4Header::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## ipv4-header.h (module 'internet'): static ns3::TypeId ns3::Ipv4Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsChecksumOk() const [member function]
cls.add_method('IsChecksumOk',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsDontFragment() const [member function]
cls.add_method('IsDontFragment',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): bool ns3::Ipv4Header::IsLastFragment() const [member function]
cls.add_method('IsLastFragment',
'bool',
[],
is_const=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetDestination(ns3::Ipv4Address destination) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'destination')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetDontFragment() [member function]
cls.add_method('SetDontFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetFragmentOffset(uint16_t offsetBytes) [member function]
cls.add_method('SetFragmentOffset',
'void',
[param('uint16_t', 'offsetBytes')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetIdentification(uint16_t identification) [member function]
cls.add_method('SetIdentification',
'void',
[param('uint16_t', 'identification')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetLastFragment() [member function]
cls.add_method('SetLastFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetMayFragment() [member function]
cls.add_method('SetMayFragment',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetMoreFragments() [member function]
cls.add_method('SetMoreFragments',
'void',
[])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetPayloadSize(uint16_t size) [member function]
cls.add_method('SetPayloadSize',
'void',
[param('uint16_t', 'size')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetProtocol(uint8_t num) [member function]
cls.add_method('SetProtocol',
'void',
[param('uint8_t', 'num')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetSource(ns3::Ipv4Address source) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'source')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
## ipv4-header.h (module 'internet'): void ns3::Ipv4Header::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Start() [member function]
cls.add_method('Start',
'void',
[])
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoStart() [member function]
cls.add_method('DoStart',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Ipv4MulticastRoute_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4MulticastRoute__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4MulticastRoute > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Ipv4MulticastRoute, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4MulticastRoute> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Ipv4Route_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4Route__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter< ns3::Ipv4Route > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Socket_methods(root_module, cls):
## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Socket const &', 'arg0')])
## socket.h (module 'network'): ns3::Socket::Socket() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function]
cls.add_method('BindToNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netdevice')],
is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function]
cls.add_method('GetBoundNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[])
## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Recv',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function]
cls.add_method('SendTo',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')])
## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function]
cls.add_method('SetAcceptCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')])
## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function]
cls.add_method('SetCloseCallbacks',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')])
## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function]
cls.add_method('SetConnectCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')])
## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function]
cls.add_method('SetDataSentCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')])
## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function]
cls.add_method('SetRecvCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')])
## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function]
cls.add_method('SetRecvPktInfo',
'void',
[param('bool', 'flag')])
## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function]
cls.add_method('SetSendCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')])
## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function]
cls.add_method('NotifyConnectionFailed',
'void',
[],
visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function]
cls.add_method('NotifyConnectionRequest',
'bool',
[param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function]
cls.add_method('NotifyConnectionSucceeded',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function]
cls.add_method('NotifyDataRecv',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function]
cls.add_method('NotifyDataSent',
'void',
[param('uint32_t', 'size')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function]
cls.add_method('NotifyErrorClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function]
cls.add_method('NotifyNewConnectionCreated',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function]
cls.add_method('NotifyNormalClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function]
cls.add_method('NotifySend',
'void',
[param('uint32_t', 'spaceAvailable')],
visibility='protected')
return
def register_Ns3SocketAddressTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag(ns3::SocketAddressTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketAddressTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketAddressTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::Address ns3::SocketAddressTag::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketAddressTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketAddressTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketAddressTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::SetAddress(ns3::Address addr) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'addr')])
return
def register_Ns3SocketIpTtlTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Trailer_methods(root_module, cls):
cls.add_output_stream_operator()
## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor]
cls.add_constructor([])
## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Trailer const &', 'arg0')])
## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_pure_virtual=True, is_virtual=True)
## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4_methods(root_module, cls):
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4(ns3::Ipv4 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4 const &', 'arg0')])
## ipv4.h (module 'internet'): ns3::Ipv4::Ipv4() [constructor]
cls.add_constructor([])
## ipv4.h (module 'internet'): bool ns3::Ipv4::AddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddInterface',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4::GetAddress(uint32_t interface, uint32_t addressIndex) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForAddress(ns3::Ipv4Address address) const [member function]
cls.add_method('GetInterfaceForAddress',
'int32_t',
[param('ns3::Ipv4Address', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) const [member function]
cls.add_method('GetInterfaceForDevice',
'int32_t',
[param('ns3::Ptr< ns3::NetDevice const >', 'device')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): int32_t ns3::Ipv4::GetInterfaceForPrefix(ns3::Ipv4Address address, ns3::Ipv4Mask mask) const [member function]
cls.add_method('GetInterfaceForPrefix',
'int32_t',
[param('ns3::Ipv4Address', 'address'), param('ns3::Ipv4Mask', 'mask')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMetric(uint32_t interface) const [member function]
cls.add_method('GetMetric',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint16_t ns3::Ipv4::GetMtu(uint32_t interface) const [member function]
cls.add_method('GetMtu',
'uint16_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNAddresses(uint32_t interface) const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): uint32_t ns3::Ipv4::GetNInterfaces() const [member function]
cls.add_method('GetNInterfaces',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4::GetNetDevice(uint32_t interface) [member function]
cls.add_method('GetNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4::GetRoutingProtocol() const [member function]
cls.add_method('GetRoutingProtocol',
'ns3::Ptr< ns3::Ipv4RoutingProtocol >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): static ns3::TypeId ns3::Ipv4::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Insert(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
cls.add_method('Insert',
'void',
[param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsDestinationAddress(ns3::Ipv4Address address, uint32_t iif) const [member function]
cls.add_method('IsDestinationAddress',
'bool',
[param('ns3::Ipv4Address', 'address'), param('uint32_t', 'iif')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsForwarding(uint32_t interface) const [member function]
cls.add_method('IsForwarding',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::IsUp(uint32_t interface) const [member function]
cls.add_method('IsUp',
'bool',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::RemoveAddress(uint32_t interface, uint32_t addressIndex) [member function]
cls.add_method('RemoveAddress',
'bool',
[param('uint32_t', 'interface'), param('uint32_t', 'addressIndex')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4::SelectSourceAddress(ns3::Ptr<const ns3::NetDevice> device, ns3::Ipv4Address dst, ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e scope) [member function]
cls.add_method('SelectSourceAddress',
'ns3::Ipv4Address',
[param('ns3::Ptr< ns3::NetDevice const >', 'device'), param('ns3::Ipv4Address', 'dst'), param('ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e', 'scope')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol, ns3::Ptr<ns3::Ipv4Route> route) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol'), param('ns3::Ptr< ns3::Ipv4Route >', 'route')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetDown(uint32_t interface) [member function]
cls.add_method('SetDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetForwarding(uint32_t interface, bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('uint32_t', 'interface'), param('bool', 'val')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetMetric(uint32_t interface, uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint32_t', 'interface'), param('uint16_t', 'metric')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol) [member function]
cls.add_method('SetRoutingProtocol',
'void',
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetUp(uint32_t interface) [member function]
cls.add_method('SetUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4.h (module 'internet'): ns3::Ipv4::IF_ANY [variable]
cls.add_static_attribute('IF_ANY', 'uint32_t const', is_const=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetIpForward() const [member function]
cls.add_method('GetIpForward',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): bool ns3::Ipv4::GetWeakEsModel() const [member function]
cls.add_method('GetWeakEsModel',
'bool',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetIpForward(bool forward) [member function]
cls.add_method('SetIpForward',
'void',
[param('bool', 'forward')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## ipv4.h (module 'internet'): void ns3::Ipv4::SetWeakEsModel(bool model) [member function]
cls.add_method('SetWeakEsModel',
'void',
[param('bool', 'model')],
is_pure_virtual=True, visibility='private', is_virtual=True)
return
def register_Ns3Ipv4AddressChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv4AddressValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Address const &', 'value')])
return
def register_Ns3Ipv4Interface_methods(root_module, cls):
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface::Ipv4Interface(ns3::Ipv4Interface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Interface const &', 'arg0')])
## ipv4-interface.h (module 'internet'): ns3::Ipv4Interface::Ipv4Interface() [constructor]
cls.add_constructor([])
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::AddAddress(ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('AddAddress',
'bool',
[param('ns3::Ipv4InterfaceAddress', 'address')])
## ipv4-interface.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4Interface::GetAddress(uint32_t index) const [member function]
cls.add_method('GetAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'index')],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ptr<ns3::ArpCache> ns3::Ipv4Interface::GetArpCache() const [member function]
cls.add_method('GetArpCache',
'ns3::Ptr< ns3::ArpCache >',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4Interface::GetDevice() const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): uint16_t ns3::Ipv4Interface::GetMetric() const [member function]
cls.add_method('GetMetric',
'uint16_t',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): uint32_t ns3::Ipv4Interface::GetNAddresses() const [member function]
cls.add_method('GetNAddresses',
'uint32_t',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): static ns3::TypeId ns3::Ipv4Interface::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsDown() const [member function]
cls.add_method('IsDown',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsForwarding() const [member function]
cls.add_method('IsForwarding',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): bool ns3::Ipv4Interface::IsUp() const [member function]
cls.add_method('IsUp',
'bool',
[],
is_const=True)
## ipv4-interface.h (module 'internet'): ns3::Ipv4InterfaceAddress ns3::Ipv4Interface::RemoveAddress(uint32_t index) [member function]
cls.add_method('RemoveAddress',
'ns3::Ipv4InterfaceAddress',
[param('uint32_t', 'index')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::Send(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetArpCache(ns3::Ptr<ns3::ArpCache> arg0) [member function]
cls.add_method('SetArpCache',
'void',
[param('ns3::Ptr< ns3::ArpCache >', 'arg0')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetDevice(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('SetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetDown() [member function]
cls.add_method('SetDown',
'void',
[])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetForwarding(bool val) [member function]
cls.add_method('SetForwarding',
'void',
[param('bool', 'val')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetMetric(uint16_t metric) [member function]
cls.add_method('SetMetric',
'void',
[param('uint16_t', 'metric')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::SetUp() [member function]
cls.add_method('SetUp',
'void',
[])
## ipv4-interface.h (module 'internet'): void ns3::Ipv4Interface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3Ipv4L3ClickProtocol_methods(root_module, cls):
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol::Ipv4L3ClickProtocol() [constructor]
cls.add_constructor([])
## ipv4-l3-click-protocol.h (module 'click'): ns3::Ipv4L3ClickProtocol::Ipv4L3ClickProtocol(ns3::Ipv4L3ClickProtocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4L3ClickProtocol const &', 'arg0')])
return
def register_Ns3Ipv4L4Protocol_methods(root_module, cls):
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::Ipv4L4Protocol() [constructor]
cls.add_constructor([])
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::Ipv4L4Protocol(ns3::Ipv4L4Protocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4L4Protocol const &', 'arg0')])
## ipv4-l4-protocol.h (module 'internet'): ns3::Callback<void,ns3::Ptr<ns3::Packet>,ns3::Ipv4Address,ns3::Ipv4Address,unsigned char,ns3::Ptr<ns3::Ipv4Route>,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::Ipv4L4Protocol::GetDownTarget() const [member function]
cls.add_method('GetDownTarget',
'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr< ns3::Ipv4Route >, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): int ns3::Ipv4L4Protocol::GetProtocolNumber() const [member function]
cls.add_method('GetProtocolNumber',
'int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): static ns3::TypeId ns3::Ipv4L4Protocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-l4-protocol.h (module 'internet'): ns3::Ipv4L4Protocol::RxStatus ns3::Ipv4L4Protocol::Receive(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::Ipv4Interface> incomingInterface) [member function]
cls.add_method('Receive',
'ns3::Ipv4L4Protocol::RxStatus',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::Ipv4Interface >', 'incomingInterface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): void ns3::Ipv4L4Protocol::ReceiveIcmp(ns3::Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, ns3::Ipv4Address payloadSource, ns3::Ipv4Address payloadDestination, uint8_t const * payload) [member function]
cls.add_method('ReceiveIcmp',
'void',
[param('ns3::Ipv4Address', 'icmpSource'), param('uint8_t', 'icmpTtl'), param('uint8_t', 'icmpType'), param('uint8_t', 'icmpCode'), param('uint32_t', 'icmpInfo'), param('ns3::Ipv4Address', 'payloadSource'), param('ns3::Ipv4Address', 'payloadDestination'), param('uint8_t const *', 'payload')],
is_virtual=True)
## ipv4-l4-protocol.h (module 'internet'): void ns3::Ipv4L4Protocol::SetDownTarget(ns3::Callback<void,ns3::Ptr<ns3::Packet>,ns3::Ipv4Address,ns3::Ipv4Address,unsigned char,ns3::Ptr<ns3::Ipv4Route>,ns3::empty,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetDownTarget',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr< ns3::Ipv4Route >, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv4MaskChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')])
return
def register_Ns3Ipv4MaskValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Mask const &', 'value')])
return
def register_Ns3Ipv4MulticastRoute_methods(root_module, cls):
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute(ns3::Ipv4MulticastRoute const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MulticastRoute const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::Ipv4MulticastRoute() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetGroup() const [member function]
cls.add_method('GetGroup',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4MulticastRoute::GetOrigin() const [member function]
cls.add_method('GetOrigin',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): uint32_t ns3::Ipv4MulticastRoute::GetOutputTtl(uint32_t oif) [member function]
cls.add_method('GetOutputTtl',
'uint32_t',
[param('uint32_t', 'oif')],
deprecated=True)
## ipv4-route.h (module 'internet'): std::map<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > > ns3::Ipv4MulticastRoute::GetOutputTtlMap() const [member function]
cls.add_method('GetOutputTtlMap',
'std::map< unsigned int, unsigned int >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): uint32_t ns3::Ipv4MulticastRoute::GetParent() const [member function]
cls.add_method('GetParent',
'uint32_t',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetGroup(ns3::Ipv4Address const group) [member function]
cls.add_method('SetGroup',
'void',
[param('ns3::Ipv4Address const', 'group')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOrigin(ns3::Ipv4Address const origin) [member function]
cls.add_method('SetOrigin',
'void',
[param('ns3::Ipv4Address const', 'origin')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetOutputTtl(uint32_t oif, uint32_t ttl) [member function]
cls.add_method('SetOutputTtl',
'void',
[param('uint32_t', 'oif'), param('uint32_t', 'ttl')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4MulticastRoute::SetParent(uint32_t iif) [member function]
cls.add_method('SetParent',
'void',
[param('uint32_t', 'iif')])
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_INTERFACES [variable]
cls.add_static_attribute('MAX_INTERFACES', 'uint32_t const', is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4MulticastRoute::MAX_TTL [variable]
cls.add_static_attribute('MAX_TTL', 'uint32_t const', is_const=True)
return
def register_Ns3Ipv4Route_methods(root_module, cls):
cls.add_output_stream_operator()
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route(ns3::Ipv4Route const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Route const &', 'arg0')])
## ipv4-route.h (module 'internet'): ns3::Ipv4Route::Ipv4Route() [constructor]
cls.add_constructor([])
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetGateway() const [member function]
cls.add_method('GetGateway',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ptr<ns3::NetDevice> ns3::Ipv4Route::GetOutputDevice() const [member function]
cls.add_method('GetOutputDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## ipv4-route.h (module 'internet'): ns3::Ipv4Address ns3::Ipv4Route::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetDestination(ns3::Ipv4Address dest) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Ipv4Address', 'dest')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetGateway(ns3::Ipv4Address gw) [member function]
cls.add_method('SetGateway',
'void',
[param('ns3::Ipv4Address', 'gw')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetOutputDevice(ns3::Ptr<ns3::NetDevice> outputDevice) [member function]
cls.add_method('SetOutputDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'outputDevice')])
## ipv4-route.h (module 'internet'): void ns3::Ipv4Route::SetSource(ns3::Ipv4Address src) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Ipv4Address', 'src')])
return
def register_Ns3Ipv4RoutingProtocol_methods(root_module, cls):
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol() [constructor]
cls.add_constructor([])
## ipv4-routing-protocol.h (module 'internet'): ns3::Ipv4RoutingProtocol::Ipv4RoutingProtocol(ns3::Ipv4RoutingProtocol const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4RoutingProtocol const &', 'arg0')])
## ipv4-routing-protocol.h (module 'internet'): static ns3::TypeId ns3::Ipv4RoutingProtocol::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyAddAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyAddAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyInterfaceDown(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceDown',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyInterfaceUp(uint32_t interface) [member function]
cls.add_method('NotifyInterfaceUp',
'void',
[param('uint32_t', 'interface')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::NotifyRemoveAddress(uint32_t interface, ns3::Ipv4InterfaceAddress address) [member function]
cls.add_method('NotifyRemoveAddress',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv4InterfaceAddress', 'address')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::PrintRoutingTable(ns3::Ptr<ns3::OutputStreamWrapper> stream) const [member function]
cls.add_method('PrintRoutingTable',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): bool ns3::Ipv4RoutingProtocol::RouteInput(ns3::Ptr<const ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<const ns3::NetDevice> idev, ns3::Callback<void,ns3::Ptr<ns3::Ipv4Route>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ucb, ns3::Callback<void,ns3::Ptr<ns3::Ipv4MulticastRoute>,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> mcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,unsigned int,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> lcb, ns3::Callback<void,ns3::Ptr<const ns3::Packet>,const ns3::Ipv4Header&,ns3::Socket::SocketErrno,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ecb) [member function]
cls.add_method('RouteInput',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice const >', 'idev'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ucb'), param('ns3::Callback< void, ns3::Ptr< ns3::Ipv4MulticastRoute >, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'mcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'lcb'), param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::Ipv4Header const &, ns3::Socket::SocketErrno, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ecb')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): ns3::Ptr<ns3::Ipv4Route> ns3::Ipv4RoutingProtocol::RouteOutput(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Header const & header, ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno & sockerr) [member function]
cls.add_method('RouteOutput',
'ns3::Ptr< ns3::Ipv4Route >',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Header const &', 'header'), param('ns3::Ptr< ns3::NetDevice >', 'oif'), param('ns3::Socket::SocketErrno &', 'sockerr')],
is_pure_virtual=True, is_virtual=True)
## ipv4-routing-protocol.h (module 'internet'): void ns3::Ipv4RoutingProtocol::SetIpv4(ns3::Ptr<ns3::Ipv4> ipv4) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv6AddressValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Address const &', 'value')])
return
def register_Ns3Ipv6PrefixChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')])
return
def register_Ns3Ipv6PrefixValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Prefix',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Prefix const &', 'value')])
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback<bool,ns3::Ptr<ns3::NetDevice>,ns3::Ptr<const ns3::Packet>,short unsigned int,const ns3::Address&,const ns3::Address&,ns3::NetDevice::PacketType,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, short unsigned int, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::Callback<bool,ns3::Ptr<ns3::NetDevice>,ns3::Ptr<const ns3::Packet>,short unsigned int,const ns3::Address&,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, short unsigned int, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NixVector_methods(root_module, cls):
cls.add_output_stream_operator()
## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor]
cls.add_constructor([])
## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor]
cls.add_constructor([param('ns3::NixVector const &', 'o')])
## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function]
cls.add_method('AddNeighborIndex',
'void',
[param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function]
cls.add_method('BitCount',
'uint32_t',
[param('uint32_t', 'numberOfNeighbors')],
is_const=True)
## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint32_t const *', 'buffer'), param('uint32_t', 'size')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function]
cls.add_method('ExtractNeighborIndex',
'uint32_t',
[param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function]
cls.add_method('GetRemainingBits',
'uint32_t',
[])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3OutputStreamWrapper_methods(root_module, cls):
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
[])
return
def register_Ns3Packet_methods(root_module, cls):
cls.add_output_stream_operator()
## packet.h (module 'network'): ns3::Packet::Packet() [constructor]
cls.add_constructor([])
## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor]
cls.add_constructor([param('ns3::Packet const &', 'o')])
## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor]
cls.add_constructor([param('uint32_t', 'size')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header')])
## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddPacketTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer')])
## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function]
cls.add_method('EnablePrinting',
'void',
[],
is_static=True)
## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function]
cls.add_method('FindFirstMatchingByteTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function]
cls.add_method('GetByteTagIterator',
'ns3::ByteTagIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function]
cls.add_method('GetNixVector',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function]
cls.add_method('GetPacketTagIterator',
'ns3::PacketTagIterator',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
deprecated=True, is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header')],
is_const=True)
## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function]
cls.add_method('PeekPacketTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('PeekTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function]
cls.add_method('PrintByteTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function]
cls.add_method('PrintPacketTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function]
cls.add_method('RemoveAllByteTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function]
cls.add_method('RemoveAllPacketTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header')])
## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function]
cls.add_method('RemovePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('RemoveTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> arg0) [member function]
cls.add_method('SetNixVector',
'void',
[param('ns3::Ptr< ns3::NixVector >', 'arg0')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3AddressChecker_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')])
return
def register_Ns3AddressValue_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressValue const &', 'arg0')])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor]
cls.add_constructor([param('ns3::Address const &', 'value')])
## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Address',
[],
is_const=True)
## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Address const &', 'value')])
return
def register_Ns3Ipv4ClickRouting_methods(root_module, cls):
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting::Ipv4ClickRouting() [constructor]
cls.add_constructor([])
## ipv4-click-routing.h (module 'click'): ns3::Ipv4ClickRouting::Ipv4ClickRouting(ns3::Ipv4ClickRouting const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4ClickRouting const &', 'arg0')])
return
def register_functions(root_module):
module = root_module
register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
return
def register_functions_ns3_FatalImpl(module, root_module):
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
| zy901002-gpsr | src/click/bindings/modulegen__gcc_LP64.py | Python | gpl2 | 251,102 |
callback_classes = [
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
]
| zy901002-gpsr | src/click/bindings/callbacks_list.py | Python | gpl2 | 647 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Lalith Suresh
*
* 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
#ifdef NS3_CLICK
#include "ns3/test.h"
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/simple-net-device.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/click-internet-stack-helper.h"
#include <click/simclick.h>
namespace ns3 {
static void
AddClickInternetStack (Ptr<Node> node)
{
ClickInternetStackHelper internet;
internet.SetClickFile (node, "src/click/examples/nsclick-lan-single-interface.click");
internet.Install (node);
}
static void
AddNetworkDevice (Ptr<Node> node, Mac48Address macaddr, Ipv4Address ipv4addr, Ipv4Mask ipv4mask)
{
Ptr<SimpleNetDevice> rxDev1;
rxDev1 = CreateObject<SimpleNetDevice> ();
rxDev1->SetAddress (Mac48Address (macaddr));
node->AddDevice (rxDev1);
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
uint32_t netdev_idx = ipv4->AddInterface (rxDev1);
Ipv4InterfaceAddress ipv4Addr = Ipv4InterfaceAddress (ipv4addr, ipv4mask);
ipv4->AddAddress (netdev_idx, ipv4Addr);
ipv4->SetUp (netdev_idx);
}
class ClickIfidFromNameTest : public TestCase
{
public:
ClickIfidFromNameTest ();
virtual void DoRun ();
};
ClickIfidFromNameTest::ClickIfidFromNameTest ()
: TestCase ("Test SIMCLICK_IFID_FROM_NAME")
{
}
void
ClickIfidFromNameTest::DoRun ()
{
Ptr<Node> node = CreateObject<Node> ();
AddClickInternetStack (node);
AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0"));
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Ptr<Ipv4ClickRouting> click = DynamicCast<Ipv4ClickRouting> (ipv4->GetRoutingProtocol ());
click->DoStart ();
int ret;
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "tap0");
NS_TEST_EXPECT_MSG_EQ (ret, 0, "tap0 is interface 0");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "tun0");
NS_TEST_EXPECT_MSG_EQ (ret, 0, "tun0 is interface 0");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "eth0");
NS_TEST_EXPECT_MSG_EQ (ret, 1, "Eth0 is interface 1");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "tap1");
NS_TEST_EXPECT_MSG_EQ (ret, 0, "tap1 is interface 0");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "tun1");
NS_TEST_EXPECT_MSG_EQ (ret, 0, "tun1 is interface 0");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IFID_FROM_NAME, "eth1");
NS_TEST_EXPECT_MSG_EQ (ret, -1, "No eth1 on node");
// Cast ret to void to work around set-but-unused warnings from compilers
(void) ret;
}
class ClickIpMacAddressFromNameTest : public TestCase
{
public:
ClickIpMacAddressFromNameTest ();
virtual void DoRun ();
};
ClickIpMacAddressFromNameTest::ClickIpMacAddressFromNameTest ()
: TestCase ("Test SIMCLICK_IPADDR_FROM_NAME")
{
}
void
ClickIpMacAddressFromNameTest::DoRun ()
{
Ptr<Node> node = CreateObject<Node> ();
AddClickInternetStack (node);
AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0"));
AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:02"), Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0"));
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Ptr<Ipv4ClickRouting> click = DynamicCast<Ipv4ClickRouting> (ipv4->GetRoutingProtocol ());
click->DoStart ();
int ret = 0;
char *buf = NULL;
buf = new char [255];
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "eth0", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "10.1.1.1"), 0, "eth0 has IP 10.1.1.1");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_MACADDR_FROM_NAME, "eth0", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:01"), 0, "eth0 has Mac Address 00:00:00:00:00:01");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "eth1", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "10.1.1.2"), 0, "eth1 has IP 10.1.1.2");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_MACADDR_FROM_NAME, "eth1", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:02"), 0, "eth0 has Mac Address 00:00:00:00:00:02");
// Not sure how to test the below case, because the Ipv4ClickRouting code is to ASSERT for such inputs
// ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "eth2", buf, 255);
// NS_TEST_EXPECT_MSG_EQ (buf, NULL, "No eth2");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "tap0", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "127.0.0.1"), 0, "tun0 has IP 127.0.0.1");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_MACADDR_FROM_NAME, "tap0", buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:00"), 0, "tun0 has IP 127.0.0.1");
delete [] buf;
// Cast ret to void to work around set-but-unused warnings from compilers
(void) ret;
}
class ClickTrivialTest : public TestCase
{
public:
ClickTrivialTest ();
virtual void DoRun ();
};
ClickTrivialTest::ClickTrivialTest ()
: TestCase ("Test SIMCLICK_GET_NODE_NAME and SIMCLICK_IF_READY")
{
}
void
ClickTrivialTest::DoRun ()
{
Ptr<Node> node = CreateObject<Node> ();
AddClickInternetStack (node);
AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0"));
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Ptr<Ipv4ClickRouting> click = DynamicCast<Ipv4ClickRouting> (ipv4->GetRoutingProtocol ());
click->SetNodeName ("myNode");
click->DoStart ();
int ret = 0;
char *buf = NULL;
buf = new char [255];
ret = simclick_sim_command (click->m_simNode, SIMCLICK_GET_NODE_NAME, buf, 255);
NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "myNode"), 0, "Node name is Node");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IF_READY, 0);
NS_TEST_EXPECT_MSG_EQ (ret, 1, "tap0 is ready");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IF_READY, 1);
NS_TEST_EXPECT_MSG_EQ (ret, 1, "eth0 is ready");
ret = simclick_sim_command (click->m_simNode, SIMCLICK_IF_READY, 2);
NS_TEST_EXPECT_MSG_EQ (ret, 0, "eth1 does not exist, so return 0");
delete [] buf;
// Cast ret to void to work around set-but-unused warnings from compilers
(void) ret;
}
class ClickIfidFromNameTestSuite : public TestSuite
{
public:
ClickIfidFromNameTestSuite () : TestSuite ("routing-click", UNIT)
{
AddTestCase (new ClickTrivialTest);
AddTestCase (new ClickIfidFromNameTest);
AddTestCase (new ClickIpMacAddressFromNameTest);
}
} g_ipv4ClickRoutingTestSuite;
} // namespace ns3
#endif // NS3_CLICK
| zy901002-gpsr | src/click/test/ipv4-click-routing-test.cc | C++ | gpl2 | 7,357 |
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#
# See test.py for more information.
cpp_examples = [
("nsclick-simple-lan", "ENABLE_CLICK == True", "False"),
]
# A list of Python examples to run in order to ensure that they remain
# runnable over time. Each tuple in the list contains
#
# (example_name, do_run).
#
# See test.py for more information.
python_examples = []
| zy901002-gpsr | src/click/test/examples-to-run.py | Python | gpl2 | 630 |
// nsclick-wifi-single-interface.click
//
// Copyright (c) 2011, Deutsche Telekom Laboratories
//
// 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: Ruben Merz <ruben@net.t-labs.tu-berlin.de>
//
// This is a single host Click configuration for wifi.
// The node broadcasts ARP requests if it wants to find a destination
// address, and it responds to ARP requests made for it.
elementclass WiFiSimHost {
$ipaddr, $hwaddr |
cl::Classifier(12/0806 20/0001,12/0806 20/0002, -);
forhost::IPClassifier(dst host $ipaddr,-);
arpquerier::ARPQuerier(eth0);
arpresponder::ARPResponder(eth0);
ethout::Queue
-> ToDump(out_eth0.pcap,PER_NODE 1)
-> ToSimDevice(eth0);
// All packets received on eth0 are silently
// dropped if they are destined for another location
FromSimDevice(eth0,SNAPLEN 4096)
-> ToDump(in_eth0.pcap,PER_NODE 1,ENCAP ETHER)
-> cl;
// ARP queries from other nodes go to the ARP responder element
cl[0] -> arpresponder;
// ARP responses go to our ARP query element
cl[1] -> [1]arpquerier;
// All other packets get checked whether they are meant for us
cl[2]
-> Strip (14)
-> CheckIPHeader2
-> MarkIPHeader
-> GetIPAddress(16) // Sets destination IP address annotation from packet data
-> forhost;
// Packets for us are pushed outside
forhost[0]
->[0]output;
// Packets for other folks or broadcast packets get sent to output 1
forhost[1]
-> ToDump(discard.pcap,2000,PER_NODE 1,ENCAP IP)
-> [1]output;
// Incoming packets get pushed into the ARP query module
input[0]
-> arpquerier;
// Both the ARP query and response modules send data out to
// the simulated network device, eth0.
arpquerier
-> ToDump(out_arpquery.pcap,PER_NODE 1)
-> ethout;
arpresponder
-> ToDump(out_arprespond.pcap,PER_NODE 1)
-> ethout;
}
elementclass TapSimHost {
$dev |
// Packets go to "tap0" which sends them to the kernel
input[0]
-> ToDump(tokernel.pcap,2000,IP,PER_NODE 1)
-> ToSimDevice($dev,IP);
// Packets sent out by the "kernel" get pushed outside
FromSimDevice($dev,SNAPLEN 4096)
-> CheckIPHeader2
-> ToDump(fromkernel.pcap,2000,IP,PER_NODE 1)
-> GetIPAddress(16)
-> [0]output;
}
// Instantiate elements
wifi::WiFiSimHost(eth0:ip,eth0:eth);
kernel::TapSimHost(tap0);
// Users can do some processing between the two elements
wifi[0] -> kernel;
kernel -> wifi;
// Packets not for us are discarded
wifi[1] -> Discard;
// It is mandatory to use an IPRouteTable element with ns-3-click
// (but we do not use it in this example)
rt :: LinearIPLookup (172.16.1.0/24 0.0.0.0 1);
// We are actually not using the routing table
Idle () -> rt;
rt[0] -> Discard;
rt[1] -> Discard;
| zy901002-gpsr | src/click/examples/nsclick-wifi-single-interface.click | Click | gpl2 | 3,350 |
/* -*- 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
// Network topology
//
//
// 172.16.1.0/24
// (1.1) (1.2) (2.1) (2.2)
//
// eth0 eth0 eth1 eth0
// n0 ========= n1 ========= n2
// LAN 1 LAN 2
//
// - UDP flows from n0 to n2 via n1.
// - All nodes are Click based.
//
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/csma-module.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/ipv4-l3-click-protocol.h"
#include "ns3/click-internet-stack-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("NsclickRouting");
int
main (int argc, char *argv[])
{
#ifdef NS3_CLICK
//
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (3);
//
// Install Click on the nodes
//
ClickInternetStackHelper clickinternet;
clickinternet.SetClickFile (n.Get (0), "src/click/examples/nsclick-routing-node0.click");
clickinternet.SetClickFile (n.Get (1), "src/click/examples/nsclick-ip-router.click");
clickinternet.SetClickFile (n.Get (2), "src/click/examples/nsclick-routing-node2.click");
clickinternet.SetRoutingTableElement (n.Get (0), "kernel/rt");
clickinternet.SetRoutingTableElement (n.Get (1), "u/rt");
clickinternet.SetRoutingTableElement (n.Get (2), "kernel/rt");
clickinternet.Install (n);
NS_LOG_INFO ("Create channels.");
//
// Explicitly create the channels required by the topology (shown above).
//
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
NetDeviceContainer d01 = csma.Install (NodeContainer (n.Get (0), n.Get (1)));
NetDeviceContainer d12 = csma.Install (NodeContainer (n.Get (1), n.Get (2)));
Ipv4AddressHelper ipv4;
//
// We've got the "hardware" in place. Now we need to add IP addresses.
//
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
Ipv4InterfaceContainer i01 = ipv4.Assign (d01);
ipv4.SetBase ("172.16.2.0", "255.255.255.0");
Ipv4InterfaceContainer i12 = ipv4.Assign (d12);
NS_LOG_INFO ("Create Applications.");
//
// Create one udpServer applications on node one.
//
uint16_t port = 4000;
UdpServerHelper server (port);
ApplicationContainer apps = server.Install (n.Get (2));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
//
// Create one UdpClient application to send UDP datagrams from node zero to
// node one.
//
uint32_t MaxPacketSize = 1024;
Time interPacketInterval = Seconds (0.05);
uint32_t maxPacketCount = 320;
UdpClientHelper client (i12.GetAddress (1), port);
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
apps = client.Install (NodeContainer (n.Get (0)));
apps.Start (Seconds (2.0));
apps.Stop (Seconds (10.0));
csma.EnablePcap ("nsclick-routing", d01, false);
csma.EnablePcap ("nsclick-routing", d12, false);
//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
#else
NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in");
#endif
}
| zy901002-gpsr | src/click/examples/nsclick-routing.cc | C++ | gpl2 | 4,239 |
// nsclick-lan-single-interface.click
//
// Copyright (c) 2011, Deutsche Telekom Laboratories
//
// 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: Ruben Merz <ruben@net.t-labs.tu-berlin.de>
//
// This is a single host Click configuration for a LAN.
// The node broadcasts ARP requests if it wants to find a destination
// address, and it responds to ARP requests made for it.
elementclass LanSimHost {
$ipaddr, $hwaddr |
cl::Classifier(12/0806 20/0001,12/0806 20/0002, -);
forhost::IPClassifier(dst host $ipaddr,-);
arpquerier::ARPQuerier(eth0);
arpresponder::ARPResponder(eth0);
ethout::Queue
-> ToDump(out_eth0.pcap,PER_NODE 1)
-> ToSimDevice(eth0);
// All packets received on eth0 are silently
// dropped if they are destined for another location
FromSimDevice(eth0,SNAPLEN 4096)
-> ToDump(in_eth0.pcap,PER_NODE 1,ENCAP ETHER)
-> cl;
// ARP queries from other nodes go to the ARP responder element
cl[0] -> arpresponder;
// ARP responses go to our ARP query element
cl[1] -> [1]arpquerier;
// All other packets get checked whether they are meant for us
cl[2]
-> Strip(14)
-> CheckIPHeader2
-> MarkIPHeader
-> GetIPAddress(16) // Sets destination IP address annotation from packet data
-> forhost;
// Packets for us are pushed outside
forhost[0]
->[0]output;
// Packets for other folks or broadcast packets get sent to output 1
forhost[1]
-> ToDump(discard.pcap,2000,PER_NODE 1,ENCAP IP)
-> [1]output;
// Incoming packets get pushed into the ARP query module
input[0]
-> arpquerier;
// Both the ARP query and response modules send data out to
// the simulated network device, eth0.
arpquerier
-> ToDump(out_arpquery.pcap,PER_NODE 1)
-> ethout;
arpresponder
-> ToDump(out_arprespond.pcap,PER_NODE 1)
-> ethout;
}
elementclass TapSimHost {
$dev |
// It is mandatory to use an IPRouteTable element with ns-3-click
rt :: LinearIPLookup (172.16.2.0/24 0.0.0.0 1,172.16.1.0/24 172.16.2.1 1);
// Packets go to "tap0" which sends them to the kernel
input[0]
-> ToDump(tokernel.pcap,2000,IP,PER_NODE 1)
-> ToSimDevice($dev,IP);
// Packets sent out by the "kernel" get pushed outside
FromSimDevice($dev,SNAPLEN 4096)
-> CheckIPHeader2
-> ToDump(fromkernel.pcap,2000,IP,PER_NODE 1)
-> GetIPAddress(16)
-> rt
-> [0]output;
rt[1] -> [0] output;
}
// Instantiate elements
lan::LanSimHost(eth0:ip,eth0:eth);
kernel::TapSimHost(tap0);
// Users can do some processing between the two elements
lan[0] -> kernel;
kernel -> lan;
// Packets for others or broadcasts are discarded
lan[1] -> Discard;
| zy901002-gpsr | src/click/examples/nsclick-routing-node2.click | Click | gpl2 | 3,283 |
// nsclick-wifi-single-interface.click
//
// Copyright (c) 2011, Deutsche Telekom Laboratories
//
// 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: Ruben Merz <ruben@net.t-labs.tu-berlin.de>
//
// This is a single host Click configuration for wifi.
// Sets the interface in promiscuous mode
// The node broadcasts ARP requests if it wants to find a destination
// address, and it responds to ARP requests made for it.
elementclass WiFiSimHost {
$ipaddr, $hwaddr |
cl::Classifier(12/0806 20/0001,12/0806 20/0002, -);
forhost::IPClassifier(dst host $ipaddr,-);
arpquerier::ARPQuerier(eth0);
arpresponder::ARPResponder(eth0);
ethout::Queue
-> ToDump(out_eth0.pcap,PER_NODE 1)
-> ToSimDevice(eth0);
// All packets received on eth0 are silently
// dropped if they are destined for another location
FromSimDevice(eth0,SNAPLEN 4096,PROMISC true)
-> ToDump(in_eth0.pcap,PER_NODE 1,ENCAP ETHER)
-> cl;
// ARP queries from other nodes go to the ARP responder element
cl[0] -> arpresponder;
// ARP responses go to our ARP query element
cl[1] -> [1]arpquerier;
// All other packets get checked whether they are meant for us
cl[2]
-> Strip (14)
-> CheckIPHeader2
-> MarkIPHeader
-> GetIPAddress(16) // Sets destination IP address annotation from packet data
-> forhost;
// Packets for us are pushed outside
forhost[0]
->[0]output;
// Packets for other folks or broadcast packets get sent to output 1
forhost[1]
-> ToDump(discard.pcap,2000,PER_NODE 1,ENCAP IP)
-> [1]output;
// Incoming packets get pushed into the ARP query module
input[0]
-> arpquerier;
// Both the ARP query and response modules send data out to
// the simulated network device, eth0.
arpquerier
-> ToDump(out_arpquery.pcap,PER_NODE 1)
-> ethout;
arpresponder
-> ToDump(out_arprespond.pcap,PER_NODE 1)
-> ethout;
}
elementclass TapSimHost {
$dev |
// Packets go to "tap0" which sends them to the kernel
input[0]
-> ToDump(tokernel.pcap,2000,IP,PER_NODE 1)
-> ToSimDevice($dev,IP);
// Packets sent out by the "kernel" get pushed outside
FromSimDevice($dev,SNAPLEN 4096)
-> CheckIPHeader2
-> ToDump(fromkernel.pcap,2000,IP,PER_NODE 1)
-> GetIPAddress(16)
-> [0]output;
}
// Instantiate elements
wifi::WiFiSimHost(eth0:ip,eth0:eth);
kernel::TapSimHost(tap0);
// Users can do some processing between the two elements
wifi[0] -> kernel;
kernel -> wifi;
// Packets not for us are discarded
wifi[1] -> Discard;
// It is mandatory to use an IPRouteTable element with ns-3-click
// (but we do not use it in this example)
rt :: LinearIPLookup (172.16.1.0/24 0.0.0.0 1);
// We are actually not using the routing table
Idle () -> rt;
rt[0] -> Discard;
rt[1] -> Discard;
| zy901002-gpsr | src/click/examples/nsclick-wifi-single-interface-promisc.click | Click | gpl2 | 3,405 |
// nsclick-lan-single-interface.click
//
// Copyright (c) 2011, Deutsche Telekom Laboratories
//
// 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: Ruben Merz <ruben@net.t-labs.tu-berlin.de>
//
// This is a single host Click configuration for a LAN.
// The node broadcasts ARP requests if it wants to find a destination
// address, and it responds to ARP requests made for it.
elementclass LanSimHost {
$ipaddr, $hwaddr |
cl::Classifier(12/0806 20/0001,12/0806 20/0002, -);
forhost::IPClassifier(dst host $ipaddr,-);
arpquerier::ARPQuerier(eth0);
arpresponder::ARPResponder(eth0);
ethout::Queue
-> ToDump(out_eth0.pcap,PER_NODE 1)
-> ToSimDevice(eth0);
// All packets received on eth0 are silently
// dropped if they are destined for another location
FromSimDevice(eth0,SNAPLEN 4096)
-> ToDump(in_eth0.pcap,PER_NODE 1,ENCAP ETHER)
-> cl;
// ARP queries from other nodes go to the ARP responder element
cl[0] -> arpresponder;
// ARP responses go to our ARP query element
cl[1] -> [1]arpquerier;
// All other packets get checked whether they are meant for us
cl[2]
-> Strip(14)
-> CheckIPHeader2
-> MarkIPHeader
-> GetIPAddress(16) // Sets destination IP address annotation from packet data
-> forhost;
// Packets for us are pushed outside
forhost[0]
->[0]output;
// Packets for other folks or broadcast packets get sent to output 1
forhost[1]
-> ToDump(discard.pcap,2000,PER_NODE 1,ENCAP IP)
-> [1]output;
// Incoming packets get pushed into the ARP query module
input[0]
-> arpquerier;
// Both the ARP query and response modules send data out to
// the simulated network device, eth0.
arpquerier
-> ToDump(out_arpquery.pcap,PER_NODE 1)
-> ethout;
arpresponder
-> ToDump(out_arprespond.pcap,PER_NODE 1)
-> ethout;
}
elementclass TapSimHost {
$dev |
// Packets go to "tap0" which sends them to the kernel
input[0]
-> ToDump(tokernel.pcap,2000,IP,PER_NODE 1)
-> ToSimDevice($dev,IP);
// Packets sent out by the "kernel" get pushed outside
FromSimDevice($dev,SNAPLEN 4096)
-> CheckIPHeader2
-> ToDump(fromkernel.pcap,2000,IP,PER_NODE 1)
-> GetIPAddress(16)
-> [0]output;
}
// Instantiate elements
lan::LanSimHost(eth0:ip,eth0:eth);
kernel::TapSimHost(tap0);
// Users can do some processing between the two elements
lan[0] -> kernel;
kernel -> lan;
// Packets for others or broadcasts are discarded
lan[1] -> Discard;
// It is mandatory to use an IPRouteTable element with ns-3-click
// (but we do not use it in this example)
rt :: LinearIPLookup (172.16.1.0/24 0.0.0.0 1);
// We are actually not using the routing table
Idle () -> rt;
rt[0] -> Discard;
rt[1] -> Discard;
| zy901002-gpsr | src/click/examples/nsclick-lan-single-interface.click | Click | gpl2 | 3,357 |
// nsclick-lan-single-interface.click
//
// Copyright (c) 2011, Deutsche Telekom Laboratories
//
// 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: Ruben Merz <ruben@net.t-labs.tu-berlin.de>
//
// This is a single host Click configuration for a LAN.
// The node broadcasts ARP requests if it wants to find a destination
// address, and it responds to ARP requests made for it.
elementclass LanSimHost {
$ipaddr, $hwaddr |
cl::Classifier(12/0806 20/0001,12/0806 20/0002, -);
forhost::IPClassifier(dst host $ipaddr,-);
arpquerier::ARPQuerier(eth0);
arpresponder::ARPResponder(eth0);
ethout::Queue
-> ToDump(out_eth0.pcap,PER_NODE 1)
-> ToSimDevice(eth0);
// All packets received on eth0 are silently
// dropped if they are destined for another location
FromSimDevice(eth0,SNAPLEN 4096)
-> ToDump(in_eth0.pcap,PER_NODE 1,ENCAP ETHER)
-> cl;
// ARP queries from other nodes go to the ARP responder element
cl[0] -> arpresponder;
// ARP responses go to our ARP query element
cl[1] -> [1]arpquerier;
// All other packets get checked whether they are meant for us
cl[2]
-> Strip(14)
-> CheckIPHeader2
-> MarkIPHeader
-> GetIPAddress(16) // Sets destination IP address annotation from packet data
-> forhost;
// Packets for us are pushed outside
forhost[0]
->[0]output;
// Packets for other folks or broadcast packets get sent to output 1
forhost[1]
-> ToDump(discard.pcap,2000,PER_NODE 1,ENCAP IP)
-> [1]output;
// Incoming packets get pushed into the ARP query module
input[0]
-> arpquerier;
// Both the ARP query and response modules send data out to
// the simulated network device, eth0.
arpquerier
-> ToDump(out_arpquery.pcap,PER_NODE 1)
-> ethout;
arpresponder
-> ToDump(out_arprespond.pcap,PER_NODE 1)
-> ethout;
}
elementclass TapSimHost {
$dev |
// It is mandatory to use an IPRouteTable element with ns-3-click
rt :: LinearIPLookup (172.16.1.0/24 0.0.0.0 1, 172.16.2.0/24 172.16.1.2 1);
// Packets go to "tap0" which sends them to the kernel
input[0]
-> ToDump(tokernel.pcap,2000,IP,PER_NODE 1)
-> ToSimDevice($dev,IP);
// Packets sent out by the "kernel" get pushed outside
FromSimDevice($dev,SNAPLEN 4096)
-> CheckIPHeader2
-> ToDump(fromkernel.pcap,2000,IP,PER_NODE 1)
-> GetIPAddress(16)
-> rt
-> [0]output;
rt[1] -> [0] output;
}
// Instantiate elements
lan::LanSimHost(eth0:ip,eth0:eth);
kernel::TapSimHost(tap0);
// Users can do some processing between the two elements
lan[0] -> kernel;
kernel -> lan;
// Packets for others or broadcasts are discarded
lan[1] -> Discard;
| zy901002-gpsr | src/click/examples/nsclick-routing-node0.click | Click | gpl2 | 3,284 |
/* -*- 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
*/
// Adaptation of examples/udp/udp-client-server.cc for
// Click based nodes.
//
// Network topology
//
// 172.16.1.0/24
// (1.1) (1.2) (1.3)
// n0 n1 n2
// | | |
// =============
// LAN
//
// - UDP flows from n0 to n1 and n2 to n1
// - All nodes are Click based.
// - The single ethernet interface that each node
// uses is named 'eth0' in the Click file.
//
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/csma-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/click-internet-stack-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("NsclickUdpClientServerCsma");
int
main (int argc, char *argv[])
{
#ifdef NS3_CLICK
//
// Enable logging for UdpClient and
//
LogComponentEnable ("NsclickUdpClientServerCsma", LOG_LEVEL_INFO);
//
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (3);
NS_LOG_INFO ("Create channels.");
//
// Explicitly create the channels required by the topology (shown above).
//
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
NetDeviceContainer d = csma.Install (n);
//
// Install Click on the nodes
//
ClickInternetStackHelper clickinternet;
clickinternet.SetClickFile (n, "src/click/examples/nsclick-lan-single-interface.click");
clickinternet.SetRoutingTableElement (n, "rt");
clickinternet.Install (n);
Ipv4AddressHelper ipv4;
//
// We've got the "hardware" in place. Now we need to add IP addresses.
//
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (d);
NS_LOG_INFO ("Create Applications.");
//
// Create one udpServer applications on node one.
//
uint16_t port = 4000;
UdpServerHelper server (port);
ApplicationContainer apps = server.Install (n.Get (1));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
//
// Create one UdpClient application to send UDP datagrams from node zero to
// node one.
//
uint32_t MaxPacketSize = 1024;
Time interPacketInterval = Seconds (0.05);
uint32_t maxPacketCount = 320;
UdpClientHelper client (i.GetAddress (1), port);
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
apps = client.Install (NodeContainer (n.Get (0), n.Get (2)));
apps.Start (Seconds (2.0));
apps.Stop (Seconds (10.0));
csma.EnablePcap ("nsclick-udp-client-server-csma", d, false);
//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
#else
NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in");
#endif
}
| zy901002-gpsr | src/click/examples/nsclick-udp-client-server-csma.cc | C++ | gpl2 | 3,860 |
/* -*- 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
// Scenario:
//
// (Click) CSMA (non-Click)
// A ================ B
// (172.16.1.1) (172.16.1.2)
// (eth0)
//
//
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/click-internet-stack-helper.h"
#include "ns3/log.h"
using namespace ns3;
void ReceivePacket (Ptr<Socket> socket)
{
NS_LOG_UNCOND ("Received one packet!");
}
int main (int argc, char *argv[])
{
#ifdef NS3_CLICK
NodeContainer csmaNodes;
csmaNodes.Create (2);
// Setup CSMA channel between the nodes
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer csmaDevices = csma.Install (csmaNodes);
// Install normal internet stack on node B
InternetStackHelper internet;
internet.Install (csmaNodes.Get (1));
// Install Click on node A
ClickInternetStackHelper clickinternet;
clickinternet.SetClickFile (csmaNodes.Get (0), "src/click/examples/nsclick-lan-single-interface.click");
clickinternet.SetRoutingTableElement (csmaNodes.Get (0), "rt");
clickinternet.Install (csmaNodes.Get (0));
// Configure IP addresses for the nodes
Ipv4AddressHelper ipv4;
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
ipv4.Assign (csmaDevices);
// Configure traffic application and sockets
Address LocalAddress (InetSocketAddress (Ipv4Address::GetAny (), 50000));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", LocalAddress);
ApplicationContainer recvapp = packetSinkHelper.Install (csmaNodes.Get (1));
recvapp.Start (Seconds (5.0));
recvapp.Stop (Seconds (10.0));
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer appcont;
AddressValue remoteAddress (InetSocketAddress (Ipv4Address ("172.16.1.2"), 50000));
onOffHelper.SetAttribute ("Remote", remoteAddress);
appcont.Add (onOffHelper.Install (csmaNodes.Get (0)));
appcont.Start (Seconds (5.0));
appcont.Stop (Seconds (10.0));
// For tracing
csma.EnablePcap ("nsclick-simple-lan", csmaDevices, false);
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
#else
NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in");
#endif
}
| zy901002-gpsr | src/click/examples/nsclick-simple-lan.cc | C++ | gpl2 | 3,319 |
/* -*- 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
*
* Authors: Lalith Suresh <suresh.lalith@gmail.com>
*/
// Scenario: node A (using Click) sends packets to node B (not using
// Click)
//
// (Click) (non-Click)
// A ))) WLAN ((( B
// (172.16.1.1) (172.16.1.2)
// (eth0)
//
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/click-internet-stack-helper.h"
#include "ns3/log.h"
#include "ns3/mobility-helper.h"
using namespace ns3;
void ReceivePacket (Ptr<Socket> socket)
{
NS_LOG_UNCOND ("Received one packet!");
}
int main (int argc, char *argv[])
{
#ifdef NS3_CLICK
double rss = -80;
// Setup nodes
NodeContainer wifiNodes;
wifiNodes.Create (2);
// Get Wifi devices installed on both nodes.
// Adapted from examples/wireless/wifi-simple-adhoc.cc
std::string phyMode ("DsssRate1Mbps");
// disable fragmentation for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
// turn off RTS/CTS for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (phyMode));
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This is one parameter that matters when using FixedRssLossModel
// set it to zero; otherwise, gain will be added
wifiPhy.Set ("RxGain", DoubleValue (0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
// The below FixedRssLossModel will cause the rss to be fixed regardless
// of the distance between the two stations, and the transmit power
wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss));
wifiPhy.SetChannel (wifiChannel.Create ());
// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer wifiDevices = wifi.Install (wifiPhy, wifiMac, wifiNodes);
// Setup mobility models
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiNodes);
// Install normal internet stack on node B
InternetStackHelper internet;
internet.Install (wifiNodes.Get (1));
// Install Click on node A
ClickInternetStackHelper clickinternet;
clickinternet.SetClickFile (wifiNodes.Get (0), "src/click/examples/nsclick-wifi-single-interface.click");
clickinternet.SetRoutingTableElement (wifiNodes.Get (0), "rt");
clickinternet.Install (wifiNodes.Get (0));
// Configure IP addresses
Ipv4AddressHelper ipv4;
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
ipv4.Assign (wifiDevices);
// Setup traffic application and sockets
Address LocalAddress (InetSocketAddress (Ipv4Address::GetAny (), 50000));
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", LocalAddress);
ApplicationContainer recvapp = packetSinkHelper.Install (wifiNodes.Get (1));
recvapp.Start (Seconds (5.0));
recvapp.Stop (Seconds (10.0));
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer appcont;
AddressValue remoteAddress (InetSocketAddress (Ipv4Address ("172.16.1.2"), 50000));
onOffHelper.SetAttribute ("Remote", remoteAddress);
appcont.Add (onOffHelper.Install (wifiNodes.Get (0)));
appcont.Start (Seconds (5.0));
appcont.Stop (Seconds (10.0));
// For tracing
wifiPhy.EnablePcap ("nsclick-raw-wlan", wifiDevices);
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
#else
NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in");
#endif
}
| zy901002-gpsr | src/click/examples/nsclick-raw-wlan.cc | C++ | gpl2 | 5,468 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
obj = bld.create_ns3_program('nsclick-simple-lan',
['click', 'csma', 'internet', 'applications'])
obj.source = 'nsclick-simple-lan.cc'
obj = bld.create_ns3_program('nsclick-raw-wlan',
['click', 'wifi', 'internet', 'applications'])
obj.source = 'nsclick-raw-wlan.cc'
obj = bld.create_ns3_program('nsclick-udp-client-server-csma',
['click', 'csma', 'internet', 'applications'])
obj.source = 'nsclick-udp-client-server-csma.cc'
obj = bld.create_ns3_program('nsclick-udp-client-server-wifi',
['click', 'wifi', 'internet', 'applications'])
obj.source = 'nsclick-udp-client-server-wifi.cc'
obj = bld.create_ns3_program('nsclick-routing',
['click', 'csma', 'internet', 'applications'])
obj.source = 'nsclick-routing.cc'
| zy901002-gpsr | src/click/examples/wscript | Python | gpl2 | 1,008 |
/* -*- 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
*/
// Adaptation of examples/udp/udp-client-server.cc for
// Click based nodes running wifi.
//
// Network topology:
//
// (1.4)
// (( n4 ))
//
// 172.16.1.0/24
//
// (1.1) (1.2) (1.3)
// n0 )) (( n1 )) (( n2
// WLAN
//
// - UDP flows from n0 to n1 and n2 to n1.
// - All nodes are Click based.
// - The single ethernet interface that each node
// uses is named 'eth0' in the Click file.
// - Node 4 is running in promiscuous mode and can listen in on
// the packets being exchanged between n0-n1 and n2-n1.
//
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/applications-module.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/click-internet-stack-helper.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("NsclickUdpClientServerWifi");
#ifdef NS3_CLICK
void
ReadArp (Ptr<Ipv4ClickRouting> clickRouter)
{
// Access the handlers
NS_LOG_INFO (clickRouter->ReadHandler ("wifi/arpquerier", "table"));
NS_LOG_INFO (clickRouter->ReadHandler ("wifi/arpquerier", "stats"));
}
void
WriteArp (Ptr<Ipv4ClickRouting> clickRouter)
{
// Access the handler
NS_LOG_INFO (clickRouter->WriteHandler ("wifi/arpquerier", "insert", "172.16.1.2 00:00:00:00:00:02"));
}
#endif
int
main (int argc, char *argv[])
{
#ifdef NS3_CLICK
//
// Enable logging
//
LogComponentEnable ("NsclickUdpClientServerWifi", LOG_LEVEL_INFO);
//
// Explicitly create the nodes required by the topology (shown above).
//
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (4);
NS_LOG_INFO ("Create channels.");
//
// Explicitly create the channels required by the topology (shown above).
//
std::string phyMode ("DsssRate1Mbps");
// disable fragmentation for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
// turn off RTS/CTS for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (phyMode));
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This is one parameter that matters when using FixedRssLossModel
// set it to zero; otherwise, gain will be added
wifiPhy.Set ("RxGain", DoubleValue (0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
// The below FixedRssLossModel will cause the rss to be fixed regardless
// of the distance between the two stations, and the transmit power
wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (-80));
wifiPhy.SetChannel (wifiChannel.Create ());
// Add a non-QoS upper mac, and disable rate control
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
// Set it to adhoc mode
wifiMac.SetType ("ns3::AdhocWifiMac");
NetDeviceContainer d = wifi.Install (wifiPhy, wifiMac, n);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (10.0, 0.0, 0.0));
positionAlloc->Add (Vector (20.0, 0.0, 0.0));
positionAlloc->Add (Vector (0.0, 10.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (n);
//
// Install Click on the nodes
//
ClickInternetStackHelper clickinternet;
clickinternet.SetClickFile (n.Get (0), "src/click/examples/nsclick-wifi-single-interface.click");
clickinternet.SetClickFile (n.Get (1), "src/click/examples/nsclick-wifi-single-interface.click");
clickinternet.SetClickFile (n.Get (2), "src/click/examples/nsclick-wifi-single-interface.click");
// Node 4 is to run in promiscuous mode. This can be verified
// from the pcap trace Node4_in_eth0.pcap generated after running
// this script.
clickinternet.SetClickFile (n.Get (3), "src/click/examples/nsclick-wifi-single-interface-promisc.click");
clickinternet.SetRoutingTableElement (n, "rt");
clickinternet.Install (n);
Ipv4AddressHelper ipv4;
//
// We've got the "hardware" in place. Now we need to add IP addresses.
//
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("172.16.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (d);
NS_LOG_INFO ("Create Applications.");
//
// Create one udpServer applications on node one.
//
uint16_t port = 4000;
UdpServerHelper server (port);
ApplicationContainer apps = server.Install (n.Get (1));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
//
// Create one UdpClient application to send UDP datagrams from node zero to
// node one.
//
uint32_t MaxPacketSize = 1024;
Time interPacketInterval = Seconds (0.5);
uint32_t maxPacketCount = 320;
UdpClientHelper client (i.GetAddress (1), port);
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
apps = client.Install (NodeContainer (n.Get (0), n.Get (2)));
apps.Start (Seconds (2.0));
apps.Stop (Seconds (10.0));
wifiPhy.EnablePcap ("nsclick-udp-client-server-wifi", d);
// Force the MAC address of the second node: The current ARP
// implementation of Click sends only one ARP request per incoming
// packet for an unknown destination and does not retransmit if no
// response is received. With the scenario of this example, all ARP
// requests of node 3 are lost due to interference from node
// 1. Hence, we fill in the ARP table of node 2 before at the
// beginning of the simulation
Simulator::Schedule (Seconds (0.5), &ReadArp, n.Get (2)->GetObject<Ipv4ClickRouting> ());
Simulator::Schedule (Seconds (0.6), &WriteArp, n.Get (2)->GetObject<Ipv4ClickRouting> ());
Simulator::Schedule (Seconds (0.7), &ReadArp, n.Get (2)->GetObject<Ipv4ClickRouting> ());
//
// Now, do the actual simulation.
//
NS_LOG_INFO ("Run Simulation.");
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
#else
NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in");
#endif
}
| zy901002-gpsr | src/click/examples/nsclick-udp-client-server-wifi.cc | C++ | gpl2 | 7,667 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Lalith Suresh <suresh.lalith@gmail.com>
*/
#ifdef NS3_CLICK
#ifndef CLICK_INTERNET_STACK_HELPER_H
#define CLICK_INTERNET_STACK_HELPER_H
#include "ns3/node-container.h"
#include "ns3/net-device-container.h"
#include "ns3/packet.h"
#include "ns3/ptr.h"
#include "ns3/object-factory.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/internet-trace-helper.h"
#include <map>
namespace ns3 {
class Node;
class Ipv4RoutingHelper;
/**
* \brief aggregate Click/IP/TCP/UDP functionality to existing Nodes.
*
* This helper has been adapted from the InternetStackHelper class and
* nodes will not be able to use Ipv6 functionalities.
*
*/
class ClickInternetStackHelper : public PcapHelperForIpv4,
public AsciiTraceHelperForIpv4
{
public:
/**
* Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing
*/
ClickInternetStackHelper (void);
/**
* Destroy the ClickInternetStackHelper
*/
virtual ~ClickInternetStackHelper (void);
ClickInternetStackHelper (const ClickInternetStackHelper &);
ClickInternetStackHelper &operator = (const ClickInternetStackHelper &o);
/**
* Return helper internal state to that of a newly constructed one
*/
void Reset (void);
/**
* Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol,
* ns3::Udp, and ns3::Tcp classes onto the provided node. This method will
* assert if called on a node that already has an Ipv4 object aggregated to it.
*
* \param nodeName The name of the node on which to install the stack.
*/
void Install (std::string nodeName) const;
/**
* Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol,
* ns3::Udp, and ns3::Tcp classes onto the provided node. This method will
* assert if called on a node that already has an Ipv4 object aggregated to it.
*
* \param node The node on which to install the stack.
*/
void Install (Ptr<Node> node) const;
/**
* For each node in the input container, aggregate implementations of the
* ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and, ns3::Tcp classes.
* The program will assert if this method is called on a container with a
* node that already has an Ipv4 object aggregated to it.
*
* \param c NodeContainer that holds the set of nodes on which to install the
* new stacks.
*/
void Install (NodeContainer c) const;
/**
* Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation
*/
void InstallAll (void) const;
/**
* \brief set the Tcp stack which will not need any other parameter.
*
* This function sets up the tcp stack to the given TypeId. It should not be
* used for NSC stack setup because the nsc stack needs the Library attribute
* to be setup, please use instead the version that requires an attribute
* and a value. If you choose to use this function anyways to set nsc stack
* the default value for the linux library will be used: "liblinux2.6.26.so".
*
* \param tid the type id, typically it is set to "ns3::TcpL4Protocol"
*/
void SetTcp (std::string tid);
/**
* \brief This function is used to setup the Network Simulation Cradle stack with library value.
*
* Give the NSC stack a shared library file name to use when creating the
* stack implementation. The attr string is actually the attribute name to
* be setup and val is its value. The attribute is the stack implementation
* to be used and the value is the shared library name.
*
* \param tid The type id, for the case of nsc it would be "ns3::NscTcpL4Protocol"
* \param attr The attribute name that must be setup, for example "Library"
* \param val The attribute value, which will be in fact the shared library name (example:"liblinux2.6.26.so")
*/
void SetTcp (std::string tid, std::string attr, const AttributeValue &val);
/**
* \brief Set a Click file to be used for a group of nodes.
* \param c NodeContainer of nodes
* \param clickfile Click file to be used
*/
void SetClickFile (NodeContainer c, std::string clickfile);
/**
* \brief Set a Click file to be used for a node.
* \param node Node for which Click file is to be set
* \param clickfile Click file to be used
*/
void SetClickFile (Ptr<Node> node, std::string clickfile);
/**
* \brief Set a Click routing table element for a group of nodes.
* \param c NodeContainer of nodes
* \param rt Click Routing Table element name
*/
void SetRoutingTableElement (NodeContainer c, std::string rt);
/**
* \brief Set a Click routing table element for a node.
* \param node Node for which Click file is to be set
* \param rt Click Routing Table element name
*/
void SetRoutingTableElement (Ptr<Node> node, std::string rt);
private:
/**
* @brief Enable pcap output the indicated Ipv4 and interface pair.
* @internal
*
* @param prefix Filename prefix to use for pcap files.
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
*/
virtual void EnablePcapIpv4Internal (std::string prefix,
Ptr<Ipv4> ipv4,
uint32_t interface,
bool explicitFilename);
/**
* @brief Enable ascii trace output on the indicated Ipv4 and interface pair.
* @internal
*
* @param stream An OutputStreamWrapper representing an existing file to use
* when writing trace data.
* @param prefix Filename prefix to use for ascii trace files.
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
*/
virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
std::string prefix,
Ptr<Ipv4> ipv4,
uint32_t interface,
bool explicitFilename);
void Initialize (void);
ObjectFactory m_tcpFactory;
/**
* \internal
*/
static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
/**
* \internal
*/
static void Cleanup (void);
/**
* \internal
*/
bool PcapHooked (Ptr<Ipv4> ipv4);
/**
* \internal
*/
bool AsciiHooked (Ptr<Ipv4> ipv4);
/**
* \brief IPv4 install state (enabled/disabled) ?
*/
bool m_ipv4Enabled;
/**
* \brief Node to Click file mapping
*/
std::map < Ptr<Node>, std::string > m_nodeToClickFileMap;
/**
* \brief Node to Routing Table Element mapping
*/
std::map < Ptr<Node>, std::string > m_nodeToRoutingTableElementMap;
};
} // namespace ns3
#endif /* CLICK_INTERNET_STACK_HELPER_H */
#endif /* NS3_CLICK */
| zy901002-gpsr | src/click/helper/click-internet-stack-helper.h | C++ | gpl2 | 7,818 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Faker Moatamri <faker.moatamri@sophia.inria.fr>
* Author: Lalith Suresh <suresh.lalith@gmail.com>
*/
#ifdef NS3_CLICK
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/object.h"
#include "ns3/names.h"
#include "ns3/ipv4.h"
#include "ns3/packet-socket-factory.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/net-device.h"
#include "ns3/callback.h"
#include "ns3/node.h"
#include "ns3/core-config.h"
#include "ns3/arp-l3-protocol.h"
#include "ns3/ipv4-click-routing.h"
#include "ns3/ipv4-l3-click-protocol.h"
#include "ns3/trace-helper.h"
#include "click-internet-stack-helper.h"
#include <limits>
#include <map>
NS_LOG_COMPONENT_DEFINE ("ClickInternetStackHelper");
namespace ns3 {
#define INTERFACE_CONTEXT
typedef std::pair<Ptr<Ipv4>, uint32_t> InterfacePairIpv4;
typedef std::map<InterfacePairIpv4, Ptr<PcapFileWrapper> > InterfaceFileMapIpv4;
typedef std::map<InterfacePairIpv4, Ptr<OutputStreamWrapper> > InterfaceStreamMapIpv4;
static InterfaceFileMapIpv4 g_interfaceFileMapIpv4; /**< A mapping of Ipv4/interface pairs to pcap files */
static InterfaceStreamMapIpv4 g_interfaceStreamMapIpv4; /**< A mapping of Ipv4/interface pairs to ascii streams */
ClickInternetStackHelper::ClickInternetStackHelper ()
: m_ipv4Enabled (true)
{
Initialize ();
}
// private method called by both constructor and Reset ()
void
ClickInternetStackHelper::Initialize ()
{
SetTcp ("ns3::TcpL4Protocol");
}
ClickInternetStackHelper::~ClickInternetStackHelper ()
{
}
ClickInternetStackHelper::ClickInternetStackHelper (const ClickInternetStackHelper &o)
{
m_ipv4Enabled = o.m_ipv4Enabled;
m_tcpFactory = o.m_tcpFactory;
}
ClickInternetStackHelper &
ClickInternetStackHelper::operator = (const ClickInternetStackHelper &o)
{
if (this == &o)
{
return *this;
}
return *this;
}
void
ClickInternetStackHelper::Reset (void)
{
m_ipv4Enabled = true;
Initialize ();
}
void
ClickInternetStackHelper::SetTcp (const std::string tid)
{
m_tcpFactory.SetTypeId (tid);
}
void
ClickInternetStackHelper::SetTcp (std::string tid, std::string n0, const AttributeValue &v0)
{
m_tcpFactory.SetTypeId (tid);
m_tcpFactory.Set (n0,v0);
}
void
ClickInternetStackHelper::SetClickFile (NodeContainer c, std::string clickfile)
{
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
SetClickFile (*i, clickfile);
}
}
void
ClickInternetStackHelper::SetClickFile (Ptr<Node> node, std::string clickfile)
{
m_nodeToClickFileMap.insert (std::make_pair (node, clickfile));
}
void
ClickInternetStackHelper::SetRoutingTableElement (NodeContainer c, std::string rt)
{
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
SetRoutingTableElement (*i, rt);
}
}
void
ClickInternetStackHelper::SetRoutingTableElement (Ptr<Node> node, std::string rt)
{
m_nodeToRoutingTableElementMap.insert (std::make_pair (node, rt));
}
void
ClickInternetStackHelper::Install (NodeContainer c) const
{
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
{
Install (*i);
}
}
void
ClickInternetStackHelper::InstallAll (void) const
{
Install (NodeContainer::GetGlobal ());
}
void
ClickInternetStackHelper::CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
{
ObjectFactory factory;
factory.SetTypeId (typeId);
Ptr<Object> protocol = factory.Create <Object> ();
node->AggregateObject (protocol);
}
void
ClickInternetStackHelper::Install (Ptr<Node> node) const
{
if (m_ipv4Enabled)
{
if (node->GetObject<Ipv4> () != 0)
{
NS_FATAL_ERROR ("ClickInternetStackHelper::Install (): Aggregating "
"an InternetStack to a node with an existing Ipv4 object");
return;
}
CreateAndAggregateObjectFromTypeId (node, "ns3::ArpL3Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::Ipv4L3ClickProtocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::Icmpv4L4Protocol");
CreateAndAggregateObjectFromTypeId (node, "ns3::UdpL4Protocol");
node->AggregateObject (m_tcpFactory.Create<Object> ());
Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
node->AggregateObject (factory);
// Set routing
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Ptr<Ipv4ClickRouting> ipv4Routing = CreateObject<Ipv4ClickRouting> ();
std::map< Ptr<Node>, std::string >::const_iterator it;
it = m_nodeToClickFileMap.find (node);
if (it != m_nodeToClickFileMap.end ())
{
ipv4Routing->SetClickFile (it->second);
}
it = m_nodeToRoutingTableElementMap.find (node);
if (it != m_nodeToRoutingTableElementMap.end ())
{
ipv4Routing->SetClickRoutingTableElement (it->second);
}
ipv4->SetRoutingProtocol (ipv4Routing);
node->AggregateObject (ipv4Routing);
}
}
void
ClickInternetStackHelper::Install (std::string nodeName) const
{
Ptr<Node> node = Names::Find<Node> (nodeName);
Install (node);
}
static void
Ipv4L3ProtocolRxTxSink (Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interface)
{
NS_LOG_FUNCTION (p << ipv4 << interface);
//
// Since trace sources are independent of interface, if we hook a source
// on a particular protocol we will get traces for all of its interfaces.
// We need to filter this to only report interfaces for which the user
// has expressed interest.
//
InterfacePairIpv4 pair = std::make_pair (ipv4, interface);
if (g_interfaceFileMapIpv4.find (pair) == g_interfaceFileMapIpv4.end ())
{
NS_LOG_INFO ("Ignoring packet to/from interface " << interface);
return;
}
Ptr<PcapFileWrapper> file = g_interfaceFileMapIpv4[pair];
file->Write (Simulator::Now (), p);
}
bool
ClickInternetStackHelper::PcapHooked (Ptr<Ipv4> ipv4)
{
for ( InterfaceFileMapIpv4::const_iterator i = g_interfaceFileMapIpv4.begin ();
i != g_interfaceFileMapIpv4.end ();
++i)
{
if ((*i).first.first == ipv4)
{
return true;
}
}
return false;
}
void
ClickInternetStackHelper::EnablePcapIpv4Internal (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface, bool explicitFilename)
{
NS_LOG_FUNCTION (prefix << ipv4 << interface);
if (!m_ipv4Enabled)
{
NS_LOG_INFO ("Call to enable Ipv4 pcap tracing but Ipv4 not enabled");
return;
}
//
// We have to create a file and a mapping from protocol/interface to file
// irrespective of how many times we want to trace a particular protocol.
//
PcapHelper pcapHelper;
std::string filename;
if (explicitFilename)
{
filename = prefix;
}
else
{
filename = pcapHelper.GetFilenameFromInterfacePair (prefix, ipv4, interface);
}
Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_RAW);
//
// However, we only hook the trace source once to avoid multiple trace sink
// calls per event (connect is independent of interface).
//
if (!PcapHooked (ipv4))
{
//
// Ptr<Ipv4> is aggregated to node and Ipv4L3Protocol is aggregated to
// node so we can get to Ipv4L3Protocol through Ipv4.
//
Ptr<Ipv4L3Protocol> ipv4L3Protocol = ipv4->GetObject<Ipv4L3Protocol> ();
NS_ASSERT_MSG (ipv4L3Protocol, "ClickInternetStackHelper::EnablePcapIpv4Internal(): "
"m_ipv4Enabled and ipv4L3Protocol inconsistent");
bool result = ipv4L3Protocol->TraceConnectWithoutContext ("Tx", MakeCallback (&Ipv4L3ProtocolRxTxSink));
NS_ASSERT_MSG (result == true, "ClickInternetStackHelper::EnablePcapIpv4Internal(): "
"Unable to connect ipv4L3Protocol \"Tx\"");
result = ipv4L3Protocol->TraceConnectWithoutContext ("Rx", MakeCallback (&Ipv4L3ProtocolRxTxSink));
NS_ASSERT_MSG (result == true, "ClickInternetStackHelper::EnablePcapIpv4Internal(): "
"Unable to connect ipv4L3Protocol \"Rx\"");
(void) result; //cast to void to suppress variable set but not used compiler warning in optimized builds
}
g_interfaceFileMapIpv4[std::make_pair (ipv4, interface)] = file;
}
static void
Ipv4L3ProtocolDropSinkWithoutContext (
Ptr<OutputStreamWrapper> stream,
Ipv4Header const &header,
Ptr<const Packet> packet,
Ipv4L3Protocol::DropReason reason,
Ptr<Ipv4> ipv4,
uint32_t interface)
{
//
// Since trace sources are independent of interface, if we hook a source
// on a particular protocol we will get traces for all of its interfaces.
// We need to filter this to only report interfaces for which the user
// has expressed interest.
//
InterfacePairIpv4 pair = std::make_pair (ipv4, interface);
if (g_interfaceStreamMapIpv4.find (pair) == g_interfaceStreamMapIpv4.end ())
{
NS_LOG_INFO ("Ignoring packet to/from interface " << interface);
return;
}
Ptr<Packet> p = packet->Copy ();
p->AddHeader (header);
*stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
}
static void
Ipv4L3ProtocolDropSinkWithContext (
Ptr<OutputStreamWrapper> stream,
std::string context,
Ipv4Header const &header,
Ptr<const Packet> packet,
Ipv4L3Protocol::DropReason reason,
Ptr<Ipv4> ipv4,
uint32_t interface)
{
//
// Since trace sources are independent of interface, if we hook a source
// on a particular protocol we will get traces for all of its interfaces.
// We need to filter this to only report interfaces for which the user
// has expressed interest.
//
InterfacePairIpv4 pair = std::make_pair (ipv4, interface);
if (g_interfaceStreamMapIpv4.find (pair) == g_interfaceStreamMapIpv4.end ())
{
NS_LOG_INFO ("Ignoring packet to/from interface " << interface);
return;
}
Ptr<Packet> p = packet->Copy ();
p->AddHeader (header);
#ifdef INTERFACE_CONTEXT
*stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << "(" << interface << ") "
<< *p << std::endl;
#else
*stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
#endif
}
bool
ClickInternetStackHelper::AsciiHooked (Ptr<Ipv4> ipv4)
{
for ( InterfaceStreamMapIpv4::const_iterator i = g_interfaceStreamMapIpv4.begin ();
i != g_interfaceStreamMapIpv4.end ();
++i)
{
if ((*i).first.first == ipv4)
{
return true;
}
}
return false;
}
void
ClickInternetStackHelper::EnableAsciiIpv4Internal (
Ptr<OutputStreamWrapper> stream,
std::string prefix,
Ptr<Ipv4> ipv4,
uint32_t interface,
bool explicitFilename)
{
if (!m_ipv4Enabled)
{
NS_LOG_INFO ("Call to enable Ipv4 ascii tracing but Ipv4 not enabled");
return;
}
//
// Our trace sinks are going to use packet printing, so we have to
// make sure that is turned on.
//
Packet::EnablePrinting ();
//
// If we are not provided an OutputStreamWrapper, we are expected to create
// one using the usual trace filename conventions and hook WithoutContext
// since there will be one file per context and therefore the context would
// be redundant.
//
if (stream == 0)
{
//
// Set up an output stream object to deal with private ofstream copy
// constructor and lifetime issues. Let the helper decide the actual
// name of the file given the prefix.
//
// We have to create a stream and a mapping from protocol/interface to
// stream irrespective of how many times we want to trace a particular
// protocol.
//
AsciiTraceHelper asciiTraceHelper;
std::string filename;
if (explicitFilename)
{
filename = prefix;
}
else
{
filename = asciiTraceHelper.GetFilenameFromInterfacePair (prefix, ipv4, interface);
}
Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
//
// However, we only hook the trace sources once to avoid multiple trace sink
// calls per event (connect is independent of interface).
//
if (!AsciiHooked (ipv4))
{
//
// We can use the default drop sink for the ArpL3Protocol since it has
// the usual signature. We can get to the Ptr<ArpL3Protocol> through
// our Ptr<Ipv4> since they must both be aggregated to the same node.
//
Ptr<ArpL3Protocol> arpL3Protocol = ipv4->GetObject<ArpL3Protocol> ();
asciiTraceHelper.HookDefaultDropSinkWithoutContext<ArpL3Protocol> (arpL3Protocol, "Drop", theStream);
//
// The drop sink for the Ipv4L3Protocol uses a different signature than
// the default sink, so we have to cook one up for ourselves. We can get
// to the Ptr<Ipv4L3Protocol> through our Ptr<Ipv4> since they must both
// be aggregated to the same node.
//
Ptr<Ipv4L3Protocol> ipv4L3Protocol = ipv4->GetObject<Ipv4L3Protocol> ();
bool __attribute__ ((unused)) result = ipv4L3Protocol->TraceConnectWithoutContext ("Drop",
MakeBoundCallback (&Ipv4L3ProtocolDropSinkWithoutContext,
theStream));
NS_ASSERT_MSG (result == true, "ClickInternetStackHelper::EanableAsciiIpv4Internal(): "
"Unable to connect ipv4L3Protocol \"Drop\"");
}
g_interfaceStreamMapIpv4[std::make_pair (ipv4, interface)] = theStream;
return;
}
//
// If we are provided an OutputStreamWrapper, we are expected to use it, and
// to provide a context. We are free to come up with our own context if we
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for
// compatibility and simplicity, we just use Config::Connect and let it deal
// with the context.
//
// We need to associate the ipv4/interface with a stream to express interest
// in tracing events on that pair, however, we only hook the trace sources
// once to avoid multiple trace sink calls per event (connect is independent
// of interface).
//
if (!AsciiHooked (ipv4))
{
Ptr<Node> node = ipv4->GetObject<Node> ();
std::ostringstream oss;
//
// For the ARP Drop, we are going to use the default trace sink provided by
// the ascii trace helper. There is actually no AsciiTraceHelper in sight
// here, but the default trace sinks are actually publicly available static
// functions that are always there waiting for just such a case.
//
oss << "/NodeList/" << node->GetId () << "/$ns3::ArpL3Protocol/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
//
// This has all kinds of parameters coming with, so we have to cook up our
// own sink.
//
oss.str ("");
oss << "/NodeList/" << node->GetId () << "/$ns3::Ipv4L3Protocol/Drop";
Config::Connect (oss.str (), MakeBoundCallback (&Ipv4L3ProtocolDropSinkWithContext, stream));
}
g_interfaceStreamMapIpv4[std::make_pair (ipv4, interface)] = stream;
}
} // namespace ns3
#endif // NS3_CLICK
| zy901002-gpsr | src/click/helper/click-internet-stack-helper.cc | C++ | gpl2 | 16,246 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os
import Options
def options(opt):
opt.add_option('--with-nsclick',
help=('Path to Click source or installation prefix for NS-3 Click Integration support'),
dest='with_nsclick', default=None)
opt.add_option('--disable-nsclick',
help=('Disable NS-3 Click Integration support'),
dest='disable_nsclick', default=False, action="store_true")
def configure(conf):
if Options.options.disable_nsclick:
conf.report_optional_feature("nsclick", "NS-3 Click Integration", False,
"disabled by user request")
return
if Options.options.with_nsclick:
if os.path.isdir(Options.options.with_nsclick):
conf.msg("Checking for libnsclick.so location", ("%s (given)" % Options.options.with_nsclick))
conf.env['WITH_NSCLICK'] = os.path.abspath(Options.options.with_nsclick)
else:
nsclick_dir = os.path.join('..','click')
if os.path.isdir(nsclick_dir):
conf.msg("Checking for click location", ("%s (guessed)" % nsclick_dir))
conf.env['WITH_NSCLICK'] = os.path.abspath(nsclick_dir)
del nsclick_dir
if not conf.env['WITH_NSCLICK']:
conf.msg("Checking for click location", False)
conf.report_optional_feature("nsclick", "NS-3 Click Integration", False,
"nsclick not enabled (see option --with-nsclick)")
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('click')
return
test_code = '''
#include<sys/types.h>
#include<sys/time.h>
#include<click/simclick.h>
#ifdef __cplusplus
extern "C" {
#endif
int simclick_sim_send(simclick_node_t *sim,int ifid,int type, const unsigned char* data,int len,simclick_simpacketinfo *pinfo)
{
return 0;
}
int simclick_sim_command(simclick_node_t *sim, int cmd, ...)
{
return 0;
}
#ifdef __cplusplus
}
#endif
int main()
{
return 0;
}
'''
conf.env['DL'] = conf.check(mandatory=True, lib='dl', define_name='DL', uselib_store='DL')
for tmp in ['lib', 'ns']:
libdir = os.path.abspath(os.path.join(conf.env['WITH_NSCLICK'],tmp))
if os.path.isdir(libdir):
conf.env.append_value('NS3_MODULE_PATH',libdir)
conf.env['LIBPATH_NSCLICK'] = [libdir]
conf.env['INCLUDES_NSCLICK'] = [os.path.abspath(os.path.join(conf.env['WITH_NSCLICK'],'include'))]
conf.env['LIB_NSCLICK'] = ['nsclick']
conf.env['DEFINES_NSCLICK'] = ['NS3_CLICK']
conf.env['NSCLICK'] = conf.check_nonfatal(fragment=test_code, use='DL NSCLICK',
msg="Checking for library nsclick")
conf.report_optional_feature("nsclick", "NS-3 Click Integration",
conf.env['NSCLICK'], "nsclick library not found")
if not conf.env['NSCLICK']:
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('click')
def build(bld):
# Don't do anything for this module if click should not be built.
if 'click' in bld.env['MODULES_NOT_BUILT']:
return
module = bld.create_ns3_module('click', ['core', 'network', 'internet'])
module.source = [
'model/ipv4-click-routing.cc',
'model/ipv4-l3-click-protocol.cc',
'helper/click-internet-stack-helper.cc',
]
module_test = bld.create_ns3_module_test_library('click')
module_test.source = [
'test/ipv4-click-routing-test.cc',
]
if bld.env['NSCLICK'] and bld.env['DL']:
module.use = 'NSCLICK DL'
module_test.use = 'NSCLICK DL'
headers = bld.new_task_gen(features=['ns3header'])
headers.module = 'click'
headers.source = [
'model/ipv4-click-routing.h',
'model/ipv4-l3-click-protocol.h',
'helper/click-internet-stack-helper.h',
]
if bld.env['ENABLE_EXAMPLES']:
bld.add_subdirs('examples')
bld.ns3_python_bindings()
| zy901002-gpsr | src/click/wscript | Python | gpl2 | 4,207 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef CAPABILITY_INFORMATION_H
#define CAPABILITY_INFORMATION_H
#include <stdint.h>
#include "ns3/buffer.h"
namespace ns3 {
/**
* \ingroup wifi
*
*
*/
class CapabilityInformation
{
public:
CapabilityInformation ();
void SetEss (void);
void SetIbss (void);
bool IsEss (void) const;
bool IsIbss (void) const;
uint32_t GetSerializedSize (void) const;
Buffer::Iterator Serialize (Buffer::Iterator start) const;
Buffer::Iterator Deserialize (Buffer::Iterator start);
private:
bool Is (uint8_t n) const;
void Set (uint8_t n);
void Clear (uint8_t n);
uint16_t m_capability;
};
} // namespace ns3
#endif /* CAPABILITY_INFORMATION_H */
| zy901002-gpsr | src/wifi/model/capability-information.h | C++ | gpl2 | 1,479 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2003,2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef ONOE_WIFI_MANAGER_H
#define ONOE_WIFI_MANAGER_H
#include "wifi-remote-station-manager.h"
#include "ns3/nstime.h"
namespace ns3 {
struct OnoeWifiRemoteStation;
/**
* \brief an implementation of the rate control algorithm developed
* by Atsushi Onoe
*
* \ingroup wifi
*
* This algorithm is well known because it has been used as the default
* rate control algorithm for the madwifi driver. I am not aware of
* any publication or reference about this algorithm beyond the madwifi
* source code.
*/
class OnoeWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
OnoeWifiManager ();
private:
// overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
virtual void DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr);
virtual void DoReportDataOk (WifiRemoteStation *station,
double ackSnr, WifiMode ackMode, double dataSnr);
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
void UpdateRetry (OnoeWifiRemoteStation *station);
void UpdateMode (OnoeWifiRemoteStation *station);
Time m_updatePeriod;
uint32_t m_addCreditThreshold;
uint32_t m_raiseThreshold;
};
} // namespace ns3
#endif /* ONOE_WIFI_MANAGER_H */
| zy901002-gpsr | src/wifi/model/onoe-wifi-manager.h | C++ | gpl2 | 2,657 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "yans-error-rate-model.h"
#include "wifi-phy.h"
#include "ns3/log.h"
NS_LOG_COMPONENT_DEFINE ("YansErrorRateModel");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (YansErrorRateModel);
TypeId
YansErrorRateModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::YansErrorRateModel")
.SetParent<ErrorRateModel> ()
.AddConstructor<YansErrorRateModel> ()
;
return tid;
}
YansErrorRateModel::YansErrorRateModel ()
{
}
double
YansErrorRateModel::Log2 (double val) const
{
return log (val) / log (2.0);
}
double
YansErrorRateModel::GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const
{
double EbNo = snr * signalSpread / phyRate;
double z = sqrt (EbNo);
double ber = 0.5 * erfc (z);
NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber);
return ber;
}
double
YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const
{
double EbNo = snr * signalSpread / phyRate;
double z = sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0));
double z1 = ((1.0 - 1.0 / sqrt (m)) * erfc (z));
double z2 = 1 - pow ((1 - z1), 2.0);
double ber = z2 / Log2 (m);
NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber);
return ber;
}
uint32_t
YansErrorRateModel::Factorial (uint32_t k) const
{
uint32_t fact = 1;
while (k > 0)
{
fact *= k;
k--;
}
return fact;
}
double
YansErrorRateModel::Binomial (uint32_t k, double p, uint32_t n) const
{
double retval = Factorial (n) / (Factorial (k) * Factorial (n - k)) * pow (p, k) * pow (1 - p, n - k);
return retval;
}
double
YansErrorRateModel::CalculatePdOdd (double ber, unsigned int d) const
{
NS_ASSERT ((d % 2) == 1);
unsigned int dstart = (d + 1) / 2;
unsigned int dend = d;
double pd = 0;
for (unsigned int i = dstart; i < dend; i++)
{
pd += Binomial (i, ber, d);
}
return pd;
}
double
YansErrorRateModel::CalculatePdEven (double ber, unsigned int d) const
{
NS_ASSERT ((d % 2) == 0);
unsigned int dstart = d / 2 + 1;
unsigned int dend = d;
double pd = 0;
for (unsigned int i = dstart; i < dend; i++)
{
pd += Binomial (i, ber, d);
}
pd += 0.5 * Binomial (d / 2, ber, d);
return pd;
}
double
YansErrorRateModel::CalculatePd (double ber, unsigned int d) const
{
double pd;
if ((d % 2) == 0)
{
pd = CalculatePdEven (ber, d);
}
else
{
pd = CalculatePdOdd (ber, d);
}
return pd;
}
double
YansErrorRateModel::GetFecBpskBer (double snr, double nbits,
uint32_t signalSpread, uint32_t phyRate,
uint32_t dFree, uint32_t adFree) const
{
double ber = GetBpskBer (snr, signalSpread, phyRate);
if (ber == 0.0)
{
return 1.0;
}
double pd = CalculatePd (ber, dFree);
double pmu = adFree * pd;
pmu = std::min (pmu, 1.0);
double pms = pow (1 - pmu, nbits);
return pms;
}
double
YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits,
uint32_t signalSpread,
uint32_t phyRate,
uint32_t m, uint32_t dFree,
uint32_t adFree, uint32_t adFreePlusOne) const
{
double ber = GetQamBer (snr, m, signalSpread, phyRate);
if (ber == 0.0)
{
return 1.0;
}
/* first term */
double pd = CalculatePd (ber, dFree);
double pmu = adFree * pd;
/* second term */
pd = CalculatePd (ber, dFree + 1);
pmu += adFreePlusOne * pd;
pmu = std::min (pmu, 1.0);
double pms = pow (1 - pmu, nbits);
return pms;
}
double
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
{
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
|| mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM)
{
if (mode.GetConstellationSize () == 2)
{
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
{
return GetFecBpskBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
10, // dFree
11 // adFree
);
}
else
{
return GetFecBpskBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
5, // dFree
8 // adFree
);
}
}
else if (mode.GetConstellationSize () == 4)
{
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
4, // m
10, // dFree
11, // adFree
0 // adFreePlusOne
);
}
else
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
4, // m
5, // dFree
8, // adFree
31 // adFreePlusOne
);
}
}
else if (mode.GetConstellationSize () == 16)
{
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2)
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
16, // m
10, // dFree
11, // adFree
0 // adFreePlusOne
);
}
else
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
16, // m
5, // dFree
8, // adFree
31 // adFreePlusOne
);
}
}
else if (mode.GetConstellationSize () == 64)
{
if (mode.GetCodeRate () == WIFI_CODE_RATE_2_3)
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
64, // m
6, // dFree
1, // adFree
16 // adFreePlusOne
);
}
else
{
return GetFecQamBer (snr,
nbits,
mode.GetBandwidth (), // signal spread
mode.GetPhyRate (), // phy rate
64, // m
5, // dFree
8, // adFree
31 // adFreePlusOne
);
}
}
}
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS)
{
switch (mode.GetDataRate ())
{
case 1000000:
return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr, nbits);
case 2000000:
return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr, nbits);
case 5500000:
return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr, nbits);
case 11000000:
return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr, nbits);
}
}
return 0;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/yans-error-rate-model.cc | C++ | gpl2 | 9,498 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "status-code.h"
#include <string>
#include <ostream>
namespace ns3 {
StatusCode::StatusCode ()
{
}
void
StatusCode::SetSuccess (void)
{
m_code = 0;
}
void
StatusCode::SetFailure (void)
{
m_code = 1;
}
bool
StatusCode::IsSuccess (void) const
{
return (m_code == 0);
}
uint32_t
StatusCode::GetSerializedSize (void) const
{
return 2;
}
Buffer::Iterator
StatusCode::Serialize (Buffer::Iterator start) const
{
start.WriteHtolsbU16 (m_code);
return start;
}
Buffer::Iterator
StatusCode::Deserialize (Buffer::Iterator start)
{
m_code = start.ReadLsbtohU16 ();
return start;
}
std::ostream &
operator << (std::ostream &os, const StatusCode &code)
{
if (code.IsSuccess ())
{
os << "success";
}
else
{
os << "failure";
}
return os;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/status-code.cc | C++ | gpl2 | 1,622 |
/* -*- 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 "qos-tag.h"
#include "ns3/tag.h"
#include "ns3/uinteger.h"
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (QosTag);
TypeId
QosTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::QosTag")
.SetParent<Tag> ()
.AddConstructor<QosTag> ()
.AddAttribute ("tid", "The tid that indicates AC which packet belongs",
UintegerValue (0),
MakeUintegerAccessor (&QosTag::GetTid),
MakeUintegerChecker<uint8_t> ())
;
return tid;
}
TypeId
QosTag::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
QosTag::QosTag ()
: m_tid (0)
{
}
QosTag::QosTag (uint8_t tid)
: m_tid (tid)
{
}
void
QosTag::SetTid (uint8_t tid)
{
m_tid = tid;
}
void
QosTag::SetUserPriority (UserPriority up)
{
m_tid = up;
}
uint32_t
QosTag::GetSerializedSize (void) const
{
return 1;
}
void
QosTag::Serialize (TagBuffer i) const
{
i.WriteU8 (m_tid);
}
void
QosTag::Deserialize (TagBuffer i)
{
m_tid = (UserPriority) i.ReadU8 ();
}
uint8_t
QosTag::GetTid () const
{
return m_tid;
}
void
QosTag::Print (std::ostream &os) const
{
os << "Tid=" << m_tid;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/qos-tag.cc | C++ | gpl2 | 1,954 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "supported-rates.h"
#include "ns3/assert.h"
#include "ns3/log.h"
NS_LOG_COMPONENT_DEFINE ("SupportedRates");
namespace ns3 {
SupportedRates::SupportedRates ()
: extended (this),
m_nRates (0)
{
}
void
SupportedRates::AddSupportedRate (uint32_t bs)
{
NS_ASSERT (m_nRates < MAX_SUPPORTED_RATES);
if (IsSupportedRate (bs))
{
return;
}
m_rates[m_nRates] = bs / 500000;
m_nRates++;
NS_LOG_DEBUG ("add rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
}
void
SupportedRates::SetBasicRate (uint32_t bs)
{
uint8_t rate = bs / 500000;
for (uint8_t i = 0; i < m_nRates; i++)
{
if ((rate | 0x80) == m_rates[i])
{
return;
}
if (rate == m_rates[i])
{
NS_LOG_DEBUG ("set basic rate=" << bs << ", n rates=" << (uint32_t)m_nRates);
m_rates[i] |= 0x80;
return;
}
}
AddSupportedRate (bs);
SetBasicRate (bs);
}
bool
SupportedRates::IsBasicRate (uint32_t bs) const
{
uint8_t rate = (bs / 500000) | 0x80;
for (uint8_t i = 0; i < m_nRates; i++)
{
if (rate == m_rates[i])
{
return true;
}
}
return false;
}
bool
SupportedRates::IsSupportedRate (uint32_t bs) const
{
uint8_t rate = bs / 500000;
for (uint8_t i = 0; i < m_nRates; i++)
{
if (rate == m_rates[i]
|| (rate | 0x80) == m_rates[i])
{
return true;
}
}
return false;
}
uint8_t
SupportedRates::GetNRates (void) const
{
return m_nRates;
}
uint32_t
SupportedRates::GetRate (uint8_t i) const
{
return (m_rates[i] & 0x7f) * 500000;
}
WifiInformationElementId
SupportedRates::ElementId () const
{
return IE_SUPPORTED_RATES;
}
uint8_t
SupportedRates::GetInformationFieldSize () const
{
// The Supported Rates Information Element contains only the first 8
// supported rates - the remainder appear in the Extended Supported
// Rates Information Element.
return m_nRates > 8 ? 8 : m_nRates;
}
void
SupportedRates::SerializeInformationField (Buffer::Iterator start) const
{
// The Supported Rates Information Element contains only the first 8
// supported rates - the remainder appear in the Extended Supported
// Rates Information Element.
start.Write (m_rates, m_nRates > 8 ? 8 : m_nRates);
}
uint8_t
SupportedRates::DeserializeInformationField (Buffer::Iterator start,
uint8_t length)
{
NS_ASSERT (length <= 8);
m_nRates = length;
start.Read (m_rates, m_nRates);
return m_nRates;
}
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE ()
{
}
ExtendedSupportedRatesIE::ExtendedSupportedRatesIE (SupportedRates *sr)
{
m_supportedRates = sr;
}
WifiInformationElementId
ExtendedSupportedRatesIE::ElementId () const
{
return IE_EXTENDED_SUPPORTED_RATES;
}
uint8_t
ExtendedSupportedRatesIE::GetInformationFieldSize () const
{
// If there are 8 or fewer rates then we don't need an Extended
// Supported Rates IE and so could return zero here, but we're
// overriding the GetSerializedSize() method, so if this function is
// invoked in that case then it indicates a programming error. Hence
// we have an assertion on that condition.
NS_ASSERT (m_supportedRates->m_nRates > 8);
// The number of rates we have beyond the initial 8 is the size of
// the information field.
return (m_supportedRates->m_nRates - 8);
}
void
ExtendedSupportedRatesIE::SerializeInformationField (Buffer::Iterator start) const
{
// If there are 8 or fewer rates then there should be no Extended
// Supported Rates Information Element at all so being here would
// seemingly indicate a programming error.
//
// Our overridden version of the Serialize() method should ensure
// that this routine is never invoked in that case (by ensuring that
// WifiInformationElement::Serialize() is not invoked).
NS_ASSERT (m_supportedRates->m_nRates > 8);
start.Write (m_supportedRates->m_rates + 8, m_supportedRates->m_nRates - 8);
}
Buffer::Iterator
ExtendedSupportedRatesIE::Serialize (Buffer::Iterator start) const
{
// If there are 8 or fewer rates then we don't need an Extended
// Supported Rates IE, so we don't serialise anything.
if (m_supportedRates->m_nRates <= 8)
{
return start;
}
// If there are more than 8 rates then we serialise as per normal.
return WifiInformationElement::Serialize (start);
}
uint16_t
ExtendedSupportedRatesIE::GetSerializedSize () const
{
// If there are 8 or fewer rates then we don't need an Extended
// Supported Rates IE, so it's serialised length will be zero.
if (m_supportedRates->m_nRates <= 8)
{
return 0;
}
// Otherwise, the size of it will be the number of supported rates
// beyond 8, plus 2 for the Element ID and Length.
return WifiInformationElement::GetSerializedSize ();
}
uint8_t
ExtendedSupportedRatesIE::DeserializeInformationField (Buffer::Iterator start,
uint8_t length)
{
NS_ASSERT (length > 0);
NS_ASSERT (m_supportedRates->m_nRates + length <= MAX_SUPPORTED_RATES);
start.Read (m_supportedRates->m_rates + m_supportedRates->m_nRates, length);
m_supportedRates->m_nRates += length;
return length;
}
std::ostream &operator << (std::ostream &os, const SupportedRates &rates)
{
os << "[";
for (uint8_t i = 0; i < rates.GetNRates (); i++)
{
uint32_t rate = rates.GetRate (i);
if (rates.IsBasicRate (rate))
{
os << "*";
}
os << rate / 1000000 << "mbs";
if (i < rates.GetNRates () - 1)
{
os << " ";
}
}
os << "]";
return os;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/supported-rates.cc | C++ | gpl2 | 6,480 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "capability-information.h"
namespace ns3 {
CapabilityInformation::CapabilityInformation ()
: m_capability (0)
{
}
void
CapabilityInformation::SetEss (void)
{
Set (0);
Clear (1);
}
void
CapabilityInformation::SetIbss (void)
{
Clear (0);
Set (1);
}
bool
CapabilityInformation::IsEss (void) const
{
return Is (0);
}
bool
CapabilityInformation::IsIbss (void) const
{
return Is (1);
}
void
CapabilityInformation::Set (uint8_t n)
{
uint32_t mask = 1 << n;
m_capability |= mask;
}
void
CapabilityInformation::Clear (uint8_t n)
{
uint32_t mask = 1 << n;
m_capability &= ~mask;
}
bool
CapabilityInformation::Is (uint8_t n) const
{
uint32_t mask = 1 << n;
return (m_capability & mask) == mask;
}
uint32_t
CapabilityInformation::GetSerializedSize (void) const
{
return 2;
}
Buffer::Iterator
CapabilityInformation::Serialize (Buffer::Iterator start) const
{
start.WriteHtolsbU16 (m_capability);
return start;
}
Buffer::Iterator
CapabilityInformation::Deserialize (Buffer::Iterator start)
{
m_capability = start.ReadLsbtohU16 ();
return start;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/capability-information.cc | C++ | gpl2 | 1,922 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef STATUS_CODE_H
#define STATUS_CODE_H
#include <stdint.h>
#include <ostream>
#include "ns3/buffer.h"
namespace ns3 {
class StatusCode
{
public:
StatusCode ();
void SetSuccess (void);
void SetFailure (void);
bool IsSuccess (void) const;
uint32_t GetSerializedSize (void) const;
Buffer::Iterator Serialize (Buffer::Iterator start) const;
Buffer::Iterator Deserialize (Buffer::Iterator start);
private:
uint16_t m_code;
};
std::ostream &operator << (std::ostream &os, const StatusCode &code);
} // namespace ns3
#endif /* STATUS_CODE_H */
| zy901002-gpsr | src/wifi/model/status-code.h | C++ | gpl2 | 1,380 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef MGT_HEADERS_H
#define MGT_HEADERS_H
#include <stdint.h>
#include "ns3/header.h"
#include "status-code.h"
#include "capability-information.h"
#include "supported-rates.h"
#include "ssid.h"
namespace ns3 {
/**
* \ingroup wifi
* Implement the header for management frames of type association request.
*/
class MgtAssocRequestHeader : public Header
{
public:
MgtAssocRequestHeader ();
~MgtAssocRequestHeader ();
void SetSsid (Ssid ssid);
void SetSupportedRates (SupportedRates rates);
void SetListenInterval (uint16_t interval);
Ssid GetSsid (void) const;
SupportedRates GetSupportedRates (void) const;
uint16_t GetListenInterval (void) const;
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
Ssid m_ssid;
SupportedRates m_rates;
CapabilityInformation m_capability;
uint16_t m_listenInterval;
};
/**
* \ingroup wifi
* Implement the header for management frames of type association response.
*/
class MgtAssocResponseHeader : public Header
{
public:
MgtAssocResponseHeader ();
~MgtAssocResponseHeader ();
StatusCode GetStatusCode (void);
SupportedRates GetSupportedRates (void);
void SetSupportedRates (SupportedRates rates);
void SetStatusCode (StatusCode code);
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
SupportedRates m_rates;
CapabilityInformation m_capability;
StatusCode m_code;
uint16_t m_aid;
};
/**
* \ingroup wifi
* Implement the header for management frames of type probe request.
*/
class MgtProbeRequestHeader : public Header
{
public:
~MgtProbeRequestHeader ();
void SetSsid (Ssid ssid);
void SetSupportedRates (SupportedRates rates);
Ssid GetSsid (void) const;
SupportedRates GetSupportedRates (void) const;
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
Ssid m_ssid;
SupportedRates m_rates;
};
/**
* \ingroup wifi
* Implement the header for management frames of type probe response.
*/
class MgtProbeResponseHeader : public Header
{
public:
MgtProbeResponseHeader ();
~MgtProbeResponseHeader ();
Ssid GetSsid (void) const;
uint64_t GetBeaconIntervalUs (void) const;
SupportedRates GetSupportedRates (void) const;
void SetSsid (Ssid ssid);
void SetBeaconIntervalUs (uint64_t us);
void SetSupportedRates (SupportedRates rates);
uint64_t GetTimestamp ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
uint64_t m_timestamp;
Ssid m_ssid;
uint64_t m_beaconInterval;
SupportedRates m_rates;
CapabilityInformation m_capability;
};
/**
* \ingroup wifi
* Implement the header for management frames of type beacon.
*/
class MgtBeaconHeader : public MgtProbeResponseHeader
{
};
/****************************
* Action frames
*****************************/
/**
* \ingroup wifi
*
* See IEEE 802.11 chapter 7.3.1.11
* Header format: | category: 1 | action value: 1 |
*
*/
class WifiActionHeader : public Header
{
public:
WifiActionHeader ();
~WifiActionHeader ();
/* Compatible with open80211s implementation */
enum CategoryValue //table 7-24 staring from 4
{
BLOCK_ACK = 3,
MESH_PEERING_MGT = 30,
MESH_LINK_METRIC = 31,
MESH_PATH_SELECTION = 32,
MESH_INTERWORKING = 33,
MESH_RESOURCE_COORDINATION = 34,
MESH_PROXY_FORWARDING = 35,
};
/* Compatible with open80211s implementation */
enum PeerLinkMgtActionValue
{
PEER_LINK_OPEN = 0,
PEER_LINK_CONFIRM = 1,
PEER_LINK_CLOSE = 2,
};
enum LinkMetricActionValue
{
LINK_METRIC_REQUEST = 0,
LINK_METRIC_REPORT,
};
/* Compatible with open80211s implementation */
enum PathSelectionActionValue
{
PATH_SELECTION = 0,
};
enum InterworkActionValue
{
PORTAL_ANNOUNCEMENT = 0,
};
enum ResourceCoordinationActionValue
{
CONGESTION_CONTROL_NOTIFICATION = 0,
MDA_SETUP_REQUEST,
MDA_SETUP_REPLY,
MDAOP_ADVERTISMENT_REQUEST,
MDAOP_ADVERTISMENTS,
MDAOP_SET_TEARDOWN,
BEACON_TIMING_REQUEST,
BEACON_TIMING_RESPONSE,
TBTT_ADJUSTMENT_REQUEST,
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
};
enum BlockAckActionValue
{
BLOCK_ACK_ADDBA_REQUEST = 0,
BLOCK_ACK_ADDBA_RESPONSE = 1,
BLOCK_ACK_DELBA = 2
};
typedef union
{
enum PeerLinkMgtActionValue peerLink;
enum LinkMetricActionValue linkMetrtic;
enum PathSelectionActionValue pathSelection;
enum InterworkActionValue interwork;
enum ResourceCoordinationActionValue resourceCoordination;
enum BlockAckActionValue blockAck;
} ActionValue;
void SetAction (enum CategoryValue type,ActionValue action);
CategoryValue GetCategory ();
ActionValue GetAction ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId () const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
uint8_t m_category;
uint8_t m_actionValue;
};
/**
* \ingroup wifi
* Implement the header for management frames of type add block ack request.
*/
class MgtAddBaRequestHeader : public Header
{
public:
MgtAddBaRequestHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
void SetDelayedBlockAck ();
void SetImmediateBlockAck ();
void SetTid (uint8_t tid);
void SetTimeout (uint16_t timeout);
void SetBufferSize (uint16_t size);
void SetStartingSequence (uint16_t seq);
void SetAmsduSupport (bool supported);
uint16_t GetStartingSequence (void) const;
uint8_t GetTid (void) const;
bool IsImmediateBlockAck (void) const;
uint16_t GetTimeout (void) const;
uint16_t GetBufferSize (void) const;
bool IsAmsduSupported (void) const;
private:
uint16_t GetParameterSet (void) const;
void SetParameterSet (uint16_t params);
uint16_t GetStartingSequenceControl (void) const;
void SetStartingSequenceControl (uint16_t seqControl);
uint8_t m_dialogToken; /* Not used for now */
uint8_t m_amsduSupport;
uint8_t m_policy;
uint8_t m_tid;
uint16_t m_bufferSize;
uint16_t m_timeoutValue;
uint16_t m_startingSeq;
};
/**
* \ingroup wifi
* Implement the header for management frames of type add block ack response.
*/
class MgtAddBaResponseHeader : public Header
{
public:
MgtAddBaResponseHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
void SetDelayedBlockAck ();
void SetImmediateBlockAck ();
void SetTid (uint8_t tid);
void SetTimeout (uint16_t timeout);
void SetBufferSize (uint16_t size);
void SetStatusCode (StatusCode code);
void SetAmsduSupport (bool supported);
StatusCode GetStatusCode (void) const;
uint8_t GetTid (void) const;
bool IsImmediateBlockAck (void) const;
uint16_t GetTimeout (void) const;
uint16_t GetBufferSize (void) const;
bool IsAmsduSupported (void) const;
private:
uint16_t GetParameterSet (void) const;
void SetParameterSet (uint16_t params);
uint8_t m_dialogToken; /* Not used for now */
StatusCode m_code;
uint8_t m_amsduSupport;
uint8_t m_policy;
uint8_t m_tid;
uint16_t m_bufferSize;
uint16_t m_timeoutValue;
};
/**
* \ingroup wifi
* Implement the header for management frames of type del block ack.
*/
class MgtDelBaHeader : public Header
{
public:
MgtDelBaHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
bool IsByOriginator (void) const;
uint8_t GetTid (void) const;
void SetTid (uint8_t);
void SetByOriginator (void);
void SetByRecipient (void);
private:
uint16_t GetParameterSet (void) const;
void SetParameterSet (uint16_t params);
uint16_t m_initiator;
uint16_t m_tid;
/* Not used for now.
Always set to 1: "Unspecified reason" */
uint16_t m_reasonCode;
};
} // namespace ns3
#endif /* MGT_HEADERS_H */
| zy901002-gpsr | src/wifi/model/mgt-headers.h | C++ | gpl2 | 10,328 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef WIFI_MAC_H
#define WIFI_MAC_H
#include "ns3/packet.h"
#include "ns3/mac48-address.h"
#include "wifi-phy.h"
#include "wifi-remote-station-manager.h"
#include "ssid.h"
#include "qos-utils.h"
namespace ns3 {
class Dcf;
/**
* \brief base class for all MAC-level wifi objects.
* \ingroup wifi
*
* This class encapsulates all the low-level MAC functionality
* DCA, EDCA, etc) and all the high-level MAC functionality
* (association/disassociation state machines).
*
*/
class WifiMac : public Object
{
public:
static TypeId GetTypeId (void);
/**
* \param slotTime the slot duration
*/
virtual void SetSlot (Time slotTime) = 0;
/**
* \param sifs the sifs duration
*/
virtual void SetSifs (Time sifs) = 0;
/**
* \param eifsNoDifs the duration of an EIFS minus DIFS.
*
* This value is used to calculate the EIFS depending
* on AIFSN.
*/
virtual void SetEifsNoDifs (Time eifsNoDifs) = 0;
/**
* \param pifs the pifs duration.
*/
virtual void SetPifs (Time pifs) = 0;
/**
* \param ctsTimeout the duration of a CTS timeout.
*/
virtual void SetCtsTimeout (Time ctsTimeout) = 0;
/**
* \param ackTimeout the duration of an ACK timeout.
*/
virtual void SetAckTimeout (Time ackTimeout) = 0;
/**
* \param delay the max propagation delay.
*
* Unused for now.
*/
void SetMaxPropagationDelay (Time delay);
/**
* \returns the current PIFS duration.
*/
virtual Time GetPifs (void) const = 0;
/**
* \returns the current SIFS duration.
*/
virtual Time GetSifs (void) const = 0;
/**
* \returns the current slot duration.
*/
virtual Time GetSlot (void) const = 0;
/**
* \returns the current EIFS minus DIFS duration
*/
virtual Time GetEifsNoDifs (void) const = 0;
/**
* \returns the current CTS timeout duration.
*/
virtual Time GetCtsTimeout (void) const = 0;
/**
* \returns the current ACK timeout duration.
*/
virtual Time GetAckTimeout (void) const = 0;
/**
* Unused for now.
*/
Time GetMsduLifetime (void) const;
/**
* Unused for now.
*/
Time GetMaxPropagationDelay (void) const;
/**
* \returns the MAC address associated to this MAC layer.
*/
virtual Mac48Address GetAddress (void) const = 0;
/**
* \returns the ssid which this MAC layer is going to try to stay in.
*/
virtual Ssid GetSsid (void) const = 0;
/**
* \param address the current address of this MAC layer.
*/
virtual void SetAddress (Mac48Address address) = 0;
/**
* \param ssid the current ssid of this MAC layer.
*/
virtual void SetSsid (Ssid ssid) = 0;
/**
* \returns the bssid of the network this device belongs to.
*/
virtual Mac48Address GetBssid (void) const = 0;
/**
* \brief Sets the interface in promiscuous mode.
*
* Enables promiscuous mode on the interface. Note that any further
* filtering on the incoming frame path may affect the overall
* behavior.
*/
virtual void SetPromisc (void) = 0;
/**
* \param packet the packet to send.
* \param to the address to which the packet should be sent.
* \param from the address from which the packet should be sent.
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the DCF function determines that
* access it granted to this MAC. The extra parameter "from" allows
* this device to operate in a bridged mode, forwarding received
* frames without altering the source address.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from) = 0;
/**
* \param packet the packet to send.
* \param to the address to which the packet should be sent.
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the DCF function determines that
* access it granted to this MAC.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
virtual bool SupportsSendFrom (void) const = 0;
/**
* \param phy the physical layer attached to this MAC.
*/
virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
/**
* \param stationManager the station manager attached to this MAC.
*/
virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
/**
* \param upCallback the callback to invoke when a packet must be forwarded up the stack.
*/
virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback) = 0;
/**
* \param linkUp the callback to invoke when the link becomes up.
*/
virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
/**
* \param linkDown the callback to invoke when the link becomes down.
*/
virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
/* Next functions are not pure virtual so non Qos WifiMacs are not
* forced to implement them.
*/
virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
virtual Time GetBasicBlockAckTimeout (void) const;
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
virtual Time GetCompressedBlockAckTimeout (void) const;
/**
* Public method used to fire a MacTx trace. Implemented for encapsulation
* purposes.
*/
void NotifyTx (Ptr<const Packet> packet);
/**
* Public method used to fire a MacTxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxDrop (Ptr<const Packet> packet);
/**
* Public method used to fire a MacRx trace. Implemented for encapsulation
* purposes.
*/
void NotifyRx (Ptr<const Packet> packet);
/**
* Public method used to fire a MacPromiscRx trace. Implemented for encapsulation
* purposes.
*/
void NotifyPromiscRx (Ptr<const Packet> packet);
/**
* Public method used to fire a MacRxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxDrop (Ptr<const Packet> packet);
/**
* \param standard the wifi standard to be configured
*/
void ConfigureStandard (enum WifiPhyStandard standard);
protected:
void ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac);
void ConfigureCCHDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac);
private:
static Time GetDefaultMaxPropagationDelay (void);
static Time GetDefaultSlot (void);
static Time GetDefaultSifs (void);
static Time GetDefaultEifsNoDifs (void);
static Time GetDefaultCtsAckDelay (void);
static Time GetDefaultCtsAckTimeout (void);
static Time GetDefaultBasicBlockAckDelay (void);
static Time GetDefaultBasicBlockAckTimeout (void);
static Time GetDefaultCompressedBlockAckDelay (void);
static Time GetDefaultCompressedBlockAckTimeout (void);
/**
* \param standard the phy standard to be used
*
* This method is called by ns3::WifiMac::ConfigureStandard to complete
* the configuration process for a requested phy standard. Subclasses should
* implement this method to configure their dcf queues according to the
* requested standard.
*/
virtual void FinishConfigureStandard (enum WifiPhyStandard standard) = 0;
Time m_maxPropagationDelay;
void Configure80211a (void);
void Configure80211b (void);
void Configure80211g (void);
void Configure80211_10Mhz (void);
void Configure80211_5Mhz ();
void Configure80211p_CCH (void);
void Configure80211p_SCH (void);
/**
* The trace source fired when packets come into the "top" of the device
* at the L3/L2 transition, before being queued for transmission.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macTxTrace;
/**
* The trace source fired when packets coming into the "top" of the device
* are dropped at the MAC layer during transmission.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
/**
* The trace source fired for packets successfully received by the device
* immediately before being forwarded up to higher layers (at the L2/L3
* transition). This is a promiscuous trace.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
/**
* The trace source fired for packets successfully received by the device
* immediately before being forwarded up to higher layers (at the L2/L3
* transition). This is a non- promiscuous trace.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macRxTrace;
/**
* The trace source fired when packets coming into the "top" of the device
* are dropped at the MAC layer during reception.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
};
} // namespace ns3
#endif /* WIFI_MAC_H */
| zy901002-gpsr | src/wifi/model/wifi-mac.h | C++ | gpl2 | 9,583 |
/* -*- 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/log.h"
#include "ns3/uinteger.h"
#include "amsdu-subframe-header.h"
#include "msdu-standard-aggregator.h"
NS_LOG_COMPONENT_DEFINE ("MsduStandardAggregator");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (MsduStandardAggregator);
TypeId
MsduStandardAggregator::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MsduStandardAggregator")
.SetParent<MsduAggregator> ()
.AddConstructor<MsduStandardAggregator> ()
.AddAttribute ("MaxAmsduSize", "Max length in byte of an A-MSDU",
UintegerValue (7935),
MakeUintegerAccessor (&MsduStandardAggregator::m_maxAmsduLength),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
MsduStandardAggregator::MsduStandardAggregator ()
{
}
MsduStandardAggregator::~MsduStandardAggregator ()
{
}
bool
MsduStandardAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest)
{
NS_LOG_FUNCTION (this);
Ptr<Packet> currentPacket;
AmsduSubframeHeader currentHdr;
uint32_t padding = CalculatePadding (aggregatedPacket);
uint32_t actualSize = aggregatedPacket->GetSize ();
if ((14 + packet->GetSize () + actualSize + padding) <= m_maxAmsduLength)
{
if (padding)
{
Ptr<Packet> pad = Create<Packet> (padding);
aggregatedPacket->AddAtEnd (pad);
}
currentHdr.SetDestinationAddr (dest);
currentHdr.SetSourceAddr (src);
currentHdr.SetLength (packet->GetSize ());
currentPacket = packet->Copy ();
currentPacket->AddHeader (currentHdr);
aggregatedPacket->AddAtEnd (currentPacket);
return true;
}
return false;
}
uint32_t
MsduStandardAggregator::CalculatePadding (Ptr<const Packet> packet)
{
return (4 - (packet->GetSize () % 4 )) % 4;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/msdu-standard-aggregator.cc | C++ | gpl2 | 2,678 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef ADHOC_WIFI_MAC_H
#define ADHOC_WIFI_MAC_H
#include "regular-wifi-mac.h"
#include "amsdu-subframe-header.h"
namespace ns3 {
/**
* \ingroup wifi
*
*
*/
class AdhocWifiMac : public RegularWifiMac
{
public:
static TypeId GetTypeId (void);
AdhocWifiMac ();
virtual ~AdhocWifiMac ();
/**
* \param address the current address of this MAC layer.
*/
virtual void SetAddress (Mac48Address address);
/**
* \param linkUp the callback to invoke when the link becomes up.
*/
virtual void SetLinkUpCallback (Callback<void> linkUp);
/**
* \param packet the packet to send.
* \param to the address to which the packet should be sent.
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the channel access function determines that
* access is granted to this MAC.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
private:
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
};
} // namespace ns3
#endif /* ADHOC_WIFI_MAC_H */
| zy901002-gpsr | src/wifi/model/adhoc-wifi-mac.h | C++ | gpl2 | 1,955 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef YANS_WIFI_PHY_H
#define YANS_WIFI_PHY_H
#include <stdint.h>
#include "ns3/callback.h"
#include "ns3/event-id.h"
#include "ns3/packet.h"
#include "ns3/object.h"
#include "ns3/traced-callback.h"
#include "ns3/nstime.h"
#include "ns3/ptr.h"
#include "ns3/random-variable.h"
#include "wifi-phy.h"
#include "wifi-mode.h"
#include "wifi-preamble.h"
#include "wifi-phy-standard.h"
#include "interference-helper.h"
namespace ns3 {
class RandomUniform;
class RxEvent;
class YansWifiChannel;
class WifiPhyStateHelper;
/**
* \brief 802.11 PHY layer model
* \ingroup wifi
*
* This PHY implements a model of 802.11a. The model
* implemented here is based on the model described
* in "Yet Another Network Simulator",
* (http://cutebugs.net/files/wns2-yans.pdf).
*
*
* This PHY model depends on a channel loss and delay
* model as provided by the ns3::PropagationLossModel
* and ns3::PropagationDelayModel classes, both of which are
* members of the ns3::YansWifiChannel class.
*/
class YansWifiPhy : public WifiPhy
{
public:
static TypeId GetTypeId (void);
YansWifiPhy ();
virtual ~YansWifiPhy ();
void SetChannel (Ptr<YansWifiChannel> channel);
/**
* \brief Set channel number.
*
* Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
*
* where Starting channel frequency is standard-dependent, see SetStandard()
* as defined in IEEE 802.11-2007 17.3.8.3.2.
*
* YansWifiPhy can switch among different channels. Basically, YansWifiPhy
* has a private attribute m_channelNumber that identifies the channel the
* PHY operates on. Channel switching cannot interrupt an ongoing transmission.
* When PHY is in TX state, the channel switching is postponed until the end
* of the current transmission. When the PHY is in RX state, the channel
* switching causes the drop of the synchronized packet.
*/
void SetChannelNumber (uint16_t id);
/// Return current channel number, see SetChannelNumber()
uint16_t GetChannelNumber () const;
/// Return current center channel frequency in MHz, see SetChannelNumber()
double GetChannelFrequencyMhz () const;
void StartReceivePacket (Ptr<Packet> packet,
double rxPowerDbm,
WifiMode mode,
WifiPreamble preamble);
void SetRxNoiseFigure (double noiseFigureDb);
void SetTxPowerStart (double start);
void SetTxPowerEnd (double end);
void SetNTxPower (uint32_t n);
void SetTxGain (double gain);
void SetRxGain (double gain);
void SetEdThreshold (double threshold);
void SetCcaMode1Threshold (double threshold);
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
void SetDevice (Ptr<Object> device);
void SetMobility (Ptr<Object> mobility);
double GetRxNoiseFigure (void) const;
double GetTxGain (void) const;
double GetRxGain (void) const;
double GetEdThreshold (void) const;
double GetCcaMode1Threshold (void) const;
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
Ptr<Object> GetDevice (void) const;
Ptr<Object> GetMobility (void);
virtual double GetTxPowerStart (void) const;
virtual double GetTxPowerEnd (void) const;
virtual uint32_t GetNTxPower (void) const;
virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
virtual void RegisterListener (WifiPhyListener *listener);
virtual bool IsStateCcaBusy (void);
virtual bool IsStateIdle (void);
virtual bool IsStateBusy (void);
virtual bool IsStateRx (void);
virtual bool IsStateTx (void);
virtual bool IsStateSwitching (void);
virtual Time GetStateDuration (void);
virtual Time GetDelayUntilIdle (void);
virtual Time GetLastRxStartTime (void) const;
virtual uint32_t GetNModes (void) const;
virtual WifiMode GetMode (uint32_t mode) const;
virtual double CalculateSnr (WifiMode txMode, double ber) const;
virtual Ptr<WifiChannel> GetChannel (void) const;
virtual void ConfigureStandard (enum WifiPhyStandard standard);
private:
YansWifiPhy (const YansWifiPhy &o);
virtual void DoDispose (void);
void Configure80211a (void);
void Configure80211b (void);
void Configure80211g (void);
void Configure80211_10Mhz (void);
void Configure80211_5Mhz ();
void ConfigureHolland (void);
void Configure80211p_CCH (void);
void Configure80211p_SCH (void);
double GetEdThresholdW (void) const;
double DbmToW (double dbm) const;
double DbToRatio (double db) const;
double WToDbm (double w) const;
double RatioToDb (double ratio) const;
double GetPowerDbm (uint8_t power) const;
void EndReceive (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
private:
double m_edThresholdW;
double m_ccaMode1ThresholdW;
double m_txGainDb;
double m_rxGainDb;
double m_txPowerBaseDbm;
double m_txPowerEndDbm;
uint32_t m_nTxPower;
Ptr<YansWifiChannel> m_channel;
uint16_t m_channelNumber;
Ptr<Object> m_device;
Ptr<Object> m_mobility;
/**
* This vector holds the set of transmission modes that this
* WifiPhy(-derived class) can support. In conversation we call this
* the DeviceRateSet (not a term you'll find in the standard), and
* it is a superset of standard-defined parameters such as the
* OperationalRateSet, and the BSSBasicRateSet (which, themselves,
* have a superset/subset relationship).
*
* Mandatory rates relevant to this WifiPhy can be found by
* iterating over this vector looking for WifiMode objects for which
* WifiMode::IsMandatory() is true.
*
* A quick note is appropriate here (well, here is as good a place
* as any I can find)...
*
* In the standard there is no text that explicitly precludes
* production of a device that does not support some rates that are
* mandatory (according to the standard) for PHYs that the device
* happens to fully or partially support.
*
* This approach is taken by some devices which choose to only support,
* for example, 6 and 9 Mbps ERP-OFDM rates for cost and power
* consumption reasons (i.e., these devices don't need to be designed
* for and waste current on the increased linearity requirement of
* higher-order constellations when 6 and 9 Mbps more than meet their
* data requirements). The wording of the standard allows such devices
* to have an OperationalRateSet which includes 6 and 9 Mbps ERP-OFDM
* rates, despite 12 and 24 Mbps being "mandatory" rates for the
* ERP-OFDM PHY.
*
* Now this doesn't actually have any impact on code, yet. It is,
* however, something that we need to keep in mind for the
* future. Basically, the key point is that we can't be making
* assumptions like "the Operational Rate Set will contain all the
* mandatory rates".
*/
WifiModeList m_deviceRateSet;
EventId m_endRxEvent;
UniformVariable m_random;
/// Standard-dependent center frequency of 0-th channel, MHz
double m_channelStartingFrequency;
Ptr<WifiPhyStateHelper> m_state;
InterferenceHelper m_interference;
Time m_channelSwitchDelay;
};
} // namespace ns3
#endif /* YANS_WIFI_PHY_H */
| zy901002-gpsr | src/wifi/model/yans-wifi-phy.h | C++ | gpl2 | 8,098 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2004,2005,2006 INRIA
*
* 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: Federico Maguolo <maguolof@dei.unipd.it>
*/
#include "aarfcd-wifi-manager.h"
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/boolean.h"
#include "ns3/double.h"
#include "ns3/uinteger.h"
#include <algorithm>
#define Min(a,b) ((a < b) ? a : b)
#define Max(a,b) ((a > b) ? a : b)
NS_LOG_COMPONENT_DEFINE ("Aarfcd");
namespace ns3 {
struct AarfcdWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
uint32_t m_success;
uint32_t m_failed;
bool m_recovery;
bool m_justModifyRate;
uint32_t m_retry;
uint32_t m_successThreshold;
uint32_t m_timerTimeout;
uint32_t m_rate;
bool m_rtsOn;
uint32_t m_rtsWnd;
uint32_t m_rtsCounter;
bool m_haveASuccess;
};
NS_OBJECT_ENSURE_REGISTERED (AarfcdWifiManager);
TypeId
AarfcdWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AarfcdWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<AarfcdWifiManager> ()
.AddAttribute ("SuccessK", "Multiplication factor for the success threshold in the AARF algorithm.",
DoubleValue (2.0),
MakeDoubleAccessor (&AarfcdWifiManager::m_successK),
MakeDoubleChecker<double> ())
.AddAttribute ("TimerK",
"Multiplication factor for the timer threshold in the AARF algorithm.",
DoubleValue (2.0),
MakeDoubleAccessor (&AarfcdWifiManager::m_timerK),
MakeDoubleChecker<double> ())
.AddAttribute ("MaxSuccessThreshold",
"Maximum value of the success threshold in the AARF algorithm.",
UintegerValue (60),
MakeUintegerAccessor (&AarfcdWifiManager::m_maxSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinTimerThreshold",
"The minimum value for the 'timer' threshold in the AARF algorithm.",
UintegerValue (15),
MakeUintegerAccessor (&AarfcdWifiManager::m_minTimerThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinSuccessThreshold",
"The minimum value for the success threshold in the AARF algorithm.",
UintegerValue (10),
MakeUintegerAccessor (&AarfcdWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinRtsWnd",
"Minimum value for Rts window of Aarf-CD",
UintegerValue (1),
MakeUintegerAccessor (&AarfcdWifiManager::m_minRtsWnd),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MaxRtsWnd",
"Maximum value for Rts window of Aarf-CD",
UintegerValue (40),
MakeUintegerAccessor (&AarfcdWifiManager::m_maxRtsWnd),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("TurnOffRtsAfterRateDecrease",
"If true the RTS mechanism will be turned off when the rate will be decreased",
BooleanValue (true),
MakeBooleanAccessor (&AarfcdWifiManager::m_turnOffRtsAfterRateDecrease),
MakeBooleanChecker ())
.AddAttribute ("TurnOnRtsAfterRateIncrease",
"If true the RTS mechanism will be turned on when the rate will be increased",
BooleanValue (true),
MakeBooleanAccessor (&AarfcdWifiManager::m_turnOnRtsAfterRateIncrease),
MakeBooleanChecker ())
;
return tid;
}
AarfcdWifiManager::AarfcdWifiManager ()
: WifiRemoteStationManager ()
{
}
AarfcdWifiManager::~AarfcdWifiManager ()
{
}
WifiRemoteStation *
AarfcdWifiManager::DoCreateStation (void) const
{
AarfcdWifiRemoteStation *station = new AarfcdWifiRemoteStation ();
// aarf fields below
station->m_successThreshold = m_minSuccessThreshold;
station->m_timerTimeout = m_minTimerThreshold;
station->m_rate = 0;
station->m_success = 0;
station->m_failed = 0;
station->m_recovery = false;
station->m_retry = 0;
station->m_timer = 0;
// aarf-cd specific fields below
station->m_rtsOn = false;
station->m_rtsWnd = m_minRtsWnd;
station->m_rtsCounter = 0;
station->m_justModifyRate = true;
station->m_haveASuccess = false;
return station;
}
void
AarfcdWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
}
/**
* It is important to realize that "recovery" mode starts after failure of
* the first transmission after a rate increase and ends at the first successful
* transmission. Specifically, recovery mode transcends retransmissions boundaries.
* Fundamentally, ARF handles each data transmission independently, whether it
* is the initial transmission of a packet or the retransmission of a packet.
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
*/
void
AarfcdWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *)st;
station->m_timer++;
station->m_failed++;
station->m_retry++;
station->m_success = 0;
if (!station->m_rtsOn)
{
TurnOnRts (station);
if (!station->m_justModifyRate && !station->m_haveASuccess)
{
IncreaseRtsWnd (station);
}
else
{
ResetRtsWnd (station);
}
station->m_rtsCounter = station->m_rtsWnd;
if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
else if (station->m_recovery)
{
NS_ASSERT (station->m_retry >= 1);
station->m_justModifyRate = false;
station->m_rtsCounter = station->m_rtsWnd;
if (station->m_retry == 1)
{
// need recovery fallback
if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
}
station->m_justModifyRate = true;
station->m_successThreshold = (int)(Min (station->m_successThreshold * m_successK,
m_maxSuccessThreshold));
station->m_timerTimeout = (int)(Max (station->m_timerTimeout * m_timerK,
m_minSuccessThreshold));
if (station->m_rate != 0)
{
station->m_rate--;
}
}
station->m_timer = 0;
}
else
{
NS_ASSERT (station->m_retry >= 1);
station->m_justModifyRate = false;
station->m_rtsCounter = station->m_rtsWnd;
if (((station->m_retry - 1) % 2) == 1)
{
// need normal fallback
if (m_turnOffRtsAfterRateDecrease)
{
TurnOffRts (station);
}
station->m_justModifyRate = true;
station->m_timerTimeout = m_minTimerThreshold;
station->m_successThreshold = m_minSuccessThreshold;
if (station->m_rate != 0)
{
station->m_rate--;
}
}
if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
CheckRts (station);
}
void
AarfcdWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
void
AarfcdWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
NS_LOG_DEBUG ("station=" << station << " rts ok");
station->m_rtsCounter--;
}
void
AarfcdWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
station->m_timer++;
station->m_success++;
station->m_failed = 0;
station->m_recovery = false;
station->m_retry = 0;
station->m_justModifyRate = false;
station->m_haveASuccess = true;
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
if ((station->m_success == station->m_successThreshold
|| station->m_timer == station->m_timerTimeout)
&& (station->m_rate < (GetNSupported (station) - 1)))
{
NS_LOG_DEBUG ("station=" << station << " inc rate");
station->m_rate++;
station->m_timer = 0;
station->m_success = 0;
station->m_recovery = true;
station->m_justModifyRate = true;
if (m_turnOnRtsAfterRateIncrease)
{
TurnOnRts (station);
ResetRtsWnd (station);
station->m_rtsCounter = station->m_rtsWnd;
}
}
CheckRts (station);
}
void
AarfcdWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
}
void
AarfcdWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
}
WifiMode
AarfcdWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
return GetSupported (station, station->m_rate);
}
WifiMode
AarfcdWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
// XXX: we could/should implement the Aarf algorithm for
// RTS only by picking a single rate within the BasicRateSet.
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
return GetSupported (station, 0);
}
bool
AarfcdWifiManager::DoNeedRts (WifiRemoteStation *st,
Ptr<const Packet> packet, bool normally)
{
AarfcdWifiRemoteStation *station = (AarfcdWifiRemoteStation *) st;
NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn ? "RTS" : "BASIC") <<
" rtsCounter=" << station->m_rtsCounter);
return station->m_rtsOn;
}
bool
AarfcdWifiManager::IsLowLatency (void) const
{
return true;
}
void
AarfcdWifiManager::CheckRts (AarfcdWifiRemoteStation *station)
{
if (station->m_rtsCounter == 0 && station->m_rtsOn)
{
TurnOffRts (station);
}
}
void
AarfcdWifiManager::TurnOffRts (AarfcdWifiRemoteStation *station)
{
station->m_rtsOn = false;
station->m_haveASuccess = false;
}
void
AarfcdWifiManager::TurnOnRts (AarfcdWifiRemoteStation *station)
{
station->m_rtsOn = true;
}
void
AarfcdWifiManager::IncreaseRtsWnd (AarfcdWifiRemoteStation *station)
{
if (station->m_rtsWnd == m_maxRtsWnd)
{
return;
}
station->m_rtsWnd *= 2;
if (station->m_rtsWnd > m_maxRtsWnd)
{
station->m_rtsWnd = m_maxRtsWnd;
}
}
void
AarfcdWifiManager::ResetRtsWnd (AarfcdWifiRemoteStation *station)
{
station->m_rtsWnd = m_minRtsWnd;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/aarfcd-wifi-manager.cc | C++ | gpl2 | 11,477 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef WIFI_MAC_TRAILER_H
#define WIFI_MAC_TRAILER_H
#include "ns3/trailer.h"
#include <stdint.h>
namespace ns3 {
/**
* The length in octects of the IEEE 802.11 MAC FCS field
*/
static const uint16_t WIFI_MAC_FCS_LENGTH = 4;
/**
* \ingroup wifi
*
* Implements the IEEE 802.11 MAC trailer
*/
class WifiMacTrailer : public Trailer
{
public:
WifiMacTrailer ();
~WifiMacTrailer ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
};
} // namespace ns3
#endif /* WIFI_MAC_TRAILER_H */
| zy901002-gpsr | src/wifi/model/wifi-mac-trailer.h | C++ | gpl2 | 1,561 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ideal-wifi-manager.h"
#include "wifi-phy.h"
#include "ns3/assert.h"
#include "ns3/double.h"
#include <math.h>
namespace ns3 {
struct IdealWifiRemoteStation : public WifiRemoteStation
{
double m_lastSnr;
};
NS_OBJECT_ENSURE_REGISTERED (IdealWifiManager);
TypeId
IdealWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::IdealWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<IdealWifiManager> ()
.AddAttribute ("BerThreshold",
"The maximum Bit Error Rate acceptable at any transmission mode",
DoubleValue (10e-6),
MakeDoubleAccessor (&IdealWifiManager::m_ber),
MakeDoubleChecker<double> ())
;
return tid;
}
IdealWifiManager::IdealWifiManager ()
{
}
IdealWifiManager::~IdealWifiManager ()
{
}
void
IdealWifiManager::SetupPhy (Ptr<WifiPhy> phy)
{
uint32_t nModes = phy->GetNModes ();
for (uint32_t i = 0; i < nModes; i++)
{
WifiMode mode = phy->GetMode (i);
AddModeSnrThreshold (mode, phy->CalculateSnr (mode, m_ber));
}
WifiRemoteStationManager::SetupPhy (phy);
}
double
IdealWifiManager::GetSnrThreshold (WifiMode mode) const
{
for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++)
{
if (mode == i->second)
{
return i->first;
}
}
NS_ASSERT (false);
return 0.0;
}
void
IdealWifiManager::AddModeSnrThreshold (WifiMode mode, double snr)
{
m_thresholds.push_back (std::make_pair (snr,mode));
}
WifiRemoteStation *
IdealWifiManager::DoCreateStation (void) const
{
IdealWifiRemoteStation *station = new IdealWifiRemoteStation ();
station->m_lastSnr = 0.0;
return station;
}
void
IdealWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
void
IdealWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
}
void
IdealWifiManager::DoReportDataFailed (WifiRemoteStation *station)
{
}
void
IdealWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = rtsSnr;
}
void
IdealWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
station->m_lastSnr = dataSnr;
}
void
IdealWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
}
void
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
}
WifiMode
IdealWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
// We search within the Supported rate set the mode with the
// highest snr threshold possible which is smaller than m_lastSnr
// to ensure correct packet delivery.
double maxThreshold = 0.0;
WifiMode maxMode = GetDefaultMode ();
for (uint32_t i = 0; i < GetNSupported (station); i++)
{
WifiMode mode = GetSupported (station, i);
double threshold = GetSnrThreshold (mode);
if (threshold > maxThreshold
&& threshold < station->m_lastSnr)
{
maxThreshold = threshold;
maxMode = mode;
}
}
return maxMode;
}
WifiMode
IdealWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
// We search within the Basic rate set the mode with the highest
// snr threshold possible which is smaller than m_lastSnr to
// ensure correct packet delivery.
double maxThreshold = 0.0;
WifiMode maxMode = GetDefaultMode ();
for (uint32_t i = 0; i < GetNBasicModes (); i++)
{
WifiMode mode = GetBasicMode (i);
double threshold = GetSnrThreshold (mode);
if (threshold > maxThreshold
&& threshold < station->m_lastSnr)
{
maxThreshold = threshold;
maxMode = mode;
}
}
return maxMode;
}
bool
IdealWifiManager::IsLowLatency (void) const
{
return true;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/ideal-wifi-manager.cc | C++ | gpl2 | 5,007 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef WIFI_MAC_HEADER_H
#define WIFI_MAC_HEADER_H
#include "ns3/header.h"
#include "ns3/mac48-address.h"
#include "ns3/nstime.h"
#include <stdint.h>
namespace ns3 {
enum WifiMacType
{
WIFI_MAC_CTL_RTS = 0,
WIFI_MAC_CTL_CTS,
WIFI_MAC_CTL_ACK,
WIFI_MAC_CTL_BACKREQ,
WIFI_MAC_CTL_BACKRESP,
WIFI_MAC_MGT_BEACON,
WIFI_MAC_MGT_ASSOCIATION_REQUEST,
WIFI_MAC_MGT_ASSOCIATION_RESPONSE,
WIFI_MAC_MGT_DISASSOCIATION,
WIFI_MAC_MGT_REASSOCIATION_REQUEST,
WIFI_MAC_MGT_REASSOCIATION_RESPONSE,
WIFI_MAC_MGT_PROBE_REQUEST,
WIFI_MAC_MGT_PROBE_RESPONSE,
WIFI_MAC_MGT_AUTHENTICATION,
WIFI_MAC_MGT_DEAUTHENTICATION,
WIFI_MAC_MGT_ACTION,
WIFI_MAC_MGT_ACTION_NO_ACK,
WIFI_MAC_MGT_MULTIHOP_ACTION,
WIFI_MAC_DATA,
WIFI_MAC_DATA_CFACK,
WIFI_MAC_DATA_CFPOLL,
WIFI_MAC_DATA_CFACK_CFPOLL,
WIFI_MAC_DATA_NULL,
WIFI_MAC_DATA_NULL_CFACK,
WIFI_MAC_DATA_NULL_CFPOLL,
WIFI_MAC_DATA_NULL_CFACK_CFPOLL,
WIFI_MAC_QOSDATA,
WIFI_MAC_QOSDATA_CFACK,
WIFI_MAC_QOSDATA_CFPOLL,
WIFI_MAC_QOSDATA_CFACK_CFPOLL,
WIFI_MAC_QOSDATA_NULL,
WIFI_MAC_QOSDATA_NULL_CFPOLL,
WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL,
};
/**
* \ingroup wifi
*
* Implements the IEEE 802.11 MAC header
*/
class WifiMacHeader : public Header
{
public:
enum QosAckPolicy
{
NORMAL_ACK = 0,
NO_ACK = 1,
NO_EXPLICIT_ACK = 2,
BLOCK_ACK = 3,
};
enum AddressType
{
ADDR1,
ADDR2,
ADDR3,
ADDR4
};
WifiMacHeader ();
~WifiMacHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
void SetAssocReq (void);
void SetAssocResp (void);
void SetProbeReq (void);
void SetProbeResp (void);
void SetBeacon (void);
void SetTypeData (void);
void SetAction ();
void SetBlockAckReq (void);
void SetBlockAck (void);
void SetMultihopAction ();
void SetDsFrom (void);
void SetDsNotFrom (void);
void SetDsTo (void);
void SetDsNotTo (void);
void SetAddr1 (Mac48Address address);
void SetAddr2 (Mac48Address address);
void SetAddr3 (Mac48Address address);
void SetAddr4 (Mac48Address address);
void SetType (enum WifiMacType type);
void SetRawDuration (uint16_t duration);
void SetDuration (Time duration);
void SetId (uint16_t id);
void SetSequenceNumber (uint16_t seq);
void SetFragmentNumber (uint8_t frag);
void SetNoMoreFragments (void);
void SetMoreFragments (void);
void SetRetry (void);
void SetNoRetry (void);
void SetQosTid (uint8_t tid);
void SetQosEosp ();
void SetQosNoEosp ();
void SetQosAckPolicy (enum QosAckPolicy);
void SetQosNormalAck (void);
void SetQosBlockAck (void);
void SetQosNoAck (void);
void SetQosAmsdu (void);
void SetQosNoAmsdu (void);
void SetQosTxopLimit (uint8_t txop);
Mac48Address GetAddr1 (void) const;
Mac48Address GetAddr2 (void) const;
Mac48Address GetAddr3 (void) const;
Mac48Address GetAddr4 (void) const;
enum WifiMacType GetType (void) const;
bool IsFromDs (void) const;
bool IsToDs (void) const;
bool IsData (void) const;
bool IsQosData (void) const;
bool IsCtl (void) const;
bool IsMgt (void) const;
bool IsCfpoll (void) const;
bool IsRts (void) const;
bool IsCts (void) const;
bool IsAck (void) const;
bool IsBlockAckReq (void) const;
bool IsBlockAck (void) const;
bool IsAssocReq (void) const;
bool IsAssocResp (void) const;
bool IsReassocReq (void) const;
bool IsReassocResp (void) const;
bool IsProbeReq (void) const;
bool IsProbeResp (void) const;
bool IsBeacon (void) const;
bool IsDisassociation (void) const;
bool IsAuthentication (void) const;
bool IsDeauthentication (void) const;
bool IsAction () const;
bool IsMultihopAction () const;
uint16_t GetRawDuration (void) const;
Time GetDuration (void) const;
uint16_t GetSequenceControl (void) const;
uint16_t GetSequenceNumber (void) const;
uint16_t GetFragmentNumber (void) const;
bool IsRetry (void) const;
bool IsMoreFragments (void) const;
bool IsQosBlockAck (void) const;
bool IsQosNoAck (void) const;
bool IsQosAck (void) const;
bool IsQosEosp (void) const;
bool IsQosAmsdu (void) const;
uint8_t GetQosTid (void) const;
enum QosAckPolicy GetQosAckPolicy (void) const;
uint8_t GetQosTxopLimit (void) const;
uint32_t GetSize (void) const;
const char * GetTypeString (void) const;
private:
uint16_t GetFrameControl (void) const;
uint16_t GetQosControl (void) const;
void SetFrameControl (uint16_t control);
void SetSequenceControl (uint16_t seq);
void SetQosControl (uint16_t qos);
void PrintFrameControl (std::ostream &os) const;
uint8_t m_ctrlType;
uint8_t m_ctrlSubtype;
uint8_t m_ctrlToDs;
uint8_t m_ctrlFromDs;
uint8_t m_ctrlMoreFrag;
uint8_t m_ctrlRetry;
uint8_t m_ctrlPwrMgt;
uint8_t m_ctrlMoreData;
uint8_t m_ctrlWep;
uint8_t m_ctrlOrder;
uint16_t m_duration;
Mac48Address m_addr1;
Mac48Address m_addr2;
Mac48Address m_addr3;
uint8_t m_seqFrag;
uint16_t m_seqSeq;
Mac48Address m_addr4;
uint8_t m_qosTid;
uint8_t m_qosEosp;
uint8_t m_qosAckPolicy;
uint8_t m_amsduPresent;
uint16_t m_qosStuff;
};
} // namespace ns3
#endif /* WIFI_MAC_HEADER_H */
| zy901002-gpsr | src/wifi/model/wifi-mac-header.h | C++ | gpl2 | 6,263 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 Duy Nguyen
*
* 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: Duy Nguyen <duy@soe.ucsc.edu>
*
* Some Comments:
*
* 1) Segment Size is declared for completeness but not used because it has
* to do more with the requirement of the specific hardware.
*
* 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel
* algorithm). Otherwise, please use ConstantRateWifiManager instead.
*
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
*/
#include "minstrel-wifi-manager.h"
#include "wifi-phy.h"
#include "ns3/random-variable.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/uinteger.h"
#include "ns3/double.h"
#include "ns3/wifi-mac.h"
#include "ns3/assert.h"
#include <vector>
NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager");
namespace ns3 {
struct MinstrelWifiRemoteStation : public WifiRemoteStation
{
Time m_nextStatsUpdate; ///< 10 times every second
/**
* To keep track of the current position in the our random sample table
* going row by row from 1st column until the 10th column(Minstrel defines 10)
* then we wrap back to the row 1 col 1.
* note: there are many other ways to do this.
*/
uint32_t m_col, m_index;
uint32_t m_maxTpRate; ///< the current throughput rate
uint32_t m_maxTpRate2; ///< second highest throughput rate
uint32_t m_maxProbRate; ///< rate with highest prob of success
int m_packetCount; ///< total number of packets as of now
int m_sampleCount; ///< how many packets we have sample so far
bool m_isSampling; ///< a flag to indicate we are currently sampling
uint32_t m_sampleRate; ///< current sample rate
bool m_sampleRateSlower; ///< a flag to indicate sample rate is slower
uint32_t m_currentRate; ///< current rate we are using
uint32_t m_shortRetry; ///< short retries such as control packts
uint32_t m_longRetry; ///< long retries such as data packets
uint32_t m_retry; ///< total retries short + long
uint32_t m_err; ///< retry errors
uint32_t m_txrate; ///< current transmit rate
bool m_initialized; ///< for initializing tables
};
NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager);
TypeId
MinstrelWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MinstrelWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<MinstrelWifiManager> ()
.AddAttribute ("UpdateStatistics",
"The interval between updating statistics table ",
TimeValue (Seconds (0.1)),
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats),
MakeTimeChecker ())
.AddAttribute ("LookAroundRate",
"the percentage to try other rates",
DoubleValue (10),
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate),
MakeDoubleChecker<double> ())
.AddAttribute ("EWMA",
"EWMA level",
DoubleValue (75),
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel),
MakeDoubleChecker<double> ())
.AddAttribute ("SegmentSize",
"The largest allowable segment size packet",
DoubleValue (6000),
MakeDoubleAccessor (&MinstrelWifiManager::m_segmentSize),
MakeDoubleChecker <double> ())
.AddAttribute ("SampleColumn",
"The number of columns used for sampling",
DoubleValue (10),
MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol),
MakeDoubleChecker <double> ())
.AddAttribute ("PacketLength",
"The packet length used for calculating mode TxTime",
DoubleValue (1200),
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen),
MakeDoubleChecker <double> ())
;
return tid;
}
MinstrelWifiManager::MinstrelWifiManager ()
{
m_nsupported = 0;
}
MinstrelWifiManager::~MinstrelWifiManager ()
{
}
void
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy)
{
uint32_t nModes = phy->GetNModes ();
for (uint32_t i = 0; i < nModes; i++)
{
WifiMode mode = phy->GetMode (i);
AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, mode, WIFI_PREAMBLE_LONG));
}
WifiRemoteStationManager::SetupPhy (phy);
}
Time
MinstrelWifiManager::GetCalcTxTime (WifiMode mode) const
{
for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++)
{
if (mode == i->second)
{
return i->first;
}
}
NS_ASSERT (false);
return Seconds (0);
}
void
MinstrelWifiManager::AddCalcTxTime (WifiMode mode, Time t)
{
m_calcTxTime.push_back (std::make_pair (t, mode));
}
WifiRemoteStation *
MinstrelWifiManager::DoCreateStation (void) const
{
MinstrelWifiRemoteStation *station = new MinstrelWifiRemoteStation ();
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
station->m_col = 0;
station->m_index = 0;
station->m_maxTpRate = 0;
station->m_maxTpRate2 = 0;
station->m_maxProbRate = 0;
station->m_packetCount = 0;
station->m_sampleCount = 0;
station->m_isSampling = false;
station->m_sampleRate = 0;
station->m_sampleRateSlower = false;
station->m_currentRate = 0;
station->m_shortRetry = 0;
station->m_longRetry = 0;
station->m_retry = 0;
station->m_err = 0;
station->m_txrate = 0;
station->m_initialized = false;
return station;
}
void
MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station)
{
if (!station->m_initialized && GetNSupported (station) > 1)
{
// Note: we appear to be doing late initialization of the table
// to make sure that the set of supported rates has been initialized
// before we perform our own initialization.
m_nsupported = GetNSupported (station);
m_minstrelTable = MinstrelRate (m_nsupported);
m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
InitSampleTable (station);
RateInit (station);
station->m_initialized = true;
}
}
void
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st,
double rxSnr, WifiMode txMode)
{
NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
}
void
MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
station->m_shortRetry++;
}
void
MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_DEBUG ("self=" << st << " rts ok");
}
void
MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
UpdateRetry (station);
station->m_err++;
}
void
MinstrelWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
/**
*
* Retry Chain table is implemented here
*
* Try | LOOKAROUND RATE | NORMAL RATE
* | random < best | random > best |
* --------------------------------------------------------------
* 1 | Best throughput | Random rate | Best throughput
* 2 | Random rate | Best throughput | Next best throughput
* 3 | Best probability | Best probability | Best probability
* 4 | Lowest Baserate | Lowest baserate | Lowest baserate
*
* Note: For clarity, multiple blocks of if's and else's are used
* After a failing 7 times, DoReportFinalDataFailed will be called
*/
CheckInit (station);
if (!station->m_initialized)
{
return;
}
station->m_longRetry++;
NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
/// for normal rate, we're not currently sampling random rates
if (!station->m_isSampling)
{
/// use best throughput rate
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
{
; ///< there's still a few retries left
}
/// use second best throughput rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxTpRate2;
}
/// use best probability rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxProbRate;
}
/// use lowest base rate
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = 0;
}
}
/// for look-around rate, we're currently sampling random rates
else
{
/// current sampling rate is slower than the current best rate
if (station->m_sampleRateSlower)
{
/// use best throughput rate
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
{
; ///< there are a few retries left
}
/// use random rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = station->m_sampleRate;
}
/// use max probability rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount ))
{
station->m_txrate = station->m_maxProbRate;
}
/// use lowest base rate
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
{
station->m_txrate = 0;
}
}
/// current sampling rate is better than current best rate
else
{
/// use random rate
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
{
; ///< keep using it
}
/// use the best rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxTpRate;
}
/// use the best probability rate
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
{
station->m_txrate = station->m_maxProbRate;
}
/// use the lowest base rate
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
{
station->m_txrate = 0;
}
}
}
}
void
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
station->m_isSampling = false;
station->m_sampleRateSlower = false;
CheckInit (station);
if (!station->m_initialized)
{
return;
}
m_minstrelTable[station->m_txrate].numRateSuccess++;
m_minstrelTable[station->m_txrate].numRateAttempt++;
UpdateRetry (station);
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
station->m_packetCount++;
if (m_nsupported >= 1)
{
station->m_txrate = FindRate (station);
}
}
void
MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << station->m_txrate);
station->m_isSampling = false;
station->m_sampleRateSlower = false;
UpdateRetry (station);
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
station->m_err++;
if (m_nsupported >= 1)
{
station->m_txrate = FindRate (station);
}
}
void
MinstrelWifiManager::UpdateRetry (MinstrelWifiRemoteStation *station)
{
station->m_retry = station->m_shortRetry + station->m_longRetry;
station->m_shortRetry = 0;
station->m_longRetry = 0;
}
WifiMode
MinstrelWifiManager::DoGetDataMode (WifiRemoteStation *st,
uint32_t size)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
if (!station->m_initialized)
{
CheckInit (station);
/// start the rate at half way
station->m_txrate = m_nsupported / 2;
}
UpdateStats (station);
return GetSupported (station, station->m_txrate);
}
WifiMode
MinstrelWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
return GetSupported (station, 0);
}
bool
MinstrelWifiManager::IsLowLatency (void) const
{
return true;
}
uint32_t
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
{
uint32_t bitrate;
bitrate = m_sampleTable[station->m_index][station->m_col];
station->m_index++;
/// bookeeping for m_index and m_col variables
if (station->m_index > (m_nsupported - 2))
{
station->m_index = 0;
station->m_col++;
if (station->m_col >= m_sampleCol)
{
station->m_col = 0;
}
}
return bitrate;
}
uint32_t
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
{
NS_LOG_DEBUG ("FindRate " << "packet=" << station->m_packetCount );
if ((station->m_sampleCount + station->m_packetCount) == 0)
{
return 0;
}
uint32_t idx;
/// for determining when to try a sample rate
UniformVariable coinFlip (0, 100);
/**
* if we are below the target of look around rate percentage, look around
* note: do it randomly by flipping a coin instead sampling
* all at once until it reaches the look around rate
*/
if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate)
&& ((int)coinFlip.GetValue ()) % 2 == 1 )
{
/// now go through the table and find an index rate
idx = GetNextSample (station);
/**
* This if condition is used to make sure that we don't need to use
* the sample rate it is the same as our current rate
*/
if (idx != station->m_maxTpRate && idx != station->m_txrate)
{
/// start sample count
station->m_sampleCount++;
/// set flag that we are currently sampling
station->m_isSampling = true;
/// bookeeping for resetting stuff
if (station->m_packetCount >= 10000)
{
station->m_sampleCount = 0;
station->m_packetCount = 0;
}
/// error check
if (idx >= m_nsupported)
{
NS_LOG_DEBUG ("ALERT!!! ERROR");
}
/// set the rate that we're currently sampling
station->m_sampleRate = idx;
if (station->m_sampleRate == station->m_maxTpRate)
{
station->m_sampleRate = station->m_maxTpRate2;
}
/// is this rate slower than the current best rate
station->m_sampleRateSlower =
(m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime);
/// using the best rate instead
if (station->m_sampleRateSlower)
{
idx = station->m_maxTpRate;
}
}
}
/// continue using the best rate
else
{
idx = station->m_maxTpRate;
}
NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx);
return idx;
}
void
MinstrelWifiManager::UpdateStats (MinstrelWifiRemoteStation *station)
{
if (Simulator::Now () < station->m_nextStatsUpdate)
{
return;
}
if (!station->m_initialized)
{
return;
}
NS_LOG_DEBUG ("Updating stats=" << this);
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
Time txTime;
uint32_t tempProb;
for (uint32_t i = 0; i < m_nsupported; i++)
{
/// calculate the perfect tx time for this rate
txTime = m_minstrelTable[i].perfectTxTime;
/// just for initialization
if (txTime.GetMicroSeconds () == 0)
{
txTime = Seconds (1);
}
NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
"\t attempt=" << m_minstrelTable[i].numRateAttempt <<
"\t success=" << m_minstrelTable[i].numRateSuccess);
/// if we've attempted something
if (m_minstrelTable[i].numRateAttempt)
{
/**
* calculate the probability of success
* assume probability scales from 0 to 18000
*/
tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt;
/// bookeeping
m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess;
m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt;
m_minstrelTable[i].prob = tempProb;
/// ewma probability (cast for gcc 3.4 compatibility)
tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
m_minstrelTable[i].ewmaProb = tempProb;
/// calculating throughput
m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
}
/// bookeeping
m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt;
m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess;
m_minstrelTable[i].numRateSuccess = 0;
m_minstrelTable[i].numRateAttempt = 0;
/// Sample less often below 10% and above 95% of success
if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
{
/**
* retry count denotes the number of retries permitted for each rate
* # retry_count/2
*/
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1;
if (m_minstrelTable[i].adjustedRetryCount > 2)
{
m_minstrelTable[i].adjustedRetryCount = 2;
}
}
else
{
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount;
}
/// if it's 0 allow one retry limit
if (m_minstrelTable[i].adjustedRetryCount == 0)
{
m_minstrelTable[i].adjustedRetryCount = 1;
}
}
uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
/// go find max throughput, second maximum throughput, high probability succ
for (uint32_t i = 0; i < m_nsupported; i++)
{
NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
"\n ewma" << m_minstrelTable[i].ewmaProb);
if (max_tp < m_minstrelTable[i].throughput)
{
index_max_tp = i;
max_tp = m_minstrelTable[i].throughput;
}
if (max_prob < m_minstrelTable[i].ewmaProb)
{
index_max_prob = i;
max_prob = m_minstrelTable[i].ewmaProb;
}
}
max_tp = 0;
/// find the second highest max
for (uint32_t i = 0; i < m_nsupported; i++)
{
if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput))
{
index_max_tp2 = i;
max_tp = m_minstrelTable[i].throughput;
}
}
station->m_maxTpRate = index_max_tp;
station->m_maxTpRate2 = index_max_tp2;
station->m_maxProbRate = index_max_prob;
station->m_currentRate = index_max_tp;
if (index_max_tp > station->m_txrate)
{
station->m_txrate = index_max_tp;
}
NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob);
/// reset it
RateInit (station);
}
void
MinstrelWifiManager::RateInit (MinstrelWifiRemoteStation *station)
{
NS_LOG_DEBUG ("RateInit=" << station);
for (uint32_t i = 0; i < m_nsupported; i++)
{
m_minstrelTable[i].numRateAttempt = 0;
m_minstrelTable[i].numRateSuccess = 0;
m_minstrelTable[i].prob = 0;
m_minstrelTable[i].ewmaProb = 0;
m_minstrelTable[i].prevNumRateAttempt = 0;
m_minstrelTable[i].prevNumRateSuccess = 0;
m_minstrelTable[i].successHist = 0;
m_minstrelTable[i].attemptHist = 0;
m_minstrelTable[i].throughput = 0;
m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i));
m_minstrelTable[i].retryCount = 1;
m_minstrelTable[i].adjustedRetryCount = 1;
}
}
void
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station)
{
NS_LOG_DEBUG ("InitSampleTable=" << this);
station->m_col = station->m_index = 0;
/// for off-seting to make rates fall between 0 and numrates
uint32_t numSampleRates = m_nsupported;
uint32_t newIndex;
for (uint32_t col = 0; col < m_sampleCol; col++)
{
for (uint32_t i = 0; i < numSampleRates; i++ )
{
/**
* The next two lines basically tries to generate a random number
* between 0 and the number of available rates
*/
UniformVariable uv (0, numSampleRates);
newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates;
/// this loop is used for filling in other uninitilized places
while (m_sampleTable[newIndex][col] != 0)
{
newIndex = (newIndex + 1) % m_nsupported;
}
m_sampleTable[newIndex][col] = i;
}
}
}
void
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station)
{
NS_LOG_DEBUG ("PrintSampleTable=" << station);
uint32_t numSampleRates = m_nsupported;
for (uint32_t i = 0; i < numSampleRates; i++)
{
for (uint32_t j = 0; j < m_sampleCol; j++)
{
std::cout << m_sampleTable[i][j] << "\t";
}
std::cout << std::endl;
}
}
void
MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station)
{
NS_LOG_DEBUG ("PrintTable=" << station);
for (uint32_t i = 0; i < m_nsupported; i++)
{
std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n";
}
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/minstrel-wifi-manager.cc | C++ | gpl2 | 24,760 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2003,2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "onoe-wifi-manager.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/uinteger.h"
NS_LOG_COMPONENT_DEFINE ("OnoeWifiRemoteStation");
namespace ns3 {
struct OnoeWifiRemoteStation : public WifiRemoteStation
{
Time m_nextModeUpdate;
uint32_t m_shortRetry;
uint32_t m_longRetry;
uint32_t m_tx_ok;
uint32_t m_tx_err;
uint32_t m_tx_retr;
uint32_t m_tx_upper;
uint32_t m_txrate;
};
NS_OBJECT_ENSURE_REGISTERED (OnoeWifiManager);
TypeId
OnoeWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::OnoeWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<OnoeWifiManager> ()
.AddAttribute ("UpdatePeriod",
"The interval between decisions about rate control changes",
TimeValue (Seconds (1.0)),
MakeTimeAccessor (&OnoeWifiManager::m_updatePeriod),
MakeTimeChecker ())
.AddAttribute ("RaiseThreshold", "Attempt to raise the rate if we hit that threshold",
UintegerValue (10),
MakeUintegerAccessor (&OnoeWifiManager::m_raiseThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("AddCreditThreshold", "Add credit threshold",
UintegerValue (10),
MakeUintegerAccessor (&OnoeWifiManager::m_addCreditThreshold),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
OnoeWifiManager::OnoeWifiManager ()
{
}
WifiRemoteStation *
OnoeWifiManager::DoCreateStation (void) const
{
OnoeWifiRemoteStation *station = new OnoeWifiRemoteStation ();
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
station->m_shortRetry = 0;
station->m_longRetry = 0;
station->m_tx_ok = 0;
station->m_tx_err = 0;
station->m_tx_retr = 0;
station->m_tx_upper = 0;
station->m_txrate = 0;
return station;
}
void
OnoeWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
void
OnoeWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_shortRetry++;
}
void
OnoeWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
station->m_longRetry++;
}
void
OnoeWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
void
OnoeWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateRetry (station);
station->m_tx_ok++;
}
void
OnoeWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateRetry (station);
station->m_tx_err++;
}
void
OnoeWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateRetry (station);
station->m_tx_err++;
}
void
OnoeWifiManager::UpdateRetry (OnoeWifiRemoteStation *station)
{
station->m_tx_retr += station->m_shortRetry + station->m_longRetry;
station->m_shortRetry = 0;
station->m_longRetry = 0;
}
void
OnoeWifiManager::UpdateMode (OnoeWifiRemoteStation *station)
{
if (Simulator::Now () < station->m_nextModeUpdate)
{
return;
}
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
/**
* The following 20 lines of code were copied from the Onoe
* rate control kernel module used in the madwifi driver.
*/
int dir = 0, enough;
uint32_t nrate;
enough = (station->m_tx_ok + station->m_tx_err >= 10);
/* no packet reached -> down */
if (station->m_tx_err > 0 && station->m_tx_ok == 0)
{
dir = -1;
}
/* all packets needs retry in average -> down */
if (enough && station->m_tx_ok < station->m_tx_retr)
{
dir = -1;
}
/* no error and less than rate_raise% of packets need retry -> up */
if (enough && station->m_tx_err == 0
&& station->m_tx_retr < (station->m_tx_ok * m_addCreditThreshold) / 100)
{
dir = 1;
}
NS_LOG_DEBUG (this << " ok " << station->m_tx_ok << " err " << station->m_tx_err << " retr " << station->m_tx_retr <<
" upper " << station->m_tx_upper << " dir " << dir);
nrate = station->m_txrate;
switch (dir)
{
case 0:
if (enough && station->m_tx_upper > 0)
{
station->m_tx_upper--;
}
break;
case -1:
if (nrate > 0)
{
nrate--;
}
station->m_tx_upper = 0;
break;
case 1:
/* raise rate if we hit rate_raise_threshold */
if (++station->m_tx_upper < m_raiseThreshold)
{
break;
}
station->m_tx_upper = 0;
if (nrate + 1 < GetNSupported (station))
{
nrate++;
}
break;
}
if (nrate != station->m_txrate)
{
NS_ASSERT (nrate < GetNSupported (station));
station->m_txrate = nrate;
station->m_tx_ok = station->m_tx_err = station->m_tx_retr = station->m_tx_upper = 0;
}
else if (enough)
{
station->m_tx_ok = station->m_tx_err = station->m_tx_retr = 0;
}
}
WifiMode
OnoeWifiManager::DoGetDataMode (WifiRemoteStation *st,
uint32_t size)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateMode (station);
NS_ASSERT (station->m_txrate < GetNSupported (station));
uint32_t rateIndex;
if (station->m_longRetry < 4)
{
rateIndex = station->m_txrate;
}
else if (station->m_longRetry < 6)
{
if (station->m_txrate > 0)
{
rateIndex = station->m_txrate - 1;
}
else
{
rateIndex = station->m_txrate;
}
}
else if (station->m_longRetry < 8)
{
if (station->m_txrate > 1)
{
rateIndex = station->m_txrate - 2;
}
else
{
rateIndex = station->m_txrate;
}
}
else
{
if (station->m_txrate > 2)
{
rateIndex = station->m_txrate - 3;
}
else
{
rateIndex = station->m_txrate;
}
}
return GetSupported (station, rateIndex);
}
WifiMode
OnoeWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
UpdateMode (station);
// XXX: can we implement something smarter ?
return GetSupported (station, 0);
}
bool
OnoeWifiManager::IsLowLatency (void) const
{
return false;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/onoe-wifi-manager.cc | C++ | gpl2 | 7,504 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef SSID_H
#define SSID_H
#include <stdint.h>
#include "ns3/buffer.h"
#include "ns3/attribute-helper.h"
#include "ns3/wifi-information-element.h"
namespace ns3 {
/**
* \ingroup wifi
*
* The IEEE 802.11 SSID Information Element
*/
class Ssid : public WifiInformationElement
{
public:
// broadcast ssid
Ssid ();
Ssid (std::string s);
Ssid (char const ssid[32], uint8_t length);
bool IsEqual (const Ssid& o) const;
bool IsBroadcast (void) const;
char* PeekString (void) const;
WifiInformationElementId ElementId () const;
uint8_t GetInformationFieldSize () const;
void SerializeInformationField (Buffer::Iterator start) const;
uint8_t DeserializeInformationField (Buffer::Iterator start,
uint8_t length);
private:
uint8_t m_ssid[33];
uint8_t m_length;
};
std::ostream &operator << (std::ostream &os, const Ssid &ssid);
std::istream &operator >> (std::istream &is, Ssid &ssid);
/**
* \class ns3::SsidValue
* \brief hold objects of type ns3::Ssid
*/
ATTRIBUTE_HELPER_HEADER (Ssid);
} // namespace ns3
#endif /* SSID_H */
| zy901002-gpsr | src/wifi/model/ssid.h | C++ | gpl2 | 1,918 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef DCA_TXOP_H
#define DCA_TXOP_H
#include <stdint.h>
#include "ns3/callback.h"
#include "ns3/packet.h"
#include "ns3/nstime.h"
#include "ns3/object.h"
#include "ns3/wifi-mac-header.h"
#include "ns3/wifi-mode.h"
#include "ns3/wifi-remote-station-manager.h"
#include "ns3/dcf.h"
namespace ns3 {
class DcfState;
class DcfManager;
class WifiMacQueue;
class MacLow;
class WifiMacParameters;
class MacTxMiddle;
class RandomStream;
class MacStation;
class MacStations;
/**
* \brief handle packet fragmentation and retransmissions.
* \ingroup wifi
*
* This class implements the packet fragmentation and
* retransmission policy. It uses the ns3::MacLow and ns3::DcfManager
* helper classes to respectively send packets and decide when
* to send them. Packets are stored in a ns3::WifiMacQueue until
* they can be sent.
*
* The policy currently implemented uses a simple fragmentation
* threshold: any packet bigger than this threshold is fragmented
* in fragments whose size is smaller than the threshold.
*
* The retransmission policy is also very simple: every packet is
* retransmitted until it is either successfully transmitted or
* it has been retransmitted up until the ssrc or slrc thresholds.
*
* The rts/cts policy is similar to the fragmentation policy: when
* a packet is bigger than a threshold, the rts/cts protocol is used.
*/
class DcaTxop : public Dcf
{
public:
static TypeId GetTypeId (void);
typedef Callback <void, const WifiMacHeader&> TxOk;
typedef Callback <void, const WifiMacHeader&> TxFailed;
DcaTxop ();
~DcaTxop ();
void SetLow (Ptr<MacLow> low);
void SetManager (DcfManager *manager);
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager);
/**
* \param callback the callback to invoke when a
* packet transmission was completed successfully.
*/
void SetTxOkCallback (TxOk callback);
/**
* \param callback the callback to invoke when a
* packet transmission was completed unsuccessfully.
*/
void SetTxFailedCallback (TxFailed callback);
Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
virtual uint32_t GetMinCw (void) const;
virtual uint32_t GetMaxCw (void) const;
virtual uint32_t GetAifsn (void) const;
/**
* \param packet packet to send
* \param hdr header of packet to send.
*
* Store the packet in the internal queue until it
* can be sent safely.
*/
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
private:
class TransmissionListener;
class NavListener;
class PhyListener;
class Dcf;
friend class Dcf;
friend class TransmissionListener;
DcaTxop &operator = (const DcaTxop &);
DcaTxop (const DcaTxop &o);
// Inherited from ns3::Object
Ptr<MacLow> Low (void);
void DoStart ();
/* dcf notifications forwarded here */
bool NeedsAccess (void) const;
void NotifyAccessGranted (void);
void NotifyInternalCollision (void);
void NotifyCollision (void);
/**
* When a channel switching occurs, enqueued packets are removed.
*/
void NotifyChannelSwitching (void);
/* event handlers */
void GotCts (double snr, WifiMode txMode);
void MissedCts (void);
void GotAck (double snr, WifiMode txMode);
void MissedAck (void);
void StartNext (void);
void Cancel (void);
void RestartAccessIfNeeded (void);
void StartAccessIfNeeded (void);
bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
bool NeedRtsRetransmission (void);
bool NeedDataRetransmission (void);
bool NeedFragmentation (void);
uint32_t GetNextFragmentSize (void);
uint32_t GetFragmentSize (void);
uint32_t GetFragmentOffset (void);
bool IsLastFragment (void);
void NextFragment (void);
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
virtual void DoDispose (void);
Dcf *m_dcf;
DcfManager *m_manager;
TxOk m_txOkCallback;
TxFailed m_txFailedCallback;
Ptr<WifiMacQueue> m_queue;
MacTxMiddle *m_txMiddle;
Ptr <MacLow> m_low;
Ptr<WifiRemoteStationManager> m_stationManager;
TransmissionListener *m_transmissionListener;
RandomStream *m_rng;
bool m_accessOngoing;
Ptr<const Packet> m_currentPacket;
WifiMacHeader m_currentHdr;
uint8_t m_fragmentNumber;
};
} // namespace ns3
#endif /* DCA_TXOP_H */
| zy901002-gpsr | src/wifi/model/dca-txop.h | C++ | gpl2 | 5,183 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 Duy Nguyen
*
* 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: Duy Nguyen <duy@soe.ucsc.edu>
*/
#ifndef MINSTREL_WIFI_MANAGER_H
#define MINSTREL_WIFI_MANAGER_H
#include "wifi-remote-station-manager.h"
#include "wifi-mode.h"
#include "ns3/nstime.h"
#include <vector>
namespace ns3 {
struct MinstrelWifiRemoteStation;
/**
* A struct to contain all information related to a data rate
*/
struct RateInfo
{
/**
* Perfect transmission time calculation, or frame calculation
* Given a bit rate and a packet length n bytes
*/
Time perfectTxTime;
uint32_t retryCount; ///< retry limit
uint32_t adjustedRetryCount; ///< adjust the retry limit for this rate
uint32_t numRateAttempt; ///< how many number of attempts so far
uint32_t numRateSuccess; ///< number of successful pkts
uint32_t prob; ///< (# pkts success )/(# total pkts)
/**
* EWMA calculation
* ewma_prob =[prob *(100 - ewma_level) + (ewma_prob_old * ewma_level)]/100
*/
uint32_t ewmaProb;
uint32_t prevNumRateAttempt; ///< from last rate
uint32_t prevNumRateSuccess; ///< from last rate
uint64_t successHist; ///< aggregate of all successes
uint64_t attemptHist; ///< aggregate of all attempts
uint32_t throughput; ///< throughput of a rate
};
/**
* Data structure for a Minstrel Rate table
* A vector of a struct RateInfo
*/
typedef std::vector<struct RateInfo> MinstrelRate;
/**
* Data structure for a Sample Rate table
* A vector of a vector uint32_t
*/
typedef std::vector<std::vector<uint32_t> > SampleRate;
/**
* \author Duy Nguyen
* \brief Implementation of Minstrel Rate Control Algorithm
* \ingroup wifi
*
* Porting Minstrel from Madwifi and Linux Kernel
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
*/
class MinstrelWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
MinstrelWifiManager ();
virtual ~MinstrelWifiManager ();
virtual void SetupPhy (Ptr<WifiPhy> phy);
private:
// overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
virtual void DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr);
virtual void DoReportDataOk (WifiRemoteStation *station,
double ackSnr, WifiMode ackMode, double dataSnr);
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
virtual bool IsLowLatency (void) const;
/// for estimating the TxTime of a packet with a given mode
Time GetCalcTxTime (WifiMode mode) const;
void AddCalcTxTime (WifiMode mode, Time t);
/// update the number of retries and reset accordingly
void UpdateRetry (MinstrelWifiRemoteStation *station);
/// getting the next sample from Sample Table
uint32_t GetNextSample (MinstrelWifiRemoteStation *station);
/// find a rate to use from Minstrel Table
uint32_t FindRate (MinstrelWifiRemoteStation *station);
/// updating the Minstrel Table every 1/10 seconds
void UpdateStats (MinstrelWifiRemoteStation *station);
/// initialize Minstrel Table
void RateInit (MinstrelWifiRemoteStation *station);
/// initialize Sample Table
void InitSampleTable (MinstrelWifiRemoteStation *station);
/// printing Sample Table
void PrintSampleTable (MinstrelWifiRemoteStation *station);
/// printing Minstrel Table
void PrintTable (MinstrelWifiRemoteStation *station);
void CheckInit (MinstrelWifiRemoteStation *station); ///< check for initializations
typedef std::vector<std::pair<Time,WifiMode> > TxTime;
MinstrelRate m_minstrelTable; ///< minstrel table
SampleRate m_sampleTable; ///< sample table
TxTime m_calcTxTime; ///< to hold all the calculated TxTime for all modes
Time m_updateStats; ///< how frequent do we calculate the stats(1/10 seconds)
double m_lookAroundRate; ///< the % to try other rates than our current rate
double m_ewmaLevel; ///< exponential weighted moving average
uint32_t m_segmentSize; ///< largest allowable segment size
uint32_t m_sampleCol; ///< number of sample columns
uint32_t m_pktLen; ///< packet length used for calculate mode TxTime
uint32_t m_nsupported; ///< modes supported
};
} // namespace ns3
#endif /* MINSTREL_WIFI_MANAGER_H */
| zy901002-gpsr | src/wifi/model/minstrel-wifi-manager.h | C++ | gpl2 | 5,454 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef EDCA_TXOP_N_H
#define EDCA_TXOP_N_H
#include "ns3/object.h"
#include "ns3/mac48-address.h"
#include "ns3/packet.h"
#include "wifi-mode.h"
#include "wifi-mac-header.h"
#include "wifi-remote-station-manager.h"
#include "qos-utils.h"
#include "dcf.h"
#include "ctrl-headers.h"
#include "block-ack-manager.h"
#include <map>
#include <list>
namespace ns3 {
class DcfState;
class DcfManager;
class MacLow;
class MacTxMiddle;
class WifiMac;
class WifiMacParameters;
class WifiMacQueue;
class RandomStream;
class QosBlockedDestinations;
class MsduAggregator;
class MgtAddBaResponseHeader;
class BlockAckManager;
class MgtDelBaHeader;
enum TypeOfStation
{
STA,
AP,
ADHOC_STA,
MESH
};
/**
* \ingroup wifi
* This queue contains packets for a particular access class.
* possibles access classes are:
*
* -AC_VO : voice, tid = 6,7 ^
* -AC_VI : video, tid = 4,5 |
* -AC_BE : best-effort, tid = 0,3 | priority
* -AC_BK : background, tid = 1,2 |
*
* For more details see section 9.1.3.1 in 802.11 standard.
*/
class EdcaTxopN : public Dcf
{
public:
typedef Callback <void, const WifiMacHeader&> TxOk;
typedef Callback <void, const WifiMacHeader&> TxFailed;
static TypeId GetTypeId (void);
EdcaTxopN ();
virtual ~EdcaTxopN ();
void DoDispose ();
void SetLow (Ptr<MacLow> low);
void SetTxMiddle (MacTxMiddle *txMiddle);
void SetManager (DcfManager *manager);
void SetTxOkCallback (TxOk callback);
void SetTxFailedCallback (TxFailed callback);
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager);
void SetTypeOfStation (enum TypeOfStation type);
enum TypeOfStation GetTypeOfStation (void) const;
Ptr<WifiMacQueue > GetQueue () const;
virtual void SetMinCw (uint32_t minCw);
virtual void SetMaxCw (uint32_t maxCw);
virtual void SetAifsn (uint32_t aifsn);
virtual uint32_t GetMinCw (void) const;
virtual uint32_t GetMaxCw (void) const;
virtual uint32_t GetAifsn (void) const;
Ptr<MacLow> Low (void);
Ptr<MsduAggregator> GetMsduAggregator (void) const;
/* dcf notifications forwarded here */
bool NeedsAccess (void) const;
void NotifyAccessGranted (void);
void NotifyInternalCollision (void);
void NotifyCollision (void);
/**
* When a channel switching occurs, enqueued packets are removed.
*/
void NotifyChannelSwitching (void);
/*event handlers*/
void GotCts (double snr, WifiMode txMode);
void MissedCts (void);
void GotAck (double snr, WifiMode txMode);
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient);
void MissedBlockAck (void);
void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
void MissedAck (void);
void StartNext (void);
void Cancel (void);
void RestartAccessIfNeeded (void);
void StartAccessIfNeeded (void);
bool NeedRts (void);
bool NeedRtsRetransmission (void);
bool NeedDataRetransmission (void);
bool NeedFragmentation (void) const;
uint32_t GetNextFragmentSize (void);
uint32_t GetFragmentSize (void);
uint32_t GetFragmentOffset (void);
bool IsLastFragment (void) const;
void NextFragment (void);
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr);
void SetAccessCategory (enum AcIndex ac);
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
void SetMsduAggregator (Ptr<MsduAggregator> aggr);
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
void CompleteConfig (void);
void SetBlockAckThreshold (uint8_t threshold);
uint8_t GetBlockAckThreshold (void) const;
void SetBlockAckInactivityTimeout (uint16_t timeout);
void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator);
private:
void DoStart ();
/**
* This functions are used only to correctly set addresses in a-msdu subframe.
* If aggregating sta is a STA (in an infrastructured network):
* SA = Address2
* DA = Address3
* If aggregating sta is an AP
* SA = Address3
* DA = Address1
*/
Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr);
Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr);
EdcaTxopN &operator = (const EdcaTxopN &);
EdcaTxopN (const EdcaTxopN &);
/* If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame
* is sent to destination in order to setup a block ack.
*/
bool SetupBlockAckIfNeeded ();
/* Sends an ADDBARequest to establish a block ack agreement with sta
* addressed by <i>recipient</i> for tid <i>tid</i>.
*/
void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck);
/* After that all packets, for which a block ack agreement was established, have been
* transmitted, we have to send a block ack request.
*/
void SendBlockAckRequest (const struct Bar &bar);
/* For now is typically invoked to complete transmission of a packets sent with ack policy
* Block Ack: the packet is buffered and dcf is reset.
*/
void CompleteTx (void);
/* Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
* if an established block ack agreement exists with the receiver.
*/
void VerifyBlockAck (void);
AcIndex m_ac;
class Dcf;
class TransmissionListener;
class BlockAckEventListener;
friend class Dcf;
friend class TransmissionListener;
Dcf *m_dcf;
DcfManager *m_manager;
Ptr<WifiMacQueue> m_queue;
TxOk m_txOkCallback;
TxFailed m_txFailedCallback;
Ptr<MacLow> m_low;
MacTxMiddle *m_txMiddle;
TransmissionListener *m_transmissionListener;
BlockAckEventListener *m_blockAckListener;
RandomStream *m_rng;
Ptr<WifiRemoteStationManager> m_stationManager;
uint8_t m_fragmentNumber;
/* current packet could be a simple MSDU or, if an aggregator for this queue is
present, could be an A-MSDU.
*/
Ptr<const Packet> m_currentPacket;
WifiMacHeader m_currentHdr;
Ptr<MsduAggregator> m_aggregator;
TypeOfStation m_typeOfStation;
QosBlockedDestinations *m_qosBlockedDestinations;
BlockAckManager *m_baManager;
/*
* Represents the minimum number of packets for use of block ack.
*/
uint8_t m_blockAckThreshold;
enum BlockAckType m_blockAckType;
Time m_currentPacketTimestamp;
uint16_t m_blockAckInactivityTimeout;
struct Bar m_currentBar;
};
} // namespace ns3
#endif /* EDCA_TXOP_N_H */
| zy901002-gpsr | src/wifi/model/edca-txop-n.h | C++ | gpl2 | 7,427 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2003,2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "amrr-wifi-manager.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include "ns3/uinteger.h"
#include "ns3/double.h"
NS_LOG_COMPONENT_DEFINE ("AmrrWifiRemoteStation");
namespace ns3 {
struct AmrrWifiRemoteStation : public WifiRemoteStation
{
Time m_nextModeUpdate;
uint32_t m_tx_ok;
uint32_t m_tx_err;
uint32_t m_tx_retr;
uint32_t m_retry;
uint32_t m_txrate;
uint32_t m_successThreshold;
uint32_t m_success;
bool m_recovery;
};
NS_OBJECT_ENSURE_REGISTERED (AmrrWifiManager);
TypeId
AmrrWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AmrrWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<AmrrWifiManager> ()
.AddAttribute ("UpdatePeriod",
"The interval between decisions about rate control changes",
TimeValue (Seconds (1.0)),
MakeTimeAccessor (&AmrrWifiManager::m_updatePeriod),
MakeTimeChecker ())
.AddAttribute ("FailureRatio",
"Ratio of minimum erroneous transmissions needed to switch to a lower rate",
DoubleValue (1.0 / 3.0),
MakeDoubleAccessor (&AmrrWifiManager::m_failureRatio),
MakeDoubleChecker<double> (0.0, 1.0))
.AddAttribute ("SuccessRatio",
"Ratio of maximum erroneous transmissions needed to switch to a higher rate",
DoubleValue (1.0 / 10.0),
MakeDoubleAccessor (&AmrrWifiManager::m_successRatio),
MakeDoubleChecker<double> (0.0, 1.0))
.AddAttribute ("MaxSuccessThreshold",
"Maximum number of consecutive success periods needed to switch to a higher rate",
UintegerValue (10),
MakeUintegerAccessor (&AmrrWifiManager::m_maxSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinSuccessThreshold",
"Minimum number of consecutive success periods needed to switch to a higher rate",
UintegerValue (1),
MakeUintegerAccessor (&AmrrWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
AmrrWifiManager::AmrrWifiManager ()
{
}
WifiRemoteStation *
AmrrWifiManager::DoCreateStation (void) const
{
AmrrWifiRemoteStation *station = new AmrrWifiRemoteStation ();
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
station->m_tx_ok = 0;
station->m_tx_err = 0;
station->m_tx_retr = 0;
station->m_retry = 0;
station->m_txrate = 0;
station->m_successThreshold = m_minSuccessThreshold;
station->m_success = 0;
station->m_recovery = false;
return station;
}
void
AmrrWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
void
AmrrWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
}
void
AmrrWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
station->m_retry++;
station->m_tx_retr++;
}
void
AmrrWifiManager::DoReportRtsOk (WifiRemoteStation *st,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
}
void
AmrrWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
station->m_retry = 0;
station->m_tx_ok++;
}
void
AmrrWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
}
void
AmrrWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
station->m_retry = 0;
station->m_tx_err++;
}
bool
AmrrWifiManager::IsMinRate (AmrrWifiRemoteStation *station) const
{
return (station->m_txrate == 0);
}
bool
AmrrWifiManager::IsMaxRate (AmrrWifiRemoteStation *station) const
{
NS_ASSERT (station->m_txrate + 1 <= GetNSupported (station));
return (station->m_txrate + 1 == GetNSupported (station));
}
bool
AmrrWifiManager::IsSuccess (AmrrWifiRemoteStation *station) const
{
return (station->m_tx_retr + station->m_tx_err) < station->m_tx_ok * m_successRatio;
}
bool
AmrrWifiManager::IsFailure (AmrrWifiRemoteStation *station) const
{
return (station->m_tx_retr + station->m_tx_err) > station->m_tx_ok * m_failureRatio;
}
bool
AmrrWifiManager::IsEnough (AmrrWifiRemoteStation *station) const
{
return (station->m_tx_retr + station->m_tx_err + station->m_tx_ok) > 10;
}
void
AmrrWifiManager::ResetCnt (AmrrWifiRemoteStation *station)
{
station->m_tx_ok = 0;
station->m_tx_err = 0;
station->m_tx_retr = 0;
}
void
AmrrWifiManager::IncreaseRate (AmrrWifiRemoteStation *station)
{
station->m_txrate++;
NS_ASSERT (station->m_txrate < GetNSupported (station));
}
void
AmrrWifiManager::DecreaseRate (AmrrWifiRemoteStation *station)
{
station->m_txrate--;
}
void
AmrrWifiManager::UpdateMode (AmrrWifiRemoteStation *station)
{
if (Simulator::Now () < station->m_nextModeUpdate)
{
return;
}
station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
NS_LOG_DEBUG ("Update");
bool needChange = false;
if (IsSuccess (station) && IsEnough (station))
{
station->m_success++;
NS_LOG_DEBUG ("++ success=" << station->m_success << " successThreshold=" << station->m_successThreshold <<
" tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr <<
" rate=" << station->m_txrate << " n-supported-rates=" << GetNSupported (station));
if (station->m_success >= station->m_successThreshold
&& !IsMaxRate (station))
{
station->m_recovery = true;
station->m_success = 0;
IncreaseRate (station);
needChange = true;
}
else
{
station->m_recovery = false;
}
}
else if (IsFailure (station))
{
station->m_success = 0;
NS_LOG_DEBUG ("-- success=" << station->m_success << " successThreshold=" << station->m_successThreshold <<
" tx_ok=" << station->m_tx_ok << " tx_err=" << station->m_tx_err << " tx_retr=" << station->m_tx_retr <<
" rate=" << station->m_txrate << " n-supported-rates=" << GetNSupported (station));
if (!IsMinRate (station))
{
if (station->m_recovery)
{
station->m_successThreshold *= 2;
station->m_successThreshold = std::min (station->m_successThreshold,
m_maxSuccessThreshold);
}
else
{
station->m_successThreshold = m_minSuccessThreshold;
}
station->m_recovery = false;
DecreaseRate (station);
needChange = true;
}
else
{
station->m_recovery = false;
}
}
if (IsEnough (station) || needChange)
{
NS_LOG_DEBUG ("Reset");
ResetCnt (station);
}
}
WifiMode
AmrrWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
UpdateMode (station);
NS_ASSERT (station->m_txrate < GetNSupported (station));
uint32_t rateIndex;
if (station->m_retry < 1)
{
rateIndex = station->m_txrate;
}
else if (station->m_retry < 2)
{
if (station->m_txrate > 0)
{
rateIndex = station->m_txrate - 1;
}
else
{
rateIndex = station->m_txrate;
}
}
else if (station->m_retry < 3)
{
if (station->m_txrate > 1)
{
rateIndex = station->m_txrate - 2;
}
else
{
rateIndex = station->m_txrate;
}
}
else
{
if (station->m_txrate > 2)
{
rateIndex = station->m_txrate - 3;
}
else
{
rateIndex = station->m_txrate;
}
}
return GetSupported (station, rateIndex);
}
WifiMode
AmrrWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
AmrrWifiRemoteStation *station = (AmrrWifiRemoteStation *)st;
UpdateMode (station);
// XXX: can we implement something smarter ?
return GetSupported (station, 0);
}
bool
AmrrWifiManager::IsLowLatency (void) const
{
return true;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/amrr-wifi-manager.cc | C++ | gpl2 | 9,250 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef WIFI_MODE_H
#define WIFI_MODE_H
#include <stdint.h>
#include <string>
#include <vector>
#include <ostream>
#include "ns3/attribute-helper.h"
#include "ns3/wifi-phy-standard.h"
namespace ns3 {
/**
* This enumeration defines the modulation classes per IEEE
* 802.11-2007, Section 9.6.1, Table 9-2.
*/
enum WifiModulationClass
{
/** Modulation class unknown or unspecified. A WifiMode with this
WifiModulationClass has not been properly initialised. */
WIFI_MOD_CLASS_UNKNOWN = 0,
/** Infrared (IR) (Clause 16) */
WIFI_MOD_CLASS_IR,
/** Frequency-hopping spread spectrum (FHSS) PHY (Clause 14) */
WIFI_MOD_CLASS_FHSS,
/** DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18) */
WIFI_MOD_CLASS_DSSS,
/** ERP-PBCC PHY (19.6) */
WIFI_MOD_CLASS_ERP_PBCC,
/** DSSS-OFDM PHY (19.7) */
WIFI_MOD_CLASS_DSSS_OFDM,
/** ERP-OFDM PHY (19.5) */
WIFI_MOD_CLASS_ERP_OFDM,
/** OFDM PHY (Clause 17) */
WIFI_MOD_CLASS_OFDM,
/** HT PHY (Clause 20) */
WIFI_MOD_CLASS_HT
};
/**
* This enumeration defines the various convolutional coding rates
* used for the OFDM transmission modes in the IEEE 802.11
* standard. DSSS (for example) rates which do not have an explicit
* coding stage in their generation should have this parameter set to
* WIFI_CODE_RATE_UNDEFINED.
*/
enum WifiCodeRate
{
/** No explicit coding (e.g., DSSS rates) */
WIFI_CODE_RATE_UNDEFINED,
/** Rate 3/4 */
WIFI_CODE_RATE_3_4,
/** Rate 2/3 */
WIFI_CODE_RATE_2_3,
/** Rate 1/2 */
WIFI_CODE_RATE_1_2
};
/**
* \brief represent a single transmission mode
* \ingroup wifi
*
* A WifiMode is implemented by a single integer which is used
* to lookup in a global array the characteristics of the
* associated transmission mode. It is thus extremely cheap to
* keep a WifiMode variable around.
*/
class WifiMode
{
public:
/**
* \returns the number of Hz used by this signal
*/
uint32_t GetBandwidth (void) const;
/**
* \returns the physical bit rate of this signal.
*
* If a transmission mode uses 1/2 FEC, and if its
* data rate is 3Mbs, the phy rate is 6Mbs
*/
uint64_t GetPhyRate (void) const;
/**
* \returns the data bit rate of this signal.
*/
uint64_t GetDataRate (void) const;
/**
* \returns the coding rate of this transmission mode
*/
enum WifiCodeRate GetCodeRate (void) const;
/**
* \returns the size of the modulation constellation.
*/
uint8_t GetConstellationSize (void) const;
/**
* \returns a human-readable representation of this WifiMode
* instance.
*/
std::string GetUniqueName (void) const;
/**
* \returns true if this mode is a mandatory mode, false
* otherwise.
*/
bool IsMandatory (void) const;
/**
* \returns the uid associated to this wireless mode.
*
* Each specific wireless mode should have a different uid.
* For example, the 802.11b 1Mbs and the 802.11b 2Mbs modes
* should have different uids.
*/
uint32_t GetUid (void) const;
/**
*
* \returns the Modulation Class (see IEEE 802.11-2007 Section
* 9.6.1) to which this WifiMode belongs.
*/
enum WifiModulationClass GetModulationClass () const;
/**
* Create an invalid WifiMode. Calling any method on the
* instance created will trigger an assert. This is useful
* to separate the declaration of a WifiMode variable from
* its initialization.
*/
WifiMode ();
WifiMode (std::string name);
private:
friend class WifiModeFactory;
WifiMode (uint32_t uid);
uint32_t m_uid;
};
bool operator == (const WifiMode &a, const WifiMode &b);
std::ostream & operator << (std::ostream & os, const WifiMode &mode);
std::istream & operator >> (std::istream &is, WifiMode &mode);
/**
* \class ns3::WifiModeValue
* \brief hold objects of type ns3::WifiMode
*/
ATTRIBUTE_HELPER_HEADER (WifiMode);
/**
* In various parts of the code, folk are interested in maintaining a
* list of transmission modes. The vector class provides a good basis
* for this, but we here add some syntactic sugar by defining a
* WifiModeList type, and a corresponding iterator.
*/
typedef std::vector<WifiMode> WifiModeList;
typedef WifiModeList::const_iterator WifiModeListIterator;
/**
* \brief create WifiMode class instances and keep track of them.
*
* This factory ensures that each WifiMode created has a unique name
* and assigns to each of them a unique integer.
*/
class WifiModeFactory
{
public:
/**
* \param uniqueName the name of the associated WifiMode. This name
* must be unique accross _all_ instances.
* \param modClass the class of modulation
* \param isMandatory true if this WifiMode is mandatory, false otherwise.
* \param bandwidth the bandwidth (Hz) of the signal generated when the
* associated WifiMode is used.
* \param dataRate the rate (bits/second) at which the user data is transmitted
* \param codingRate if convolutional coding is used for this rate
* then this parameter specifies the convolutional coding rate
* used. If there is no explicit convolutional coding step (e.g.,
* for DSSS rates) then the caller should set this parameter to
* WIFI_CODE_RATE_UNCODED.
* \param constellationSize the order of the constellation used.
*
* Create a WifiMode.
*/
static WifiMode CreateWifiMode (std::string uniqueName,
enum WifiModulationClass modClass,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
enum WifiCodeRate codingRate,
uint8_t constellationSize);
private:
friend class WifiMode;
friend std::istream & operator >> (std::istream &is, WifiMode &mode);
static WifiModeFactory* GetFactory ();
WifiModeFactory ();
/**
* This is the data associated to a unique WifiMode.
* The integer stored in a WifiMode is in fact an index
* in an array of WifiModeItem objects.
*/
struct WifiModeItem
{
std::string uniqueUid;
uint32_t bandwidth;
uint32_t dataRate;
uint32_t phyRate;
enum WifiModulationClass modClass;
uint8_t constellationSize;
enum WifiCodeRate codingRate;
bool isMandatory;
};
WifiMode Search (std::string name);
uint32_t AllocateUid (std::string uniqueName);
WifiModeItem* Get (uint32_t uid);
typedef std::vector<struct WifiModeItem> WifiModeItemList;
WifiModeItemList m_itemList;
};
} // namespace ns3
#endif /* WIFI_MODE_H */
| zy901002-gpsr | src/wifi/model/wifi-mode.h | C++ | gpl2 | 7,376 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#include "ns3/log.h"
#include "ns3/assert.h"
#include "ns3/pointer.h"
#include "edca-txop-n.h"
#include "mac-low.h"
#include "dcf-manager.h"
#include "mac-tx-middle.h"
#include "wifi-mac-trailer.h"
#include "wifi-mac.h"
#include "random-stream.h"
#include "wifi-mac-queue.h"
#include "msdu-aggregator.h"
#include "mgt-headers.h"
#include "qos-blocked-destinations.h"
NS_LOG_COMPONENT_DEFINE ("EdcaTxopN");
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
namespace ns3 {
class EdcaTxopN::Dcf : public DcfState
{
public:
Dcf (EdcaTxopN * txop)
: m_txop (txop)
{
}
private:
virtual void DoNotifyAccessGranted (void)
{
m_txop->NotifyAccessGranted ();
}
virtual void DoNotifyInternalCollision (void)
{
m_txop->NotifyInternalCollision ();
}
virtual void DoNotifyCollision (void)
{
m_txop->NotifyCollision ();
}
virtual void DoNotifyChannelSwitching (void)
{
m_txop->NotifyChannelSwitching ();
}
EdcaTxopN *m_txop;
};
class EdcaTxopN::TransmissionListener : public MacLowTransmissionListener
{
public:
TransmissionListener (EdcaTxopN * txop)
: MacLowTransmissionListener (),
m_txop (txop) {
}
virtual ~TransmissionListener () {}
virtual void GotCts (double snr, WifiMode txMode)
{
m_txop->GotCts (snr, txMode);
}
virtual void MissedCts (void)
{
m_txop->MissedCts ();
}
virtual void GotAck (double snr, WifiMode txMode)
{
m_txop->GotAck (snr, txMode);
}
virtual void MissedAck (void)
{
m_txop->MissedAck ();
}
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source)
{
m_txop->GotBlockAck (blockAck, source);
}
virtual void MissedBlockAck (void)
{
m_txop->MissedBlockAck ();
}
virtual void StartNext (void)
{
m_txop->StartNext ();
}
virtual void Cancel (void)
{
m_txop->Cancel ();
}
private:
EdcaTxopN *m_txop;
};
class EdcaTxopN::BlockAckEventListener : public MacLowBlockAckEventListener
{
public:
BlockAckEventListener (EdcaTxopN * txop)
: MacLowBlockAckEventListener (),
m_txop (txop) {
}
virtual ~BlockAckEventListener () {}
virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid)
{
m_txop->SendDelbaFrame (address, tid, false);
}
private:
EdcaTxopN *m_txop;
};
NS_OBJECT_ENSURE_REGISTERED (EdcaTxopN);
TypeId
EdcaTxopN::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::EdcaTxopN")
.SetParent (ns3::Dcf::GetTypeId ())
.AddConstructor<EdcaTxopN> ()
.AddAttribute ("BlockAckThreshold", "If number of packets in this queue reaches this value,\
block ack mechanism is used. If this value is 0, block ack is never used.",
UintegerValue (0),
MakeUintegerAccessor (&EdcaTxopN::SetBlockAckThreshold,
&EdcaTxopN::GetBlockAckThreshold),
MakeUintegerChecker<uint8_t> (0, 64))
.AddAttribute ("BlockAckInactivityTimeout", "Represents max time (blocks of 1024 micro seconds) allowed for block ack\
inactivity. If this value isn't equal to 0 a timer start after that a\
block ack setup is completed and will be reset every time that a block\
ack frame is received. If this value is 0, block ack inactivity timeout won't be used.",
UintegerValue (0),
MakeUintegerAccessor (&EdcaTxopN::SetBlockAckInactivityTimeout),
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("Queue", "The WifiMacQueue object",
PointerValue (),
MakePointerAccessor (&EdcaTxopN::GetQueue),
MakePointerChecker<WifiMacQueue> ())
;
return tid;
}
EdcaTxopN::EdcaTxopN ()
: m_manager (0),
m_currentPacket (0),
m_aggregator (0),
m_blockAckType (COMPRESSED_BLOCK_ACK)
{
NS_LOG_FUNCTION (this);
m_transmissionListener = new EdcaTxopN::TransmissionListener (this);
m_blockAckListener = new EdcaTxopN::BlockAckEventListener (this);
m_dcf = new EdcaTxopN::Dcf (this);
m_queue = CreateObject<WifiMacQueue> ();
m_rng = new RealRandomStream ();
m_qosBlockedDestinations = new QosBlockedDestinations ();
m_baManager = new BlockAckManager ();
m_baManager->SetQueue (m_queue);
m_baManager->SetBlockAckType (m_blockAckType);
m_baManager->SetBlockDestinationCallback (MakeCallback (&QosBlockedDestinations::Block, m_qosBlockedDestinations));
m_baManager->SetUnblockDestinationCallback (MakeCallback (&QosBlockedDestinations::Unblock, m_qosBlockedDestinations));
m_baManager->SetMaxPacketDelay (m_queue->GetMaxDelay ());
}
EdcaTxopN::~EdcaTxopN ()
{
NS_LOG_FUNCTION (this);
}
void
EdcaTxopN::DoDispose (void)
{
NS_LOG_FUNCTION (this);
m_queue = 0;
m_low = 0;
m_stationManager = 0;
delete m_transmissionListener;
delete m_dcf;
delete m_rng;
delete m_qosBlockedDestinations;
delete m_baManager;
delete m_blockAckListener;
m_transmissionListener = 0;
m_dcf = 0;
m_rng = 0;
m_qosBlockedDestinations = 0;
m_baManager = 0;
m_blockAckListener = 0;
m_txMiddle = 0;
m_aggregator = 0;
}
void
EdcaTxopN::SetManager (DcfManager *manager)
{
NS_LOG_FUNCTION (this << manager);
m_manager = manager;
m_manager->Add (m_dcf);
}
void
EdcaTxopN::SetTxOkCallback (TxOk callback)
{
m_txOkCallback = callback;
}
void
EdcaTxopN::SetTxFailedCallback (TxFailed callback)
{
m_txFailedCallback = callback;
}
void
EdcaTxopN::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
{
NS_LOG_FUNCTION (this << remoteManager);
m_stationManager = remoteManager;
}
void
EdcaTxopN::SetTypeOfStation (enum TypeOfStation type)
{
NS_LOG_FUNCTION (this << type);
m_typeOfStation = type;
}
enum TypeOfStation
EdcaTxopN::GetTypeOfStation (void) const
{
return m_typeOfStation;
}
Ptr<WifiMacQueue >
EdcaTxopN::GetQueue () const
{
NS_LOG_FUNCTION (this);
return m_queue;
}
void
EdcaTxopN::SetMinCw (uint32_t minCw)
{
NS_LOG_FUNCTION (this << minCw);
m_dcf->SetCwMin (minCw);
}
void
EdcaTxopN::SetMaxCw (uint32_t maxCw)
{
NS_LOG_FUNCTION (this << maxCw);
m_dcf->SetCwMax (maxCw);
}
void
EdcaTxopN::SetAifsn (uint32_t aifsn)
{
NS_LOG_FUNCTION (this << aifsn);
m_dcf->SetAifsn (aifsn);
}
uint32_t
EdcaTxopN::GetMinCw (void) const
{
return m_dcf->GetCwMin ();
}
uint32_t
EdcaTxopN::GetMaxCw (void) const
{
return m_dcf->GetCwMax ();
}
uint32_t
EdcaTxopN::GetAifsn (void) const
{
return m_dcf->GetAifsn ();
}
void
EdcaTxopN::SetTxMiddle (MacTxMiddle *txMiddle)
{
m_txMiddle = txMiddle;
}
Ptr<MacLow>
EdcaTxopN::Low (void)
{
return m_low;
}
void
EdcaTxopN::SetLow (Ptr<MacLow> low)
{
NS_LOG_FUNCTION (this << low);
m_low = low;
}
bool
EdcaTxopN::NeedsAccess (void) const
{
return !m_queue->IsEmpty () || m_currentPacket != 0 || m_baManager->HasPackets ();
}
void
EdcaTxopN::NotifyAccessGranted (void)
{
NS_LOG_FUNCTION (this);
if (m_currentPacket == 0)
{
if (m_queue->IsEmpty () && !m_baManager->HasPackets ())
{
NS_LOG_DEBUG ("queue is empty");
return;
}
if (m_baManager->HasBar (m_currentBar))
{
SendBlockAckRequest (m_currentBar);
return;
}
/* check if packets need retransmission are stored in BlockAckManager */
m_currentPacket = m_baManager->GetNextPacket (m_currentHdr);
if (m_currentPacket == 0)
{
if (m_queue->PeekFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations) == 0)
{
NS_LOG_DEBUG ("no available packets in the queue");
return;
}
if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast ()
&& m_blockAckThreshold > 0
&& !m_baManager->ExistsAgreement (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid ())
&& SetupBlockAckIfNeeded ())
{
return;
}
m_currentPacket = m_queue->DequeueFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations);
NS_ASSERT (m_currentPacket != 0);
uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
m_currentHdr.SetSequenceNumber (sequence);
m_currentHdr.SetFragmentNumber (0);
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
m_fragmentNumber = 0;
NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
", to=" << m_currentHdr.GetAddr1 () <<
", seq=" << m_currentHdr.GetSequenceControl ());
if (m_currentHdr.IsQosData () && !m_currentHdr.GetAddr1 ().IsBroadcast ())
{
VerifyBlockAck ();
}
}
}
MacLowTransmissionParameters params;
params.DisableOverrideDurationId ();
if (m_currentHdr.GetAddr1 ().IsGroup ())
{
params.DisableRts ();
params.DisableAck ();
params.DisableNextData ();
m_low->StartTransmission (m_currentPacket,
&m_currentHdr,
params,
m_transmissionListener);
m_currentPacket = 0;
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
StartAccessIfNeeded ();
NS_LOG_DEBUG ("tx broadcast");
}
else if (m_currentHdr.GetType () == WIFI_MAC_CTL_BACKREQ)
{
SendBlockAckRequest (m_currentBar);
}
else
{
if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ())
{
params.DisableAck ();
}
else
{
params.EnableAck ();
}
if (NeedFragmentation () && ((m_currentHdr.IsQosData ()
&& !m_currentHdr.IsQosAmsdu ())
|| m_currentHdr.IsData ())
&& (m_blockAckThreshold == 0
|| m_blockAckType == BASIC_BLOCK_ACK))
{
//With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
params.DisableRts ();
WifiMacHeader hdr;
Ptr<Packet> fragment = GetFragmentPacket (&hdr);
if (IsLastFragment ())
{
NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
params.DisableNextData ();
}
else
{
NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
params.EnableNextData (GetNextFragmentSize ());
}
m_low->StartTransmission (fragment, &hdr, params,
m_transmissionListener);
}
else
{
WifiMacHeader peekedHdr;
if (m_currentHdr.IsQosData ()
&& m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ())
&& !m_currentHdr.GetAddr1 ().IsBroadcast ()
&& m_aggregator != 0 && !m_currentHdr.IsRetry ())
{
/* here is performed aggregation */
Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
m_aggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
MapSrcAddressForAggregation (peekedHdr),
MapDestAddressForAggregation (peekedHdr));
bool aggregated = false;
bool isAmsdu = false;
Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
WifiMacHeader::ADDR1,
m_currentHdr.GetAddr1 ());
while (peekedPacket != 0)
{
aggregated = m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket,
MapSrcAddressForAggregation (peekedHdr),
MapDestAddressForAggregation (peekedHdr));
if (aggregated)
{
isAmsdu = true;
m_queue->Remove (peekedPacket);
}
else
{
break;
}
peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ());
}
if (isAmsdu)
{
m_currentHdr.SetQosAmsdu ();
m_currentHdr.SetAddr3 (m_low->GetBssid ());
m_currentPacket = currentAggregatedPacket;
currentAggregatedPacket = 0;
NS_LOG_DEBUG ("tx unicast A-MSDU");
}
}
if (NeedRts ())
{
params.EnableRts ();
NS_LOG_DEBUG ("tx unicast rts");
}
else
{
params.DisableRts ();
NS_LOG_DEBUG ("tx unicast");
}
params.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);
CompleteTx ();
}
}
}
void EdcaTxopN::NotifyInternalCollision (void)
{
NS_LOG_FUNCTION (this);
NotifyCollision ();
}
void
EdcaTxopN::NotifyCollision (void)
{
NS_LOG_FUNCTION (this);
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
void
EdcaTxopN::GotCts (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
NS_LOG_DEBUG ("got cts");
}
void
EdcaTxopN::MissedCts (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed cts");
if (!NeedRtsRetransmission ())
{
NS_LOG_DEBUG ("Cts Fail");
m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
}
else
{
m_dcf->UpdateFailedCw ();
}
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
void
EdcaTxopN::NotifyChannelSwitching (void)
{
m_queue->Flush ();
m_currentPacket = 0;
}
void
EdcaTxopN::Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
NS_LOG_FUNCTION (this << packet << &hdr);
WifiMacTrailer fcs;
uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
packet, fullPacketSize);
m_queue->Enqueue (packet, hdr);
StartAccessIfNeeded ();
}
void
EdcaTxopN::GotAck (double snr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << snr << txMode);
if (!NeedFragmentation ()
|| IsLastFragment ()
|| m_currentHdr.IsQosAmsdu ())
{
NS_LOG_DEBUG ("got ack. tx done.");
if (!m_txOkCallback.IsNull ())
{
m_txOkCallback (m_currentHdr);
}
if (m_currentHdr.IsAction ())
{
WifiActionHeader actionHdr;
Ptr<Packet> p = m_currentPacket->Copy ();
p->RemoveHeader (actionHdr);
if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK
&& actionHdr.GetAction ().blockAck == WifiActionHeader::BLOCK_ACK_DELBA)
{
MgtDelBaHeader delBa;
p->PeekHeader (delBa);
if (delBa.IsByOriginator ())
{
m_baManager->TearDownBlockAck (m_currentHdr.GetAddr1 (), delBa.GetTid ());
}
else
{
m_low->DestroyBlockAckAgreement (m_currentHdr.GetAddr1 (), delBa.GetTid ());
}
}
}
m_currentPacket = 0;
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
else
{
NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
}
}
void
EdcaTxopN::MissedAck (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed ack");
if (!NeedDataRetransmission ())
{
NS_LOG_DEBUG ("Ack Fail");
m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
// to reset the dcf.
m_currentPacket = 0;
m_dcf->ResetCw ();
}
else
{
NS_LOG_DEBUG ("Retransmit");
m_currentHdr.SetRetry ();
m_dcf->UpdateFailedCw ();
}
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
void
EdcaTxopN::MissedBlockAck (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed block ack");
//should i report this to station addressed by ADDR1?
NS_LOG_DEBUG ("Retransmit block ack request");
m_currentHdr.SetRetry ();
m_dcf->UpdateFailedCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
Ptr<MsduAggregator>
EdcaTxopN::GetMsduAggregator (void) const
{
return m_aggregator;
}
void
EdcaTxopN::RestartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
if ((m_currentPacket != 0
|| !m_queue->IsEmpty () || m_baManager->HasPackets ())
&& !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
}
void
EdcaTxopN::StartAccessIfNeeded (void)
{
NS_LOG_FUNCTION (this);
if (m_currentPacket == 0
&& (!m_queue->IsEmpty () || m_baManager->HasPackets ())
&& !m_dcf->IsAccessRequested ())
{
m_manager->RequestAccess (m_dcf);
}
}
bool
EdcaTxopN::NeedRts (void)
{
return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
bool
EdcaTxopN::NeedRtsRetransmission (void)
{
return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
bool
EdcaTxopN::NeedDataRetransmission (void)
{
return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
void
EdcaTxopN::NextFragment (void)
{
m_fragmentNumber++;
}
void
EdcaTxopN::StartNext (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("start next packet fragment");
/* this callback is used only for fragments. */
NextFragment ();
WifiMacHeader hdr;
Ptr<Packet> fragment = GetFragmentPacket (&hdr);
MacLowTransmissionParameters params;
params.EnableAck ();
params.DisableRts ();
params.DisableOverrideDurationId ();
if (IsLastFragment ())
{
params.DisableNextData ();
}
else
{
params.EnableNextData (GetNextFragmentSize ());
}
Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
}
void
EdcaTxopN::Cancel (void)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("transmission cancelled");
}
bool
EdcaTxopN::NeedFragmentation (void) const
{
return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
uint32_t
EdcaTxopN::GetFragmentSize (void)
{
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
}
uint32_t
EdcaTxopN::GetNextFragmentSize (void)
{
return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber + 1);
}
uint32_t
EdcaTxopN::GetFragmentOffset (void)
{
return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
}
bool
EdcaTxopN::IsLastFragment (void) const
{
return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, m_fragmentNumber);
}
Ptr<Packet>
EdcaTxopN::GetFragmentPacket (WifiMacHeader *hdr)
{
*hdr = m_currentHdr;
hdr->SetFragmentNumber (m_fragmentNumber);
uint32_t startOffset = GetFragmentOffset ();
Ptr<Packet> fragment;
if (IsLastFragment ())
{
hdr->SetNoMoreFragments ();
}
else
{
hdr->SetMoreFragments ();
}
fragment = m_currentPacket->CreateFragment (startOffset,
GetFragmentSize ());
return fragment;
}
void
EdcaTxopN::SetAccessCategory (enum AcIndex ac)
{
m_ac = ac;
}
Mac48Address
EdcaTxopN::MapSrcAddressForAggregation (const WifiMacHeader &hdr)
{
Mac48Address retval;
if (m_typeOfStation == STA || m_typeOfStation == ADHOC_STA)
{
retval = hdr.GetAddr2 ();
}
else
{
retval = hdr.GetAddr3 ();
}
return retval;
}
Mac48Address
EdcaTxopN::MapDestAddressForAggregation (const WifiMacHeader &hdr)
{
Mac48Address retval;
if (m_typeOfStation == AP || m_typeOfStation == ADHOC_STA)
{
retval = hdr.GetAddr1 ();
}
else
{
retval = hdr.GetAddr3 ();
}
return retval;
}
void
EdcaTxopN::SetMsduAggregator (Ptr<MsduAggregator> aggr)
{
m_aggregator = aggr;
}
void
EdcaTxopN::PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr)
{
NS_LOG_FUNCTION (this << packet << &hdr);
WifiMacTrailer fcs;
uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
packet, fullPacketSize);
m_queue->PushFront (packet, hdr);
StartAccessIfNeeded ();
}
void
EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("received ADDBA response from " << recipient);
uint8_t tid = respHdr->GetTid ();
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::PENDING))
{
if (respHdr->GetStatusCode ().IsSuccess ())
{
NS_LOG_DEBUG ("block ack agreement established with " << recipient);
m_baManager->UpdateAgreement (respHdr, recipient);
}
else
{
NS_LOG_DEBUG ("discard ADDBA response" << recipient);
m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
}
}
RestartAccessIfNeeded ();
}
void
EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
}
void
EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
{
NS_LOG_DEBUG ("got block ack from=" << recipient);
m_baManager->NotifyGotBlockAck (blockAck, recipient);
m_currentPacket = 0;
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
RestartAccessIfNeeded ();
}
void
EdcaTxopN::VerifyBlockAck (void)
{
NS_LOG_FUNCTION (this);
uint8_t tid = m_currentHdr.GetQosTid ();
Mac48Address recipient = m_currentHdr.GetAddr1 ();
uint16_t sequence = m_currentHdr.GetSequenceNumber ();
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::INACTIVE))
{
m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
}
if (m_baManager->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
{
m_currentHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK);
}
}
void
EdcaTxopN::CompleteTx (void)
{
if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ())
{
if (!m_currentHdr.IsRetry ())
{
m_baManager->StorePacket (m_currentPacket, m_currentHdr, m_currentPacketTimestamp);
}
m_baManager->NotifyMpduTransmission (m_currentHdr.GetAddr1 (), m_currentHdr.GetQosTid (),
m_txMiddle->GetNextSeqNumberByTidAndAddress (m_currentHdr.GetQosTid (),
m_currentHdr.GetAddr1 ()));
//we are not waiting for an ack: transmission is completed
m_currentPacket = 0;
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
StartAccessIfNeeded ();
}
}
bool
EdcaTxopN::SetupBlockAckIfNeeded ()
{
uint8_t tid = m_currentHdr.GetQosTid ();
Mac48Address recipient = m_currentHdr.GetAddr1 ();
uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient);
if (packets >= m_blockAckThreshold)
{
/* Block ack setup */
uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
SendAddBaRequest (recipient, tid, startingSequence, m_blockAckInactivityTimeout, true);
return true;
}
return false;
}
void
EdcaTxopN::SendBlockAckRequest (const struct Bar &bar)
{
NS_LOG_FUNCTION (this);
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
hdr.SetAddr1 (bar.recipient);
hdr.SetAddr2 (m_low->GetAddress ());
hdr.SetAddr3 (m_low->GetBssid ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
hdr.SetNoRetry ();
hdr.SetNoMoreFragments ();
m_currentPacket = bar.bar;
m_currentHdr = hdr;
MacLowTransmissionParameters params;
params.DisableRts ();
params.DisableNextData ();
params.DisableOverrideDurationId ();
if (bar.immediate)
{
if (m_blockAckType == BASIC_BLOCK_ACK)
{
params.EnableBasicBlockAck ();
}
else if (m_blockAckType == COMPRESSED_BLOCK_ACK)
{
params.EnableCompressedBlockAck ();
}
else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
{
NS_FATAL_ERROR ("Multi-tid block ack is not supported");
}
}
else
{
//Delayed block ack
params.EnableAck ();
}
m_low->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener);
}
void
EdcaTxopN::CompleteConfig (void)
{
NS_LOG_FUNCTION (this);
m_baManager->SetTxMiddle (m_txMiddle);
m_low->RegisterBlockAckListenerForAc (m_ac, m_blockAckListener);
m_baManager->SetBlockAckInactivityCallback (MakeCallback (&EdcaTxopN::SendDelbaFrame, this));
}
void
EdcaTxopN::SetBlockAckThreshold (uint8_t threshold)
{
m_blockAckThreshold = threshold;
m_baManager->SetBlockAckThreshold (threshold);
}
void
EdcaTxopN::SetBlockAckInactivityTimeout (uint16_t timeout)
{
m_blockAckInactivityTimeout = timeout;
}
uint8_t
EdcaTxopN::GetBlockAckThreshold (void) const
{
return m_blockAckThreshold;
}
void
EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
uint16_t timeout, bool immediateBAck)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("sent ADDBA request to " << dest);
WifiMacHeader hdr;
hdr.SetAction ();
hdr.SetAddr1 (dest);
hdr.SetAddr2 (m_low->GetAddress ());
hdr.SetAddr3 (m_low->GetAddress ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
WifiActionHeader actionHdr;
WifiActionHeader::ActionValue action;
action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST;
actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
Ptr<Packet> packet = Create<Packet> ();
/*Setting ADDBARequest header*/
MgtAddBaRequestHeader reqHdr;
reqHdr.SetAmsduSupport (true);
if (immediateBAck)
{
reqHdr.SetImmediateBlockAck ();
}
else
{
reqHdr.SetDelayedBlockAck ();
}
reqHdr.SetTid (tid);
/* For now we don't use buffer size field in the ADDBA request frame. The recipient
* will choose how many packets it can receive under block ack.
*/
reqHdr.SetBufferSize (0);
reqHdr.SetTimeout (timeout);
reqHdr.SetStartingSequence (startSeq);
m_baManager->CreateAgreement (&reqHdr, dest);
packet->AddHeader (reqHdr);
packet->AddHeader (actionHdr);
m_currentPacket = packet;
m_currentHdr = hdr;
uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
m_currentHdr.SetSequenceNumber (sequence);
m_currentHdr.SetFragmentNumber (0);
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
MacLowTransmissionParameters params;
params.EnableAck ();
params.DisableRts ();
params.DisableNextData ();
params.DisableOverrideDurationId ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr, params,
m_transmissionListener);
}
void
EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
{
WifiMacHeader hdr;
hdr.SetAction ();
hdr.SetAddr1 (addr);
hdr.SetAddr2 (m_low->GetAddress ());
hdr.SetAddr3 (m_low->GetAddress ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
MgtDelBaHeader delbaHdr;
delbaHdr.SetTid (tid);
if (byOriginator)
{
delbaHdr.SetByOriginator ();
}
else
{
delbaHdr.SetByRecipient ();
}
WifiActionHeader actionHdr;
WifiActionHeader::ActionValue action;
action.blockAck = WifiActionHeader::BLOCK_ACK_DELBA;
actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (delbaHdr);
packet->AddHeader (actionHdr);
PushFront (packet, hdr);
}
void
EdcaTxopN::DoStart ()
{
m_dcf->ResetCw ();
m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ()));
ns3::Dcf::DoStart ();
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/edca-txop-n.cc | C++ | gpl2 | 30,951 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef INTERFERENCE_HELPER_H
#define INTERFERENCE_HELPER_H
#include <stdint.h>
#include <vector>
#include <list>
#include "wifi-mode.h"
#include "wifi-preamble.h"
#include "wifi-phy-standard.h"
#include "ns3/nstime.h"
#include "ns3/simple-ref-count.h"
namespace ns3 {
class ErrorRateModel;
/**
* \ingroup wifi
* \brief handles interference calculations
*/
class InterferenceHelper
{
public:
class Event : public SimpleRefCount<InterferenceHelper::Event>
{
public:
Event (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower);
~Event ();
Time GetDuration (void) const;
Time GetStartTime (void) const;
Time GetEndTime (void) const;
double GetRxPowerW (void) const;
uint32_t GetSize (void) const;
WifiMode GetPayloadMode (void) const;
enum WifiPreamble GetPreambleType (void) const;
private:
uint32_t m_size;
WifiMode m_payloadMode;
enum WifiPreamble m_preamble;
Time m_startTime;
Time m_endTime;
double m_rxPowerW;
};
struct SnrPer
{
double snr;
double per;
};
InterferenceHelper ();
~InterferenceHelper ();
void SetNoiseFigure (double value);
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
double GetNoiseFigure (void) const;
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
/**
* \param energyW the minimum energy (W) requested
* \returns the expected amount of time the observed
* energy on the medium will be higher than
* the requested threshold.
*/
Time GetEnergyDuration (double energyW);
Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower);
struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr<InterferenceHelper::Event> event);
void NotifyRxStart ();
void NotifyRxEnd ();
void EraseEvents (void);
private:
class NiChange
{
public:
NiChange (Time time, double delta);
Time GetTime (void) const;
double GetDelta (void) const;
bool operator < (const NiChange& o) const;
private:
Time m_time;
double m_delta;
};
typedef std::vector <NiChange> NiChanges;
typedef std::list<Ptr<Event> > Events;
InterferenceHelper (const InterferenceHelper &o);
InterferenceHelper &operator = (const InterferenceHelper &o);
void AppendEvent (Ptr<Event> event);
double CalculateNoiseInterferenceW (Ptr<Event> event, NiChanges *ni) const;
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
double CalculatePer (Ptr<const Event> event, NiChanges *ni) const;
double m_noiseFigure; /**< noise figure (linear) */
Ptr<ErrorRateModel> m_errorRateModel;
///Experimental: needed for energy duration calculation
NiChanges m_niChanges;
double m_firstPower;
bool m_rxing;
/// Returns an iterator to the first nichange, which is later than moment
NiChanges::iterator GetPosition (Time moment);
void AddNiChangeEvent (NiChange change);
};
} // namespace ns3
#endif /* INTERFERENCE_HELPER_H */
| zy901002-gpsr | src/wifi/model/interference-helper.h | C++ | gpl2 | 4,050 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2004,2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "aarf-wifi-manager.h"
#include "ns3/double.h"
#include "ns3/uinteger.h"
#include "ns3/log.h"
#define Min(a,b) ((a < b) ? a : b)
#define Max(a,b) ((a > b) ? a : b)
NS_LOG_COMPONENT_DEFINE ("AarfWifiManager");
namespace ns3 {
struct AarfWifiRemoteStation : public WifiRemoteStation
{
uint32_t m_timer;
uint32_t m_success;
uint32_t m_failed;
bool m_recovery;
uint32_t m_retry;
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
uint32_t m_rate;
};
NS_OBJECT_ENSURE_REGISTERED (AarfWifiManager);
TypeId
AarfWifiManager::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::AarfWifiManager")
.SetParent<WifiRemoteStationManager> ()
.AddConstructor<AarfWifiManager> ()
.AddAttribute ("SuccessK", "Multiplication factor for the success threshold in the AARF algorithm.",
DoubleValue (2.0),
MakeDoubleAccessor (&AarfWifiManager::m_successK),
MakeDoubleChecker<double> ())
.AddAttribute ("TimerK",
"Multiplication factor for the timer threshold in the AARF algorithm.",
DoubleValue (2.0),
MakeDoubleAccessor (&AarfWifiManager::m_timerK),
MakeDoubleChecker<double> ())
.AddAttribute ("MaxSuccessThreshold",
"Maximum value of the success threshold in the AARF algorithm.",
UintegerValue (60),
MakeUintegerAccessor (&AarfWifiManager::m_maxSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinTimerThreshold",
"The minimum value for the 'timer' threshold in the AARF algorithm.",
UintegerValue (15),
MakeUintegerAccessor (&AarfWifiManager::m_minTimerThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MinSuccessThreshold",
"The minimum value for the success threshold in the AARF algorithm.",
UintegerValue (10),
MakeUintegerAccessor (&AarfWifiManager::m_minSuccessThreshold),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
AarfWifiManager::AarfWifiManager ()
{
}
AarfWifiManager::~AarfWifiManager ()
{
}
WifiRemoteStation *
AarfWifiManager::DoCreateStation (void) const
{
AarfWifiRemoteStation *station = new AarfWifiRemoteStation ();
station->m_successThreshold = m_minSuccessThreshold;
station->m_timerTimeout = m_minTimerThreshold;
station->m_rate = 0;
station->m_success = 0;
station->m_failed = 0;
station->m_recovery = false;
station->m_retry = 0;
station->m_timer = 0;
return station;
}
void
AarfWifiManager::DoReportRtsFailed (WifiRemoteStation *station)
{
}
/**
* It is important to realize that "recovery" mode starts after failure of
* the first transmission after a rate increase and ends at the first successful
* transmission. Specifically, recovery mode transcends retransmissions boundaries.
* Fundamentally, ARF handles each data transmission independently, whether it
* is the initial transmission of a packet or the retransmission of a packet.
* The fundamental reason for this is that there is a backoff between each data
* transmission, be it an initial transmission or a retransmission.
*/
void
AarfWifiManager::DoReportDataFailed (WifiRemoteStation *st)
{
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *)st;
station->m_timer++;
station->m_failed++;
station->m_retry++;
station->m_success = 0;
if (station->m_recovery)
{
NS_ASSERT (station->m_retry >= 1);
if (station->m_retry == 1)
{
// need recovery fallback
station->m_successThreshold = (int)(Min (station->m_successThreshold * m_successK,
m_maxSuccessThreshold));
station->m_timerTimeout = (int)(Max (station->m_timerTimeout * m_timerK,
m_minSuccessThreshold));
if (station->m_rate != 0)
{
station->m_rate--;
}
}
station->m_timer = 0;
}
else
{
NS_ASSERT (station->m_retry >= 1);
if (((station->m_retry - 1) % 2) == 1)
{
// need normal fallback
station->m_timerTimeout = m_minTimerThreshold;
station->m_successThreshold = m_minSuccessThreshold;
if (station->m_rate != 0)
{
station->m_rate--;
}
}
if (station->m_retry >= 2)
{
station->m_timer = 0;
}
}
}
void
AarfWifiManager::DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode)
{
}
void
AarfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr)
{
NS_LOG_DEBUG ("station=" << station << " rts ok");
}
void
AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
station->m_timer++;
station->m_success++;
station->m_failed = 0;
station->m_recovery = false;
station->m_retry = 0;
NS_LOG_DEBUG ("station=" << station << " data ok success=" << station->m_success << ", timer=" << station->m_timer);
if ((station->m_success == station->m_successThreshold
|| station->m_timer == station->m_timerTimeout)
&& (station->m_rate < (GetNSupported (station) - 1)))
{
NS_LOG_DEBUG ("station=" << station << " inc rate");
station->m_rate++;
station->m_timer = 0;
station->m_success = 0;
station->m_recovery = true;
}
}
void
AarfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
{
}
void
AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
{
}
WifiMode
AarfWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
{
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
return GetSupported (station, station->m_rate);
}
WifiMode
AarfWifiManager::DoGetRtsMode (WifiRemoteStation *st)
{
// XXX: we could/should implement the Aarf algorithm for
// RTS only by picking a single rate within the BasicRateSet.
AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
return GetSupported (station, 0);
}
bool
AarfWifiManager::IsLowLatency (void) const
{
return true;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/aarf-wifi-manager.cc | C++ | gpl2 | 7,314 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "wifi-mode.h"
#include "ns3/simulator.h"
#include "ns3/assert.h"
#include "ns3/log.h"
namespace ns3 {
bool operator == (const WifiMode &a, const WifiMode &b)
{
return a.GetUid () == b.GetUid ();
}
std::ostream & operator << (std::ostream & os, const WifiMode &mode)
{
os << mode.GetUniqueName ();
return os;
}
std::istream & operator >> (std::istream &is, WifiMode &mode)
{
std::string str;
is >> str;
mode = WifiModeFactory::GetFactory ()->Search (str);
return is;
}
uint32_t
WifiMode::GetBandwidth (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->bandwidth;
}
uint64_t
WifiMode::GetPhyRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->phyRate;
}
uint64_t
WifiMode::GetDataRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->dataRate;
}
enum WifiCodeRate
WifiMode::GetCodeRate (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->codingRate;
}
uint8_t
WifiMode::GetConstellationSize (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->constellationSize;
}
std::string
WifiMode::GetUniqueName (void) const
{
// needed for ostream printing of the invalid mode
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->uniqueUid;
}
bool
WifiMode::IsMandatory (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->isMandatory;
}
uint32_t
WifiMode::GetUid (void) const
{
return m_uid;
}
enum WifiModulationClass
WifiMode::GetModulationClass () const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->modClass;
}
WifiMode::WifiMode ()
: m_uid (0)
{
}
WifiMode::WifiMode (uint32_t uid)
: m_uid (uid)
{
}
WifiMode::WifiMode (std::string name)
{
*this = WifiModeFactory::GetFactory ()->Search (name);
}
ATTRIBUTE_HELPER_CPP (WifiMode);
WifiModeFactory::WifiModeFactory ()
{
}
WifiMode
WifiModeFactory::CreateWifiMode (std::string uniqueName,
enum WifiModulationClass modClass,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
enum WifiCodeRate codingRate,
uint8_t constellationSize)
{
WifiModeFactory *factory = GetFactory ();
uint32_t uid = factory->AllocateUid (uniqueName);
WifiModeItem *item = factory->Get (uid);
item->uniqueUid = uniqueName;
item->modClass = modClass;
// The modulation class for this WifiMode must be valid.
NS_ASSERT (modClass != WIFI_MOD_CLASS_UNKNOWN);
item->bandwidth = bandwidth;
item->dataRate = dataRate;
item->codingRate = codingRate;
switch (codingRate)
{
case WIFI_CODE_RATE_3_4:
item->phyRate = dataRate * 4 / 3;
break;
case WIFI_CODE_RATE_2_3:
item->phyRate = dataRate * 3 / 2;
break;
case WIFI_CODE_RATE_1_2:
item->phyRate = dataRate * 2 / 1;
break;
case WIFI_CODE_RATE_UNDEFINED:
default:
item->phyRate = dataRate;
break;
}
// Check for compatibility between modulation class and coding
// rate. If modulation class is DSSS then coding rate must be
// undefined, and vice versa. I could have done this with an
// assertion, but it seems better to always give the error (i.e.,
// not only in non-optimised builds) and the cycles that extra test
// here costs are only suffered at simulation setup.
if ((codingRate == WIFI_CODE_RATE_UNDEFINED) != (modClass == WIFI_MOD_CLASS_DSSS))
{
NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
<< "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS");
}
item->constellationSize = constellationSize;
item->isMandatory = isMandatory;
return WifiMode (uid);
}
WifiMode
WifiModeFactory::Search (std::string name)
{
WifiModeItemList::const_iterator i;
uint32_t j = 0;
for (i = m_itemList.begin (); i != m_itemList.end (); i++)
{
if (i->uniqueUid == name)
{
return WifiMode (j);
}
j++;
}
// If we get here then a matching WifiMode was not found above. This
// is a fatal problem, but we try to be helpful by displaying the
// list of WifiModes that are supported.
NS_LOG_UNCOND ("Could not find match for WifiMode named \""
<< name << "\". Valid options are:");
for (i = m_itemList.begin (); i != m_itemList.end (); i++)
{
NS_LOG_UNCOND (" " << i->uniqueUid);
}
// Empty fatal error to die. We've already unconditionally logged
// the helpful information.
NS_FATAL_ERROR ("");
// This next line is unreachable because of the fatal error
// immediately above, and that is fortunate, because we have no idea
// what is in WifiMode (0), but we do know it is not what our caller
// has requested by name. It's here only because it's the safest
// thing that'll give valid code.
return WifiMode (0);
}
uint32_t
WifiModeFactory::AllocateUid (std::string uniqueUid)
{
uint32_t j = 0;
for (WifiModeItemList::const_iterator i = m_itemList.begin ();
i != m_itemList.end (); i++)
{
if (i->uniqueUid == uniqueUid)
{
return j;
}
j++;
}
uint32_t uid = m_itemList.size ();
m_itemList.push_back (WifiModeItem ());
return uid;
}
struct WifiModeFactory::WifiModeItem *
WifiModeFactory::Get (uint32_t uid)
{
NS_ASSERT (uid < m_itemList.size ());
return &m_itemList[uid];
}
WifiModeFactory *
WifiModeFactory::GetFactory (void)
{
static bool isFirstTime = true;
static WifiModeFactory factory;
if (isFirstTime)
{
uint32_t uid = factory.AllocateUid ("Invalid-WifiMode");
WifiModeItem *item = factory.Get (uid);
item->uniqueUid = "Invalid-WifiMode";
item->bandwidth = 0;
item->dataRate = 0;
item->phyRate = 0;
item->modClass = WIFI_MOD_CLASS_UNKNOWN;
item->constellationSize = 0;
item->codingRate = WIFI_CODE_RATE_UNDEFINED;
item->isMandatory = false;
isFirstTime = false;
}
return &factory;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/wifi-mode.cc | C++ | gpl2 | 7,397 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "wifi-phy-state-helper.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/trace-source-accessor.h"
NS_LOG_COMPONENT_DEFINE ("WifiPhyStateHelper");
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (WifiPhyStateHelper);
TypeId
WifiPhyStateHelper::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiPhyStateHelper")
.SetParent<Object> ()
.AddConstructor<WifiPhyStateHelper> ()
.AddTraceSource ("State",
"The state of the PHY layer",
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_stateLogger))
.AddTraceSource ("RxOk",
"A packet has been received successfully.",
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_rxOkTrace))
.AddTraceSource ("RxError",
"A packet has been received unsuccessfully.",
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_rxErrorTrace))
.AddTraceSource ("Tx", "Packet transmission is starting.",
MakeTraceSourceAccessor (&WifiPhyStateHelper::m_txTrace))
;
return tid;
}
WifiPhyStateHelper::WifiPhyStateHelper ()
: m_rxing (false),
m_endTx (Seconds (0)),
m_endRx (Seconds (0)),
m_endCcaBusy (Seconds (0)),
m_endSwitching (Seconds (0)),
m_startTx (Seconds (0)),
m_startRx (Seconds (0)),
m_startCcaBusy (Seconds (0)),
m_startSwitching (Seconds (0)),
m_previousStateChangeTime (Seconds (0))
{
NS_LOG_FUNCTION (this);
}
void
WifiPhyStateHelper::SetReceiveOkCallback (WifiPhy::RxOkCallback callback)
{
m_rxOkCallback = callback;
}
void
WifiPhyStateHelper::SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback)
{
m_rxErrorCallback = callback;
}
void
WifiPhyStateHelper::RegisterListener (WifiPhyListener *listener)
{
m_listeners.push_back (listener);
}
bool
WifiPhyStateHelper::IsStateIdle (void)
{
return (GetState () == WifiPhy::IDLE);
}
bool
WifiPhyStateHelper::IsStateBusy (void)
{
return (GetState () != WifiPhy::IDLE);
}
bool
WifiPhyStateHelper::IsStateCcaBusy (void)
{
return (GetState () == WifiPhy::CCA_BUSY);
}
bool
WifiPhyStateHelper::IsStateRx (void)
{
return (GetState () == WifiPhy::RX);
}
bool
WifiPhyStateHelper::IsStateTx (void)
{
return (GetState () == WifiPhy::TX);
}
bool
WifiPhyStateHelper::IsStateSwitching (void)
{
return (GetState () == WifiPhy::SWITCHING);
}
Time
WifiPhyStateHelper::GetStateDuration (void)
{
return Simulator::Now () - m_previousStateChangeTime;
}
Time
WifiPhyStateHelper::GetDelayUntilIdle (void)
{
Time retval;
switch (GetState ())
{
case WifiPhy::RX:
retval = m_endRx - Simulator::Now ();
break;
case WifiPhy::TX:
retval = m_endTx - Simulator::Now ();
break;
case WifiPhy::CCA_BUSY:
retval = m_endCcaBusy - Simulator::Now ();
break;
case WifiPhy::SWITCHING:
retval = m_endSwitching - Simulator::Now ();
break;
case WifiPhy::IDLE:
retval = Seconds (0);
break;
default:
NS_FATAL_ERROR ("Invalid WifiPhy state.");
retval = Seconds (0);
break;
}
retval = Max (retval, Seconds (0));
return retval;
}
Time
WifiPhyStateHelper::GetLastRxStartTime (void) const
{
return m_startRx;
}
enum WifiPhy::State
WifiPhyStateHelper::GetState (void)
{
if (m_endTx > Simulator::Now ())
{
return WifiPhy::TX;
}
else if (m_rxing)
{
return WifiPhy::RX;
}
else if (m_endSwitching > Simulator::Now ())
{
return WifiPhy::SWITCHING;
}
else if (m_endCcaBusy > Simulator::Now ())
{
return WifiPhy::CCA_BUSY;
}
else
{
return WifiPhy::IDLE;
}
}
void
WifiPhyStateHelper::NotifyTxStart (Time duration)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifyTxStart (duration);
}
}
void
WifiPhyStateHelper::NotifyRxStart (Time duration)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifyRxStart (duration);
}
}
void
WifiPhyStateHelper::NotifyRxEndOk (void)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifyRxEndOk ();
}
}
void
WifiPhyStateHelper::NotifyRxEndError (void)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifyRxEndError ();
}
}
void
WifiPhyStateHelper::NotifyMaybeCcaBusyStart (Time duration)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifyMaybeCcaBusyStart (duration);
}
}
void
WifiPhyStateHelper::NotifySwitchingStart (Time duration)
{
for (Listeners::const_iterator i = m_listeners.begin (); i != m_listeners.end (); i++)
{
(*i)->NotifySwitchingStart (duration);
}
}
void
WifiPhyStateHelper::LogPreviousIdleAndCcaBusyStates (void)
{
Time now = Simulator::Now ();
Time idleStart = Max (m_endCcaBusy, m_endRx);
idleStart = Max (idleStart, m_endTx);
idleStart = Max (idleStart, m_endSwitching);
NS_ASSERT (idleStart <= now);
if (m_endCcaBusy > m_endRx
&& m_endCcaBusy > m_endSwitching
&& m_endCcaBusy > m_endTx)
{
Time ccaBusyStart = Max (m_endTx, m_endRx);
ccaBusyStart = Max (ccaBusyStart, m_startCcaBusy);
ccaBusyStart = Max (ccaBusyStart, m_endSwitching);
m_stateLogger (ccaBusyStart, idleStart - ccaBusyStart, WifiPhy::CCA_BUSY);
}
m_stateLogger (idleStart, now - idleStart, WifiPhy::IDLE);
}
void
WifiPhyStateHelper::SwitchToTx (Time txDuration, Ptr<const Packet> packet, WifiMode txMode,
WifiPreamble preamble, uint8_t txPower)
{
m_txTrace (packet, txMode, preamble, txPower);
NotifyTxStart (txDuration);
Time now = Simulator::Now ();
switch (GetState ())
{
case WifiPhy::RX:
/* The packet which is being received as well
* as its endRx event are cancelled by the caller.
*/
m_rxing = false;
m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
m_endRx = now;
break;
case WifiPhy::CCA_BUSY:
{
Time ccaStart = Max (m_endRx, m_endTx);
ccaStart = Max (ccaStart, m_startCcaBusy);
ccaStart = Max (ccaStart, m_endSwitching);
m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
} break;
case WifiPhy::IDLE:
LogPreviousIdleAndCcaBusyStates ();
break;
case WifiPhy::SWITCHING:
default:
NS_FATAL_ERROR ("Invalid WifiPhy state.");
break;
}
m_stateLogger (now, txDuration, WifiPhy::TX);
m_previousStateChangeTime = now;
m_endTx = now + txDuration;
m_startTx = now;
}
void
WifiPhyStateHelper::SwitchToRx (Time rxDuration)
{
NS_ASSERT (IsStateIdle () || IsStateCcaBusy ());
NS_ASSERT (!m_rxing);
NotifyRxStart (rxDuration);
Time now = Simulator::Now ();
switch (GetState ())
{
case WifiPhy::IDLE:
LogPreviousIdleAndCcaBusyStates ();
break;
case WifiPhy::CCA_BUSY:
{
Time ccaStart = Max (m_endRx, m_endTx);
ccaStart = Max (ccaStart, m_startCcaBusy);
ccaStart = Max (ccaStart, m_endSwitching);
m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
} break;
case WifiPhy::SWITCHING:
case WifiPhy::RX:
case WifiPhy::TX:
NS_FATAL_ERROR ("Invalid WifiPhy state.");
break;
}
m_previousStateChangeTime = now;
m_rxing = true;
m_startRx = now;
m_endRx = now + rxDuration;
NS_ASSERT (IsStateRx ());
}
void
WifiPhyStateHelper::SwitchToChannelSwitching (Time switchingDuration)
{
NotifySwitchingStart (switchingDuration);
Time now = Simulator::Now ();
switch (GetState ())
{
case WifiPhy::RX:
/* The packet which is being received as well
* as its endRx event are cancelled by the caller.
*/
m_rxing = false;
m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
m_endRx = now;
break;
case WifiPhy::CCA_BUSY:
{
Time ccaStart = Max (m_endRx, m_endTx);
ccaStart = Max (ccaStart, m_startCcaBusy);
ccaStart = Max (ccaStart, m_endSwitching);
m_stateLogger (ccaStart, now - ccaStart, WifiPhy::CCA_BUSY);
} break;
case WifiPhy::IDLE:
LogPreviousIdleAndCcaBusyStates ();
break;
case WifiPhy::TX:
case WifiPhy::SWITCHING:
default:
NS_FATAL_ERROR ("Invalid WifiPhy state.");
break;
}
if (now < m_endCcaBusy)
{
m_endCcaBusy = now;
}
m_stateLogger (now, switchingDuration, WifiPhy::SWITCHING);
m_previousStateChangeTime = now;
m_startSwitching = now;
m_endSwitching = now + switchingDuration;
NS_ASSERT (IsStateSwitching ());
}
void
WifiPhyStateHelper::SwitchFromRxEndOk (Ptr<Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
{
m_rxOkTrace (packet, snr, mode, preamble);
NotifyRxEndOk ();
DoSwitchFromRx ();
if (!m_rxOkCallback.IsNull ())
{
m_rxOkCallback (packet, snr, mode, preamble);
}
}
void
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<const Packet> packet, double snr)
{
m_rxErrorTrace (packet, snr);
NotifyRxEndError ();
DoSwitchFromRx ();
if (!m_rxErrorCallback.IsNull ())
{
m_rxErrorCallback (packet, snr);
}
}
void
WifiPhyStateHelper::DoSwitchFromRx (void)
{
NS_ASSERT (IsStateRx ());
NS_ASSERT (m_rxing);
Time now = Simulator::Now ();
m_stateLogger (m_startRx, now - m_startRx, WifiPhy::RX);
m_previousStateChangeTime = now;
m_rxing = false;
NS_ASSERT (IsStateIdle () || IsStateCcaBusy ());
}
void
WifiPhyStateHelper::SwitchMaybeToCcaBusy (Time duration)
{
NotifyMaybeCcaBusyStart (duration);
Time now = Simulator::Now ();
switch (GetState ())
{
case WifiPhy::SWITCHING:
break;
case WifiPhy::IDLE:
LogPreviousIdleAndCcaBusyStates ();
break;
case WifiPhy::CCA_BUSY:
break;
case WifiPhy::RX:
break;
case WifiPhy::TX:
break;
}
m_startCcaBusy = now;
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/wifi-phy-state-helper.cc | C++ | gpl2 | 10,927 |
/* -*- 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>
*/
#ifndef CTRL_HEADERS_H
#define CTRL_HEADERS_H
#include "ns3/header.h"
namespace ns3 {
enum BlockAckType
{
BASIC_BLOCK_ACK,
COMPRESSED_BLOCK_ACK,
MULTI_TID_BLOCK_ACK
};
/**
* \ingroup wifi
* \brief Headers for Block ack request.
*
* 802.11n standard includes three types of block ack:
* - Basic block ack (unique type in 802.11e)
* - Compressed block ack
* - Multi-TID block ack
* For now only basic block ack and compressed block ack
* are supported.
* Basic block ack is also default variant.
*/
class CtrlBAckRequestHeader : public Header
{
public:
CtrlBAckRequestHeader ();
~CtrlBAckRequestHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
void SetHtImmediateAck (bool immediateAck);
void SetType (enum BlockAckType type);
void SetTidInfo (uint8_t tid);
void SetStartingSequence (uint16_t seq);
bool MustSendHtImmediateAck (void) const;
uint8_t GetTidInfo (void) const;
uint16_t GetStartingSequence (void) const;
bool IsBasic (void) const;
bool IsCompressed (void) const;
bool IsMultiTid (void) const;
uint16_t GetStartingSequenceControl (void) const;
private:
void SetStartingSequenceControl (uint16_t seqControl);
uint16_t GetBarControl (void) const;
void SetBarControl (uint16_t bar);
/**
* The lsb bit of the BAR control field is used only for the
* HT (High Throughput) delayed block ack configuration.
* For now only non HT immediate block ack is implemented so this field
* is here only for a future implementation of HT delayed variant.
*/
bool m_barAckPolicy;
bool m_multiTid;
bool m_compressed;
uint16_t m_tidInfo;
uint16_t m_startingSeq;
};
/**
* \ingroup wifi
* \brief Headers for Block ack response.
*
* 802.11n standard includes three types of block ack:
* - Basic block ack (unique type in 802.11e)
* - Compressed block ack
* - Multi-TID block ack
* For now only basic block ack and compressed block ack
* are supported.
* Basic block ack is also default variant.
*/
class CtrlBAckResponseHeader : public Header
{
public:
CtrlBAckResponseHeader ();
~CtrlBAckResponseHeader ();
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
void SetHtImmediateAck (bool immeadiateAck);
void SetType (enum BlockAckType type);
void SetTidInfo (uint8_t tid);
void SetStartingSequence (uint16_t seq);
bool MustSendHtImmediateAck (void) const;
uint8_t GetTidInfo (void) const;
uint16_t GetStartingSequence (void) const;
bool IsBasic (void) const;
bool IsCompressed (void) const;
bool IsMultiTid (void) const;
void SetReceivedPacket (uint16_t seq);
void SetReceivedFragment (uint16_t seq, uint8_t frag);
bool IsPacketReceived (uint16_t seq) const;
bool IsFragmentReceived (uint16_t seq, uint8_t frag) const;
uint16_t GetStartingSequenceControl (void) const;
void SetStartingSequenceControl (uint16_t seqControl);
const uint16_t* GetBitmap (void) const;
uint64_t GetCompressedBitmap (void) const;
void ResetBitmap (void);
private:
uint16_t GetBaControl (void) const;
void SetBaControl (uint16_t bar);
Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const;
Buffer::Iterator DeserializeBitmap (Buffer::Iterator start);
/**
* This function is used to correctly index in both bitmap
* and compressed bitmap, one bit or one block of 16 bits respectively.
*
* for more details see 7.2.1.8 in IEEE 802.11n/D4.00
*
* \param seq the sequence number
*
* \return If we are using basic block ack, return value represents index of
* block of 16 bits for packet having sequence number equals to <i>seq</i>.
* If we are using compressed block ack, return value represents bit
* to set to 1 in the compressed bitmap to indicate that packet having
* sequence number equals to <i>seq</i> was correctly received.
*/
uint8_t IndexInBitmap (uint16_t seq) const;
/**
* Checks if sequence number <i>seq</i> can be acknowledged in the bitmap.
*
* \param seq the sequence number
*
* \return
*/
bool IsInBitmap (uint16_t seq) const;
/**
* The lsb bit of the BA control field is used only for the
* HT (High Throughput) delayed block ack configuration.
* For now only non HT immediate block ack is implemented so this field
* is here only for a future implementation of HT delayed variant.
*/
bool m_baAckPolicy;
bool m_multiTid;
bool m_compressed;
uint16_t m_tidInfo;
uint16_t m_startingSeq;
union
{
uint16_t m_bitmap[64];
uint64_t m_compressedBitmap;
} bitmap;
};
} // namespace ns3
#endif /* CTRL_HEADERS_H */
| zy901002-gpsr | src/wifi/model/ctrl-headers.h | C++ | gpl2 | 5,894 |
/* -*- 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>
* Author: Cecchi Niccolò <insa@igeek.it>
*/
#include "qos-utils.h"
#include "qos-tag.h"
namespace ns3 {
AcIndex
QosUtilsMapTidToAc (uint8_t tid)
{
switch (tid)
{
case 0:
return AC_BE;
break;
case 1:
return AC_BK;
break;
case 2:
return AC_BK;
break;
case 3:
return AC_BE;
break;
case 4:
return AC_VI;
break;
case 5:
return AC_VI;
break;
case 6:
return AC_VO;
break;
case 7:
return AC_VO;
break;
}
return AC_UNDEF;
}
uint8_t
QosUtilsGetTidForPacket (Ptr<const Packet> packet)
{
QosTag qos;
uint8_t tid = 8;
if (packet->PeekPacketTag (qos))
{
if (qos.GetTid () < 8)
{
tid = qos.GetTid ();
}
}
return tid;
}
uint32_t
QosUtilsMapSeqControlToUniqueInteger (uint16_t seqControl, uint16_t endSequence)
{
uint32_t integer = 0;
uint16_t numberSeq = (seqControl >> 4) & 0x0fff;
integer = (4096 - (endSequence + 1) + numberSeq) % 4096;
integer *= 16;
integer += (seqControl & 0x000f);
return integer;
}
bool
QosUtilsIsOldPacket (uint16_t startingSeq, uint16_t seqNumber)
{
NS_ASSERT (startingSeq < 4096);
NS_ASSERT (seqNumber < 4096);
uint16_t distance = ((seqNumber - startingSeq) + 4096) % 4096;
return (distance >= 2048);
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/qos-utils.cc | C++ | gpl2 | 2,155 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 IITP RAS
*
* 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
*
* Authors: Kirill Andreev <andreev@iitp.ru>
* Pavel Boyko <boyko.iitp.ru>
*/
#ifndef WIFI_INFORMATION_ELEMENT_VECTOR_H
#define WIFI_INFORMATION_ELEMENT_VECTOR_H
#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
#include "ns3/wifi-information-element.h"
namespace ns3 {
/**
* \brief Information element vector
* \ingroup wifi
*
* Implements a vector of WifiInformationElements.
* Information elements typically come in groups, and the
* WifiInformationElementVector class provides a representation of a
* series of IEs, and the facility for serialisation to and
* deserialisation from the over-the-air format.
*/
class WifiInformationElementVector : public Header
{
public:
WifiInformationElementVector ();
~WifiInformationElementVector ();
///\name Inherited from Header
//\{
static TypeId GetTypeId ();
TypeId GetInstanceTypeId () const;
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
/**
* \attention When you use RemoveHeader, WifiInformationElementVector supposes, that
* all buffer consists of information elements
* @param start
* @return
*/
virtual uint32_t Deserialize (Buffer::Iterator start);
virtual void Print (std::ostream &os) const;
//\}
/**
* \brief Needed when you try to deserialize a lonely IE inside other header
* \param start is the start of the buffer
* \return deserialized bytes
*/
virtual uint32_t DeserializeSingleIe (Buffer::Iterator start);
///Set maximum size to control overflow of the max packet length
void SetMaxSize (uint16_t size);
/// As soon as this is a vector, we define an Iterator
typedef std::vector<Ptr<WifiInformationElement> >::iterator Iterator;
/// Returns Begin of the vector
Iterator Begin ();
/// Returns End of the vector
Iterator End ();
/// add an IE, if maxSize has exceeded, returns false
bool AddInformationElement (Ptr<WifiInformationElement> element);
/// vector of pointers to information elements is the body of IeVector
Ptr<WifiInformationElement> FindFirst (WifiInformationElementId id) const;
virtual bool operator== (const WifiInformationElementVector & a) const;
protected:
typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
/// Current number of bytes
uint32_t GetSize () const;
IE_VECTOR m_elements;
/// Size in bytes (actually, max packet length)
uint16_t m_maxSize;
};
}
#endif /* WIFI_INFORMATION_ELEMENT_VECTOR_H */
| zy901002-gpsr | src/wifi/model/wifi-information-element-vector.h | C++ | gpl2 | 3,235 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef RANDOM_STREAM_H
#define RANDOM_STREAM_H
#include <stdint.h>
#include <list>
#include "ns3/random-variable.h"
namespace ns3 {
/**
* A simple wrapper around RngStream to make testing
* of the code easier.
*/
class RandomStream
{
public:
virtual ~RandomStream ();
virtual uint32_t GetNext (uint32_t min, uint32_t max) = 0;
};
class RealRandomStream : public RandomStream
{
public:
RealRandomStream ();
virtual uint32_t GetNext (uint32_t min, uint32_t max);
private:
UniformVariable m_stream;
};
class TestRandomStream : public RandomStream
{
public:
void AddNext (uint32_t v);
virtual uint32_t GetNext (uint32_t min, uint32_t max);
private:
std::list<uint32_t> m_nexts;
};
} // namespace ns3
#endif /* RANDOM_STREAM_H */
| zy901002-gpsr | src/wifi/model/random-stream.h | C++ | gpl2 | 1,566 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include <math.h>
#include "dcf-manager.h"
#include "wifi-phy.h"
#include "wifi-mac.h"
#include "mac-low.h"
NS_LOG_COMPONENT_DEFINE ("DcfManager");
#define MY_DEBUG(x) \
NS_LOG_DEBUG (Simulator::Now () << " " << this << " " << x)
namespace ns3 {
/****************************************************************
* Implement the DCF state holder
****************************************************************/
DcfState::DcfState ()
: m_backoffSlots (0),
m_backoffStart (Seconds (0.0)),
m_cwMin (0),
m_cwMax (0),
m_cw (0),
m_accessRequested (false)
{
}
DcfState::~DcfState ()
{
}
void
DcfState::SetAifsn (uint32_t aifsn)
{
m_aifsn = aifsn;
}
void
DcfState::SetCwMin (uint32_t minCw)
{
m_cwMin = minCw;
ResetCw ();
}
void
DcfState::SetCwMax (uint32_t maxCw)
{
m_cwMax = maxCw;
ResetCw ();
}
uint32_t
DcfState::GetAifsn (void) const
{
return m_aifsn;
}
uint32_t
DcfState::GetCwMin (void) const
{
return m_cwMin;
}
uint32_t
DcfState::GetCwMax (void) const
{
return m_cwMax;
}
void
DcfState::ResetCw (void)
{
m_cw = m_cwMin;
}
void
DcfState::UpdateFailedCw (void)
{
// see 802.11-2007, section 9.9.1.5
m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
}
void
DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
{
m_backoffSlots -= nSlots;
m_backoffStart = backoffUpdateBound;
MY_DEBUG ("update slots=" << nSlots << " slots, backoff=" << m_backoffSlots);
}
void
DcfState::StartBackoffNow (uint32_t nSlots)
{
NS_ASSERT (m_backoffSlots == 0);
MY_DEBUG ("start backoff=" << nSlots << " slots");
m_backoffSlots = nSlots;
m_backoffStart = Simulator::Now ();
}
uint32_t
DcfState::GetCw (void) const
{
return m_cw;
}
uint32_t
DcfState::GetBackoffSlots (void) const
{
return m_backoffSlots;
}
Time
DcfState::GetBackoffStart (void) const
{
return m_backoffStart;
}
bool
DcfState::IsAccessRequested (void) const
{
return m_accessRequested;
}
void
DcfState::NotifyAccessRequested (void)
{
m_accessRequested = true;
}
void
DcfState::NotifyAccessGranted (void)
{
NS_ASSERT (m_accessRequested);
m_accessRequested = false;
DoNotifyAccessGranted ();
}
void
DcfState::NotifyCollision (void)
{
DoNotifyCollision ();
}
void
DcfState::NotifyInternalCollision (void)
{
DoNotifyInternalCollision ();
}
void
DcfState::NotifyChannelSwitching (void)
{
DoNotifyChannelSwitching ();
}
/***************************************************************
* Listener for Nav events. Forwards to DcfManager
***************************************************************/
class LowDcfListener : public ns3::MacLowDcfListener
{
public:
LowDcfListener (ns3::DcfManager *dcf)
: m_dcf (dcf)
{
}
virtual ~LowDcfListener ()
{
}
virtual void NavStart (Time duration)
{
m_dcf->NotifyNavStartNow (duration);
}
virtual void NavReset (Time duration)
{
m_dcf->NotifyNavResetNow (duration);
}
virtual void AckTimeoutStart (Time duration)
{
m_dcf->NotifyAckTimeoutStartNow (duration);
}
virtual void AckTimeoutReset ()
{
m_dcf->NotifyAckTimeoutResetNow ();
}
virtual void CtsTimeoutStart (Time duration)
{
m_dcf->NotifyCtsTimeoutStartNow (duration);
}
virtual void CtsTimeoutReset ()
{
m_dcf->NotifyCtsTimeoutResetNow ();
}
private:
ns3::DcfManager *m_dcf;
};
/***************************************************************
* Listener for PHY events. Forwards to DcfManager
***************************************************************/
class PhyListener : public ns3::WifiPhyListener
{
public:
PhyListener (ns3::DcfManager *dcf)
: m_dcf (dcf)
{
}
virtual ~PhyListener ()
{
}
virtual void NotifyRxStart (Time duration)
{
m_dcf->NotifyRxStartNow (duration);
}
virtual void NotifyRxEndOk (void)
{
m_dcf->NotifyRxEndOkNow ();
}
virtual void NotifyRxEndError (void)
{
m_dcf->NotifyRxEndErrorNow ();
}
virtual void NotifyTxStart (Time duration)
{
m_dcf->NotifyTxStartNow (duration);
}
virtual void NotifyMaybeCcaBusyStart (Time duration)
{
m_dcf->NotifyMaybeCcaBusyStartNow (duration);
}
virtual void NotifySwitchingStart (Time duration)
{
m_dcf->NotifySwitchingStartNow (duration);
}
private:
ns3::DcfManager *m_dcf;
};
/****************************************************************
* Implement the DCF manager of all DCF state holders
****************************************************************/
DcfManager::DcfManager ()
: m_lastAckTimeoutEnd (MicroSeconds (0)),
m_lastCtsTimeoutEnd (MicroSeconds (0)),
m_lastNavStart (MicroSeconds (0)),
m_lastNavDuration (MicroSeconds (0)),
m_lastRxStart (MicroSeconds (0)),
m_lastRxDuration (MicroSeconds (0)),
m_lastRxReceivedOk (true),
m_lastRxEnd (MicroSeconds (0)),
m_lastTxStart (MicroSeconds (0)),
m_lastTxDuration (MicroSeconds (0)),
m_lastBusyStart (MicroSeconds (0)),
m_lastBusyDuration (MicroSeconds (0)),
m_lastSwitchingStart (MicroSeconds (0)),
m_lastSwitchingDuration (MicroSeconds (0)),
m_rxing (false),
m_slotTimeUs (0),
m_sifs (Seconds (0.0)),
m_phyListener (0),
m_lowListener (0)
{
}
DcfManager::~DcfManager ()
{
delete m_phyListener;
delete m_lowListener;
m_phyListener = 0;
m_lowListener = 0;
}
void
DcfManager::SetupPhyListener (Ptr<WifiPhy> phy)
{
m_phyListener = new PhyListener (this);
phy->RegisterListener (m_phyListener);
}
void
DcfManager::SetupLowListener (Ptr<MacLow> low)
{
m_lowListener = new LowDcfListener (this);
low->RegisterDcfListener (m_lowListener);
}
void
DcfManager::SetSlot (Time slotTime)
{
m_slotTimeUs = slotTime.GetMicroSeconds ();
}
void
DcfManager::SetSifs (Time sifs)
{
m_sifs = sifs;
}
void
DcfManager::SetEifsNoDifs (Time eifsNoDifs)
{
m_eifsNoDifs = eifsNoDifs;
}
Time
DcfManager::GetEifsNoDifs () const
{
return m_eifsNoDifs;
}
void
DcfManager::Add (DcfState *dcf)
{
m_states.push_back (dcf);
}
Time
DcfManager::MostRecent (Time a, Time b) const
{
return Max (a, b);
}
Time
DcfManager::MostRecent (Time a, Time b, Time c) const
{
Time retval;
retval = Max (a, b);
retval = Max (retval, c);
return retval;
}
Time
DcfManager::MostRecent (Time a, Time b, Time c, Time d) const
{
Time e = Max (a, b);
Time f = Max (c, d);
Time retval = Max (e, f);
return retval;
}
Time
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const
{
Time g = Max (a, b);
Time h = Max (c, d);
Time i = Max (e, f);
Time k = Max (g, h);
Time retval = Max (k, i);
return retval;
}
Time
DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const
{
Time h = Max (a, b);
Time i = Max (c, d);
Time j = Max (e, f);
Time k = Max (h, i);
Time l = Max (j, g);
Time retval = Max (k, l);
return retval;
}
bool
DcfManager::IsBusy (void) const
{
// PHY busy
if (m_rxing)
{
return true;
}
Time lastTxEnd = m_lastTxStart + m_lastTxDuration;
if (lastTxEnd > Simulator::Now ())
{
return true;
}
// NAV busy
Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
if (lastNavEnd > Simulator::Now ())
{
return true;
}
return false;
}
void
DcfManager::RequestAccess (DcfState *state)
{
UpdateBackoff ();
NS_ASSERT (!state->IsAccessRequested ());
state->NotifyAccessRequested ();
/**
* If there is a collision, generate a backoff
* by notifying the collision to the user.
*/
if (state->GetBackoffSlots () == 0
&& IsBusy ())
{
MY_DEBUG ("medium is busy: collision");
/* someone else has accessed the medium.
* generate a backoff.
*/
state->NotifyCollision ();
}
DoGrantAccess ();
DoRestartAccessTimeoutIfNeeded ();
}
void
DcfManager::DoGrantAccess (void)
{
uint32_t k = 0;
for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
{
DcfState *state = *i;
if (state->IsAccessRequested ()
&& GetBackoffEndFor (state) <= Simulator::Now () )
{
/**
* This is the first dcf we find with an expired backoff and which
* needs access to the medium. i.e., it has data to send.
*/
MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots=" << state->GetBackoffSlots ());
i++; // go to the next item in the list.
k++;
std::vector<DcfState *> internalCollisionStates;
for (States::const_iterator j = i; j != m_states.end (); j++, k++)
{
DcfState *otherState = *j;
if (otherState->IsAccessRequested ()
&& GetBackoffEndFor (otherState) <= Simulator::Now ())
{
MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" <<
otherState->GetBackoffSlots ());
/**
* all other dcfs with a lower priority whose backoff
* has expired and which needed access to the medium
* must be notified that we did get an internal collision.
*/
internalCollisionStates.push_back (otherState);
}
}
/**
* Now, we notify all of these changes in one go. It is necessary to
* perform first the calculations of which states are colliding and then
* only apply the changes because applying the changes through notification
* could change the global state of the manager, and, thus, could change
* the result of the calculations.
*/
state->NotifyAccessGranted ();
for (std::vector<DcfState *>::const_iterator k = internalCollisionStates.begin ();
k != internalCollisionStates.end (); k++)
{
(*k)->NotifyInternalCollision ();
}
break;
}
i++;
}
}
void
DcfManager::AccessTimeout (void)
{
UpdateBackoff ();
DoGrantAccess ();
DoRestartAccessTimeoutIfNeeded ();
}
Time
DcfManager::GetAccessGrantStart (void) const
{
Time rxAccessStart;
if (!m_rxing)
{
rxAccessStart = m_lastRxEnd + m_sifs;
if (!m_lastRxReceivedOk)
{
rxAccessStart += m_eifsNoDifs;
}
}
else
{
rxAccessStart = m_lastRxStart + m_lastRxDuration + m_sifs;
}
Time busyAccessStart = m_lastBusyStart + m_lastBusyDuration + m_sifs;
Time txAccessStart = m_lastTxStart + m_lastTxDuration + m_sifs;
Time navAccessStart = m_lastNavStart + m_lastNavDuration + m_sifs;
Time ackTimeoutAccessStart = m_lastAckTimeoutEnd + m_sifs;
Time ctsTimeoutAccessStart = m_lastCtsTimeoutEnd + m_sifs;
Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs;
Time accessGrantedStart = MostRecent (rxAccessStart,
busyAccessStart,
txAccessStart,
navAccessStart,
ackTimeoutAccessStart,
ctsTimeoutAccessStart,
switchingAccessStart
);
NS_LOG_INFO ("access grant start=" << accessGrantedStart <<
", rx access start=" << rxAccessStart <<
", busy access start=" << busyAccessStart <<
", tx access start=" << txAccessStart <<
", nav access start=" << navAccessStart);
return accessGrantedStart;
}
Time
DcfManager::GetBackoffStartFor (DcfState *state)
{
Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
return mostRecentEvent;
}
Time
DcfManager::GetBackoffEndFor (DcfState *state)
{
return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs);
}
void
DcfManager::UpdateBackoff (void)
{
uint32_t k = 0;
for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++)
{
DcfState *state = *i;
Time backoffStart = GetBackoffStartFor (state);
if (backoffStart <= Simulator::Now ())
{
uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds ();
uint32_t nIntSlots = nus / m_slotTimeUs;
uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs);
state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
}
}
}
void
DcfManager::DoRestartAccessTimeoutIfNeeded (void)
{
/**
* Is there a DcfState which needs to access the medium, and,
* if there is one, how many slots for AIFS+backoff does it require ?
*/
bool accessTimeoutNeeded = false;
Time expectedBackoffEnd = Simulator::GetMaximumSimulationTime ();
for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++)
{
DcfState *state = *i;
if (state->IsAccessRequested ())
{
Time tmp = GetBackoffEndFor (state);
if (tmp > Simulator::Now ())
{
accessTimeoutNeeded = true;
expectedBackoffEnd = std::min (expectedBackoffEnd, tmp);
}
}
}
if (accessTimeoutNeeded)
{
MY_DEBUG ("expected backoff end=" << expectedBackoffEnd);
Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now ();
if (m_accessTimeout.IsRunning ()
&& Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay)
{
m_accessTimeout.Cancel ();
}
if (m_accessTimeout.IsExpired ())
{
m_accessTimeout = Simulator::Schedule (expectedBackoffDelay,
&DcfManager::AccessTimeout, this);
}
}
}
void
DcfManager::NotifyRxStartNow (Time duration)
{
MY_DEBUG ("rx start for=" << duration);
UpdateBackoff ();
m_lastRxStart = Simulator::Now ();
m_lastRxDuration = duration;
m_rxing = true;
}
void
DcfManager::NotifyRxEndOkNow (void)
{
MY_DEBUG ("rx end ok");
m_lastRxEnd = Simulator::Now ();
m_lastRxReceivedOk = true;
m_rxing = false;
}
void
DcfManager::NotifyRxEndErrorNow (void)
{
MY_DEBUG ("rx end error");
m_lastRxEnd = Simulator::Now ();
m_lastRxReceivedOk = false;
m_rxing = false;
}
void
DcfManager::NotifyTxStartNow (Time duration)
{
if (m_rxing)
{
//this may be caused only if PHY has started to receive a packet
//inside SIFS, so, we check that lastRxStart was maximum a SIFS
//ago
NS_ASSERT (Simulator::Now () - m_lastRxStart <= m_sifs);
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = true;
m_rxing = false;
}
MY_DEBUG ("tx start for " << duration);
UpdateBackoff ();
m_lastTxStart = Simulator::Now ();
m_lastTxDuration = duration;
}
void
DcfManager::NotifyMaybeCcaBusyStartNow (Time duration)
{
MY_DEBUG ("busy start for " << duration);
UpdateBackoff ();
m_lastBusyStart = Simulator::Now ();
m_lastBusyDuration = duration;
}
void
DcfManager::NotifySwitchingStartNow (Time duration)
{
Time now = Simulator::Now ();
NS_ASSERT (m_lastTxStart + m_lastTxDuration <= now);
NS_ASSERT (m_lastSwitchingStart + m_lastSwitchingDuration <= now);
if (m_rxing)
{
// channel switching during packet reception
m_lastRxEnd = Simulator::Now ();
m_lastRxDuration = m_lastRxEnd - m_lastRxStart;
m_lastRxReceivedOk = true;
m_rxing = false;
}
if (m_lastNavStart + m_lastNavDuration > now)
{
m_lastNavDuration = now - m_lastNavStart;
}
if (m_lastBusyStart + m_lastBusyDuration > now)
{
m_lastBusyDuration = now - m_lastBusyStart;
}
if (m_lastAckTimeoutEnd > now)
{
m_lastAckTimeoutEnd = now;
}
if (m_lastCtsTimeoutEnd > now)
{
m_lastCtsTimeoutEnd = now;
}
// Cancel timeout
if (m_accessTimeout.IsRunning ())
{
m_accessTimeout.Cancel ();
}
// Reset backoffs
for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
{
DcfState *state = *i;
uint32_t remainingSlots = state->GetBackoffSlots ();
if (remainingSlots > 0)
{
state->UpdateBackoffSlotsNow (remainingSlots, now);
NS_ASSERT (state->GetBackoffSlots () == 0);
}
state->ResetCw ();
state->m_accessRequested = false;
state->NotifyChannelSwitching ();
}
MY_DEBUG ("switching start for " << duration);
m_lastSwitchingStart = Simulator::Now ();
m_lastSwitchingDuration = duration;
}
void
DcfManager::NotifyNavResetNow (Time duration)
{
MY_DEBUG ("nav reset for=" << duration);
UpdateBackoff ();
m_lastNavStart = Simulator::Now ();
m_lastNavDuration = duration;
UpdateBackoff ();
/**
* If the nav reset indicates an end-of-nav which is earlier
* than the previous end-of-nav, the expected end of backoff
* might be later than previously thought so, we might need
* to restart a new access timeout.
*/
DoRestartAccessTimeoutIfNeeded ();
}
void
DcfManager::NotifyNavStartNow (Time duration)
{
NS_ASSERT (m_lastNavStart < Simulator::Now ());
MY_DEBUG ("nav start for=" << duration);
UpdateBackoff ();
Time newNavEnd = Simulator::Now () + duration;
Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
if (newNavEnd > lastNavEnd)
{
m_lastNavStart = Simulator::Now ();
m_lastNavDuration = duration;
}
}
void
DcfManager::NotifyAckTimeoutStartNow (Time duration)
{
NS_ASSERT (m_lastAckTimeoutEnd < Simulator::Now ());
m_lastAckTimeoutEnd = Simulator::Now () + duration;
}
void
DcfManager::NotifyAckTimeoutResetNow ()
{
m_lastAckTimeoutEnd = Simulator::Now ();
DoRestartAccessTimeoutIfNeeded ();
}
void
DcfManager::NotifyCtsTimeoutStartNow (Time duration)
{
m_lastCtsTimeoutEnd = Simulator::Now () + duration;
}
void
DcfManager::NotifyCtsTimeoutResetNow ()
{
m_lastCtsTimeoutEnd = Simulator::Now ();
DoRestartAccessTimeoutIfNeeded ();
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/dcf-manager.cc | C++ | gpl2 | 19,179 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#include "sta-wifi-mac.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
#include "ns3/boolean.h"
#include "ns3/trace-source-accessor.h"
#include "qos-tag.h"
#include "mac-low.h"
#include "dcf-manager.h"
#include "mac-rx-middle.h"
#include "mac-tx-middle.h"
#include "wifi-mac-header.h"
#include "msdu-aggregator.h"
#include "amsdu-subframe-header.h"
#include "mgt-headers.h"
NS_LOG_COMPONENT_DEFINE ("StaWifiMac");
/*
* The state machine for this STA is:
-------------- -----------
| Associated | <-------------------- -------> | Refused |
-------------- \ / -----------
\ \ /
\ ----------------- -----------------------------
\-> | Beacon Missed | --> | Wait Association Response |
----------------- -----------------------------
\ ^
\ |
\ -----------------------
\-> | Wait Probe Response |
-----------------------
*/
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (StaWifiMac);
TypeId
StaWifiMac::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::StaWifiMac")
.SetParent<RegularWifiMac> ()
.AddConstructor<StaWifiMac> ()
.AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.",
TimeValue (Seconds (0.05)),
MakeTimeAccessor (&StaWifiMac::m_probeRequestTimeout),
MakeTimeChecker ())
.AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.",
TimeValue (Seconds (0.5)),
MakeTimeAccessor (&StaWifiMac::m_assocRequestTimeout),
MakeTimeChecker ())
.AddAttribute ("MaxMissedBeacons",
"Number of beacons which much be consecutively missed before "
"we attempt to restart association.",
UintegerValue (10),
MakeUintegerAccessor (&StaWifiMac::m_maxMissedBeacons),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't. NOTE: if more than one STA in your simulation is using active probing, you should enable it at a different simulation time for each STA, otherwise all the STAs will start sending probes at the same time resulting in collisions. See bug 1060 for more info.",
BooleanValue (false),
MakeBooleanAccessor (&StaWifiMac::SetActiveProbing),
MakeBooleanChecker ())
.AddTraceSource ("Assoc", "Associated with an access point.",
MakeTraceSourceAccessor (&StaWifiMac::m_assocLogger))
.AddTraceSource ("DeAssoc", "Association with an access point lost.",
MakeTraceSourceAccessor (&StaWifiMac::m_deAssocLogger))
;
return tid;
}
StaWifiMac::StaWifiMac ()
: m_state (BEACON_MISSED),
m_probeRequestEvent (),
m_assocRequestEvent (),
m_beaconWatchdogEnd (Seconds (0.0))
{
NS_LOG_FUNCTION (this);
// Let the lower layers know that we are acting as a non-AP STA in
// an infrastructure BSS.
SetTypeOfStation (STA);
}
StaWifiMac::~StaWifiMac ()
{
NS_LOG_FUNCTION (this);
}
void
StaWifiMac::SetMaxMissedBeacons (uint32_t missed)
{
NS_LOG_FUNCTION (this << missed);
m_maxMissedBeacons = missed;
}
void
StaWifiMac::SetProbeRequestTimeout (Time timeout)
{
NS_LOG_FUNCTION (this << timeout);
m_probeRequestTimeout = timeout;
}
void
StaWifiMac::SetAssocRequestTimeout (Time timeout)
{
NS_LOG_FUNCTION (this << timeout);
m_assocRequestTimeout = timeout;
}
void
StaWifiMac::StartActiveAssociation (void)
{
NS_LOG_FUNCTION (this);
TryToEnsureAssociated ();
}
void
StaWifiMac::SetActiveProbing (bool enable)
{
NS_LOG_FUNCTION (this << enable);
if (enable)
{
Simulator::ScheduleNow (&StaWifiMac::TryToEnsureAssociated, this);
}
else
{
m_probeRequestEvent.Cancel ();
}
}
void
StaWifiMac::SendProbeRequest (void)
{
NS_LOG_FUNCTION (this);
WifiMacHeader hdr;
hdr.SetProbeReq ();
hdr.SetAddr1 (Mac48Address::GetBroadcast ());
hdr.SetAddr2 (GetAddress ());
hdr.SetAddr3 (Mac48Address::GetBroadcast ());
hdr.SetDsNotFrom ();
hdr.SetDsNotTo ();
Ptr<Packet> packet = Create<Packet> ();
MgtProbeRequestHeader probe;
probe.SetSsid (GetSsid ());
probe.SetSupportedRates (GetSupportedRates ());
packet->AddHeader (probe);
// The standard is not clear on the correct queue for management
// frames if we are a QoS AP. The approach taken here is to always
// use the DCF for these regardless of whether we have a QoS
// association or not.
m_dca->Queue (packet, hdr);
m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout,
&StaWifiMac::ProbeRequestTimeout, this);
}
void
StaWifiMac::SendAssociationRequest (void)
{
NS_LOG_FUNCTION (this << GetBssid ());
WifiMacHeader hdr;
hdr.SetAssocReq ();
hdr.SetAddr1 (GetBssid ());
hdr.SetAddr2 (GetAddress ());
hdr.SetAddr3 (GetBssid ());
hdr.SetDsNotFrom ();
hdr.SetDsNotTo ();
Ptr<Packet> packet = Create<Packet> ();
MgtAssocRequestHeader assoc;
assoc.SetSsid (GetSsid ());
assoc.SetSupportedRates (GetSupportedRates ());
packet->AddHeader (assoc);
// The standard is not clear on the correct queue for management
// frames if we are a QoS AP. The approach taken here is to always
// use the DCF for these regardless of whether we have a QoS
// association or not.
m_dca->Queue (packet, hdr);
m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout,
&StaWifiMac::AssocRequestTimeout, this);
}
void
StaWifiMac::TryToEnsureAssociated (void)
{
NS_LOG_FUNCTION (this);
switch (m_state)
{
case ASSOCIATED:
return;
break;
case WAIT_PROBE_RESP:
/* we have sent a probe request earlier so we
do not need to re-send a probe request immediately.
We just need to wait until probe-request-timeout
or until we get a probe response
*/
break;
case BEACON_MISSED:
/* we were associated but we missed a bunch of beacons
* so we should assume we are not associated anymore.
* We try to initiate a probe request now.
*/
m_linkDown ();
SetState (WAIT_PROBE_RESP);
SendProbeRequest ();
break;
case WAIT_ASSOC_RESP:
/* we have sent an assoc request so we do not need to
re-send an assoc request right now. We just need to
wait until either assoc-request-timeout or until
we get an assoc response.
*/
break;
case REFUSED:
/* we have sent an assoc request and received a negative
assoc resp. We wait until someone restarts an
association with a given ssid.
*/
break;
}
}
void
StaWifiMac::AssocRequestTimeout (void)
{
NS_LOG_FUNCTION (this);
SetState (WAIT_ASSOC_RESP);
SendAssociationRequest ();
}
void
StaWifiMac::ProbeRequestTimeout (void)
{
NS_LOG_FUNCTION (this);
SetState (WAIT_PROBE_RESP);
SendProbeRequest ();
}
void
StaWifiMac::MissedBeacons (void)
{
NS_LOG_FUNCTION (this);
if (m_beaconWatchdogEnd > Simulator::Now ())
{
m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (),
&StaWifiMac::MissedBeacons, this);
return;
}
NS_LOG_DEBUG ("beacon missed");
SetState (BEACON_MISSED);
TryToEnsureAssociated ();
}
void
StaWifiMac::RestartBeaconWatchdog (Time delay)
{
NS_LOG_FUNCTION (this << delay);
m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd);
if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay
&& m_beaconWatchdog.IsExpired ())
{
NS_LOG_DEBUG ("really restart watchdog.");
m_beaconWatchdog = Simulator::Schedule (delay, &StaWifiMac::MissedBeacons, this);
}
}
bool
StaWifiMac::IsAssociated (void) const
{
return m_state == ASSOCIATED;
}
bool
StaWifiMac::IsWaitAssocResp (void) const
{
return m_state == WAIT_ASSOC_RESP;
}
void
StaWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
{
NS_LOG_FUNCTION (this << packet << to);
if (!IsAssociated ())
{
NotifyTxDrop (packet);
TryToEnsureAssociated ();
return;
}
WifiMacHeader hdr;
// If we are not a QoS AP then we definitely want to use AC_BE to
// transmit the packet. A TID of zero will map to AC_BE (through \c
// QosUtilsMapTidToAc()), so we use that as our default here.
uint8_t tid = 0;
// For now, an AP that supports QoS does not support non-QoS
// associations, and vice versa. In future the AP model should
// support simultaneously associated QoS and non-QoS STAs, at which
// point there will need to be per-association QoS state maintained
// by the association state machine, and consulted here.
if (m_qosSupported)
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
hdr.SetQosNoEosp ();
hdr.SetQosNoAmsdu ();
// Transmission of multiple frames in the same TXOP is not
// supported for now
hdr.SetQosTxopLimit (0);
// Fill in the QoS control field in the MAC header
tid = QosUtilsGetTidForPacket (packet);
// Any value greater than 7 is invalid and likely indicates that
// the packet had no QoS tag, so we revert to zero, which'll
// mean that AC_BE is used.
if (tid >= 7)
{
tid = 0;
}
hdr.SetQosTid (tid);
}
else
{
hdr.SetTypeData ();
}
hdr.SetAddr1 (GetBssid ());
hdr.SetAddr2 (m_low->GetAddress ());
hdr.SetAddr3 (to);
hdr.SetDsNotFrom ();
hdr.SetDsTo ();
if (m_qosSupported)
{
// Sanity check that the TID is valid
NS_ASSERT (tid < 8);
m_edca[QosUtilsMapTidToAc (tid)]->Queue (packet, hdr);
}
else
{
m_dca->Queue (packet, hdr);
}
}
void
StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
{
NS_LOG_FUNCTION (this << packet << hdr);
NS_ASSERT (!hdr->IsCtl ());
if (hdr->GetAddr3 () == GetAddress ())
{
NS_LOG_LOGIC ("packet sent by us.");
return;
}
else if (hdr->GetAddr1 () != GetAddress ()
&& !hdr->GetAddr1 ().IsGroup ())
{
NS_LOG_LOGIC ("packet is not for us");
NotifyRxDrop (packet);
return;
}
else if (hdr->IsData ())
{
if (!IsAssociated ())
{
NS_LOG_LOGIC ("Received data frame while not associated: ignore");
NotifyRxDrop (packet);
return;
}
if (!(hdr->IsFromDs () && !hdr->IsToDs ()))
{
NS_LOG_LOGIC ("Received data frame not from the DS: ignore");
NotifyRxDrop (packet);
return;
}
if (hdr->GetAddr2 () != GetBssid ())
{
NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
NotifyRxDrop (packet);
return;
}
if (hdr->IsQosData ())
{
if (hdr->IsQosAmsdu ())
{
NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
DeaggregateAmsduAndForward (packet, hdr);
packet = 0;
}
else
{
ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
}
}
else
{
ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ());
}
return;
}
else if (hdr->IsProbeReq ()
|| hdr->IsAssocReq ())
{
// This is a frame aimed at an AP, so we can safely ignore it.
NotifyRxDrop (packet);
return;
}
else if (hdr->IsBeacon ())
{
MgtBeaconHeader beacon;
packet->RemoveHeader (beacon);
bool goodBeacon = false;
if (GetSsid ().IsBroadcast ()
|| beacon.GetSsid ().IsEqual (GetSsid ()))
{
goodBeacon = true;
}
if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
{
goodBeacon = false;
}
if (goodBeacon)
{
Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons);
RestartBeaconWatchdog (delay);
SetBssid (hdr->GetAddr3 ());
}
if (goodBeacon && m_state == BEACON_MISSED)
{
SetState (WAIT_ASSOC_RESP);
SendAssociationRequest ();
}
return;
}
else if (hdr->IsProbeResp ())
{
if (m_state == WAIT_PROBE_RESP)
{
MgtProbeResponseHeader probeResp;
packet->RemoveHeader (probeResp);
if (!probeResp.GetSsid ().IsEqual (GetSsid ()))
{
//not a probe resp for our ssid.
return;
}
SetBssid (hdr->GetAddr3 ());
Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons);
RestartBeaconWatchdog (delay);
if (m_probeRequestEvent.IsRunning ())
{
m_probeRequestEvent.Cancel ();
}
SetState (WAIT_ASSOC_RESP);
SendAssociationRequest ();
}
return;
}
else if (hdr->IsAssocResp ())
{
if (m_state == WAIT_ASSOC_RESP)
{
MgtAssocResponseHeader assocResp;
packet->RemoveHeader (assocResp);
if (m_assocRequestEvent.IsRunning ())
{
m_assocRequestEvent.Cancel ();
}
if (assocResp.GetStatusCode ().IsSuccess ())
{
SetState (ASSOCIATED);
NS_LOG_DEBUG ("assoc completed");
SupportedRates rates = assocResp.GetSupportedRates ();
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
{
WifiMode mode = m_phy->GetMode (i);
if (rates.IsSupportedRate (mode.GetDataRate ()))
{
m_stationManager->AddSupportedMode (hdr->GetAddr2 (), mode);
if (rates.IsBasicRate (mode.GetDataRate ()))
{
m_stationManager->AddBasicMode (mode);
}
}
}
if (!m_linkUp.IsNull ())
{
m_linkUp ();
}
}
else
{
NS_LOG_DEBUG ("assoc refused");
SetState (REFUSED);
}
}
return;
}
// Invoke the receive handler of our parent class to deal with any
// other frames. Specifically, this will handle Block Ack-related
// Management Action frames.
RegularWifiMac::Receive (packet, hdr);
}
SupportedRates
StaWifiMac::GetSupportedRates (void) const
{
SupportedRates rates;
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
{
WifiMode mode = m_phy->GetMode (i);
rates.AddSupportedRate (mode.GetDataRate ());
}
return rates;
}
void
StaWifiMac::SetState (MacState value)
{
if (value == ASSOCIATED
&& m_state != ASSOCIATED)
{
m_assocLogger (GetBssid ());
}
else if (value != ASSOCIATED
&& m_state == ASSOCIATED)
{
m_deAssocLogger (GetBssid ());
}
m_state = value;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/sta-wifi-mac.cc | C++ | gpl2 | 16,477 |
/* -*- 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>
*/
#ifndef MSDU_AGGREGATOR_H
#define MSDU_AGGREGATOR_H
#include "ns3/ptr.h"
#include "ns3/packet.h"
#include "ns3/object.h"
#include "amsdu-subframe-header.h"
#include <list>
namespace ns3 {
class WifiMacHeader;
/**
* \brief Abstract class that concrete msdu aggregators have to implement
* \ingroup wifi
*/
class MsduAggregator : public Object
{
public:
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus;
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI;
static TypeId GetTypeId (void);
/* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>. If <i>packet</i>
* can be added returns true, false otherwise.
*/
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest) = 0;
static DeaggregatedMsdus Deaggregate (Ptr<Packet> aggregatedPacket);
};
} // namespace ns3
#endif /* MSDU_AGGREGATOR_H */
| zy901002-gpsr | src/wifi/model/msdu-aggregator.h | C++ | gpl2 | 1,918 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 The Boeing Company
*
* 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: Gary Pei <guangyu.pei@boeing.com>
*/
#ifndef NIST_ERROR_RATE_MODEL_H
#define NIST_ERROR_RATE_MODEL_H
#include <stdint.h>
#include "wifi-mode.h"
#include "error-rate-model.h"
#include "dsss-error-rate-model.h"
namespace ns3 {
/**
* \ingroup wifi
*
* A model for the error rate for different modulations. For OFDM modulation,
* the model description and validation can be found in
* http://www.nsnam.org/~pei/80211ofdm.pdf. For DSSS modulations (802.11b),
* the model uses the DsssErrorRateModel.
*/
class NistErrorRateModel : public ErrorRateModel
{
public:
static TypeId GetTypeId (void);
NistErrorRateModel ();
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
private:
double CalculatePe (double p, uint32_t bValue) const;
double GetBpskBer (double snr) const;
double GetQpskBer (double snr) const;
double Get16QamBer (double snr) const;
double Get64QamBer (double snr) const;
double GetFecBpskBer (double snr, double nbits,
uint32_t bValue) const;
double GetFecQpskBer (double snr, double nbits,
uint32_t bValue) const;
double GetFec16QamBer (double snr, uint32_t nbits,
uint32_t bValue) const;
double GetFec64QamBer (double snr, uint32_t nbits,
uint32_t bValue) const;
};
} // namespace ns3
#endif /* NIST_ERROR_RATE_MODEL_H */
| zy901002-gpsr | src/wifi/model/nist-error-rate-model.h | C++ | gpl2 | 2,184 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef WIFI_NET_DEVICE_H
#define WIFI_NET_DEVICE_H
#include "ns3/net-device.h"
#include "ns3/packet.h"
#include "ns3/traced-callback.h"
#include "ns3/mac48-address.h"
#include <string>
namespace ns3 {
class WifiRemoteStationManager;
class WifiChannel;
class WifiPhy;
class WifiMac;
/**
* \defgroup wifi Wifi Models
*
* This section documents the API of the ns-3 Wifi module. For a generic functional description, please refer to the ns-3 manual.
*/
/**
* \brief Hold together all Wifi-related objects.
* \ingroup wifi
*
* This class holds together ns3::WifiChannel, ns3::WifiPhy,
* ns3::WifiMac, and, ns3::WifiRemoteStationManager.
*/
class WifiNetDevice : public NetDevice
{
public:
static TypeId GetTypeId (void);
WifiNetDevice ();
virtual ~WifiNetDevice ();
/**
* \param mac the mac layer to use.
*/
void SetMac (Ptr<WifiMac> mac);
/**
* \param phy the phy layer to use.
*/
void SetPhy (Ptr<WifiPhy> phy);
/**
* \param manager the manager to use.
*/
void SetRemoteStationManager (Ptr<WifiRemoteStationManager> manager);
/**
* \returns the mac we are currently using.
*/
Ptr<WifiMac> GetMac (void) const;
/**
* \returns the phy we are currently using.
*/
Ptr<WifiPhy> GetPhy (void) const;
/**
* \returns the remote station manager we are currently using.
*/
Ptr<WifiRemoteStationManager> GetRemoteStationManager (void) const;
// inherited from NetDevice base class.
virtual void SetIfIndex (const uint32_t index);
virtual uint32_t GetIfIndex (void) const;
virtual Ptr<Channel> GetChannel (void) const;
virtual void SetAddress (Address address);
virtual Address GetAddress (void) const;
virtual bool SetMtu (const uint16_t mtu);
virtual uint16_t GetMtu (void) const;
virtual bool IsLinkUp (void) const;
virtual void AddLinkChangeCallback (Callback<void> callback);
virtual bool IsBroadcast (void) const;
virtual Address GetBroadcast (void) const;
virtual bool IsMulticast (void) const;
virtual Address GetMulticast (Ipv4Address multicastGroup) const;
virtual bool IsPointToPoint (void) const;
virtual bool IsBridge (void) const;
virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
virtual Ptr<Node> GetNode (void) const;
virtual void SetNode (Ptr<Node> node);
virtual bool NeedsArp (void) const;
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
virtual Address GetMulticast (Ipv6Address addr) const;
virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
virtual bool SupportsSendFrom (void) const;
private:
// This value conforms to the 802.11 specification
static const uint16_t MAX_MSDU_SIZE = 2304;
virtual void DoDispose (void);
virtual void DoStart (void);
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
void LinkUp (void);
void LinkDown (void);
void Setup (void);
Ptr<WifiChannel> DoGetChannel (void) const;
void CompleteConfig (void);
Ptr<Node> m_node;
Ptr<WifiPhy> m_phy;
Ptr<WifiMac> m_mac;
Ptr<WifiRemoteStationManager> m_stationManager;
NetDevice::ReceiveCallback m_forwardUp;
NetDevice::PromiscReceiveCallback m_promiscRx;
TracedCallback<Ptr<const Packet>, Mac48Address> m_rxLogger;
TracedCallback<Ptr<const Packet>, Mac48Address> m_txLogger;
uint32_t m_ifIndex;
bool m_linkUp;
TracedCallback<> m_linkChanges;
mutable uint16_t m_mtu;
bool m_configComplete;
};
} // namespace ns3
#endif /* WIFI_NET_DEVICE_H */
| zy901002-gpsr | src/wifi/model/wifi-net-device.h | C++ | gpl2 | 4,438 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009, 2010 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>
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
*/
#ifndef ORIGINATOR_BLOCK_ACK_AGREEMENT_H
#define ORIGINATOR_BLOCK_ACK_AGREEMENT_H
#include "block-ack-agreement.h"
namespace ns3 {
/**
* \ingroup wifi
* Maintains the state and information about transmitted MPDUs with ack policy block ack
* for an originator station.
*/
class OriginatorBlockAckAgreement : public BlockAckAgreement
{
friend class BlockAckManager;
public:
OriginatorBlockAckAgreement ();
OriginatorBlockAckAgreement (Mac48Address recipient, uint8_t tid);
~OriginatorBlockAckAgreement ();
/* receive ADDBAResponse
* send ADDBARequest --------------- status code = success ---------------
* ----------------->| PENDING |------------------------>| ESTABLISHED |-----
* --------------- --------------- |
* | / ^ ^ |
* receive ADDBAResponse | receive BlockAck / | | | receive BlockAck
* status code = failure | retryPkts + queuePkts / | | | retryPkts + queuePkts
* v < / | | | >=
* --------------- blockAckThreshold / | | | blockAckThreshold
* | UNSUCCESSFUL | / | | |
* --------------- v | ----------|
* -------------- |
* | INACTIVE | |
* -------------- |
* send a MPDU (Normal Ack) | |
* retryPkts + queuePkts | |
* >= | |
* blockAckThreshold |----------------
*/
/**
* Represents the state for this agreement.
*
* PENDING:
* If an agreement is in PENDING state it means that an ADDBARequest frame was sent to
* recipient in order to setup the block ack and the originator is waiting for the relative
* ADDBAResponse frame.
*
* ESTABLISHED:
* The block ack is active and all packets relative to this agreement are transmitted
* with ack policy set to block ack.
*
* INACTIVE:
* In our implementation, block ack tear-down happens only if an inactivity timeout occurs
* so we could have an active block ack but a number of packets that doesn't reach the value of
* m_blockAckThreshold (see ns3::BlockAckManager). In these conditions the agreement becomes
* INACTIVE until that the number of packets reaches the value of m_blockAckThreshold again.
*
* UNSUCCESSFUL (not used for now):
* The agreement's state becomes UNSUCCESSFUL if:
*
* - its previous state was PENDING and an ADDBAResponse frame wasn't received from
* recipient station within an interval of time defined by m_bAckSetupTimeout attribute
* in ns3::WifiMac.
* - an ADDBAResponse frame is received from recipient and the Status Code field is set
* to failure.
*
* In both cases for station addressed by BlockAckAgreement::m_peer and for
* TID BlockAckAgreement::m_tid block ack mechanism won't be used.
*/
enum State
{
PENDING,
ESTABLISHED,
INACTIVE,
UNSUCCESSFUL
};
void SetState (enum State state);
bool IsPending (void) const;
bool IsEstablished (void) const;
bool IsInactive (void) const;
bool IsUnsuccessful (void) const;
/**
* Notifies a packet's transmission with ack policy Block Ack.
*/
void NotifyMpduTransmission (uint16_t nextSeqNumber);
/**
* Returns true if all packets for which a block ack was negotiated have been transmitted so
* a block ack request is needed in order to acknowledge them.
*/
bool IsBlockAckRequestNeeded (void) const;
void CompleteExchange (void);
private:
enum State m_state;
uint16_t m_sentMpdus;
bool m_needBlockAckReq;
};
} // namespace ns3
#endif /* ORIGINATOR_BLOCK_ACK_AGREEMENT_H */
| zy901002-gpsr | src/wifi/model/originator-block-ack-agreement.h | C++ | gpl2 | 5,127 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#include "ns3/assert.h"
#include "mac-tx-middle.h"
#include "wifi-mac-header.h"
namespace ns3 {
MacTxMiddle::MacTxMiddle ()
: m_sequence (0)
{
}
MacTxMiddle::~MacTxMiddle ()
{
for (std::map<Mac48Address,uint16_t*>::iterator i = m_qosSequences.begin (); i != m_qosSequences.end (); i++)
{
delete [] i->second;
}
}
uint16_t
MacTxMiddle::GetNextSequenceNumberfor (const WifiMacHeader *hdr)
{
uint16_t retval;
if (hdr->IsQosData ()
&& !hdr->GetAddr1 ().IsGroup ())
{
uint8_t tid = hdr->GetQosTid ();
NS_ASSERT (tid < 16);
std::map<Mac48Address, uint16_t*>::iterator it = m_qosSequences.find (hdr->GetAddr1 ());
if (it != m_qosSequences.end ())
{
retval = it->second[tid];
it->second[tid]++;
it->second[tid] %= 4096;
}
else
{
retval = 0;
std::pair <Mac48Address,uint16_t*> newSeq (hdr->GetAddr1 (), new uint16_t[16]);
std::pair <std::map<Mac48Address,uint16_t*>::iterator,bool> newIns = m_qosSequences.insert (newSeq);
NS_ASSERT (newIns.second == true);
for (uint8_t i = 0; i < 16; i++)
{
newIns.first->second[i] = 0;
}
newIns.first->second[tid]++;
}
}
else
{
retval = m_sequence;
m_sequence++;
m_sequence %= 4096;
}
return retval;
}
uint16_t
MacTxMiddle::GetNextSeqNumberByTidAndAddress (uint8_t tid, Mac48Address addr) const
{
NS_ASSERT (tid < 16);
uint16_t seq = 0;
std::map <Mac48Address,uint16_t*>::const_iterator it = m_qosSequences.find (addr);
if (it != m_qosSequences.end ())
{
return it->second[tid];
}
return seq;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/mac-tx-middle.cc | C++ | gpl2 | 2,630 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005, 2009 INRIA
* 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 "qos-blocked-destinations.h"
namespace ns3 {
QosBlockedDestinations::QosBlockedDestinations ()
{
}
QosBlockedDestinations::~QosBlockedDestinations ()
{
}
bool
QosBlockedDestinations::IsBlocked (Mac48Address dest, uint8_t tid) const
{
for (BlockedPacketsCI i = m_blockedQosPackets.begin (); i != m_blockedQosPackets.end (); i++)
{
if (i->first == dest && i->second == tid)
{
return true;
}
}
return false;
}
void
QosBlockedDestinations::Block (Mac48Address dest, uint8_t tid)
{
if (!IsBlocked (dest, tid))
{
m_blockedQosPackets.push_back (std::make_pair (dest, tid));
}
}
void
QosBlockedDestinations::Unblock (Mac48Address dest, uint8_t tid)
{
for (BlockedPacketsI i = m_blockedQosPackets.begin (); i != m_blockedQosPackets.end (); i++)
{
if (i->first == dest && i->second == tid)
{
m_blockedQosPackets.erase (i);
break;
}
}
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/qos-blocked-destinations.cc | C++ | gpl2 | 1,815 |
/* -*- 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 "block-ack-agreement.h"
namespace ns3 {
BlockAckAgreement::BlockAckAgreement ()
: m_amsduSupported (0),
m_blockAckPolicy (1),
m_inactivityEvent ()
{
}
BlockAckAgreement::BlockAckAgreement (Mac48Address peer, uint8_t tid)
: m_amsduSupported (0),
m_blockAckPolicy (1),
m_inactivityEvent ()
{
m_tid = tid;
m_peer = peer;
}
BlockAckAgreement::~BlockAckAgreement ()
{
m_inactivityEvent.Cancel ();
}
void
BlockAckAgreement::SetBufferSize (uint16_t bufferSize)
{
NS_ASSERT (bufferSize <= 1024);
NS_ASSERT (bufferSize % 16 == 0);
m_bufferSize = bufferSize;
}
void
BlockAckAgreement::SetTimeout (uint16_t timeout)
{
m_timeout = timeout;
}
void
BlockAckAgreement::SetStartingSequence (uint16_t seq)
{
NS_ASSERT (seq < 4096);
m_startingSeq = seq;
}
void
BlockAckAgreement::SetImmediateBlockAck (void)
{
m_blockAckPolicy = 1;
}
void
BlockAckAgreement::SetDelayedBlockAck (void)
{
m_blockAckPolicy = 0;
}
void
BlockAckAgreement::SetAmsduSupport (bool supported)
{
m_amsduSupported = supported;
}
uint8_t
BlockAckAgreement::GetTid (void) const
{
return m_tid;
}
Mac48Address
BlockAckAgreement::GetPeer (void) const
{
return m_peer;
}
uint16_t
BlockAckAgreement::GetBufferSize (void) const
{
return m_bufferSize;
}
uint16_t
BlockAckAgreement::GetTimeout (void) const
{
return m_timeout;
}
uint16_t
BlockAckAgreement::GetStartingSequence (void) const
{
return m_startingSeq;
}
uint16_t
BlockAckAgreement::GetStartingSequenceControl (void) const
{
uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
return seqControl;
}
bool
BlockAckAgreement::IsImmediateBlockAck (void) const
{
return (m_blockAckPolicy == 1);
}
bool
BlockAckAgreement::IsAmsduSupported (void) const
{
return (m_amsduSupported == 1) ? true : false;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/block-ack-agreement.cc | C++ | gpl2 | 2,608 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef DCF_MANAGER_H
#define DCF_MANAGER_H
#include "ns3/nstime.h"
#include "ns3/event-id.h"
#include <vector>
namespace ns3 {
class WifiPhy;
class WifiMac;
class MacLow;
class PhyListener;
class LowDcfListener;
/**
* \brief keep track of the state needed for a single DCF
* function.
* \ingroup wifi
*
* Multiple instances of a DcfState can be registered in a single
* DcfManager to implement 802.11e-style relative QoS.
* DcfState::SetAifsn and DcfState::SetCwBounds allow the user to
* control the relative QoS differentiation.
*/
class DcfState
{
public:
DcfState ();
virtual ~DcfState ();
/**
* \param aifsn the number of slots which make up an AIFS for a specific DCF.
* a DIFS corresponds to an AIFSN = 2.
*
* Calling this method after DcfManager::Add has been called is not recommended.
*/
void SetAifsn (uint32_t aifsn);
void SetCwMin (uint32_t minCw);
void SetCwMax (uint32_t maxCw);
uint32_t GetAifsn (void) const;
uint32_t GetCwMin (void) const;
uint32_t GetCwMax (void) const;
/**
* Update the value of the CW variable to take into account
* a transmission success or a transmission abort (stop transmission
* of a packet after the maximum number of retransmissions has been
* reached). By default, this resets the CW variable to minCW.
*/
void ResetCw (void);
/**
* Update the value of the CW variable to take into account
* a transmission failure. By default, this triggers a doubling
* of CW (capped by maxCW).
*/
void UpdateFailedCw (void);
/**
* \param nSlots the number of slots of the backoff.
*
* Start a backoff by initializing the backoff counter to the number of
* slots specified.
*/
void StartBackoffNow (uint32_t nSlots);
/**
* \returns the current value of the CW variable. The initial value is
* minCW.
*/
uint32_t GetCw (void) const;
/**
* \returns true if access has been requested for this DcfState and
* has not been granted already, false otherwise.
*/
bool IsAccessRequested (void) const;
private:
friend class DcfManager;
uint32_t GetBackoffSlots (void) const;
Time GetBackoffStart (void) const;
void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound);
void NotifyAccessRequested (void);
void NotifyAccessGranted (void);
void NotifyCollision (void);
void NotifyInternalCollision (void);
void NotifyChannelSwitching (void);
/**
* Called by DcfManager to notify a DcfState subclass
* that access to the medium is granted and can
* start immediately.
*/
virtual void DoNotifyAccessGranted (void) = 0;
/**
* Called by DcfManager to notify a DcfState subclass
* that an 'internal' collision occured, that is, that
* the backoff timer of a higher priority DcfState expired
* at the same time and that access was granted to this
* higher priority DcfState.
*
* The subclass is expected to start a new backoff by
* calling DcfState::StartBackoffNow and DcfManager::RequestAccess
* is access is still needed.
*/
virtual void DoNotifyInternalCollision (void) = 0;
/**
* Called by DcfManager to notify a DcfState subclass
* that a normal collision occured, that is, that
* the medium was busy when access was requested.
*
* The subclass is expected to start a new backoff by
* calling DcfState::StartBackoffNow and DcfManager::RequestAccess
* is access is still needed.
*/
virtual void DoNotifyCollision (void) = 0;
/**
* Called by DcfManager to notify a DcfState subclass
* that a channel switching occured.
*
* The subclass is expected to flush the queue of
* packets.
*/
virtual void DoNotifyChannelSwitching () = 0;
uint32_t m_aifsn;
uint32_t m_backoffSlots;
// the backoffStart variable is used to keep track of the
// time at which a backoff was started or the time at which
// the backoff counter was last updated.
Time m_backoffStart;
uint32_t m_cwMin;
uint32_t m_cwMax;
uint32_t m_cw;
bool m_accessRequested;
};
/**
* \brief Manage a set of ns3::DcfState
* \ingroup wifi
*
* Handle a set of independent ns3::DcfState, each of which represents
* a single DCF within a MAC stack. Each ns3::DcfState has a priority
* implicitely associated with it (the priority is determined when the
* ns3::DcfState is added to the DcfManager: the first DcfState to be
* added gets the highest priority, the second, the second highest
* priority, and so on.) which is used to handle "internal" collisions.
* i.e., when two local DcfState are expected to get access to the
* medium at the same time, the highest priority local DcfState wins
* access to the medium and the other DcfState suffers a "internal"
* collision.
*/
class DcfManager
{
public:
DcfManager ();
~DcfManager ();
void SetupPhyListener (Ptr<WifiPhy> phy);
void SetupLowListener (Ptr<MacLow> low);
/**
* \param slotTime the duration of a slot.
*
* It is a bad idea to call this method after RequestAccess or
* one of the Notify methods has been invoked.
*/
void SetSlot (Time slotTime);
/**
* \param sifs the duration of a SIFS.
*
* It is a bad idea to call this method after RequestAccess or
* one of the Notify methods has been invoked.
*/
void SetSifs (Time sifs);
/**
* \param eifsNoDifs the duration of a EIFS minus the duration of DIFS.
*
* It is a bad idea to call this method after RequestAccess or
* one of the Notify methods has been invoked.
*/
void SetEifsNoDifs (Time eifsNoDifs);
/**
* \return value set previously using SetEifsNoDifs.
*/
Time GetEifsNoDifs () const;
/**
* \param dcf a new DcfState.
*
* The DcfManager does not take ownership of this pointer so, the callee
* must make sure that the DcfState pointer will stay valid as long
* as the DcfManager is valid. Note that the order in which DcfState
* objects are added to a DcfManager matters: the first DcfState added
* has the highest priority, the second DcfState added, has the second
* highest priority, etc.
*/
void Add (DcfState *dcf);
/**
* \param state a DcfState
*
* Notify the DcfManager that a specific DcfState needs access to the
* medium. The DcfManager is then responsible for starting an access
* timer and, invoking DcfState::DoNotifyAccessGranted when the access
* is granted if it ever gets granted.
*/
void RequestAccess (DcfState *state);
/**
* \param duration expected duration of reception
*
* Notify the DCF that a packet reception started
* for the expected duration.
*/
void NotifyRxStartNow (Time duration);
/**
* Notify the DCF that a packet reception was just
* completed successfully.
*/
void NotifyRxEndOkNow (void);
/**
* Notify the DCF that a packet reception was just
* completed unsuccessfully.
*/
void NotifyRxEndErrorNow (void);
/**
* \param duration expected duration of transmission
*
* Notify the DCF that a packet transmission was
* just started and is expected to last for the specified
* duration.
*/
void NotifyTxStartNow (Time duration);
/**
* \param duration expected duration of cca busy period
*
* Notify the DCF that a CCA busy period has just started.
*/
void NotifyMaybeCcaBusyStartNow (Time duration);
/**
* \param duration expected duration of channel switching period
*
* Notify the DCF that a channel switching period has just started.
* During switching state, new packets can be enqueued in DcaTxop/EdcaTxop
* but they won't access to the medium until the end of the channel switching.
*/
void NotifySwitchingStartNow (Time duration);
/**
* \param duration the value of the received NAV.
*
* Called at end of rx
*/
void NotifyNavResetNow (Time duration);
/**
* \param duration the value of the received NAV.
*
* Called at end of rx
*/
void NotifyNavStartNow (Time duration);
void NotifyAckTimeoutStartNow (Time duration);
void NotifyAckTimeoutResetNow ();
void NotifyCtsTimeoutStartNow (Time duration);
void NotifyCtsTimeoutResetNow ();
private:
void UpdateBackoff (void);
Time MostRecent (Time a, Time b) const;
Time MostRecent (Time a, Time b, Time c) const;
Time MostRecent (Time a, Time b, Time c, Time d) const;
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f) const;
Time MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const;
/**
* Access will never be granted to the medium _before_
* the time returned by this method.
*
* \returns the absolute time at which access could start to
* be granted
*/
Time GetAccessGrantStart (void) const;
Time GetBackoffStartFor (DcfState *state);
Time GetBackoffEndFor (DcfState *state);
void DoRestartAccessTimeoutIfNeeded (void);
void AccessTimeout (void);
void DoGrantAccess (void);
bool IsBusy (void) const;
typedef std::vector<DcfState *> States;
States m_states;
Time m_lastAckTimeoutEnd;
Time m_lastCtsTimeoutEnd;
Time m_lastNavStart;
Time m_lastNavDuration;
Time m_lastRxStart;
Time m_lastRxDuration;
bool m_lastRxReceivedOk;
Time m_lastRxEnd;
Time m_lastTxStart;
Time m_lastTxDuration;
Time m_lastBusyStart;
Time m_lastBusyDuration;
Time m_lastSwitchingStart;
Time m_lastSwitchingDuration;
bool m_rxing;
bool m_sleeping;
Time m_eifsNoDifs;
EventId m_accessTimeout;
uint32_t m_slotTimeUs;
Time m_sifs;
PhyListener* m_phyListener;
LowDcfListener* m_lowListener;
};
} // namespace ns3
#endif /* DCF_MANAGER_H */
| zy901002-gpsr | src/wifi/model/dcf-manager.h | C++ | gpl2 | 10,421 |
/* -*- 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>
*/
#ifndef QOS_TAG_H
#define QOS_TAG_H
#include "ns3/packet.h"
namespace ns3 {
class Tag;
/**
* As per IEEE Std. 802.11-2007, Section 6.1.1.1.1, when EDCA is used the
* the Traffic ID (TID) value corresponds to one of the User Priority (UP)
* values defined by the IEEE Std. 802.1D-2004, Annex G, table G-2.
*
* Note that this correspondence does not hold for HCCA, since in that
* case the mapping between UPs and TIDs should be determined by a
* TSPEC element as per IEEE Std. 802.11-2007, Section 7.3.2.30
*/
enum UserPriority
{
UP_BK = 1, /**< background */
UP_BE = 0, /**< best effort (default) */
UP_EE = 3, /**< excellent effort */
UP_CL = 4, /**< controlled load */
UP_VI = 5, /**< video, < 100ms latency and jitter */
UP_VO = 6, /**< voice, < 10ms latency and jitter */
UP_NC = 7 /**< network control */
};
/**
* \ingroup wifi
*
* The aim of the QosTag is to provide means for an Application to
* specify the TID which will be used by a QoS-aware WifiMac for a
* given traffic flow. Note that the current QosTag class was
* designed to be completely mac/wifi specific without any attempt
* at being generic.
*/
class QosTag : public Tag
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
/**
* Create a QosTag with the default TID = 0 (best effort traffic)
*/
QosTag ();
/**
* Create a QosTag with the given TID
*/
QosTag (uint8_t tid);
/**
* Set the TID to the given value. This assumes that the
* application is aware of the QoS support provided by the MAC
* layer, and is therefore able to set the correct TID.
*
* @param tid the value of the TID to set
*/
void SetTid (uint8_t tid);
/**
* Set the TID to the value that corresponds to the requested
* UserPriority. Note that, since the mapping of UserPriority to TID
* is defined for EDCA only, you should call this method only when
* EDCA is used. When using HDCA, QosTag(uint8_t tid) should be used
* instead.
*
* @param up the requested UserPriority
*
*/
void SetUserPriority (UserPriority up);
virtual void Serialize (TagBuffer i) const;
virtual void Deserialize (TagBuffer i);
virtual uint32_t GetSerializedSize () const;
virtual void Print (std::ostream &os) const;
uint8_t GetTid (void) const;
private:
uint8_t m_tid;
};
} // namespace ns3
#endif /* QOS_TAG_H */
| zy901002-gpsr | src/wifi/model/qos-tag.h | C++ | gpl2 | 3,214 |
/* -*- 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>
*/
#ifndef MSDU_STANDARD_AGGREGATOR_H
#define MSDU_STANDARD_AGGREGATOR_H
#include "msdu-aggregator.h"
namespace ns3 {
/**
* \ingroup wifi
* Standard MSDU aggregator
*
*/
class MsduStandardAggregator : public MsduAggregator
{
public:
static TypeId GetTypeId (void);
MsduStandardAggregator ();
~MsduStandardAggregator ();
/**
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible,
* \param src Source address of <i>packet</i>.
* \param dest Destination address of <i>packet</i>.
*
* This method performs an MSDU aggregation.
* Returns true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
*/
virtual bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
Mac48Address src, Mac48Address dest);
private:
/* Calculates how much padding must be added to the end of aggregated packet,
after that a new packet is added.
Each A-MSDU subframe is padded so that its length is multiple of 4 octets.
*/
uint32_t CalculatePadding (Ptr<const Packet> packet);
uint32_t m_maxAmsduLength;
};
} // namespace ns3
#endif /* MSDU_STANDARD_AGGREGATOR_H */
| zy901002-gpsr | src/wifi/model/msdu-standard-aggregator.h | C++ | gpl2 | 2,089 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005, 2009 INRIA
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
* Author: Mirko Banchi <mk.banchi@gmail.com>
*/
#ifndef WIFI_MAC_QUEUE_H
#define WIFI_MAC_QUEUE_H
#include <list>
#include <utility>
#include "ns3/packet.h"
#include "ns3/nstime.h"
#include "ns3/object.h"
#include "wifi-mac-header.h"
namespace ns3 {
class WifiMacParameters;
class QosBlockedDestinations;
/**
* \ingroup wifi
*
* This queue implements the timeout procedure described in IEEE
* Std. 802.11-2007, section 9.9.1.6, paragraph 6.
*
* When a packet is received by the MAC, to be sent to the PHY,
* it is queued in the internal queue after being tagged by the
* current time.
*
* When a packet is dequeued, the queue checks its timestamp
* to verify whether or not it should be dropped. If
* dot11EDCATableMSDULifetime has elapsed, it is dropped.
* Otherwise, it is returned to the caller.
*/
class WifiMacQueue : public Object
{
public:
static TypeId GetTypeId (void);
WifiMacQueue ();
~WifiMacQueue ();
void SetMaxSize (uint32_t maxSize);
void SetMaxDelay (Time delay);
uint32_t GetMaxSize (void) const;
Time GetMaxDelay (void) const;
void Enqueue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr);
Ptr<const Packet> Dequeue (WifiMacHeader *hdr);
Ptr<const Packet> Peek (WifiMacHeader *hdr);
/**
* Searchs and returns, if is present in this queue, first packet having
* address indicated by <i>type</i> equals to <i>addr</i>, and tid
* equals to <i>tid</i>. This method removes the packet from this queue.
* Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
*/
Ptr<const Packet> DequeueByTidAndAddress (WifiMacHeader *hdr,
uint8_t tid,
WifiMacHeader::AddressType type,
Mac48Address addr);
/**
* Searchs and returns, if is present in this queue, first packet having
* address indicated by <i>type</i> equals to <i>addr</i>, and tid
* equals to <i>tid</i>. This method doesn't remove the packet from this queue.
* Is typically used by ns3::EdcaTxopN in order to perform correct MSDU
* aggregation (A-MSDU).
*/
Ptr<const Packet> PeekByTidAndAddress (WifiMacHeader *hdr,
uint8_t tid,
WifiMacHeader::AddressType type,
Mac48Address addr);
/**
* If exists, removes <i>packet</i> from queue and returns true. Otherwise it
* takes no effects and return false. Deletion of the packet is
* performed in linear time (O(n)).
*/
bool Remove (Ptr<const Packet> packet);
/**
* Returns number of QoS packets having tid equals to <i>tid</i> and address
* specified by <i>type</i> equals to <i>addr</i>.
*/
uint32_t GetNPacketsByTidAndAddress (uint8_t tid,
WifiMacHeader::AddressType type,
Mac48Address addr);
/**
* Returns first available packet for transmission. A packet could be no available
* if it's a QoS packet with a tid and an address1 fields equal to <i>tid</i> and <i>addr</i>
* respectively that index a pending agreement in the BlockAckManager object.
* So that packet must not be transmitted until reception of an ADDBA response frame from station
* addressed by <i>addr</i>. This method removes the packet from queue.
*/
Ptr<const Packet> DequeueFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
const QosBlockedDestinations *blockedPackets);
/**
* Returns first available packet for transmission. The packet isn't removed from queue.
*/
Ptr<const Packet> PeekFirstAvailable (WifiMacHeader *hdr,
Time &tStamp,
const QosBlockedDestinations *blockedPackets);
void Flush (void);
bool IsEmpty (void);
uint32_t GetSize (void);
private:
struct Item;
typedef std::list<struct Item> PacketQueue;
typedef std::list<struct Item>::reverse_iterator PacketQueueRI;
typedef std::list<struct Item>::iterator PacketQueueI;
void Cleanup (void);
Mac48Address GetAddressForPacket (enum WifiMacHeader::AddressType type, PacketQueueI);
struct Item
{
Item (Ptr<const Packet> packet,
const WifiMacHeader &hdr,
Time tstamp);
Ptr<const Packet> packet;
WifiMacHeader hdr;
Time tstamp;
};
PacketQueue m_queue;
WifiMacParameters *m_parameters;
uint32_t m_size;
uint32_t m_maxSize;
Time m_maxDelay;
};
} // namespace ns3
#endif /* WIFI_MAC_QUEUE_H */
| zy901002-gpsr | src/wifi/model/wifi-mac-queue.h | C++ | gpl2 | 5,621 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "dcf.h"
#include "ns3/uinteger.h"
namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (Dcf);
TypeId
Dcf::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::Dcf")
.SetParent<Object> ()
.AddAttribute ("MinCw", "The minimum value of the contention window.",
UintegerValue (15),
MakeUintegerAccessor (&Dcf::SetMinCw,
&Dcf::GetMinCw),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MaxCw", "The maximum value of the contention window.",
UintegerValue (1023),
MakeUintegerAccessor (&Dcf::SetMaxCw,
&Dcf::GetMaxCw),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("Aifsn", "The AIFSN: the default value conforms to simple DCA.",
UintegerValue (2),
MakeUintegerAccessor (&Dcf::SetAifsn,
&Dcf::GetAifsn),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/dcf.cc | C++ | gpl2 | 1,906 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Federico Maguolo <maguolof@dei.unipd.it>
*/
#ifndef CARA_WIFI_MANAGER_H
#define CARA_WIFI_MANAGER_H
#include "wifi-remote-station-manager.h"
namespace ns3 {
/**
* \brief implement the CARA rate control algorithm
* \ingroup wifi
*
* Implement the CARA algorithm from:
* J. Kim, S. Kim, S. Choi, and D. Qiao.
* "CARA: Collision-Aware Rate Adaptation for IEEE 802.11 WLANs."
*
* Originally implemented by Federico Maguolo for a very early
* prototype version of ns-3.
*/
class CaraWifiManager : public WifiRemoteStationManager
{
public:
static TypeId GetTypeId (void);
CaraWifiManager ();
virtual ~CaraWifiManager ();
private:
// overriden from base class
virtual WifiRemoteStation * DoCreateStation (void) const;
virtual void DoReportRxOk (WifiRemoteStation *station,
double rxSnr, WifiMode txMode);
virtual void DoReportRtsFailed (WifiRemoteStation *station);
virtual void DoReportDataFailed (WifiRemoteStation *station);
virtual void DoReportRtsOk (WifiRemoteStation *station,
double ctsSnr, WifiMode ctsMode, double rtsSnr);
virtual void DoReportDataOk (WifiRemoteStation *station,
double ackSnr, WifiMode ackMode, double dataSnr);
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size);
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station);
virtual bool DoNeedRts (WifiRemoteStation *station,
Ptr<const Packet> packet, bool normally);
virtual bool IsLowLatency (void) const;
uint32_t m_timerTimeout;
uint32_t m_successThreshold;
uint32_t m_failureThreshold;
uint32_t m_probeThreshold;
};
} // namespace ns3
#endif /* CARA_WIFI_MANAGER_H */
| zy901002-gpsr | src/wifi/model/cara-wifi-manager.h | C++ | gpl2 | 2,642 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "interference-helper.h"
#include "wifi-phy.h"
#include "error-rate-model.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
#include <algorithm>
NS_LOG_COMPONENT_DEFINE ("InterferenceHelper");
namespace ns3 {
/****************************************************************
* Phy event class
****************************************************************/
InterferenceHelper::Event::Event (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower)
: m_size (size),
m_payloadMode (payloadMode),
m_preamble (preamble),
m_startTime (Simulator::Now ()),
m_endTime (m_startTime + duration),
m_rxPowerW (rxPower)
{
}
InterferenceHelper::Event::~Event ()
{
}
Time
InterferenceHelper::Event::GetDuration (void) const
{
return m_endTime - m_startTime;
}
Time
InterferenceHelper::Event::GetStartTime (void) const
{
return m_startTime;
}
Time
InterferenceHelper::Event::GetEndTime (void) const
{
return m_endTime;
}
double
InterferenceHelper::Event::GetRxPowerW (void) const
{
return m_rxPowerW;
}
uint32_t
InterferenceHelper::Event::GetSize (void) const
{
return m_size;
}
WifiMode
InterferenceHelper::Event::GetPayloadMode (void) const
{
return m_payloadMode;
}
enum WifiPreamble
InterferenceHelper::Event::GetPreambleType (void) const
{
return m_preamble;
}
/****************************************************************
* Class which records SNIR change events for a
* short period of time.
****************************************************************/
InterferenceHelper::NiChange::NiChange (Time time, double delta)
: m_time (time),
m_delta (delta)
{
}
Time
InterferenceHelper::NiChange::GetTime (void) const
{
return m_time;
}
double
InterferenceHelper::NiChange::GetDelta (void) const
{
return m_delta;
}
bool
InterferenceHelper::NiChange::operator < (const InterferenceHelper::NiChange& o) const
{
return (m_time < o.m_time);
}
/****************************************************************
* The actual InterferenceHelper
****************************************************************/
InterferenceHelper::InterferenceHelper ()
: m_errorRateModel (0),
m_firstPower (0.0),
m_rxing (false)
{
}
InterferenceHelper::~InterferenceHelper ()
{
EraseEvents ();
m_errorRateModel = 0;
}
Ptr<InterferenceHelper::Event>
InterferenceHelper::Add (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPowerW)
{
Ptr<InterferenceHelper::Event> event;
event = Create<InterferenceHelper::Event> (size,
payloadMode,
preamble,
duration,
rxPowerW);
AppendEvent (event);
return event;
}
void
InterferenceHelper::SetNoiseFigure (double value)
{
m_noiseFigure = value;
}
double
InterferenceHelper::GetNoiseFigure (void) const
{
return m_noiseFigure;
}
void
InterferenceHelper::SetErrorRateModel (Ptr<ErrorRateModel> rate)
{
m_errorRateModel = rate;
}
Ptr<ErrorRateModel>
InterferenceHelper::GetErrorRateModel (void) const
{
return m_errorRateModel;
}
Time
InterferenceHelper::GetEnergyDuration (double energyW)
{
Time now = Simulator::Now ();
double noiseInterferenceW = 0.0;
Time end = now;
noiseInterferenceW = m_firstPower;
for (NiChanges::const_iterator i = m_niChanges.begin (); i != m_niChanges.end (); i++)
{
noiseInterferenceW += i->GetDelta ();
end = i->GetTime ();
if (end < now)
{
continue;
}
if (noiseInterferenceW < energyW)
{
break;
}
}
return end > now ? end - now : MicroSeconds (0);
}
void
InterferenceHelper::AppendEvent (Ptr<InterferenceHelper::Event> event)
{
Time now = Simulator::Now ();
if (!m_rxing)
{
NiChanges::iterator nowIterator = GetPosition (now);
for (NiChanges::iterator i = m_niChanges.begin (); i != nowIterator; i++)
{
m_firstPower += i->GetDelta ();
}
m_niChanges.erase (m_niChanges.begin (), nowIterator);
m_niChanges.insert (m_niChanges.begin (), NiChange (event->GetStartTime (), event->GetRxPowerW ()));
}
else
{
AddNiChangeEvent (NiChange (event->GetStartTime (), event->GetRxPowerW ()));
}
AddNiChangeEvent (NiChange (event->GetEndTime (), -event->GetRxPowerW ()));
}
double
InterferenceHelper::CalculateSnr (double signal, double noiseInterference, WifiMode mode) const
{
// thermal noise at 290K in J/s = W
static const double BOLTZMANN = 1.3803e-23;
// Nt is the power of thermal noise in W
double Nt = BOLTZMANN * 290.0 * mode.GetBandwidth ();
// receiver noise Floor (W) which accounts for thermal noise and non-idealities of the receiver
double noiseFloor = m_noiseFigure * Nt;
double noise = noiseFloor + noiseInterference;
double snr = signal / noise;
return snr;
}
double
InterferenceHelper::CalculateNoiseInterferenceW (Ptr<InterferenceHelper::Event> event, NiChanges *ni) const
{
double noiseInterference = m_firstPower;
NS_ASSERT (m_rxing);
for (NiChanges::const_iterator i = m_niChanges.begin () + 1; i != m_niChanges.end (); i++)
{
if ((event->GetEndTime () == i->GetTime ()) && event->GetRxPowerW () == -i->GetDelta ())
{
break;
}
ni->push_back (*i);
}
ni->insert (ni->begin (), NiChange (event->GetStartTime (), noiseInterference));
ni->push_back (NiChange (event->GetEndTime (), 0));
return noiseInterference;
}
double
InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const
{
if (duration == NanoSeconds (0))
{
return 1.0;
}
uint32_t rate = mode.GetPhyRate ();
uint64_t nbits = (uint64_t)(rate * duration.GetSeconds ());
double csr = m_errorRateModel->GetChunkSuccessRate (mode, snir, (uint32_t)nbits);
return csr;
}
double
InterferenceHelper::CalculatePer (Ptr<const InterferenceHelper::Event> event, NiChanges *ni) const
{
double psr = 1.0; /* Packet Success Rate */
NiChanges::iterator j = ni->begin ();
Time previous = (*j).GetTime ();
WifiMode payloadMode = event->GetPayloadMode ();
WifiPreamble preamble = event->GetPreambleType ();
WifiMode headerMode = WifiPhy::GetPlcpHeaderMode (payloadMode, preamble);
Time plcpHeaderStart = (*j).GetTime () + MicroSeconds (WifiPhy::GetPlcpPreambleDurationMicroSeconds (payloadMode, preamble));
Time plcpPayloadStart = plcpHeaderStart + MicroSeconds (WifiPhy::GetPlcpHeaderDurationMicroSeconds (payloadMode, preamble));
double noiseInterferenceW = (*j).GetDelta ();
double powerW = event->GetRxPowerW ();
j++;
while (ni->end () != j)
{
Time current = (*j).GetTime ();
NS_ASSERT (current >= previous);
if (previous >= plcpPayloadStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
payloadMode),
current - previous,
payloadMode);
}
else if (previous >= plcpHeaderStart)
{
if (current >= plcpPayloadStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
headerMode),
plcpPayloadStart - previous,
headerMode);
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
payloadMode),
current - plcpPayloadStart,
payloadMode);
}
else
{
NS_ASSERT (current >= plcpHeaderStart);
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
headerMode),
current - previous,
headerMode);
}
}
else
{
if (current >= plcpPayloadStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
headerMode),
plcpPayloadStart - plcpHeaderStart,
headerMode);
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
payloadMode),
current - plcpPayloadStart,
payloadMode);
}
else if (current >= plcpHeaderStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
headerMode),
current - plcpHeaderStart,
headerMode);
}
}
noiseInterferenceW += (*j).GetDelta ();
previous = (*j).GetTime ();
j++;
}
double per = 1 - psr;
return per;
}
struct InterferenceHelper::SnrPer
InterferenceHelper::CalculateSnrPer (Ptr<InterferenceHelper::Event> event)
{
NiChanges ni;
double noiseInterferenceW = CalculateNoiseInterferenceW (event, &ni);
double snr = CalculateSnr (event->GetRxPowerW (),
noiseInterferenceW,
event->GetPayloadMode ());
/* calculate the SNIR at the start of the packet and accumulate
* all SNIR changes in the snir vector.
*/
double per = CalculatePer (event, &ni);
struct SnrPer snrPer;
snrPer.snr = snr;
snrPer.per = per;
return snrPer;
}
void
InterferenceHelper::EraseEvents (void)
{
m_niChanges.clear ();
m_rxing = false;
m_firstPower = 0.0;
}
InterferenceHelper::NiChanges::iterator
InterferenceHelper::GetPosition (Time moment)
{
return std::upper_bound (m_niChanges.begin (), m_niChanges.end (), NiChange (moment, 0));
}
void
InterferenceHelper::AddNiChangeEvent (NiChange change)
{
m_niChanges.insert (GetPosition (change.GetTime ()), change);
}
void
InterferenceHelper::NotifyRxStart ()
{
m_rxing = true;
}
void
InterferenceHelper::NotifyRxEnd ()
{
m_rxing = false;
}
} // namespace ns3
| zy901002-gpsr | src/wifi/model/interference-helper.cc | C++ | gpl2 | 12,091 |