1.1 --- a/examples/csma-broadcast.cc Mon Apr 07 10:44:06 2008 -0700
1.2 +++ b/examples/csma-broadcast.cc Mon Apr 07 18:29:38 2008 -0700
1.3 @@ -33,8 +33,9 @@
1.4 #include <cassert>
1.5
1.6 #include "ns3/core-module.h"
1.7 +#include "ns3/simulator-module.h"
1.8 +#include "ns3/node-module.h"
1.9 #include "ns3/helper-module.h"
1.10 -#include "ns3/simulator-module.h"
1.11
1.12 using namespace ns3;
1.13
1.14 @@ -94,10 +95,10 @@
1.15 // Create the OnOff application to send UDP datagrams of size
1.16 // 512 bytes (default) at a rate of 500 Kb/s (default) from n0
1.17 NS_LOG_INFO ("Create Applications.");
1.18 - OnOffHelper onoff;
1.19 - onoff.SetUdpRemote (Ipv4Address ("255.255.255.255"), port);
1.20 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
1.21 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
1.22 + OnOffHelper onoff ("ns3::Udp",
1.23 + Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
1.24 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
1.25 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
1.26
1.27 ApplicationContainer app = onoff.Install (c0.Get (0));
1.28 // Start the application
1.29 @@ -105,12 +106,11 @@
1.30 app.Stop (Seconds (10.0));
1.31
1.32 // Create an optional packet sink to receive these packets
1.33 - PacketSinkHelper sink;
1.34 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
1.35 + PacketSinkHelper sink ("ns3::Udp",
1.36 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
1.37 sink.Install (c0.Get (1));
1.38 sink.Install (c1.Get (1));
1.39
1.40 -
1.41 // Also configure some tcpdump traces; each interface will be traced
1.42 // The output files will be named
1.43 // csma-broadcast.pcap-<nodeId>-<interfaceId>
2.1 --- a/examples/csma-multicast.cc Mon Apr 07 10:44:06 2008 -0700
2.2 +++ b/examples/csma-multicast.cc Mon Apr 07 18:29:38 2008 -0700
2.3 @@ -33,8 +33,9 @@
2.4 #include <fstream>
2.5
2.6 #include "ns3/core-module.h"
2.7 +#include "ns3/simulator-module.h"
2.8 +#include "ns3/node-module.h"
2.9 #include "ns3/helper-module.h"
2.10 -#include "ns3/simulator-module.h"
2.11
2.12 using namespace ns3;
2.13
2.14 @@ -140,12 +141,12 @@
2.15
2.16 // Configure a multicast packet generator that generates a packet
2.17 // every few seconds
2.18 - OnOffHelper onoff;
2.19 - onoff.SetUdpRemote (multicastGroup, multicastPort);
2.20 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
2.21 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
2.22 - onoff.SetAppAttribute ("DataRate", DataRate ("255b/s"));
2.23 - onoff.SetAppAttribute ("PacketSize", Uinteger (128));
2.24 + OnOffHelper onoff ("ns3::Udp",
2.25 + Address (InetSocketAddress (multicastGroup, multicastPort)));
2.26 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
2.27 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
2.28 + onoff.SetAttribute ("DataRate", DataRate ("255b/s"));
2.29 + onoff.SetAttribute ("PacketSize", Uinteger (128));
2.30
2.31 ApplicationContainer srcC = onoff.Install (c0.Get (0));
2.32
2.33 @@ -156,8 +157,9 @@
2.34 srcC.Stop (Seconds(10.));
2.35
2.36 // Create an optional packet sink to receive these packets
2.37 - PacketSinkHelper sink;
2.38 - sink.SetUdpLocal (Ipv4Address::GetAny(), multicastPort);
2.39 + PacketSinkHelper sink ("ns3::Udp",
2.40 + Address (InetSocketAddress (Ipv4Address::GetAny(), multicastPort)));
2.41 +
2.42 ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4
2.43 // Start the sink
2.44 sinkC.Start (Seconds (1.0));
3.1 --- a/examples/csma-one-subnet.cc Mon Apr 07 10:44:06 2008 -0700
3.2 +++ b/examples/csma-one-subnet.cc Mon Apr 07 18:29:38 2008 -0700
3.3 @@ -29,6 +29,7 @@
3.4 #include <fstream>
3.5
3.6 #include "ns3/simulator-module.h"
3.7 +#include "ns3/node-module.h"
3.8 #include "ns3/core-module.h"
3.9 #include "ns3/helper-module.h"
3.10
3.11 @@ -94,10 +95,10 @@
3.12 NS_LOG_INFO ("Create Applications.");
3.13 uint16_t port = 9; // Discard port (RFC 863)
3.14
3.15 - OnOffHelper onoff;
3.16 - onoff.SetUdpRemote (Ipv4Address ("10.1.1.2"), port);
3.17 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
3.18 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
3.19 + OnOffHelper onoff ("ns3::Udp",
3.20 + Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
3.21 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
3.22 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
3.23
3.24 ApplicationContainer app = onoff.Install (c.Get (0));
3.25 // Start the application
3.26 @@ -105,14 +106,15 @@
3.27 app.Stop (Seconds (10.0));
3.28
3.29 // Create an optional packet sink to receive these packets
3.30 - PacketSinkHelper sink;
3.31 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
3.32 + PacketSinkHelper sink ("ns3::Udp",
3.33 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
3.34 sink.Install (c.Get (1));
3.35
3.36 //
3.37 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
3.38 //
3.39 - onoff.SetUdpRemote (Ipv4Address("10.1.1.1"), port);
3.40 + onoff.SetAttribute ("Remote",
3.41 + Address (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
3.42 ApplicationContainer app2 = onoff.Install (c.Get (3));
3.43
3.44 sink.Install (c.Get (0));
4.1 --- a/examples/csma-packet-socket.cc Mon Apr 07 10:44:06 2008 -0700
4.2 +++ b/examples/csma-packet-socket.cc Mon Apr 07 18:29:38 2008 -0700
4.3 @@ -35,6 +35,7 @@
4.4
4.5 #include "ns3/core-module.h"
4.6 #include "ns3/simulator-module.h"
4.7 +#include "ns3/node-module.h"
4.8 #include "ns3/helper-module.h"
4.9
4.10 #include "ns3/ascii-trace.h"
4.11 @@ -80,16 +81,23 @@
4.12
4.13 NS_LOG_INFO ("Create Applications.");
4.14 // Create the OnOff application to send raw datagrams
4.15 - OnOffHelper onoff;
4.16 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1.0));
4.17 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0.0));
4.18 - onoff.SetPacketRemote (devs.Get (0), devs.Get (1)->GetAddress (), 2);
4.19 + PacketSocketAddress socket;
4.20 + socket.SetSingleDevice(devs.Get (0)->GetIfIndex ());
4.21 + socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
4.22 + socket.SetProtocol (2);
4.23 + OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
4.24 + onoff.SetAttribute ("OnTime", ConstantVariable (1.0));
4.25 + onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
4.26 +
4.27 ApplicationContainer apps = onoff.Install (c.Get (0));
4.28 apps.Start (Seconds (1.0));
4.29 apps.Stop (Seconds (10.0));
4.30
4.31 -
4.32 - onoff.SetPacketRemote (devs.Get (3), devs.Get (0)->GetAddress (), 3);
4.33 + socket.SetSingleDevice (devs.Get (3)->GetIfIndex ());
4.34 + socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
4.35 + socket.SetProtocol (3);
4.36 + onoff.SetAttribute ("Remote", Address (socket));
4.37 + onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
4.38 apps = onoff.Install (c.Get (3));
4.39 apps.Start (Seconds (1.0));
4.40 apps.Stop (Seconds (10.0));
5.1 --- a/examples/mixed-global-routing.cc Mon Apr 07 10:44:06 2008 -0700
5.2 +++ b/examples/mixed-global-routing.cc Mon Apr 07 18:29:38 2008 -0700
5.3 @@ -37,8 +37,9 @@
5.4 #include <cassert>
5.5
5.6 #include "ns3/core-module.h"
5.7 +#include "ns3/simulator-module.h"
5.8 +#include "ns3/node-module.h"
5.9 #include "ns3/helper-module.h"
5.10 -#include "ns3/simulator-module.h"
5.11 #include "ns3/ascii-trace.h"
5.12 #include "ns3/pcap-trace.h"
5.13 #include "ns3/global-route-manager.h"
5.14 @@ -50,37 +51,6 @@
5.15 int
5.16 main (int argc, char *argv[])
5.17 {
5.18 -
5.19 - // Users may find it convenient to turn on explicit debugging
5.20 - // for selected modules; the below lines suggest how to do this
5.21 -#if 0
5.22 - LogComponentEnable ("MixedGlobalRoutingExample", LOG_LEVEL_INFO);
5.23 -
5.24 - LogComponentEnable("Object", LOG_LEVEL_ALL);
5.25 - LogComponentEnable("Queue", LOG_LEVEL_ALL);
5.26 - LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
5.27 - LogComponentEnable("Channel", LOG_LEVEL_ALL);
5.28 - LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL);
5.29 - LogComponentEnable("NetDevice", LOG_LEVEL_ALL);
5.30 - LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL);
5.31 - LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
5.32 - LogComponentEnable("PacketSocket", LOG_LEVEL_ALL);
5.33 - LogComponentEnable("Socket", LOG_LEVEL_ALL);
5.34 - LogComponentEnable("UdpSocket", LOG_LEVEL_ALL);
5.35 - LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL);
5.36 - LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
5.37 - LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL);
5.38 - LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL);
5.39 - LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL);
5.40 - LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL);
5.41 - LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL);
5.42 - LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL);
5.43 - LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL);
5.44 - LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL);
5.45 -#endif
5.46 - // Set up some default values for the simulation. Use the Bind ()
5.47 -
5.48 -
5.49 Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
5.50 Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
5.51
5.52 @@ -142,12 +112,13 @@
5.53 // 210 bytes at a rate of 448 Kb/s
5.54 NS_LOG_INFO ("Create Applications.");
5.55 uint16_t port = 9; // Discard port (RFC 863)
5.56 - OnOffHelper onoff;
5.57 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
5.58 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
5.59 - onoff.SetAppAttribute ("DataRate", DataRate("300bps"));
5.60 - onoff.SetAppAttribute ("PacketSize", Uinteger (50));
5.61 - onoff.SetUdpRemote (i5i6.GetAddress (1), port);
5.62 + OnOffHelper onoff ("ns3::Udp",
5.63 + Address (InetSocketAddress (i5i6.GetAddress (1), port)));
5.64 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
5.65 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
5.66 + onoff.SetAttribute ("DataRate", DataRate("300bps"));
5.67 + onoff.SetAttribute ("PacketSize", Uinteger (50));
5.68 +
5.69 ApplicationContainer apps = onoff.Install (c.Get (0));
5.70 apps.Start (Seconds (1.0));
5.71 apps.Stop (Seconds (10.0));
6.1 --- a/examples/simple-alternate-routing.cc Mon Apr 07 10:44:06 2008 -0700
6.2 +++ b/examples/simple-alternate-routing.cc Mon Apr 07 18:29:38 2008 -0700
6.3 @@ -39,6 +39,7 @@
6.4
6.5 #include "ns3/core-module.h"
6.6 #include "ns3/simulator-module.h"
6.7 +#include "ns3/node-module.h"
6.8 #include "ns3/helper-module.h"
6.9 #include "ns3/global-route-manager.h"
6.10
6.11 @@ -140,17 +141,18 @@
6.12 uint16_t port = 9; // Discard port (RFC 863)
6.13
6.14 // Create a flow from n3 to n1, starting at time 1.1 seconds
6.15 - OnOffHelper onoff;
6.16 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
6.17 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
6.18 - onoff.SetUdpRemote (i1i2.GetAddress (0), port);
6.19 + OnOffHelper onoff ("ns3::Udp",
6.20 + Address (InetSocketAddress (i1i2.GetAddress (0), port)));
6.21 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
6.22 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
6.23 +
6.24 ApplicationContainer apps = onoff.Install (c.Get (3));
6.25 apps.Start (Seconds (1.1));
6.26 apps.Start (Seconds (10.0));
6.27
6.28 // Create a packet sink to receive these packets
6.29 - PacketSinkHelper sink;
6.30 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
6.31 + PacketSinkHelper sink ("ns3::Udp",
6.32 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
6.33 apps = sink.Install (c.Get (1));
6.34 apps.Start (Seconds (1.1));
6.35 apps.Stop (Seconds (10.0));
6.36 @@ -160,7 +162,6 @@
6.37 PointToPointHelper::EnablePcap ("simple-alternate-routing");
6.38 PointToPointHelper::EnableAscii (ascii);
6.39
6.40 -
6.41 NS_LOG_INFO ("Run Simulation.");
6.42 Simulator::Run ();
6.43 Simulator::Destroy ();
7.1 --- a/examples/simple-error-model.cc Mon Apr 07 10:44:06 2008 -0700
7.2 +++ b/examples/simple-error-model.cc Mon Apr 07 18:29:38 2008 -0700
7.3 @@ -42,6 +42,7 @@
7.4 #include "ns3/core-module.h"
7.5 #include "ns3/common-module.h"
7.6 #include "ns3/simulator-module.h"
7.7 +#include "ns3/node-module.h"
7.8 #include "ns3/helper-module.h"
7.9 #include "ns3/global-route-manager.h"
7.10
7.11 @@ -120,29 +121,33 @@
7.12 // 210 bytes at a rate of 448 Kb/s
7.13 NS_LOG_INFO ("Create Applications.");
7.14 uint16_t port = 9; // Discard port (RFC 863)
7.15 - OnOffHelper onoff;
7.16 - onoff.SetUdpRemote (i3i2.GetAddress (1), port);
7.17 - onoff.SetAppAttribute ("OnTime", ConstantVariable(1));
7.18 - onoff.SetAppAttribute ("OffTime", ConstantVariable(0));
7.19 +
7.20 + OnOffHelper onoff ("ns3::Udp",
7.21 + Address (InetSocketAddress (i3i2.GetAddress (1), port)));
7.22 + onoff.SetAttribute ("OnTime", ConstantVariable(1));
7.23 + onoff.SetAttribute ("OffTime", ConstantVariable(0));
7.24 +
7.25 ApplicationContainer apps = onoff.Install (c.Get (0));
7.26 apps.Start(Seconds(1.0));
7.27 apps.Stop (Seconds(10.0));
7.28
7.29 // Create an optional packet sink to receive these packets
7.30 - PacketSinkHelper sink;
7.31 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
7.32 + PacketSinkHelper sink ("ns3::Udp",
7.33 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
7.34 apps = sink.Install (c.Get (3));
7.35 apps.Start (Seconds (1.0));
7.36 apps.Stop (Seconds (10.0));
7.37
7.38 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
7.39 - onoff.SetUdpRemote (i1i2.GetAddress (0), port);
7.40 + onoff.SetAttribute ("Remote",
7.41 + Address (InetSocketAddress (i1i2.GetAddress (0), port)));
7.42 apps = onoff.Install (c.Get (3));
7.43 apps.Start(Seconds(1.1));
7.44 apps.Stop (Seconds(10.0));
7.45
7.46 // Create a packet sink to receive these packets
7.47 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
7.48 + sink.SetAttribute ("Local",
7.49 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
7.50 apps = sink.Install (c.Get (1));
7.51 apps.Start (Seconds (1.1));
7.52 apps.Stop (Seconds (10.0));
8.1 --- a/examples/simple-global-routing.cc Mon Apr 07 10:44:06 2008 -0700
8.2 +++ b/examples/simple-global-routing.cc Mon Apr 07 18:29:38 2008 -0700
8.3 @@ -44,6 +44,7 @@
8.4
8.5 #include "ns3/core-module.h"
8.6 #include "ns3/simulator-module.h"
8.7 +#include "ns3/node-module.h"
8.8 #include "ns3/helper-module.h"
8.9 #include "ns3/global-route-manager.h"
8.10
8.11 @@ -121,23 +122,24 @@
8.12 // 210 bytes at a rate of 448 Kb/s
8.13 NS_LOG_INFO ("Create Applications.");
8.14 uint16_t port = 9; // Discard port (RFC 863)
8.15 - OnOffHelper onoff;
8.16 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
8.17 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
8.18 - onoff.SetUdpRemote (i3i2.GetAddress (0), port);
8.19 + OnOffHelper onoff ("ns3::Udp",
8.20 + Address (InetSocketAddress (i3i2.GetAddress (0), port)));
8.21 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
8.22 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
8.23 ApplicationContainer apps = onoff.Install (c.Get (0));
8.24 apps.Start (Seconds (1.0));
8.25 apps.Stop (Seconds (10.0));
8.26
8.27 // Create a packet sink to receive these packets
8.28 - PacketSinkHelper sink;
8.29 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
8.30 + PacketSinkHelper sink ("ns3::Udp",
8.31 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
8.32 apps = sink.Install (c.Get (3));
8.33 apps.Start (Seconds (1.0));
8.34 apps.Stop (Seconds (10.0));
8.35
8.36 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
8.37 - onoff.SetUdpRemote (i1i2.GetAddress (0), port);
8.38 + onoff.SetAttribute ("Remote",
8.39 + Address (InetSocketAddress (i1i2.GetAddress (0), port)));
8.40 apps = onoff.Install (c.Get (3));
8.41 apps.Start (Seconds (1.1));
8.42 apps.Stop (Seconds (10.0));
9.1 --- a/examples/simple-point-to-point-olsr.cc Mon Apr 07 10:44:06 2008 -0700
9.2 +++ b/examples/simple-point-to-point-olsr.cc Mon Apr 07 18:29:38 2008 -0700
9.3 @@ -44,6 +44,7 @@
9.4
9.5 #include "ns3/core-module.h"
9.6 #include "ns3/simulator-module.h"
9.7 +#include "ns3/node-module.h"
9.8 #include "ns3/helper-module.h"
9.9
9.10 using namespace ns3;
9.11 @@ -125,23 +126,27 @@
9.12 // 210 bytes at a rate of 448 Kb/s
9.13 NS_LOG_INFO ("Create Applications.");
9.14 uint16_t port = 9; // Discard port (RFC 863)
9.15 - OnOffHelper onoff;
9.16 - onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
9.17 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
9.18 - onoff.SetUdpRemote (i34.GetAddress (1), port);
9.19 +
9.20 + OnOffHelper onoff ("ns3::Udp",
9.21 + Address (InetSocketAddress (i34.GetAddress (1), port)));
9.22 + onoff.SetAttribute ("OnTime", ConstantVariable (1));
9.23 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
9.24 +
9.25 ApplicationContainer apps = onoff.Install (c.Get (0));
9.26 apps.Start (Seconds (1.0));
9.27 apps.Stop (Seconds (10.0));
9.28
9.29 // Create a packet sink to receive these packets
9.30 - PacketSinkHelper sink;
9.31 - sink.SetUdpLocal (Ipv4Address::GetAny (), port);
9.32 + PacketSinkHelper sink ("ns3::Udp",
9.33 + Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
9.34 +
9.35 apps = sink.Install (c.Get (3));
9.36 apps.Start (Seconds (1.0));
9.37 apps.Stop (Seconds (10.0));
9.38
9.39 // Create a similar flow from n3 to n1, starting at time 1.1 seconds
9.40 - onoff.SetUdpRemote (i12.GetAddress (0), port);
9.41 + onoff.SetAttribute ("Remote",
9.42 + Address (InetSocketAddress (i12.GetAddress (0), port)));
9.43 apps = onoff.Install (c.Get (3));
9.44 apps.Start (Seconds (1.1));
9.45 apps.Stop (Seconds (10.0));
10.1 --- a/examples/tcp-large-transfer.cc Mon Apr 07 10:44:06 2008 -0700
10.2 +++ b/examples/tcp-large-transfer.cc Mon Apr 07 18:29:38 2008 -0700
10.3 @@ -169,8 +169,9 @@
10.4 uint16_t servPort = 50000;
10.5
10.6 // Create a packet sink to receive these packets
10.7 - PacketSinkHelper sink;
10.8 - sink.SetTcpLocal (Ipv4Address::GetAny (), servPort);
10.9 + PacketSinkHelper sink ("ns3::Tcp",
10.10 + Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)));
10.11 +
10.12 ApplicationContainer apps = sink.Install (c1.Get (1));
10.13 apps.Start (Seconds (0.0));
10.14
11.1 --- a/examples/wifi-adhoc.cc Mon Apr 07 10:44:06 2008 -0700
11.2 +++ b/examples/wifi-adhoc.cc Mon Apr 07 18:29:38 2008 -0700
11.3 @@ -128,12 +128,17 @@
11.4
11.5 mobility.Layout (c);
11.6
11.7 - OnOffHelper onoff;
11.8 - onoff.SetAppAttribute ("OnTime", ConstantVariable (250));
11.9 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
11.10 - onoff.SetAppAttribute ("DataRate", DataRate (60000000));
11.11 - onoff.SetAppAttribute ("PacketSize", Uinteger (2000));
11.12 - onoff.SetPacketRemote (devices.Get (0), devices.Get (1)->GetAddress (), 1);
11.13 + PacketSocketAddress socket;
11.14 + socket.SetSingleDevice(devices.Get (0)->GetIfIndex ());
11.15 + socket.SetPhysicalAddress (devices.Get (1)->GetAddress ());
11.16 + socket.SetProtocol (1);
11.17 +
11.18 + OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
11.19 + onoff.SetAttribute ("OnTime", ConstantVariable (250));
11.20 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
11.21 + onoff.SetAttribute ("DataRate", DataRate (60000000));
11.22 + onoff.SetAttribute ("PacketSize", Uinteger (2000));
11.23 +
11.24 ApplicationContainer apps = onoff.Install (c.Get (0));
11.25 apps.Start (Seconds (0.5));
11.26 apps.Stop (Seconds (250.0));
12.1 --- a/examples/wifi-ap.cc Mon Apr 07 10:44:06 2008 -0700
12.2 +++ b/examples/wifi-ap.cc Mon Apr 07 18:29:38 2008 -0700
12.3 @@ -156,10 +156,15 @@
12.4
12.5 Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
12.6
12.7 - OnOffHelper onoff;
12.8 - onoff.SetAppAttribute ("OnTime", ConstantVariable (42));
12.9 - onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
12.10 - onoff.SetPacketRemote (staDevs.Get (0), staDevs.Get (1)->GetAddress (), 1);
12.11 + PacketSocketAddress socket;
12.12 + socket.SetSingleDevice(staDevs.Get (0)->GetIfIndex ());
12.13 + socket.SetPhysicalAddress (staDevs.Get (1)->GetAddress ());
12.14 + socket.SetProtocol (1);
12.15 +
12.16 + OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
12.17 + onoff.SetAttribute ("OnTime", ConstantVariable (42));
12.18 + onoff.SetAttribute ("OffTime", ConstantVariable (0));
12.19 +
12.20 ApplicationContainer apps = onoff.Install (stas.Get (0));
12.21 apps.Start (Seconds (0.5));
12.22 apps.Stop (Seconds (43.0));
13.1 --- a/src/helper/node-container.h Mon Apr 07 10:44:06 2008 -0700
13.2 +++ b/src/helper/node-container.h Mon Apr 07 18:29:38 2008 -0700
13.3 @@ -51,6 +51,14 @@
13.4 *
13.5 * Create a node container which is a concatenation of the two input
13.6 * NodeContainers.
13.7 + *
13.8 + * \note A frequently seen idiom that uses these constructors involves the
13.9 + * implicit conversion by constructor of Ptr<Node>. When used, two
13.10 + * Ptr<Node> will be passed to this constructor instead of NodeContainer&.
13.11 + * C++ will notice the implicit conversion path that goes through the
13.12 + * NodeContainer (Ptr<Node> node) constructor above. Using this conversion
13.13 + * one may provide optionally provide arguments of Ptr<Node> to these
13.14 + * constructors.
13.15 */
13.16 NodeContainer (const NodeContainer &a, const NodeContainer &b);
13.17
14.1 --- a/src/helper/on-off-helper.cc Mon Apr 07 10:44:06 2008 -0700
14.2 +++ b/src/helper/on-off-helper.cc Mon Apr 07 18:29:38 2008 -0700
14.3 @@ -24,36 +24,15 @@
14.4
14.5 namespace ns3 {
14.6
14.7 -OnOffHelper::OnOffHelper ()
14.8 +OnOffHelper::OnOffHelper (std::string protocol, Address address)
14.9 {
14.10 m_factory.SetTypeId ("ns3::OnOffApplication");
14.11 + m_factory.Set ("Protocol", String(protocol));
14.12 + m_factory.Set ("Remote", address);
14.13 }
14.14
14.15 void
14.16 -OnOffHelper::SetUdpRemote (Ipv4Address ip, uint16_t port)
14.17 -{
14.18 - m_factory.Set ("Protocol", String ("ns3::Udp"));
14.19 - m_factory.Set ("Remote", Address (InetSocketAddress (ip, port)));
14.20 -}
14.21 -void
14.22 -OnOffHelper::SetTcpRemote (Ipv4Address ip, uint16_t port)
14.23 -{
14.24 - m_factory.Set ("Protocol", String ("ns3::Tcp"));
14.25 - m_factory.Set ("Remote", Address (InetSocketAddress (ip, port)));
14.26 -}
14.27 -void
14.28 -OnOffHelper::SetPacketRemote (Ptr<NetDevice> source, Address destination, uint16_t protocol)
14.29 -{
14.30 - PacketSocketAddress packet;
14.31 - packet.SetSingleDevice (source->GetIfIndex ());
14.32 - packet.SetPhysicalAddress (destination);
14.33 - packet.SetProtocol (protocol);
14.34 - m_factory.Set ("Protocol", String ("ns3::PacketSocketFactory"));
14.35 - m_factory.Set ("Remote", Address (packet));
14.36 -}
14.37 -
14.38 -void
14.39 -OnOffHelper::SetAppAttribute (std::string name, Attribute value)
14.40 +OnOffHelper::SetAttribute (std::string name, Attribute value)
14.41 {
14.42 m_factory.Set (name, value);
14.43 }
15.1 --- a/src/helper/on-off-helper.h Mon Apr 07 10:44:06 2008 -0700
15.2 +++ b/src/helper/on-off-helper.h Mon Apr 07 18:29:38 2008 -0700
15.3 @@ -34,13 +34,9 @@
15.4 class OnOffHelper
15.5 {
15.6 public:
15.7 - OnOffHelper ();
15.8 + OnOffHelper (std::string protocol, Address address);
15.9
15.10 - void SetUdpRemote (Ipv4Address ip, uint16_t port);
15.11 - void SetTcpRemote (Ipv4Address ip, uint16_t port);
15.12 - void SetPacketRemote (Ptr<NetDevice> source, Address destination, uint16_t protocol);
15.13 -
15.14 - void SetAppAttribute (std::string name, Attribute value);
15.15 + void SetAttribute (std::string name, Attribute value);
15.16
15.17 ApplicationContainer Install (NodeContainer c);
15.18
16.1 --- a/src/helper/packet-sink-helper.cc Mon Apr 07 10:44:06 2008 -0700
16.2 +++ b/src/helper/packet-sink-helper.cc Mon Apr 07 18:29:38 2008 -0700
16.3 @@ -23,12 +23,22 @@
16.4
16.5 namespace ns3 {
16.6
16.7 -PacketSinkHelper::PacketSinkHelper ()
16.8 +PacketSinkHelper::PacketSinkHelper (std::string protocol, Address address)
16.9 {
16.10 m_factory.SetTypeId ("ns3::PacketSink");
16.11 + m_factory.Set ("Protocol", String(protocol));
16.12 + m_factory.Set ("Local", address);
16.13 }
16.14
16.15 void
16.16 +PacketSinkHelper::SetAttribute (std::string name, Attribute value)
16.17 +{
16.18 + m_factory.Set (name, value);
16.19 +}
16.20 +
16.21 +
16.22 +#if 0
16.23 +void
16.24 PacketSinkHelper::SetUdpLocal (Ipv4Address ip, uint16_t port)
16.25 {
16.26 m_factory.Set ("Protocol", String ("ns3::Udp"));
16.27 @@ -40,6 +50,7 @@
16.28 m_factory.Set ("Protocol", String ("ns3::Tcp"));
16.29 m_factory.Set ("Local", Address (InetSocketAddress (ip, port)));
16.30 }
16.31 +#endif
16.32
16.33 ApplicationContainer
16.34 PacketSinkHelper::Install (NodeContainer c)
17.1 --- a/src/helper/packet-sink-helper.h Mon Apr 07 10:44:06 2008 -0700
17.2 +++ b/src/helper/packet-sink-helper.h Mon Apr 07 18:29:38 2008 -0700
17.3 @@ -30,10 +30,9 @@
17.4 class PacketSinkHelper
17.5 {
17.6 public:
17.7 - PacketSinkHelper ();
17.8 + PacketSinkHelper (std::string protocol, Address address);
17.9
17.10 - void SetUdpLocal (Ipv4Address ip, uint16_t port);
17.11 - void SetTcpLocal (Ipv4Address ip, uint16_t port);
17.12 + void SetAttribute (std::string name, Attribute value);
17.13
17.14 ApplicationContainer Install (NodeContainer c);
17.15 private: