branch merge

This commit is contained in:
Craig Dowell
2008-03-31 16:22:24 -07:00
207 changed files with 927 additions and 2420 deletions

View File

@@ -5,4 +5,6 @@ Tom Henderson (tomhend@u.washington.edu)
Joe Kopena (tjkopena@cs.drexel.edu)
Mathieu Lacage (mathieu.lacage@sophia.inria.fr)
Emmanuelle Laprise (emmmanuelle.laprise@bluekazoo.ca)
Federico Maguolo (maguolof@dei.unipd.it)
George F. Riley (riley@ece.gatech.edu)
Guillaume Vu-Brugier (gvubrugier@gmail.com)

15
README
View File

@@ -81,14 +81,15 @@ build/debug or build/optimized.
The current codebase is expected to build and run on the
following set of platforms:
- linux x86 gcc 4.2, 4.1, and, 3.4.
- linux x86_64 gcc 4.0
- linux x86 gcc 4.2, 4.1, and, 3.4.6.
- linux x86_64 gcc 4.1.3, 4.2.1, 3.4.6
- MacOS X ppc and x86
- cygwin
- cygwin gcc 3.4.4 (debug only)
The current codebase is expected to fail to build on
the following platforms:
- gcc 3.3 and earlier
- optimized builds on gcc 3.4.4 and 3.4.5
- optimized builds on linux x86 gcc 4.0
Other platforms may or may not work: we welcome
@@ -102,11 +103,11 @@ On recent Linux systems, once you have built ns-3, it
should be easy to run the sample programs with the
following command:
./waf --run simple-point-to-point
./waf --run simple-global-routing
That program should generate a simple-point-to-point.tr text
trace file and a set of simple-point-to-point-xx-xx.pcap binary
pcap trace files, which can be read by tcpdump.
That program should generate a simple-global-routing.tr text
trace file and a set of simple-global-routing-xx-xx.pcap binary
pcap trace files, which can be read by tcpdump -tt -r filename.pcap
5) Getting access to the ns-3 documentation
-------------------------------------------

View File

@@ -3,6 +3,17 @@
This file contains ns-3 release notes (most recent releases first).
Release 3.0.12 (2008/03/31)
========================
- Add Attribute support to the TypeId metadata system and add
attribute support to all in-tree models
- Add a mid-level helper API to build simulation topologies
and perform simple ascii and pcap link-level tracing.
- Large amount of structural changes to accomodate the needs
of the upcoming python bindings
- new rate control algorithm (RRAA) and a jakes propagation model
in the 802.11 model (Federico Maguolo).
Release 3.0.11 (2008/02/15)
========================
- Initial port of GTNetS TCP implementation (initial version

View File

@@ -1 +1 @@
3.0.11
3.0.12

View File

@@ -133,7 +133,7 @@ main (int argc, char *argv[])
// The output files will be named
// csma-broadcast.pcap-<nodeId>-<interfaceId>
// and can be read by the "tcpdump -tt -r" command
CsmaHelper::EnablePcap ("csma-broadcast.pcap");
CsmaHelper::EnablePcap ("csma-broadcast");
std::ofstream ascii;
ascii.open ("csma-broadcast.tr");
CsmaHelper::EnableAscii (ascii);

View File

@@ -173,7 +173,7 @@ main (int argc, char *argv[])
// csma-multicast.pcap-<nodeId>-<interfaceId>
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
CsmaHelper::EnablePcap ("csma-multicast.pcap");
CsmaHelper::EnablePcap ("csma-multicast");
//
// Now, do the actual simulation.
//

View File

@@ -131,7 +131,7 @@ main (int argc, char *argv[])
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
//
CsmaHelper::EnablePcap ("csma-one-subnet.pcap");
CsmaHelper::EnablePcap ("csma-one-subnet");
//
// Now, do the actual simulation.
//

View File

@@ -154,9 +154,9 @@ main (int argc, char *argv[])
std::ofstream ascii;
ascii.open ("mixed-global-routing.tr");
PointToPointHelper::EnablePcap ("mixed-global-routing.pcap");
PointToPointHelper::EnablePcap ("mixed-global-routing");
PointToPointHelper::EnableAscii (ascii);
CsmaHelper::EnablePcap ("mixed-global-routing.pcap");
CsmaHelper::EnablePcap ("mixed-global-routing");
CsmaHelper::EnableAscii (ascii);

View File

@@ -177,7 +177,7 @@ main (int argc, char *argv[])
std::ofstream ascii;
ascii.open ("simple-alternate-routing.tr");
PointToPointHelper::EnablePcap ("simple-alternate-routing.pcap");
PointToPointHelper::EnablePcap ("simple-alternate-routing");
PointToPointHelper::EnableAscii (ascii);

View File

@@ -163,7 +163,7 @@ main (int argc, char *argv[])
std::ofstream ascii;
ascii.open ("simple-error-model.tr");
PointToPointHelper::EnablePcap ("simple-error-model.pcap");
PointToPointHelper::EnablePcap ("simple-error-model");
PointToPointHelper::EnableAscii (ascii);
NS_LOG_INFO ("Run Simulation.");

View File

@@ -93,9 +93,6 @@ main (int argc, char *argv[])
CommandLine cmd;
cmd.Parse (argc, argv);
std::ofstream ascii;
ascii.open ("simple-global-routing.tr");
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
@@ -111,8 +108,6 @@ main (int argc, char *argv[])
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
PointToPointHelper p2p;
p2p.EnablePcap ("simple-global-routing.pcap");
p2p.EnableAscii (ascii);
p2p.SetChannelParameter ("BitRate", DataRate (5000000));
p2p.SetChannelParameter ("Delay", MilliSeconds (2));
NetDeviceContainer d0d2 = p2p.Build (n0n2);
@@ -152,7 +147,6 @@ main (int argc, char *argv[])
apps.Stop (Seconds (10.0));
// Create a packet sink to receive these packets
// The last argument "true" disables output from the Receive callback
PacketSinkHelper sink;
sink.SetupUdp (Ipv4Address::GetAny (), port);
apps = sink.Build (c.Get (3));
@@ -170,6 +164,10 @@ main (int argc, char *argv[])
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
std::ofstream ascii;
ascii.open ("simple-global-routing.tr");
PointToPointHelper::EnablePcap ("simple-global-routing");
PointToPointHelper::EnableAscii (ascii);
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();

View File

@@ -35,38 +35,20 @@
// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec.
// (i.e., DataRate of 448,000 bps)
// - DropTail queues
// - Tracing of queues and packet receptions to file
// "simple-point-to-point.tr"
// - Tracing of queues and packet receptions to file "simple-point-to-point-olsr.tr"
#include "ns3/log.h"
#include "ns3/command-line.h"
#include "ns3/ptr.h"
#include "ns3/random-variable.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
#include "ns3/ascii-trace.h"
#include "ns3/pcap-trace.h"
#include "ns3/internet-node.h"
#include "ns3/point-to-point-channel.h"
#include "ns3/point-to-point-net-device.h"
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4.h"
#include "ns3/socket.h"
#include "ns3/ipv4-route.h"
#include "ns3/point-to-point-topology.h"
#include "ns3/onoff-application.h"
#include "ns3/packet-sink.h"
#include "ns3/olsr-helper.h"
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/helper-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SimplePointToPointExample");
NS_LOG_COMPONENT_DEFINE ("SimpleGlobalRoutingExample");
int
main (int argc, char *argv[])
@@ -74,7 +56,7 @@ main (int argc, char *argv[])
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
#if 0
LogComponentEnable ("SimplePointToPointExample", LOG_LEVEL_INFO);
LogComponentEnable ("SimpleGlobalRoutingExample", LOG_LEVEL_INFO);
LogComponentEnable("Object", LOG_LEVEL_ALL);
LogComponentEnable("Queue", LOG_LEVEL_ALL);
@@ -98,125 +80,104 @@ main (int argc, char *argv[])
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL);
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL);
#endif
// Set up some default values for the simulation. Use the
// Set up some default values for the simulation.
Config::SetDefault ("ns3::OnOffApplication::PacketSize", String ("210"));
Config::SetDefault ("ns3::OnOffApplication::DataRate", String ("448kb/s"));
Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
//DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
// Allow the user to override any of the defaults and the above
// Bind()s at run-time, via command-line arguments
// DefaultValue::Bind ()s at run-time, via command-line arguments
CommandLine cmd;
cmd.Parse (argc, argv);
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
Ptr<Node> n0 = CreateObject<InternetNode> ();
Ptr<Node> n1 = CreateObject<InternetNode> ();
Ptr<Node> n2 = CreateObject<InternetNode> ();
Ptr<Node> n3 = CreateObject<InternetNode> ();
Ptr<Node> n4 = CreateObject<InternetNode> ();
NodeContainer c;
c.Create (5);
NodeContainer n02 = NodeContainer (c.Get(0), c.Get (2));
NodeContainer n12 = NodeContainer (c.Get(1), c.Get (2));
NodeContainer n32 = NodeContainer (c.Get(3), c.Get (2));
NodeContainer n34 = NodeContainer (c.Get (3), c.Get (4));
InternetStackHelper internet;
internet.Build (c);
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
Ptr<PointToPointChannel> channel0 =
PointToPointTopology::AddPointToPointLink (
n0, n2, DataRate(5000000), MilliSeconds(2));
Ptr<PointToPointChannel> channel1 =
PointToPointTopology::AddPointToPointLink (
n1, n2, DataRate(5000000), MilliSeconds(2));
Ptr<PointToPointChannel> channel2 =
PointToPointTopology::AddPointToPointLink (
n2, n3, DataRate(1500000), MilliSeconds(10));
Ptr<PointToPointChannel> channel3 =
PointToPointTopology::AddPointToPointLink (
n3, n4, DataRate(1500000), MilliSeconds(10));
PointToPointHelper p2p;
p2p.SetChannelParameter ("BitRate", DataRate (5000000));
p2p.SetChannelParameter ("Delay", MilliSeconds (2));
NetDeviceContainer nd02 = p2p.Build (n02);
NetDeviceContainer nd12 = p2p.Build (n12);
p2p.SetChannelParameter ("BitRate", DataRate (1500000));
p2p.SetChannelParameter ("Delay", MilliSeconds (10));
NetDeviceContainer nd32 = p2p.Build (n32);
NetDeviceContainer nd34 = p2p.Build (n34);
// Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
PointToPointTopology::AddIpv4Addresses (
channel0, n0, Ipv4Address("10.1.1.1"),
n2, Ipv4Address("10.1.1.2"));
PointToPointTopology::AddIpv4Addresses (
channel1, n1, Ipv4Address("10.1.2.1"),
n2, Ipv4Address("10.1.2.2"));
PointToPointTopology::AddIpv4Addresses (
channel2, n2, Ipv4Address("10.1.3.1"),
n3, Ipv4Address("10.1.3.2"));
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i02 = ipv4.Allocate (nd02);
PointToPointTopology::AddIpv4Addresses (
channel3, n3, Ipv4Address("10.1.4.1"),
n4, Ipv4Address("10.1.4.2"));
ipv4.SetBase ("10.1.2.0", "255.255.255.0");
Ipv4InterfaceContainer i12 = ipv4.Allocate (nd12);
ipv4.SetBase ("10.1.3.0", "255.255.255.0");
Ipv4InterfaceContainer i32 = ipv4.Allocate (nd32);
ipv4.SetBase ("10.1.4.0", "255.255.255.0");
Ipv4InterfaceContainer i34 = ipv4.Allocate (nd34);
// Enable OLSR
NS_LOG_INFO ("Enabling OLSR Routing.");
OlsrHelper olsr;
olsr.EnableAll ();
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.4.2", port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.0));
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.1));
OnOffHelper onoff;
onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
onoff.SetUdpRemote (i34.GetAddress (1), port);
ApplicationContainer apps = onoff.Build (c.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));
PacketSinkHelper sink;
sink.SetupUdp (Ipv4Address::GetAny (), port);
apps = sink.Build (c.Get (3));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
// Trace output will be sent to the simple-point-to-point.tr file
NS_LOG_INFO ("Configure Tracing.");
AsciiTrace asciitrace ("simple-point-to-point-olsr.tr");
asciitrace.TraceAllQueues ();
asciitrace.TraceAllNetDeviceRx ();
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
onoff.SetUdpRemote (i12.GetAddress (0), port);
apps = onoff.Build (c.Get (3));
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
// Also configure some tcpdump traces; each interface will be traced
// The output files will be named
// simple-point-to-point.pcap-<nodeId>-<interfaceId>
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
PcapTrace pcaptrace ("simple-point-to-point-olsr.pcap");
pcaptrace.TraceAllIp ();
// Create a packet sink to receive these packets
apps = sink.Build (c.Get (1));
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
std::ofstream ascii;
ascii.open ("simple-point-to-point-olsr.tr");
PointToPointHelper::EnablePcap ("simple-point-to-point-olsr");
PointToPointHelper::EnableAscii (ascii);
Simulator::StopAt (Seconds (30));
NS_LOG_INFO ("Run Simulation.");
Simulator::StopAt (Seconds (30));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
return 0;
}

View File

@@ -1,219 +0,0 @@
/* -*- 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
*
* ns-2 simple.tcl script (ported from ns-2)
* Originally authored by Steve McCanne, 12/19/1996
*/
// Port of ns-2/tcl/ex/simple.tcl to ns-3
//
// Network topology
//
// n0
// \ 5 Mb/s, 2ms
// \ 1.5Mb/s, 10ms
// n2 -------------------------n3
// /
// / 5 Mb/s, 2ms
// n1
//
// - all links are point-to-point links with indicated one-way BW/delay
// - CBR/UDP flows from n0 to n3, and from n3 to n1
// - FTP/TCP flow from n0 to n3, starting at time 1.2 to time 1.35 sec.
// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec.
// (i.e., DataRate of 448,000 bps)
// - DropTail queues
// - Tracing of queues and packet receptions to file
// "simple-point-to-point.tr"
#include "ns3/log.h"
#include "ns3/command-line.h"
#include "ns3/ptr.h"
#include "ns3/random-variable.h"
#include "ns3/config.h"
#include "ns3/string.h"
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
#include "ns3/ascii-trace.h"
#include "ns3/pcap-trace.h"
#include "ns3/internet-node.h"
#include "ns3/point-to-point-channel.h"
#include "ns3/point-to-point-net-device.h"
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4.h"
#include "ns3/socket.h"
#include "ns3/ipv4-route.h"
#include "ns3/point-to-point-topology.h"
#include "ns3/onoff-application.h"
#include "ns3/packet-sink.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SimplePointToPointExample");
int
main (int argc, char *argv[])
{
// Users may find it convenient to turn on explicit debugging
// for selected modules; the below lines suggest how to do this
#if 0
LogComponentEnable ("SimplePointToPointExample", LOG_LEVEL_ALL);
#endif
// Set up some default values for the simulation.
Config::SetDefault ("ns3::OnOffApplication::PacketSize", String ("210"));
Config::SetDefault ("ns3::OnOffApplication::DataRate", String ("448kb/s"));
// Allow the user to override any of the defaults and the above
// Bind()s at run-time, via command-line arguments
CommandLine cmd;
cmd.Parse (argc, argv);
// Here, we will explicitly create four nodes. In more sophisticated
// topologies, we could configure a node factory.
NS_LOG_INFO ("Create nodes.");
Ptr<Node> n0 = CreateObject<InternetNode> ();
Ptr<Node> n1 = CreateObject<InternetNode> ();
Ptr<Node> n2 = CreateObject<InternetNode> ();
Ptr<Node> n3 = CreateObject<InternetNode> ();
// We create the channels first without any IP addressing information
NS_LOG_INFO ("Create channels.");
Ptr<PointToPointChannel> channel0 =
PointToPointTopology::AddPointToPointLink (
n0, n2, DataRate(5000000), MilliSeconds(2));
Ptr<PointToPointChannel> channel1 =
PointToPointTopology::AddPointToPointLink (
n1, n2, DataRate(5000000), MilliSeconds(2));
Ptr<PointToPointChannel> channel2 =
PointToPointTopology::AddPointToPointLink (
n2, n3, DataRate(1500000), MilliSeconds(10));
// Later, we add IP addresses.
NS_LOG_INFO ("Assign IP Addresses.");
PointToPointTopology::AddIpv4Addresses (
channel0, n0, Ipv4Address("10.1.1.1"),
n2, Ipv4Address("10.1.1.2"));
PointToPointTopology::AddIpv4Addresses (
channel1, n1, Ipv4Address("10.1.2.1"),
n2, Ipv4Address("10.1.2.2"));
PointToPointTopology::AddIpv4Addresses (
channel2, n2, Ipv4Address("10.1.3.1"),
n3, Ipv4Address("10.1.3.2"));
// Finally, we add static routes. These three steps (Channel and
// NetDevice creation, IP Address assignment, and routing) are
// separated because there may be a need to postpone IP Address
// assignment (emulation) or modify to use dynamic routing
NS_LOG_INFO ("Add Static Routes.");
PointToPointTopology::AddIpv4Routes(n0, n2, channel0);
PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
PointToPointTopology::AddIpv4Routes(n2, n3, channel2);
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.0));
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"));
n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n3->AddApplication (ooff);
// Start the application
ooff->Start(Seconds(1.1));
// Create a packet sink to receive these packets
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("ns3::Udp"));
n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));
// TCP
// Create a file transfer from n0 to n3, starting at time 1.2
uint16_t servPort = 500;
ooff = CreateObject<OnOffApplication> ("Remote", Address (InetSocketAddress ("10.1.3.2", servPort)),
"Protocol", TypeId::LookupByName ("ns3::Tcp"),
"OnTime", ConstantVariable(1),
"OffTime", ConstantVariable(0));
n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds(1.2));
ooff->Stop (Seconds(1.35));
// Create a packet sink to receive these TCP packets
sink = CreateObject<PacketSink> ("Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("ns3::Tcp"));
n3->AddApplication (sink);
sink->Start (Seconds (1.2));
// Here, finish off packet routing configuration
// This will likely set by some global StaticRouting object in the future
NS_LOG_INFO ("Set Default Routes.");
Ptr<Ipv4> ipv4;
ipv4 = n0->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
ipv4 = n3->GetObject<Ipv4> ();
ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
// Configure tracing of all enqueue, dequeue, and NetDevice receive events
// Trace output will be sent to the simple-point-to-point.tr file
NS_LOG_INFO ("Configure Tracing.");
AsciiTrace asciitrace ("simple-point-to-point.tr");
asciitrace.TraceAllQueues ();
asciitrace.TraceAllNetDeviceRx ();
// Also configure some tcpdump traces; each interface will be traced
// The output files will be named
// simple-point-to-point.pcap-<nodeId>-<interfaceId>
// and can be read by the "tcpdump -r" command (use "-tt" option to
// display timestamps correctly)
PcapTrace pcaptrace ("simple-point-to-point.pcap");
pcaptrace.TraceAllIp ();
NS_LOG_INFO ("Run Simulation.");
Simulator::StopAt (Seconds (3.0));
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}

View File

@@ -182,7 +182,7 @@ int main (int argc, char *argv[])
std::ofstream ascii;
ascii.open ("tcp-large-transfer.tr");
PointToPointHelper::EnablePcap ("tcp-large-transfer.pcap");
PointToPointHelper::EnablePcap ("tcp-large-transfer");
PointToPointHelper::EnableAscii (ascii);

View File

@@ -128,7 +128,7 @@ main (int argc, char *argv[])
std::ofstream ascii;
ascii.open ("udp-echo.tr");
CsmaHelper::EnablePcap ("udp-echo.pcap");
CsmaHelper::EnablePcap ("udp-echo");
CsmaHelper::EnableAscii (ascii);
//

View File

@@ -10,10 +10,6 @@ def build(bld):
['point-to-point', 'internet-node', 'global-routing'])
obj.source = 'simple-alternate-routing.cc'
obj = bld.create_ns3_program('simple-point-to-point',
['point-to-point', 'internet-node'])
obj.source = 'simple-point-to-point.cc'
obj = bld.create_ns3_program('simple-error-model',
['point-to-point', 'internet-node'])
obj.source = 'simple-error-model.cc'

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 University of Washington
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
// All rights reserved.
//
// 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
// All rights reserved.
//
// 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INRIA, INESC Porto
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006,2007 INESC Porto, INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007, Emmanuelle Laprise
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Emmanuelle Laprise
* All rights reserved.
*
* 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

View File

@@ -1,165 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2007 Emmanuelle Laprise
//
// 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
//
#include <algorithm>
#include "ns3/assert.h"
#include "ns3/fatal-error.h"
#include "ns3/nstime.h"
#include "ns3/internet-node.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/queue.h"
#include "ns3/drop-tail-queue.h"
#include "ns3/string.h"
#include "csma-channel.h"
#include "csma-net-device.h"
#include "csma-ipv4-topology.h"
namespace ns3 {
uint32_t
CsmaIpv4Topology::AddIpv4CsmaNetDevice(
Ptr<Node> node,
Ptr<CsmaChannel> channel,
Mac48Address addr)
{
Ptr<Queue> q = CreateObject<DropTailQueue> ();
// assume full-duplex
Ptr<CsmaNetDevice> nd = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("IpArp"));
node->AddDevice (nd);
nd->AddQueue(q);
nd->Attach (channel);
return nd->GetIfIndex ();
}
void
CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr<Node> n1,
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
Ptr<Queue> q = CreateObject<DropTailQueue> ();
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd0);
nd0->SetSendEnable (true);
nd0->SetReceiveEnable (false);
nd0->AddQueue(q);
nd0->Attach (ch);
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd1);
nd1->SetSendEnable (false);
nd1->SetReceiveEnable (true);
nd1->AddQueue(q);
nd1->Attach (ch);
}
void
CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr<Node> n1,
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
Ptr<Queue> q = CreateObject<DropTailQueue> ();
Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd0);
nd0->SetSendEnable (true);
nd0->SetReceiveEnable (false);
nd0->AddQueue(q);
nd0->Attach (ch);
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd1);
nd1->SetSendEnable (false);
nd1->SetReceiveEnable (true);
nd1->AddQueue(q);
nd1->Attach (ch);
}
uint32_t
CsmaIpv4Topology::AddIpv4Address(
Ptr<Node> node,
uint32_t netDeviceNumber,
const Ipv4Address address,
const Ipv4Mask mask,
uint16_t metric)
{
Ptr<NetDevice> nd = node->GetDevice(netDeviceNumber);
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
uint32_t ifIndex = ipv4->AddInterface (nd);
ipv4->SetAddress (ifIndex, address);
ipv4->SetNetworkMask (ifIndex, mask);
ipv4->SetMetric (ifIndex, metric);
ipv4->SetUp (ifIndex);
return ifIndex;
}
void
CsmaIpv4Topology::AddIpv4Routes (
Ptr<NetDevice> nd1, Ptr<NetDevice> nd2)
{
// Assert that both are Ipv4 nodes
Ptr<Ipv4> ip1 = nd1->GetNode ()->GetObject<Ipv4> ();
Ptr<Ipv4> ip2 = nd2->GetNode ()->GetObject<Ipv4> ();
NS_ASSERT(ip1 != 0 && ip2 != 0);
// Get interface indexes for both nodes corresponding to the right channel
uint32_t index1 = 0;
bool found = false;
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
{
if (ip1 ->GetNetDevice (i) == nd1)
{
index1 = i;
found = true;
}
}
NS_ASSERT (found);
uint32_t index2 = 0;
found = false;
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
{
if (ip2 ->GetNetDevice (i) == nd2)
{
index2 = i;
found = true;
}
}
NS_ASSERT (found);
ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1);
ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2);
}
} // namespace ns3

View File

@@ -1,129 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2007 Emmanuelle Laprise
//
// 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
//
#ifndef __CSMA_IPV4_TOPOLOGY_H__
#define __CSMA_IPV4_TOPOLOGY_H__
#include "ns3/ptr.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-route.h"
#include "ns3/internet-node.h"
#include "ns3/csma-net-device.h"
// The topology class consists of only static methods thar are used to
// create the topology and data flows for an ns3 simulation
namespace ns3 {
class CsmaIpv4Channel;
class Node;
class IPAddr;
class DataRate;
class Queue;
/**
* \brief A helper class to create Topologies based on the
* InternetNodes and CsmaChannels. Either the
* SimpleCsmaNetDevice or the LLCCsmaNetDevice can be used
* when constructing these topologies.
*/
class CsmaIpv4Topology {
public:
/**
* \param node Node to be attached to the Csma channel
* \param channel CsmaChannel to which node n1 should be attached
* \param addr Mac address of the node
*
* Add a Csma node to a Csma channel. This function adds
* a EthernetCsmaNetDevice to the nodes so that they can
* connect to a CsmaChannel. This means that Ethernet headers
* and trailers will be added to the packet before sending out on
* the net device.
*
* \return ifIndex of the device
*/
static uint32_t AddIpv4CsmaNetDevice(Ptr<Node> node,
Ptr<CsmaChannel> channel,
Mac48Address addr);
/**
* \param n1 Node to be attached to the Csma channel
* \param ch CsmaChannel to which node n1 should be attached
* \param addr Mac address of the node
*
* Add a Csma node to a Csma channel. This function adds
* a RawCsmaNetDevice to the nodes so that they can connect
* to a CsmaChannel.
*/
static void AddIpv4RawCsmaNode( Ptr<Node> n1,
Ptr<CsmaChannel> ch,
Mac48Address addr);
/**
* \param n1 Node to be attached to the Csma channel
* \param ch CsmaChannel to which node n1 should be attached
* \param addr Mac address of the node
*
* Add a Csma node to a Csma channel. This function adds
* a LlcCsmaNetDevice to the nodes so that they can connect
* to a CsmaChannel.
*/
static void AddIpv4LlcCsmaNode( Ptr<Node> n1,
Ptr<CsmaChannel> ch,
Mac48Address addr);
/**
* \brief Create an Ipv4 interface for a net device and assign an
* Ipv4Address to that interface.
*
* \param node The node to which to add the new address and corresponding
* interface.
* \param netDeviceNumber The NetDevice index number with which to associate
* the address.
* \param address The Ipv4 Address for the interface.
* \param mask The network mask for the interface
* \param metric (optional) metric (cost) to assign for routing calculations
*
* Add an Ipv4Address to the Ipv4 interface associated with the
* ndNum CsmaIpv4NetDevices on the provided CsmaIpv4Channel
*/
static uint32_t AddIpv4Address(Ptr<Node> node,
uint32_t netDeviceNumber,
const Ipv4Address address,
const Ipv4Mask mask,
uint16_t metric = 1);
/**
* \param nd1 Node
* \param nd2 Node
*
* Add an IPV4 host route between the two specified net devices
*/
static void AddIpv4Routes (Ptr<NetDevice> nd1, Ptr<NetDevice> nd2);
};
} // namespace ns3
#endif

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Emmanuelle Laprise
* All rights reserved.
*
* 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

View File

@@ -1,102 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2007 Emmanuelle Laprise
//
// 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
//
//
// Topology helper for Csma channels in ns3.
#include "ns3/assert.h"
#include "ns3/queue.h"
#include "csma-channel.h"
#include "csma-net-device.h"
#include "csma-topology.h"
#include "ns3/socket-factory.h"
namespace ns3 {
Ptr<CsmaChannel>
CsmaTopology::CreateCsmaChannel(
const DataRate& bps,
const Time& delay)
{
Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> ("BitRate", bps, "Delay", delay);
return channel;
}
#if 0
Ptr<CsmaNetDevice>
CsmaTopology::AddCsmaEthernetNode(
Ptr<Node> n1,
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Address", addr,
"EncapsulationMode", "EthernetV1");
Ptr<Queue> q = Queue::CreateDefault ();
nd1->AddQueue(q);
nd1->Attach (ch);
return nd1;
}
Ptr<PacketSocket>
CsmaTopology::ConnectPacketSocket(Ptr<PacketSocketApp> app,
Ptr<CsmaNetDevice> ndSrc,
Ptr<CsmaNetDevice> ndDest)
{
Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
socket->Bind(ndSrc);
socket->Connect(ndDest->GetAddress());
app->Connect(socket);
return socket;
}
Ptr<PacketSocket>
CsmaTopology::ConnectPacketSocket(Ptr<PacketSocketApp> app,
Ptr<CsmaNetDevice> ndSrc,
MacAddress macAddr)
{
Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
socket->Bind(ndSrc);
socket->Connect(macAddr);
app->Connect(socket);
return socket;
}
Ptr<Socket>
CsmaTopology::CreatePacketSocket(Ptr<Node> n1, std::string tid_name)
{
TypeId tid = TypeId::LookupByName (tid_name);
Ptr<SocketFactory> socketFactory =
n1->GetObject<SocketFactory> (tid);
Ptr<Socket> socket = socketFactory->CreateSocket ();
return socket;
}
#endif
} // namespace ns3

View File

@@ -1,123 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2007 Emmanuelle Laprise
//
// 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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
//
// Topology helper for multipoint channels in ns3.
//
#ifndef CSMA_TOPOLOGY_H
#define CSMA_TOPOLOGY_H
#include "ns3/ptr.h"
#include "ns3/csma-net-device.h"
#include "ns3/node.h"
// The topology class consists of only static methods thar are used to
// create the topology and data flows for an ns3 simulation
namespace ns3 {
class CsmaChannel;
class Node;
class DataRate;
class Queue;
/**
* \brief A helper class to create Csma Topologies
*
* Csma topologies are created based on the
* ns3::CsmaNetDevice subclasses and ns3::CsmaChannel
* objects. This class uses the EthernetNetDevice and
* PacketSocket classes in order to create logical connections between
* net devices. The PacketSocket class generates the data and the
* EthernetNetDevice class creates ethernet packets from the
* data, filling in source and destination addresses. The
* EthernetNetDevice class filters received data packets
* according to its destination Mac addresses.
*/
class CsmaTopology {
public:
/**
* \param dataRate Maximum transmission link rate
* \param delay propagation delay between any two nodes
* \return Pointer to the created CsmaChannel
*
* Create a CsmaChannel. All nodes connected to a multipoint
* channels will receive all packets written to that channel
*/
static Ptr<CsmaChannel> CreateCsmaChannel(
const DataRate& dataRate, const Time& delay);
#if 0
/**
* \param n1 Node to be attached to the multipoint channel
* \param ch CsmaChannel to which node n1 should be attached
* \param addr MacAddress that should be assigned to the
* EthernetNetDevice that will be added to the node.
*
* Add a multipoint node to a multipoint channel
*/
static Ptr<CsmaNetDevice> AddCsmaEthernetNode(Ptr<Node> n1,
Ptr<CsmaChannel> ch,
MacAddress addr);
/**
* \param app Application that will be sending data to the agent
* \param ndSrc Net Device that will be sending the packets onto the
* network
* \param ndDest Net Device to which ndSrc will be sending the packets
* \return A pointer to the PacketSocket
*
* Creates an PacketSocket and configure it to send packets between
* two net devices
*/
static Ptr<PacketSocket> ConnectPacketSocket(Ptr<PacketSocketApp> app,
Ptr<CsmaNetDevice> ndSrc,
Ptr<CsmaNetDevice> ndDest);
/**
* \param app Application that will be sending data to the agent
* \param ndSrc Net Device that will be sending the packets onto the
* network
* \param macAddr Mac destination address for the packets send by
* the ndSrc net device \return a Pointer to the created
* PacketSocket
*
* Creates an PacketSocket and configure it to send packets from a
* net device to a destination MacAddress
*/
static Ptr<PacketSocket> ConnectPacketSocket(Ptr<PacketSocketApp> app,
Ptr<CsmaNetDevice> ndSrc,
MacAddress macAddr);
/**
* \param n1 Node from which socketfactory should be tested.
* \param tid_name Interface identifier ("ns3::PacketSocketFactory", in this case)
*
* This is a test function to make sure that a socket can be created
* by using the socketfactory interface provided in the
* netdevicenode.
*/
static Ptr<Socket> CreatePacketSocket(Ptr<Node> n1,
std::string tid_name);
#endif
};
} // namespace ns3
#endif

View File

@@ -6,8 +6,6 @@ def build(bld):
'backoff.cc',
'csma-net-device.cc',
'csma-channel.cc',
'csma-topology.cc',
'csma-ipv4-topology.cc',
]
headers = bld.create_obj('ns3header')
headers.module = 'csma'
@@ -15,6 +13,4 @@ def build(bld):
'backoff.h',
'csma-net-device.h',
'csma-channel.h',
'csma-topology.h',
'csma-ipv4-topology.h',
]

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 University of Washington
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,252 +0,0 @@
/* -*- 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>
//
//
// Topology helper for ns3.
// George F. Riley, Georgia Tech, Spring 2007
#include <algorithm>
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/fatal-error.h"
#include "ns3/nstime.h"
#include "ns3/internet-node.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/queue.h"
#include "ns3/drop-tail-queue.h"
#include "point-to-point-channel.h"
#include "point-to-point-net-device.h"
#include "point-to-point-topology.h"
namespace ns3 {
Ptr<PointToPointChannel>
PointToPointTopology::AddPointToPointLink(
Ptr<Node> n1,
Ptr<Node> n2,
const DataRate& bps,
const Time& delay)
{
Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ("BitRate", bps, "Delay", delay);
Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
n1->AddDevice (net1);
Ptr<Queue> q = CreateObject<DropTailQueue> ();
net1->AddQueue(q);
net1->Attach (channel);
Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> ("Address", Mac48Address::Allocate ());
n2->AddDevice (net2);
q = CreateObject<DropTailQueue> ();
net2->AddQueue(q);
net2->Attach (channel);
return channel;
}
Ptr<PointToPointNetDevice>
PointToPointTopology::GetNetDevice (Ptr<Node> n, Ptr<PointToPointChannel> chan)
{
Ptr<PointToPointNetDevice> found = 0;
// The PointToPoint channel is used to find the relevant NetDevice
NS_ASSERT (chan->GetNDevices () == 2);
Ptr<PointToPointNetDevice> nd1 = chan->GetPointToPointDevice (0);
Ptr<PointToPointNetDevice> nd2 = chan->GetPointToPointDevice (1);
if ( nd1->GetNode ()->GetId () == n->GetId () )
{
found = nd1;
}
else if ( nd2->GetNode ()->GetId () == n->GetId () )
{
found = nd2;
}
else
{
NS_ASSERT (found);
}
return found;
}
void
PointToPointTopology::AddIpv4Addresses(
Ptr<const PointToPointChannel> chan,
Ptr<Node> n1, const Ipv4Address& addr1,
Ptr<Node> n2, const Ipv4Address& addr2)
{
// Duplex link is assumed to be subnetted as a /30
// May run this unnumbered in the future?
Ipv4Mask netmask("255.255.255.252");
NS_ASSERT (netmask.IsMatch(addr1,addr2));
// The PointToPoint channel is used to find the relevant NetDevices
NS_ASSERT (chan->GetNDevices () == 2);
Ptr<NetDevice> nd1 = chan->GetDevice (0);
Ptr<NetDevice> nd2 = chan->GetDevice (1);
// Make sure that nd1 belongs to n1 and nd2 to n2
if ( (nd1->GetNode ()->GetId () == n2->GetId () ) &&
(nd2->GetNode ()->GetId () == n1->GetId () ) )
{
std::swap(nd1, nd2);
}
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> ();
uint32_t index1 = ip1->AddInterface (nd1);
ip1->SetAddress (index1, addr1);
ip1->SetNetworkMask (index1, netmask);
ip1->SetUp (index1);
Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> ();
uint32_t index2 = ip2->AddInterface (nd2);
ip2->SetAddress (index2, addr2);
ip2->SetNetworkMask (index2, netmask);
ip2->SetUp (index2);
}
void
PointToPointTopology::SetIpv4Metric(
Ptr<const PointToPointChannel> chan,
Ptr<Node> n1, Ptr<Node> n2, uint16_t metric)
{
// The PointToPoint channel is used to find the relevant NetDevices
NS_ASSERT (chan->GetNDevices () == 2);
Ptr<NetDevice> nd1 = chan->GetDevice (0);
Ptr<NetDevice> nd2 = chan->GetDevice (1);
// Make sure that nd1 belongs to n1 and nd2 to n2
if ( (nd1->GetNode ()->GetId () == n2->GetId () ) &&
(nd2->GetNode ()->GetId () == n1->GetId () ) )
{
std::swap(nd1, nd2);
}
NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ());
NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ());
// The NetDevice ifIndex does not correspond to the
// ifIndex used by Ipv4. Therefore, we have to iterate
// through the NetDevices until we find the Ipv4 ifIndex
// that corresponds to NetDevice nd1
// Get interface indexes for both nodes corresponding to the right channel
uint32_t index = 0;
bool found = false;
Ptr<Ipv4> ip1 = n1->GetObject<Ipv4> ();
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
{
if (ip1 ->GetNetDevice (i) == nd1)
{
index = i;
found = true;
}
}
NS_ASSERT(found);
ip1->SetMetric (index, metric);
index = 0;
found = false;
Ptr<Ipv4> ip2 = n2->GetObject<Ipv4> ();
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
{
if (ip2 ->GetNetDevice (i) == nd2)
{
index = i;
found = true;
}
}
NS_ASSERT(found);
ip2->SetMetric (index, metric);
}
void
PointToPointTopology::AddIpv4Routes (
Ptr<Node> n1, Ptr<Node> n2, Ptr<const PointToPointChannel> chan)
{
// The PointToPoint channel is used to find the relevant NetDevices
NS_ASSERT (chan->GetNDevices () == 2);
Ptr<NetDevice> nd1 = chan->GetDevice (0);
Ptr<NetDevice> nd2 = chan->GetDevice (1);
// Assert that n1 is the Node owning one of the two NetDevices
// and make sure that nd1 corresponds to it
if (nd1->GetNode ()->GetId () == n1->GetId ())
{
; // Do nothing
}
else if (nd2->GetNode ()->GetId () == n1->GetId ())
{
std::swap(nd1, nd2);
}
else
{
NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel");
}
// Assert that n2 is the Node owning one of the two NetDevices
// and make sure that nd2 corresponds to it
if (nd2->GetNode ()->GetId () != n2->GetId ())
{
NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel");
}
// Assert that both are Ipv4 nodes
Ptr<Ipv4> ip1 = nd1->GetNode ()->GetObject<Ipv4> ();
Ptr<Ipv4> ip2 = nd2->GetNode ()->GetObject<Ipv4> ();
NS_ASSERT(ip1 != 0 && ip2 != 0);
// Get interface indexes for both nodes corresponding to the right channel
uint32_t index1 = 0;
bool found = false;
for (uint32_t i = 0; i < ip1->GetNInterfaces (); i++)
{
if (ip1 ->GetNetDevice (i) == nd1)
{
index1 = i;
found = true;
}
}
NS_ASSERT(found);
uint32_t index2 = 0;
found = false;
for (uint32_t i = 0; i < ip2->GetNInterfaces (); i++)
{
if (ip2 ->GetNetDevice (i) == nd2)
{
index2 = i;
found = true;
}
}
NS_ASSERT(found);
ip1->AddHostRouteTo (ip2-> GetAddress (index2), index1);
ip2->AddHostRouteTo (ip1-> GetAddress (index1), index2);
}
} // namespace ns3

View File

@@ -1,112 +0,0 @@
/* -*- 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>
//
// Topology helper for ns3.
// George F. Riley, Georgia Tech, Spring 2007
#ifndef __POINT_TO_POINT_TOPOLOGY_H__
#define __POINT_TO_POINT_TOPOLOGY_H__
#include "ns3/ptr.h"
// The topology class consists of only static methods thar are used to
// create the topology and data flows for an ns3 simulation
namespace ns3 {
class PointToPointChannel;
class Node;
class IPAddr;
class DataRate;
class Queue;
/**
* \brief A helper class to create Topologies based on the
* ns3::PointToPointNetDevice and ns3::PointToPointChannel objects.
*/
class PointToPointTopology {
public:
/**
* \param n1 Node
* \param n2 Node
* \param dataRate Maximum transmission link rate
* \param delay one-way propagation delay
* \return Pointer to the underlying PointToPointChannel
*
* Add a full-duplex point-to-point link between two nodes
* and attach PointToPointNetDevices to the resulting
* PointToPointChannel.
*/
static Ptr<PointToPointChannel> AddPointToPointLink(
Ptr<Node> n1, Ptr<Node> n2, const DataRate& dataRate, const Time& delay);
/**
* \param n Node
* \param chan PointToPointChannel connected to node n
* \return Pointer to the corresponding PointToPointNetDevice
*
* Utility function to retrieve a PointToPointNetDevice pointer
* corresponding to the input parameters
*/
static Ptr<PointToPointNetDevice> GetNetDevice(
Ptr<Node> n, Ptr<PointToPointChannel> chan);
/**
* \param chan PointToPointChannel to use
* \param n1 Node
* \param addr1 Ipv4 Address for n1
* \param n2 Node
* \param addr2 Ipv4 Address for n2
*
* Add Ipv4Addresses to the Ipv4 interfaces associated with the
* two PointToPointNetDevices on the provided PointToPointChannel
*/
static void AddIpv4Addresses(
Ptr<const PointToPointChannel> chan,
Ptr<Node> n1, const Ipv4Address& addr1,
Ptr<Node> n2, const Ipv4Address& addr2);
/**
* \param chan PointToPointChannel to use
* \param n1 Node
* \param n2 Node
* \param metric link metric to assign on Ipv4Link on chan between n1 and n2
*
* Add a non-unit-cost link metric (bidirectionally) to the Ipv4
* interfaces associated with the two PointToPointNetDevices on the
* provided PointToPointChannel
*/
static void SetIpv4Metric(
Ptr<const PointToPointChannel> chan,
Ptr<Node> n1, Ptr<Node> n2, uint16_t metric);
/**
* \param channel PointToPointChannel to use
* \param n1 Node
* \param n2 Node
*
* For the given PointToPointChannel, for each Node, add an
* IPv4 host route to the IPv4 address of the peer node.
*/
static void AddIpv4Routes (Ptr<Node> n1, Ptr<Node> n2, Ptr<const PointToPointChannel> channel);
};
} // namespace ns3
#endif

View File

@@ -6,7 +6,6 @@ def build(bld):
module.source = [
'point-to-point-net-device.cc',
'point-to-point-channel.cc',
'point-to-point-topology.cc',
'point-to-point-test.cc',
]
headers = bld.create_obj('ns3header')
@@ -14,6 +13,5 @@ def build(bld):
headers.source = [
'point-to-point-net-device.h',
'point-to-point-channel.h',
'point-to-point-topology.h',
]

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "application-container.h"
namespace ns3 {

View File

@@ -1,3 +1,22 @@
/* -*- 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 APPLICATION_CONTAINER_H
#define APPLICATION_CONTAINER_H
@@ -42,7 +61,7 @@ public:
*/
void Add (ApplicationContainer other);
/**
* \param device another netdevice pointer.
* \param application another netdevice pointer.
*
* Append to the end of this container the input netdevice pointer.
*/

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "csma-helper.h"
#include "ns3/simulator.h"
#include "ns3/object-factory.h"
@@ -48,7 +67,7 @@ void
CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
{
std::ostringstream oss;
oss << filename << "-" << nodeid << "-" << deviceid;
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
Ptr<PcapWriter> pcap = Create<PcapWriter> ();
pcap->Open (oss.str ());
pcap->WriteEthernetHeader ();

View File

@@ -1,3 +1,22 @@
/* -*- 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 CSMA_HELPER_H
#define CSMA_HELPER_H
@@ -67,7 +86,7 @@ public:
*
* Generate a pcap file which contains the link-level data observed
* by the specified deviceid within the specified nodeid. The pcap
* data is stored in the file prefix-nodeid-deviceid.
* data is stored in the file prefix-nodeid-deviceid.pcap.
*
* This method should be invoked after the network topology has
* been fully constructed.

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "internet-stack-helper.h"
#include "ns3/internet-stack.h"
#include "ns3/packet-socket-factory.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 INTERNET_STACK_HELPER_H
#define INTERNET_STACK_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "ns3/mobility-helper.h"
#include "ns3/mobility-model.h"
#include "ns3/mobility-model-notifier.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 MOBILITY_HELPER_H
#define MOBILITY_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "net-device-container.h"
namespace ns3 {

View File

@@ -1,3 +1,22 @@
/* -*- 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 NET_DEVICE_CONTAINER_H
#define NET_DEVICE_CONTAINER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "node-container.h"
#include "ns3/node-list.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 NODE_CONTAINER_H
#define NODE_CONTAINER_H

View File

@@ -1,7 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,7 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 INRIA
* All rights reserved.
*
* 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

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "olsr-helper.h"
#include "ns3/olsr-agent.h"
#include "ns3/node-list.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 OLSR_HELPER_H
#define OLSR_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "on-off-helper.h"
#include "ns3/inet-socket-address.h"
#include "ns3/packet-socket-address.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 ON_OFF_HELPER_H
#define ON_OFF_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "packet-sink-helper.h"
#include "ns3/string.h"
#include "ns3/inet-socket-address.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 PACKET_SINK_HELPER_H
#define PACKET_SINK_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "point-to-point-helper.h"
#include "ns3/simulator.h"
#include "ns3/point-to-point-net-device.h"
@@ -48,7 +67,7 @@ void
PointToPointHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
{
std::ostringstream oss;
oss << filename << "-" << nodeid << "-" << deviceid;
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
Ptr<PcapWriter> pcap = Create<PcapWriter> ();
pcap->Open (oss.str ());
pcap->WriteEthernetHeader ();

View File

@@ -1,3 +1,22 @@
/* -*- 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 POINT_TO_POINT_HELPER_H
#define POINT_TO_POINT_HELPER_H
@@ -66,7 +85,7 @@ public:
*
* Generate a pcap file which contains the link-level data observed
* by the specified deviceid within the specified nodeid. The pcap
* data is stored in the file prefix-nodeid-deviceid.
* data is stored in the file prefix-nodeid-deviceid.pcap.
*
* This method should be invoked after the network topology has
* been fully constructed.

View File

@@ -1,3 +1,22 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 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
*
* Author: Tom Henderson <tomhend@u.washington.edu>
*/
#include <vector>
#include "ns3/ptr.h"

View File

@@ -1,3 +1,22 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 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
*
* Author: Tom Henderson <tomhend@u.washington.edu>
*/
#ifndef STATIC_MULTICAST_ROUTE_HELPER_H
#define STATIC_MULTICAST_ROUTE_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "udp-echo-helper.h"
#include "ns3/udp-echo-server.h"
#include "ns3/udp-echo-client.h"

View File

@@ -1,3 +1,22 @@
/* -*- 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 UDP_ECHO_HELPER_H
#define UDP_ECHO_HELPER_H

View File

@@ -1,3 +1,22 @@
/* -*- 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>
*/
#include "wifi-helper.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-mac.h"
@@ -12,6 +31,7 @@
#include "ns3/wifi-mode.h"
#include "ns3/wifi-preamble.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
@@ -38,14 +58,14 @@ static void AsciiPhyTxEvent (std::ostream *os, std::string context,
WifiMode mode, WifiPreamble preamble,
uint8_t txLevel)
{
*os << context << " " << *packet << std::endl;
*os << "+ " << Simulator::Now () << " " << context << " " << *packet << std::endl;
}
static void AsciiPhyRxOkEvent (std::ostream *os, std::string context,
Ptr<const Packet> packet, double snr, WifiMode mode,
enum WifiPreamble preamble)
{
*os << context << " " << *packet << std::endl;
*os << "r " << Simulator::Now () << " " << context << " " << *packet << std::endl;
}
@@ -129,7 +149,7 @@ void
WifiHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid)
{
std::ostringstream oss;
oss << filename << "-" << nodeid << "-" << deviceid;
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap";
Ptr<PcapWriter> pcap = Create<PcapWriter> ();
pcap->Open (oss.str ());
pcap->WriteWifiHeader ();

View File

@@ -1,3 +1,22 @@
/* -*- 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_HELPER_H
#define WIFI_HELPER_H
@@ -128,7 +147,7 @@ public:
*
* Generate a pcap file which contains the link-level data observed
* by the specified deviceid within the specified nodeid. The pcap
* data is stored in the file prefix-nodeid-deviceid.
* data is stored in the file prefix-nodeid-deviceid.pcap.
*
* This method should be invoked after the network topology has
* been fully constructed.

View File

@@ -1,7 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006 INRIA
* All rights reserved.
*
* 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

Some files were not shown because too many files have changed in this diff Show More