--- a/examples/simple-global-routing.cc Tue Feb 26 23:27:19 2008 +0100
+++ b/examples/simple-global-routing.cc Wed Feb 27 00:05:23 2008 +0100
@@ -48,6 +48,8 @@
#include "ns3/default-value.h"
#include "ns3/ptr.h"
#include "ns3/random-variable.h"
+#include "ns3/config.h"
+#include "ns3/uinteger.h"
#include "ns3/simulator.h"
#include "ns3/nstime.h"
@@ -110,8 +112,8 @@
// instantiate, when the queue factory is invoked in the topology code
DefaultValue::Bind ("Queue", "DropTailQueue");
- DefaultValue::Bind ("OnOffApplicationPacketSize", "210");
- DefaultValue::Bind ("OnOffApplicationDataRate", "448kb/s");
+ Config::SetDefault ("OnOffApplication::PacketSize", Uinteger (210));
+ Config::SetDefault ("OnOffApplication::DataRate", MakeDataRate ("448kb/s"));
//DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);
@@ -163,42 +165,45 @@
// 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> (
- n0,
- InetSocketAddress ("10.1.3.2", port),
- "Udp",
- ConstantVariable (1),
- ConstantVariable (0));
+ Ptr<OnOffApplication> ooff =
+ CreateObjectWith<OnOffApplication> ("Node", n0,
+ "Remote", Address (InetSocketAddress ("10.1.3.2", port)),
+ "Protocol", TypeId::LookupByName ("Udp"),
+ "OnTime", ConstantVariable (1),
+ "OffTime", ConstantVariable (0));
+ n0->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.0));
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
// The last argument "true" disables output from the Receive callback
- Ptr<PacketSink> sink = CreateObject<PacketSink> (
- n3,
- InetSocketAddress (Ipv4Address::GetAny (), port),
- "Udp");
+ Ptr<PacketSink> sink =
+ CreateObjectWith<PacketSink> ("Node", n3,
+ "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
+ "Protocol", TypeId::LookupByName ("Udp"));
+ n3->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.0));
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = CreateObject<OnOffApplication> (
- n3,
- InetSocketAddress ("10.1.2.1", port),
- "Udp",
- ConstantVariable (1),
- ConstantVariable (0));
+ ooff = CreateObjectWith<OnOffApplication> (
+ "Node", n3,
+ "Remote", Address (InetSocketAddress ("10.1.2.1", port)),
+ "Protocol", TypeId::LookupByName ("Udp"),
+ "OnTime", ConstantVariable (1),
+ "OffTime", ConstantVariable (0));
+ n3->AddApplication (ooff);
// Start the application
ooff->Start (Seconds (1.1));
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
- sink = CreateObject<PacketSink> (
- n1,
- InetSocketAddress (Ipv4Address::GetAny (), port),
- "Udp");
+ sink = CreateObjectWith<PacketSink> ("Node", n1,
+ "Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
+ "Protocol", TypeId::LookupByName ("Udp"));
+ n1->AddApplication (sink);
// Start the sink
sink->Start (Seconds (1.1));
sink->Stop (Seconds (10.0));