rework app constructors
authorCraig Dowell <craigdo@ee.washington.edu>
Mon, 07 Apr 2008 18:29:38 -0700
changeset 2890 172baa5960ff
parent 2889 969d4f6ab9ba
child 2891 aeca90b95bf5
rework app constructors
examples/csma-broadcast.cc
examples/csma-multicast.cc
examples/csma-one-subnet.cc
examples/csma-packet-socket.cc
examples/mixed-global-routing.cc
examples/simple-alternate-routing.cc
examples/simple-error-model.cc
examples/simple-global-routing.cc
examples/simple-point-to-point-olsr.cc
examples/tcp-large-transfer.cc
examples/wifi-adhoc.cc
examples/wifi-ap.cc
src/helper/node-container.h
src/helper/on-off-helper.cc
src/helper/on-off-helper.h
src/helper/packet-sink-helper.cc
src/helper/packet-sink-helper.h
--- a/examples/csma-broadcast.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/csma-broadcast.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -33,8 +33,9 @@
 #include <cassert>
 
 #include "ns3/core-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/simulator-module.h"
 
 using namespace ns3;
 
@@ -94,10 +95,10 @@
   // Create the OnOff application to send UDP datagrams of size
   // 512 bytes (default) at a rate of 500 Kb/s (default) from n0
   NS_LOG_INFO ("Create Applications.");
-  OnOffHelper onoff;
-  onoff.SetUdpRemote (Ipv4Address ("255.255.255.255"), port);
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
+  OnOffHelper onoff ("ns3::Udp", 
+    Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
 
   ApplicationContainer app = onoff.Install (c0.Get (0));
   // Start the application
@@ -105,12 +106,11 @@
   app.Stop (Seconds (10.0));
   
   // Create an optional packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   sink.Install (c0.Get (1));
   sink.Install (c1.Get (1));
 
-
   // Also configure some tcpdump traces; each interface will be traced
   // The output files will be named 
   // csma-broadcast.pcap-<nodeId>-<interfaceId>
--- a/examples/csma-multicast.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/csma-multicast.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -33,8 +33,9 @@
 #include <fstream>
 
 #include "ns3/core-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/simulator-module.h"
 
 using namespace ns3;
 
@@ -140,12 +141,12 @@
 
   // Configure a multicast packet generator that generates a packet
   // every few seconds
-  OnOffHelper onoff;
-  onoff.SetUdpRemote (multicastGroup, multicastPort);
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetAppAttribute ("DataRate", DataRate ("255b/s"));
-  onoff.SetAppAttribute ("PacketSize", Uinteger (128));
+  OnOffHelper onoff ("ns3::Udp", 
+    Address (InetSocketAddress (multicastGroup, multicastPort)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+  onoff.SetAttribute ("DataRate", DataRate ("255b/s"));
+  onoff.SetAttribute ("PacketSize", Uinteger (128));
 
   ApplicationContainer srcC = onoff.Install (c0.Get (0));
 
@@ -156,8 +157,9 @@
   srcC.Stop (Seconds(10.));
 
   // Create an optional packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny(), multicastPort);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny(), multicastPort)));
+
   ApplicationContainer sinkC = sink.Install (c1.Get (2)); // Node n4 
   // Start the sink
   sinkC.Start (Seconds (1.0));
--- a/examples/csma-one-subnet.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/csma-one-subnet.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -29,6 +29,7 @@
 #include <fstream>
 
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/core-module.h"
 #include "ns3/helper-module.h"
 
@@ -94,10 +95,10 @@
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
 
-  OnOffHelper onoff;
-  onoff.SetUdpRemote (Ipv4Address ("10.1.1.2"), port);
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
+  OnOffHelper onoff ("ns3::Udp", 
+    Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
 
   ApplicationContainer app = onoff.Install (c.Get (0));
   // Start the application
@@ -105,14 +106,15 @@
   app.Stop (Seconds (10.0));
 
   // Create an optional packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   sink.Install (c.Get (1));
 
 // 
 // Create a similar flow from n3 to n0, starting at time 1.1 seconds
 //
-  onoff.SetUdpRemote (Ipv4Address("10.1.1.1"), port);
+  onoff.SetAttribute ("Remote", 
+    Address (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
   ApplicationContainer app2 = onoff.Install (c.Get (3));
 
   sink.Install (c.Get (0));
--- a/examples/csma-packet-socket.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/csma-packet-socket.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -35,6 +35,7 @@
 
 #include "ns3/core-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 
 #include "ns3/ascii-trace.h"
@@ -80,16 +81,23 @@
 
   NS_LOG_INFO ("Create Applications.");
   // Create the OnOff application to send raw datagrams
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1.0));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0.0));
-  onoff.SetPacketRemote (devs.Get (0), devs.Get (1)->GetAddress (), 2);
+  PacketSocketAddress socket;
+  socket.SetSingleDevice(devs.Get (0)->GetIfIndex ());
+  socket.SetPhysicalAddress (devs.Get (1)->GetAddress ());
+  socket.SetProtocol (2);
+  OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1.0));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
   
-
-  onoff.SetPacketRemote (devs.Get (3), devs.Get (0)->GetAddress (), 3);
+  socket.SetSingleDevice (devs.Get (3)->GetIfIndex ());
+  socket.SetPhysicalAddress (devs.Get (0)->GetAddress ());
+  socket.SetProtocol (3);
+  onoff.SetAttribute ("Remote", Address (socket));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0.0));
   apps = onoff.Install (c.Get (3));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
--- a/examples/mixed-global-routing.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/mixed-global-routing.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -37,8 +37,9 @@
 #include <cassert>
 
 #include "ns3/core-module.h"
+#include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
-#include "ns3/simulator-module.h"
 #include "ns3/ascii-trace.h"
 #include "ns3/pcap-trace.h"
 #include "ns3/global-route-manager.h"
@@ -50,37 +51,6 @@
 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 ("MixedGlobalRoutingExample", LOG_LEVEL_INFO);
-
-  LogComponentEnable("Object", LOG_LEVEL_ALL);
-  LogComponentEnable("Queue", LOG_LEVEL_ALL);
-  LogComponentEnable("DropTailQueue", LOG_LEVEL_ALL);
-  LogComponentEnable("Channel", LOG_LEVEL_ALL);
-  LogComponentEnable("CsmaChannel", LOG_LEVEL_ALL);
-  LogComponentEnable("NetDevice", LOG_LEVEL_ALL);
-  LogComponentEnable("CsmaNetDevice", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("PacketSocket", LOG_LEVEL_ALL);
-  LogComponentEnable("Socket", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpSocket", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpL4Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4L3Protocol", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4StaticRouting", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4Interface", LOG_LEVEL_ALL);
-  LogComponentEnable("ArpIpv4Interface", LOG_LEVEL_ALL);
-  LogComponentEnable("Ipv4LoopbackInterface", LOG_LEVEL_ALL);
-  LogComponentEnable("OnOffApplication", LOG_LEVEL_ALL);
-  LogComponentEnable("PacketSinkApplication", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_ALL);
-  LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_ALL);
-#endif
-  // Set up some default values for the simulation.  Use the Bind ()
-
-
   Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
   Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
 
@@ -142,12 +112,13 @@
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetAppAttribute ("DataRate", DataRate("300bps"));
-  onoff.SetAppAttribute ("PacketSize", Uinteger (50));
-  onoff.SetUdpRemote (i5i6.GetAddress (1), port);
+  OnOffHelper onoff ("ns3::Udp",
+    Address (InetSocketAddress (i5i6.GetAddress (1), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+  onoff.SetAttribute ("DataRate", DataRate("300bps"));
+  onoff.SetAttribute ("PacketSize", Uinteger (50));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
--- a/examples/simple-alternate-routing.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/simple-alternate-routing.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -39,6 +39,7 @@
 
 #include "ns3/core-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/global-route-manager.h"
 
@@ -140,17 +141,18 @@
   uint16_t port = 9;   // Discard port (RFC 863)
 
   // Create a flow from n3 to n1, starting at time 1.1 seconds
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetUdpRemote (i1i2.GetAddress (0), port);
+  OnOffHelper onoff ("ns3::Udp",
+    Address (InetSocketAddress (i1i2.GetAddress (0), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+
   ApplicationContainer apps = onoff.Install (c.Get (3));
   apps.Start (Seconds (1.1));
   apps.Start (Seconds (10.0));
 
   // Create a packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (1));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));
@@ -160,7 +162,6 @@
   PointToPointHelper::EnablePcap ("simple-alternate-routing");
   PointToPointHelper::EnableAscii (ascii);
 
-
   NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();
   Simulator::Destroy ();
--- a/examples/simple-error-model.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/simple-error-model.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -42,6 +42,7 @@
 #include "ns3/core-module.h"
 #include "ns3/common-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/global-route-manager.h"
 
@@ -120,29 +121,33 @@
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
-  OnOffHelper onoff;
-  onoff.SetUdpRemote (i3i2.GetAddress (1), port);
-  onoff.SetAppAttribute ("OnTime", ConstantVariable(1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable(0));
+
+  OnOffHelper onoff ("ns3::Udp",
+    Address (InetSocketAddress (i3i2.GetAddress (1), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable(1));
+  onoff.SetAttribute ("OffTime", ConstantVariable(0));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start(Seconds(1.0));
   apps.Stop (Seconds(10.0));
 
   // Create an optional packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (3));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a similar flow from n3 to n1, starting at time 1.1 seconds
-  onoff.SetUdpRemote (i1i2.GetAddress (0), port);
+  onoff.SetAttribute ("Remote", 
+    Address (InetSocketAddress (i1i2.GetAddress (0), port)));
   apps = onoff.Install (c.Get (3));
   apps.Start(Seconds(1.1));
   apps.Stop (Seconds(10.0));
 
   // Create a packet sink to receive these packets
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  sink.SetAttribute ("Local", 
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (1));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));
--- a/examples/simple-global-routing.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/simple-global-routing.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -44,6 +44,7 @@
 
 #include "ns3/core-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 #include "ns3/global-route-manager.h"
 
@@ -121,23 +122,24 @@
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetUdpRemote (i3i2.GetAddress (0), port);
+  OnOffHelper onoff ("ns3::Udp", 
+    Address (InetSocketAddress (i3i2.GetAddress (0), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
   apps = sink.Install (c.Get (3));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a similar flow from n3 to n1, starting at time 1.1 seconds
-  onoff.SetUdpRemote (i1i2.GetAddress (0), port);
+  onoff.SetAttribute ("Remote", 
+    Address (InetSocketAddress (i1i2.GetAddress (0), port)));
   apps = onoff.Install (c.Get (3));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));
--- a/examples/simple-point-to-point-olsr.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/simple-point-to-point-olsr.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -44,6 +44,7 @@
 
 #include "ns3/core-module.h"
 #include "ns3/simulator-module.h"
+#include "ns3/node-module.h"
 #include "ns3/helper-module.h"
 
 using namespace ns3;
@@ -125,23 +126,27 @@
   // 210 bytes at a rate of 448 Kb/s
   NS_LOG_INFO ("Create Applications.");
   uint16_t port = 9;   // Discard port (RFC 863)
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetUdpRemote (i34.GetAddress (1), port);
+
+  OnOffHelper onoff ("ns3::Udp", 
+    Address (InetSocketAddress (i34.GetAddress (1), port)));
+  onoff.SetAttribute ("OnTime", ConstantVariable (1));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
+  PacketSinkHelper sink ("ns3::Udp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
+
   apps = sink.Install (c.Get (3));
   apps.Start (Seconds (1.0));
   apps.Stop (Seconds (10.0));
 
   // Create a similar flow from n3 to n1, starting at time 1.1 seconds
-  onoff.SetUdpRemote (i12.GetAddress (0), port);
+  onoff.SetAttribute ("Remote",
+    Address (InetSocketAddress (i12.GetAddress (0), port)));
   apps = onoff.Install (c.Get (3));
   apps.Start (Seconds (1.1));
   apps.Stop (Seconds (10.0));
--- a/examples/tcp-large-transfer.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/tcp-large-transfer.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -169,8 +169,9 @@
   uint16_t servPort = 50000;
 
   // Create a packet sink to receive these packets
-  PacketSinkHelper sink;
-  sink.SetTcpLocal (Ipv4Address::GetAny (), servPort);
+  PacketSinkHelper sink ("ns3::Tcp",
+    Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)));
+
   ApplicationContainer apps = sink.Install (c1.Get (1));
   apps.Start (Seconds (0.0));
 
--- a/examples/wifi-adhoc.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/wifi-adhoc.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -128,12 +128,17 @@
 
   mobility.Layout (c);
 
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (250));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetAppAttribute ("DataRate", DataRate (60000000));
-  onoff.SetAppAttribute ("PacketSize", Uinteger (2000));
-  onoff.SetPacketRemote (devices.Get (0), devices.Get (1)->GetAddress (), 1);
+  PacketSocketAddress socket;
+  socket.SetSingleDevice(devices.Get (0)->GetIfIndex ());
+  socket.SetPhysicalAddress (devices.Get (1)->GetAddress ());
+  socket.SetProtocol (1);
+
+  OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
+  onoff.SetAttribute ("OnTime", ConstantVariable (250));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+  onoff.SetAttribute ("DataRate", DataRate (60000000));
+  onoff.SetAttribute ("PacketSize", Uinteger (2000));
+
   ApplicationContainer apps = onoff.Install (c.Get (0));
   apps.Start (Seconds (0.5));
   apps.Stop (Seconds (250.0));
--- a/examples/wifi-ap.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/examples/wifi-ap.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -156,10 +156,15 @@
 
   Simulator::Schedule (Seconds (1.0), &AdvancePosition, ap.Get (0));
 
-  OnOffHelper onoff;
-  onoff.SetAppAttribute ("OnTime", ConstantVariable (42));
-  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
-  onoff.SetPacketRemote (staDevs.Get (0), staDevs.Get (1)->GetAddress (), 1);
+  PacketSocketAddress socket;
+  socket.SetSingleDevice(staDevs.Get (0)->GetIfIndex ());
+  socket.SetPhysicalAddress (staDevs.Get (1)->GetAddress ());
+  socket.SetProtocol (1);
+
+  OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
+  onoff.SetAttribute ("OnTime", ConstantVariable (42));
+  onoff.SetAttribute ("OffTime", ConstantVariable (0));
+
   ApplicationContainer apps = onoff.Install (stas.Get (0));
   apps.Start (Seconds (0.5));
   apps.Stop (Seconds (43.0));
--- a/src/helper/node-container.h	Mon Apr 07 10:44:06 2008 -0700
+++ b/src/helper/node-container.h	Mon Apr 07 18:29:38 2008 -0700
@@ -51,6 +51,14 @@
    *
    * Create a node container which is a concatenation of the two input
    * NodeContainers.
+   *
+   * \note A frequently seen idiom that uses these constructors involves the
+   * implicit conversion by constructor of Ptr<Node>.  When used, two 
+   * Ptr<Node> will be passed to this constructor instead of NodeContainer&.
+   * C++ will notice the implicit conversion path that goes through the 
+   * NodeContainer (Ptr<Node> node) constructor above.  Using this conversion
+   * one may provide optionally provide arguments of Ptr<Node> to these 
+   * constructors.
    */
   NodeContainer (const NodeContainer &a, const NodeContainer &b);
 
--- a/src/helper/on-off-helper.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/src/helper/on-off-helper.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -24,36 +24,15 @@
 
 namespace ns3 {
 
-OnOffHelper::OnOffHelper ()
+OnOffHelper::OnOffHelper (std::string protocol, Address address)
 {
   m_factory.SetTypeId ("ns3::OnOffApplication");
+  m_factory.Set ("Protocol", String(protocol));
+  m_factory.Set ("Remote", address);
 }
 
 void 
-OnOffHelper::SetUdpRemote (Ipv4Address ip, uint16_t port)
-{
-  m_factory.Set ("Protocol", String ("ns3::Udp"));
-  m_factory.Set ("Remote", Address (InetSocketAddress (ip, port)));
-}
-void 
-OnOffHelper::SetTcpRemote (Ipv4Address ip, uint16_t port)
-{
-  m_factory.Set ("Protocol", String ("ns3::Tcp"));
-  m_factory.Set ("Remote", Address (InetSocketAddress (ip, port)));
-}
-void 
-OnOffHelper::SetPacketRemote (Ptr<NetDevice> source, Address destination, uint16_t protocol)
-{
-  PacketSocketAddress packet;
-  packet.SetSingleDevice (source->GetIfIndex ());
-  packet.SetPhysicalAddress (destination);
-  packet.SetProtocol (protocol);
-  m_factory.Set ("Protocol", String ("ns3::PacketSocketFactory"));
-  m_factory.Set ("Remote", Address (packet));
-}
-  
-void 
-OnOffHelper::SetAppAttribute (std::string name, Attribute value)
+OnOffHelper::SetAttribute (std::string name, Attribute value)
 {
   m_factory.Set (name, value);
 }
--- a/src/helper/on-off-helper.h	Mon Apr 07 10:44:06 2008 -0700
+++ b/src/helper/on-off-helper.h	Mon Apr 07 18:29:38 2008 -0700
@@ -34,13 +34,9 @@
 class OnOffHelper
 {
 public:
-  OnOffHelper ();
+  OnOffHelper (std::string protocol, Address address);
 
-  void SetUdpRemote (Ipv4Address ip, uint16_t port);
-  void SetTcpRemote (Ipv4Address ip, uint16_t port);
-  void SetPacketRemote (Ptr<NetDevice> source, Address destination, uint16_t protocol);
-  
-  void SetAppAttribute (std::string name, Attribute value);
+  void SetAttribute (std::string name, Attribute value);
 
   ApplicationContainer Install (NodeContainer c);
 
--- a/src/helper/packet-sink-helper.cc	Mon Apr 07 10:44:06 2008 -0700
+++ b/src/helper/packet-sink-helper.cc	Mon Apr 07 18:29:38 2008 -0700
@@ -23,12 +23,22 @@
 
 namespace ns3 {
 
-PacketSinkHelper::PacketSinkHelper ()
+PacketSinkHelper::PacketSinkHelper (std::string protocol, Address address)
 {
   m_factory.SetTypeId ("ns3::PacketSink");
+  m_factory.Set ("Protocol", String(protocol));
+  m_factory.Set ("Local", address);
 }
 
 void 
+PacketSinkHelper::SetAttribute (std::string name, Attribute value)
+{
+  m_factory.Set (name, value);
+}
+
+
+#if 0
+void 
 PacketSinkHelper::SetUdpLocal (Ipv4Address ip, uint16_t port)
 {
   m_factory.Set ("Protocol", String ("ns3::Udp"));
@@ -40,6 +50,7 @@
   m_factory.Set ("Protocol", String ("ns3::Tcp"));
   m_factory.Set ("Local", Address (InetSocketAddress (ip, port)));
 }
+#endif
 
 ApplicationContainer 
 PacketSinkHelper::Install (NodeContainer c)
--- a/src/helper/packet-sink-helper.h	Mon Apr 07 10:44:06 2008 -0700
+++ b/src/helper/packet-sink-helper.h	Mon Apr 07 18:29:38 2008 -0700
@@ -30,10 +30,9 @@
 class PacketSinkHelper
 {
 public:
-  PacketSinkHelper ();
+  PacketSinkHelper (std::string protocol, Address address);
 
-  void SetUdpLocal (Ipv4Address ip, uint16_t port);
-  void SetTcpLocal (Ipv4Address ip, uint16_t port);
+  void SetAttribute (std::string name, Attribute value);
 
   ApplicationContainer Install (NodeContainer c);
 private: